CHLTVClientState::ReadPacketEntities
0x0016bb00 · 1977 bytes · __thiscall
_ZN16CHLTVClientState18ReadPacketEntitiesER15CEntityReadInfo
Decompiled
undefined (2 params)
/* CHLTVClientState::ReadPacketEntities(CEntityReadInfo&) */
void __thiscall
CHLTVClientState::ReadPacketEntities(CHLTVClientState *this,CEntityReadInfo *param_1)
{
int *piVar1;
undefined4 *puVar2;
uint uVar3;
uint uVar4;
byte bVar5;
CEntityReadInfo CVar6;
int iVar7;
int iVar8;
int iVar9;
uint uVar10;
uint uVar11;
uint *puVar12;
int local_30;
uint local_28;
byte local_24;
if ((*(int *)(param_1 + 8) != 0) && (uVar11 = *(int *)(param_1 + 0x14) + 1, (int)uVar11 < 0x800))
{
iVar7 = (int)uVar11 >> 5;
puVar12 = (uint *)(*(int *)(param_1 + 8) + 0xc + iVar7 * 4);
uVar11 = *puVar12 & (&GetStartBitMask(int)::g_StartMask)[uVar11 & 0x1f];
iVar8 = iVar7;
if (uVar11 == 0) {
uVar11 = puVar12[1];
iVar9 = iVar7;
while (iVar8 = iVar9 + 1, iVar8 != 0x40) {
if (uVar11 != 0) goto LAB_0016bb70;
uVar11 = puVar12[(iVar9 + 2) - iVar7];
iVar9 = iVar8;
}
}
else {
LAB_0016bb70:
iVar8 = iVar8 * 0x20;
if ((uVar11 & 0xff) == 0) {
uVar10 = uVar11 >> 8 & 0xff;
if (uVar10 == 0) {
uVar10 = uVar11 >> 0x10 & 0xff;
if (uVar10 == 0) {
if (uVar11 >> 0x18 == 0) goto LAB_0016bbb5;
iVar8 = iVar8 + 0x18 +
*(int *)(FirstBitInWord(unsigned_int,int)::firstBitLUT + (uVar11 >> 0x18) * 4);
}
else {
iVar8 = iVar8 + 0x10 +
*(int *)(FirstBitInWord(unsigned_int,int)::firstBitLUT + uVar10 * 4);
}
}
else {
iVar8 = iVar8 + 8 + *(int *)(FirstBitInWord(unsigned_int,int)::firstBitLUT + uVar10 * 4);
}
}
else {
iVar8 = iVar8 + *(int *)(FirstBitInWord(unsigned_int,int)::firstBitLUT + (uVar11 & 0xff) * 4
);
}
*(int *)(param_1 + 0x14) = iVar8;
if (-1 < iVar8) goto LAB_0016bbbc;
}
}
LAB_0016bbb5:
*(undefined4 *)(param_1 + 0x14) = 9999;
LAB_0016bbbc:
iVar8 = *(int *)(param_1 + 0x10);
LAB_0016bbbf:
if (3 < iVar8) {
LAB_0016bc64:
if ((param_1[4] != (CEntityReadInfo)0x0) && (iVar8 == 4)) {
ReadDeletions(this,param_1);
}
if (*(char *)(*(int *)(param_1 + 0x2c) + 4) != '\0') {
Host_Error("CL_ParsePacketEntities: buffer read overflow\n");
}
if (param_1[4] == (CEntityReadInfo)0x0) {
*(undefined8 *)(this + 100) = 0;
}
return;
}
iVar8 = *(int *)(param_1 + 0x20) + -1;
*(int *)(param_1 + 0x20) = iVar8;
bVar5 = ~(byte)((uint)iVar8 >> 0x18);
CVar6 = (CEntityReadInfo)(bVar5 >> 7);
param_1[0x34] = (CEntityReadInfo)(bVar5 >> 7);
if (iVar8 < 0) goto LAB_0016bbe3;
iVar8 = *(int *)(param_1 + 0x1c);
*(undefined4 *)(param_1 + 0x30) = 0;
iVar7 = *(int *)(param_1 + 0x2c);
iVar9 = *(int *)(iVar7 + 0x14);
uVar11 = *(uint *)(iVar7 + 0x10);
if (iVar9 < 6) {
puVar12 = *(uint **)(iVar7 + 0x18);
if (puVar12 == *(uint **)(iVar7 + 0x1c)) {
*(undefined4 *)(iVar7 + 0x14) = 1;
*(uint **)(iVar7 + 0x18) = puVar12 + 1;
uVar10 = 0;
*(undefined4 *)(iVar7 + 0x10) = 0;
*(undefined1 *)(iVar7 + 4) = 1;
}
else {
if (*(uint **)(iVar7 + 0x1c) < puVar12) {
*(undefined1 *)(iVar7 + 4) = 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
}
else {
*(uint **)(iVar7 + 0x18) = puVar12 + 1;
uVar3 = *puVar12;
*(uint *)(iVar7 + 0x10) = uVar3;
if (*(char *)(iVar7 + 4) == '\0') {
uVar10 = (&CBitBuffer::s_nMaskTable)[6 - iVar9];
*(int *)(iVar7 + 0x14) = iVar9 + 0x1a;
local_24 = (byte)(6 - iVar9);
uVar10 = (uVar3 & uVar10) << ((byte)iVar9 & 0x1f) | uVar11;
*(uint *)(iVar7 + 0x10) = uVar3 >> (local_24 & 0x1f);
goto LAB_0016bd1b;
}
}
uVar10 = 0;
}
}
else {
*(int *)(iVar7 + 0x14) = iVar9 + -6;
uVar10 = uVar11 & 0x3f;
if (iVar9 + -6 == 0) {
puVar2 = *(undefined4 **)(iVar7 + 0x18);
*(undefined4 *)(iVar7 + 0x14) = 0x20;
if (puVar2 == *(undefined4 **)(iVar7 + 0x1c)) {
*(undefined4 *)(iVar7 + 0x14) = 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
*(undefined4 **)(iVar7 + 0x18) = puVar2 + 1;
goto LAB_0016bd1b;
}
if (puVar2 <= *(undefined4 **)(iVar7 + 0x1c)) {
*(undefined4 **)(iVar7 + 0x18) = puVar2 + 1;
*(undefined4 *)(iVar7 + 0x10) = *puVar2;
goto LAB_0016bd1b;
}
*(undefined1 *)(iVar7 + 4) = 1;
uVar11 = uVar11 & 0x30;
*(undefined4 *)(iVar7 + 0x10) = 0;
if (uVar11 == 0x20) goto LAB_0016bed3;
LAB_0016bd29:
if (uVar11 != 0x30) {
if (uVar11 != 0x10) goto LAB_0016bd8e;
iVar9 = *(int *)(iVar7 + 0x14);
if (iVar9 < 4) {
uVar11 = *(uint *)(iVar7 + 0x10);
puVar12 = *(uint **)(iVar7 + 0x18);
if (puVar12 == *(uint **)(iVar7 + 0x1c)) {
*(undefined4 *)(iVar7 + 0x14) = 1;
uVar11 = 0;
*(undefined4 *)(iVar7 + 0x10) = 0;
*(uint **)(iVar7 + 0x18) = puVar12 + 1;
*(undefined1 *)(iVar7 + 4) = 1;
}
else {
if (puVar12 < *(uint **)(iVar7 + 0x1c)) {
*(uint **)(iVar7 + 0x18) = puVar12 + 1;
uVar3 = *puVar12;
*(uint *)(iVar7 + 0x10) = uVar3;
if (*(char *)(iVar7 + 4) == '\0') {
uVar4 = (&CBitBuffer::s_nMaskTable)[4 - iVar9];
*(int *)(iVar7 + 0x14) = iVar9 + 0x1c;
local_28._0_1_ = (byte)(4 - iVar9);
*(uint *)(iVar7 + 0x10) = uVar3 >> ((byte)local_28 & 0x1f);
uVar11 = ((uVar3 & uVar4) << ((byte)iVar9 & 0x1f) | uVar11) << 4;
goto LAB_0016bd8b;
}
}
else {
*(undefined1 *)(iVar7 + 4) = 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
}
uVar11 = 0;
}
}
else {
*(int *)(iVar7 + 0x14) = iVar9 + -4;
uVar11 = *(uint *)(iVar7 + 0x10) & 0xf;
if (iVar9 + -4 == 0) {
puVar2 = *(undefined4 **)(iVar7 + 0x18);
*(undefined4 *)(iVar7 + 0x14) = 0x20;
if (puVar2 == *(undefined4 **)(iVar7 + 0x1c)) {
uVar11 = uVar11 << 4;
*(undefined4 *)(iVar7 + 0x14) = 1;
*(undefined4 **)(iVar7 + 0x18) = puVar2 + 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
}
else if (*(undefined4 **)(iVar7 + 0x1c) < puVar2) {
uVar11 = uVar11 << 4;
*(undefined1 *)(iVar7 + 4) = 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
}
else {
uVar11 = uVar11 << 4;
*(undefined4 **)(iVar7 + 0x18) = puVar2 + 1;
*(undefined4 *)(iVar7 + 0x10) = *puVar2;
}
}
else {
uVar11 = uVar11 << 4;
*(uint *)(iVar7 + 0x10) = *(uint *)(iVar7 + 0x10) >> 4;
}
}
LAB_0016bd8b:
uVar10 = uVar11 | uVar10 & 0xf;
goto LAB_0016bd8e;
}
iVar9 = *(int *)(iVar7 + 0x14);
local_28 = uVar10 & 0xf;
if (iVar9 < 0x1c) {
puVar12 = *(uint **)(iVar7 + 0x18);
uVar10 = *(uint *)(iVar7 + 0x10);
if (puVar12 == *(uint **)(iVar7 + 0x1c)) {
LAB_0016c22d:
*(undefined4 *)(iVar7 + 0x14) = 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
*(uint **)(iVar7 + 0x18) = puVar12 + 1;
*(undefined1 *)(iVar7 + 4) = 1;
goto LAB_0016c049;
}
if (*(uint **)(iVar7 + 0x1c) < puVar12) {
LAB_0016c03e:
*(undefined1 *)(iVar7 + 4) = 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
goto LAB_0016c049;
}
*(uint **)(iVar7 + 0x18) = puVar12 + 1;
uVar11 = *puVar12;
*(uint *)(iVar7 + 0x10) = uVar11;
if (*(char *)(iVar7 + 4) != '\0') goto LAB_0016c049;
local_30 = 0x1c - iVar9;
local_24 = (byte)iVar9;
uVar10 = ((&CBitBuffer::s_nMaskTable)[local_30] & uVar11) << (local_24 & 0x1f) | uVar10;
iVar9 = iVar9 + 4;
LAB_0016c18b:
*(int *)(iVar7 + 0x14) = iVar9;
uVar10 = uVar10 << 4;
*(uint *)(iVar7 + 0x10) = uVar11 >> ((byte)local_30 & 0x1f);
}
else {
*(int *)(iVar7 + 0x14) = iVar9 + -0x1c;
uVar10 = *(uint *)(iVar7 + 0x10) & 0xfffffff;
if (iVar9 + -0x1c == 0) {
LAB_0016bf01:
puVar2 = *(undefined4 **)(iVar7 + 0x18);
*(undefined4 *)(iVar7 + 0x14) = 0x20;
if (puVar2 == *(undefined4 **)(iVar7 + 0x1c)) {
uVar10 = uVar10 << 4;
*(undefined4 *)(iVar7 + 0x14) = 1;
*(undefined4 **)(iVar7 + 0x18) = puVar2 + 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
}
else if (*(undefined4 **)(iVar7 + 0x1c) < puVar2) {
uVar10 = uVar10 << 4;
*(undefined1 *)(iVar7 + 4) = 1;
*(undefined4 *)(iVar7 + 0x10) = 0;
}
else {
uVar10 = uVar10 << 4;
*(undefined4 **)(iVar7 + 0x18) = puVar2 + 1;
*(undefined4 *)(iVar7 + 0x10) = *puVar2;
}
}
else {
uVar10 = uVar10 << 4;
*(uint *)(iVar7 + 0x10) = *(uint *)(iVar7 + 0x10) >> 0x1c;
}
}
}
else {
*(uint *)(iVar7 + 0x10) = uVar11 >> 6;
LAB_0016bd1b:
uVar11 = uVar10 & 0x30;
if (uVar11 != 0x20) goto LAB_0016bd29;
LAB_0016bed3:
iVar9 = *(int *)(iVar7 + 0x14);
local_28 = uVar10 & 0xf;
if (iVar9 < 8) {
puVar12 = *(uint **)(iVar7 + 0x18);
uVar10 = *(uint *)(iVar7 + 0x10);
if (puVar12 == *(uint **)(iVar7 + 0x1c)) goto LAB_0016c22d;
if (*(uint **)(iVar7 + 0x1c) <= puVar12) goto LAB_0016c03e;
*(uint **)(iVar7 + 0x18) = puVar12 + 1;
uVar11 = *puVar12;
*(uint *)(iVar7 + 0x10) = uVar11;
if (*(char *)(iVar7 + 4) == '\0') {
local_30 = 8 - iVar9;
local_24 = (byte)iVar9;
uVar10 = ((&CBitBuffer::s_nMaskTable)[local_30] & uVar11) << (local_24 & 0x1f) | uVar10;
iVar9 = iVar9 + 0x18;
goto LAB_0016c18b;
}
LAB_0016c049:
uVar10 = 0;
}
else {
*(int *)(iVar7 + 0x14) = iVar9 + -8;
uVar10 = *(uint *)(iVar7 + 0x10) & 0xff;
if (iVar9 + -8 == 0) goto LAB_0016bf01;
uVar10 = uVar10 << 4;
*(uint *)(iVar7 + 0x10) = *(uint *)(iVar7 + 0x10) >> 8;
}
}
uVar10 = uVar10 | local_28;
}
LAB_0016bd8e:
iVar8 = iVar8 + 1 + uVar10;
*(int *)(param_1 + 0x18) = iVar8;
*(int *)(param_1 + 0x1c) = iVar8;
iVar8 = *(int *)(param_1 + 0x2c);
uVar11 = *(uint *)(iVar8 + 0x10);
piVar1 = (int *)(iVar8 + 0x14);
*piVar1 = *piVar1 + -1;
if (*piVar1 == 0) {
puVar2 = *(undefined4 **)(iVar8 + 0x18);
*(undefined4 *)(iVar8 + 0x14) = 0x20;
if (puVar2 == *(undefined4 **)(iVar8 + 0x1c)) {
*(undefined4 *)(iVar8 + 0x14) = 1;
*(undefined4 *)(iVar8 + 0x10) = 0;
*(undefined4 **)(iVar8 + 0x18) = puVar2 + 1;
}
else if (*(undefined4 **)(iVar8 + 0x1c) < puVar2) {
*(undefined1 *)(iVar8 + 4) = 1;
*(undefined4 *)(iVar8 + 0x10) = 0;
}
else {
*(undefined4 **)(iVar8 + 0x18) = puVar2 + 1;
*(undefined4 *)(iVar8 + 0x10) = *puVar2;
}
}
else {
*(uint *)(iVar8 + 0x10) = uVar11 >> 1;
}
if ((uVar11 & 1) == 0) {
iVar8 = *(int *)(param_1 + 0x2c);
uVar11 = *(uint *)(iVar8 + 0x10);
piVar1 = (int *)(iVar8 + 0x14);
*piVar1 = *piVar1 + -1;
if (*piVar1 == 0) {
puVar2 = *(undefined4 **)(iVar8 + 0x18);
*(undefined4 *)(iVar8 + 0x14) = 0x20;
if (puVar2 == *(undefined4 **)(iVar8 + 0x1c)) {
*(undefined4 *)(iVar8 + 0x14) = 1;
*(undefined4 *)(iVar8 + 0x10) = 0;
*(undefined4 **)(iVar8 + 0x18) = puVar2 + 1;
}
else if (*(undefined4 **)(iVar8 + 0x1c) < puVar2) {
*(undefined1 *)(iVar8 + 4) = 1;
*(undefined4 *)(iVar8 + 0x10) = 0;
}
else {
*(undefined4 **)(iVar8 + 0x18) = puVar2 + 1;
*(undefined4 *)(iVar8 + 0x10) = *puVar2;
}
}
else {
*(uint *)(iVar8 + 0x10) = uVar11 >> 1;
}
if ((uVar11 & 1) != 0) {
*(uint *)(param_1 + 0x30) = *(uint *)(param_1 + 0x30) | 4;
CVar6 = param_1[0x34];
goto LAB_0016bbe3;
}
}
else {
*(uint *)(param_1 + 0x30) = *(uint *)(param_1 + 0x30) | 1;
iVar8 = *(int *)(param_1 + 0x2c);
uVar11 = *(uint *)(iVar8 + 0x10);
piVar1 = (int *)(iVar8 + 0x14);
*piVar1 = *piVar1 + -1;
if (*piVar1 == 0) {
puVar2 = *(undefined4 **)(iVar8 + 0x18);
*(undefined4 *)(iVar8 + 0x14) = 0x20;
if (puVar2 == *(undefined4 **)(iVar8 + 0x1c)) {
*(undefined4 *)(iVar8 + 0x14) = 1;
*(undefined4 *)(iVar8 + 0x10) = 0;
*(undefined4 **)(iVar8 + 0x18) = puVar2 + 1;
}
else if (*(undefined4 **)(iVar8 + 0x1c) < puVar2) {
*(undefined1 *)(iVar8 + 4) = 1;
*(undefined4 *)(iVar8 + 0x10) = 0;
}
else {
*(undefined4 **)(iVar8 + 0x18) = puVar2 + 1;
*(undefined4 *)(iVar8 + 0x10) = *puVar2;
}
}
else {
*(uint *)(iVar8 + 0x10) = uVar11 >> 1;
}
if ((uVar11 & 1) != 0) {
*(uint *)(param_1 + 0x30) = *(uint *)(param_1 + 0x30) | 2;
}
}
CVar6 = param_1[0x34];
LAB_0016bbe3:
*(undefined4 *)(param_1 + 0x10) = 3;
if (CVar6 == (CEntityReadInfo)0x0) goto LAB_0016bc30;
do {
if (*(int *)(param_1 + 0x14) < *(int *)(param_1 + 0x18)) goto LAB_0016bc30;
if ((*(uint *)(param_1 + 0x30) & 4) == 0) {
if ((*(uint *)(param_1 + 0x30) & 1) == 0) {
*(undefined4 *)(param_1 + 0x10) = 2;
ReadDeltaEnt(this,param_1);
}
else {
*(undefined4 *)(param_1 + 0x10) = 1;
ReadLeavePVS(this,param_1);
}
}
else {
*(undefined4 *)(param_1 + 0x10) = 0;
ReadEnterPVS(this,param_1);
}
while( true ) {
iVar8 = *(int *)(param_1 + 0x10);
if (iVar8 != 3) goto LAB_0016bbbf;
if (param_1[0x34] != (CEntityReadInfo)0x0) break;
LAB_0016bc30:
if ((*(int *)(param_1 + 8) == 0) ||
(*(int *)(*(int *)(param_1 + 8) + 4) < *(int *)(param_1 + 0x14))) {
*(undefined4 *)(param_1 + 0x10) = 4;
iVar8 = 4;
goto LAB_0016bc64;
}
*(undefined4 *)(param_1 + 0x10) = 3;
ReadPreserveEnt(this,param_1);
}
} while( true );
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.