L L4D2node

CUtlRBTree<CBaseEntity*,unsigned_short,bool(*)(CBaseEntity*const&,CBaseEntity*const&),CUtlMemory<UtlRBTreeNode_t<CBaseEntity*,unsigned_short>,unsigned_short>>::Insert

0x007d0cb0 · 744 bytes · __thiscall

_ZN10CUtlRBTreeIP11CBaseEntitytPFbRKS1_S3_E10CUtlMemoryI15UtlRBTreeNode_tIS1_tEtEE6InsertES3_

Decompiled

undefined (2 params)

/* CUtlRBTree<CBaseEntity*, unsigned short, bool (*)(CBaseEntity* const&, CBaseEntity* const&),
   CUtlMemory<UtlRBTreeNode_t<CBaseEntity*, unsigned short>, unsigned short> >::Insert(CBaseEntity*
   const&) */

ushort __thiscall
CUtlRBTree<CBaseEntity*,unsigned_short,bool(*)(CBaseEntity*const&,CBaseEntity*const&),CUtlMemory<UtlRBTreeNode_t<CBaseEntity*,unsigned_short>,unsigned_short>>
::Insert(CUtlRBTree<CBaseEntity*,unsigned_short,bool(*)(CBaseEntity*const&,CBaseEntity*const&),CUtlMemory<UtlRBTreeNode_t<CBaseEntity*,unsigned_short>,unsigned_short>>
         *this,CBaseEntity **param_1)

{
  bool bVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  ushort uVar5;
  uint uVar6;
  uint uVar7;
  undefined2 *puVar8;
  int local_24;
  ushort local_20;
  ushort local_1e;
  
  local_1e = *(ushort *)(this + 0x10);
  uVar5 = local_1e;
  if (local_1e == 0xffff) {
    bVar1 = false;
  }
  else {
    do {
      local_1e = uVar5;
      iVar3 = (uint)local_1e * 0xc;
      cVar2 = (**(code **)this)(param_1,*(int *)(this + 4) + iVar3 + 8);
      if (cVar2 == '\0') {
        if ((Links(unsigned_short)::s_Sentinel == '\0') &&
           (iVar4 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar4 != 0)) {
          Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f4ee62 = 0xffff;
          DAT_00f4ee64 = 0xffff;
          __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        }
        uVar5 = *(ushort *)(*(int *)(this + 4) + 2 + iVar3);
        bVar1 = false;
      }
      else {
        if ((Links(unsigned_short)::s_Sentinel == '\0') &&
           (iVar3 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar3 != 0)) {
          Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f4ee62 = 0xffff;
          DAT_00f4ee64 = 0xffff;
          __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        }
        uVar5 = *(ushort *)(*(int *)(this + 4) + (uint)local_1e * 0xc);
        bVar1 = true;
      }
    } while (uVar5 != 0xffff);
  }
  uVar5 = *(ushort *)(this + 0x14);
  local_20 = uVar5;
  if (uVar5 != 0xffff) {
    iVar3 = *(int *)(this + 4);
    local_24 = (uint)uVar5 * 0xc;
    puVar8 = (undefined2 *)(iVar3 + local_24);
    *(undefined2 *)(this + 0x14) = puVar8[1];
    goto LAB_007d0d67;
  }
  iVar3 = *(int *)(this + 8);
  if ((int)(uint)*(ushort *)(this + 0x16) < iVar3) {
    uVar7 = *(ushort *)(this + 0x16) + 1;
    uVar6 = uVar7 & 0xffff;
    if (iVar3 <= (int)uVar6) {
      uVar7 = 0xffff;
      uVar6 = 0xffff;
    }
    if (iVar3 <= (int)uVar6) goto LAB_007d0f11;
LAB_007d0ecf:
    local_20 = (ushort)uVar7;
    local_24 = (uVar7 & 0xffff) * 0xc;
  }
  else {
    uVar6 = 0;
    if (iVar3 < 1) {
      uVar6 = 0xffff;
    }
    uVar7 = (0 < iVar3) - 1;
    if ((int)uVar6 < iVar3) goto LAB_007d0ecf;
LAB_007d0f11:
    CUtlMemory<UtlRBTreeNode_t<CBaseEntity*,unsigned_short>,unsigned_short>::Grow
              ((CUtlMemory<UtlRBTreeNode_t<CBaseEntity*,unsigned_short>,unsigned_short> *)(this + 4)
               ,1);
    iVar3 = *(int *)(this + 8);
    if ((int)(uint)*(ushort *)(this + 0x16) < iVar3) {
      uVar7 = *(ushort *)(this + 0x16) + 1;
      uVar6 = uVar7 & 0xffff;
      if ((int)uVar6 < iVar3) {
        local_24 = uVar6 * 0xc;
        local_20 = (ushort)uVar7;
      }
      else {
        local_24 = 0xbfff4;
        uVar6 = 0xffff;
      }
    }
    else {
      uVar6 = 0;
      local_24 = 0xbfff4;
      if (iVar3 < 1) {
        uVar6 = 0xffff;
      }
      else {
        local_24 = 0;
      }
      local_20 = 0;
      if (iVar3 < 1) {
        local_20 = uVar5;
      }
    }
    if (iVar3 <= (int)uVar6) {
      Error("CUtlRBTree overflow!\n");
    }
  }
  uVar5 = (ushort)uVar6;
  *(ushort *)(this + 0x16) = local_20;
  iVar3 = *(int *)(this + 4);
  puVar8 = (undefined2 *)(iVar3 + local_24);
LAB_007d0d67:
  *(int *)(this + 0x18) = iVar3;
  puVar8[1] = 0xffff;
  *puVar8 = 0xffff;
  puVar8[3] = 0;
  puVar8[2] = local_1e;
  if (local_1e == 0xffff) {
    *(ushort *)(this + 0x10) = local_20;
  }
  else if (bVar1) {
    *(ushort *)(*(int *)(this + 4) + (uint)local_1e * 0xc) = local_20;
  }
  else {
    *(ushort *)(*(int *)(this + 4) + (uint)local_1e * 0xc + 2) = local_20;
  }
  InsertRebalance(this,uVar5);
  *(short *)(this + 0x12) = *(short *)(this + 0x12) + 1;
  if (local_24 + *(int *)(this + 4) != -8) {
    *(CBaseEntity **)(local_24 + *(int *)(this + 4) + 8) = *param_1;
  }
  return local_20;
}

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)