aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/dllmain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/dllmain.cpp')
-rw-r--r--NorthstarDedicatedTest/dllmain.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/NorthstarDedicatedTest/dllmain.cpp b/NorthstarDedicatedTest/dllmain.cpp
index 6f57d265..83e78f4e 100644
--- a/NorthstarDedicatedTest/dllmain.cpp
+++ b/NorthstarDedicatedTest/dllmain.cpp
@@ -25,8 +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;
@@ -44,10 +47,6 @@ BOOL APIENTRY DllMain( HMODULE hModule,
break;
}
- if (!initialised)
- InitialiseNorthstar();
- initialised = true;
-
return TRUE;
}
@@ -57,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
@@ -95,6 +100,7 @@ void InitialiseNorthstar()
// client-exclusive patches
{
+ AddDllLoadCallback("tier0.dll", InitialiseTier0LanguageHooks);
AddDllLoadCallback("engine.dll", InitialiseClientEngineSecurityPatches);
AddDllLoadCallback("client.dll", InitialiseClientSquirrel);
AddDllLoadCallback("client.dll", InitialiseSourceConsole);
@@ -108,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);
@@ -117,6 +126,7 @@ void InitialiseNorthstar()
AddDllLoadCallback("engine.dll", InitialisePlaylistHooks);
AddDllLoadCallback("filesystem_stdio.dll", InitialiseFilesystem);
+ AddDllLoadCallback("engine.dll", InitialiseEngineRpakFilesystem);
AddDllLoadCallback("engine.dll", InitialiseKeyValues);
// maxplayers increase
@@ -126,4 +136,9 @@ void InitialiseNorthstar()
// 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