diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2024-11-12 17:11:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 17:11:31 +0100 |
commit | 6509283abd620038bf48f0d90ba23b8fa17feec7 (patch) | |
tree | a4186aef12d8c44e3bc71868f2e1556068e4a6dd /primedev/server/buildainfile.cpp | |
parent | a4b09bc42d5f79ef86697c893efc9e3b7d966502 (diff) | |
parent | 13344f3910befa2cd15bfd306ba2c5e42e6c80ec (diff) | |
download | NorthstarLauncher-6509283abd620038bf48f0d90ba23b8fa17feec7.tar.gz NorthstarLauncher-6509283abd620038bf48f0d90ba23b8fa17feec7.zip |
Merge branch 'main' into feat/overhaul-mod-loading-locationsfeat/overhaul-mod-loading-locations
Diffstat (limited to 'primedev/server/buildainfile.cpp')
-rw-r--r-- | primedev/server/buildainfile.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/primedev/server/buildainfile.cpp b/primedev/server/buildainfile.cpp index 19a6d0e3..456c84f0 100644 --- a/primedev/server/buildainfile.cpp +++ b/primedev/server/buildainfile.cpp @@ -7,8 +7,6 @@ namespace fs = std::filesystem; -AUTOHOOK_INIT() - const int AINET_VERSION_NUMBER = 57; const int AINET_SCRIPT_VERSION_NUMBER = 21; const int PLACEHOLDER_CRC = 0; @@ -359,22 +357,18 @@ void DumpAINInfo(CAI_Network* aiNetwork) writeStream.close(); } -// clang-format off -AUTOHOOK(CAI_NetworkBuilder__Build, server.dll + 0x385E20, -void, __fastcall, (void* builder, CAI_Network* aiNetwork, void* unknown)) -// clang-format on +static void(__fastcall* o_pCAI_NetworkBuilder__Build)(void* builder, CAI_Network* aiNetwork, void* unknown) = nullptr; +static void __fastcall h_CAI_NetworkBuilder__Build(void* builder, CAI_Network* aiNetwork, void* unknown) { - CAI_NetworkBuilder__Build(builder, aiNetwork, unknown); + o_pCAI_NetworkBuilder__Build(builder, aiNetwork, unknown); DumpAINInfo(aiNetwork); } -// clang-format off -AUTOHOOK(LoadAINFile, server.dll + 0x3933A0, -void, __fastcall, (void* aimanager, void* buf, const char* filename)) -// clang-format on +static void(__fastcall* o_pLoadAINFile)(void* aimanager, void* buf, const char* filename) = nullptr; +static void __fastcall h_LoadAINFile(void* aimanager, void* buf, const char* filename) { - LoadAINFile(aimanager, buf, filename); + o_pLoadAINFile(aimanager, buf, filename); if (Cvar_ns_ai_dumpAINfileFromLoad->GetBool()) { @@ -385,7 +379,11 @@ void, __fastcall, (void* aimanager, void* buf, const char* filename)) ON_DLL_LOAD("server.dll", BuildAINFile, (CModule module)) { - AUTOHOOK_DISPATCH() + o_pCAI_NetworkBuilder__Build = module.Offset(0x385E20).RCast<decltype(o_pCAI_NetworkBuilder__Build)>(); + HookAttach(&(PVOID&)o_pCAI_NetworkBuilder__Build, (PVOID)h_CAI_NetworkBuilder__Build); + + o_pLoadAINFile = module.Offset(0x3933A0).RCast<decltype(o_pLoadAINFile)>(); + HookAttach(&(PVOID&)o_pLoadAINFile, (PVOID)h_LoadAINFile); Cvar_ns_ai_dumpAINfileFromLoad = new ConVar( "ns_ai_dumpAINfileFromLoad", "0", FCVAR_NONE, "For debugging: whether we should dump ain data for ains loaded from disk"); |