aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHappyDOGE <28511119+HappyDOGE@users.noreply.github.com>2021-12-27 15:50:01 +0300
committerHappyDOGE <28511119+HappyDOGE@users.noreply.github.com>2021-12-27 15:50:01 +0300
commit22f39a161516fee4e1350ec4e8830c120d1d53c5 (patch)
tree9fc0e67d1fd0a8e53f6ec4254be68c9ae03b0390
parent2dac0c0c284f2464b919c1f20c741dda8ff17163 (diff)
downloadNorthstarLauncher-22f39a161516fee4e1350ec4e8830c120d1d53c5.tar.gz
NorthstarLauncher-22f39a161516fee4e1350ec4e8830c120d1d53c5.zip
fix status command not working for server operator
-rw-r--r--NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters6
-rw-r--r--NorthstarDedicatedTest/logging.cpp30
2 files changed, 35 insertions, 1 deletions
diff --git a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
index 37be2f7e..a3d5e82d 100644
--- a/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
+++ b/NorthstarDedicatedTest/NorthstarDedicatedTest.vcxproj.filters
@@ -1499,6 +1499,12 @@
<ClCompile Include="miscclientfixes.cpp">
<Filter>Source Files\Client</Filter>
</ClCompile>
+ <ClCompile Include="maxplayers.cpp">
+ <Filter>Source Files\Shared</Filter>
+ </ClCompile>
+ <ClCompile Include="miscserverfixes.cpp">
+ <Filter>Source Files\Server</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="include\spdlog\fmt\bundled\LICENSE.rst">
diff --git a/NorthstarDedicatedTest/logging.cpp b/NorthstarDedicatedTest/logging.cpp
index 09ae6961..6525df27 100644
--- a/NorthstarDedicatedTest/logging.cpp
+++ b/NorthstarDedicatedTest/logging.cpp
@@ -242,7 +242,7 @@ void EngineSpewFuncHook(void* engineServer, SpewType_t type, const char* format,
}
}
- char formatted[2048];
+ char formatted[2048] = { 0 };
bool shouldFormat = true;
// because titanfall 2 is quite possibly the worst thing to yet exist, it sometimes gives invalid specifiers which will crash
@@ -304,11 +304,39 @@ void EngineSpewFuncHook(void* engineServer, SpewType_t type, const char* format,
spdlog::warn("Failed to format {} \"{}\"", typeStr, format);
}
+ auto endpos = strlen(formatted);
+ if (formatted[endpos - 1] == '\n')
+ formatted[endpos - 1] = '\0'; // cut off repeated newline
+
spdlog::info("[SERVER {}] {}", typeStr, formatted);
}
+
+typedef void(*Status_ConMsg_Type)(const char* text, ...);
+Status_ConMsg_Type Status_ConMsg_Original;
+
+void Status_ConMsg_Hook(const char* text, ...)
+{
+ char formatted[2048];
+ va_list list;
+
+ va_start(list, text);
+ vsprintf_s(formatted, text, list);
+ va_end(list);
+
+ auto endpos = strlen(formatted);
+ if (formatted[endpos - 1] == '\n')
+ formatted[endpos - 1] = '\0'; // cut off repeated newline
+
+ spdlog::info(formatted);
+}
+
void InitialiseEngineSpewFuncHooks(HMODULE baseAddress)
{
HookEnabler hook;
+
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x11CA80, EngineSpewFuncHook, reinterpret_cast<LPVOID*>(&EngineSpewFunc));
+
+ // 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));
} \ No newline at end of file