L L4D2node

CPrecacheHandler::CacheResource

0x00497540 · 435 bytes · __thiscall

_ZN16CPrecacheHandler13CacheResourceE22PrecacheResourceType_tPKcbP16ResourceList_t__Pi

Decompiled

undefined (6 params)

/* CPrecacheHandler::CacheResource(PrecacheResourceType_t, char const*, bool, ResourceList_t__*,
   int*) */

void __thiscall
CPrecacheHandler::CacheResource
          (CPrecacheHandler *param_1,undefined4 param_2,char *param_3,char param_4,
          ResourceList_t__ *param_5,int *param_6)

{
  short sVar1;
  int iVar2;
  
  if (param_4 == '\0') {
switchD_0049756d_caseD_7:
    if (param_6 != (int *)0x0) {
      *param_6 = 0;
      return;
    }
  }
  else {
    if (param_6 != (int *)0x0) {
      *param_6 = 0;
    }
    switch(param_2) {
    case 1:
      PrecacheMaterial(param_3);
      if (param_6 != (int *)0x0) {
        iVar2 = GetMaterialIndex(param_3);
        *param_6 = iVar2;
      }
      if (param_5 != (ResourceList_t__ *)&DAT_ffffffff) {
        iVar2 = *g_pResourceAccessControl;
LAB_00497640:
                    /* WARNING: Could not recover jumptable at 0x00497650. Too many branches */
                    /* WARNING: Treating indirect jump as call */
        (**(code **)(iVar2 + 0x1c))();
        return;
      }
      break;
    case 2:
      iVar2 = CBaseEntity::PrecacheModel(param_3);
      if (param_6 != (int *)0x0) {
        *param_6 = iVar2;
      }
      if (param_5 != (ResourceList_t__ *)&DAT_ffffffff) {
        iVar2 = *g_pResourceAccessControl;
        goto LAB_00497640;
      }
      break;
    case 3:
      sVar1 = CBaseEntity::PrecacheScriptSound(param_3);
      if (param_6 != (int *)0x0) {
        *param_6 = (int)sVar1;
      }
      if (param_5 != (ResourceList_t__ *)&DAT_ffffffff) {
        iVar2 = *g_pResourceAccessControl;
        goto LAB_00497640;
      }
      break;
    case 4:
      PrecacheParticleSystem(param_3);
      if (param_6 != (int *)0x0) {
        iVar2 = GetParticleSystemIndex(param_3);
        *param_6 = iVar2;
      }
      if (param_5 != (ResourceList_t__ *)&DAT_ffffffff) {
        iVar2 = *g_pResourceAccessControl;
        goto LAB_00497640;
      }
      break;
    case 5:
      UTIL_PrecacheOther(param_3,(char *)0x0);
      return;
    case 6:
      iVar2 = UTIL_PrecacheDecal(param_3,true);
      if (param_6 != (int *)0x0) {
        *param_6 = iVar2;
      }
      break;
    case 7:
      goto switchD_0049756d_caseD_7;
    case 8:
      CacheResourceFile(param_1,param_3,true,param_5);
      return;
    case 10:
      PrecachePhysicsSounds(param_1,param_3,true,param_5);
      return;
    case 0xb:
      (**(code **)(*g_pPrecacheSystem + 0x14))(g_pPrecacheSystem,param_1,4,param_3,1,param_5,0);
    }
  }
  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)