[Structs] Complete client_t

This commit is contained in:
Diavolo 2022-08-20 12:30:34 +02:00
parent 28b089f070
commit 6276ef2e24
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
7 changed files with 53 additions and 20 deletions

View File

@ -294,7 +294,8 @@ namespace Components
Bots::Bots()
{
AssertOffset(Game::client_s, bIsTestClient, 0x41AF0);
AssertOffset(Game::client_t, bIsTestClient, 0x41AF0);
AssertOffset(Game::client_t, ping, 0x212C8);
// Replace connect string
Utils::Hook::Set<const char*>(0x48ADA6, "connect bot%d \"\\cg_predictItems\\1\\cl_anonymous\\0\\color\\4\\head\\default\\model\\multi\\snaps\\20\\rate\\5000\\name\\%s\\protocol\\%d\\checksum\\%d\\statver\\%d %u\\qport\\%d\"");

View File

@ -410,6 +410,8 @@ namespace Components
Chat::Chat()
{
AssertOffset(Game::client_t, steamID, 0x43F00);
cg_chatWidth = Dvar::Register<int>("cg_chatWidth", 52, 1, std::numeric_limits<int>::max(), Game::DVAR_ARCHIVE, "The normalized maximum width of a chat message");
sv_disableChat = Dvar::Register<bool>("sv_disableChat", false, Game::DVAR_NONE, "Disable chat messages from clients");
Events::OnSVInit(AddChatCommands);

View File

@ -761,13 +761,13 @@ namespace Components
else
{
// Score and ping are irrelevant
const char* namePtr = Game::PartyHost_GetMemberName(reinterpret_cast<Game::PartyData*>(0x1081C00), i);
const char* namePtr = Game::PartyHost_GetMemberName(Game::g_lobbyData, i);
if (!namePtr || !namePtr[0]) continue;
playerInfo["name"] = namePtr;
}
players.push_back(playerInfo);
players.emplace_back(playerInfo);
}
info["players"] = players;

View File

@ -276,7 +276,7 @@ namespace Components
const auto* ent = Game::GetPlayerEntity(entref);
auto* client = Script::GetClient(ent);
client->ping = static_cast<int16_t>(ping);
client->ping = ping;
});
}

View File

@ -70,7 +70,7 @@ namespace Components
// set snapshot num to 1 behind (T6 does this, why shouldn't we?)
for (int i = 0; i < *Game::svs_clientCount; ++i)
{
Game::svs_clients[i].snapNum = *Game::svs_time - 1;
Game::svs_clients[i].nextSnapshotTime = *Game::svs_time - 1;
}
}

View File

@ -954,7 +954,7 @@ namespace Game
typedef bool(__cdecl * SV_Loaded_t)();
extern SV_Loaded_t SV_Loaded;
typedef void(__cdecl * SV_ClientThink_t)(client_s*, usercmd_s*);
typedef void(__cdecl * SV_ClientThink_t)(client_t* cl, usercmd_s* cmd);
extern SV_ClientThink_t SV_ClientThink;
typedef void(__cdecl * SV_DropClient_t)(client_t* drop, const char* reason, bool tellThem);

View File

@ -6317,14 +6317,34 @@ namespace Game
static_assert(sizeof(clientHeader_t) == 1624);
#pragma pack(push, 1)
struct svscmd_info_t
{
char cmd[1024];
int time;
int type;
};
typedef struct client_s
struct clientSnapshot_t
{
playerState_s ps;
int num_entities;
int num_clients;
int first_entity;
int first_client;
int messageSent;
int messageAcked;
int messageSize;
int serverTime;
int timeDelta;
int baselineSnap;
};
struct client_t
{
clientHeader_t header;
const char* dropReason; // 1624
char userinfo[1024]; // 1628
char __pad3[132096]; // 2652
svscmd_info_t reliableCommandInfo[128]; // 2652
int reliableSequence; // 134748
int reliableAcknowledge; // 134752
int reliableSent; // 134756
@ -6339,21 +6359,31 @@ namespace Game
int nextReliableTime; // 135860
int lastPacketTime; // 135864
int lastConnectTime; // 135868
int snapNum; // 135872
int __pad5; // 135876
short ping; // 135880
char __pad6[14]; // 135882
int nextSnapshotTime; // 135872
int timeoutCount; // 135876
int ping; // 135880
int rate;
int snapshotMsec;
int snapshotBackoffCount;
int pureAuthentic; // 135896
char __pad7[133138]; // 135900
short scriptID; // 269038
char netchanOutgoingBuffer[131072];
char netchanIncomingBuffer[2048];
char playerGuid[17];
unsigned short scriptId; // 269038
int bIsTestClient; // 269040
int serverID; // 269044
char __pad8[9224]; // 269048
bool usingOnlineStatsOffline;
char stats[8192];
char statsModifiedFlags[1024];
bool statsModified;
char statPacketsReceived;
bool steamAuthorized;
char steamAuthFailCount;
unsigned __int64 steamID; // 278272
char __pad9[403592]; // 278280
} client_t;
#pragma pack(pop)
bool sendMatchData;
int matchDataSendTime;
clientSnapshot_t frames[32];
};
static_assert(sizeof(client_t) == 0xA6790);