L L4D2node

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

0x007c1bc0 · 473 bytes · __thiscall

_ZN10CUtlVectorI8CUserCmd10CUtlMemoryIS0_iEE12InsertBeforeEiRKS0_

Decompiled

undefined (3 params)

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

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

{
  CUserCmd *pCVar1;
  void *pvVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  iVar4 = *(int *)(this + 4);
  iVar3 = *(int *)(this + 0xc) + 1;
  if (iVar4 < iVar3) {
    iVar5 = *(int *)(this + 8);
    if (-1 < iVar5) {
      if (iVar5 == 0) {
        if (iVar4 == 0) {
          if (iVar3 < 2) {
            iVar5 = 1;
            goto LAB_007c1d37;
          }
          iVar4 = 1;
        }
        do {
          iVar5 = iVar4 * 2;
          if (iVar3 <= iVar5) break;
          iVar5 = iVar4 * 4;
          iVar4 = iVar5;
        } while (iVar5 < iVar3);
      }
      else {
        for (iVar5 = iVar5 * (*(int *)(this + 0xc) / iVar5 + 1); iVar5 < iVar3;
            iVar5 = (iVar5 + iVar3) / 2) {
        }
      }
LAB_007c1d37:
      *(int *)(this + 4) = iVar5;
      if (*(void **)this == (void *)0x0) {
        pvVar2 = malloc(iVar5 * 0x58);
        *(void **)this = pvVar2;
      }
      else {
        pvVar2 = realloc(*(void **)this,iVar5 * 0x58);
        *(void **)this = pvVar2;
        iVar3 = *(int *)(this + 0xc) + 1;
      }
      goto LAB_007c1be8;
    }
  }
  pvVar2 = *(void **)this;
LAB_007c1be8:
  *(int *)(this + 0xc) = iVar3;
  iVar4 = param_1 * 0x58;
  iVar3 = (iVar3 - param_1) + -1;
  *(void **)(this + 0x10) = pvVar2;
  if (0 < iVar3) {
    _V_memmove((void *)((int)pvVar2 + iVar4 + 0x58),(void *)((int)pvVar2 + iVar4),iVar3 * 0x58);
    pvVar2 = *(void **)this;
  }
  pCVar1 = (CUserCmd *)((int)pvVar2 + iVar4);
  if ((pCVar1 != (CUserCmd *)0x0) &&
     (*(undefined ***)pCVar1 = &PTR__CUserCmd_00c15058, param_2 != pCVar1)) {
    *(undefined4 *)(pCVar1 + 4) = *(undefined4 *)(param_2 + 4);
    *(undefined4 *)(pCVar1 + 8) = *(undefined4 *)(param_2 + 8);
    *(undefined4 *)(pCVar1 + 0xc) = *(undefined4 *)(param_2 + 0xc);
    *(undefined4 *)(pCVar1 + 0x10) = *(undefined4 *)(param_2 + 0x10);
    *(undefined4 *)(pCVar1 + 0x14) = *(undefined4 *)(param_2 + 0x14);
    *(undefined4 *)(pCVar1 + 0x18) = *(undefined4 *)(param_2 + 0x18);
    *(undefined4 *)(pCVar1 + 0x1c) = *(undefined4 *)(param_2 + 0x1c);
    *(undefined4 *)(pCVar1 + 0x20) = *(undefined4 *)(param_2 + 0x20);
    *(undefined4 *)(pCVar1 + 0x24) = *(undefined4 *)(param_2 + 0x24);
    pCVar1[0x28] = param_2[0x28];
    *(undefined4 *)(pCVar1 + 0x2c) = *(undefined4 *)(param_2 + 0x2c);
    *(undefined4 *)(pCVar1 + 0x30) = *(undefined4 *)(param_2 + 0x30);
    *(undefined4 *)(pCVar1 + 0x34) = *(undefined4 *)(param_2 + 0x34);
    *(undefined2 *)(pCVar1 + 0x38) = *(undefined2 *)(param_2 + 0x38);
    *(undefined2 *)(pCVar1 + 0x3a) = *(undefined2 *)(param_2 + 0x3a);
    pCVar1[0x3c] = param_2[0x3c];
    *(undefined4 *)(pCVar1 + 0x40) = *(undefined4 *)(param_2 + 0x40);
    *(undefined4 *)(pCVar1 + 0x44) = *(undefined4 *)(param_2 + 0x44);
    *(undefined4 *)(pCVar1 + 0x48) = *(undefined4 *)(param_2 + 0x48);
    *(undefined4 *)(pCVar1 + 0x4c) = *(undefined4 *)(param_2 + 0x4c);
    *(undefined4 *)(pCVar1 + 0x50) = *(undefined4 *)(param_2 + 0x50);
    *(undefined4 *)(pCVar1 + 0x54) = *(undefined4 *)(param_2 + 0x54);
  }
  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)