CThreadSafeMultiMemoryPool::Free
0x000756f0 · 250 bytes · __regparm1
_ZN26CThreadSafeMultiMemoryPool4FreeEPv
Decompiled
undefined (1 param)
/* CThreadSafeMultiMemoryPool::Free(void*) */
void * __regparm1 CThreadSafeMultiMemoryPool::Free(void *param_1)
{
uint *puVar1;
uint uVar2;
ushort uVar3;
uint uVar4;
void *pvVar5;
int in_stack_00000004;
int in_stack_00000008;
int local_28 [6];
if (in_stack_00000008 == 0) {
return param_1;
}
if (*(uint *)(in_stack_00000008 + -4) <= *(uint *)(in_stack_00000004 + 0x14)) {
pvVar5 = (void *)CThreadSafeMemoryPool::Free
((void *)**(undefined4 **)
(*(int *)(in_stack_00000004 + 0x18) +
(*(uint *)(in_stack_00000008 + -4) - 1 >> 5) * 4),
in_stack_00000008 + -4);
return pvVar5;
}
uVar4 = ThreadGetCurrentId();
puVar1 = (uint *)(in_stack_00000004 + 0x48);
if (uVar4 != *(uint *)(in_stack_00000004 + 0x48)) {
LOCK();
uVar2 = *puVar1;
if (uVar2 == 0) {
*puVar1 = uVar4;
}
UNLOCK();
if (uVar2 != 0) {
CThreadFastMutex::Lock((uint)puVar1,uVar4);
goto LAB_00075739;
}
}
*(int *)(in_stack_00000004 + 0x4c) = *(int *)(in_stack_00000004 + 0x4c) + 1;
LAB_00075739:
local_28[0] = in_stack_00000008 + -4;
/* try { // try from 0007574c to 00075750 has its CatchHandler @ 000757fb */
uVar3 = 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>>
::Find((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>>
*)(in_stack_00000004 + 0x2c),(Node_t *)local_28);
if (uVar3 != 0xffff) {
free(*(void **)(*(int *)(in_stack_00000004 + 0x30) + (uint)uVar3 * 0x14 + 0xc));
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>>
::RemoveAt((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>>
*)(in_stack_00000004 + 0x2c),uVar3);
}
*(int *)(in_stack_00000004 + 0x4c) = *(int *)(in_stack_00000004 + 0x4c) + -1;
if (*(void **)(in_stack_00000004 + 0x4c) != (void *)0x0) {
return *(void **)(in_stack_00000004 + 0x4c);
}
LOCK();
pvVar5 = (void *)*puVar1;
*puVar1 = 0;
UNLOCK();
return pvVar5;
}
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.