BZ2_blockSort
0x0029b320 · 428 bytes · __cdecl
_Z13BZ2_blockSortP6EState
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* BZ2_blockSort(EState*) */
void BZ2_blockSort(EState *param_1)
{
uint *puVar1;
int iVar2;
uint *puVar3;
int iVar4;
uint uVar5;
int iVar6;
int local_38;
int local_20 [4];
iVar6 = *(int *)(param_1 + 0x44);
puVar1 = *(uint **)(param_1 + 0x20);
iVar2 = *(int *)(param_1 + 0x30);
puVar3 = *(uint **)(param_1 + 0x18);
iVar4 = *(int *)(param_1 + 0x268);
if (9999 < iVar6) {
local_38 = 0;
uVar5 = iVar6 + 0x22U;
if ((iVar6 + 0x22U & 1) != 0) {
uVar5 = iVar6 + 0x23;
}
if (0 < iVar2) {
if (iVar2 < 0x65) {
local_38 = ((iVar2 + -1) / 3) * iVar6;
}
else {
local_38 = iVar6 * 0x21;
}
}
local_20[0] = local_38;
mainSort(puVar1,*(uchar **)(param_1 + 0x24),(ushort *)(*(uchar **)(param_1 + 0x24) + uVar5),
puVar3,iVar6,iVar4,local_20);
if (2 < iVar4) {
fprintf(_stderr," %d work, %d block, ratio %5.2f\n",local_38 - local_20[0],iVar6,
(double)((float)(local_38 - local_20[0]) / (float)iVar6));
}
if (-1 < local_20[0]) goto LAB_0029b3c1;
if (1 < iVar4) {
fwrite(" too repetitive; using fallback sorting algorithm\n",1,0x35,_stderr);
}
}
fallbackSort(*(uint **)(param_1 + 0x10),*(uint **)(param_1 + 0x14),puVar3,iVar6,iVar4);
LAB_0029b3c1:
*(undefined4 *)(param_1 + 0x1c) = 0xffffffff;
if (0 < *(int *)(param_1 + 0x44)) {
iVar6 = 0;
if (*puVar1 == 0) {
*(undefined4 *)(param_1 + 0x1c) = 0;
return;
}
do {
iVar6 = iVar6 + 1;
if (iVar6 == *(int *)(param_1 + 0x44)) goto LAB_0029b3f2;
} while (puVar1[iVar6] != 0);
*(int *)(param_1 + 0x1c) = iVar6;
if (iVar6 != -1) {
return;
}
}
LAB_0029b3f2:
BZ2_bz__AssertH__fail(0x3eb);
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.