L L4D2node

CUtlRBTree<ThinkSync,unsigned_short,bool(*)(ThinkSync_const&,ThinkSync_const&),CUtlMemory<UtlRBTreeNode_t<ThinkSync,unsigned_short>,unsigned_short>>::Insert

0x0047ee00 · 605 bytes · __thiscall

_ZN10CUtlRBTreeI9ThinkSynctPFbRKS0_S2_E10CUtlMemoryI15UtlRBTreeNode_tIS0_tEtEE6InsertES2_

Decompiled

undefined (2 params)

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

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

{
  int iVar1;
  ushort uVar2;
  ushort uVar3;
  bool bVar4;
  char cVar5;
  undefined2 *puVar6;
  int iVar7;
  int iVar8;
  ushort local_26;
  int local_24;
  
  uVar2 = *(ushort *)(this + 0x10);
  if (*(ushort *)(this + 0x10) == 0xffff) {
    local_26 = NewNode(this);
    local_24 = (uint)local_26 * 0x24;
    puVar6 = (undefined2 *)(local_24 + *(int *)(this + 4));
    puVar6[2] = 0xffff;
    puVar6[1] = 0xffff;
    *puVar6 = 0xffff;
    puVar6[3] = 0;
  }
  else {
    do {
      uVar3 = uVar2;
      iVar1 = (uint)uVar3 * 0x24;
      cVar5 = (**(code **)this)(param_1,*(int *)(this + 4) + iVar1 + 8);
      if (cVar5 == '\0') {
        if ((Links(unsigned_short)::s_Sentinel == '\0') &&
           (iVar7 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar7 != 0)) {
          Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f1624c = 0xffff;
          DAT_00f1624e = 0xffff;
          __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        }
        bVar4 = false;
        uVar2 = *(ushort *)(*(int *)(this + 4) + 2 + iVar1);
      }
      else {
        if ((Links(unsigned_short)::s_Sentinel == '\0') &&
           (iVar7 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar7 != 0)) {
          Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f1624c = 0xffff;
          DAT_00f1624e = 0xffff;
          __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        }
        bVar4 = true;
        uVar2 = *(ushort *)(*(int *)(this + 4) + (uint)uVar3 * 0x24);
      }
    } while (uVar2 != 0xffff);
    local_26 = NewNode(this);
    local_24 = (uint)local_26 * 0x24;
    puVar6 = (undefined2 *)(local_24 + *(int *)(this + 4));
    puVar6[2] = uVar3;
    puVar6[1] = 0xffff;
    *puVar6 = 0xffff;
    puVar6[3] = 0;
    if (uVar3 != 0xffff) {
      if (bVar4) {
        *(ushort *)(*(int *)(this + 4) + iVar1) = local_26;
      }
      else {
        *(ushort *)(*(int *)(this + 4) + 2 + iVar1) = local_26;
      }
      goto LAB_0047eeeb;
    }
  }
  *(ushort *)(this + 0x10) = local_26;
LAB_0047eeeb:
  InsertRebalance(this,local_26);
  *(short *)(this + 0x12) = *(short *)(this + 0x12) + 1;
  local_24 = local_24 + *(int *)(this + 4);
  if (local_24 != -8) {
    *(undefined4 *)(local_24 + 0x10) = 0;
    *(undefined4 *)(local_24 + 0x14) = 0;
    *(undefined4 *)(local_24 + 0x18) = 0;
    *(undefined4 *)(local_24 + 0x1c) = 0;
    *(undefined4 *)(local_24 + 0x20) = 0;
    *(undefined4 *)(local_24 + 8) = *(undefined4 *)param_1;
    *(undefined4 *)(local_24 + 0xc) = *(undefined4 *)(param_1 + 4);
    iVar1 = *(int *)(param_1 + 0x14);
    if (0 < iVar1) {
      iVar7 = 0;
      iVar8 = 0;
      while( true ) {
                    /* try { // try from 0047ef6f to 0047ef73 has its CatchHandler @ 0047f081 */
        CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>>::InsertBefore
                  ((CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>> *)
                   (local_24 + 0x10),iVar7,(CHandle *)(*(int *)(param_1 + 8) + iVar8 * 4));
        iVar8 = iVar8 + 1;
        if (iVar8 == iVar1) break;
        iVar7 = *(int *)(local_24 + 0x1c);
      }
    }
  }
  return local_26;
}

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)