aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/logging.cpp
diff options
context:
space:
mode:
authorHappyDOGE <28511119+HappyDOGE@users.noreply.github.com>2021-12-28 12:18:58 +0300
committerHappyDOGE <28511119+HappyDOGE@users.noreply.github.com>2021-12-28 12:18:58 +0300
commite49f026c92c75c4f10afd7f8895d8ebe2a01e97d (patch)
treec7350f3f743b9a429b72538d41121c557fb20a2b /NorthstarDedicatedTest/logging.cpp
parentbea776a8f6bcba5f702483d868d6fb6c4a069416 (diff)
downloadNorthstarLauncher-e49f026c92c75c4f10afd7f8895d8ebe2a01e97d.tar.gz
NorthstarLauncher-e49f026c92c75c4f10afd7f8895d8ebe2a01e97d.zip
implement svc_Print, copy NS hostname to source cvar
Diffstat (limited to 'NorthstarDedicatedTest/logging.cpp')
-rw-r--r--NorthstarDedicatedTest/logging.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp
index 6525df27..0e72cc80 100644
--- a/NorthstarDedicatedTest/logging.cpp
+++ b/NorthstarDedicatedTest/logging.cpp
@@ -331,6 +331,21 @@ void Status_ConMsg_Hook(const char* text, ...)
spdlog::info(formatted);
}
+typedef bool(*CClientState_ProcessPrint_Type)(__int64 thisptr, __int64 msg);
+CClientState_ProcessPrint_Type CClientState_ProcessPrint_Original;
+
+bool CClientState_ProcessPrint_Hook(__int64 thisptr, __int64 msg)
+{
+ char* text = *(char**)(msg + 0x20);
+
+ auto endpos = strlen(text);
+ if (text[endpos - 1] == '\n')
+ text[endpos - 1] = '\0'; // cut off repeated newline
+
+ spdlog::info(text);
+ return true;
+}
+
void InitialiseEngineSpewFuncHooks(HMODULE baseAddress)
{
HookEnabler hook;
@@ -339,4 +354,7 @@ void InitialiseEngineSpewFuncHooks(HMODULE baseAddress)
// Hook print function that status concmd uses to actually print data
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x15ABD0, Status_ConMsg_Hook, reinterpret_cast<LPVOID*>(&Status_ConMsg_Original));
+
+ // Hook CClientState::ProcessPrint
+ ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x1A1530, CClientState_ProcessPrint_Hook, reinterpret_cast<LPVOID*>(&CClientState_ProcessPrint_Original));
} \ No newline at end of file