L L4D2node

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

0x00470670 · 253 bytes · __thiscall

_ZN10CUtlVectorI22VoiceCommandMenuItem_t10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_

Decompiled

undefined (3 params)

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

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

{
  void *pvVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  undefined4 *puVar5;
  byte bVar6;
  
  bVar6 = 0;
  iVar4 = *(int *)(this + 4);
  iVar2 = *(int *)(this + 0xc) + 1;
  if (iVar4 < iVar2) {
    iVar3 = *(int *)(this + 8);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar4 == 0) {
          if (iVar2 < 2) {
            iVar3 = 1;
            goto LAB_0047070f;
          }
          iVar4 = 1;
        }
        do {
          iVar3 = iVar4 * 2;
          if (iVar2 <= iVar3) break;
          iVar3 = iVar4 * 4;
          iVar4 = iVar3;
        } while (iVar3 < iVar2);
      }
      else {
        for (iVar3 = iVar3 * (*(int *)(this + 0xc) / iVar3 + 1); iVar3 < iVar2;
            iVar3 = (iVar3 + iVar2) / 2) {
        }
      }
LAB_0047070f:
      *(int *)(this + 4) = iVar3;
      if (*(void **)this == (void *)0x0) {
        pvVar1 = malloc(iVar3 * 0x48);
        *(void **)this = pvVar1;
      }
      else {
        pvVar1 = realloc(*(void **)this,iVar3 * 0x48);
        *(void **)this = pvVar1;
        iVar2 = *(int *)(this + 0xc) + 1;
      }
      goto LAB_0047068e;
    }
  }
  pvVar1 = *(void **)this;
LAB_0047068e:
  *(int *)(this + 0xc) = iVar2;
  iVar2 = (iVar2 - param_1) + -1;
  *(void **)(this + 0x10) = pvVar1;
  iVar4 = param_1 * 0x48;
  if (0 < iVar2) {
    _V_memmove((void *)((int)pvVar1 + iVar4 + 0x48),(void *)((int)pvVar1 + iVar4),iVar2 * 0x48);
    pvVar1 = *(void **)this;
  }
  if ((undefined4 *)((int)pvVar1 + iVar4) != (undefined4 *)0x0) {
    puVar5 = (undefined4 *)((int)pvVar1 + iVar4);
    for (iVar2 = 0x12; iVar2 != 0; iVar2 = iVar2 + -1) {
      *puVar5 = *(undefined4 *)param_2;
      param_2 = param_2 + (uint)bVar6 * -8 + 4;
      puVar5 = puVar5 + (uint)bVar6 * -2 + 1;
    }
  }
  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)