CMeleeWeaponInfoStore::LoadScriptsFromDir
0x00545270 · 380 bytes · __thiscall
_ZN21CMeleeWeaponInfoStore18LoadScriptsFromDirEP14CUtlStringList
Decompiled
undefined (2 params)
/* CMeleeWeaponInfoStore::LoadScriptsFromDir(CUtlStringList*) */
void __thiscall
CMeleeWeaponInfoStore::LoadScriptsFromDir(CMeleeWeaponInfoStore *this,CUtlStringList *param_1)
{
int iVar1;
char *pcVar2;
char cVar3;
KeyValues *this_00;
IBaseFileSystem *pIVar4;
int iVar5;
int in_GS_OFFSET;
uint uVar6;
char local_124 [260];
int local_20;
iVar5 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar1 = *(int *)(param_1 + 0xc);
if (0 < iVar1) {
do {
pcVar2 = *(char **)(*(int *)param_1 + iVar5 * 4);
cVar3 = CDirectorItemManager::IsMeleeWeaponAllowedToExist
(*(CDirectorItemManager **)(TheDirector + 0x62c),pcVar2);
if ((cVar3 != '\0') && (pcVar2 != (char *)0x0)) {
uVar6 = 0x104;
V_snprintf(local_124,0x104,"scripts/melee/%s.txt",pcVar2);
this_00 = KeyValues::operator_new((KeyValues *)0x2c,uVar6);
/* try { // try from 00545340 to 00545344 has its CatchHandler @ 005453f7 */
KeyValues::KeyValues(this_00,"meleeweapon",(IKeyValuesSystem *)0x0,false);
if (this_00 != (KeyValues *)0x0) {
pIVar4 = (IBaseFileSystem *)0x0;
if (filesystem != 0) {
pIVar4 = (IBaseFileSystem *)(filesystem + 4);
}
cVar3 = KeyValues::LoadFromFile(this_00,pIVar4,local_124,"GAME");
if (cVar3 != '\0') {
RegisterMeleeWeaponType(this,pcVar2,this_00);
(**(code **)(*g_pStringTableMeleeWeapons + 0x24))
(g_pStringTableMeleeWeapons,1,pcVar2,0xffffffff,0);
}
KeyValues::deleteThis();
}
}
iVar5 = iVar5 + 1;
} while (iVar5 != iVar1);
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.