diff options
author | p0358 <p0358@users.noreply.github.com> | 2021-12-31 22:25:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-31 22:25:40 +0100 |
commit | dcba96bcc4b02639e859b0dcdc863391cb54684f (patch) | |
tree | 99d129460365774ae011d83b3765e7d9388c44a7 /NorthstarDedicatedTest/dedicated.cpp | |
parent | 4f7c3d02943a38941b79a638c5607b2b7f668956 (diff) | |
parent | d658c0c8374f8491e062fabe031f79185169c414 (diff) | |
download | NorthstarLauncher-dcba96bcc4b02639e859b0dcdc863391cb54684f.tar.gz NorthstarLauncher-dcba96bcc4b02639e859b0dcdc863391cb54684f.zip |
Merge pull request #1 from geniiii/p0358-refactor-fixes
Fixes, removal of fallback linear allocator
Diffstat (limited to 'NorthstarDedicatedTest/dedicated.cpp')
-rw-r--r-- | NorthstarDedicatedTest/dedicated.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp index 851ab861..0ecc1dba 100644 --- a/NorthstarDedicatedTest/dedicated.cpp +++ b/NorthstarDedicatedTest/dedicated.cpp @@ -13,7 +13,7 @@ bool IsDedicated() // CDedidcatedExports defs struct CDedicatedExports; // forward declare -typedef void (*DedicatedSys_PrintfType)(CDedicatedExports* dedicated, char* msg); +typedef void (*DedicatedSys_PrintfType)(CDedicatedExports* dedicated, const char* msg); typedef void (*DedicatedRunServerType)(CDedicatedExports* dedicated); // would've liked to just do this as a class but have not been able to get it to work @@ -27,7 +27,7 @@ struct CDedicatedExports DedicatedRunServerType RunServer; }; -void Sys_Printf(CDedicatedExports* dedicated, char* msg) +void Sys_Printf(CDedicatedExports* dedicated, const char* msg) { spdlog::info("[DEDICATED PRINT] {}", msg); } @@ -36,7 +36,7 @@ typedef void(*CHostState__InitType)(CHostState* self); void RunServer(CDedicatedExports* dedicated) { - Sys_Printf(dedicated, (char*)"CDedicatedExports::RunServer(): starting"); + Sys_Printf(dedicated, "CDedicatedExports::RunServer(): starting"); // init hoststate, if we don't do this, we get a crash later on CHostState__InitType CHostState__Init = (CHostState__InitType)((char*)GetModuleHandleA("engine.dll") + 0x16E110); @@ -383,23 +383,18 @@ void InitialiseDedicated(HMODULE engineAddress) CommandLine()->AppendParm("+exec", "autoexec_ns_server"); } -typedef void(*Tier0_InitOriginType)(); -Tier0_InitOriginType Tier0_InitOrigin; -void Tier0_InitOriginHook() +void InitialiseDedicatedOrigin(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 an origin id as a client // for dedi it's fine though, game doesn't care if origin is disabled as long as there's only a server - Tier0_InitOrigin(); -} -void InitialiseDedicatedOrigin(HMODULE baseAddress) -{ if (!IsDedicated()) return; - HookEnabler hook; - ENABLER_CREATEHOOK(hook, GetProcAddress(GetModuleHandleA("tier0.dll"), "Tier0_InitOrigin"), &Tier0_InitOriginHook, reinterpret_cast<LPVOID*>(&Tier0_InitOrigin)); + char* ptr = (char*)GetProcAddress(GetModuleHandleA("tier0.dll"), "Tier0_InitOrigin"); + TempReadWrite rw(ptr); + *ptr = (char)0xC3; } typedef void(*PrintFatalSquirrelErrorType)(void* sqvm); |