L L4D2node

CUtlVector<CSocketCreator::AcceptedSocket_t,CUtlMemory<CSocketCreator::AcceptedSocket_t,int>>::InsertBefore

0x0028cb30 · 286 bytes · __thiscall

_ZN10CUtlVectorIN14CSocketCreator16AcceptedSocket_tE10CUtlMemoryIS1_iEE12InsertBeforeEi

Decompiled

undefined (2 params)

/* CUtlVector<CSocketCreator::AcceptedSocket_t, CUtlMemory<CSocketCreator::AcceptedSocket_t, int>
   >::InsertBefore(int) */

int __thiscall
CUtlVector<CSocketCreator::AcceptedSocket_t,CUtlMemory<CSocketCreator::AcceptedSocket_t,int>>::
InsertBefore(CUtlVector<CSocketCreator::AcceptedSocket_t,CUtlMemory<CSocketCreator::AcceptedSocket_t,int>>
             *this,int param_1)

{
  int iVar1;
  void *pvVar2;
  int iVar3;
  int iVar4;
  netadr_s *this_00;
  
  iVar4 = *(int *)(this + 4);
  iVar3 = *(int *)(this + 0xc) + 1;
  if (iVar4 < iVar3) {
    iVar1 = *(int *)(this + 8);
    if (-1 < iVar1) {
      if (iVar1 == 0) {
        if (iVar4 == 0) {
          if (iVar3 < 3) {
            iVar4 = 2;
            goto LAB_0028cbee;
          }
          iVar4 = 2;
        }
        do {
          iVar4 = iVar4 * 2;
        } while (iVar4 < iVar3);
      }
      else {
        for (iVar4 = iVar1 * (*(int *)(this + 0xc) / iVar1 + 1); iVar4 < iVar3;
            iVar4 = (iVar4 + iVar3) / 2) {
        }
      }
LAB_0028cbee:
      *(int *)(this + 4) = iVar4;
      if (*(void **)this == (void *)0x0) {
        pvVar2 = malloc(iVar4 * 0x14);
        *(void **)this = pvVar2;
      }
      else {
        pvVar2 = realloc(*(void **)this,iVar4 * 0x14);
        *(void **)this = pvVar2;
        iVar3 = *(int *)(this + 0xc) + 1;
      }
      goto LAB_0028cb4e;
    }
  }
  pvVar2 = *(void **)this;
LAB_0028cb4e:
  *(int *)(this + 0xc) = iVar3;
  iVar3 = (iVar3 - param_1) + -1;
  *(void **)(this + 0x10) = pvVar2;
  iVar4 = param_1 * 0x14;
  if (0 < iVar3) {
    _V_memmove((void *)((int)pvVar2 + iVar4 + 0x14),(void *)((int)pvVar2 + iVar4),iVar3 * 0x14);
    pvVar2 = *(void **)this;
  }
  if ((void *)(iVar4 + (int)pvVar2) != (void *)0x0) {
    this_00 = (netadr_s *)(iVar4 + (int)pvVar2 + 4);
    netadr_s::SetIP(this_00,0);
    netadr_s::SetPort(this_00,0);
    netadr_s::SetType(this_00,3);
  }
  return param_1;
}

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)