diff --git a/src/client/component/getinfo.cpp b/src/client/component/getinfo.cpp index 93de3f7d..b8a92a73 100644 --- a/src/client/component/getinfo.cpp +++ b/src/client/component/getinfo.cpp @@ -12,8 +12,6 @@ #include -#include "command.hpp" - namespace getinfo { namespace @@ -29,6 +27,16 @@ namespace getinfo return game::Dvar_GetString(dvar); } + int get_dvar_int(const char* dvar_name) + { + const auto dvar = game::Dvar_FindVar(dvar_name); + if (!dvar) + { + return {}; + } + + return game::Dvar_GetInt(dvar); + } int Com_SessionMode_GetGameMode() { @@ -52,15 +60,16 @@ namespace getinfo utils::info_string info{}; info.set("challenge", std::string(data.begin(), data.end())); info.set("gamename", "T7"); - info.set("hostname", get_dvar_string("sv_hostname")); + info.set("hostname", get_dvar_string(game::is_server() ? "live_steam_server_name" : "sv_hostname")); info.set("gametype", get_dvar_string("g_gametype")); //info.set("sv_motd", get_dvar_string("sv_motd")); + info.set("description", game::is_server() ? get_dvar_string("live_steam_server_description") : ""); info.set("xuid", utils::string::va("%llX", steam::SteamUser()->GetSteamID().bits)); info.set("mapname", get_dvar_string("mapname")); - //info.set("isPrivate", get_dvar_string("g_password").empty() ? "0" : "1"); - //info.set("clients", utils::string::va("%i", get_client_count())); - //info.set("bots", utils::string::va("%i", get_bot_count())); - //info.set("sv_maxclients", utils::string::va("%i", *game::mp::svs_numclients)); + info.set("isPrivate", get_dvar_string("g_password").empty() ? "0" : "1"); + info.set("clients", utils::string::va("%i", 0)); + info.set("bots", utils::string::va("%i", /*get_bot_count()*/0)); + info.set("sv_maxclients", utils::string::va("%i", get_dvar_int("com_maxclients"))); info.set("protocol", utils::string::va("%i", PROTOCOL)); info.set("playmode", utils::string::va("%i", game::Com_SessionMode_GetMode())); info.set("gamemode", utils::string::va("%i", Com_SessionMode_GetGameMode())); diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 7ce4b347..2ee50eff 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -79,6 +79,7 @@ namespace game WEAK symbol Dvar_FindMalleableVar{0x1422BD6A0}; WEAK symbol Dvar_GetDebugName{0x1422BDCB0}; WEAK symbol Dvar_GetString{0x1422BFFF0, 0x140575E30}; + WEAK symbol Dvar_GetInt{0x1422BF2C0, 0x140575C20}; WEAK symbol Dvar_SetFromStringByName{ 0x1422C7F60 }; diff --git a/src/client/steam/interfaces/matchmaking_servers.cpp b/src/client/steam/interfaces/matchmaking_servers.cpp index 3fc0e429..6c7a50bd 100644 --- a/src/client/steam/interfaces/matchmaking_servers.cpp +++ b/src/client/steam/interfaces/matchmaking_servers.cpp @@ -40,12 +40,12 @@ namespace steam server.m_bDoNotRefresh = false; strcpy_s(server.m_szGameDir, ""); strcpy_s(server.m_szMap, info.get("mapname").data()); - strcpy_s(server.m_szGameDescription, "Example BO^3I^5I^6I ^7Server"); + strcpy_s(server.m_szGameDescription, info.get("description").data()); server.m_nAppID = 311210; server.m_nPlayers = atoi(info.get("clients").data()); server.m_nMaxPlayers = atoi(info.get("sv_maxclients").data()); server.m_nBotPlayers = atoi(info.get("bots").data()); - server.m_bPassword = false; + server.m_bPassword = info.get("isPrivate") == "1"; server.m_bSecure = true; server.m_ulTimeLastPlayed = 0; server.m_nServerVersion = 1000;