ct_tally
0x000eb440 · 603 bytes · __cdecl
_Z8ct_tallyR6TStateii
Decompiled
undefined (3 params)
/* ct_tally(TState&, int, int) */
bool ct_tally(TState *param_1,int param_2,int param_3)
{
int *piVar1;
int iVar2;
uint uVar3;
TState TVar4;
int iVar5;
uint uVar6;
uint uVar7;
bool bVar8;
iVar5 = *(int *)(param_1 + 0x1af2c);
uVar6 = iVar5 + 1;
*(uint *)(param_1 + 0x1af2c) = uVar6;
param_1[iVar5 + 0x1f2c] = SUB41(param_3,0);
if (param_2 == 0) {
*(short *)(param_1 + param_3 * 4 + 0x14) = *(short *)(param_1 + param_3 * 4 + 0x14) + 1;
TVar4 = param_1[0x1af39];
goto LAB_000eb47d;
}
iVar5 = param_2 + -1;
if (((ushort)iVar5 < 0x7efa) && ((ushort)param_3 < 0x100)) {
if (iVar5 < 0x100) {
if (0x1d < (byte)param_1[param_2 + 0x1c3c]) {
*(char **)(param_1 + 0x6afa4) = "ct_tally: bad match";
}
*(short *)(param_1 + (uint)(byte)param_1[param_3 + 0x1b3d] * 4 + 0x418) =
*(short *)(param_1 + (uint)(byte)param_1[param_3 + 0x1b3d] * 4 + 0x418) + 1;
LAB_000eb52e:
uVar7 = (uint)(byte)param_1[param_2 + 0x1c3c];
}
else {
uVar7 = (uint)(byte)param_1[(iVar5 >> 7) + 0x1d3d];
if (0x1d < uVar7) {
*(char **)(param_1 + 0x6afa4) = "ct_tally: bad match";
*(short *)(param_1 + (uint)(byte)param_1[param_3 + 0x1b3d] * 4 + 0x418) =
*(short *)(param_1 + (uint)(byte)param_1[param_3 + 0x1b3d] * 4 + 0x418) + 1;
goto LAB_000eb563;
}
*(short *)(param_1 + (uint)(byte)param_1[param_3 + 0x1b3d] * 4 + 0x418) =
*(short *)(param_1 + (uint)(byte)param_1[param_3 + 0x1b3d] * 4 + 0x418) + 1;
}
}
else {
*(char **)(param_1 + 0x6afa4) = "ct_tally: bad match";
*(short *)(param_1 + (uint)(byte)param_1[param_3 + 0x1b3d] * 4 + 0x418) =
*(short *)(param_1 + (uint)(byte)param_1[param_3 + 0x1b3d] * 4 + 0x418) + 1;
if (iVar5 < 0x100) goto LAB_000eb52e;
LAB_000eb563:
uVar7 = (uint)(byte)param_1[(iVar5 >> 7) + 0x1d3d];
}
*(short *)(param_1 + uVar7 * 4 + 0x908) = *(short *)(param_1 + uVar7 * 4 + 0x908) + 1;
iVar2 = *(int *)(param_1 + 0x1af30);
*(int *)(param_1 + 0x1af30) = iVar2 + 1;
*(ushort *)(param_1 + iVar2 * 2 + 0x9f2c) = (ushort)iVar5;
TVar4 = param_1[0x1af39];
param_1[0x1af38] = (TState)((byte)param_1[0x1af38] | (byte)TVar4);
LAB_000eb47d:
param_1[0x1af39] = (TState)((char)TVar4 * '\x02');
if ((uVar6 & 7) == 0) {
iVar5 = *(int *)(param_1 + 0x1af34);
*(int *)(param_1 + 0x1af34) = iVar5 + 1;
param_1[iVar5 + 0x19f2c] = param_1[0x1af38];
param_1[0x1af38] = (TState)0x0;
param_1[0x1af39] = (TState)0x1;
}
if ((2 < *(int *)(param_1 + 4)) && ((uVar6 & 0xfff) == 0)) {
uVar7 = uVar6 * 8;
uVar3 = *(int *)(param_1 + 0x6af84) - *(int *)(param_1 + 0x6af74);
iVar5 = 0;
do {
piVar1 = &extra_dbits + iVar5;
iVar2 = iVar5 * 4;
iVar5 = iVar5 + 1;
uVar7 = uVar7 + (*piVar1 + 5) * (uint)*(ushort *)(param_1 + iVar2 + 0x908);
} while (iVar5 != 0x1e);
uVar7 = uVar7 >> 3;
Trace("\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) ",uVar6,
*(undefined4 *)(param_1 + 0x1af30),uVar3,uVar7,100 - (uVar7 * 100) / uVar3);
uVar6 = *(uint *)(param_1 + 0x1af2c);
if ((*(uint *)(param_1 + 0x1af30) < uVar6 >> 1) && (uVar7 < uVar3 >> 1)) {
return true;
}
}
bVar8 = true;
if (uVar6 != 0x7fff) {
bVar8 = *(int *)(param_1 + 0x1af30) == 0x8000;
}
return bVar8;
}
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.