LocateGameInfoFile
0x000d7e90 · 620 bytes · __cdecl
_Z18LocateGameInfoFileRK17CFSSteamSetupInfoPci
Decompiled
undefined (3 params)
/* LocateGameInfoFile(CFSSteamSetupInfo const&, char*, int) */
undefined4 LocateGameInfoFile(CFSSteamSetupInfo *param_1,char *param_2,int param_3)
{
char cVar1;
undefined4 uVar2;
char *pcVar3;
int iVar4;
bool local_d;
if (param_1[4] != (CFSSteamSetupInfo)0x0) {
if (*(char **)param_1 == (char *)0x0) {
uVar2 = SetupFileSystemError(0,1,"bOnlyUseDirectoryName=1 and pDirectoryName=NULL.");
return uVar2;
}
cVar1 = DoesFileExistIn(*(char **)param_1,"gameinfo.txt");
if (cVar1 == '\0') {
uVar2 = SetupFileSystemError
(1,1,
"Setup file \'%s\' doesn\'t exist in subdirectory \'%s\'.\nCheck your -game parameter or VCONFIG setting."
,"gameinfo.txt",*(undefined4 *)param_1);
return uVar2;
}
V_strncpy(param_2,*(char **)param_1,param_3);
return 0;
}
pcVar3 = (char *)GetVProjectCmdLineValue();
if (pcVar3 == (char *)0x0) {
if (param_1[8] != (CFSSteamSetupInfo)0x0) goto LAB_000d8088;
local_d = true;
if ((((anonymous_namespace)::GetSuggestGameInfoDirFn()::s_pfnSuggestGameInfoDir != (code *)0x0)
&& (cVar1 = (*(anonymous_namespace)::GetSuggestGameInfoDirFn()::s_pfnSuggestGameInfoDir)
(param_1,param_2,param_3,&local_d), cVar1 != '\0')) &&
(iVar4 = TryLocateGameInfoFile(param_2,param_3,local_d), iVar4 == 0)) {
return 0;
}
pcVar3 = getenv("VProject");
if (pcVar3 != (char *)0x0) {
V_MakeAbsolutePath(param_2,param_3,pcVar3,(char *)0x0);
iVar4 = TryLocateGameInfoFile(param_2,param_3,false);
if (iVar4 == 0) {
return 0;
}
}
Warning("Warning: falling back to auto detection of vproject directory.\n");
pcVar3 = *(char **)param_1;
if (pcVar3 == (char *)0x0) {
pcVar3 = ".";
}
V_MakeAbsolutePath(param_2,param_3,pcVar3,(char *)0x0);
iVar4 = TryLocateGameInfoFile(param_2,param_3,true);
if (iVar4 == 0) {
return 0;
}
Q_getwd(param_2,param_3);
iVar4 = TryLocateGameInfoFile(param_2,param_3,true);
if (iVar4 == 0) {
return 0;
}
}
else {
cVar1 = DoesFileExistIn(pcVar3,"gameinfo.txt");
if (cVar1 != '\0') {
V_MakeAbsolutePath(param_2,param_3,pcVar3,(char *)0x0);
return 0;
}
if (param_1[8] != (CFSSteamSetupInfo)0x0) {
LAB_000d8088:
V_strncpy(param_2,"",param_3);
return 0;
}
}
uVar2 = SetupFileSystemError
(1,1,
"Unable to find %s. Solutions:\n\n1. Read http://www.valve-erc.com/srcsdk/faq.html#NoGameDir\n2. Run vconfig to specify which game you\'re working on.\n3. Add -game <path> on the command line where <path> is the directory that %s is in.\n"
,"gameinfo.txt","gameinfo.txt");
return uVar2;
}
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.