L L4D2node

CUtlVector<CTerrorPlayer::InfectedDamageEvent,CUtlMemory<CTerrorPlayer::InfectedDamageEvent,int>>::InsertBefore

0x009ec0c0 · 243 bytes · __thiscall

_ZN10CUtlVectorIN13CTerrorPlayer19InfectedDamageEventE10CUtlMemoryIS1_iEE12InsertBeforeEiRKS1_

Decompiled

undefined (3 params)

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

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

{
  undefined4 uVar1;
  undefined4 *puVar2;
  void *pvVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  
  iVar5 = *(int *)(this + 4);
  iVar6 = *(int *)(this + 0xc) + 1;
  if (iVar5 < iVar6) {
    iVar4 = *(int *)(this + 8);
    if (-1 < iVar4) {
      if (iVar4 == 0) {
        if (iVar5 == 0) {
          if (iVar6 < 5) {
            iVar4 = 4;
            goto LAB_009ec15f;
          }
          iVar5 = 4;
        }
        do {
          iVar4 = iVar5 * 2;
          if (iVar6 <= iVar4) break;
          iVar4 = iVar5 * 4;
          iVar5 = iVar4;
        } while (iVar4 < iVar6);
      }
      else {
        for (iVar4 = iVar4 * (*(int *)(this + 0xc) / iVar4 + 1); iVar4 < iVar6;
            iVar4 = (iVar4 + iVar6) / 2) {
        }
      }
LAB_009ec15f:
      *(int *)(this + 4) = iVar4;
      if (*(void **)this == (void *)0x0) {
        pvVar3 = malloc(iVar4 << 3);
        *(void **)this = pvVar3;
      }
      else {
        pvVar3 = realloc(*(void **)this,iVar4 << 3);
        *(void **)this = pvVar3;
        iVar6 = *(int *)(this + 0xc) + 1;
      }
      goto LAB_009ec0de;
    }
  }
  pvVar3 = *(void **)this;
LAB_009ec0de:
  *(int *)(this + 0xc) = iVar6;
  iVar6 = (iVar6 - param_1) + -1;
  *(void **)(this + 0x10) = pvVar3;
  iVar5 = param_1 * 8;
  if (0 < iVar6) {
    _V_memmove((void *)((int)pvVar3 + iVar5 + 8),(void *)((int)pvVar3 + iVar5),iVar6 * 8);
    pvVar3 = *(void **)this;
  }
  puVar2 = (undefined4 *)((int)pvVar3 + iVar5);
  if (puVar2 != (undefined4 *)0x0) {
    uVar1 = *(undefined4 *)(param_2 + 4);
    *puVar2 = *(undefined4 *)param_2;
    puVar2[1] = uVar1;
  }
  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)