CEntitySaveRestoreBlockHandler::SaveInitEntities
0x004ac0e0 · 621 bytes · __thiscall
_ZN30CEntitySaveRestoreBlockHandler16SaveInitEntitiesEP16CSaveRestoreData
Decompiled
undefined (2 params)
/* CEntitySaveRestoreBlockHandler::SaveInitEntities(CSaveRestoreData*) */
undefined4 __thiscall
CEntitySaveRestoreBlockHandler::SaveInitEntities
(CEntitySaveRestoreBlockHandler *this,CSaveRestoreData *param_1)
{
CUtlVector<CGameSaveRestoreInfo::CHashElement,CUtlMemory<CGameSaveRestoreInfo::CHashElement,int>>
*this_00;
int *piVar1;
int iVar2;
int iVar3;
undefined4 uVar4;
undefined4 *puVar5;
uint uVar6;
int iVar7;
int iVar8;
undefined *puVar9;
CBaseEntity *pCVar10;
int local_38;
int local_34;
int local_30;
int local_28;
int local_24;
int local_20;
iVar2 = CGlobalEntityList::NumberOfEntities((CGlobalEntityList *)gEntList);
iVar3 = (**(code **)(*engine + 0x68))(engine,iVar2 * 0x38,1);
uVar4 = 0;
if (iVar3 != 0) {
iVar7 = 0;
iVar8 = 0;
*(int *)(param_1 + 0x578) = iVar3;
*(int *)(param_1 + 0x574) = iVar2;
if (0 < iVar2) {
while( true ) {
puVar5 = (undefined4 *)(iVar3 + iVar7);
iVar8 = iVar8 + 1;
iVar7 = iVar7 + 0x38;
*puVar5 = 0xffffffff;
puVar5[1] = 0xffffffff;
puVar5[2] = 0xffffffff;
puVar5[3] = 0xffffffff;
puVar5[5] = 0;
puVar5[6] = 0;
puVar5[7] = 0;
puVar5[8] = 0;
puVar5[9] = 0;
puVar5[10] = 0;
puVar5[0xb] = 0;
puVar5[0xc] = 0;
puVar5[0xd] = 0;
if (*(int *)(param_1 + 0x574) <= iVar8) break;
iVar3 = *(int *)(param_1 + 0x578);
}
}
local_28 = 0;
pCVar10 = (CBaseEntity *)0x0;
while (pCVar10 = (CBaseEntity *)
CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,pCVar10),
pCVar10 != (CBaseEntity *)0x0) {
SaveEntityOnTable(pCVar10,param_1,&local_28);
}
CUtlHash<CGameSaveRestoreInfo::CHashElement,CGameSaveRestoreInfo::CHashFuncs,CGameSaveRestoreInfo::CHashFuncs>
::CUtlHash(param_1 + 0x580,0x400,0,0,0,0);
local_38 = *(int *)(param_1 + 0x574);
if (0 < local_38) {
local_34 = 0;
local_30 = 0;
do {
local_24 = 0;
uVar6 = *(uint *)(*(int *)(param_1 + 0x578) + 0x10 + local_34);
if (((uVar6 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar6 >> 0xc)) {
local_24 = *(int *)(puVar9 + 4);
}
local_20 = local_30;
uVar6 = Hash4(&local_24);
if (param_1[0x596] == (CSaveRestoreData)0x0) {
uVar6 = uVar6 % *(uint *)(param_1 + 0x58c);
}
else {
uVar6 = uVar6 & *(uint *)(param_1 + 0x598);
}
this_00 = (CUtlVector<CGameSaveRestoreInfo::CHashElement,CUtlMemory<CGameSaveRestoreInfo::CHashElement,int>>
*)(*(int *)(param_1 + 0x580) + uVar6 * 0x14);
iVar3 = *(int *)(this_00 + 0xc);
if (iVar3 < 1) {
if (iVar3 == 0) {
LAB_004ac2dc:
CUtlVector<CGameSaveRestoreInfo::CHashElement,CUtlMemory<CGameSaveRestoreInfo::CHashElement,int>>
::GrowVector(this_00,1);
CUtlVector<CGameSaveRestoreInfo::CHashElement,CUtlMemory<CGameSaveRestoreInfo::CHashElement,int>>
::ShiftElementsRight(this_00,iVar3,1);
piVar1 = (int *)(*(int *)this_00 + iVar3 * 8);
if (piVar1 != (int *)0x0) {
*piVar1 = local_24;
piVar1[1] = local_20;
}
}
}
else if (**(int **)this_00 != local_24) {
iVar2 = 0;
do {
iVar2 = iVar2 + 1;
if (iVar2 == iVar3) goto LAB_004ac2dc;
} while ((*(int **)this_00)[iVar2 * 2] != local_24);
}
local_30 = local_30 + 1;
local_34 = local_34 + 0x38;
} while (local_30 != local_38);
local_38 = *(int *)(param_1 + 0x574);
}
uVar4 = CONCAT31((int3)((uint)local_38 >> 8),local_28 == local_38);
}
return uVar4;
}
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.