CSave::WriteEntityPtr
0x004a6c80 · 518 bytes · __thiscall
_ZN5CSave14WriteEntityPtrEPP11CBaseEntityi
Decompiled
undefined (3 params)
/* CSave::WriteEntityPtr(CBaseEntity**, int) */
void __thiscall CSave::WriteEntityPtr(CSave *this,CBaseEntity **param_1,int param_2)
{
int *piVar1;
CBaseEntity *pCVar2;
int iVar3;
uint uVar4;
int *piVar5;
uint uVar6;
undefined4 uVar7;
uint uVar8;
int iVar9;
undefined4 *puVar10;
undefined *puVar11;
undefined4 *local_1044;
int local_103c;
CBaseEntity *local_1024 [2];
undefined4 local_101c [1027];
if (0 < param_2) {
local_103c = 0;
do {
pCVar2 = param_1[local_103c];
iVar3 = *(int *)(this + 0x1c);
if (pCVar2 == (CBaseEntity *)0x0) {
LAB_004a6e4c:
uVar7 = 0xffffffff;
}
else {
if (*(int *)(iVar3 + 0x574) < 1) {
LAB_004a6d01:
if (0 < *(int *)(iVar3 + 0x55c)) {
puVar10 = *(undefined4 **)(iVar3 + 0x560);
iVar9 = 0;
do {
uVar6 = puVar10[4];
if ((((uVar6 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar6 & 0xfff) * 0x10,
puVar11 != (undefined *)0xfffffffc)) && (*(uint *)(puVar11 + 8) == uVar6 >> 0xc))
&& (pCVar2 == *(CBaseEntity **)(puVar11 + 4))) {
uVar7 = *puVar10;
goto LAB_004a6d8f;
}
iVar9 = iVar9 + 1;
puVar10 = puVar10 + 0xe;
} while (iVar9 != *(int *)(iVar3 + 0x55c));
}
goto LAB_004a6e4c;
}
piVar5 = (int *)(*(int *)(iVar3 + 0x568) + 0xc);
piVar1 = piVar5 + *(int *)(iVar3 + 0x574) * 5;
iVar9 = 0;
do {
iVar9 = iVar9 + *piVar5;
piVar5 = piVar5 + 5;
} while (piVar5 != piVar1);
if (iVar9 == 0) goto LAB_004a6d01;
local_1024[0] = pCVar2;
uVar6 = Hash4(local_1024);
if (*(char *)(iVar3 + 0x57e) == '\0') {
uVar6 = uVar6 % *(uint *)(iVar3 + 0x574);
}
else {
uVar6 = uVar6 & *(uint *)(iVar3 + 0x580);
}
piVar1 = (int *)(*(int *)(iVar3 + 0x568) + uVar6 * 0x14);
uVar4 = piVar1[3];
if ((int)uVar4 < 1) {
if (uVar4 == 0) goto LAB_004a6e4c;
uVar8 = 0;
}
else {
piVar1 = (int *)*piVar1;
uVar8 = 0;
pCVar2 = (CBaseEntity *)*piVar1;
while (pCVar2 != local_1024[0]) {
uVar8 = uVar8 + 1;
if (uVar8 == uVar4) goto LAB_004a6e4c;
pCVar2 = (CBaseEntity *)piVar1[uVar8 * 2];
}
}
uVar6 = uVar6 << 0x10 | uVar8;
if (uVar6 == 0xffffffff) goto LAB_004a6e4c;
uVar7 = *(undefined4 *)
(*(int *)(*(int *)(iVar3 + 0x568) + (uVar6 >> 0x10) * 0x14) + 4 +
(uVar8 & 0xffff) * 8);
}
LAB_004a6d8f:
iVar3 = local_103c + 1;
local_101c[local_103c] = uVar7;
} while ((iVar3 < 0x400) && (local_103c = iVar3, iVar3 < param_2));
}
local_1044 = local_101c;
(**(code **)(*(int *)this + 0x2c))(this,local_1044,param_2);
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.