CPrecacheHandler::CacheResourceFile
0x00497010 · 453 bytes · __thiscall
_ZN16CPrecacheHandler17CacheResourceFileEPKcbP16ResourceList_t__
Decompiled
undefined (4 params)
/* CPrecacheHandler::CacheResourceFile(char const*, bool, ResourceList_t__*) */
void __thiscall
CPrecacheHandler::CacheResourceFile
(CPrecacheHandler *this,char *param_1,bool param_2,ResourceList_t__ *param_3)
{
char *pcVar1;
char cVar2;
KeyValues *pKVar3;
IBaseFileSystem *pIVar4;
char *pcVar5;
char *pcVar6;
int iVar7;
char *pcVar8;
int iVar9;
uint in_stack_ffffffa8;
pKVar3 = KeyValues::operator_new((KeyValues *)0x2c,in_stack_ffffffa8);
/* try { // try from 0049705d to 00497061 has its CatchHandler @ 004971e5 */
KeyValues::KeyValues(pKVar3,"ResourceFile",(IKeyValuesSystem *)0x0,false);
pIVar4 = (IBaseFileSystem *)0x0;
if (g_pFullFileSystem != 0) {
pIVar4 = (IBaseFileSystem *)(g_pFullFileSystem + 4);
}
cVar2 = KeyValues::LoadFromFile(pKVar3,pIVar4,param_1,"GAME");
if (cVar2 == '\0') {
Warning("Can\'t open %s for client precache info.",param_1);
}
else {
pKVar3 = (KeyValues *)KeyValues::GetFirstSubKey(pKVar3);
while (pKVar3 != (KeyValues *)0x0) {
pcVar5 = (char *)KeyValues::GetName(pKVar3);
pcVar6 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
iVar7 = _V_strlen(pcVar5);
if ((iVar7 == 0) || (iVar7 = _V_strlen(pcVar6), iVar7 == 0)) {
LAB_004970b0:
pKVar3 = (KeyValues *)KeyValues::GetNextKey(pKVar3);
}
else {
iVar7 = 0;
do {
pcVar1 = (&s_pPrecacheResourceTypeName)[iVar7];
pcVar8 = (char *)KeyValues::GetName(pKVar3);
iVar9 = _V_stricmp(pcVar8,pcVar1);
if (iVar9 == 0) {
(*(code *)**(undefined4 **)this)(this,iVar7,pcVar6,param_2,param_3,0);
goto LAB_004970b0;
}
iVar7 = iVar7 + 1;
} while (iVar7 != 0xc);
Warning("Error in precache file \"%s\":\n",param_1);
Warning("\tUnknown resource type specified \"%s\", value \"%s\"\n",pcVar5,pcVar6);
pKVar3 = (KeyValues *)KeyValues::GetNextKey(pKVar3);
}
}
}
KeyValues::deleteThis();
return;
}
SourceMod gamedata
paste intoaddons/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.
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.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.