Skip to content

Commit d7999a5

Browse files
committed
Further ship ownership data
1 parent 516c41b commit d7999a5

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

nmspy/data/types.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ class cGcPlayerState(Structure):
247247
muUnits: Annotated[int, Field(c_uint32, 0x1BC)]
248248
muNanites: Annotated[int, Field(c_uint32, 0x1C0)]
249249
muSpecials: Annotated[int, Field(c_uint32, 0x1C4)]
250+
# Found in cGcPlayerShipOwnership::SpawnNewShip
251+
miPrimaryShip: Annotated[int, Field(c_uint32, 0xC4F0)]
250252

251253
@function_hook(
252254
"48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC ? 44 8B 81 ? ? ? ? 48 8D 2D"
@@ -276,9 +278,12 @@ def StoreCurrentSystemSpaceStationEndpoint(
276278

277279
@partial_struct
278280
class cGcPlayerShipOwnership(Structure):
279-
# Both these found at the top of cGcPlayerShipOwnership::UpdateMeshRefresh
280-
mbShouldRefreshMesh: Annotated[bool, Field(c_bool, 0xA690)]
281-
mMeshRefreshState: Annotated[int, Field(c_uint32, 0xA694)]
281+
282+
@partial_struct
283+
class sGcShipData(Structure):
284+
_total_size_ = 0x48
285+
286+
mPlayerShipSeed: Annotated[basic.cTkSeed, 0x0]
282287

283288
@function_hook(
284289
"48 89 5C 24 ? 55 56 57 41 54 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 45"
@@ -294,6 +299,31 @@ def Update(
294299
lfTimestep: Annotated[float, c_float],
295300
): ...
296301

302+
@function_hook("44 89 44 24 ? 48 89 54 24 ? 55 56 41 54 41 56 41 57 48 8D 6C 24")
303+
def SpawnNewShip(
304+
self,
305+
this: "_Pointer[cGcPlayerShipOwnership]",
306+
lMatrix: _Pointer[basic.cTkMatrix34],
307+
leLandingGearState: c_uint32, # cGcPlayerShipOwnership::ShipSpawnLandingGearState
308+
liShipIndex: c_int32,
309+
lbSpawnShipOverride: c_bool,
310+
) -> c_bool:
311+
...
312+
313+
@function_hook("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 41 56 48 83 EC ? 48 8B 35 ? ? ? ? 8B DA")
314+
def DestroyShip(
315+
self,
316+
this: "_Pointer[cGcPlayerShipOwnership]",
317+
liShipIndex: c_int32,
318+
) -> c_bool:
319+
...
320+
321+
# Not sure about this...
322+
mShips: Annotated[list[sGcShipData], Field(sGcShipData * 12, 0x58)]
323+
# Both these found at the top of cGcPlayerShipOwnership::UpdateMeshRefresh
324+
mbShouldRefreshMesh: Annotated[bool, Field(c_bool, 0xA690)]
325+
mMeshRefreshState: Annotated[int, Field(c_uint32, 0xA694)]
326+
297327

298328
@partial_struct
299329
class cGcGameState(Structure):

tools/data.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,5 +758,15 @@
758758
"name": "cGcGameState::Update",
759759
"signature": "48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 55 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? F3 0F 10 91",
760760
"mangled_name": "?Update@cGcGameState@@QEAAXM@Z"
761+
},
762+
{
763+
"name": "cGcPlayerShipOwnership::SpawnNewShip",
764+
"signature": "44 89 44 24 ? 48 89 54 24 ? 55 56 41 54 41 56 41 57 48 8D 6C 24",
765+
"mangled_name": "?SpawnNewShip@cGcPlayerShipOwnership@@QEAA_NAEBVcTkMatrix34@@W4ShipSpawnLandingGearState@1@H_N@Z"
766+
},
767+
{
768+
"name": "cGcPlayerShipOwnership::DestroyShip",
769+
"signature": "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 41 56 48 83 EC ? 48 8B 35 ? ? ? ? 8B DA",
770+
"mangled_name": "?DestroyShip@cGcPlayerShipOwnership@@QEAA_NH@Z"
761771
}
762772
]

0 commit comments

Comments
 (0)