L L4D2node

CServerRemoteAccess::GetNextListenerID

0x0020ea70 · 706 bytes · __thiscall

_ZN19CServerRemoteAccess17GetNextListenerIDEbPK8netadr_s

Decompiled

undefined (3 params)

/* CServerRemoteAccess::GetNextListenerID(bool, netadr_s const*) */

void __thiscall
CServerRemoteAccess::GetNextListenerID(CServerRemoteAccess *this,bool param_1,netadr_s *param_2)

{
  int iVar1;
  void *pvVar2;
  int iVar3;
  int *piVar4;
  int iVar5;
  netadr_s *this_00;
  int iVar6;
  
  iVar6 = *(int *)(this + 0x40);
  if (iVar6 == -1) {
    iVar5 = *(int *)(this + 0x4c);
    iVar3 = *(int *)(this + 0x30);
    if ((iVar5 < 0) || (iVar3 <= iVar5)) {
      iVar6 = 0;
      if (iVar3 < 1) goto LAB_0020ebf8;
      goto LAB_0020ebd6;
    }
    iVar6 = iVar5 + 1;
    if ((-1 < iVar6) && (iVar6 < iVar3)) {
      if (iVar6 != -1) goto LAB_0020ebd6;
      if (CUtlLinkedList<CServerRemoteAccess::ListenerStore_t,int,false,int,CUtlMemory<UtlLinkedListElem_t<CServerRemoteAccess::ListenerStore_t,int>,int>>
          ::AllocInternal(bool)::__executeCount < 10) {
        CUtlLinkedList<CServerRemoteAccess::ListenerStore_t,int,false,int,CUtlMemory<UtlLinkedListElem_t<CServerRemoteAccess::ListenerStore_t,int>,int>>
        ::AllocInternal(bool)::__executeCount =
             CUtlLinkedList<CServerRemoteAccess::ListenerStore_t,int,false,int,CUtlMemory<UtlLinkedListElem_t<CServerRemoteAccess::ListenerStore_t,int>,int>>
             ::AllocInternal(bool)::__executeCount + 1;
        Warning("CUtlLinkedList overflow! (exhausted index range)\n");
      }
      pvVar2 = *(void **)(this + 0x2c);
LAB_0020ebbd:
      piVar4 = (int *)((int)pvVar2 + -0x1c);
      iVar5 = -0x1c;
      iVar6 = -1;
      goto LAB_0020eb3b;
    }
LAB_0020ebf8:
    iVar6 = *(int *)(this + 0x34);
    if (iVar6 < 0) {
      pvVar2 = *(void **)(this + 0x2c);
    }
    else {
      iVar1 = iVar3 + 1;
      if (iVar6 == 0) {
        iVar6 = 2;
        if (iVar3 != 0) {
          iVar6 = iVar3;
        }
        while (iVar3 = iVar6, iVar3 < iVar1) {
          iVar6 = iVar3 * 2;
        }
      }
      else {
        for (iVar3 = iVar6 * (iVar3 / iVar6 + 1); iVar3 < iVar1; iVar3 = (iVar3 + iVar1) / 2) {
        }
      }
      *(int *)(this + 0x30) = iVar3;
      if (*(void **)(this + 0x2c) == (void *)0x0) {
        pvVar2 = malloc(iVar3 * 0x1c);
        *(void **)(this + 0x2c) = pvVar2;
      }
      else {
        pvVar2 = realloc(*(void **)(this + 0x2c),iVar3 * 0x1c);
        iVar5 = *(int *)(this + 0x4c);
        iVar3 = *(int *)(this + 0x30);
        *(void **)(this + 0x2c) = pvVar2;
      }
    }
    *(void **)(this + 0x50) = pvVar2;
    if ((iVar5 < 0) || (iVar3 <= iVar5)) {
      iVar6 = 0;
      if (iVar3 < 1) goto LAB_0020ec80;
    }
    else {
      iVar6 = iVar5 + 1;
      if (iVar3 <= iVar6) {
LAB_0020ec80:
        if (CUtlLinkedList<CServerRemoteAccess::ListenerStore_t,int,false,int,CUtlMemory<UtlLinkedListElem_t<CServerRemoteAccess::ListenerStore_t,int>,int>>
            ::AllocInternal(bool)::__executeCount < 10) {
          CUtlLinkedList<CServerRemoteAccess::ListenerStore_t,int,false,int,CUtlMemory<UtlLinkedListElem_t<CServerRemoteAccess::ListenerStore_t,int>,int>>
          ::AllocInternal(bool)::__executeCount =
               CUtlLinkedList<CServerRemoteAccess::ListenerStore_t,int,false,int,CUtlMemory<UtlLinkedListElem_t<CServerRemoteAccess::ListenerStore_t,int>,int>>
               ::AllocInternal(bool)::__executeCount + 1;
          Warning("CUtlLinkedList overflow! (exhausted memory allocator)\n");
          pvVar2 = *(void **)(this + 0x2c);
        }
        goto LAB_0020ebbd;
      }
    }
LAB_0020ebd6:
    *(int *)(this + 0x4c) = iVar6;
    *(int *)(this + 0x48) = *(int *)(this + 0x48) + 1;
    iVar5 = iVar6 * 0x1c;
    iVar3 = *(int *)(this + 0x2c) + iVar5;
  }
  else {
    iVar5 = iVar6 * 0x1c;
    iVar3 = *(int *)(this + 0x2c) + iVar5;
    *(undefined4 *)(this + 0x40) = *(undefined4 *)(iVar3 + 0x18);
  }
  *(int *)(iVar3 + 0x18) = iVar6;
  *(int *)(*(int *)(this + 0x2c) + 0x14 + iVar5) = iVar6;
  CUtlLinkedList<CServerRemoteAccess::ListenerStore_t,int,false,int,CUtlMemory<UtlLinkedListElem_t<CServerRemoteAccess::ListenerStore_t,int>,int>>
  ::Unlink((CUtlLinkedList<CServerRemoteAccess::ListenerStore_t,int,false,int,CUtlMemory<UtlLinkedListElem_t<CServerRemoteAccess::ListenerStore_t,int>,int>>
            *)(this + 0x2c),iVar6);
  iVar3 = *(int *)(this + 0x2c);
  *(undefined4 *)(iVar3 + iVar5 + 0x18) = 0xffffffff;
  iVar1 = *(int *)(this + 0x3c);
  *(int *)(iVar3 + iVar5 + 0x14) = iVar1;
  *(int *)(this + 0x3c) = iVar6;
  if (iVar1 == -1) {
    *(int *)(this + 0x44) = *(int *)(this + 0x44) + 1;
    *(int *)(this + 0x38) = iVar6;
    iVar3 = *(int *)(this + 0x2c);
  }
  else {
    *(int *)(iVar1 * 0x1c + *(int *)(this + 0x2c) + 0x18) = iVar6;
    *(int *)(this + 0x44) = *(int *)(this + 0x44) + 1;
    iVar3 = *(int *)(this + 0x2c);
  }
  piVar4 = (int *)0x0;
  if (iVar5 + iVar3 != 0) {
    this_00 = (netadr_s *)(iVar5 + iVar3 + 8);
    netadr_s::SetIP(this_00,0);
    netadr_s::SetPort(this_00,0);
    netadr_s::SetType(this_00,3);
    piVar4 = (int *)(*(int *)(this + 0x2c) + iVar5);
  }
LAB_0020eb3b:
  *piVar4 = iVar6;
  *(bool *)(*(int *)(this + 0x2c) + 4 + iVar5) = !param_1;
  *(bool *)(*(int *)(this + 0x2c) + 5 + iVar5) = param_2 != (netadr_s *)0x0;
  if (param_2 != (netadr_s *)0x0) {
    iVar6 = *(int *)(this + 0x2c);
    *(undefined4 *)(iVar6 + 8 + iVar5) = *(undefined4 *)param_2;
    *(undefined4 *)(iVar6 + 0xc + iVar5) = *(undefined4 *)(param_2 + 4);
    *(undefined2 *)(iVar6 + 0x10 + iVar5) = *(undefined2 *)(param_2 + 8);
  }
  return;
}

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)