L L4D2node

CGameServer::PrecacheSound

0x0020a3e0 · 439 bytes · __thiscall

_ZN11CGameServer13PrecacheSoundEPKci

Decompiled

undefined (3 params)

/* CGameServer::PrecacheSound(char const*, int) */

int __thiscall CGameServer::PrecacheSound(CGameServer *this,char *param_1,int param_2)

{
  char cVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  char *pcVar5;
  CMapReslistGenerator *this_00;
  byte *pbVar6;
  int iVar7;
  byte local_1d [13];
  
  piVar2 = *(int **)(this + 0x2d368);
  if (piVar2 != (int *)0x0) {
    iVar3 = (**(code **)(*piVar2 + 0x10))(piVar2);
    iVar4 = (**(code **)(**(int **)(this + 0x2d368) + 0x24))
                      (*(int **)(this + 0x2d368),1,param_1,0xffffffff,0);
    if (iVar4 != 0xffff) {
      if ((*(int *)(sv_showprecachedsounds._28_4_ + 0x30) != 0) &&
         (iVar7 = (**(code **)(**(int **)(this + 0x2d368) + 0x10))(*(int **)(this + 0x2d368)),
         iVar3 < iVar7)) {
        DevMsg("PrecacheSound: %d: %s\n",iVar4,param_1);
      }
      iVar3 = MapReslistGenerator();
      if ((*(char *)(iVar3 + 1) != '\0') && (cVar1 = *param_1, pcVar5 = param_1, cVar1 != '\0')) {
        while (((cVar1 == '!' ||
                ((((byte)(cVar1 - 0x23U) < 2 || ((byte)(cVar1 - 0x28U) < 3)) ||
                 ((byte)(cVar1 - 0x3eU) < 3)))) ||
               (((cVar1 == '<' || (cVar1 == '^')) || (cVar1 == '}'))))) {
          cVar1 = pcVar5[1];
          pcVar5 = pcVar5 + 1;
        }
        pcVar5 = (char *)va("sound/%s",pcVar5);
        this_00 = (CMapReslistGenerator *)MapReslistGenerator();
        CMapReslistGenerator::OnResourcePrecached(this_00,pcVar5);
      }
      pbVar6 = (byte *)(**(code **)(**(int **)(this + 0x2d368) + 0x30))
                                 (*(int **)(this + 0x2d368),iVar4,0);
      if (pbVar6 == (byte *)0x0) {
        local_1d[0] = (byte)param_2 & 3;
      }
      else {
        local_1d[0] = *pbVar6 & 0xfc | (*pbVar6 | (byte)param_2) & 3;
      }
      (**(code **)(**(int **)(this + 0x2d368) + 0x2c))(*(int **)(this + 0x2d368),iVar4,1,local_1d);
      CPrecacheItem::SetName((CPrecacheItem *)(this + iVar4 * 8 + 0x5264),param_1);
      return iVar4;
    }
  }
  return -1;
}

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)