CFindEntityCache::Lookup
0x009f4920 · 358 bytes · __thiscall
_ZN16CFindEntityCache6LookupEPKc
Decompiled
undefined (2 params)
/* CFindEntityCache::Lookup(char const*) */
CBaseEntity * __thiscall CFindEntityCache::Lookup(CFindEntityCache *this,char *param_1)
{
undefined2 uVar1;
uint uVar2;
char cVar3;
short sVar4;
CBaseEntity *pCVar5;
undefined *puVar6;
int iVar7;
CFindEntityCache *pCVar8;
int local_24;
if (*param_1 == '!') {
pCVar5 = (CBaseEntity *)
CGlobalEntityList::FindEntityByName
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,param_1,(CBaseEntity *)0x0,
(CBaseEntity *)0x0,(CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
return pCVar5;
}
iVar7 = 0;
sVar4 = HashStringCaseless(param_1);
local_24 = -1;
pCVar8 = this;
do {
uVar2 = *(uint *)pCVar8;
if ((((uVar2 == 0xffffffff) ||
(puVar6 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar6 + 8) != uVar2 >> 0xc)) ||
(pCVar5 = *(CBaseEntity **)(puVar6 + 4), pCVar5 == (CBaseEntity *)0x0)) {
if (local_24 == -1) {
local_24 = iVar7;
}
}
else if ((*(short *)(this + iVar7 * 2 + 0x20) == sVar4) &&
((param_1 == *(char **)(pCVar5 + 0x154) ||
(cVar3 = CBaseEntity::NameMatchesComplex(pCVar5,param_1), cVar3 != '\0')))) {
if (iVar7 == 0) {
return pCVar5;
}
uVar1 = *(undefined2 *)(this + iVar7 * 2 + 0x20);
iVar7 = iVar7 + -1;
uVar2 = *(uint *)pCVar8;
pCVar8 = this + iVar7 * 4;
while( true ) {
*(undefined4 *)(pCVar8 + 4) = *(undefined4 *)pCVar8;
*(undefined2 *)(this + iVar7 * 2 + 0x22) = *(undefined2 *)(this + iVar7 * 2 + 0x20);
if (iVar7 == 0) break;
iVar7 = iVar7 + -1;
pCVar8 = pCVar8 + -4;
}
*(uint *)this = uVar2;
*(undefined2 *)(this + 0x20) = uVar1;
return pCVar5;
}
iVar7 = iVar7 + 1;
pCVar8 = pCVar8 + 4;
if (iVar7 == 8) {
pCVar5 = (CBaseEntity *)Insert(this,local_24,param_1);
return pCVar5;
}
} while( true );
}
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.