L L4D2node

CUtlVector<OneWayLink_t,CUtlMemoryFixedGrowable<OneWayLink_t,512u,int>>::InsertBefore

0x00721f60 · 388 bytes · __thiscall

_ZN10CUtlVectorI12OneWayLink_t23CUtlMemoryFixedGrowableIS0_Lj512EiEE12InsertBeforeEiRKS0_

Decompiled

undefined (3 params)

/* CUtlVector<OneWayLink_t, CUtlMemoryFixedGrowable<OneWayLink_t, 512u, int> >::InsertBefore(int,
   OneWayLink_t const&) */

int __thiscall
CUtlVector<OneWayLink_t,CUtlMemoryFixedGrowable<OneWayLink_t,512u,int>>::InsertBefore
          (CUtlVector<OneWayLink_t,CUtlMemoryFixedGrowable<OneWayLink_t,512u,int>> *this,int param_1
          ,OneWayLink_t *param_2)

{
  undefined4 *puVar1;
  void *__dest;
  int iVar2;
  int iVar3;
  int local_20;
  
  iVar3 = *(int *)(this + 4);
  iVar2 = *(int *)(this + 0x1810) + 1;
  if (iVar2 <= iVar3) {
    __dest = *(void **)this;
    goto LAB_00721f84;
  }
  local_20 = *(int *)(this + 8);
  iVar2 = iVar2 - iVar3;
  if (local_20 < 0) {
    local_20 = *(int *)(this + 0xc);
    *(int *)(this + 8) = local_20;
    if (iVar3 == 0) {
      *(undefined4 *)this = 0;
      __dest = (void *)0x0;
    }
    else {
      __dest = malloc(iVar3 * 0xc);
      memcpy(__dest,*(void **)this,iVar3 * 0xc);
      local_20 = *(int *)(this + 8);
      *(void **)this = __dest;
    }
    if (-1 < local_20) {
      iVar3 = *(int *)(this + 4);
      goto LAB_00721ffc;
    }
  }
  else {
LAB_00721ffc:
    iVar2 = iVar2 + iVar3;
    if (local_20 == 0) {
      if (iVar3 == 0) {
        iVar3 = 3;
      }
      for (; iVar3 < iVar2; iVar3 = iVar3 * 2) {
      }
    }
    else {
      for (iVar3 = ((iVar2 + -1) / local_20 + 1) * local_20; iVar3 < iVar2;
          iVar3 = (iVar3 + iVar2) / 2) {
      }
    }
    *(int *)(this + 4) = iVar3;
    if (*(void **)this != (void *)0x0) {
      __dest = realloc(*(void **)this,iVar3 * 0xc);
      *(void **)this = __dest;
      iVar2 = *(int *)(this + 0x1810) + 1;
      goto LAB_00721f84;
    }
    __dest = malloc(iVar3 * 0xc);
    *(void **)this = __dest;
  }
  iVar2 = *(int *)(this + 0x1810) + 1;
LAB_00721f84:
  *(int *)(this + 0x1810) = iVar2;
  iVar2 = (iVar2 - param_1) + -1;
  iVar3 = param_1 * 0xc;
  *(void **)(this + 0x1814) = __dest;
  if (0 < iVar2) {
    _V_memmove((void *)((int)__dest + iVar3 + 0xc),(void *)((int)__dest + iVar3),iVar2 * 0xc);
    __dest = *(void **)this;
  }
  puVar1 = (undefined4 *)((int)__dest + iVar3);
  if (puVar1 != (undefined4 *)0x0) {
    *puVar1 = *(undefined4 *)param_2;
    puVar1[1] = *(undefined4 *)(param_2 + 4);
    puVar1[2] = *(undefined4 *)(param_2 + 8);
  }
  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)