CThreadSafeMultiMemoryPool::Clear
0x00075020 · 307 bytes · __thiscall
_ZN26CThreadSafeMultiMemoryPool5ClearEv
Decompiled
undefined (1 param)
/* CThreadSafeMultiMemoryPool::Clear() */
uint __thiscall CThreadSafeMultiMemoryPool::Clear(CThreadSafeMultiMemoryPool *this)
{
CThreadSafeMultiMemoryPool *pCVar1;
ushort *puVar2;
uint uVar3;
uint uVar4;
int iVar5;
int iVar6;
uVar4 = ThreadGetCurrentId();
pCVar1 = this + 0x48;
if (uVar4 != *(uint *)(this + 0x48)) {
LOCK();
uVar3 = *(uint *)pCVar1;
if (uVar3 == 0) {
*(uint *)pCVar1 = uVar4;
}
UNLOCK();
if (uVar3 != 0) {
CThreadFastMutex::Lock((uint)pCVar1,uVar4);
goto LAB_00075052;
}
}
*(int *)(this + 0x4c) = *(int *)(this + 0x4c) + 1;
LAB_00075052:
iVar6 = 0;
if (0 < *(int *)(this + 0xc)) {
do {
/* try { // try from 00075068 to 0007506c has its CatchHandler @ 00075163 */
CThreadSafeMemoryPool::Clear(*(CThreadSafeMemoryPool **)(*(int *)this + iVar6 * 8));
iVar6 = iVar6 + 1;
} while (iVar6 < *(int *)(this + 0xc));
}
uVar4 = *(uint *)(this + 0x34);
iVar6 = 0;
if ((short)uVar4 != 0) {
do {
while (((int)uVar4 <= iVar6 || (*(ushort *)(this + 0x42) < (ushort)iVar6))) {
iVar6 = iVar6 + 1;
if ((int)(uVar4 & 0xffff) <= iVar6) goto LAB_000750cd;
}
if ((CUtlRBTree<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel == '\0') &&
(iVar5 = __cxa_guard_acquire(&CUtlRBTree<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel), iVar5 != 0)) {
DAT_000d2862 = 0xffff;
CUtlRBTree<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel = 0xffff;
DAT_000d2864 = 0xffff;
__cxa_guard_release(&CUtlRBTree<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Links(unsigned_short)::s_Sentinel);
}
puVar2 = (ushort *)(*(int *)(this + 0x30) + iVar6 * 0x14);
if ((ushort)iVar6 != *puVar2) {
free(*(void **)(puVar2 + 6));
}
uVar4 = *(uint *)(this + 0x34);
iVar6 = iVar6 + 1;
} while (iVar6 < (int)(uVar4 & 0xffff));
}
LAB_000750cd:
CUtlRBTree<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::RemoveAll((CUtlRBTree<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short,CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)(this + 0x2c));
*(int *)(this + 0x4c) = *(int *)(this + 0x4c) + -1;
uVar4 = *(uint *)(this + 0x4c);
if (uVar4 == 0) {
LOCK();
uVar4 = *(uint *)pCVar1;
*(uint *)pCVar1 = 0;
UNLOCK();
}
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.