L L4D2node

CUtlMultiList<CDataManagerBase::resource_lru_element_t,unsigned_short>::InsertBefore

0x00bdcbb0 · 486 bytes · __thiscall

_ZN13CUtlMultiListIN16CDataManagerBase22resource_lru_element_tEtE12InsertBeforeEtt

Decompiled

undefined (3 params)

/* CUtlMultiList<CDataManagerBase::resource_lru_element_t, unsigned short>::InsertBefore(unsigned
   short, unsigned short) */

uint __thiscall
CUtlMultiList<CDataManagerBase::resource_lru_element_t,unsigned_short>::InsertBefore
          (CUtlMultiList<CDataManagerBase::resource_lru_element_t,unsigned_short> *this,
          ushort param_1,ushort param_2)

{
  int iVar1;
  ushort uVar2;
  void *pvVar3;
  undefined2 *puVar4;
  uint uVar5;
  uint uVar6;
  short sVar7;
  uint uVar8;
  int iVar9;
  
  uVar2 = *(ushort *)(this + 0x2c);
  uVar8 = (uint)uVar2;
  if (uVar2 == 0xffff) {
    uVar8 = *(uint *)(this + 0x30);
    if ((uVar8 != (uVar8 & 0xffff)) || ((short)uVar8 == -1)) {
      if (9 < Alloc()::__executeCount) {
        return 0xffffffff;
      }
      Alloc()::__executeCount = Alloc()::__executeCount + 1;
      Warning("CUtlMultiList overflow! (exhausted index range)\n");
      return 0xffffffff;
    }
    if (uVar8 == *(uint *)(this + 4)) {
      iVar9 = *(int *)(this + 8);
      if (iVar9 < 0) {
        *(undefined4 *)(this + 0x34) = *(undefined4 *)this;
LAB_00bdcd42:
        if (Alloc()::__executeCount < 10) {
          Alloc()::__executeCount = Alloc()::__executeCount + 1;
          Warning("CUtlMultiList overflow! (exhausted memory allocator)\n");
        }
        return 0xffffffff;
      }
      iVar1 = uVar8 + 1;
      if (iVar9 == 0) {
        uVar6 = 3;
        if (uVar8 != 0) {
          uVar6 = uVar8;
        }
        for (; (int)uVar6 < iVar1; uVar6 = uVar6 * 2) {
        }
      }
      else {
        for (uVar6 = iVar9 * ((int)uVar8 / iVar9 + 1); (int)uVar6 < iVar1;
            uVar6 = (int)(uVar6 + iVar1) / 2) {
        }
      }
      *(uint *)(this + 4) = uVar6;
      if (*(void **)this == (void *)0x0) {
        pvVar3 = malloc(uVar6 * 0xc);
        *(void **)this = pvVar3;
      }
      else {
        pvVar3 = realloc(*(void **)this,uVar6 * 0xc);
        uVar8 = *(uint *)(this + 0x30);
        uVar6 = *(uint *)(this + 4);
        *(void **)this = pvVar3;
      }
      *(void **)(this + 0x34) = pvVar3;
      if ((int)uVar6 <= (int)uVar8) goto LAB_00bdcd42;
    }
    else {
      pvVar3 = *(void **)this;
    }
    uVar6 = uVar8 & 0xffff;
    *(uint *)(this + 0x30) = uVar8 + 1;
    iVar9 = uVar6 * 0xc;
    pvVar3 = (void *)((int)pvVar3 + iVar9);
  }
  else {
    uVar6 = (uint)uVar2;
    iVar9 = uVar6 * 0xc;
    pvVar3 = (void *)(*(int *)this + iVar9);
    *(undefined2 *)(this + 0x2c) = *(undefined2 *)((int)pvVar3 + 10);
  }
  sVar7 = (short)uVar8;
  *(short *)((int)pvVar3 + 8) = sVar7;
  *(short *)((int)pvVar3 + 10) = sVar7;
  *(short *)(this + 0x2e) = *(short *)(this + 0x2e) + 1;
  puVar4 = (undefined2 *)(iVar9 + *(int *)this);
  if (puVar4 != (undefined2 *)0x0) {
    *(undefined4 *)(puVar4 + 2) = 0;
    *puVar4 = 0;
    puVar4[1] = 1;
  }
  uVar5 = 0xffffffff;
  if (sVar7 != -1) {
    LinkBefore(this,param_1,param_2,(ushort)uVar6);
    puVar4 = (undefined2 *)(iVar9 + *(int *)this);
    uVar5 = uVar8;
    if (puVar4 != (undefined2 *)0x0) {
      *(undefined4 *)(puVar4 + 2) = 0;
      *puVar4 = 0;
      puVar4[1] = 1;
    }
  }
  return uVar5;
}

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)