Merge pull request #124 from diamante0018/client_t-is-fun-4

[Structs] Update client_t
This commit is contained in:
Dss0 2021-09-08 23:25:01 +02:00 committed by GitHub
commit e873b48571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 61 additions and 48 deletions

View File

@ -181,9 +181,9 @@ namespace Components
Game::client_t* client = &Game::svs_clients[num]; Game::client_t* client = &Game::svs_clients[num];
SteamID guid; SteamID guid;
guid.bits = client->steamid; guid.bits = client->steamID;
Bans::InsertBan({ guid, client->addr.ip }); Bans::InsertBan({ guid, client->netchan.remoteAddress.ip });
Game::SV_KickClientError(client, reason); Game::SV_KickClientError(client, reason);
} }

View File

@ -437,7 +437,7 @@ namespace Components
ucmd.rightmove = g_botai[i].right; ucmd.rightmove = g_botai[i].right;
ucmd.weapon = g_botai[i].weapon; ucmd.weapon = g_botai[i].weapon;
client->deltaMessage = client->outgoingSequence - 1; client->deltaMessage = client->netchan.outgoingSequence - 1;
Game::SV_ClientThink(client, &ucmd); Game::SV_ClientThink(client, &ucmd);
} }

View File

@ -134,7 +134,7 @@ namespace Components
if (client->state >= 3) if (client->state >= 3)
{ {
std::string ip = Game::NET_AdrToString(client->addr); std::string ip = Game::NET_AdrToString(client->netchan.remoteAddress);
if (ip.find_first_of(":") != std::string::npos) if (ip.find_first_of(":") != std::string::npos)
ip.erase(ip.begin() + ip.find_first_of(":"), ip.end()); // erase port ip.erase(ip.begin() + ip.find_first_of(":"), ip.end()); // erase port
Game::Scr_AddString(ip.data()); Game::Scr_AddString(ip.data());

View File

@ -177,7 +177,7 @@ namespace Components
{ {
if (Game::svs_clients[i].state >= 3) if (Game::svs_clients[i].state >= 3)
{ {
list.append(Utils::String::VA(" %llX", Game::svs_clients[i].steamid)); list.append(Utils::String::VA(" %llX", Game::svs_clients[i].steamID));
Utils::InfoString info(Game::svs_clients[i].connectInfoString); Utils::InfoString info(Game::svs_clients[i].connectInfoString);
list.append(Utils::String::VA(" %llX", strtoull(info.get("realsteamId").data(), nullptr, 16))); list.append(Utils::String::VA(" %llX", strtoull(info.get("realsteamId").data(), nullptr, 16)));

View File

@ -387,7 +387,7 @@ namespace Components
if (client->state >= 3) if (client->state >= 3)
{ {
if (address.getIP().full == Network::Address(client->addr).getIP().full) if (address.getIP().full == Network::Address(client->netchan.remoteAddress).getIP().full)
{ {
return client; return client;
} }

View File

@ -610,7 +610,7 @@ namespace Game
{ {
if (client->state < 5) if (client->state < 5)
{ {
Components::Network::SendCommand(client->addr, "error", reason); Components::Network::SendCommand(client->netchan.remoteAddress, "error", reason);
} }
SV_KickClient(client, reason.data()); SV_KickClient(client, reason.data());

View File

@ -4215,6 +4215,35 @@ namespace Game
char ipx[10]; char ipx[10];
}; };
struct netProfileInfo_t
{
char __pad0[0x5E0];
};
static_assert(sizeof(netProfileInfo_t) == 0x5E0);
struct netchan_t
{
int outgoingSequence;
netsrc_t sock;
int dropped;
int incomingSequence;
netadr_t remoteAddress;
int qport;
int fragmentSequence;
int fragmentLength;
char* fragmentBuffer;
int fragmentBufferSize;
int unsentFragments;
int unsentFragmentStart;
int unsentLength;
char* unsentBuffer;
int unsentBufferSize;
netProfileInfo_t prof;
};
static_assert(sizeof(netchan_t) == 0x62C);
struct FxEditorElemAtlas struct FxEditorElemAtlas
{ {
int behavior; int behavior;
@ -4621,50 +4650,34 @@ namespace Game
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct client_s typedef struct client_s
{ {
// 0 clientstate_t state; // 0
clientstate_t state; char __pad0[4]; // 4
// 4 int deltaMessage; // 8
char _pad[4]; char __pad1[12]; // 12
// 8 netchan_t netchan; // 24
int deltaMessage; char __pad2[20]; // 1604
// 12 const char* delayDropReason; // 1624
char __pad[12]; char connectInfoString[1024]; // 1628
// 24 char __pad3[132096]; // 2652
int outgoingSequence; int reliableSequence; // 134748
// 28 int reliableAcknowledge; // 134752
char pad[12]; int reliableSent; // 134756
// 40 char __pad4[1084]; // 134760
netadr_t addr; char name[16]; // 135844
// 60 char __pad5[12]; // 135860
char pad1[1568]; int snapNum; // 135872
// 1628 int __pad6; // 135876
char connectInfoString[1024]; short ping; // 135880
// 2652 char __pad7[133158]; // 135882
char pad2[133192]; int isBot; // 269040
// 135844 char __pad8[9228]; // 269044
char name[16]; unsigned __int64 steamID; // 278272
// 135860 char __pad9[403592]; // 278280
char pad3[12];
// 135872
int snapNum;
// 135876
int pad4;
// 135880
short ping;
// 135882
//char pad5[142390];
char pad5[133158];
// 269040
int isBot;
// 269044
char pad6[9228];
// 278272
unsigned __int64 steamid;
// 278280
char pad7[403592];
} client_t; } client_t;
#pragma pack(pop) #pragma pack(pop)
static_assert(sizeof(client_t) == 0xA6790);
struct CModelAllocData struct CModelAllocData
{ {
void* mainArray; void* mainArray;