L L4D2node

CThreadSafeMultiMemoryPool::~CThreadSafeMultiMemoryPool

0x00075180 · 429 bytes · __thiscall

_ZN26CThreadSafeMultiMemoryPoolD1Ev

Decompiled

undefined (1 param)

/* CThreadSafeMultiMemoryPool::~CThreadSafeMultiMemoryPool() */

void __thiscall
CThreadSafeMultiMemoryPool::~CThreadSafeMultiMemoryPool(CThreadSafeMultiMemoryPool *this)

{
  CThreadSafeMultiMemoryPool *pCVar1;
  ushort *puVar2;
  uint uVar3;
  CThreadSafeMemoryPool *this_00;
  uint uVar4;
  int iVar5;
  int iVar6;
  
  pCVar1 = this + 0x48;
  uVar4 = ThreadGetCurrentId();
  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_000751b7;
    }
  }
  *(int *)(this + 0x4c) = *(int *)(this + 0x4c) + 1;
LAB_000751b7:
  iVar6 = 0;
  if (0 < *(int *)(this + 0xc)) {
    do {
      this_00 = *(CThreadSafeMemoryPool **)(*(int *)this + iVar6 * 8);
      if (this_00 != (CThreadSafeMemoryPool *)0x0) {
        CThreadSafeMemoryPool::~CThreadSafeMemoryPool(this_00);
        operator_delete(this_00);
      }
      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_00075239;
      }
      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)) {
        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_000d2862 = 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_00075239:
  *(int *)(this + 0x4c) = *(int *)(this + 0x4c) + -1;
  if (*(int *)(this + 0x4c) == 0) {
    LOCK();
    *(uint *)pCVar1 = 0;
    UNLOCK();
  }
  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));
  *(undefined2 *)(this + 0x40) = 0xffff;
  CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
  ::Purge((CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
           *)(this + 0x30));
  *(undefined2 *)(this + 0x42) = 0xffff;
  CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
  ::Purge((CUtlMemory<UtlRBTreeNode_t<CUtlMap<void*,CThreadSafeMultiMemoryPool::RawAllocation_t,unsigned_short>::Node_t,unsigned_short>,unsigned_short>
           *)(this + 0x30));
  *(undefined4 *)(this + 0x24) = 0;
  CUtlMemory<CThreadSafeMultiMemoryPool::MemPoolRecord_t*,int>::Purge
            ((CUtlMemory<CThreadSafeMultiMemoryPool::MemPoolRecord_t*,int> *)(this + 0x18));
  *(undefined4 *)(this + 0x28) = *(undefined4 *)(this + 0x18);
  CUtlMemory<CThreadSafeMultiMemoryPool::MemPoolRecord_t*,int>::Purge
            ((CUtlMemory<CThreadSafeMultiMemoryPool::MemPoolRecord_t*,int> *)(this + 0x18));
  *(undefined4 *)(this + 0xc) = 0;
  CUtlMemory<CThreadSafeMultiMemoryPool::MemPoolRecord_t,int>::Purge
            ((CUtlMemory<CThreadSafeMultiMemoryPool::MemPoolRecord_t,int> *)this);
  *(undefined4 *)(this + 0x10) = *(undefined4 *)this;
  CUtlMemory<CThreadSafeMultiMemoryPool::MemPoolRecord_t,int>::Purge
            ((CUtlMemory<CThreadSafeMultiMemoryPool::MemPoolRecord_t,int> *)this);
  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)