L L4D2node

CUtlVector<IHandleEntity*,CUtlMemoryFixedGrowable<IHandleEntity*,256u,int>>::InsertBefore

0x0051c860 · 341 bytes · __thiscall

_ZN10CUtlVectorIP13IHandleEntity23CUtlMemoryFixedGrowableIS1_Lj256EiEE12InsertBeforeEiRKS1_

Decompiled

undefined (3 params)

/* CUtlVector<IHandleEntity*, CUtlMemoryFixedGrowable<IHandleEntity*, 256u, int>
   >::InsertBefore(int, IHandleEntity* const&) */

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

{
  int iVar1;
  void *__dest;
  int iVar2;
  int iVar3;
  
  iVar1 = *(int *)(this + 4);
  iVar2 = *(int *)(this + 0x410) + 1;
  if (iVar2 <= iVar1) {
    __dest = *(void **)this;
    goto LAB_0051c881;
  }
  iVar3 = *(int *)(this + 8);
  iVar2 = iVar2 - iVar1;
  if (iVar3 < 0) {
    iVar3 = *(int *)(this + 0xc);
    *(int *)(this + 8) = iVar3;
    if (iVar1 == 0) {
      *(undefined4 *)this = 0;
      __dest = (void *)0x0;
    }
    else {
      __dest = malloc(iVar1 * 4);
      memcpy(__dest,*(void **)this,iVar1 * 4);
      iVar3 = *(int *)(this + 8);
      *(void **)this = __dest;
    }
    if (-1 < iVar3) {
      iVar1 = *(int *)(this + 4);
      goto LAB_0051c8db;
    }
  }
  else {
LAB_0051c8db:
    iVar2 = iVar2 + iVar1;
    if (iVar3 == 0) {
      if (iVar1 == 0) {
        iVar1 = 8;
      }
      for (; iVar1 < iVar2; iVar1 = iVar1 * 2) {
      }
    }
    else {
      for (iVar1 = ((iVar2 + -1) / iVar3 + 1) * iVar3; iVar1 < iVar2; iVar1 = (iVar1 + iVar2) / 2) {
      }
    }
    *(int *)(this + 4) = iVar1;
    if (*(void **)this != (void *)0x0) {
      __dest = realloc(*(void **)this,iVar1 << 2);
      *(void **)this = __dest;
      iVar2 = *(int *)(this + 0x410) + 1;
      goto LAB_0051c881;
    }
    __dest = malloc(iVar1 << 2);
    *(void **)this = __dest;
  }
  iVar2 = *(int *)(this + 0x410) + 1;
LAB_0051c881:
  *(int *)(this + 0x410) = iVar2;
  iVar1 = param_1 * 4;
  iVar2 = (iVar2 - param_1) + -1;
  *(void **)(this + 0x414) = __dest;
  if (0 < iVar2) {
    _V_memmove((void *)((int)__dest + iVar1 + 4),(void *)((int)__dest + iVar1),iVar2 * 4);
    __dest = *(void **)this;
  }
  if ((undefined4 *)((int)__dest + iVar1) != (undefined4 *)0x0) {
    *(undefined4 *)((int)__dest + iVar1) = *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)