diff options
author | HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> | 2021-12-28 12:18:58 +0300 |
---|---|---|
committer | HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> | 2021-12-28 12:18:58 +0300 |
commit | e49f026c92c75c4f10afd7f8895d8ebe2a01e97d (patch) | |
tree | c7350f3f743b9a429b72538d41121c557fb20a2b /NorthstarDedicatedTest/masterserver.cpp | |
parent | bea776a8f6bcba5f702483d868d6fb6c4a069416 (diff) | |
download | NorthstarLauncher-e49f026c92c75c4f10afd7f8895d8ebe2a01e97d.tar.gz NorthstarLauncher-e49f026c92c75c4f10afd7f8895d8ebe2a01e97d.zip |
implement svc_Print, copy NS hostname to source cvar
Diffstat (limited to 'NorthstarDedicatedTest/masterserver.cpp')
-rw-r--r-- | NorthstarDedicatedTest/masterserver.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp index 706f60ec..d7fea6d1 100644 --- a/NorthstarDedicatedTest/masterserver.cpp +++ b/NorthstarDedicatedTest/masterserver.cpp @@ -21,6 +21,9 @@ ConVar* Cvar_ns_server_name; ConVar* Cvar_ns_server_desc; ConVar* Cvar_ns_server_password; +// Source ConVar +ConVar* Cvar_hostname; + MasterServerManager* g_MasterServerManager; typedef void(*CHostState__State_NewGameType)(CHostState* hostState); @@ -127,7 +130,7 @@ void MasterServerManager::AuthenticateOriginWithMasterServer(char* uid, char* or if (originAuthInfo.HasParseError()) { - spdlog::error("Failed reading origin auth info response: encountered parse error \{}\"", rapidjson::GetParseError_En(originAuthInfo.GetParseError())); + spdlog::error("Failed reading origin auth info response: encountered parse error \"{}\"", rapidjson::GetParseError_En(originAuthInfo.GetParseError())); goto REQUEST_END_CLEANUP; } @@ -852,6 +855,10 @@ void CHostState__State_NewGameHook(CHostState* hostState) if (maxPlayersVar) // GetCurrentPlaylistVar can return null so protect against this maxPlayers = std::stoi(maxPlayersVar); + // Copy new server name cvar to source + Cvar_hostname->m_pszString = Cvar_ns_server_name->m_pszString; + Cvar_hostname->m_StringLength = Cvar_ns_server_name->m_StringLength; + g_MasterServerManager->AddSelfToServerList(Cvar_hostport->m_nValue, Cvar_ns_player_auth_port->m_nValue, Cvar_ns_server_name->m_pszString, Cvar_ns_server_desc->m_pszString, hostState->m_levelName, (char*)GetCurrentPlaylistName(), maxPlayers, Cvar_ns_server_password->m_pszString); g_ServerAuthenticationManager->StartPlayerAuthServer(); g_ServerAuthenticationManager->m_bNeedLocalAuthForNewgame = false; @@ -898,6 +905,9 @@ void InitialiseSharedMasterServer(HMODULE baseAddress) Cvar_ns_server_password = RegisterConVar("ns_server_password", "", FCVAR_GAMEDLL, ""); Cvar_ns_report_server_to_masterserver = RegisterConVar("ns_report_server_to_masterserver", "1", FCVAR_GAMEDLL, ""); Cvar_ns_report_sp_server_to_masterserver = RegisterConVar("ns_report_sp_server_to_masterserver", "0", FCVAR_GAMEDLL, ""); + + Cvar_hostname = *(ConVar**)((char*)baseAddress + 0x1315bae8); + g_MasterServerManager = new MasterServerManager; RegisterConCommand("ns_fetchservers", ConCommand_ns_fetchservers, "", FCVAR_CLIENTDLL); |