aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-09-30 21:12:54 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-09-30 21:12:54 +0100
commit8b93a09f5b12ce7967df5824794ed24b3ff31cdc (patch)
tree1ce680cb9134273870373134f845633e2c390bde
parent2497b700379205ea01c1aa0c55a19be523233be1 (diff)
downloadNorthstarLauncher-8b93a09f5b12ce7967df5824794ed24b3ff31cdc.tar.gz
NorthstarLauncher-8b93a09f5b12ce7967df5824794ed24b3ff31cdc.zip
add maxplayers to dedi window title
-rw-r--r--NorthstarDedicatedTest/dedicated.cpp3
-rw-r--r--NorthstarDedicatedTest/gameutils.cpp2
-rw-r--r--NorthstarDedicatedTest/gameutils.h9
-rw-r--r--NorthstarDedicatedTest/tier0.cpp2
4 files changed, 8 insertions, 8 deletions
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp
index c09797f8..1468f9d1 100644
--- a/NorthstarDedicatedTest/dedicated.cpp
+++ b/NorthstarDedicatedTest/dedicated.cpp
@@ -58,7 +58,8 @@ void RunServer(CDedicatedExports* dedicated)
{
g_pEngine->Frame();
- SetConsoleTitleA(fmt::format("Titanfall 2 dedicated server - {} {}/{} players", g_pHostState->m_levelName, g_ServerAuthenticationManager->m_additionalPlayerData.size(), "0").c_str());
+ // this way of getting playercount/maxplayers honestly really sucks, but not got any other methods of doing it rn
+ SetConsoleTitleA(fmt::format("Titanfall 2 dedicated server - {} {}/{} players", g_pHostState->m_levelName, g_ServerAuthenticationManager->m_additionalPlayerData.size(), GetCurrentPlaylistVar("max_players", false)).c_str());
Sleep(50);
}
}
diff --git a/NorthstarDedicatedTest/gameutils.cpp b/NorthstarDedicatedTest/gameutils.cpp
index 013ae61a..f940ff1b 100644
--- a/NorthstarDedicatedTest/gameutils.cpp
+++ b/NorthstarDedicatedTest/gameutils.cpp
@@ -21,6 +21,7 @@ ConVar* Cvar_hostport;
GetCurrentPlaylistType GetCurrentPlaylistName;
SetCurrentPlaylistType SetCurrentPlaylist;
SetPlaylistVarOverrideType SetPlaylistVarOverride;
+GetCurrentPlaylistVarType GetCurrentPlaylistVar;
// uid
char* g_LocalPlayerUserID;
@@ -39,6 +40,7 @@ void InitialiseEngineGameUtilFunctions(HMODULE baseAddress)
GetCurrentPlaylistName = (GetCurrentPlaylistType)((char*)baseAddress + 0x18C640);
SetCurrentPlaylist = (SetCurrentPlaylistType)((char*)baseAddress + 0x18EB20);
SetPlaylistVarOverride = (SetPlaylistVarOverrideType)((char*)baseAddress + 0x18ED17);
+ GetCurrentPlaylistVar = (GetCurrentPlaylistVarType)((char*)baseAddress + 0x18C680);
g_LocalPlayerUserID = (char*)baseAddress + 0x13F8E688;
}
diff --git a/NorthstarDedicatedTest/gameutils.h b/NorthstarDedicatedTest/gameutils.h
index 0f59a773..188ec3bf 100644
--- a/NorthstarDedicatedTest/gameutils.h
+++ b/NorthstarDedicatedTest/gameutils.h
@@ -2,7 +2,6 @@
#include "convar.h"
// cmd.h
-
enum class ECommandTarget_t
{
CBUF_FIRST_PLAYER = 0,
@@ -86,7 +85,6 @@ public:
};
// hoststate stuff
-
enum HostState_t
{
HS_NEW_GAME = 0,
@@ -127,7 +125,6 @@ public:
extern CHostState* g_pHostState;
// cengine stuff
-
enum EngineQuitState
{
QUIT_NOTQUITTING = 0,
@@ -169,11 +166,9 @@ public:
extern CEngine* g_pEngine;
// network stuff
-
extern ConVar* Cvar_hostport;
// playlist stuff
-
typedef const char*(*GetCurrentPlaylistType)();
extern GetCurrentPlaylistType GetCurrentPlaylistName;
@@ -183,8 +178,10 @@ extern SetCurrentPlaylistType SetCurrentPlaylist;
typedef void(*SetPlaylistVarOverrideType)(const char* varName, const char* value);
extern SetPlaylistVarOverrideType SetPlaylistVarOverride;
-// uid
+typedef char*(*GetCurrentPlaylistVarType)(const char* varName, bool useOverrides);
+extern GetCurrentPlaylistVarType GetCurrentPlaylistVar;
+// uid
extern char* g_LocalPlayerUserID;
void InitialiseEngineGameUtilFunctions(HMODULE baseAddress); \ No newline at end of file
diff --git a/NorthstarDedicatedTest/tier0.cpp b/NorthstarDedicatedTest/tier0.cpp
index bc1bbf46..74ac02d3 100644
--- a/NorthstarDedicatedTest/tier0.cpp
+++ b/NorthstarDedicatedTest/tier0.cpp
@@ -8,7 +8,7 @@ void* ResolveTier0Function(const char* name)
HMODULE tier0 = GetModuleHandle(L"tier0.dll");
// todo: maybe cache resolved funcs? idk the performance hit of getprocaddress
- std::cout << "ResolveTier0Function " << name << " " << tier0 << "::" << GetProcAddress(tier0, name) << std::endl;
+ //std::cout << "ResolveTier0Function " << name << " " << tier0 << "::" << GetProcAddress(tier0, name) << std::endl;
return GetProcAddress(tier0, name);
}