CMapLoadEntityFilter::CreateNextEntity
0x006cd7a0 · 552 bytes · __thiscall
_ZN20CMapLoadEntityFilter16CreateNextEntityEPKc
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CMapLoadEntityFilter::CreateNextEntity(char const*) */
int __thiscall CMapLoadEntityFilter::CreateNextEntity(CMapLoadEntityFilter *this,char *param_1)
{
int iVar1;
ushort uVar2;
uint uVar3;
int iVar4;
uint uVar5;
int iVar6;
int *piVar7;
uint uVar8;
uint uVar9;
int local_28;
int local_20;
iVar1 = CreateEntityByName(param_1,-1,true);
if (iVar1 == 0) {
local_28 = -1;
local_20 = -1;
}
else {
iVar4 = *(int *)(iVar1 + 0x30);
if (iVar4 == 0) {
local_28 = -1;
local_20 = 0;
}
else {
local_28 = *(int *)(iVar4 + 4);
local_20 = iVar4 - *(int *)(gpGlobals + 0x58) >> 4;
}
}
uVar5 = (uint)DAT_00fe3118;
if (DAT_00fe3118 == 0xffff) {
if ((int)(uint)DAT_00fe311e < DAT_00fe310c) {
uVar5 = DAT_00fe311e + 1;
uVar8 = uVar5 & 0xffff;
if (DAT_00fe310c <= (int)uVar8) {
uVar5 = 0xffff;
uVar8 = 0xffff;
}
}
else {
uVar8 = 0;
if (DAT_00fe310c < 1) {
uVar8 = 0xffff;
}
uVar5 = (0 < DAT_00fe310c) - 1;
}
if (DAT_00fe310c <= (int)uVar8) {
CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>::Grow
((CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short> *)
&g_MapEntityRefs,1);
_DAT_00fe3120 = g_MapEntityRefs;
if ((int)(uint)DAT_00fe311e < DAT_00fe310c) {
uVar8 = DAT_00fe311e + 1;
uVar3 = uVar8 & 0xffff;
uVar5 = 0xffff;
uVar9 = 0xffff;
if ((int)uVar3 < DAT_00fe310c) {
uVar5 = uVar8;
uVar9 = uVar3;
}
}
else {
uVar9 = 0;
if (DAT_00fe310c < 1) {
uVar9 = 0xffff;
}
uVar5 = (0 < DAT_00fe310c) - 1;
}
if (DAT_00fe310c <= (int)uVar9) {
if (9 < CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount) {
_DAT_00fe3120 = g_MapEntityRefs;
return iVar1;
}
CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount =
CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount + 1;
Warning("CUtlLinkedList overflow! (exhausted memory allocator)\n");
return iVar1;
}
}
uVar2 = (ushort)uVar5;
if (uVar2 == 0xffff) {
if (9 < CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount) {
return iVar1;
}
CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount =
CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
::AllocInternal(bool)::__executeCount + 1;
Warning("CUtlLinkedList overflow! (exhausted index range)\n");
return iVar1;
}
uVar5 = uVar5 & 0xffff;
_DAT_00fe311c = _DAT_00fe311c + 1;
iVar6 = uVar5 * 0xc;
iVar4 = g_MapEntityRefs + iVar6;
DAT_00fe311e = uVar2;
}
else {
iVar6 = uVar5 * 0xc;
iVar4 = g_MapEntityRefs + iVar6;
uVar2 = DAT_00fe3118;
DAT_00fe3118 = *(ushort *)(iVar4 + 10);
}
*(ushort *)(iVar4 + 10) = uVar2;
*(ushort *)(iVar4 + 8) = uVar2;
CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
::LinkBefore((CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
*)&g_MapEntityRefs,0xffff,(ushort)uVar5);
piVar7 = (int *)(iVar6 + g_MapEntityRefs);
if (piVar7 != (int *)0x0) {
*piVar7 = local_20;
piVar7[1] = local_28;
}
return iVar1;
}
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.