L L4D2node

CGameServer::DumpPrecacheStats

0x0020a9a0 · 513 bytes · __thiscall

_ZN11CGameServer17DumpPrecacheStatsEP19INetworkStringTable

Decompiled

undefined (2 params)

/* CGameServer::DumpPrecacheStats(INetworkStringTable*) */

void __thiscall CGameServer::DumpPrecacheStats(CGameServer *this,INetworkStringTable *param_1)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  int iVar4;
  byte *pbVar5;
  int iVar6;
  CPrecacheItem *this_00;
  longdouble lVar7;
  longdouble lVar8;
  double dVar9;
  int local_20 [4];
  
  if (param_1 == (INetworkStringTable *)0x0) {
    ConMsg("Can only dump stats when active in a level\n");
    return;
  }
  if (*(INetworkStringTable **)(this + 0x2d364) == param_1) {
    this_00 = (CPrecacheItem *)(this + 0x264);
  }
  else if (*(INetworkStringTable **)(this + 0x2d36c) == param_1) {
    this_00 = (CPrecacheItem *)(this + 0x4264);
  }
  else if (*(INetworkStringTable **)(this + 0x2d368) == param_1) {
    this_00 = (CPrecacheItem *)(this + 0x5264);
  }
  else {
    if (*(INetworkStringTable **)(this + 0x2d370) != param_1) {
      return;
    }
    this_00 = (CPrecacheItem *)(this + 0x2c364);
  }
  iVar1 = (**(code **)(*(int *)param_1 + 0x10))(param_1);
  uVar2 = (**(code **)(*(int *)param_1 + 0x14))(param_1);
  ConMsg("\n");
  iVar3 = (**(code **)(*(int *)param_1 + 8))(param_1);
  dVar9 = (double)CONCAT44(uVar2,iVar1);
  ConMsg("Precache table %s:  %i of %i slots used\n",iVar3,iVar1,uVar2);
  if (0 < iVar1) {
    iVar6 = 0;
    do {
      while( true ) {
        uVar2 = (undefined4)((ulonglong)dVar9 >> 0x20);
        iVar4 = (**(code **)(*(int *)param_1 + 0x28))(param_1,iVar6);
        dVar9 = (double)CONCAT44(uVar2,local_20);
        iVar3 = iVar6;
        pbVar5 = (byte *)(**(code **)(*(int *)param_1 + 0x30))(param_1,iVar6,local_20);
        if (local_20[0] != 1) {
          iVar3 = local_20[0];
          Error("CGameServer::DumpPrecacheStats: invalid CPrecacheUserData length (%d)",local_20[0])
          ;
        }
        if (((iVar4 != 0) && (this_00 != (CPrecacheItem *)0x0)) && (pbVar5 != (byte *)0x0)) break;
LAB_0020aa60:
        iVar6 = iVar6 + 1;
        this_00 = this_00 + 8;
        if (iVar6 == iVar1) goto LAB_0020ab60;
      }
      uVar2 = GetFlagString(*pbVar5 & 3);
      dVar9 = (double)CONCAT44(uVar2,iVar4);
      iVar3 = iVar6;
      ConMsg("%03i:  %s (%s):   ",iVar6,iVar4,uVar2);
      iVar4 = CPrecacheItem::GetReferenceCount(this_00);
      if (iVar4 == 0) {
        ConMsg(" never used\n",iVar3,dVar9);
        goto LAB_0020aa60;
      }
      iVar6 = iVar6 + 1;
      lVar7 = (longdouble)CPrecacheItem::GetMostRecentReference();
      lVar8 = (longdouble)CPrecacheItem::GetFirstReference();
      iVar3 = CPrecacheItem::GetReferenceCount(this_00);
      dVar9 = (double)(float)lVar8;
      ConMsg(" %i refs, first %.2f mru %.2f\n",iVar3,dVar9,(double)(float)lVar7);
      this_00 = this_00 + 8;
    } while (iVar6 != iVar1);
  }
LAB_0020ab60:
  ConMsg("\n",iVar3,dVar9);
  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)