aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NorthstarDedicatedTest/dedicated.cpp61
-rw-r--r--NorthstarDedicatedTest/gameutils.h4
2 files changed, 54 insertions, 11 deletions
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp
index b48bcc62..1d59cc91 100644
--- a/NorthstarDedicatedTest/dedicated.cpp
+++ b/NorthstarDedicatedTest/dedicated.cpp
@@ -52,11 +52,18 @@ void RunServer(CDedicatedExports* dedicated)
{
g_pEngine->Frame();
- spdlog::info("g_pEngine->Frame() on map {} took {}ms", g_pHostState->m_levelName, g_pEngine->GetFrameTime());
+ SetConsoleTitleA(fmt::format("Titanfall 2 dedicated server - {} {}/{} players", g_pHostState->m_levelName, "0", "0").c_str());
Sleep(50);
}
}
+typedef bool(*IsGameActiveWindowType)();
+IsGameActiveWindowType IsGameActiveWindow;
+bool IsGameActiveWindowHook()
+{
+ return true;
+}
+
void InitialiseDedicated(HMODULE engineAddress)
{
if (!IsDedicated())
@@ -143,14 +150,19 @@ void InitialiseDedicated(HMODULE engineAddress)
*(ptr + 4) = (char)0x90;
*(ptr + 5) = (char)0x90;
*(ptr + 6) = (char)0x90;
- *(ptr + 7) = (char)0x90;
- *(ptr + 8) = (char)0x90;
- *(ptr + 9) = (char)0x90;
- *(ptr + 10) = (char)0x90;
- *(ptr + 11) = (char)0x90;
- *(ptr + 12) = (char)0x90;
- *(ptr + 13) = (char)0x90;
- *(ptr + 14) = (char)0x90;
+
+ // previously patched these, took me a couple weeks to figure out they were the issue
+ // removing these will mess up register state when this function is over, so we'll write HS_RUN to the wrong address
+ // so uhh, don't do that
+ //*(ptr + 7) = (char)0x90;
+ //*(ptr + 8) = (char)0x90;
+ //*(ptr + 9) = (char)0x90;
+ //*(ptr + 10) = (char)0x90;
+ //*(ptr + 11) = (char)0x90;
+ //*(ptr + 12) = (char)0x90;
+ //*(ptr + 13) = (char)0x90;
+ //*(ptr + 14) = (char)0x90;
+
*(ptr + 15) = (char)0x90;
*(ptr + 16) = (char)0x90;
*(ptr + 17) = (char)0x90;
@@ -158,6 +170,8 @@ void InitialiseDedicated(HMODULE engineAddress)
*(ptr + 19) = (char)0x90;
*(ptr + 20) = (char)0x90;
*(ptr + 21) = (char)0x90;
+ *(ptr + 22) = (char)0x90;
+ *(ptr + 23) = (char)0x90;
}
{
@@ -215,6 +229,32 @@ void InitialiseDedicated(HMODULE engineAddress)
*(ptr + 2) = (char)0x90;
}
+ {
+ // some function that gets called from RunFrameServer
+ char* ptr = (char*)engineAddress + 0x15A0BB;
+ TempReadWrite rw(ptr);
+
+ // nop a function that makes requests to stryder, this will eventually access violation if left alone and isn't necessary anyway
+ *ptr = (char)0x90;
+ *(ptr + 1) = (char)0x90;
+ *(ptr + 2) = (char)0x90;
+ *(ptr + 3) = (char)0x90;
+ *(ptr + 4) = (char)0x90;
+ }
+
+ {
+ // some function that gets called from RunFrameServer
+ char* ptr = (char*)engineAddress + 0x159BF3;
+ TempReadWrite rw(ptr);
+
+ // nop a function that makes requests to stryder, this will eventually access violation if left alone and isn't necessary anyway
+ *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;
dedicatedExports->Sys_Printf = Sys_Printf;
@@ -222,6 +262,9 @@ void InitialiseDedicated(HMODULE engineAddress)
CDedicatedExports** exports = (CDedicatedExports**)((char*)engineAddress + 0x13F0B668);
*exports = dedicatedExports;
+
+ HookEnabler hook;
+ ENABLER_CREATEHOOK(hook, (char*)engineAddress + 0x1CDC80, &IsGameActiveWindowHook, reinterpret_cast<LPVOID*>(&IsGameActiveWindow));
// extra potential patches:
// nop engine.dll+1c67d1 and +1c67d8 to skip videomode creategamewindow
diff --git a/NorthstarDedicatedTest/gameutils.h b/NorthstarDedicatedTest/gameutils.h
index f63d4c81..cabd3edb 100644
--- a/NorthstarDedicatedTest/gameutils.h
+++ b/NorthstarDedicatedTest/gameutils.h
@@ -147,12 +147,13 @@ enum EngineState_t
class CEngine
{
public:
+ virtual void unknown() {} // unsure if this is where
virtual bool Load(bool dedicated, const char* baseDir) {}
virtual void Unload() {}
virtual void SetNextState(EngineState_t iNextState) {}
virtual EngineState_t GetState() {}
virtual void Frame() {}
- virtual float GetFrameTime() {}
+ virtual double GetFrameTime() {}
virtual float GetCurTime() {}
EngineQuitState m_nQuitting;
@@ -171,7 +172,6 @@ extern CEngine* g_pEngine;
extern ConVar* Cvar_hostport;
-
// playlist stuff
typedef const char*(*GetCurrentPlaylistType)();