L L4D2node

NET_GetLoopPacket

0x001c3a00 · 443 bytes · __cdecl

_Z17NET_GetLoopPacketP11netpacket_s

Decompiled

undefined (1 param)

/* NET_GetLoopPacket(netpacket_s*) */

undefined4 NET_GetLoopPacket(netpacket_s *param_1)

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  undefined4 *puVar4;
  int *piVar5;
  char cVar6;
  undefined4 uVar7;
  undefined4 *puVar8;
  
  iVar1 = *(int *)(param_1 + 0xc);
  uVar7 = 0;
  if (iVar1 < 2) {
    puVar8 = &s_LoopBacks + iVar1 * 8;
    do {
      do {
        while( true ) {
          do {
            do {
              iVar2 = (&DAT_003ac104)[iVar1 * 8];
              puVar3 = (undefined4 *)*puVar8;
              puVar4 = (undefined4 *)*puVar3;
            } while (puVar4 == (undefined4 *)0x0);
          } while (iVar2 != (&DAT_003ac104)[iVar1 * 8]);
          if (puVar3 != (undefined4 *)(&DAT_003ac108)[iVar1 * 8]) break;
          if (puVar8 == puVar4) {
            return 0;
          }
          ThreadInterlockedAssignIf64
                    (&DAT_003ac108 + iVar1 * 8,puVar4,(&DAT_003ac10c)[iVar1 * 8] + 1,puVar3,
                     (&DAT_003ac10c)[iVar1 * 8]);
        }
      } while (puVar8 == puVar4);
      piVar5 = (int *)puVar4[1];
      cVar6 = ThreadInterlockedAssignIf64(puVar8,puVar4,iVar2 + 1,puVar3,iVar2);
    } while (cVar6 == '\0');
    LOCK();
    (&DAT_003ac110)[iVar1 * 8] = (&DAT_003ac110)[iVar1 * 8] + -1;
    UNLOCK();
    puVar3[1] = piVar5;
    do {
      iVar2 = (&DAT_003ac11c)[iVar1 * 8];
      uVar7 = (&DAT_003ac118)[iVar1 * 8];
      *puVar3 = uVar7;
      cVar6 = ThreadInterlockedAssignIf64
                        (&DAT_003ac118 + iVar1 * 8,puVar3,iVar2 + 0x10001,uVar7,iVar2);
    } while (cVar6 == '\0');
    if (piVar5[1] == 0) {
      CUtlMemoryPool::Free((CUtlMemoryPool *)loopback_t::s_Allocator,piVar5);
      uVar7 = NET_LagPacket(false,param_1);
    }
    else {
      netadr_s::SetType((netadr_s *)param_1,1);
      iVar1 = piVar5[1];
      *(int *)(param_1 + 0x40) = iVar1;
      *(int *)(param_1 + 0x44) = piVar5[1];
      _V_memcpy(*(void **)(param_1 + 0x18),(void *)*piVar5,iVar1);
      piVar5[1] = 0;
      if ((void *)*piVar5 != piVar5 + 2) {
        operator_delete((void *)*piVar5);
        *piVar5 = (int)(piVar5 + 2);
      }
      CUtlMemoryPool::Free((CUtlMemoryPool *)loopback_t::s_Allocator,piVar5);
      uVar7 = NET_LagPacket(true,param_1);
    }
  }
  return uVar7;
}

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)