CNetChan::CompressFragments
0x001aeb60 · 1145 bytes · __thiscall
_ZN8CNetChan17CompressFragmentsEv
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CNetChan::CompressFragments() */
void __thiscall CNetChan::CompressFragments(CNetChan *this)
{
int *piVar1;
int *piVar2;
char cVar3;
int iVar4;
char *pcVar5;
int iVar6;
int iVar7;
char *pcVar8;
uint uVar9;
CNetChan *pCVar10;
int in_GS_OFFSET;
int local_130;
uint local_128;
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (((this[0x429] != (CNetChan)0x0) && (iVar4 = (**(code **)(_g_pVCR + 0xc))(), iVar4 == 0)) &&
(*(int *)(ZombieNetworkCompression._28_4_ + 0x30) != 0)) {
pCVar10 = this + 0xbc;
iVar4 = 2;
do {
if (((*(int *)(pCVar10 + 0xc) != 0) &&
(piVar2 = (int *)**(int **)pCVar10, (char)piVar2[0x46] == '\0')) &&
((uVar9 = piVar2[0x43], 0x1ff < uVar9 && ((piVar2[0x4a] < 1 && (piVar2[0x4b] < 1)))))) {
if (piVar2[0x42] == 0) {
piVar1 = piVar2 + 1;
V_snprintf(local_124,0x104,"%s.ztmp",piVar1);
iVar6 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x34))(g_pFileSystem + 4,local_124,0);
iVar7 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x34))(g_pFileSystem + 4,piVar1,0);
if ((iVar6 < iVar7) ||
(local_130 = (**(code **)(*(int *)(g_pFileSystem + 4) + 8))
(g_pFileSystem + 4,local_124,&DAT_002a3e98,0), local_130 == 0))
{
pcVar5 = operator_new__(piVar2[0x43]);
pcVar8 = operator_new__(piVar2[0x43]);
uVar9 = piVar2[0x43];
local_128 = uVar9;
(*(code *)**(undefined4 **)(g_pFileSystem + 4))(g_pFileSystem + 4,pcVar5,uVar9,*piVar2);
cVar3 = NET_BufferToBufferCompress(pcVar8,&local_128,pcVar5,uVar9);
if ((cVar3 == '\0') ||
(iVar6 = (**(code **)(*(int *)(g_pFileSystem + 4) + 8))
(g_pFileSystem + 4,local_124,&DAT_002a5c80,0), iVar6 == 0)) {
local_130 = 0;
uVar9 = 0xffffffff;
}
else {
DevMsg("Creating compressed version of file %s (%d -> %d)\n",piVar1,piVar2[0x43],
local_128);
(**(code **)(*(int *)(g_pFileSystem + 4) + 4))
(g_pFileSystem + 4,pcVar8,local_128,iVar6);
(**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))(g_pFileSystem + 4,iVar6);
local_130 = (**(code **)(*(int *)(g_pFileSystem + 4) + 8))
(g_pFileSystem + 4,local_124,&DAT_002a3e98,0);
uVar9 = local_128;
if (local_130 == 0) {
uVar9 = 0xffffffff;
}
}
if (pcVar5 != (char *)0x0) {
operator_delete__(pcVar5);
}
if (pcVar8 != (char *)0x0) {
operator_delete__(pcVar8);
}
}
else {
uVar9 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x18))(g_pFileSystem + 4,local_130);
}
if (0 < (int)uVar9) {
(**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))(g_pFileSystem + 4,*piVar2);
*(undefined1 *)(piVar2 + 0x46) = 1;
*piVar2 = local_130;
piVar2[0x47] = piVar2[0x43];
piVar2[0x43] = uVar9;
piVar2[0x49] = uVar9 + 0xff >> 8;
}
}
else {
local_128 = uVar9;
pcVar5 = operator_new__(uVar9);
cVar3 = NET_BufferToBufferCompress(pcVar5,&local_128,(char *)piVar2[0x42],piVar2[0x43]);
if (cVar3 != '\0') {
_V_memcpy((void *)piVar2[0x42],pcVar5,local_128);
piVar2[0x47] = piVar2[0x43];
*(undefined1 *)(piVar2 + 0x46) = 1;
piVar2[0x43] = local_128;
piVar2[0x49] = local_128 + 0xff >> 8;
}
if (pcVar5 != (char *)0x0) {
operator_delete__(pcVar5);
}
}
}
pCVar10 = pCVar10 + 0x14;
iVar4 = iVar4 + -1;
} while (iVar4 != 0);
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
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.