L L4D2node

CThreadSafeMultiMemoryPool::CMBPoolSizeInUse

0x00074e50 · 360 bytes · __thiscall

_ZNK26CThreadSafeMultiMemoryPool16CMBPoolSizeInUseEv

Decompiled

undefined (1 param)

/* CThreadSafeMultiMemoryPool::CMBPoolSizeInUse() const */

undefined8 __thiscall CThreadSafeMultiMemoryPool::CMBPoolSizeInUse(CThreadSafeMultiMemoryPool *this)

{
  CThreadSafeMultiMemoryPool *pCVar1;
  ushort *puVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  bool bVar7;
  uint local_24;
  int local_20;
  
  if (*(int *)(this + 0xc) < 1) {
    local_24 = 0;
    local_20 = 0;
  }
  else {
    local_24 = 0;
    local_20 = 0;
    iVar6 = 0;
    do {
      uVar4 = CThreadSafeMemoryPool::CubSizeInUse
                        (*(CThreadSafeMemoryPool **)(*(int *)this + iVar6 * 8));
      bVar7 = CARRY4(local_24,uVar4);
      local_24 = local_24 + uVar4;
      local_20 = local_20 + (uint)bVar7;
      iVar6 = iVar6 + 1;
    } while (iVar6 < *(int *)(this + 0xc));
  }
  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_00074ec8;
    }
  }
  *(int *)(this + 0x4c) = *(int *)(this + 0x4c) + 1;
LAB_00074ec8:
  uVar4 = *(uint *)(this + 0x34);
  if ((short)uVar4 != 0) {
    iVar6 = 0;
    do {
      while (((int)uVar4 <= iVar6 || (*(ushort *)(this + 0x42) < (ushort)iVar6))) {
LAB_00074ed8:
        iVar6 = iVar6 + 1;
        if ((int)(uVar4 & 0xffff) <= iVar6) goto LAB_00074f1a;
      }
      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);
        if (iVar5 == 0) {
          uVar4 = *(uint *)(this + 0x34);
        }
        else {
          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);
          uVar4 = *(uint *)(this + 0x34);
        }
      }
      puVar2 = (ushort *)(*(int *)(this + 0x30) + iVar6 * 0x14);
      if ((ushort)iVar6 == *puVar2) goto LAB_00074ed8;
      uVar3 = *(uint *)(puVar2 + 8);
      bVar7 = CARRY4(local_24,uVar3);
      local_24 = local_24 + uVar3;
      local_20 = local_20 + (uint)bVar7;
      iVar6 = iVar6 + 1;
    } while (iVar6 < (int)(uVar4 & 0xffff));
  }
LAB_00074f1a:
  *(int *)(this + 0x4c) = *(int *)(this + 0x4c) + -1;
  uVar4 = *(uint *)(this + 0x4c);
  if (uVar4 == 0) {
    LOCK();
    uVar4 = *(uint *)pCVar1;
    *(uint *)pCVar1 = 0;
    UNLOCK();
  }
  return CONCAT44(uVar4,local_24 >> 0x14 | local_20 << 0xc);
}

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)