diff --git a/src/client/component/bots.cpp b/src/client/component/bots.cpp index 2f334f62..0d06afd0 100644 --- a/src/client/component/bots.cpp +++ b/src/client/component/bots.cpp @@ -115,6 +115,8 @@ namespace bots struct component final : generic_component { + static_assert(offsetof(game::client_s, bIsTestClient) == 0xBB360); + void post_unpack() override { utils::hook::jump(game::select(0x141653B70, 0x1402732E0), get_bot_name); diff --git a/src/client/component/dedicated_patches.cpp b/src/client/component/dedicated_patches.cpp index 45a961c1..307f1095 100644 --- a/src/client/component/dedicated_patches.cpp +++ b/src/client/component/dedicated_patches.cpp @@ -67,10 +67,27 @@ namespace dedicated_patches spawn_server_hook.invoke(controllerIndex, server, preload, savegame); } + + uint64_t sv_get_player_xuid_stub(int client_num) + { + return static_cast(game::svs_clients[client_num].xuid); + } + + int sv_get_guid(int client_num) + { + if (client_num < 0 || client_num >= game::Dvar_GetInt(*game::com_maxclients)) + { + return 0; + } + + return game::svs_clients[client_num].xuid; + } } struct component final : server_component { + static_assert(offsetof(game::client_s, xuid) == 0xBB354); + void post_unpack() override { // Fix infinite loop @@ -90,6 +107,9 @@ namespace dedicated_patches // Don't count server as client utils::hook::jump(0x14052F0F5_g, 0x14052F139_g); + + utils::hook::call(0x1402853D7_g, sv_get_player_xuid_stub); // PlayerCmd_GetXuid + utils::hook::call(0x140283303_g, sv_get_guid); // PlayerCmd_GetGuid } }; } diff --git a/src/client/game/structs.hpp b/src/client/game/structs.hpp index be6386f3..b3599480 100644 --- a/src/client/game/structs.hpp +++ b/src/client/game/structs.hpp @@ -1544,8 +1544,15 @@ namespace game struct client_s { + char __pad0[0xBB354]; + int xuid; + char __pad1[0x8]; + bool bIsTestClient; + char __pad2[0x29DAC]; }; + static_assert(sizeof(client_s) == 0xE5110); + enum scriptInstance_t { SCRIPTINSTANCE_SERVER = 0x0, diff --git a/src/client/game/symbols.hpp b/src/client/game/symbols.hpp index 4e325035..029c3d5f 100644 --- a/src/client/game/symbols.hpp +++ b/src/client/game/symbols.hpp @@ -104,6 +104,7 @@ namespace game WEAK symbol Dvar_GetString{0x1422BF590, 0x140575E30}; WEAK symbol Dvar_DisplayableValue{0x1422BC080}; WEAK symbol Dvar_GetBool{0x1422BCED0}; + WEAK symbol Dvar_GetInt{0x0, 0x140575C20}; WEAK symbol Dvar_RegisterBool{ 0x1422D0900, 0x14057B500 @@ -189,6 +190,11 @@ namespace game WEAK symbol s_dvarPool{0x157AC6220, 0x14A3CB620}; WEAK symbol g_dvarCount{0x157AC61CC, 0x14A3CB5FC}; + WEAK symbol svs_clients{0x0, 0x14A178E98}; + + // Dvar variables + WEAK symbol com_maxclients{0x0, 0x14948EE70}; + namespace s_wcd { WEAK symbol codLogo{0x157E75A50, 0x14A640BC0};