L L4D2node

CUtlVector<CThreadSafeMemoryPool::BlockSet_t,CUtlMemory<CThreadSafeMemoryPool::BlockSet_t,int>>::InsertBefore

0x0008c360 · 237 bytes · __thiscall

_ZN10CUtlVectorIN21CThreadSafeMemoryPool10BlockSet_tE10CUtlMemoryIS1_iEE12InsertBeforeEiRKS1_

Decompiled

undefined (3 params)

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

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

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