Refresh dedi console window title

This commit is contained in:
momo5502 2016-08-15 13:42:30 +02:00
parent d67aa26a5d
commit 84422b0fc0

View File

@ -45,6 +45,9 @@ namespace Components
{ {
std::string mapname = Dvar::Var("mapname").Get<const char*>(); std::string mapname = Dvar::Var("mapname").Get<const char*>();
std::string hostname = Colors::Strip(Dvar::Var("sv_hostname").Get<const char*>()); std::string hostname = Colors::Strip(Dvar::Var("sv_hostname").Get<const char*>());
if (Console::HasConsole)
{
SetConsoleTitleA(hostname.data()); SetConsoleTitleA(hostname.data());
int clientCount = 0; int clientCount = 0;
@ -71,6 +74,11 @@ namespace Components
wprintw(Console::InfoWindow, "%s : %d/%d players : map %s", hostname.data(), clientCount, maxclientCount, (mapname.size() ? mapname.data() : "none")); wprintw(Console::InfoWindow, "%s : %d/%d players : map %s", hostname.data(), clientCount, maxclientCount, (mapname.size() ? mapname.data() : "none"));
wnoutrefresh(Console::InfoWindow); wnoutrefresh(Console::InfoWindow);
} }
else if(IsWindow(*reinterpret_cast<HWND*>(0x64A3288)) != FALSE)
{
SetWindowTextA(*reinterpret_cast<HWND*>(0x64A3288), Utils::String::VA("IW4x(r" REVISION_STR REVISION_SUFFIX ") : %s", hostname.data()));
}
}
void Console::ShowPrompt() void Console::ShowPrompt()
{ {
@ -126,7 +134,6 @@ namespace Components
if ((currentTime - Console::LastRefresh) > 250) if ((currentTime - Console::LastRefresh) > 250)
{ {
Console::RefreshOutput(); Console::RefreshOutput();
Console::RefreshStatus();
Console::LastRefresh = currentTime; Console::LastRefresh = currentTime;
} }
@ -499,6 +506,8 @@ namespace Components
// Don't resize the console // Don't resize the console
Utils::Hook(0x64DC6B, 0x64DCC2, HOOK_JUMP).Install()->Quick(); Utils::Hook(0x64DC6B, 0x64DCC2, HOOK_JUMP).Install()->Quick();
Dedicated::OnFrame(Console::RefreshStatus);
// Code below is not necessary when performing unit tests! // Code below is not necessary when performing unit tests!
if (Loader::PerformingUnitTests()) return; if (Loader::PerformingUnitTests()) return;