CPlugin::Load
0x00208bf0 · 619 bytes · __thiscall
_ZN7CPlugin4LoadEPKc
Decompiled
undefined (2 params)
/* CPlugin::Load(char const*) */
undefined4 __thiscall CPlugin::Load(CPlugin *this,char *param_1)
{
char cVar1;
CPlugin CVar2;
int iVar3;
CSysModule *pCVar4;
code *pcVar5;
char *pcVar6;
undefined4 uVar7;
int in_GS_OFFSET;
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if ((DAT_003b8088 != '\0') || (cVar1 = Host_IsSecureServerAllowed(), cVar1 == '\0')) {
V_strncpy(local_124,param_1,0x104);
V_FixSlashes(local_124,'/');
iVar3 = StringAfterPrefix(local_124,"\\\\");
if (iVar3 == 0) {
uVar7 = Host_AllowLoadModule(local_124,"GAME",false);
if ((char)uVar7 == '\0') {
g_pServerPluginHandler[0xc1c] = 1;
goto LAB_00208c56;
}
CVar2 = (CPlugin)Host_IsValidSignature(local_124,false);
this[0x101] = CVar2;
pCVar4 = (CSysModule *)
(**(code **)(*g_pFileSystem + 0x68))(g_pFileSystem,local_124,&DAT_002a076d,0);
*(CSysModule **)(this + 0x10c) = pCVar4;
if (pCVar4 != (CSysModule *)0x0) {
pcVar5 = (code *)Sys_GetFactory(pCVar4);
if (pcVar5 != (code *)0x0) {
*(undefined4 *)(this + 0x108) = 3;
iVar3 = (*pcVar5)("ISERVERPLUGINCALLBACKS003",0);
*(int *)(this + 0x104) = iVar3;
if (iVar3 == 0) {
*(undefined4 *)(this + 0x108) = 2;
iVar3 = (*pcVar5)("ISERVERPLUGINCALLBACKS002",0);
*(int *)(this + 0x104) = iVar3;
if (iVar3 == 0) {
*(undefined4 *)(this + 0x108) = 1;
iVar3 = (*pcVar5)("ISERVERPLUGINCALLBACKS001",0);
*(int *)(this + 0x104) = iVar3;
if (iVar3 == 0) {
Warning("Could not get IServerPluginCallbacks interface from plugin \"%s\"",param_1)
;
uVar7 = 0;
goto LAB_00208c56;
}
}
}
uVar7 = Sys_GetFactory(g_GameDLL);
uVar7 = (**(code **)**(undefined4 **)(this + 0x104))
(*(undefined4 **)(this + 0x104),g_AppSystemFactory,uVar7);
if ((char)uVar7 == '\0') {
Warning("Failed to load plugin \"%s\"\n",param_1);
}
else {
pcVar6 = (char *)(**(code **)(**(int **)(this + 0x104) + 0x10))(*(int **)(this + 0x104))
;
V_strncpy((char *)this,pcVar6,0x80);
V_strncpy((char *)(this + 0x80),local_124,0x80);
}
}
goto LAB_00208c56;
}
Warning("Unable to load plugin \"%s\"\n",param_1);
}
}
uVar7 = 0;
LAB_00208c56:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return uVar7;
}
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.