From 53959a48d568af3a099caf4b0958766d0bcb0c87 Mon Sep 17 00:00:00 2001 From: nta Date: Wed, 11 Oct 2023 11:14:28 +0300 Subject: [PATCH] fix(server/gui): 'FXServer/unknown' in console title At one point, the `gamename` variable moved to the fallback console context, which made the code here only ever show 'unknown' instead of an actual game name (like 'FXServer/gta5'). As a fix, we will look this up in the fallback console context as well. --- code/components/citizen-server-gui/src/ServerGui.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/components/citizen-server-gui/src/ServerGui.cpp b/code/components/citizen-server-gui/src/ServerGui.cpp index ccb691bfe6..dda6e32967 100644 --- a/code/components/citizen-server-gui/src/ServerGui.cpp +++ b/code/components/citizen-server-gui/src/ServerGui.cpp @@ -180,10 +180,19 @@ devgui_convar "Tools/Network/State/Player List" svplayerlist auto conCtx = m_instance->GetComponent(); auto hostNameVar = conCtx->GetVariableManager()->FindEntryRaw("sv_hostname"); auto iconVar = conCtx->GetVariableManager()->FindEntryRaw("sv_icon"); - auto gameNameVar = conCtx->GetVariableManager()->FindEntryRaw("gamename"); if (hostNameVar && consoleWindowState.lastHostname != hostNameVar->GetValue()) { + auto gameNameVar = conCtx->GetVariableManager()->FindEntryRaw("gamename"); + + if (!gameNameVar) + { + if (auto fallbackContext = conCtx->GetFallbackContext()) + { + gameNameVar = fallbackContext->GetVariableManager()->FindEntryRaw("gamename"); + } + } + consoleWindowState.lastHostname = hostNameVar->GetValue(); SetConsoleTitle(fmt::sprintf(L"Cfx.re Server (FXServer/%s) - %s", ToWide((gameNameVar) ? gameNameVar->GetValue() : "unknown"), ToWide(consoleWindowState.lastHostname)).c_str());