From 7a2f17c9d13371e1beb62014f2ec0169124c9862 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Mon, 9 May 2022 18:28:27 +0100 Subject: move tier0 and playlist funcs to namespaces --- NorthstarDedicatedTest/gameutils.cpp | 58 ------------------------------------ 1 file changed, 58 deletions(-) (limited to 'NorthstarDedicatedTest/gameutils.cpp') diff --git a/NorthstarDedicatedTest/gameutils.cpp b/NorthstarDedicatedTest/gameutils.cpp index 792d8bf2..d6e5840a 100644 --- a/NorthstarDedicatedTest/gameutils.cpp +++ b/NorthstarDedicatedTest/gameutils.cpp @@ -2,11 +2,6 @@ #include "convar.h" #include "gameutils.h" -// memory -IMemAlloc* g_pMemAllocSingleton; -typedef IMemAlloc* (*CreateGlobalMemAllocType)(); -CreateGlobalMemAllocType CreateGlobalMemAlloc; - // cmd.h Cbuf_GetCurrentPlayerType Cbuf_GetCurrentPlayer; Cbuf_AddTextType Cbuf_AddText; @@ -19,15 +14,6 @@ CHostState* g_pHostState; CEngine* g_pEngine; server_state_t* sv_m_State; -// network stuff -ConVar* Cvar_hostport; - -// playlist stuff -GetCurrentPlaylistType GetCurrentPlaylistName; -SetCurrentPlaylistType SetCurrentPlaylist; -SetPlaylistVarOverrideType SetPlaylistVarOverride; -GetCurrentPlaylistVarType GetCurrentPlaylistVar; - // server entity stuff Server_GetEntityByIndexType Server_GetEntityByIndex; @@ -36,10 +22,6 @@ char* g_LocalPlayerUserID; char* g_LocalPlayerOriginToken; // misc stuff -ErrorType Error; -CommandLineType CommandLine; -Plat_FloatTimeType Plat_FloatTime; -ThreadInServerFrameThreadType ThreadInServerFrameThread; GetBaseLocalClientType GetBaseLocalClient; void InitialiseEngineGameUtilFunctions(HMODULE baseAddress) @@ -52,11 +34,6 @@ void InitialiseEngineGameUtilFunctions(HMODULE baseAddress) g_pEngine = *(CEngine**)((char*)baseAddress + 0x7D70C8); sv_m_State = (server_state_t*)((char*)baseAddress + 0x12A53D48); - GetCurrentPlaylistName = (GetCurrentPlaylistType)((char*)baseAddress + 0x18C640); - SetCurrentPlaylist = (SetCurrentPlaylistType)((char*)baseAddress + 0x18EB20); - SetPlaylistVarOverride = (SetPlaylistVarOverrideType)((char*)baseAddress + 0x18ED00); - GetCurrentPlaylistVar = (GetCurrentPlaylistVarType)((char*)baseAddress + 0x18C680); - g_LocalPlayerUserID = (char*)baseAddress + 0x13F8E688; g_LocalPlayerOriginToken = (char*)baseAddress + 0x13979C80; @@ -76,44 +53,9 @@ void InitialiseEngineGameUtilFunctions(HMODULE baseAddress) g_pAllConVars.push_back(pConVar); } }*/ - - Cvar_hostport = (ConVar*)((char*)baseAddress + 0x13FA6070); } void InitialiseServerGameUtilFunctions(HMODULE baseAddress) { Server_GetEntityByIndex = (Server_GetEntityByIndexType)((char*)baseAddress + 0xFB820); -} - -void InitialiseTier0GameUtilFunctions(HMODULE baseAddress) -{ - if (!baseAddress) - { - spdlog::critical("tier0 base address is null, but it should be already loaded"); - throw "tier0 base address is null, but it should be already loaded"; - } - if (g_pMemAllocSingleton) - return; // seems this function was already called - CreateGlobalMemAlloc = reinterpret_cast(GetProcAddress(baseAddress, "CreateGlobalMemAlloc")); - IMemAlloc** ppMemAllocSingleton = reinterpret_cast(GetProcAddress(baseAddress, "g_pMemAllocSingleton")); - if (!ppMemAllocSingleton) - { - spdlog::critical("Address of g_pMemAllocSingleton is a null pointer, this should never happen"); - throw "Address of g_pMemAllocSingleton is a null pointer, this should never happen"; - } - if (!*ppMemAllocSingleton) - { - g_pMemAllocSingleton = CreateGlobalMemAlloc(); - *ppMemAllocSingleton = g_pMemAllocSingleton; - spdlog::info("Created new g_pMemAllocSingleton"); - } - else - { - g_pMemAllocSingleton = *ppMemAllocSingleton; - } - - Error = reinterpret_cast(GetProcAddress(baseAddress, "Error")); - CommandLine = reinterpret_cast(GetProcAddress(baseAddress, "CommandLine")); - Plat_FloatTime = reinterpret_cast(GetProcAddress(baseAddress, "Plat_FloatTime")); - ThreadInServerFrameThread = reinterpret_cast(GetProcAddress(baseAddress, "ThreadInServerFrameThread")); } \ No newline at end of file -- cgit v1.2.3