L L4D2node

CBSPTreeData::NewHandle

0x000bc210 · 464 bytes · __thiscall

_ZN12CBSPTreeData9NewHandleEi

Decompiled

undefined (2 params)

/* CBSPTreeData::NewHandle(int) */

uint __thiscall CBSPTreeData::NewHandle(CBSPTreeData *this,int param_1)

{
  ushort uVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  undefined2 uVar6;
  uint uVar7;
  int iVar8;
  uint uVar9;
  
  uVar1 = *(ushort *)(this + 0x2c);
  uVar7 = (uint)uVar1;
  uVar3 = uVar7;
  if (uVar1 == 0xffff) {
    iVar2 = *(int *)(this + 0x20);
    if ((int)(uint)*(ushort *)(this + 0x32) < iVar2) {
      uVar5 = *(ushort *)(this + 0x32) + 1;
      uVar4 = 0xffff;
      uVar9 = uVar5 & 0xffff;
      if ((int)uVar9 < iVar2) {
        uVar4 = uVar9;
        uVar3 = uVar5;
      }
    }
    else {
      uVar4 = 0;
      if (iVar2 < 1) {
        uVar4 = 0xffff;
      }
      uVar3 = (0 < iVar2) - 1;
    }
    if ((int)uVar4 < iVar2) {
LAB_000bc335:
      if ((short)uVar3 != -1) {
        uVar7 = uVar3 & 0xffff;
        *(short *)(this + 0x32) = (short)uVar3;
        *(short *)(this + 0x30) = *(short *)(this + 0x30) + 1;
        iVar8 = uVar7 * 0xc;
        iVar2 = *(int *)(this + 0x1c) + iVar8;
        goto LAB_000bc246;
      }
      if (CUtlLinkedList<CBSPTreeData::HandleInfo_t,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>>
          ::AllocInternal(bool)::__executeCount < 10) {
        CUtlLinkedList<CBSPTreeData::HandleInfo_t,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>>
        ::AllocInternal(bool)::__executeCount =
             CUtlLinkedList<CBSPTreeData::HandleInfo_t,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>>
             ::AllocInternal(bool)::__executeCount + 1;
        Warning("CUtlLinkedList overflow! (exhausted index range)\n");
      }
      iVar2 = *(int *)(this + 0x1c);
    }
    else {
      CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>::
      Grow((CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>
            *)(this + 0x1c),1);
      iVar8 = *(int *)(this + 0x20);
      iVar2 = *(int *)(this + 0x1c);
      *(int *)(this + 0x34) = iVar2;
      if ((int)(uint)*(ushort *)(this + 0x32) < iVar8) {
        uVar1 = *(ushort *)(this + 0x32) + 1;
        uVar5 = (uint)uVar1;
        uVar4 = 0xffff;
        if ((int)uVar5 < iVar8) {
          uVar4 = uVar5;
        }
        uVar3 = (uint)uVar1;
        if (iVar8 <= (int)uVar5) {
          uVar3 = uVar7;
        }
      }
      else {
        uVar4 = 0;
        if (iVar8 < 1) {
          uVar4 = 0xffff;
        }
        uVar3 = (0 < iVar8) - 1;
      }
      if ((int)uVar4 < iVar8) goto LAB_000bc335;
      if (CUtlLinkedList<CBSPTreeData::HandleInfo_t,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>>
          ::AllocInternal(bool)::__executeCount < 10) {
        CUtlLinkedList<CBSPTreeData::HandleInfo_t,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>>
        ::AllocInternal(bool)::__executeCount =
             CUtlLinkedList<CBSPTreeData::HandleInfo_t,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>>
             ::AllocInternal(bool)::__executeCount + 1;
        Warning("CUtlLinkedList overflow! (exhausted memory allocator)\n");
        iVar2 = *(int *)(this + 0x1c);
      }
    }
    iVar8 = 0xbfff4;
    uVar3 = 0xffffffff;
  }
  else {
    uVar7 = (uint)uVar1;
    iVar8 = uVar7 * 0xc;
    iVar2 = *(int *)(this + 0x1c) + iVar8;
    *(undefined2 *)(this + 0x2c) = *(undefined2 *)(iVar2 + 10);
LAB_000bc246:
    uVar6 = (undefined2)uVar3;
    *(undefined2 *)(iVar2 + 10) = uVar6;
    *(undefined2 *)(*(int *)(this + 0x1c) + 8 + iVar8) = uVar6;
    CUtlLinkedList<CBSPTreeData::HandleInfo_t,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>>
    ::Unlink((CUtlLinkedList<CBSPTreeData::HandleInfo_t,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CBSPTreeData::HandleInfo_t,unsigned_short>,unsigned_short>>
              *)(this + 0x1c),(ushort)uVar7);
    iVar2 = *(int *)(this + 0x1c);
    *(undefined2 *)(iVar2 + iVar8 + 10) = 0xffff;
    uVar1 = *(ushort *)(this + 0x2a);
    *(ushort *)(iVar2 + iVar8 + 8) = uVar1;
    *(undefined2 *)(this + 0x2a) = uVar6;
    if (uVar1 == 0xffff) {
      *(undefined2 *)(this + 0x28) = uVar6;
    }
    else {
      *(undefined2 *)(*(int *)(this + 0x1c) + (uint)uVar1 * 0xc + 10) = uVar6;
    }
    *(short *)(this + 0x2e) = *(short *)(this + 0x2e) + 1;
    iVar2 = *(int *)(this + 0x1c);
  }
  *(int *)(iVar2 + iVar8) = param_1;
  *(undefined2 *)(*(int *)(this + 0x1c) + 4 + iVar8) = 0xffff;
  return uVar3;
}

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)