L L4D2node

CDataManagerBase::GetForFreeByIndex

0x002495d0 · 165 bytes · __thiscall

_ZN16CDataManagerBase17GetForFreeByIndexEt

Decompiled

undefined (2 params)

/* CDataManagerBase::GetForFreeByIndex(unsigned short) */

undefined4 __thiscall CDataManagerBase::GetForFreeByIndex(CDataManagerBase *this,ushort param_1)

{
  int iVar1;
  uint uVar2;
  undefined4 uVar3;
  int iVar4;
  
  if (param_1 == 0xffff) {
    uVar3 = 0;
  }
  else {
    iVar1 = *(int *)(this + 0xc) + (uint)param_1 * 0xc;
    uVar2 = (**(code **)(*(int *)this + 0x18))(this,*(undefined4 *)(iVar1 + 4));
    if (*(uint *)(this + 8) < uVar2) {
      if (GetForFreeByIndex(unsigned_short)::__executeCount < 1) {
        GetForFreeByIndex(unsigned_short)::__executeCount =
             GetForFreeByIndex(unsigned_short)::__executeCount + 1;
        Warning("Data manager \'used\' memory incorrect\n");
        iVar4 = 0;
      }
      else {
        iVar4 = 0;
      }
    }
    else {
      iVar4 = *(uint *)(this + 8) - uVar2;
    }
    *(int *)(this + 8) = iVar4;
    *(short *)(iVar1 + 2) = *(short *)(iVar1 + 2) + 1;
    uVar3 = *(undefined4 *)(iVar1 + 4);
    *(undefined4 *)(iVar1 + 4) = 0;
    CUtlMultiList<CDataManagerBase::resource_lru_element_t,unsigned_short>::LinkBefore
              ((CUtlMultiList<CDataManagerBase::resource_lru_element_t,unsigned_short> *)
               (this + 0xc),*(ushort *)(this + 0x48),0xffff,param_1);
  }
  return uVar3;
}

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)