L L4D2node

CUtlVector<CStaticProp,CUtlMemory<CStaticProp,int>>::InsertBefore

0x001e8470 · 366 bytes · __thiscall

_ZN10CUtlVectorI11CStaticProp10CUtlMemoryIS0_iEE12InsertBeforeEi

Decompiled

undefined (2 params)

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

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

{
  undefined4 *puVar1;
  void *pvVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  iVar5 = *(int *)(this + 4);
  iVar4 = *(int *)(this + 0xc) + 1;
  if (iVar5 < iVar4) {
    iVar3 = *(int *)(this + 8);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar5 == 0) {
          if (iVar4 < 2) {
            iVar3 = 1;
            goto LAB_001e8587;
          }
          iVar5 = 1;
        }
        do {
          iVar3 = iVar5 * 2;
          if (iVar4 <= iVar3) break;
          iVar3 = iVar5 * 4;
          iVar5 = iVar3;
        } while (iVar3 < iVar4);
      }
      else {
        for (iVar3 = iVar3 * (*(int *)(this + 0xc) / iVar3 + 1); iVar3 < iVar4;
            iVar3 = (iVar3 + iVar4) / 2) {
        }
      }
LAB_001e8587:
      *(int *)(this + 4) = iVar3;
      if (*(void **)this == (void *)0x0) {
        pvVar2 = malloc(iVar3 * 0xd8);
        *(void **)this = pvVar2;
      }
      else {
        pvVar2 = realloc(*(void **)this,iVar3 * 0xd8);
        *(void **)this = pvVar2;
        iVar4 = *(int *)(this + 0xc) + 1;
      }
      goto LAB_001e8492;
    }
  }
  pvVar2 = *(void **)this;
LAB_001e8492:
  *(int *)(this + 0xc) = iVar4;
  iVar4 = (iVar4 - param_1) + -1;
  iVar5 = param_1 * 0xd8;
  *(void **)(this + 0x10) = pvVar2;
  if (0 < iVar4) {
    _V_memmove((void *)((int)pvVar2 + iVar5 + 0xd8),(void *)((int)pvVar2 + iVar5),iVar4 * 0xd8);
    pvVar2 = *(void **)this;
  }
  puVar1 = (undefined4 *)((int)pvVar2 + iVar5);
  if (puVar1 != (undefined4 *)0x0) {
    *puVar1 = &PTR__CStaticProp_002bf208;
    puVar1[1] = &PTR_GetIClientUnknown_002bf340;
    puVar1[2] = &PTR_GetEntityHandle_002bf3f8;
    puVar1[3] = &DAT_002bf44c;
    puVar1[10] = 0;
    puVar1[0xc] = 0;
    puVar1[0xd] = 0;
    *(undefined1 *)(puVar1 + 0xe) = 0xff;
    puVar1[0x12] = 0xffffffff;
    *(undefined2 *)((int)puVar1 + 0x4e) = 0xffff;
    *(undefined2 *)(puVar1 + 0xb) = 0xffff;
    *(undefined2 *)(puVar1 + 0x13) = 0xffff;
    puVar1[0x14] = 0;
    puVar1[0x35] = CStaticProp::s_nDebugIndexCounter;
    CStaticProp::s_nDebugIndexCounter = CStaticProp::s_nDebugIndexCounter + 1;
    *(undefined2 *)((int)puVar1 + 0x2e) = 0xffff;
  }
  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)