From 04ec5eee77a358fb4583f3d79e24cad245d4dfc9 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 7 Sep 2026 17:45:27 -0400 Subject: [PATCH] generated address header: 80 entries (loader prototypes, verified app spine) --- include/generated/sots_addresses.h | 164 ++++++++++++++++++++++++++++- 1 file changed, 159 insertions(+), 5 deletions(-) diff --git a/include/generated/sots_addresses.h b/include/generated/sots_addresses.h index 0f30196..f73b87e 100644 --- a/include/generated/sots_addresses.h +++ b/include/generated/sots_addresses.h @@ -1,5 +1,5 @@ // GENERATED — do not edit. Facts about Sword of the Stars.exe (GOG 1.8.1). -// Source: sots-re ghidra/addresses.json @ daea98f, generated 2026-09-07 by tools/gen_addresses.py +// Source: sots-re ghidra/addresses.json @ f1c7f55, generated 2026-09-07 by tools/gen_addresses.py // Runtime address = (uintptr_t)GetModuleHandle(NULL) + RVA (the exe is ASLR-relocated). #pragma once #include @@ -7,15 +7,15 @@ namespace sots::addr { constexpr uint32_t IMAGE_BASE = 0x00400000; -// thiscall void (Application* this) [unverified] +// thiscall bool (Application* this, AppStartup* startup) /* ONE stack arg, RET 4, returns AL; EDX unused. startup = {HINSTANCE hInst; std::vector args; ...; int nShow; const char* wndClass; int iconId} built in WinMain */ [verified] constexpr uint32_t Mars_Application_Initialize = 0x004a0e50; -// thiscall int (Application* this) [unverified] +// thiscall void (Application* this) /* no stack args, plain RET, EDX not an input, EAX = last PumpMessages result (ignore) */ [verified] constexpr uint32_t Mars_Application_Run = 0x0049f5b0; // cdecl void (int coreIndex) [unverified] constexpr uint32_t Process_PinAffinity = 0x0049ee70; -// thiscall void (CfgVar* this, void* parser, const char* key, void* storage) [unverified] +// thiscall GlobalConst* (GlobalConst* this, void* storage, const char* key, ParseFn parser, const char* file) // RET 0x10 [verified] constexpr uint32_t CfgVar_RegisterKey = 0x004b76a0; -// thiscall void (DemoApp* this) [unverified] +// thiscall bool (DemoApp* this) /* no stack args; returns 0 when quitting (this+0x1b2), else 1 */ [verified] constexpr uint32_t DemoApp_OnTick = 0x0049a640; // thiscall void (StrategyClient* this) [unverified] constexpr uint32_t StrategyClient_EndTurn = 0x00383be0; @@ -57,5 +57,159 @@ constexpr uint32_t RNG_Seed = 0x0009fdf0; constexpr uint32_t RNG_NextFloat = 0x0007d830; // thiscall uint32_t (RNG* this) [unverified] constexpr uint32_t RNG_NextInt = 0x000271c0; +// cdecl void (void) /* sots.ini [Modules] Mount -> gobio::Init */ [verified] +constexpr uint32_t Mars_Application_MountModules = 0x004a0a20; +// cdecl void (int* count, const char*** table) /* count 3 @0x00b2d514, table @0x00a35e98 */ [verified] +constexpr uint32_t Game_GetDefaultMounts = 0x004991c0; +// thiscall GlobalConst* (GlobalConst* this, void* storage, const char* key, GlobalConstParseFn parser, const char* file) /* RET 0x10; static-init stub call */ [verified] +constexpr uint32_t GlobalConst_ctor = 0x004b76a0; +// cdecl void (GlobalConst* g) [verified] +constexpr uint32_t GlobalConst_Register = 0x004b7610; +// cdecl void (int* storage, const char* text) [verified] +constexpr uint32_t GlobalConst_ParseInt = 0x004b7000; +// cdecl void (float* storage, const char* text) [verified] +constexpr uint32_t GlobalConst_ParseFloat = 0x004b7020; +// cdecl void (float* storage, const char* text) /* *storage = sscanf(%f) * *(float*)0x00af5210 */ [verified] +constexpr uint32_t GlobalConst_ParseFloatScaled = 0x004b70e0; +// cdecl void (float rgba[4], const char* text) /* '%d %d %d %d', defaults 255, /255, clamp 0..1 */ [verified] +constexpr uint32_t GlobalConst_ParseColour = 0x004b7110; +// cdecl void (void) /* called once from Application::Initialize; sets g_GlobalConstsLoaded */ [verified] +constexpr uint32_t GlobalConsts_LoadAll = 0x004b76d0; +// cdecl void (const char* file, GlobalConstMap* consts) /* consts = std::map of the keys registered for this file; hook this for the file-level read */ [verified] +constexpr uint32_t GlobalConsts_LoadFile = 0x004b73c0; +// data bool [verified] +constexpr uint32_t g_GlobalConstsLoaded = 0x0072d740; +// data std::map /* +4 (0x00b2d748) = header node pointer */ [verified] +constexpr uint32_t g_GlobalConstRegistry = 0x0072d744; +// thiscall Script* (Script* this) /* sizeof(Script) = 0x28 */ [verified] +constexpr uint32_t Script_ctor = 0x004cd700; +// thiscall void (Script* this) [verified] +constexpr uint32_t Script_dtor = 0x004cd720; +// thiscall bool (Script* this, const char* path) /* gobio::ReadFile into this->buf */ [verified] +constexpr uint32_t Script_Open = 0x004cd7d0; +// thiscall void (Script* this) [verified] +constexpr uint32_t Script_Close = 0x004cd6c0; +// thiscall int (Script* this, char* out, uint outMax) /* 0 token, 1 no buffer/past end, 2 reached end */ [verified] +constexpr uint32_t Script_ReadToken = 0x004cd2f0; +// thiscall int (Script* this, ScriptToken* tok) /* tok: {int type; char key[1024]; char value[1024]}; type 1 kv, 2 block open, 3 '}' */ [verified] +constexpr uint32_t Script_Next = 0x004cd3e0; +// thiscall int (Script* this, int depth) /* 0 ok, nonzero EOF */ [verified] +constexpr uint32_t Script_SkipBlock = 0x004cd4b0; +// custom /* EAX=cursor, ECX="edFlag, EDX=out; stack: end, outEnd, &len — internal, do not hook */ [verified] +constexpr uint32_t Script_ScanToken = 0x004cd1f0; +// cdecl void (IConfigCallback* cb, const char* path, const char* blockName, bool* found) /* cb->vft[1](Script*) per matching block */ [verified] +constexpr uint32_t ConfigParser_ParseFile = 0x004cd820; +// fastcall int (IBuffer* obj) /* ECX=obj; --refcount, vft[0](1) at 0 */ [verified] +constexpr uint32_t RefCounted_Release = 0x004a7230; +// thiscall void (WeaponDictionary* this) /* reads Weapons/_weapons.txt manifest */ [verified] +constexpr uint32_t WeaponDictionary_Init = 0x0019a4c0; +// thiscall void (WeaponDictionary* this, const char* path, int id, WeaponDef** out) [verified] +constexpr uint32_t WeaponDictionary_LoadWeapon = 0x0019a230; +// thiscall WeaponDef* (WeaponDictionary* this, const char* name) /* _stricmp over def->name @+0x40 */ [verified] +constexpr uint32_t WeaponDictionary_FindByName = 0x00190a10; +// thiscall WeaponDef* (WeaponDictionary* this, const char* name) /* 'Weapon not found: "%s" - Was it added to the index file?' */ [verified] +constexpr uint32_t WeaponDictionary_FindByNameSorted = 0x00191e30; +// thiscall WeaponDef* (WeaponDef* this, int index, int id, const char* path) /* sizeof 0x278 */ [verified] +constexpr uint32_t WeaponDef_ctor = 0x00198a20; +// thiscall bool (WeaponDef* this, Script* script, int* rc, TechTree* tree) [verified] +constexpr uint32_t WeaponDef_ParseScript = 0x00199070; +// thiscall SectionDictionary* (SectionDictionary* this, TechTree* tree) /* reads Species//_shipsections.txt for species 0..6 */ [verified] +constexpr uint32_t SectionDictionary_ctor = 0x00176f40; +// thiscall SectionDef* (SectionDictionary* this, const char* path, int species, int id) [verified] +constexpr uint32_t SectionDictionary_LoadSection = 0x00176cd0; +// thiscall SectionDef* (SectionDef* this, int index, int species, int id) /* sizeof 0x3d8 */ [verified] +constexpr uint32_t SectionDef_ctor = 0x00174020; +// thiscall bool (SectionDef* this, Script* script, int* rc, TechTree* tree) [verified] +constexpr uint32_t SectionDef_ParseScript = 0x001744e0; +// cdecl const char* (uint species) [verified] +constexpr uint32_t Species_GetDirName = 0x00145ec0; +// thiscall MasterTechTree* (MasterTechTree* this) /* TechTree/MasterTechList.tech */ [verified] +constexpr uint32_t MasterTechTree_ctor = 0x0018b870; +// thiscall void (MasterTechTree* this, const char* path, int flag) [verified] +constexpr uint32_t MasterTechTree_LoadTechFile = 0x0018b770; +// thiscall void (MasterTechTree* this, Script* script, int flag) /* one tech{} block */ [verified] +constexpr uint32_t MasterTechTree_ParseTech = 0x0018b050; +// thiscall void (DemoApp* this) /* MasterTechTree -> +0x110, WeaponDictionary -> +0x118, SectionDictionary -> +0x114 */ [verified] +constexpr uint32_t DemoApp_LoadGameData = 0x00499280; +// thiscall void (DemoApp* this) /* once, from OnTick when this+0x10c is set */ [verified] +constexpr uint32_t DemoApp_EnsureGameData = 0x00499870; +// cdecl void (std::vector* mountPaths) [verified] +constexpr uint32_t gobio_Init = 0x004d7010; +// thiscall FileSystemSet* (FileSystemSet* this, std::vector* mounts) [verified] +constexpr uint32_t gobio_FileSystemSet_ctor = 0x004d6d60; +// thiscall bool (FileSystemSet* this, const char* path) [verified] +constexpr uint32_t gobio_FileSystemSet_Open = 0x004d5060; +// thiscall void (FileSystemSet* this, const char* pattern, std::vector* out) [verified] +constexpr uint32_t gobio_FileSystemSet_ListFiles = 0x004d7090; +// cdecl bool (const char* path, IBuffer** out) /* whole file by relative path; THE hook point for M4 */ [verified] +constexpr uint32_t gobio_ReadFile = 0x004d5140; +// cdecl bool (const char* path) [verified] +constexpr uint32_t gobio_Open = 0x004d50d0; +// cdecl void (void) [verified] +constexpr uint32_t gobio_Close = 0x004d4d20; +// cdecl uint (void) [verified] +constexpr uint32_t gobio_Size = 0x004d4d50; +// cdecl uint (void* dst, uint n) [verified] +constexpr uint32_t gobio_Read = 0x004d4d80; +// cdecl bool (const char* path) [verified] +constexpr uint32_t gobio_Exists = 0x004d50f0; +// cdecl void (const char* pattern, std::vector* out) [verified] +constexpr uint32_t gobio_ListFiles = 0x004d71d0; +// custom /* size in EBX, IBuffer** out on stack — internal, do not hook */ [verified] +constexpr uint32_t gobio_Buffer_Create = 0x004d4c90; +// thiscall void* (IBuffer* this) /* vft[1] and vft[2]; = this+8 */ [verified] +constexpr uint32_t gobio_Buffer_Data = 0x00282d50; +// thiscall uint (IBuffer* this) /* vft[3]; = this+0xc */ [verified] +constexpr uint32_t gobio_Buffer_Size = 0x004d4c80; +// thiscall NativeFileSystem* (NativeFileSystem* this, const char* root) /* sizeof 0x28; vtable 0x00a398ac */ [verified] +constexpr uint32_t gobio_NativeFileSystem_ctor = 0x004d57a0; +// thiscall bool (NativeFileSystem* this, const char* path) /* vft[1] fopen(root+path,'rb') */ [verified] +constexpr uint32_t gobio_NativeFileSystem_Open = 0x004d4ef0; +// thiscall uint (NativeFileSystem* this, void* dst, uint n) /* vft[4] */ [verified] +constexpr uint32_t gobio_NativeFileSystem_Read = 0x004d4c30; +// thiscall ZipFileSystem* (ZipFileSystem* this, const char* zipPath) /* sizeof 0x34; vtable 0x00a39934 */ [verified] +constexpr uint32_t gobio_ZipFileSystem_ctor = 0x004d6c40; +// thiscall bool (ZipFileSystem* this, const char* path) /* vft[1]; case- and slash-insensitive */ [verified] +constexpr uint32_t gobio_ZipFileSystem_Open = 0x004d56a0; +// thiscall uint (ZipFileSystem* this, void* dst, uint n) /* vft[4] */ [verified] +constexpr uint32_t gobio_ZipFileSystem_Read = 0x004d4b40; +// data FileSystemSet* /* -> 0x00b2e274 after gobio::Init */ [verified] +constexpr uint32_t g_gobio = 0x0072e270; +// data const char*[3] /* used when sots.ini has no [Modules] Mount; contains sots_local_en.gob, sots.gob */ [verified] +constexpr uint32_t g_DefaultMountTable = 0x00635e98; +// cdecl Stream* (const char* path) /* sniffs 'TXT' magic, returns a TextFileStream (0x420 bytes) opened for read */ [verified] +constexpr uint32_t Stream_OpenFile = 0x004cfcb0; +// thiscall TextFileStream* (TextFileStream* this) /* vtable 0x00a428c0 */ [verified] +constexpr uint32_t TextFileStream_ctor = 0x0051e460; +// thiscall bool (TextFileStream* this, const char* path, int mode /*1*/) [verified] +constexpr uint32_t TextFileStream_Open = 0x004cfb90; +// thiscall uint (Stream* this, char* out, int max) [verified] +constexpr uint32_t FileStream_ReadLine = 0x004cfa30; +// thiscall const char* (TextFileStream* this, const char* line, const char* label) /* NULL on END/mismatch */ [verified] +constexpr uint32_t TextFileStream_MatchLabel = 0x0051e760; +// thiscall bool (TextFileStream* this, const char* label, char* out, int outMax) /* vft[1] */ [verified] +constexpr uint32_t TextFileStream_ReadString = 0x0051ec90; +// thiscall bool (TextFileStream* this, const char* label, bool* out) /* vft[2] */ [verified] +constexpr uint32_t TextFileStream_ReadBool = 0x0051eba0; +// thiscall bool (TextFileStream* this, const char* label, float* out) /* vft[3] */ [verified] +constexpr uint32_t TextFileStream_ReadFloat = 0x0051eb30; +// thiscall bool (TextFileStream* this, const char* label, int* out, int dflt) /* vft[4] */ [verified] +constexpr uint32_t TextFileStream_ReadInt = 0x0051eab0; +// thiscall void (TextFileStream* this, const char* label, IStreamable* obj /*NULL=skip*/) /* vft[5]; BEGIN..END */ [verified] +constexpr uint32_t TextFileStream_ReadNested = 0x0051e8e0; +// thiscall void (ParticleSystem* this, Stream* s) /* .effect body */ [verified] +constexpr uint32_t ParticleSystem_Read = 0x004db650; +// thiscall void (ParticleSystem* this, Stream* s) [verified] +constexpr uint32_t ParticleSystem_Write = 0x004dad60; +// thiscall void* (EffectDictionary* this, const char* name) /* 'effects/' + name; Stream::OpenFile; 0x1c0-byte effect */ [unverified] +constexpr uint32_t EffectDictionary_Load = 0x004b42b0; +// cdecl void (Stream* s, const char* label, std::string* out, int flag) /* wrapper over vft[1] */ [verified] +constexpr uint32_t Stream_ReadString = 0x004b9d90; +// cdecl void (Stream* s, const char* label, int* out, int dflt) /* wrapper over vft[4] */ [verified] +constexpr uint32_t Stream_ReadInt = 0x004b9d20; +// cdecl void (Stream* s, const char* label, bool* out) /* wrapper over vft[2] */ [verified] +constexpr uint32_t Stream_ReadBool = 0x004b9c00; +// cdecl void (Stream* s, const char* label, float* out, int flag) /* wrapper over vft[3] */ [verified] +constexpr uint32_t Stream_ReadFloat = 0x004b9bc0; } // namespace sots::addr