fix getguid & getxuid

This commit is contained in:
Diavolo 2023-04-03 19:14:45 +02:00 committed by Maurice Heumann
parent 077167e81b
commit 23c7228214
4 changed files with 32 additions and 0 deletions

View File

@ -115,6 +115,8 @@ namespace bots
struct component final : generic_component struct component final : generic_component
{ {
static_assert(offsetof(game::client_s, bIsTestClient) == 0xBB360);
void post_unpack() override void post_unpack() override
{ {
utils::hook::jump(game::select(0x141653B70, 0x1402732E0), get_bot_name); utils::hook::jump(game::select(0x141653B70, 0x1402732E0), get_bot_name);

View File

@ -67,10 +67,27 @@ namespace dedicated_patches
spawn_server_hook.invoke(controllerIndex, server, preload, savegame); spawn_server_hook.invoke(controllerIndex, server, preload, savegame);
} }
uint64_t sv_get_player_xuid_stub(int client_num)
{
return 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 struct component final : server_component
{ {
static_assert(offsetof(game::client_s, xuid) == 0xBB354);
void post_unpack() override void post_unpack() override
{ {
// Fix infinite loop // Fix infinite loop
@ -90,6 +107,9 @@ namespace dedicated_patches
// Don't count server as client // Don't count server as client
utils::hook::jump(0x14052F0F5_g, 0x14052F139_g); 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
} }
}; };
} }

View File

@ -1544,6 +1544,10 @@ namespace game
struct client_s struct client_s
{ {
char __pad0[0xBB354];
int xuid;
char __pad1[0x8];
bool bIsTestClient;
}; };
enum scriptInstance_t enum scriptInstance_t

View File

@ -104,6 +104,7 @@ namespace game
WEAK symbol<const char*(const dvar_t* dvar)> Dvar_GetString{0x1422BF590, 0x140575E30}; WEAK symbol<const char*(const dvar_t* dvar)> Dvar_GetString{0x1422BF590, 0x140575E30};
WEAK symbol<const char*(const dvar_t* dvar)> Dvar_DisplayableValue{0x1422BC080}; WEAK symbol<const char*(const dvar_t* dvar)> Dvar_DisplayableValue{0x1422BC080};
WEAK symbol<bool(const dvar_t* dvar)> Dvar_GetBool{0x1422BCED0}; WEAK symbol<bool(const dvar_t* dvar)> Dvar_GetBool{0x1422BCED0};
WEAK symbol<int(const dvar_t* dvar)> Dvar_GetInt{0x0, 0x140575C20};
WEAK symbol<dvar_t*(dvarStrHash_t hash, const char* dvarName, bool value, int flags, WEAK symbol<dvar_t*(dvarStrHash_t hash, const char* dvarName, bool value, int flags,
const char* description)> Dvar_RegisterBool{ const char* description)> Dvar_RegisterBool{
0x1422D0900, 0x14057B500 0x1422D0900, 0x14057B500
@ -189,6 +190,11 @@ namespace game
WEAK symbol<char> s_dvarPool{0x157AC6220, 0x14A3CB620}; WEAK symbol<char> s_dvarPool{0x157AC6220, 0x14A3CB620};
WEAK symbol<int> g_dvarCount{0x157AC61CC, 0x14A3CB5FC}; WEAK symbol<int> g_dvarCount{0x157AC61CC, 0x14A3CB5FC};
WEAK symbol<client_s> svs_clients{0x0, 0x14A178E98};
// Dvar variables
WEAK symbol<dvar_t*> com_maxclients{0x0, 0x14948EE70};
namespace s_wcd namespace s_wcd
{ {
WEAK symbol<HWND> codLogo{0x157E75A50, 0x14A640BC0}; WEAK symbol<HWND> codLogo{0x157E75A50, 0x14A640BC0};