L L4D2node

CUtlVector<char,CUtlMemory<char,int>>::EnsureCount

0x000f4770 · 221 bytes · __thiscall

_ZN10CUtlVectorIc10CUtlMemoryIciEE11EnsureCountEi

Decompiled

undefined (2 params)

/* CUtlVector<char, CUtlMemory<char, int> >::EnsureCount(int) */

void __thiscall
CUtlVector<char,CUtlMemory<char,int>>::EnsureCount
          (CUtlVector<char,CUtlMemory<char,int>> *this,int param_1)

{
  int iVar1;
  int iVar2;
  size_t __size;
  void *pvVar3;
  int iVar4;
  int iVar5;
  
  iVar1 = *(int *)(this + 0xc);
  if (param_1 <= iVar1) {
    return;
  }
  iVar4 = param_1 - iVar1;
  if (iVar4 == 0) {
    return;
  }
  __size = *(size_t *)(this + 4);
  iVar5 = iVar1;
  if ((int)__size < param_1) {
    iVar2 = *(int *)(this + 8);
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (__size == 0) {
          if (param_1 < 0x21) {
            __size = 0x20;
            goto LAB_000f47ff;
          }
          __size = 0x20;
        }
        do {
          __size = __size * 2;
        } while ((int)__size < param_1);
      }
      else {
        for (__size = ((param_1 + -1) / iVar2 + 1) * iVar2; (int)__size < param_1;
            __size = (int)(__size + param_1) / 2) {
        }
      }
LAB_000f47ff:
      *(size_t *)(this + 4) = __size;
      if (*(void **)this == (void *)0x0) {
        pvVar3 = malloc(__size);
        *(void **)this = pvVar3;
      }
      else {
        pvVar3 = realloc(*(void **)this,__size);
        *(void **)this = pvVar3;
        iVar5 = *(int *)(this + 0xc);
      }
      goto LAB_000f47a1;
    }
  }
  pvVar3 = *(void **)this;
LAB_000f47a1:
  *(void **)(this + 0x10) = pvVar3;
  *(int *)(this + 0xc) = iVar5 + iVar4;
  iVar5 = ((iVar5 + iVar4) - iVar1) - iVar4;
  if ((0 < iVar5) && (0 < iVar4)) {
    _V_memmove((void *)((int)pvVar3 + param_1),(void *)(iVar1 + (int)pvVar3),iVar5);
  }
  return;
}

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)