PrecacheFileWeaponInfoDatabase
0x005857a0 · 402 bytes · __cdecl
_Z30PrecacheFileWeaponInfoDatabaseP11IFileSystemPKh
Decompiled
undefined (2 params)
/* PrecacheFileWeaponInfoDatabase(IFileSystem*, unsigned char const*) */
void PrecacheFileWeaponInfoDatabase(IFileSystem *param_1,uchar *param_2)
{
char cVar1;
KeyValues *pKVar2;
IBaseFileSystem *pIVar3;
char *pcVar4;
int iVar5;
undefined4 uVar6;
int in_GS_OFFSET;
uint in_stack_fffffdb8;
ushort local_222;
char local_220 [512];
int local_20;
g_bWeaponHandlesInit = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (m_WeaponInfoDatabase._18_2_ == 0) {
pKVar2 = KeyValues::operator_new((KeyValues *)0x2c,in_stack_fffffdb8);
/* try { // try from 00585819 to 0058581d has its CatchHandler @ 0058593a */
KeyValues::KeyValues(pKVar2,"weaponscripts",(IKeyValuesSystem *)0x0,false);
KeyValues::UsesEscapeSequences(pKVar2,true);
pIVar3 = (IBaseFileSystem *)0x0;
if (param_1 != (IFileSystem *)0x0) {
pIVar3 = (IBaseFileSystem *)(param_1 + 4);
}
cVar1 = KeyValues::LoadFromFile(pKVar2,pIVar3,"scripts/weapon_manifest.txt","GAME");
if (cVar1 != '\0') {
for (pKVar2 = (KeyValues *)KeyValues::GetFirstSubKey(pKVar2); pKVar2 != (KeyValues *)0x0;
pKVar2 = (KeyValues *)KeyValues::GetNextKey(pKVar2)) {
while( true ) {
pcVar4 = (char *)KeyValues::GetName(pKVar2);
iVar5 = _V_stricmp(pcVar4,"file");
if (iVar5 == 0) break;
uVar6 = KeyValues::GetName(pKVar2);
Error("Expecting \'file\', got %s\n",uVar6);
pKVar2 = (KeyValues *)KeyValues::GetNextKey(pKVar2);
if (pKVar2 == (KeyValues *)0x0) goto LAB_00585858;
}
pcVar4 = (char *)KeyValues::GetString(pKVar2,(char *)0x0,"");
V_FileBase(pcVar4,local_220,0x200);
ReadWeaponDataFromFileForSlot(param_1,local_220,&local_222,param_2);
}
}
LAB_00585858:
KeyValues::deleteThis();
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.