From 57c269f6f2202ca396bcbf9b6e8fffcd93e4db7c Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Wed, 15 Dec 2021 05:06:36 +0000 Subject: dedi ShowWindow patch --- NorthstarDedicatedTest/dedicated.cpp | 18 ++++++++++++++++++ NorthstarDedicatedTest/masterserver.cpp | 1 + NorthstarDedicatedTest/playlist.cpp | 15 --------------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp index 4c263d0c..f7b6f325 100644 --- a/NorthstarDedicatedTest/dedicated.cpp +++ b/NorthstarDedicatedTest/dedicated.cpp @@ -437,6 +437,24 @@ void InitialiseDedicated(HMODULE engineAddress) CommandLine()->AppendParm("-noshaderapi", 0); } + else + { + // for dedis where we still create a window, we can at least hide the window we create + // not great since we still run renderthread etc, but better than nothing + + { + // IVideoMode::CreateGameWindow + char* ptr = (char*)engineAddress + 0x1CD146; + TempReadWrite rw(ptr); + + // nop call to ShowWindow + *ptr = (char)0x90; + *(ptr + 1) = (char)0x90; + *(ptr + 2) = (char)0x90; + *(ptr + 3) = (char)0x90; + *(ptr + 4) = (char)0x90; + } + } CDedicatedExports* dedicatedExports = new CDedicatedExports; dedicatedExports->vtable = dedicatedExports; diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp index 4798a9b5..ce078633 100644 --- a/NorthstarDedicatedTest/masterserver.cpp +++ b/NorthstarDedicatedTest/masterserver.cpp @@ -641,6 +641,7 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name // heartbeat thread + // ideally this should actually be done in main thread, rather than on it's own thread, so it'd stop if server freezes std::thread heartbeatThread([this] { httplib::Client http(Cvar_ns_masterserver_hostname->m_pszString, Cvar_ns_masterserver_port->m_nValue); http.set_connection_timeout(10); diff --git a/NorthstarDedicatedTest/playlist.cpp b/NorthstarDedicatedTest/playlist.cpp index 20c76cb0..6339d3ba 100644 --- a/NorthstarDedicatedTest/playlist.cpp +++ b/NorthstarDedicatedTest/playlist.cpp @@ -47,19 +47,4 @@ void InitialisePlaylistHooks(HMODULE baseAddress) TempReadWrite rw(ptr); *((char*)ptr) = 0xC3; // jmp => ret } - - // on dedicated servers, force SetPlaylistVarOverride to always set the server's override list, irregardless of whether server is running yet - if (IsDedicated()) - { - // SetPlaylistVarOverride - void* ptr = (char*)baseAddress + 0x18ED17; - TempReadWrite rw(ptr); - - *((char*)ptr) = 0x90; // jl => nop - *((char*)ptr + 1) = 0x90; - *((char*)ptr + 2) = 0x90; - *((char*)ptr + 3) = 0x90; - *((char*)ptr + 4) = 0x90; - *((char*)ptr + 5) = 0x90; - } } \ No newline at end of file -- cgit v1.2.3