pqdownheap
0x000ea8a0 · 308 bytes · __cdecl
_Z10pqdownheapR6TStateP7ct_datai
Decompiled
undefined (3 params)
/* pqdownheap(TState&, ct_data*, int) */
void pqdownheap(TState *param_1,ct_data *param_2,int param_3)
{
ushort uVar1;
int iVar2;
int iVar3;
int iVar4;
int iVar5;
int iVar6;
int iVar7;
ushort uVar8;
bool bVar9;
int local_18;
local_18 = param_3 + 0x400;
iVar5 = param_3 * 2;
iVar2 = *(int *)(param_1 + local_18 * 4 + 4);
iVar3 = *(int *)(param_1 + 0x18f8);
if (iVar3 < iVar5) {
LAB_000ea967:
*(int *)(param_1 + local_18 * 4 + 4) = iVar2;
return;
}
do {
if (iVar5 < iVar3) {
iVar4 = *(int *)(param_1 + iVar5 * 4 + 0x1004);
iVar7 = *(int *)(param_1 + iVar5 * 4 + 0x1008);
uVar1 = *(ushort *)(param_2 + iVar4 * 4);
uVar8 = *(ushort *)(param_2 + iVar7 * 4);
iVar6 = iVar5 + 1;
if (uVar8 < uVar1) goto LAB_000ea8f8;
if (uVar8 == uVar1) {
if ((byte)param_1[iVar4 + 0x1900] < (byte)param_1[iVar7 + 0x1900]) {
iVar6 = iVar5;
iVar7 = iVar4;
}
goto LAB_000ea8f8;
}
uVar8 = *(ushort *)(param_2 + iVar2 * 4);
bVar9 = uVar8 == uVar1;
iVar6 = iVar5;
iVar7 = iVar4;
if (uVar8 < uVar1) goto LAB_000ea967;
}
else {
uVar8 = *(ushort *)(param_2 + *(int *)(param_1 + iVar5 * 4 + 0x1004) * 4);
iVar6 = iVar5;
iVar7 = *(int *)(param_1 + iVar5 * 4 + 0x1004);
LAB_000ea8f8:
uVar1 = *(ushort *)(param_2 + iVar2 * 4);
bVar9 = uVar1 == uVar8;
if (uVar1 < uVar8) goto LAB_000ea967;
}
if (bVar9) {
if ((byte)param_1[iVar2 + 0x1900] <= (byte)param_1[iVar7 + 0x1900]) goto LAB_000ea967;
*(int *)(param_1 + local_18 * 4 + 4) = iVar7;
}
else {
*(int *)(param_1 + local_18 * 4 + 4) = iVar7;
}
if (iVar3 < iVar6 * 2) {
*(int *)(param_1 + (iVar6 + 0x400) * 4 + 4) = iVar2;
return;
}
iVar5 = iVar6 * 2;
local_18 = iVar6 + 0x400;
} 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.