diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-09 00:40:53 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-09 00:40:53 +0100 |
commit | f230156cbebc1b93db5e254410ee2ab3a8dcb27c (patch) | |
tree | e98c72fabbff37a55e7f9216c52e4f8ef2084073 /NorthstarDedicatedTest/dedicated.cpp | |
parent | 6c8112a6c368dd36d21fd94689e9682bc3b012a5 (diff) | |
download | NorthstarLauncher-f230156cbebc1b93db5e254410ee2ab3a8dcb27c.tar.gz NorthstarLauncher-f230156cbebc1b93db5e254410ee2ab3a8dcb27c.zip |
use in-file macros rather than global funcs for registering dll load callbacks
Diffstat (limited to 'NorthstarDedicatedTest/dedicated.cpp')
-rw-r--r-- | NorthstarDedicatedTest/dedicated.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp index 5099a6d2..8f43c506 100644 --- a/NorthstarDedicatedTest/dedicated.cpp +++ b/NorthstarDedicatedTest/dedicated.cpp @@ -1,4 +1,5 @@ #include "pch.h" +#include "hooks.h" #include "dedicated.h" #include "hookutils.h" #include "gameutils.h" @@ -128,7 +129,7 @@ DWORD WINAPI ConsoleInputThread(PVOID pThreadParameter) } #include "NSMem.h" -void InitialiseDedicated(HMODULE engineAddress) +ON_DLL_LOAD_DEDI("engine.dll", DedicatedServer, (HMODULE engineAddress) { spdlog::info("InitialiseDedicated"); @@ -141,6 +142,12 @@ void InitialiseDedicated(HMODULE engineAddress) } { + // Host_Init + // don't call Key_Init to avoid loading some extra rsons from rpak (will be necessary to boot if we ever wanna disable rpaks entirely) + NSMem::NOP(ea + 0x1565B0, 5); + } + + { // CModAppSystemGroup::Create // force the engine into dedicated mode by changing the first comparison to IsServerOnly to an assignment auto ptr = ea + 0x1C4EBD; @@ -299,9 +306,9 @@ void InitialiseDedicated(HMODULE engineAddress) consoleInputThreadHandle = CreateThread(0, 0, ConsoleInputThread, 0, 0, NULL); else spdlog::info("Console input disabled by user request"); -} +}) -void InitialiseDedicatedOrigin(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 @@ -312,7 +319,7 @@ void InitialiseDedicatedOrigin(HMODULE baseAddress) { 0xC3 // ret }); -} +}) typedef void (*PrintFatalSquirrelErrorType)(void* sqvm); PrintFatalSquirrelErrorType PrintFatalSquirrelError; @@ -322,8 +329,8 @@ void PrintFatalSquirrelErrorHook(void* sqvm) g_pEngine->m_nQuitting = EngineQuitState::QUIT_TODESKTOP; } -void InitialiseDedicatedServerGameDLL(HMODULE baseAddress) +ON_DLL_LOAD_DEDI("server.dll", DedicatedServerGameDLL, (HMODULE baseAddress) { HookEnabler hook; ENABLER_CREATEHOOK(hook, baseAddress + 0x794D0, &PrintFatalSquirrelErrorHook, reinterpret_cast<LPVOID*>(&PrintFatalSquirrelError)); -}
\ No newline at end of file +})
\ No newline at end of file |