Host_ParseConfiguration
0x0017e100 · 641 bytes · __cdecl
_Z23Host_ParseConfigurationb
Decompiled
undefined (1 param)
/* Host_ParseConfiguration(bool) */
void Host_ParseConfiguration(bool param_1)
{
char cVar1;
int iVar2;
int iVar3;
char *__ptr;
char *pcVar4;
FILE *__s;
long lVar5;
uint *extraout_EDX;
int in_GS_OFFSET;
int local_124;
char local_120 [256];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
_V_strcpy(spszVersionString,"1.0.1.0");
sHostVersion = VerToInt(spszVersionString);
_V_strcpy(spszProductString,"valve");
local_124 = 0;
cVar1 = ParseSteamInfFile((char *)&local_124,extraout_EDX);
if (cVar1 == '\0') {
Sys_Error("Unable to load version from steam.inf");
}
iVar2 = (**(code **)(*(int *)(g_pFileSystem + 4) + 8))
(g_pFileSystem + 4,"perforce.inf",&DAT_002a9af2,0);
if (iVar2 == 0) {
__ptr = (char *)0x0;
LAB_0017e262:
free(__ptr);
g_bRunningFromPerforce = false;
}
else {
iVar3 = (**(code **)(*(int *)(g_pFileSystem + 4) + 0x18))(g_pFileSystem + 4,iVar2);
__ptr = malloc(iVar3 + 1);
iVar3 = (*(code *)**(undefined4 **)(g_pFileSystem + 4))(g_pFileSystem + 4,__ptr,iVar3,iVar2);
(**(code **)(*(int *)(g_pFileSystem + 4) + 0xc))(g_pFileSystem + 4,iVar2);
__ptr[iVar3] = '\0';
pcVar4 = __ptr;
do {
pcVar4 = (char *)COM_Parse(pcVar4);
if (pcVar4 == (char *)0x0) goto LAB_0017e262;
iVar2 = _V_strlen(&com_token);
if (iVar2 < 1) goto LAB_0017e262;
iVar2 = _V_strlen("FSKey=");
iVar2 = V_strnicmp(&com_token,"FSKey=",iVar2);
} while (iVar2 != 0);
iVar2 = _V_strlen("FSKey=");
V_strncpy(local_120,&com_token + iVar2,0x3f);
lVar5 = strtol(local_120,(char **)0x0,10);
free(__ptr);
g_bRunningFromPerforce = lVar5 == 0x41447e86;
}
if ((local_124 != 0) && ((param_1 || ((bool)g_bRunningFromPerforce != false)))) {
__s = (FILE *)__wrap_fopen("steam_appid.txt",&DAT_002a5c80);
if (__s != (FILE *)0x0) {
V_snprintf(local_120,0x100,"%u\n",local_124);
iVar2 = _V_strlen(local_120);
fwrite(local_120,iVar2 + 1,1,__s);
fclose(__s);
}
}
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.