Sys_LoadLibrary
0x000402e0 · 227 bytes · __regparm3
_ZL15Sys_LoadLibraryPKc9Sys_Flags
Decompiled
undefined (2 params)
/* Sys_LoadLibrary(char const*, Sys_Flags) */
void __regparm3 Sys_LoadLibrary(char *param_1,undefined4 param_2)
{
int *piVar1;
int iVar2;
char *pcVar3;
char *pcVar4;
int in_GS_OFFSET;
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
piVar1 = (int *)CommandLine_Tier0();
iVar2 = (**(code **)(*piVar1 + 0x28))(piVar1,"-xlsp");
pcVar4 = "_xlsp";
if (iVar2 == 0) {
piVar1 = (int *)CommandLine_Tier0();
iVar2 = (**(code **)(*piVar1 + 0x28))(piVar1,"-valveinternal");
if (iVar2 != 0) {
pcVar4 = "_valveinternal";
goto LAB_0004031d;
}
}
else {
LAB_0004031d:
strcpy(local_124,param_1);
pcVar3 = strchr(local_124,0x2e);
if (pcVar3 != (char *)0x0) {
*pcVar3 = '\0';
}
V_strncat(local_124,pcVar4,0x104,-1);
iVar2 = Sys_LoadLibraryGuts(local_124,param_2);
if (iVar2 != 0) goto LAB_00040384;
}
Sys_LoadLibraryGuts(param_1,param_2);
LAB_00040384:
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.