L L4D2node

CThreadSafeMemoryPool::Free

0x0008bc10 · 257 bytes · __cdecl

_ZN21CThreadSafeMemoryPool4FreeEPvi

Decompiled

undefined (2 params)

/* CThreadSafeMemoryPool::Free(void*, int) */

void CThreadSafeMemoryPool::Free(void *param_1,int param_2)

{
  uint uVar1;
  undefined4 *puVar2;
  undefined4 uVar3;
  char cVar4;
  int iVar5;
  uint uVar6;
  
  uVar1 = (int)param_1 + 0x18;
  CThreadSpinRWLock::LockForRead();
  puVar2 = *(undefined4 **)((int)param_1 + 0x3c);
  do {
    iVar5 = puVar2[1];
    uVar3 = *puVar2;
    *(undefined4 *)param_2 = uVar3;
    cVar4 = ThreadInterlockedAssignIf64(puVar2,param_2,iVar5 + 0x10001,uVar3,iVar5);
  } while (cVar4 == '\0');
  LOCK();
  *(int *)((int)param_1 + 0xc) = *(int *)((int)param_1 + 0xc) + -1;
  UNLOCK();
  uVar6 = uVar1;
  CThreadSpinRWLock::UnlockRead();
  if (((*(int *)((int)param_1 + 0xc) == 0) && (0x4fffff < *(uint *)((int)param_1 + 0x10))) &&
     (9 < *(int *)((int)param_1 + 0x34))) {
    iVar5 = ThreadGetCurrentId(uVar6);
    LOCK();
    *(int *)((int)param_1 + 0x20) = *(int *)((int)param_1 + 0x20) + 1;
    UNLOCK();
    if (((0 < *(int *)((int)param_1 + 0x1c)) ||
        ((*(int *)((int)param_1 + 0x18) != 0 && (iVar5 != *(int *)((int)param_1 + 0x18))))) ||
       (cVar4 = ThreadInterlockedAssignIf64(uVar1,iVar5,0,0,0), cVar4 == '\0')) {
      CThreadSpinRWLock::SpinLockForWrite(uVar1);
    }
    if (*(int *)((int)param_1 + 0xc) == 0) {
                    /* try { // try from 0008bcb9 to 0008bcbd has its CatchHandler @ 0008bd17 */
      ClearNoLock(param_1);
    }
    CThreadSpinRWLock::UnlockWrite();
    return;
  }
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)