L L4D2node

CUtlVector<float,CUtlMemoryFixedGrowable<float,128u,int>>::EnsureCount

0x00a62e20 · 344 bytes · __thiscall

_ZN10CUtlVectorIf23CUtlMemoryFixedGrowableIfLj128EiEE11EnsureCountEi

Decompiled

undefined (2 params)

/* CUtlVector<float, CUtlMemoryFixedGrowable<float, 128u, int> >::EnsureCount(int) */

void __thiscall
CUtlVector<float,CUtlMemoryFixedGrowable<float,128u,int>>::EnsureCount
          (CUtlVector<float,CUtlMemoryFixedGrowable<float,128u,int>> *this,int param_1)

{
  int iVar1;
  void *__dest;
  int iVar2;
  int iVar3;
  int iVar4;
  int local_20;
  
  iVar1 = *(int *)(this + 0x210);
  if (param_1 <= iVar1) {
    return;
  }
  iVar4 = param_1 - iVar1;
  if (iVar4 == 0) {
    return;
  }
  iVar3 = *(int *)(this + 4);
  if (param_1 <= iVar3) {
    __dest = *(void **)this;
    iVar3 = iVar1;
    goto LAB_00a62e53;
  }
  local_20 = *(int *)(this + 8);
  iVar2 = param_1 - iVar3;
  if (local_20 < 0) {
    local_20 = *(int *)(this + 0xc);
    *(int *)(this + 8) = local_20;
    if (iVar3 == 0) {
      *(undefined4 *)this = 0;
      __dest = (void *)0x0;
    }
    else {
      __dest = malloc(iVar3 << 2);
      memcpy(__dest,*(void **)this,iVar3 << 2);
      local_20 = *(int *)(this + 8);
      *(void **)this = __dest;
    }
    if (-1 < local_20) {
      iVar3 = *(int *)(this + 4);
      goto LAB_00a62ea3;
    }
  }
  else {
LAB_00a62ea3:
    iVar2 = iVar2 + iVar3;
    if (local_20 == 0) {
      if (iVar3 == 0) {
        iVar3 = 8;
      }
      for (; iVar3 < iVar2; iVar3 = iVar3 * 2) {
      }
    }
    else {
      for (iVar3 = ((iVar2 + -1) / local_20 + 1) * local_20; iVar3 < iVar2;
          iVar3 = (iVar3 + iVar2) / 2) {
      }
    }
    *(int *)(this + 4) = iVar3;
    if (*(void **)this != (void *)0x0) {
      __dest = realloc(*(void **)this,iVar3 << 2);
      iVar3 = *(int *)(this + 0x210);
      *(void **)this = __dest;
      goto LAB_00a62e53;
    }
    __dest = malloc(iVar3 << 2);
    *(void **)this = __dest;
  }
  iVar3 = *(int *)(this + 0x210);
LAB_00a62e53:
  *(void **)(this + 0x214) = __dest;
  *(int *)(this + 0x210) = iVar3 + iVar4;
  iVar3 = ((iVar3 + iVar4) - iVar1) - iVar4;
  if ((0 < iVar3) && (0 < iVar4)) {
    _V_memmove((void *)((int)__dest + param_1 * 4),(void *)((int)__dest + iVar1 * 4),iVar3 * 4);
  }
  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)