CLZSS::CompressNoAlloc
0x00254480 · 696 bytes · __thiscall
_ZN5CLZSS15CompressNoAllocEPhiS0_Pj
Decompiled
undefined (5 params)
/* CLZSS::CompressNoAlloc(unsigned char*, int, unsigned char*, unsigned int*) */
uchar * __thiscall
CLZSS::CompressNoAlloc(CLZSS *this,uchar *param_1,int param_2,uchar *param_3,uint *param_4)
{
byte *pbVar1;
int iVar2;
byte *pbVar3;
int iVar4;
uchar *puVar5;
int iVar6;
int iVar7;
int iVar8;
undefined1 *puVar9;
undefined1 *puVar10;
undefined4 *puVar11;
int in_GS_OFFSET;
undefined4 uStack_880;
int aiStack_87c [3];
undefined4 auStack_870 [513];
undefined1 auStack_6c [16];
uint *local_5c;
uchar *local_58;
byte *local_54;
byte *local_50;
int local_4c;
uint local_48;
byte *local_44;
byte *local_40;
byte local_39;
CLZSS *local_38;
undefined4 *local_34;
int local_30;
int local_20;
local_38 = this;
local_58 = param_3;
local_5c = param_4;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
puVar9 = auStack_6c;
if (0x10 < (uint)param_2) {
*(undefined4 **)this = auStack_870;
puVar11 = auStack_870;
for (iVar6 = 0x200; iVar6 != 0; iVar6 = iVar6 + -1) {
*puVar11 = 0;
puVar11 = puVar11 + 1;
}
iVar6 = -(*(int *)(this + 8) * 0x10 + 0x10);
puVar10 = (undefined1 *)((int)aiStack_87c + iVar6);
*(int *)(this + 4) = (int)auStack_870 + iVar6;
*(int *)((int)aiStack_87c + iVar6 + 8) = *(int *)(this + 8) * 0x10;
*(undefined4 *)((int)aiStack_87c + iVar6 + 4) = 0;
*(int *)((int)aiStack_87c + iVar6) = (int)auStack_870 + iVar6;
*(undefined4 *)((int)&uStack_880 + iVar6) = 0x2544fb;
memset(*(void **)((int)aiStack_87c + iVar6),*(int *)((int)aiStack_87c + iVar6 + 4),
*(size_t *)((int)aiStack_87c + iVar6 + 8));
local_58[0] = 'L';
local_58[1] = 'Z';
local_58[2] = 'S';
local_58[3] = 'S';
local_44 = local_58 + 8;
local_54 = local_58 + param_2 + -0x10;
*(int *)(local_58 + 4) = param_2;
puVar9 = (undefined1 *)((int)aiStack_87c + iVar6);
if (0 < param_2) {
local_48 = 0;
local_50 = (byte *)0x0;
local_40 = (byte *)0x0;
do {
if (local_48 == 0) {
local_4c = 0;
*local_44 = 0;
local_50 = local_44;
local_44 = local_44 + 1;
}
else {
local_4c = (int)(uint)*local_50 >> 1;
}
local_48 = local_48 + 1 & 7;
local_30 = 0x10;
if (param_2 < 0x11) {
local_30 = param_2;
}
local_39 = *param_1;
local_34 = *(undefined4 **)(*(int *)local_38 + (uint)local_39 * 8);
if (local_34 == (undefined4 *)0x0) {
LAB_002546d1:
iVar8 = 1;
*local_50 = (byte)local_4c;
*local_44 = *param_1;
local_44 = local_44 + 1;
pbVar3 = param_1;
}
else {
iVar8 = 0;
do {
if ((local_30 == 0) || (pbVar3 = (byte *)*local_34, local_39 != *pbVar3)) {
iVar7 = 0;
}
else {
iVar2 = 1;
do {
iVar7 = iVar2;
iVar4 = local_30;
if (iVar7 == local_30) break;
iVar4 = iVar7;
iVar2 = iVar7 + 1;
} while (pbVar3[iVar7] == param_1[iVar7]);
if (iVar8 < iVar4) {
local_40 = pbVar3;
iVar8 = iVar7;
}
}
} while ((iVar7 != local_30) &&
(puVar11 = local_34 + 2, local_34 = (undefined4 *)*puVar11,
(undefined4 *)*puVar11 != (undefined4 *)0x0));
if (iVar8 < 3) goto LAB_002546d1;
*local_50 = (byte)local_4c | 0x80;
*local_44 = (byte)((int)(param_1 + (-1 - (int)local_40)) >> 4);
local_44[1] = (char)iVar8 - 1U | (char)(param_1 + (-1 - (int)local_40)) * '\x10';
local_44 = local_44 + 2;
pbVar3 = param_1;
}
do {
pbVar1 = pbVar3 + 1;
*(byte **)((int)aiStack_87c + iVar6 + 4) = pbVar3;
*(CLZSS **)((int)aiStack_87c + iVar6) = local_38;
*(undefined4 *)((int)&uStack_880 + iVar6) = 0x254614;
BuildHash(*(CLZSS **)((int)aiStack_87c + iVar6),*(uchar **)((int)aiStack_87c + iVar6 + 4))
;
pbVar3 = pbVar1;
} while ((int)pbVar1 - (int)param_1 < iVar8);
iVar7 = 1;
if (0 < iVar8) {
iVar7 = iVar8;
}
param_2 = param_2 - iVar8;
param_1 = param_1 + iVar7;
puVar9 = (undefined1 *)((int)aiStack_87c + iVar6);
if (local_54 <= local_44) goto LAB_0025470d;
} while (0 < param_2);
puVar9 = (undefined1 *)((int)aiStack_87c + iVar6);
if (param_2 == 0) {
if (local_48 == 0) {
*local_44 = 1;
local_44 = local_44 + 1;
}
else {
*local_50 = (byte)((int)((int)(uint)*local_50 >> 1 | 0x80U) >>
(7U - (char)local_48 & 0x1f));
}
*local_44 = 0;
local_44[1] = 0;
puVar5 = local_58;
if (local_5c != (uint *)0x0) {
*local_5c = (uint)(local_44 + (2 - (int)local_58));
puVar10 = (undefined1 *)((int)aiStack_87c + iVar6);
}
goto LAB_0025470f;
}
}
}
LAB_0025470d:
puVar5 = (uchar *)0x0;
puVar10 = puVar9;
LAB_0025470f:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
*(undefined **)(puVar10 + -4) = &UNK_00254748;
__stack_chk_fail();
}
return puVar5;
}
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.