L L4D2node

CUtlRBTree<unsigned_int,unsigned_short,bool(*)(unsigned_int_const&,unsigned_int_const&),CUtlMemory<UtlRBTreeNode_t<unsigned_int,unsigned_short>,unsigned_short>>::InsertRebalance

0x004b8330 · 2918 bytes · __thiscall

_ZN10CUtlRBTreeIjtPFbRKjS1_E10CUtlMemoryI15UtlRBTreeNode_tIjtEtEE15InsertRebalanceEt

Decompiled

undefined (2 params)

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

void __thiscall
CUtlRBTree<unsigned_int,unsigned_short,bool(*)(unsigned_int_const&,unsigned_int_const&),CUtlMemory<UtlRBTreeNode_t<unsigned_int,unsigned_short>,unsigned_short>>
::InsertRebalance(CUtlRBTree<unsigned_int,unsigned_short,bool(*)(unsigned_int_const&,unsigned_int_const&),CUtlMemory<UtlRBTreeNode_t<unsigned_int,unsigned_short>,unsigned_short>>
                  *this,ushort param_1)

{
  ushort uVar1;
  int iVar2;
  undefined2 *puVar3;
  ushort uVar4;
  ushort *puVar5;
  undefined2 *puVar6;
  uint uVar7;
  ushort local_20;
  ushort local_1e;
  
  local_1e = param_1;
  do {
    uVar1 = *(ushort *)(this + 0x10);
    if (local_1e == uVar1) {
LAB_004b83a5:
      *(undefined2 *)(*(int *)(this + 4) + (uint)uVar1 * 0xc + 6) = 1;
      return;
    }
    if (Links(unsigned_short)::s_Sentinel == '\0') {
      iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
      if (iVar2 != 0) {
        Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_00f19312 = 0xffff;
        DAT_00f19314 = 0xffff;
        __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
      }
      if (local_1e != 0xffff) goto LAB_004b836f;
LAB_004b86f1:
      puVar3 = &Links(unsigned_short)::s_Sentinel;
    }
    else {
      if (local_1e == 0xffff) goto LAB_004b86f1;
LAB_004b836f:
      puVar3 = (undefined2 *)(*(int *)(this + 4) + (uint)local_1e * 0xc);
    }
    uVar1 = puVar3[2];
    if ((Links(unsigned_short)::s_Sentinel == '\0') &&
       (iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar2 != 0)) {
      DAT_00f19312 = 0xffff;
      Links(unsigned_short)::s_Sentinel = 0xffff;
      DAT_00f19314 = 0xffff;
      __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
      if (uVar1 != 0xffff) goto LAB_004b8391;
LAB_004b86b8:
      puVar3 = &Links(unsigned_short)::s_Sentinel;
    }
    else {
      if (uVar1 == 0xffff) goto LAB_004b86b8;
LAB_004b8391:
      puVar3 = (undefined2 *)(*(int *)(this + 4) + (uint)uVar1 * 0xc);
    }
    if (puVar3[3] != 0) {
      uVar1 = *(ushort *)(this + 0x10);
      goto LAB_004b83a5;
    }
    if (Links(unsigned_short)::s_Sentinel == '\0') {
      iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
      if (iVar2 != 0) {
        Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_00f19312 = 0xffff;
        DAT_00f19314 = 0xffff;
        __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
      }
      if (local_1e != 0xffff) goto LAB_004b83dd;
LAB_004b8659:
      puVar3 = &Links(unsigned_short)::s_Sentinel;
    }
    else {
      if (local_1e == 0xffff) goto LAB_004b8659;
LAB_004b83dd:
      puVar3 = (undefined2 *)(*(int *)(this + 4) + (uint)local_1e * 0xc);
    }
    uVar1 = puVar3[2];
    uVar7 = (uint)uVar1;
    if (Links(unsigned_short)::s_Sentinel == '\0') {
      iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
      if (iVar2 != 0) {
        Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_00f19312 = 0xffff;
        DAT_00f19314 = 0xffff;
        __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
      }
      if (uVar1 != 0xffff) goto LAB_004b8402;
LAB_004b85e5:
      local_20 = DAT_00f19314;
      if (Links(unsigned_short)::s_Sentinel != '\0') goto LAB_004b841b;
LAB_004b8600:
      iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
      if (iVar2 != 0) {
        Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_00f19312 = 0xffff;
        DAT_00f19314 = 0xffff;
        __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
      }
      if (uVar1 != 0xffff) goto LAB_004b8425;
LAB_004b8625:
      puVar3 = &Links(unsigned_short)::s_Sentinel;
    }
    else {
      if (uVar1 == 0xffff) goto LAB_004b85e5;
LAB_004b8402:
      local_20 = *(ushort *)(*(int *)(this + 4) + uVar7 * 0xc + 4);
      if (Links(unsigned_short)::s_Sentinel == '\0') goto LAB_004b8600;
LAB_004b841b:
      if (uVar1 == 0xffff) goto LAB_004b8625;
LAB_004b8425:
      puVar3 = (undefined2 *)(*(int *)(this + 4) + uVar7 * 0xc);
    }
    uVar4 = puVar3[2];
    if (Links(unsigned_short)::s_Sentinel == '\0') {
      iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
      if (iVar2 != 0) {
        Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_00f19314 = 0xffff;
        DAT_00f19312 = 0xffff;
        __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        goto LAB_004b843a;
      }
      if (uVar4 != 0xffff) goto LAB_004b8444;
LAB_004b85b3:
      puVar5 = &Links(unsigned_short)::s_Sentinel;
    }
    else {
LAB_004b843a:
      if (uVar4 == 0xffff) goto LAB_004b85b3;
LAB_004b8444:
      puVar5 = (ushort *)(*(int *)(this + 4) + (uint)uVar4 * 0xc);
    }
    if (uVar1 == *puVar5) {
      if (Links(unsigned_short)::s_Sentinel == '\0') {
        iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
        if (iVar2 != 0) {
          Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f19312 = 0xffff;
          DAT_00f19314 = 0xffff;
          __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        }
        if (local_20 != 0xffff) goto LAB_004b846f;
LAB_004b88b9:
        puVar3 = &Links(unsigned_short)::s_Sentinel;
      }
      else {
        if (local_20 == 0xffff) goto LAB_004b88b9;
LAB_004b846f:
        puVar3 = (undefined2 *)(*(int *)(this + 4) + (uint)local_20 * 0xc);
      }
      uVar4 = puVar3[1];
      if ((Links(unsigned_short)::s_Sentinel == '\0') &&
         (iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar2 != 0)) {
        Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_00f19312 = 0xffff;
        DAT_00f19314 = 0xffff;
        __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        if (uVar4 != 0xffff) goto LAB_004b8491;
LAB_004b87e8:
        if (DAT_00f19316 == 0) goto LAB_004b84a8;
LAB_004b8800:
        if (Links(unsigned_short)::s_Sentinel == '\0') {
          iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
          if (iVar2 != 0) {
            Links(unsigned_short)::s_Sentinel = 0xffff;
            DAT_00f19312 = 0xffff;
            DAT_00f19314 = 0xffff;
            __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
          }
          if (local_1e != 0xffff) goto LAB_004b881d;
LAB_004b8b99:
          puVar3 = &Links(unsigned_short)::s_Sentinel;
        }
        else {
          if (local_1e == 0xffff) goto LAB_004b8b99;
LAB_004b881d:
          puVar3 = (undefined2 *)(*(int *)(this + 4) + (uint)local_1e * 0xc);
        }
        uVar4 = puVar3[2];
        if ((Links(unsigned_short)::s_Sentinel == '\0') &&
           (iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar2 != 0)) {
          Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f19312 = 0xffff;
          DAT_00f19314 = 0xffff;
          __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
          if (uVar4 != 0xffff) goto LAB_004b883f;
LAB_004b8af0:
          if (local_1e != DAT_00f19312) goto LAB_004b8859;
LAB_004b8b08:
          RotateLeft(this,uVar1);
          if ((Links(unsigned_short)::s_Sentinel == '\0') &&
             (iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar2 != 0)) {
            Links(unsigned_short)::s_Sentinel = 0xffff;
            DAT_00f19312 = 0xffff;
            DAT_00f19314 = 0xffff;
            __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
          }
          if (uVar1 == 0xffff) {
            puVar3 = &Links(unsigned_short)::s_Sentinel;
          }
          else {
            puVar3 = (undefined2 *)(*(int *)(this + 4) + uVar7 * 0xc);
          }
          uVar4 = puVar3[2];
          if ((Links(unsigned_short)::s_Sentinel == '\0') &&
             (iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar2 != 0)) {
            Links(unsigned_short)::s_Sentinel = 0xffff;
            DAT_00f19312 = 0xffff;
            DAT_00f19314 = 0xffff;
            __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
          }
          if (uVar4 == 0xffff) {
            puVar6 = &Links(unsigned_short)::s_Sentinel;
            puVar3 = (undefined2 *)(*(int *)(this + 4) + 0xbfff4);
          }
          else {
            puVar3 = (undefined2 *)(*(int *)(this + 4) + (uint)uVar4 * 0xc);
            puVar6 = puVar3;
          }
          local_20 = puVar6[2];
          local_1e = uVar1;
        }
        else {
          if (uVar4 == 0xffff) goto LAB_004b8af0;
LAB_004b883f:
          if (local_1e == *(ushort *)(*(int *)(this + 4) + (uint)uVar4 * 0xc + 2))
          goto LAB_004b8b08;
LAB_004b8859:
          puVar3 = (undefined2 *)(*(int *)(this + 4) + uVar7 * 0xc);
        }
        puVar3[3] = 1;
        *(undefined2 *)(*(int *)(this + 4) + (uint)local_20 * 0xc + 6) = 0;
        RotateRight(this,local_20);
      }
      else {
        if (uVar4 == 0xffff) goto LAB_004b87e8;
LAB_004b8491:
        if (*(short *)(*(int *)(this + 4) + (uint)uVar4 * 0xc + 6) != 0) goto LAB_004b8800;
LAB_004b84a8:
        *(undefined2 *)(*(int *)(this + 4) + uVar7 * 0xc + 6) = 1;
        local_1e = local_20;
        *(undefined2 *)(*(int *)(this + 4) + (uint)uVar4 * 0xc + 6) = 1;
        *(undefined2 *)(*(int *)(this + 4) + (uint)local_20 * 0xc + 6) = 0;
      }
    }
    else {
      if (Links(unsigned_short)::s_Sentinel == '\0') {
        iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
        if (iVar2 != 0) {
          Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f19312 = 0xffff;
          DAT_00f19314 = 0xffff;
          __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        }
        if (local_20 != 0xffff) goto LAB_004b8506;
LAB_004b8959:
        puVar5 = &Links(unsigned_short)::s_Sentinel;
      }
      else {
        if (local_20 == 0xffff) goto LAB_004b8959;
LAB_004b8506:
        puVar5 = (ushort *)(*(int *)(this + 4) + (uint)local_20 * 0xc);
      }
      uVar4 = *puVar5;
      if ((Links(unsigned_short)::s_Sentinel == '\0') &&
         (iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar2 != 0)) {
        Links(unsigned_short)::s_Sentinel = 0xffff;
        DAT_00f19312 = 0xffff;
        DAT_00f19314 = 0xffff;
        __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
        if (uVar4 != 0xffff) goto LAB_004b8527;
LAB_004b8920:
        puVar3 = &Links(unsigned_short)::s_Sentinel;
      }
      else {
        if (uVar4 == 0xffff) goto LAB_004b8920;
LAB_004b8527:
        puVar3 = (undefined2 *)(*(int *)(this + 4) + (uint)uVar4 * 0xc);
      }
      if (puVar3[3] == 0) {
        *(undefined2 *)(*(int *)(this + 4) + uVar7 * 0xc + 6) = 1;
        *(undefined2 *)(*(int *)(this + 4) + (uint)uVar4 * 0xc + 6) = 1;
        local_1e = local_20;
        *(undefined2 *)(*(int *)(this + 4) + (uint)local_20 * 0xc + 6) = 0;
      }
      else {
        if (Links(unsigned_short)::s_Sentinel == '\0') {
          iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
          if (iVar2 != 0) {
            Links(unsigned_short)::s_Sentinel = 0xffff;
            DAT_00f19312 = 0xffff;
            DAT_00f19314 = 0xffff;
            __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
          }
          if (local_1e != 0xffff) goto LAB_004b871d;
LAB_004b8c09:
          uVar4 = DAT_00f19314;
          if (Links(unsigned_short)::s_Sentinel != '\0') goto LAB_004b8735;
LAB_004b8c20:
          iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel);
          if (iVar2 == 0) goto LAB_004b8735;
          Links(unsigned_short)::s_Sentinel = 0xffff;
          DAT_00f19312 = 0xffff;
          DAT_00f19314 = 0xffff;
          __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
          if (uVar4 != 0xffff) goto LAB_004b873f;
LAB_004b8c80:
          if (local_1e != Links(unsigned_short)::s_Sentinel) goto LAB_004b8758;
LAB_004b8c98:
          RotateRight(this,uVar1);
          if ((Links(unsigned_short)::s_Sentinel == '\0') &&
             (iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar2 != 0)) {
            Links(unsigned_short)::s_Sentinel = 0xffff;
            DAT_00f19312 = 0xffff;
            DAT_00f19314 = 0xffff;
            __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
          }
          if (uVar1 == 0xffff) {
            puVar3 = &Links(unsigned_short)::s_Sentinel;
          }
          else {
            puVar3 = (undefined2 *)(*(int *)(this + 4) + uVar7 * 0xc);
          }
          uVar4 = puVar3[2];
          if ((Links(unsigned_short)::s_Sentinel == '\0') &&
             (iVar2 = __cxa_guard_acquire(&Links(unsigned_short)::s_Sentinel), iVar2 != 0)) {
            Links(unsigned_short)::s_Sentinel = 0xffff;
            DAT_00f19312 = 0xffff;
            DAT_00f19314 = 0xffff;
            __cxa_guard_release(&Links(unsigned_short)::s_Sentinel);
          }
          if (uVar4 == 0xffff) {
            puVar6 = &Links(unsigned_short)::s_Sentinel;
            puVar3 = (undefined2 *)(*(int *)(this + 4) + 0xbfff4);
          }
          else {
            puVar3 = (undefined2 *)(*(int *)(this + 4) + (uint)uVar4 * 0xc);
            puVar6 = puVar3;
          }
          local_20 = puVar6[2];
          local_1e = uVar1;
        }
        else {
          if (local_1e == 0xffff) goto LAB_004b8c09;
LAB_004b871d:
          uVar4 = *(ushort *)(*(int *)(this + 4) + (uint)local_1e * 0xc + 4);
          if (Links(unsigned_short)::s_Sentinel == '\0') goto LAB_004b8c20;
LAB_004b8735:
          if (uVar4 == 0xffff) goto LAB_004b8c80;
LAB_004b873f:
          if (local_1e == *(ushort *)(*(int *)(this + 4) + (uint)uVar4 * 0xc)) goto LAB_004b8c98;
LAB_004b8758:
          puVar3 = (undefined2 *)(*(int *)(this + 4) + uVar7 * 0xc);
        }
        puVar3[3] = 1;
        *(undefined2 *)(*(int *)(this + 4) + (uint)local_20 * 0xc + 6) = 0;
        RotateLeft(this,local_20);
      }
    }
  } while( true );
}

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)