CServerPlugin::LoadPlugins
0x002098f0 · 462 bytes · __thiscall
_ZN13CServerPlugin11LoadPluginsEv
Decompiled
undefined (1 param)
/* CServerPlugin::LoadPlugins() */
void __thiscall CServerPlugin::LoadPlugins(CServerPlugin *this)
{
CPlugin *this_00;
char cVar1;
uint uVar2;
KeyValues *this_01;
char *pcVar3;
code *pcVar4;
undefined4 uVar5;
IBaseFileSystem *pIVar6;
int iVar7;
iVar7 = 0;
if (0 < *(int *)(this + 0x10)) {
do {
this_00 = *(CPlugin **)(*(int *)(this + 4) + iVar7 * 4);
if (this_00 != (CPlugin *)0x0) {
CPlugin::~CPlugin(this_00);
operator_delete(this_00);
}
iVar7 = iVar7 + 1;
} while (iVar7 < *(int *)(this + 0x10));
}
*(undefined4 *)(this + 0x10) = 0;
CUtlMemory<CPlugin*,int>::Purge((CUtlMemory<CPlugin*,int> *)(this + 4));
*(undefined4 *)(this + 0x14) = *(undefined4 *)(this + 4);
iVar7 = Sys_FindFirst("addons/*.vdf",(char *)0x0,0);
while (iVar7 != 0) {
DevMsg("Plugins: found file \"%s\"\n",iVar7);
pcVar4 = *(code **)(*(int *)(g_pFileSystem + 4) + 0x28);
uVar2 = va("addons/%s",iVar7);
cVar1 = (*pcVar4)(g_pFileSystem + 4,uVar2,&DAT_002a0772);
if (cVar1 != '\0') {
this_01 = KeyValues::operator_new((KeyValues *)0x2c,uVar2);
/* try { // try from 002099e6 to 002099ea has its CatchHandler @ 00209abe */
KeyValues::KeyValues(this_01,"Plugins",(IKeyValuesSystem *)0x0,false);
pcVar3 = (char *)va("addons/%s",iVar7);
pIVar6 = (IBaseFileSystem *)0x0;
if (g_pFileSystem != 0) {
pIVar6 = (IBaseFileSystem *)(g_pFileSystem + 4);
}
KeyValues::LoadFromFile(this_01,pIVar6,pcVar3,"MOD");
iVar7 = KeyValues::GetString(this_01,"file",(char *)0x0);
if (iVar7 != 0) {
pcVar3 = (char *)KeyValues::GetString(this_01,"file","");
LoadPlugin(this,pcVar3);
}
KeyValues::deleteThis();
}
iVar7 = Sys_FindNext((char *)0x0,0);
}
Sys_FindClose();
pcVar4 = (code *)Sys_GetFactory(g_GameDLL);
uVar5 = (*pcVar4)("PluginHelpersCheck001",0);
*(undefined4 *)(this + 0x18) = uVar5;
VerifyPluginSignatures(this);
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.