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