diff options
author | p0358 <p0358@users.noreply.github.com> | 2021-12-29 05:48:33 +0100 |
---|---|---|
committer | p0358 <p0358@users.noreply.github.com> | 2021-12-29 05:48:33 +0100 |
commit | 8a1a2e97624d15617197248a5e292c5ead5e74a2 (patch) | |
tree | d236b5bd3c21db674c784239beb2404273498887 /NorthstarDedicatedTest/gameutils.cpp | |
parent | 2bb9e5b29ab08062614b2d52c430f9097bf2106f (diff) | |
download | NorthstarLauncher-8a1a2e97624d15617197248a5e292c5ead5e74a2.tar.gz NorthstarLauncher-8a1a2e97624d15617197248a5e292c5ead5e74a2.zip |
add launcher.dll proxy option
Diffstat (limited to 'NorthstarDedicatedTest/gameutils.cpp')
-rw-r--r-- | NorthstarDedicatedTest/gameutils.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/NorthstarDedicatedTest/gameutils.cpp b/NorthstarDedicatedTest/gameutils.cpp index 642c44e6..97011059 100644 --- a/NorthstarDedicatedTest/gameutils.cpp +++ b/NorthstarDedicatedTest/gameutils.cpp @@ -79,11 +79,17 @@ void InitialiseServerGameUtilFunctions(HMODULE baseAddress) void InitialiseTier0GameUtilFunctions(HMODULE baseAddress) { baseAddress = GetModuleHandleA("tier0.dll"); - - CreateGlobalMemAlloc = (CreateGlobalMemAllocType)GetProcAddress(baseAddress, "CreateGlobalMemAlloc"); - g_pMemAllocSingleton = CreateGlobalMemAlloc(); - - Error = (ErrorType)GetProcAddress(baseAddress, "Error"); - CommandLine = (CommandLineType)GetProcAddress(baseAddress, "CommandLine"); - Plat_FloatTime = (Plat_FloatTimeType)GetProcAddress(baseAddress, "Plat_FloatTime"); + if (!baseAddress) + throw "tier0.dll is not loaded"; + + CreateGlobalMemAlloc = reinterpret_cast<CreateGlobalMemAllocType>(GetProcAddress(baseAddress, "CreateGlobalMemAlloc")); + IMemAlloc** ppMemAllocSingleton = reinterpret_cast<IMemAlloc**>(GetProcAddress(baseAddress, "g_pMemAllocSingleton")); + if (!ppMemAllocSingleton || !*ppMemAllocSingleton) + g_pMemAllocSingleton = CreateGlobalMemAlloc(); + else + g_pMemAllocSingleton = *ppMemAllocSingleton; + + Error = reinterpret_cast<ErrorType>(GetProcAddress(baseAddress, "Error")); + CommandLine = reinterpret_cast<CommandLineType>(GetProcAddress(baseAddress, "CommandLine")); + Plat_FloatTime = reinterpret_cast<Plat_FloatTimeType>(GetProcAddress(baseAddress, "Plat_FloatTime")); }
\ No newline at end of file |