L L4D2node

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

0x00473020 · 243 bytes · __thiscall

_ZN10CUtlVectorI10CUtlString10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_

Decompiled

undefined (3 params)

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

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

{
  void *pvVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  
  iVar4 = *(int *)(this + 4);
  iVar3 = *(int *)(this + 0xc) + 1;
  if (iVar4 < iVar3) {
    iVar2 = *(int *)(this + 8);
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (iVar4 == 0) {
          if (iVar3 < 3) {
            iVar2 = 2;
            goto LAB_004730bf;
          }
          iVar4 = 2;
        }
        do {
          iVar2 = iVar4 * 2;
          if (iVar3 <= iVar2) break;
          iVar2 = iVar4 * 4;
          iVar4 = iVar2;
        } while (iVar2 < iVar3);
      }
      else {
        for (iVar2 = iVar2 * (*(int *)(this + 0xc) / iVar2 + 1); iVar2 < iVar3;
            iVar2 = (iVar2 + iVar3) / 2) {
        }
      }
LAB_004730bf:
      *(int *)(this + 4) = iVar2;
      if (*(void **)this == (void *)0x0) {
        pvVar1 = malloc(iVar2 << 4);
        *(void **)this = pvVar1;
      }
      else {
        pvVar1 = realloc(*(void **)this,iVar2 << 4);
        *(void **)this = pvVar1;
        iVar3 = *(int *)(this + 0xc) + 1;
      }
      goto LAB_0047303e;
    }
  }
  pvVar1 = *(void **)this;
LAB_0047303e:
  *(int *)(this + 0xc) = iVar3;
  iVar3 = (iVar3 - param_1) + -1;
  *(void **)(this + 0x10) = pvVar1;
  iVar4 = param_1 * 0x10;
  if (0 < iVar3) {
    _V_memmove((void *)((int)pvVar1 + iVar4 + 0x10),(void *)((int)pvVar1 + iVar4),iVar3 * 0x10);
    pvVar1 = *(void **)this;
  }
  if ((CUtlString *)((int)pvVar1 + iVar4) != (CUtlString *)0x0) {
    CUtlString::CUtlString((CUtlString *)((int)pvVar1 + iVar4),param_2);
  }
  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)