L L4D2node

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

0x001069b0 · 365 bytes · __thiscall

_ZN10CUtlVectorI8Remote_t10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_

Decompiled

undefined (3 params)

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

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

{
  int iVar1;
  void *pvVar2;
  int iVar3;
  int iVar4;
  CUtlString *this_00;
  
  iVar3 = *(int *)(this + 4);
  iVar4 = *(int *)(this + 0xc) + 1;
  if (iVar3 < iVar4) {
    iVar1 = *(int *)(this + 8);
    if (iVar1 < 0) goto LAB_001069d2;
    if (iVar1 == 0) {
      if (iVar3 == 0) {
        if (iVar4 < 2) {
          iVar3 = 1;
          goto LAB_00106a56;
        }
        iVar3 = 1;
      }
      do {
        iVar3 = iVar3 * 2;
      } while (iVar3 < iVar4);
    }
    else {
      for (iVar3 = iVar1 * (*(int *)(this + 0xc) / iVar1 + 1); iVar3 < iVar4;
          iVar3 = (iVar3 + iVar4) / 2) {
      }
    }
LAB_00106a56:
    *(int *)(this + 4) = iVar3;
    if (*(void **)this != (void *)0x0) {
      pvVar2 = realloc(*(void **)this,iVar3 * 0x2c);
      iVar4 = *(int *)(this + 0xc);
      *(void **)this = pvVar2;
      *(void **)(this + 0x10) = pvVar2;
      *(int *)(this + 0xc) = iVar4 + 1;
      iVar4 = (iVar4 + 1) - param_1;
      goto joined_r0x00106a92;
    }
    pvVar2 = malloc(iVar3 * 0x2c);
    *(void **)this = pvVar2;
  }
  else {
LAB_001069d2:
    pvVar2 = *(void **)this;
  }
  *(int *)(this + 0xc) = iVar4;
  iVar4 = iVar4 - param_1;
  *(void **)(this + 0x10) = pvVar2;
joined_r0x00106a92:
  if (0 < iVar4 + -1) {
    _V_memmove((void *)((int)pvVar2 + param_1 * 0x2c + 0x2c),(void *)((int)pvVar2 + param_1 * 0x2c),
               (iVar4 + -1) * 0x2c);
    pvVar2 = *(void **)this;
  }
  this_00 = (CUtlString *)(param_1 * 0x2c + (int)pvVar2);
  if (this_00 != (CUtlString *)0x0) {
    CUtlString::CUtlString(this_00,(CUtlString *)param_2);
                    /* try { // try from 00106a0e to 00106a12 has its CatchHandler @ 00106b24 */
    CUtlString::CUtlString(this_00 + 0x10,(CUtlString *)(param_2 + 0x10));
    *(undefined4 *)(this_00 + 0x20) = *(undefined4 *)(param_2 + 0x20);
    *(undefined4 *)(this_00 + 0x24) = *(undefined4 *)(param_2 + 0x24);
    *(undefined4 *)(this_00 + 0x28) = *(undefined4 *)(param_2 + 0x28);
  }
  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)