diff options
Diffstat (limited to 'NorthstarDedicatedTest/dllmain.cpp')
-rw-r--r-- | NorthstarDedicatedTest/dllmain.cpp | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/NorthstarDedicatedTest/dllmain.cpp b/NorthstarDedicatedTest/dllmain.cpp index 78edb297..83e78f4e 100644 --- a/NorthstarDedicatedTest/dllmain.cpp +++ b/NorthstarDedicatedTest/dllmain.cpp @@ -25,7 +25,11 @@ #include "scriptmainmenupromos.h" #include "miscclientfixes.h" #include "miscserverfixes.h" +#include "rpakfilesystem.h" +#include "bansystem.h" #include "memalloc.h" +#include "maxplayers.h" +#include "languagehooks.h" bool initialised = false; @@ -43,10 +47,6 @@ BOOL APIENTRY DllMain( HMODULE hModule, break; } - if (!initialised) - InitialiseNorthstar(); - initialised = true; - return TRUE; } @@ -56,33 +56,39 @@ void WaitForDebugger(HMODULE baseAddress) if (CommandLine()->CheckParm("-waitfordebugger")) { spdlog::info("waiting for debugger..."); - spdlog::info("{} bytes have been statically allocated", g_iStaticAllocated); while (!IsDebuggerPresent()) Sleep(100); } } -// in the future this will be called from launcher instead of dllmain -void InitialiseNorthstar() +bool InitialiseNorthstar() { + if (initialised) + { + //spdlog::warn("Called InitialiseNorthstar more than once!"); // it's actually 100% fine for that to happen + return false; + } + + initialised = true; + + curl_global_init_mem(CURL_GLOBAL_DEFAULT, _malloc_base, _free_base, _realloc_base, _strdup_base, _calloc_base); + InitialiseLogging(); // apply initial hooks InstallInitialHooks(); InitialiseInterfaceCreationHooks(); - // adding a callback to tier0 won't work for some reason - AddDllLoadCallback("launcher.dll", InitialiseTier0GameUtilFunctions); + AddDllLoadCallback("tier0.dll", InitialiseTier0GameUtilFunctions); AddDllLoadCallback("engine.dll", WaitForDebugger); AddDllLoadCallback("engine.dll", InitialiseEngineGameUtilFunctions); AddDllLoadCallback("server.dll", InitialiseServerGameUtilFunctions); - AddDllLoadCallback("engine.dll", InitialiseEngineSpewFuncHooks); // dedi patches { + AddDllLoadCallback("tier0.dll", InitialiseDedicatedOrigin); AddDllLoadCallback("engine.dll", InitialiseDedicated); - AddDllLoadCallback("launcher.dll", InitialiseDedicatedOrigin); AddDllLoadCallback("server.dll", InitialiseDedicatedServerGameDLL); AddDllLoadCallback("materialsystem_dx11.dll", InitialiseDedicatedMaterialSystem); // this fucking sucks, but seemingly we somehow load after rtech_game???? unsure how, but because of this we have to apply patches here, not on rtech_game load @@ -94,6 +100,7 @@ void InitialiseNorthstar() // client-exclusive patches { + AddDllLoadCallback("tier0.dll", InitialiseTier0LanguageHooks); AddDllLoadCallback("engine.dll", InitialiseClientEngineSecurityPatches); AddDllLoadCallback("client.dll", InitialiseClientSquirrel); AddDllLoadCallback("client.dll", InitialiseSourceConsole); @@ -107,8 +114,11 @@ void InitialiseNorthstar() AddDllLoadCallback("client.dll", InitialiseMiscClientFixes); } + AddDllLoadCallback("engine.dll", InitialiseEngineSpewFuncHooks); AddDllLoadCallback("server.dll", InitialiseServerSquirrel); + AddDllLoadCallback("engine.dll", InitialiseBanSystem); AddDllLoadCallback("engine.dll", InitialiseServerAuthentication); + AddDllLoadCallback("server.dll", InitialiseServerAuthenticationServerDLL); AddDllLoadCallback("engine.dll", InitialiseSharedMasterServer); AddDllLoadCallback("server.dll", InitialiseMiscServerScriptCommand); AddDllLoadCallback("server.dll", InitialiseMiscServerFixes); @@ -116,8 +126,19 @@ void InitialiseNorthstar() AddDllLoadCallback("engine.dll", InitialisePlaylistHooks); AddDllLoadCallback("filesystem_stdio.dll", InitialiseFilesystem); + AddDllLoadCallback("engine.dll", InitialiseEngineRpakFilesystem); AddDllLoadCallback("engine.dll", InitialiseKeyValues); + // maxplayers increase + AddDllLoadCallback("engine.dll", InitialiseMaxPlayersOverride_Engine); + AddDllLoadCallback("client.dll", InitialiseMaxPlayersOverride_Client); + AddDllLoadCallback("server.dll", InitialiseMaxPlayersOverride_Server); + // mod manager after everything else AddDllLoadCallback("engine.dll", InitialiseModManager); + + // run callbacks for any libraries that are already loaded by now + CallAllPendingDLLLoadCallbacks(); + + return true; }
\ No newline at end of file |