LoadEntityDLLs
0x002159a0 · 1057 bytes · __cdecl
_Z14LoadEntityDLLsPKc
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* LoadEntityDLLs(char const*) */
void LoadEntityDLLs(char *param_1)
{
char cVar1;
KeyValues *this;
IBaseFileSystem *pIVar2;
CSysModule *pCVar3;
undefined4 uVar4;
char *pcVar5;
int iVar6;
undefined4 *puVar7;
uint in_stack_ffffffe8;
g_GameDLL = (CSysModule *)0x0;
puVar7 = &gmodinfo;
for (iVar6 = 0x8b; iVar6 != 0; iVar6 = iVar6 + -1) {
*puVar7 = 0;
puVar7 = puVar7 + 1;
}
_DAT_003ec7c0 = 1;
DAT_003ec7c8 = 1;
sv_noclipduringpause = 0;
this = KeyValues::operator_new((KeyValues *)0x2c,in_stack_ffffffe8);
/* try { // try from 00215a06 to 00215a0a has its CatchHandler @ 00215df2 */
KeyValues::KeyValues(this,"modinfo",(IKeyValuesSystem *)0x0,false);
pIVar2 = (IBaseFileSystem *)0x0;
if (g_pFileSystem != (int *)0x0) {
pIVar2 = (IBaseFileSystem *)(g_pFileSystem + 1);
}
cVar1 = KeyValues::LoadFromFile(this,pIVar2,"gameinfo.txt",(char *)0x0);
if (cVar1 != '\0') {
pcVar5 = (char *)KeyValues::GetString(this,"url_info","");
V_strncpy((char *)&gmodinfo,pcVar5,0x100);
pcVar5 = (char *)KeyValues::GetString(this,"url_dl","");
V_strncpy(&DAT_003ec6a0,pcVar5,0x100);
_DAT_003ec7c0 = KeyValues::GetInt(this,"version",0);
_DAT_003ec7c4 = KeyValues::GetInt(this,"size",0);
iVar6 = KeyValues::GetInt(this,"svonly",0);
DAT_003ec7c8 = iVar6 != 0;
iVar6 = KeyValues::GetInt(this,"cldll",0);
DAT_003ec7c9 = iVar6 != 0;
pcVar5 = (char *)KeyValues::GetString(this,"hlversion","");
V_strncpy(&DAT_003ec7a0,pcVar5,0x20);
}
KeyValues::deleteThis();
cVar1 = Host_AllowLoadModule("server_srv.so","GAMEBIN",true);
if (cVar1 == '\0') {
Host_DisallowSecureServers();
Host_AllowLoadModule("server_srv.so","GAMEBIN",true);
}
pCVar3 = (CSysModule *)
(**(code **)(*g_pFileSystem + 0x68))(g_pFileSystem,"server_srv.so","GAMEBIN",0);
if (pCVar3 != (CSysModule *)0x0) {
g_ServerFactory = (code *)Sys_GetFactory(pCVar3);
if (g_ServerFactory == (code *)0x0) {
ConMsg("Could not find factory interface in library %s","server_srv.so");
}
else {
g_bServerGameDLLGreaterThanV5 = 1;
serverGameDLL = (int *)(*g_ServerFactory)("ServerGameDLL005",0);
if (serverGameDLL == (int *)0x0) {
Msg("Could not get IServerGameDLL interface from library %s","server_srv.so");
}
else {
serverGameEnts = (*g_ServerFactory)("ServerGameEnts001",0);
if (serverGameEnts != 0) {
serverGameClients = (*g_ServerFactory)("ServerGameClients003",0);
if (serverGameClients == 0) {
serverGameClients = (*g_ServerFactory)("ServerGameClients003",0);
if (serverGameClients == 0) {
ConMsg("Could not get IServerGameClients interface from library %s","server_srv.so");
goto LAB_00215d14;
}
g_iServerGameClientsVersion = 3;
}
else {
g_iServerGameClientsVersion = 4;
}
serverGameDirector = (*g_ServerFactory)("HLTVDirector001",0);
if (serverGameDirector == 0) {
ConMsg("Could not get IHLTVDirector interface from library %s","server_srv.so");
}
serverGameTags = (*g_ServerFactory)("ServerGameTags001",0);
g_GameDLL = pCVar3;
goto LAB_00215b69;
}
ConMsg("Could not get IServerGameEnts interface from library %s","server_srv.so");
}
}
LAB_00215d14:
(**(code **)(*g_pFileSystem + 0x6c))(g_pFileSystem,pCVar3);
serverGameDLL = (int *)0x0;
serverGameEnts = 0;
serverGameClients = 0;
return;
}
ConMsg("Failed to load %s\n","server_srv.so");
LAB_00215b69:
if (serverGameDLL != (int *)0x0) {
uVar4 = (**(code **)(*serverGameDLL + 0x2c))(serverGameDLL);
Msg("Game%s loaded for \"%s\"\n","_srv.so",uVar4);
}
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.