L L4D2node

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

0x008fae50 · 245 bytes · __thiscall

_ZN10CUtlVectorI19SurvivorBotSaveData10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_

Decompiled

undefined (3 params)

/* CUtlVector<SurvivorBotSaveData, CUtlMemory<SurvivorBotSaveData, int> >::InsertBefore(int,
   SurvivorBotSaveData const&) */

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

{
  undefined4 uVar1;
  void *pvVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  iVar4 = *(int *)(this + 4);
  iVar5 = *(int *)(this + 0xc) + 1;
  if (iVar4 < iVar5) {
    iVar3 = *(int *)(this + 8);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar4 == 0) {
          if (iVar5 < 9) {
            iVar3 = 8;
            goto LAB_008faeef;
          }
          iVar4 = 8;
        }
        do {
          iVar3 = iVar4 * 2;
          if (iVar5 <= iVar3) break;
          iVar3 = iVar4 * 4;
          iVar4 = iVar3;
        } while (iVar3 < iVar5);
      }
      else {
        for (iVar3 = iVar3 * (*(int *)(this + 0xc) / iVar3 + 1); iVar3 < iVar5;
            iVar3 = (iVar3 + iVar5) / 2) {
        }
      }
LAB_008faeef:
      *(int *)(this + 4) = iVar3;
      if (*(void **)this == (void *)0x0) {
        pvVar2 = malloc(iVar3 << 2);
        *(void **)this = pvVar2;
      }
      else {
        pvVar2 = realloc(*(void **)this,iVar3 << 2);
        *(void **)this = pvVar2;
        iVar5 = *(int *)(this + 0xc) + 1;
      }
      goto LAB_008fae6e;
    }
  }
  pvVar2 = *(void **)this;
LAB_008fae6e:
  *(int *)(this + 0xc) = iVar5;
  iVar5 = (iVar5 - param_1) + -1;
  *(void **)(this + 0x10) = pvVar2;
  iVar4 = param_1 * 4;
  if (0 < iVar5) {
    _V_memmove((void *)((int)pvVar2 + iVar4 + 4),(void *)((int)pvVar2 + iVar4),iVar5 * 4);
    pvVar2 = *(void **)this;
  }
  if ((undefined4 *)(iVar4 + (int)pvVar2) != (undefined4 *)0x0) {
    uVar1 = KeyValues::MakeCopy(*(KeyValues **)param_2);
    *(undefined4 *)(iVar4 + (int)pvVar2) = uVar1;
  }
  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)