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 intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.