From 5ce8343bcced9e92ab2b3c1b80382cffa0281629 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Mon, 9 May 2022 20:23:16 +0100 Subject: use lambdas for dll load callbacks so intellisense shits itself less --- NorthstarDedicatedTest/ExploitFixes.cpp | 2 +- NorthstarDedicatedTest/audio.cpp | 2 +- NorthstarDedicatedTest/bansystem.cpp | 2 +- NorthstarDedicatedTest/buildainfile.cpp | 2 +- NorthstarDedicatedTest/chatcommand.cpp | 2 +- NorthstarDedicatedTest/clientauthhooks.cpp | 2 +- NorthstarDedicatedTest/clientchathooks.cpp | 2 +- NorthstarDedicatedTest/clientruihooks.cpp | 2 +- NorthstarDedicatedTest/clientvideooverrides.cpp | 2 +- NorthstarDedicatedTest/concommand.cpp | 2 +- NorthstarDedicatedTest/convar.cpp | 2 +- NorthstarDedicatedTest/debugoverlay.cpp | 2 +- NorthstarDedicatedTest/dedicated.cpp | 6 +++--- NorthstarDedicatedTest/dedicatedmaterialsystem.cpp | 2 +- NorthstarDedicatedTest/filesystem.cpp | 2 +- NorthstarDedicatedTest/hooks.h | 3 +-- NorthstarDedicatedTest/keyvalues.cpp | 2 +- NorthstarDedicatedTest/languagehooks.cpp | 2 +- NorthstarDedicatedTest/latencyflex.cpp | 2 +- NorthstarDedicatedTest/localchatwriter.cpp | 2 +- NorthstarDedicatedTest/logging.cpp | 4 ++-- NorthstarDedicatedTest/masterserver.cpp | 2 +- NorthstarDedicatedTest/maxplayers.cpp | 6 +++--- NorthstarDedicatedTest/miscclientfixes.cpp | 2 +- NorthstarDedicatedTest/miscserverfixes.cpp | 2 +- NorthstarDedicatedTest/miscserverscript.cpp | 2 +- NorthstarDedicatedTest/modlocalisation.cpp | 2 +- NorthstarDedicatedTest/modmanager.cpp | 2 +- NorthstarDedicatedTest/playlist.cpp | 2 +- NorthstarDedicatedTest/plugins.cpp | 2 +- NorthstarDedicatedTest/rpakfilesystem.cpp | 2 +- NorthstarDedicatedTest/scriptbrowserhooks.cpp | 2 +- NorthstarDedicatedTest/scriptmainmenupromos.cpp | 2 +- NorthstarDedicatedTest/scriptmodmenu.cpp | 2 +- NorthstarDedicatedTest/scriptserverbrowser.cpp | 2 +- NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp | 2 +- NorthstarDedicatedTest/serverauthentication.cpp | 2 +- NorthstarDedicatedTest/serverchathooks.cpp | 4 ++-- NorthstarDedicatedTest/sourceconsole.cpp | 2 +- NorthstarDedicatedTest/sourceinterface.cpp | 6 +++--- NorthstarDedicatedTest/squirrel.cpp | 6 +++--- NorthstarDedicatedTest/tier0.cpp | 2 +- 42 files changed, 52 insertions(+), 53 deletions(-) (limited to 'NorthstarDedicatedTest') diff --git a/NorthstarDedicatedTest/ExploitFixes.cpp b/NorthstarDedicatedTest/ExploitFixes.cpp index cc42ab73..3850b5a7 100644 --- a/NorthstarDedicatedTest/ExploitFixes.cpp +++ b/NorthstarDedicatedTest/ExploitFixes.cpp @@ -400,7 +400,7 @@ void DoBytePatches() } } -ON_DLL_LOAD_RELIESON("server.dll", ExploitFixes, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("server.dll", ExploitFixes, ConVar, [](HMODULE baseAddress) { spdlog::info("ExploitFixes::LoadCallback ..."); diff --git a/NorthstarDedicatedTest/audio.cpp b/NorthstarDedicatedTest/audio.cpp index 982e42ab..20ea8467 100644 --- a/NorthstarDedicatedTest/audio.cpp +++ b/NorthstarDedicatedTest/audio.cpp @@ -494,7 +494,7 @@ void __fastcall MilesLog_Hook(int level, const char* string) spdlog::info("[MSS] {} - {}", level, string); } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", AudioHooks, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", AudioHooks, ConVar, [](HMODULE baseAddress) { Cvar_ns_print_played_sounds = new ConVar("ns_print_played_sounds", "0", FCVAR_NONE, ""); diff --git a/NorthstarDedicatedTest/bansystem.cpp b/NorthstarDedicatedTest/bansystem.cpp index 1688a23c..70f4d7db 100644 --- a/NorthstarDedicatedTest/bansystem.cpp +++ b/NorthstarDedicatedTest/bansystem.cpp @@ -96,7 +96,7 @@ void ConCommand_clearbanlist(const CCommand& args) g_ServerBanSystem->ClearBanlist(); } -ON_DLL_LOAD_RELIESON("engine.dll", BanSystem, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("engine.dll", BanSystem, ConCommand, [](HMODULE baseAddress) { g_ServerBanSystem = new ServerBanSystem; g_ServerBanSystem->OpenBanlist(); diff --git a/NorthstarDedicatedTest/buildainfile.cpp b/NorthstarDedicatedTest/buildainfile.cpp index 13660dc6..e7ef6e59 100644 --- a/NorthstarDedicatedTest/buildainfile.cpp +++ b/NorthstarDedicatedTest/buildainfile.cpp @@ -374,7 +374,7 @@ void LoadAINFileHook(void* aimanager, void* buf, const char* filename) } } -ON_DLL_LOAD("server.dll", BuildAINFile, (HMODULE baseAddress) +ON_DLL_LOAD("server.dll", BuildAINFile, [](HMODULE baseAddress) { 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"); diff --git a/NorthstarDedicatedTest/chatcommand.cpp b/NorthstarDedicatedTest/chatcommand.cpp index 0cbfec74..ba096d69 100644 --- a/NorthstarDedicatedTest/chatcommand.cpp +++ b/NorthstarDedicatedTest/chatcommand.cpp @@ -30,7 +30,7 @@ void ConCommand_log(const CCommand& args) } } -ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientChatCommand, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientChatCommand, ConCommand, [](HMODULE baseAddress) { ClientSayText = (ClientSayTextType)((char*)baseAddress + 0x54780); RegisterConCommand("say", ConCommand_say, "Enters a message in public chat", FCVAR_CLIENTDLL); diff --git a/NorthstarDedicatedTest/clientauthhooks.cpp b/NorthstarDedicatedTest/clientauthhooks.cpp index 29ecbd69..f1dc3f8c 100644 --- a/NorthstarDedicatedTest/clientauthhooks.cpp +++ b/NorthstarDedicatedTest/clientauthhooks.cpp @@ -34,7 +34,7 @@ void AuthWithStryderHook(void* a1) AuthWithStryder(a1); } -ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientAuthHooks, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientAuthHooks, ConVar, [](HMODULE baseAddress) { // this cvar will save to cfg once initially agreed with Cvar_ns_has_agreed_to_send_token = new ConVar( diff --git a/NorthstarDedicatedTest/clientchathooks.cpp b/NorthstarDedicatedTest/clientchathooks.cpp index d666072e..fefbe8ca 100644 --- a/NorthstarDedicatedTest/clientchathooks.cpp +++ b/NorthstarDedicatedTest/clientchathooks.cpp @@ -85,7 +85,7 @@ static SQRESULT SQ_ChatWriteLine(void* sqvm) return SQRESULT_NOTNULL; } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ClientChatHooks, ClientSquirrel, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ClientChatHooks, ClientSquirrel, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x22E580, &CHudChat__AddGameLineHook, reinterpret_cast(&CHudChat__AddGameLine)); diff --git a/NorthstarDedicatedTest/clientruihooks.cpp b/NorthstarDedicatedTest/clientruihooks.cpp index 0bbcaaa3..c34207dc 100644 --- a/NorthstarDedicatedTest/clientruihooks.cpp +++ b/NorthstarDedicatedTest/clientruihooks.cpp @@ -16,7 +16,7 @@ char DrawRUIFuncHook(void* a1, float* a2) return DrawRUIFunc(a1, a2); } -ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", RUI, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", RUI, ConVar, [](HMODULE baseAddress) { Cvar_rui_drawEnable = new ConVar("rui_drawEnable", "1", FCVAR_CLIENTDLL, "Controls whether RUI should be drawn"); diff --git a/NorthstarDedicatedTest/clientvideooverrides.cpp b/NorthstarDedicatedTest/clientvideooverrides.cpp index 687d6714..3aaae863 100644 --- a/NorthstarDedicatedTest/clientvideooverrides.cpp +++ b/NorthstarDedicatedTest/clientvideooverrides.cpp @@ -32,7 +32,7 @@ void* BinkOpenHook(const char* path, uint32_t flags) return BinkOpen(path, flags); } -ON_DLL_LOAD_CLIENT("client.dll", BinkVideo, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT("client.dll", BinkVideo, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK( diff --git a/NorthstarDedicatedTest/concommand.cpp b/NorthstarDedicatedTest/concommand.cpp index f7ce3b75..5f86ba32 100644 --- a/NorthstarDedicatedTest/concommand.cpp +++ b/NorthstarDedicatedTest/concommand.cpp @@ -18,7 +18,7 @@ void RegisterConCommand(const char* name, void (*callback)(const CCommand&), con conCommandConstructor(newCommand, name, callback, helpString, flags, nullptr); } -ON_DLL_LOAD("engine.dll", ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD("engine.dll", ConCommand, [](HMODULE baseAddress) { conCommandConstructor = (ConCommandConstructorType)((char*)baseAddress + 0x415F60); AddMiscConCommands(); diff --git a/NorthstarDedicatedTest/convar.cpp b/NorthstarDedicatedTest/convar.cpp index 5a261edb..69653bf0 100644 --- a/NorthstarDedicatedTest/convar.cpp +++ b/NorthstarDedicatedTest/convar.cpp @@ -32,7 +32,7 @@ CvarIsFlagSetType CvarIsFlagSet; //----------------------------------------------------------------------------- // Purpose: ConVar interface initialization //----------------------------------------------------------------------------- -ON_DLL_LOAD("engine.dll", ConVar, (HMODULE baseAddress) +ON_DLL_LOAD("engine.dll", ConVar, [](HMODULE baseAddress) { conVarMalloc = (ConVarMallocType)((char*)baseAddress + 0x415C20); conVarRegister = (ConVarRegisterType)((char*)baseAddress + 0x417230); diff --git a/NorthstarDedicatedTest/debugoverlay.cpp b/NorthstarDedicatedTest/debugoverlay.cpp index db0f09fa..7dee42e9 100644 --- a/NorthstarDedicatedTest/debugoverlay.cpp +++ b/NorthstarDedicatedTest/debugoverlay.cpp @@ -152,7 +152,7 @@ void __fastcall DrawOverlayHook(OverlayBase_t* pOverlay) LeaveCriticalSection((LPCRITICAL_SECTION)((char*)sEngineModule + 0x10DB0A38)); } -ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", DebugOverlay, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", DebugOverlay, ConVar, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0xABCB0, &DrawOverlayHook, reinterpret_cast(&DrawOverlay)); diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp index 89896195..41de0594 100644 --- a/NorthstarDedicatedTest/dedicated.cpp +++ b/NorthstarDedicatedTest/dedicated.cpp @@ -133,7 +133,7 @@ DWORD WINAPI ConsoleInputThread(PVOID pThreadParameter) } #include "NSMem.h" -ON_DLL_LOAD_DEDI("engine.dll", DedicatedServer, (HMODULE engineAddress) +ON_DLL_LOAD_DEDI("engine.dll", DedicatedServer, [](HMODULE engineAddress) { spdlog::info("InitialiseDedicated"); @@ -312,7 +312,7 @@ ON_DLL_LOAD_DEDI("engine.dll", DedicatedServer, (HMODULE engineAddress) spdlog::info("Console input disabled by user request"); }) -ON_DLL_LOAD_DEDI("tier0.dll", DedicatedServerOrigin, (HMODULE baseAddress) +ON_DLL_LOAD_DEDI("tier0.dll", DedicatedServerOrigin, [](HMODULE baseAddress) { // disable origin on dedicated // for any big ea lawyers, this can't be used to play the game without origin, game will throw a fit if you try to do anything without @@ -333,7 +333,7 @@ void PrintFatalSquirrelErrorHook(void* sqvm) g_pEngine->m_nQuitting = EngineQuitState::QUIT_TODESKTOP; } -ON_DLL_LOAD_DEDI("server.dll", DedicatedServerGameDLL, (HMODULE baseAddress) +ON_DLL_LOAD_DEDI("server.dll", DedicatedServerGameDLL, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK(hook, baseAddress + 0x794D0, &PrintFatalSquirrelErrorHook, reinterpret_cast(&PrintFatalSquirrelError)); diff --git a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp index 50f1a1b4..e83f9dfb 100644 --- a/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp +++ b/NorthstarDedicatedTest/dedicatedmaterialsystem.cpp @@ -47,7 +47,7 @@ HRESULT __stdcall D3D11CreateDeviceHook( pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); } -ON_DLL_LOAD_DEDI("materialsystem_dx11.dll", DedicatedServerMaterialSystem, (HMODULE baseAddress) +ON_DLL_LOAD_DEDI("materialsystem_dx11.dll", DedicatedServerMaterialSystem, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0xD9A0E, &D3D11CreateDeviceHook, reinterpret_cast(&D3D11CreateDevice)); diff --git a/NorthstarDedicatedTest/filesystem.cpp b/NorthstarDedicatedTest/filesystem.cpp index f53f4b9e..3410bdd4 100644 --- a/NorthstarDedicatedTest/filesystem.cpp +++ b/NorthstarDedicatedTest/filesystem.cpp @@ -34,7 +34,7 @@ bool readingOriginalFile; std::string currentModPath; SourceInterface* g_Filesystem; -ON_DLL_LOAD("filesystem_stdio.dll", Filesystem, (HMODULE baseAddress) +ON_DLL_LOAD("filesystem_stdio.dll", Filesystem, [](HMODULE baseAddress) { g_Filesystem = new SourceInterface("filesystem_stdio.dll", "VFileSystem017"); diff --git a/NorthstarDedicatedTest/hooks.h b/NorthstarDedicatedTest/hooks.h index 7f4eefbc..bc0a6311 100644 --- a/NorthstarDedicatedTest/hooks.h +++ b/NorthstarDedicatedTest/hooks.h @@ -37,8 +37,7 @@ class __dllLoadCallback #define __STR(s) #s #define __ON_DLL_LOAD(dllName, func, side, counter, uniquestr, reliesOn) \ -void CONCAT(__callbackFunc, uniquestr, counter) func \ -__dllLoadCallback CONCAT(__dllLoadCallbackInstance, uniquestr, counter)(side, dllName, CONCAT(__callbackFunc, uniquestr, counter), __STR(uniquestr), reliesOn); +__dllLoadCallback CONCAT(__dllLoadCallbackInstance, uniquestr, counter)(side, dllName, func, __STR(uniquestr), reliesOn); #define ON_DLL_LOAD(dllName, uniquestr, func) __ON_DLL_LOAD(dllName, func, eDllLoadCallbackSide::UNSIDED, __LINE__, uniquestr, "") #define ON_DLL_LOAD_RELIESON(dllName, uniquestr, reliesOn, func) __ON_DLL_LOAD(dllName, func, eDllLoadCallbackSide::UNSIDED, __LINE__, uniquestr, __STR(reliesOn)) diff --git a/NorthstarDedicatedTest/keyvalues.cpp b/NorthstarDedicatedTest/keyvalues.cpp index 880089a3..a2c7281a 100644 --- a/NorthstarDedicatedTest/keyvalues.cpp +++ b/NorthstarDedicatedTest/keyvalues.cpp @@ -14,7 +14,7 @@ KeyValues__LoadFromBufferType KeyValues__LoadFromBuffer; char KeyValues__LoadFromBufferHook( void* self, const char* resourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7); -ON_DLL_LOAD("engine.dll", KeyValues, (HMODULE baseAddress) +ON_DLL_LOAD("engine.dll", KeyValues, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK( diff --git a/NorthstarDedicatedTest/languagehooks.cpp b/NorthstarDedicatedTest/languagehooks.cpp index 5e58924e..13288826 100644 --- a/NorthstarDedicatedTest/languagehooks.cpp +++ b/NorthstarDedicatedTest/languagehooks.cpp @@ -114,7 +114,7 @@ char* GetGameLanguageHook() return lang; } -ON_DLL_LOAD_CLIENT("tier0.dll", LanguageHooks, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT("tier0.dll", LanguageHooks, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0xF560, &GetGameLanguageHook, reinterpret_cast(&GetGameLanguageOriginal)); diff --git a/NorthstarDedicatedTest/latencyflex.cpp b/NorthstarDedicatedTest/latencyflex.cpp index 3ef9d21d..a2c044cf 100644 --- a/NorthstarDedicatedTest/latencyflex.cpp +++ b/NorthstarDedicatedTest/latencyflex.cpp @@ -21,7 +21,7 @@ void OnRenderStartHook() OnRenderStart(); } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", LatencyFlex, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", LatencyFlex, ConVar, [](HMODULE baseAddress) { // Connect to the LatencyFleX service // LatencyFleX is an open source vendor agnostic replacement for Nvidia Reflex input latency reduction technology. diff --git a/NorthstarDedicatedTest/localchatwriter.cpp b/NorthstarDedicatedTest/localchatwriter.cpp index 05d8be2e..81a0286a 100644 --- a/NorthstarDedicatedTest/localchatwriter.cpp +++ b/NorthstarDedicatedTest/localchatwriter.cpp @@ -437,7 +437,7 @@ void LocalChatWriter::InsertDefaultFade() } } -ON_DLL_LOAD_CLIENT("client.dll", LocalChatWriter, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT("client.dll", LocalChatWriter, [](HMODULE baseAddress) { gGameSettings = (CGameSettings**)((char*)baseAddress + 0x11BAA48); gChatFadeLength = (CGameFloatVar**)((char*)baseAddress + 0x11BAB78); diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp index 16b1e5b5..0c7e374f 100644 --- a/NorthstarDedicatedTest/logging.cpp +++ b/NorthstarDedicatedTest/logging.cpp @@ -408,7 +408,7 @@ bool CClientState_ProcessPrint_Hook(__int64 thisptr, __int64 msg) return true; } -ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", EngineSpewFuncHooks, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", EngineSpewFuncHooks, ConVar, [](HMODULE baseAddress) { HookEnabler hook; @@ -475,7 +475,7 @@ void TextMsgHook(BFRead* msg) } } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ClientPrintHooks, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ClientPrintHooks, ConVar, [](HMODULE baseAddress) { HookEnabler hook; diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp index 63915732..1ef53c7d 100644 --- a/NorthstarDedicatedTest/masterserver.cpp +++ b/NorthstarDedicatedTest/masterserver.cpp @@ -1303,7 +1303,7 @@ void CHostState__State_GameShutdownHook(CHostState* hostState) MasterServerManager::MasterServerManager() : m_pendingConnectionInfo {}, m_sOwnServerId {""}, m_sOwnClientAuthToken {""} {} -ON_DLL_LOAD_RELIESON("engine.dll", MasterServer, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("engine.dll", MasterServer, ConCommand, [](HMODULE baseAddress) { Cvar_ns_masterserver_hostname = new ConVar("ns_masterserver_hostname", "127.0.0.1", FCVAR_NONE, ""); // unfortunately lib doesn't let us specify a port and still have https work diff --git a/NorthstarDedicatedTest/maxplayers.cpp b/NorthstarDedicatedTest/maxplayers.cpp index 15846ea8..3968120a 100644 --- a/NorthstarDedicatedTest/maxplayers.cpp +++ b/NorthstarDedicatedTest/maxplayers.cpp @@ -110,7 +110,7 @@ bool MaxPlayersIncreaseEnabled() return Tier0::CommandLine() && Tier0::CommandLine()->CheckParm("-experimentalmaxplayersincrease"); } -ON_DLL_LOAD("engine.dll", MaxPlayersOverride_Engine, (HMODULE baseAddress) +ON_DLL_LOAD("engine.dll", MaxPlayersOverride_Engine, [](HMODULE baseAddress) { if (!MaxPlayersIncreaseEnabled()) return; @@ -322,7 +322,7 @@ __int64 __fastcall SendPropArray2_Hook(__int64 recvProp, int elements, int flags return SendPropArray2_Original(recvProp, elements, flags, name, proxyFn, unk1); } -ON_DLL_LOAD("server.dll", MaxPlayersOverride_Server, (HMODULE baseAddress) +ON_DLL_LOAD("server.dll", MaxPlayersOverride_Server, [](HMODULE baseAddress) { if (!MaxPlayersIncreaseEnabled()) return; @@ -500,7 +500,7 @@ __int64 __fastcall RecvPropArray2_Hook(__int64 recvProp, int elements, int flags return RecvPropArray2_Original(recvProp, elements, flags, name, proxyFn); } -ON_DLL_LOAD("client.dll", MaxPlayersOverride_Client, (HMODULE baseAddress) +ON_DLL_LOAD("client.dll", MaxPlayersOverride_Client, [](HMODULE baseAddress) { if (!MaxPlayersIncreaseEnabled()) return; diff --git a/NorthstarDedicatedTest/miscclientfixes.cpp b/NorthstarDedicatedTest/miscclientfixes.cpp index 68f83550..a72e1893 100644 --- a/NorthstarDedicatedTest/miscclientfixes.cpp +++ b/NorthstarDedicatedTest/miscclientfixes.cpp @@ -29,7 +29,7 @@ void* CrashingWeaponActivityFunc1Hook(void* a1) return CrashingWeaponActivityFunc1(a1); } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", MiscClientFixes, ConVar, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", MiscClientFixes, ConVar, [](HMODULE baseAddress) { HookEnabler hook; diff --git a/NorthstarDedicatedTest/miscserverfixes.cpp b/NorthstarDedicatedTest/miscserverfixes.cpp index 94e56e5d..eca7f798 100644 --- a/NorthstarDedicatedTest/miscserverfixes.cpp +++ b/NorthstarDedicatedTest/miscserverfixes.cpp @@ -5,7 +5,7 @@ #include "NSMem.h" -ON_DLL_LOAD("server.dll", MiscServerFixes, (HMODULE baseAddress) +ON_DLL_LOAD("server.dll", MiscServerFixes, [](HMODULE baseAddress) { uintptr_t ba = (uintptr_t)baseAddress; diff --git a/NorthstarDedicatedTest/miscserverscript.cpp b/NorthstarDedicatedTest/miscserverscript.cpp index 5d346b2a..b8ab951a 100644 --- a/NorthstarDedicatedTest/miscserverscript.cpp +++ b/NorthstarDedicatedTest/miscserverscript.cpp @@ -58,7 +58,7 @@ SQRESULT SQ_IsPlayerIndexLocalPlayer(void* sqvm) return SQRESULT_NOTNULL; } -ON_DLL_LOAD_RELIESON("server.dll", MiscServerScriptCommands, ServerSquirrel, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("server.dll", MiscServerScriptCommands, ServerSquirrel, [](HMODULE baseAddress) { g_pServerSquirrel->AddFuncRegistration( "void", "NSEarlyWritePlayerIndexPersistenceForLeave", "int playerIndex", "", SQ_EarlyWritePlayerIndexPersistenceForLeave); diff --git a/NorthstarDedicatedTest/modlocalisation.cpp b/NorthstarDedicatedTest/modlocalisation.cpp index 45f5a289..0fc02596 100644 --- a/NorthstarDedicatedTest/modlocalisation.cpp +++ b/NorthstarDedicatedTest/modlocalisation.cpp @@ -31,7 +31,7 @@ bool AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, const char return ret; } -ON_DLL_LOAD_CLIENT("localize.dll", Localize, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT("localize.dll", Localize, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x6D80, AddLocalisationFileHook, reinterpret_cast(&AddLocalisationFile)); diff --git a/NorthstarDedicatedTest/modmanager.cpp b/NorthstarDedicatedTest/modmanager.cpp index 0b733ebf..e2773f5a 100644 --- a/NorthstarDedicatedTest/modmanager.cpp +++ b/NorthstarDedicatedTest/modmanager.cpp @@ -571,7 +571,7 @@ void ConCommand_reload_mods(const CCommand& args) g_ModManager->LoadMods(); } -ON_DLL_LOAD_RELIESON("engine.dll", ModManager, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("engine.dll", ModManager, ConCommand, [](HMODULE baseAddress) { g_ModManager = new ModManager; diff --git a/NorthstarDedicatedTest/playlist.cpp b/NorthstarDedicatedTest/playlist.cpp index f91f3f3a..f8c64502 100644 --- a/NorthstarDedicatedTest/playlist.cpp +++ b/NorthstarDedicatedTest/playlist.cpp @@ -76,7 +76,7 @@ int GetCurrentGamemodeMaxPlayersHook() return maxPlayers; } -ON_DLL_LOAD_RELIESON("engine.dll", PlaylistHooks, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("engine.dll", PlaylistHooks, ConCommand, [](HMODULE baseAddress) { // playlist is the name of the command on respawn servers, but we already use setplaylist so can't get rid of it RegisterConCommand("playlist", ConCommand_playlist, "Sets the current playlist", FCVAR_NONE); diff --git a/NorthstarDedicatedTest/plugins.cpp b/NorthstarDedicatedTest/plugins.cpp index ae651d09..9f0c062f 100644 --- a/NorthstarDedicatedTest/plugins.cpp +++ b/NorthstarDedicatedTest/plugins.cpp @@ -385,7 +385,7 @@ int getPlayerInfoBool(bool* out_ptr, PlayerInfoType var) return n; } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", PluginCommands, ClientSquirrel, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", PluginCommands, ClientSquirrel, [](HMODULE baseAddress) { // i swear there's a way to make this not have be run in 2 contexts but i can't figure it out // some funcs i need are just not available in UI or CLIENT diff --git a/NorthstarDedicatedTest/rpakfilesystem.cpp b/NorthstarDedicatedTest/rpakfilesystem.cpp index fce7ddf1..c9f01b89 100644 --- a/NorthstarDedicatedTest/rpakfilesystem.cpp +++ b/NorthstarDedicatedTest/rpakfilesystem.cpp @@ -207,7 +207,7 @@ void* ReadFullFileFromDiskHook(const char* requestedPath, void* a2) return ret; } -ON_DLL_LOAD("engine.dll", RpakFilesystem, (HMODULE baseAddress) +ON_DLL_LOAD("engine.dll", RpakFilesystem, [](HMODULE baseAddress) { g_pPakLoadManager = new PakLoadManager; diff --git a/NorthstarDedicatedTest/scriptbrowserhooks.cpp b/NorthstarDedicatedTest/scriptbrowserhooks.cpp index d27c9e0e..007bf412 100644 --- a/NorthstarDedicatedTest/scriptbrowserhooks.cpp +++ b/NorthstarDedicatedTest/scriptbrowserhooks.cpp @@ -18,7 +18,7 @@ void OpenExternalWebBrowserHook(char* url, char flags) *bIsOriginOverlayEnabled = bIsOriginOverlayEnabledOriginal; } -ON_DLL_LOAD_CLIENT("engine.dll", ScriptExternalBrowserHooks, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT("engine.dll", ScriptExternalBrowserHooks, [](HMODULE baseAddress) { bIsOriginOverlayEnabled = (bool*)baseAddress + 0x13978255; diff --git a/NorthstarDedicatedTest/scriptmainmenupromos.cpp b/NorthstarDedicatedTest/scriptmainmenupromos.cpp index cb398251..0a49f491 100644 --- a/NorthstarDedicatedTest/scriptmainmenupromos.cpp +++ b/NorthstarDedicatedTest/scriptmainmenupromos.cpp @@ -129,7 +129,7 @@ SQRESULT SQ_GetCustomMainMenuPromoData(void* sqvm) return SQRESULT_NOTNULL; } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptMainMenuPrograms, ClientSquirrel, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptMainMenuPrograms, ClientSquirrel, [](HMODULE baseAddress) { g_pUISquirrel->AddFuncRegistration("void", "NSRequestCustomMainMenuPromos", "", "", SQ_RequestCustomMainMenuPromos); g_pUISquirrel->AddFuncRegistration("bool", "NSHasCustomMainMenuPromoData", "", "", SQ_HasCustomMainMenuPromoData); diff --git a/NorthstarDedicatedTest/scriptmodmenu.cpp b/NorthstarDedicatedTest/scriptmodmenu.cpp index e27634f2..75f75d44 100644 --- a/NorthstarDedicatedTest/scriptmodmenu.cpp +++ b/NorthstarDedicatedTest/scriptmodmenu.cpp @@ -176,7 +176,7 @@ SQRESULT SQ_ReloadMods(void* sqvm) return SQRESULT_NULL; } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptModMenu, ClientSquirrel, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptModMenu, ClientSquirrel, [](HMODULE baseAddress) { g_pUISquirrel->AddFuncRegistration("array", "NSGetModNames", "", "Returns the names of all loaded mods", SQ_GetModNames); g_pUISquirrel->AddFuncRegistration( diff --git a/NorthstarDedicatedTest/scriptserverbrowser.cpp b/NorthstarDedicatedTest/scriptserverbrowser.cpp index 4f2b9bd0..3b4647b5 100644 --- a/NorthstarDedicatedTest/scriptserverbrowser.cpp +++ b/NorthstarDedicatedTest/scriptserverbrowser.cpp @@ -408,7 +408,7 @@ SQRESULT SQ_CompleteAuthWithLocalServer(void* sqvm) return SQRESULT_NULL; } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptServerBrowser, ClientSquirrel, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptServerBrowser, ClientSquirrel, [](HMODULE baseAddress) { g_pUISquirrel->AddFuncRegistration("bool", "NSIsMasterServerAuthenticated", "", "", SQ_IsMasterServerAuthenticated); g_pUISquirrel->AddFuncRegistration("void", "NSRequestServerList", "", "", SQ_RequestServerList); diff --git a/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp b/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp index 79dde3e4..51e42335 100644 --- a/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp +++ b/NorthstarDedicatedTest/scriptservertoclientstringcommand.cpp @@ -15,7 +15,7 @@ void ConCommand_ns_script_servertoclientstringcommand(const CCommand& arg) } } -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptServerToClientStringCommand, ClientSquirrel, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", ScriptServerToClientStringCommand, ClientSquirrel, [](HMODULE baseAddress) { RegisterConCommand( "ns_script_servertoclientstringcommand", diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index d7e67af8..3660eada 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -612,7 +612,7 @@ void ConCommand_ns_resetpersistence(const CCommand& args) g_ServerAuthenticationManager->m_bForceReadLocalPlayerPersistenceFromDisk = true; } -ON_DLL_LOAD_RELIESON("engine.dll", ServerAuthentication, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("engine.dll", ServerAuthentication, ConCommand, [](HMODULE baseAddress) { g_ServerAuthenticationManager = new ServerAuthenticationManager; diff --git a/NorthstarDedicatedTest/serverchathooks.cpp b/NorthstarDedicatedTest/serverchathooks.cpp index 5ac582fd..472727c4 100644 --- a/NorthstarDedicatedTest/serverchathooks.cpp +++ b/NorthstarDedicatedTest/serverchathooks.cpp @@ -173,12 +173,12 @@ SQRESULT SQ_BroadcastMessage(void* sqvm) return SQRESULT_NULL; } -ON_DLL_LOAD("engine.dll", EngineServerChatHooks, (HMODULE baseAddress) +ON_DLL_LOAD("engine.dll", EngineServerChatHooks, [](HMODULE baseAddress) { g_pServerGameDLL = (CServerGameDLL*)((char*)baseAddress + 0x13F0AA98); }) -ON_DLL_LOAD_RELIESON("server.dll", ServerChatHooks, ServerSquirrel, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("server.dll", ServerChatHooks, ServerSquirrel, [](HMODULE baseAddress) { CServerGameDLL__OnReceivedSayTextMessage = (CServerGameDLL__OnReceivedSayTextMessageType)((char*)baseAddress + 0x1595C0); UTIL_PlayerByIndex = (UTIL_PlayerByIndexType)((char*)baseAddress + 0x26AA10); diff --git a/NorthstarDedicatedTest/sourceconsole.cpp b/NorthstarDedicatedTest/sourceconsole.cpp index 8e1dcb83..8f56d6c4 100644 --- a/NorthstarDedicatedTest/sourceconsole.cpp +++ b/NorthstarDedicatedTest/sourceconsole.cpp @@ -84,7 +84,7 @@ void SourceConsoleSink::sink_it_(const spdlog::details::log_msg& msg) void SourceConsoleSink::flush_() {} -ON_DLL_LOAD_CLIENT_RELIESON("client.dll", SourceConsole, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_CLIENT_RELIESON("client.dll", SourceConsole, ConCommand, [](HMODULE baseAddress) { g_SourceGameConsole = new SourceInterface("client.dll", "GameConsole004"); RegisterConCommand("toggleconsole", ConCommand_toggleconsole, "toggles the console", FCVAR_DONTRECORD); diff --git a/NorthstarDedicatedTest/sourceinterface.cpp b/NorthstarDedicatedTest/sourceinterface.cpp index e80a067d..2ed3f592 100644 --- a/NorthstarDedicatedTest/sourceinterface.cpp +++ b/NorthstarDedicatedTest/sourceinterface.cpp @@ -36,7 +36,7 @@ void* EngineCreateInterfaceHook(const char* pName, int* pReturnCode) return ret; } -ON_DLL_LOAD("client.dll", ClientInterface, (HMODULE baseAddress) +ON_DLL_LOAD("client.dll", ClientInterface, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK( @@ -46,7 +46,7 @@ ON_DLL_LOAD("client.dll", ClientInterface, (HMODULE baseAddress) reinterpret_cast(&ClientCreateInterfaceOriginal)); }) -ON_DLL_LOAD("server.dll", ServerInterface, (HMODULE baseAddress) +ON_DLL_LOAD("server.dll", ServerInterface, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK( @@ -56,7 +56,7 @@ ON_DLL_LOAD("server.dll", ServerInterface, (HMODULE baseAddress) reinterpret_cast(&ServerCreateInterfaceOriginal)); }) -ON_DLL_LOAD("engine.dll", EngineInterface, (HMODULE baseAddress) +ON_DLL_LOAD("engine.dll", EngineInterface, [](HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK( diff --git a/NorthstarDedicatedTest/squirrel.cpp b/NorthstarDedicatedTest/squirrel.cpp index 754661a4..ea23672a 100644 --- a/NorthstarDedicatedTest/squirrel.cpp +++ b/NorthstarDedicatedTest/squirrel.cpp @@ -235,7 +235,7 @@ template void ConCommand_script(const CCommand& args) g_pServerSquirrel->ExecuteCode(args.ArgS()); } -ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, [](HMODULE baseAddress) { HookEnabler hook; @@ -258,7 +258,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (HMODULE baseAddr &SQPrintHook, reinterpret_cast(&UISQPrint)); // ui print function RegisterConCommand("script_ui", ConCommand_script, "Executes script code on the ui vm", FCVAR_CLIENTDLL); - + g_pClientSquirrel->RegisterSquirrelFunc = (RegisterSquirrelFuncType)((char*)baseAddress + 0x108E0); g_pUISquirrel->RegisterSquirrelFunc = (RegisterSquirrelFuncType)((char*)baseAddress + 0x108E0); @@ -322,7 +322,7 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (HMODULE baseAddr reinterpret_cast(&ClientCallScriptInitCallback)); // client callscriptinitcallback function }) -ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (HMODULE baseAddress) +ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, [](HMODULE baseAddress) { g_pServerSquirrel = new SquirrelManager; diff --git a/NorthstarDedicatedTest/tier0.cpp b/NorthstarDedicatedTest/tier0.cpp index 1a0957ad..a34aaea5 100644 --- a/NorthstarDedicatedTest/tier0.cpp +++ b/NorthstarDedicatedTest/tier0.cpp @@ -23,7 +23,7 @@ void TryCreateGlobalMemAlloc() Tier0::g_pMemAllocSingleton = CreateGlobalMemAlloc(); // if it already exists, this returns the preexisting IMemAlloc instance } -ON_DLL_LOAD("tier0.dll", Tier0GameFuncs, (HMODULE baseAddress) +ON_DLL_LOAD("tier0.dll", Tier0GameFuncs, [](HMODULE baseAddress) { // shouldn't be necessary, but do this just in case TryCreateGlobalMemAlloc(); -- cgit v1.2.3