From 2ed05d46aacc3afdf54935428190b05d860f1008 Mon Sep 17 00:00:00 2001 From: ThatBomberDev <80880503+ThatBomberDev@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:59:19 -0500 Subject: [PATCH 1/3] Initial Documentation --- nmspy/data/types.py | 130 ++++++++++++++++++++++++++++++++++++++++---- tools/data.json | 5 ++ 2 files changed, 125 insertions(+), 10 deletions(-) diff --git a/nmspy/data/types.py b/nmspy/data/types.py index a81511f..96383ce 100644 --- a/nmspy/data/types.py +++ b/nmspy/data/types.py @@ -667,7 +667,10 @@ def GenerateSolarSystemName( lu64Seed: c_uint64, lResult: _Pointer[basic.cTkFixedString[0x7F]], lLocResult: _Pointer[basic.cTkFixedString[0x7F]], - ) -> c_uint64: ... + ) -> c_uint64: + """Returns the name for a SolarSystem, given it's seed. SolarSystem seeds are the same as their UA's. + """ + ... @partial_struct @@ -1035,7 +1038,11 @@ def PackageTechnology( "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 8B 05 ? ? ? ? 48 8B F1 85 C0 74 ? 83 F8 ? 0F 85 ? ? ? ? " "4C 8B 05" ) - def IsBlockedFromShipPurchase(self, this: "_Pointer[cGcPlayerState]") -> Annotated[bool, c_bool]: ... + def IsBlockedFromShipPurchase(self, this: "_Pointer[cGcPlayerState]") -> Annotated[bool, c_bool]: + """Determines whether the player is blocked from ship purchases or not. Active during certain + expeditions. Modify the return value in an .after hook to enable / disable in game. + """ + ... @function_hook("4C 8B DC 49 89 4B ? 53 48 81 EC ? ? ? ? 49 89 6B") def CanRepairTechnology( @@ -1044,7 +1051,16 @@ def CanRepairTechnology( lItem: _Pointer[nmse.cGcInventoryElement], leInventory: c_enum32[enums.InventoryChoice], lbIsInstallation: Annotated[bool, c_bool], - ) -> Annotated[bool, c_bool]: ... + ) -> Annotated[bool, c_bool]: + """Determines whether the player can repair the component corresponing to `lItem` in a maintenance + screen. Modify the return value in an .after hook to enable / disable in game. + + Parameters + ---------- + lItem + A Pointer to cGcInventoryElement. + """ + ... @function_hook( "8B 05 ? ? ? ? 85 C0 74 ? 83 F8 ? 75 ? 48 8B 05 ? ? ? ? 80 B8 ? ? ? ? ? 75 ? 80 B8 ? ? ? ? ? 75 ? 32 " @@ -1679,6 +1695,14 @@ def SetFacing(self, this: "_Pointer[cGcPlayer]", lDir: _Pointer[basic.cTkVector3 @function_hook("40 55 53 56 57 41 54 41 55 48 8D AC 24") def UpdateAction(self, this: "_Pointer[cGcPlayer]", lfStep: Annotated[float, c_float]): ... + @function_hook("40 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 8B F9") + def ResetInSpaceStation(self, this: _Pointer[cGcPlayer]) -> None: + """ Fades the screen out and sets the player position to the space station spawn point, + displaying an OSD message. + + """ + ... + class cGcPlanetGenerationInputData(nmse.cGcPlanetGenerationInputData): @function_hook( @@ -2762,9 +2786,12 @@ def RenderPage(self, this: "_Pointer[cGcFrontendManager]"): ... def Activate( self, this: "_Pointer[cGcFrontendManager]", - lePage: Annotated[int, c_uint32], # eFrontendPage + lePage: c_enum32[enums.eFrontendPage], lbTransitionRight: Annotated[bool, c_bool], ) -> c_bool: ... + """"Activate and display a FrontendPage on top of the user UI corresponding to lePage. + + """ @function_hook( "48 8B C4 48 89 58 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 44 0F 29 90" @@ -2784,6 +2811,9 @@ def ShowMesssageBox( lMessage: _Pointer[basic.TkID0x20], lbSomething: Annotated[bool, c_bool], ): ... + """ + Display a simple message box on top of an activated FrontendPage only. Does NOT displpay over the player HUD. + """ @function_hook("48 8B C4 53 48 81 EC ? ? ? ? 48 89 68 ? 48 8B D9 8B 89") def LoadPage(self, this: "_Pointer[cGcFrontendManager]", lePage: c_enum32[enums.eFrontendPage]): ... @@ -5580,7 +5610,11 @@ def SetWantedLevel( liLevel: Annotated[int, c_int16], lbForce: Annotated[bool, c_bool], lbSquadDefeated: Annotated[bool, c_bool], - ): ... + ): + """Set the player wanted level to the specified `liLevel`. Can also be used to disable + sentinels. + """ + ... class cGcFrontendPageClaimBase(Structure): @@ -5647,7 +5681,12 @@ def OnAttached(self, this: "_Pointer[cGcPortalComponent]"): ... def Prepare(self, this: "_Pointer[cGcPortalComponent]"): ... @function_hook("40 55 41 56 48 8D 6C 24 ? 48 81 EC ? ? ? ? 80 B9") - def WarpPlayer(self, this: "_Pointer[cGcPortalComponent]"): ... + def WarpPlayer(self, this: "_Pointer[cGcPortalComponent]"): + """Warps the player to this cGcPortalComponent::PersistentData's mTargetUA, + if mbActive is set to true. + + """ + ... class cGcApplicationDeathState(Structure): @@ -5662,7 +5701,22 @@ def Encode( lpPosition: _Pointer[basic.cTkVector3], lpCameraDirection: _Pointer[basic.cTkVector3], lResult: _Pointer[c_uint64 * 2], - ) -> c_uint64: ... + ) -> c_uint64: + """ + Converts a position and view vector into a size-2 uint64 array, which can be converted into a usable Hexadecimal String. + + Parameters + ---------- + lpPosition + A pointer to the Position Vector3f to encode. + lpCameraDirection + A pointer to the Camera View Vector3f to encode. + lResult + A size-2 uint64 array which holds both encoded parts of the UDA. This is empty when called. + + """ + ... + @static_function_hook("48 8B C4 53 48 81 EC ? ? ? ? 0F 10 1A 0F 57 C9") @staticmethod @@ -5670,7 +5724,20 @@ def Decode( lValue: _Pointer[c_uint64 * 2], lpPosition: _Pointer[basic.cTkVector3], lpCameraDirection: _Pointer[basic.cTkVector3], - ): ... + ): + """ + Converts a size-2 uint64 array into a position and view vector. + + Parameters + ---------- + lpPosition + A pointer to the Position Vector3f to encode. This is an empty vector when called. + lpCameraDirection + A pointer to the Camera View Vector3f to encode. This is an empty vector when called. + lValue + A size-2 uint64 array which holds both encoded parts of the UDA. + """ + ... @partial_struct @@ -5708,6 +5775,19 @@ def AddPermanentEffect( lExplosionID: _Pointer[basic.TkID0x10], lStartMatrix: _Pointer[basic.cTkMatrix34], ) -> c_uint64: # Pointer to EffectInstance + """Enqueue a Permanent Particle Effect by lExplosionID at position lStartMatrix. + + Parameters + ---------- + lExplosionID + The actual TkID0x10 for the effect, defined in METADATA/EFFECTS/*EFFECTS.MBIN + + Returns + ------- + c_uint64 + A Pointer to the EffectInstance added. Must be mapped using map_struct() to the correct type. + + """ ... @function_hook("4C 8B DC 49 89 5B ? 57 48 81 EC ? ? ? ? 48 8B 84 24 ? ? ? ? 48 8B DA 41 0F 10 00") @@ -5720,17 +5800,47 @@ def AddEffect_Internal( lStartMatrix: _Pointer[basic.cTkMatrix34], lbPermanent: Annotated[bool, c_bool], ) -> c_uint64: # Pointer to EffectInstance + """Enqueue a Particle Effect by lExplosionID and lParentNode at position lStartMatrix. + + Parameters + ---------- + lParentNode + A TkHandle for the actual effect .MBIN file + lExplosionID + The actual TkID0x10 for the effect, defined in METADATA/EFFECTS/*EFFECTS.MBIN + + Returns + ------- + c_uint64 + A Pointer to the EffectInstance added. Must be mapped using map_struct() to the correct type. + + """ + ... @function_hook("40 53 48 83 EC ? 8B 02 48 8B DA") def RetireEffect( self, this: "_Pointer[cGcParticleManager]", lEffect: _Pointer[EffectInstance] - ) -> c_bool: ... + ) -> c_bool: + """Ease out and retire an active Particle Effect by its EffectInstance. + """ + ... @function_hook("48 89 5C 24 ? 57 48 81 EC ? ? ? ? 44 8B C2") def RetireEffectsAndDestroyNodeOnCompletion( self, this: "_Pointer[cGcParticleManager]", lNode: basic.TkHandle - ): ... + ): + """Ease out and retire an active Particle Effect by its Handle. Also destroys the engine node + post-completion. + + Parameters + ---------- + lNode + a TkHandle for this particle's EffectInstance, NOT it's file. + + + """ + ... class cTkMetaDataManager(Structure): diff --git a/tools/data.json b/tools/data.json index 5ec4c63..5057ac6 100644 --- a/tools/data.json +++ b/tools/data.json @@ -2195,6 +2195,11 @@ "name": "cGcPlayerHUD::RenderHeadsUp", "signature": "40 55 56 48 8D 6C 24 ? 48 81 EC ? ? ? ? 8B 05", "mangled_name": "?RenderHeadsUp@cGcPlayerHUD@@QEAAXXZ" + }, + { + "name": "cGcPlayer::ResetInSpaceStation", + "signature": "40 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 8B F9", + "mangled_name": "__ZN9cGcPlayer19ResetInSpaceStationEv" } ], "global_objects": From 4f7bbe1dadec9d2a5b7799a3e1a5b8aa151ec01f Mon Sep 17 00:00:00 2001 From: ThatBomberDev <80880503+ThatBomberDev@users.noreply.github.com> Date: Mon, 2 Nov 2026 18:57:53 -0500 Subject: [PATCH 2/3] Linting fixes --- nmspy/data/types.py | 135 ++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 68 deletions(-) diff --git a/nmspy/data/types.py b/nmspy/data/types.py index 96383ce..ab4de83 100644 --- a/nmspy/data/types.py +++ b/nmspy/data/types.py @@ -667,9 +667,9 @@ def GenerateSolarSystemName( lu64Seed: c_uint64, lResult: _Pointer[basic.cTkFixedString[0x7F]], lLocResult: _Pointer[basic.cTkFixedString[0x7F]], - ) -> c_uint64: + ) -> c_uint64: """Returns the name for a SolarSystem, given it's seed. SolarSystem seeds are the same as their UA's. - """ + """ ... @@ -1038,10 +1038,10 @@ def PackageTechnology( "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 8B 05 ? ? ? ? 48 8B F1 85 C0 74 ? 83 F8 ? 0F 85 ? ? ? ? " "4C 8B 05" ) - def IsBlockedFromShipPurchase(self, this: "_Pointer[cGcPlayerState]") -> Annotated[bool, c_bool]: - """Determines whether the player is blocked from ship purchases or not. Active during certain + def IsBlockedFromShipPurchase(self, this: "_Pointer[cGcPlayerState]") -> Annotated[bool, c_bool]: + """Determines whether the player is blocked from ship purchases or not. Active during certain expeditions. Modify the return value in an .after hook to enable / disable in game. - """ + """ ... @function_hook("4C 8B DC 49 89 4B ? 53 48 81 EC ? ? ? ? 49 89 6B") @@ -1051,15 +1051,15 @@ def CanRepairTechnology( lItem: _Pointer[nmse.cGcInventoryElement], leInventory: c_enum32[enums.InventoryChoice], lbIsInstallation: Annotated[bool, c_bool], - ) -> Annotated[bool, c_bool]: - """Determines whether the player can repair the component corresponing to `lItem` in a maintenance + ) -> Annotated[bool, c_bool]: + """Determines whether the player can repair the component corresponing to `lItem` in a maintenance screen. Modify the return value in an .after hook to enable / disable in game. Parameters ---------- lItem - A Pointer to cGcInventoryElement. - """ + A Pointer to cGcInventoryElement. + """ ... @function_hook( @@ -1696,8 +1696,8 @@ def SetFacing(self, this: "_Pointer[cGcPlayer]", lDir: _Pointer[basic.cTkVector3 def UpdateAction(self, this: "_Pointer[cGcPlayer]", lfStep: Annotated[float, c_float]): ... @function_hook("40 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 8B F9") - def ResetInSpaceStation(self, this: _Pointer[cGcPlayer]) -> None: - """ Fades the screen out and sets the player position to the space station spawn point, + def ResetInSpaceStation(self, this: "_Pointer[cGcPlayer]") -> None: + """Fades the screen out and sets the player position to the space station spawn point, displaying an OSD message. """ @@ -2788,10 +2788,9 @@ def Activate( this: "_Pointer[cGcFrontendManager]", lePage: c_enum32[enums.eFrontendPage], lbTransitionRight: Annotated[bool, c_bool], - ) -> c_bool: ... - """"Activate and display a FrontendPage on top of the user UI corresponding to lePage. - - """ + ) -> c_bool: + """ "Activate and display a FrontendPage on top of the user UI corresponding to lePage.""" + ... @function_hook( "48 8B C4 48 89 58 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 44 0F 29 90" @@ -2810,10 +2809,12 @@ def ShowMesssageBox( lTitle: _Pointer[basic.TkID0x20], lMessage: _Pointer[basic.TkID0x20], lbSomething: Annotated[bool, c_bool], - ): ... - """ - Display a simple message box on top of an activated FrontendPage only. Does NOT displpay over the player HUD. - """ + ): + """ + Display a simple message box on top of an activated FrontendPage only. Does NOT + displpay over the player HUD. + """ + ... @function_hook("48 8B C4 53 48 81 EC ? ? ? ? 48 89 68 ? 48 8B D9 8B 89") def LoadPage(self, this: "_Pointer[cGcFrontendManager]", lePage: c_enum32[enums.eFrontendPage]): ... @@ -5610,9 +5611,9 @@ def SetWantedLevel( liLevel: Annotated[int, c_int16], lbForce: Annotated[bool, c_bool], lbSquadDefeated: Annotated[bool, c_bool], - ): + ): """Set the player wanted level to the specified `liLevel`. Can also be used to disable - sentinels. + sentinels. """ ... @@ -5681,10 +5682,10 @@ def OnAttached(self, this: "_Pointer[cGcPortalComponent]"): ... def Prepare(self, this: "_Pointer[cGcPortalComponent]"): ... @function_hook("40 55 41 56 48 8D 6C 24 ? 48 81 EC ? ? ? ? 80 B9") - def WarpPlayer(self, this: "_Pointer[cGcPortalComponent]"): - """Warps the player to this cGcPortalComponent::PersistentData's mTargetUA, + def WarpPlayer(self, this: "_Pointer[cGcPortalComponent]"): + """Warps the player to this cGcPortalComponent::PersistentData's mTargetUA, if mbActive is set to true. - + """ ... @@ -5703,20 +5704,20 @@ def Encode( lResult: _Pointer[c_uint64 * 2], ) -> c_uint64: """ - Converts a position and view vector into a size-2 uint64 array, which can be converted into a usable Hexadecimal String. - - Parameters - ---------- - lpPosition - A pointer to the Position Vector3f to encode. - lpCameraDirection - A pointer to the Camera View Vector3f to encode. - lResult - A size-2 uint64 array which holds both encoded parts of the UDA. This is empty when called. - - """ - ... + Converts a position and view vector into a size-2 uint64 array, which can be converted + into a usable Hexadecimal String. + Parameters + ---------- + lpPosition + A pointer to the Position Vector3f to encode. + lpCameraDirection + A pointer to the Camera View Vector3f to encode. + lResult + A size-2 uint64 array which holds both encoded parts of the UDA. This is empty when called. + + """ + ... @static_function_hook("48 8B C4 53 48 81 EC ? ? ? ? 0F 10 1A 0F 57 C9") @staticmethod @@ -5724,19 +5725,20 @@ def Decode( lValue: _Pointer[c_uint64 * 2], lpPosition: _Pointer[basic.cTkVector3], lpCameraDirection: _Pointer[basic.cTkVector3], - ): - """ - Converts a size-2 uint64 array into a position and view vector. - - Parameters - ---------- - lpPosition - A pointer to the Position Vector3f to encode. This is an empty vector when called. - lpCameraDirection - A pointer to the Camera View Vector3f to encode. This is an empty vector when called. - lValue - A size-2 uint64 array which holds both encoded parts of the UDA. - """ + ): + """ + Converts a size-2 uint64 array into a position and view vector. + + Parameters + ---------- + lpPosition + A pointer to the Position Vector3f to encode. This is an empty vector when called. + lpCameraDirection + A pointer to the Camera View Vector3f to encode. This is an empty vector when called. + lValue + A size-2 uint64 array which holds both encoded parts of the UDA. + """ + ... @@ -5780,14 +5782,14 @@ def AddPermanentEffect( Parameters ---------- lExplosionID - The actual TkID0x10 for the effect, defined in METADATA/EFFECTS/*EFFECTS.MBIN + The actual TkID0x10 for the effect, defined in METADATA/EFFECTS/*EFFECTS.MBIN Returns ------- c_uint64 - A Pointer to the EffectInstance added. Must be mapped using map_struct() to the correct type. - - """ + A Pointer to the EffectInstance added. Must be mapped using map_struct() to the correct type. + + """ ... @function_hook("4C 8B DC 49 89 5B ? 57 48 81 EC ? ? ? ? 48 8B 84 24 ? ? ? ? 48 8B DA 41 0F 10 00") @@ -5807,32 +5809,29 @@ def AddEffect_Internal( lParentNode A TkHandle for the actual effect .MBIN file lExplosionID - The actual TkID0x10 for the effect, defined in METADATA/EFFECTS/*EFFECTS.MBIN - + The actual TkID0x10 for the effect, defined in METADATA/EFFECTS/*EFFECTS.MBIN + Returns ------- c_uint64 - A Pointer to the EffectInstance added. Must be mapped using map_struct() to the correct type. - - """ - + A Pointer to the EffectInstance added. Must be mapped using map_struct() to the correct type. + + """ + ... @function_hook("40 53 48 83 EC ? 8B 02 48 8B DA") - def RetireEffect( - self, this: "_Pointer[cGcParticleManager]", lEffect: _Pointer[EffectInstance] - ) -> c_bool: - """Ease out and retire an active Particle Effect by its EffectInstance. - """ + def RetireEffect(self, this: "_Pointer[cGcParticleManager]", lEffect: _Pointer[EffectInstance]) -> c_bool: + """Ease out and retire an active Particle Effect by its EffectInstance.""" ... @function_hook("48 89 5C 24 ? 57 48 81 EC ? ? ? ? 44 8B C2") def RetireEffectsAndDestroyNodeOnCompletion( self, this: "_Pointer[cGcParticleManager]", lNode: basic.TkHandle - ): + ): """Ease out and retire an active Particle Effect by its Handle. Also destroys the engine node - post-completion. - + post-completion. + Parameters ---------- lNode From 1e5deec8e18cfa521b4156c582f5798a36d43275 Mon Sep 17 00:00:00 2001 From: ThatBomberDev <80880503+ThatBomberDev@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:16:42 -0500 Subject: [PATCH 3/3] Final Formatting Fix --- nmspy/data/types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nmspy/data/types.py b/nmspy/data/types.py index ab4de83..3e89892 100644 --- a/nmspy/data/types.py +++ b/nmspy/data/types.py @@ -668,7 +668,8 @@ def GenerateSolarSystemName( lResult: _Pointer[basic.cTkFixedString[0x7F]], lLocResult: _Pointer[basic.cTkFixedString[0x7F]], ) -> c_uint64: - """Returns the name for a SolarSystem, given it's seed. SolarSystem seeds are the same as their UA's. + """Returns the name for a SolarSystem, given it's seed. + SolarSystem seeds are the same as their UA's. """ ...