L L4D2node

NextBotManager::Register

0x0075a570 · 464 bytes · __thiscall

_ZN14NextBotManager8RegisterEP8INextBot

Decompiled

undefined (2 params)

/* NextBotManager::Register(INextBot*) */

uint __thiscall NextBotManager::Register(NextBotManager *this,INextBot *param_1)

{
  uint uVar1;
  ushort uVar2;
  uint uVar3;
  int iVar4;
  uint uVar5;
  int iVar6;
  uint uVar7;
  
  uVar2 = *(ushort *)(this + 0x14);
  if (uVar2 == 0xffff) {
    iVar6 = *(int *)(this + 8);
    if ((int)(uint)*(ushort *)(this + 0x1a) < iVar6) {
      uVar1 = *(ushort *)(this + 0x1a) + 1;
      uVar5 = uVar1 & 0xffff;
      if (iVar6 <= (int)uVar5) {
        uVar1 = 0xffff;
        uVar5 = 0xffff;
      }
    }
    else {
      uVar5 = 0;
      if (iVar6 < 1) {
        uVar5 = 0xffff;
      }
      uVar1 = (0 < iVar6) - 1;
    }
    if (iVar6 <= (int)uVar5) {
      CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>::Grow
                ((CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short> *)
                 (this + 4),1);
      *(undefined4 *)(this + 0x1c) = *(undefined4 *)(this + 4);
      iVar6 = *(int *)(this + 8);
      if ((int)(uint)*(ushort *)(this + 0x1a) < iVar6) {
        uVar7 = *(ushort *)(this + 0x1a) + 1;
        uVar3 = uVar7 & 0xffff;
        uVar1 = 0xffff;
        uVar5 = 0xffff;
        if ((int)uVar3 < iVar6) {
          uVar1 = uVar7;
          uVar5 = uVar3;
        }
      }
      else {
        uVar5 = 0;
        if (iVar6 < 1) {
          uVar5 = 0xffff;
        }
        uVar1 = (0 < iVar6) - 1;
      }
      if (iVar6 <= (int)uVar5) {
        if (9 < CUtlLinkedList<INextBot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>>
                ::AllocInternal(bool)::__executeCount) {
          return 0xffff;
        }
        CUtlLinkedList<INextBot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>>
        ::AllocInternal(bool)::__executeCount =
             CUtlLinkedList<INextBot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>>
             ::AllocInternal(bool)::__executeCount + 1;
        Warning("CUtlLinkedList overflow! (exhausted memory allocator)\n");
        return 0xffff;
      }
    }
    uVar2 = (ushort)uVar1;
    if (uVar2 == 0xffff) {
      if (CUtlLinkedList<INextBot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>>
          ::AllocInternal(bool)::__executeCount < 10) {
        CUtlLinkedList<INextBot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>>
        ::AllocInternal(bool)::__executeCount =
             CUtlLinkedList<INextBot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>>
             ::AllocInternal(bool)::__executeCount + 1;
        Warning("CUtlLinkedList overflow! (exhausted index range)\n");
      }
      return 0xffff;
    }
    uVar1 = uVar1 & 0xffff;
    *(ushort *)(this + 0x1a) = uVar2;
    *(short *)(this + 0x18) = *(short *)(this + 0x18) + 1;
    iVar6 = uVar1 * 8;
    iVar4 = *(int *)(this + 4) + iVar6;
  }
  else {
    uVar1 = (uint)uVar2;
    iVar6 = uVar1 * 8;
    iVar4 = *(int *)(this + 4) + iVar6;
    *(undefined2 *)(this + 0x14) = *(undefined2 *)(iVar4 + 6);
  }
  *(ushort *)(iVar4 + 6) = uVar2;
  *(ushort *)(*(int *)(this + 4) + 4 + iVar6) = uVar2;
  if ((((int)uVar1 < *(int *)(this + 8)) && (uVar2 <= *(ushort *)(this + 0x1a))) &&
     (uVar2 != *(ushort *)(*(int *)(this + 4) + 4 + iVar6))) {
    CUtlLinkedList<INextBot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>>
    ::Unlink((CUtlLinkedList<INextBot*,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<INextBot*,unsigned_short>,unsigned_short>>
              *)(this + 4),(ushort)uVar1);
  }
  iVar4 = *(int *)(this + 4) + iVar6;
  *(undefined2 *)(iVar4 + 4) = 0xffff;
  *(undefined2 *)(iVar4 + 6) = *(undefined2 *)(this + 0x10);
  *(ushort *)(this + 0x10) = uVar2;
  if (*(ushort *)(iVar4 + 6) == 0xffff) {
    *(ushort *)(this + 0x12) = uVar2;
  }
  else {
    *(ushort *)(*(int *)(this + 4) + 4 + (uint)*(ushort *)(iVar4 + 6) * 8) = uVar2;
  }
  *(short *)(this + 0x16) = *(short *)(this + 0x16) + 1;
  if ((undefined4 *)(iVar6 + *(int *)(this + 4)) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar6 + *(int *)(this + 4)) = param_1;
  }
  return uVar1;
}

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)