CSave::EntityIndex
0x004a8920 · 368 bytes · __thiscall
_ZN5CSave11EntityIndexEPK7edict_t
Decompiled
undefined (2 params)
/* CSave::EntityIndex(edict_t const*) */
undefined4 __thiscall CSave::EntityIndex(CSave *this,edict_t *param_1)
{
int *piVar1;
int iVar2;
uint uVar3;
int *piVar4;
uint uVar5;
uint uVar6;
int iVar7;
undefined4 *puVar8;
undefined *puVar9;
int local_24 [5];
if ((param_1 != (edict_t *)0x0) && (piVar1 = *(int **)(param_1 + 0xc), piVar1 != (int *)0x0)) {
local_24[0] = (**(code **)(*piVar1 + 0x18))(piVar1);
iVar2 = *(int *)(this + 0x1c);
if (local_24[0] != 0) {
if (0 < *(int *)(iVar2 + 0x574)) {
piVar4 = (int *)(*(int *)(iVar2 + 0x568) + 0xc);
piVar1 = piVar4 + *(int *)(iVar2 + 0x574) * 5;
iVar7 = 0;
do {
iVar7 = iVar7 + *piVar4;
piVar4 = piVar4 + 5;
} while (piVar4 != piVar1);
if (iVar7 != 0) {
uVar5 = Hash4(local_24);
if (*(char *)(iVar2 + 0x57e) == '\0') {
uVar5 = uVar5 % *(uint *)(iVar2 + 0x574);
}
else {
uVar5 = uVar5 & *(uint *)(iVar2 + 0x580);
}
piVar1 = (int *)(*(int *)(iVar2 + 0x568) + uVar5 * 0x14);
uVar3 = piVar1[3];
if ((int)uVar3 < 1) {
if (uVar3 == 0) {
return 0xffffffff;
}
uVar6 = 0;
}
else {
piVar1 = (int *)*piVar1;
uVar6 = 0;
iVar7 = *piVar1;
while (iVar7 != local_24[0]) {
uVar6 = uVar6 + 1;
if (uVar6 == uVar3) {
return 0xffffffff;
}
iVar7 = piVar1[uVar6 * 2];
}
}
uVar5 = uVar5 << 0x10 | uVar6;
if (uVar5 == 0xffffffff) {
return 0xffffffff;
}
return *(undefined4 *)
(*(int *)(*(int *)(iVar2 + 0x568) + (uVar5 >> 0x10) * 0x14) + 4 +
(uVar6 & 0xffff) * 8);
}
}
if (0 < *(int *)(iVar2 + 0x55c)) {
puVar8 = *(undefined4 **)(iVar2 + 0x560);
iVar7 = 0;
do {
uVar5 = puVar8[4];
if ((((uVar5 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar9 + 8) == uVar5 >> 0xc)) && (local_24[0] == *(int *)(puVar9 + 4)))
{
return *puVar8;
}
iVar7 = iVar7 + 1;
puVar8 = puVar8 + 0xe;
} while (iVar7 != *(int *)(iVar2 + 0x55c));
}
}
}
return 0xffffffff;
}
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.