FileSystem_LoadSearchPaths
0x000d8a60 · 789 bytes · __cdecl
_Z26FileSystem_LoadSearchPathsR18CFSSearchPathsInit
Decompiled
undefined (1 param)
/* FileSystem_LoadSearchPaths(CFSSearchPathsInit&) */
int FileSystem_LoadSearchPaths(CFSSearchPathsInit *param_1)
{
char cVar1;
bool bVar2;
KeyValues *this;
char *pcVar3;
char *pcVar4;
int iVar5;
char *pcVar6;
int in_GS_OFFSET;
undefined8 uVar7;
bool local_235;
KeyValues *local_234;
KeyValues *local_230;
KeyValues *local_22c;
char local_228 [260];
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if ((*(int *)(param_1 + 8) == 0) || (*(char **)param_1 == (char *)0x0)) {
iVar5 = SetupFileSystemError(0,3,"FileSystem_LoadSearchPaths: Invalid parameters specified.");
}
else {
uVar7 = LoadGameInfoFile(*(char **)param_1,&local_234,&local_230,&local_22c);
iVar5 = (int)uVar7;
if (iVar5 == 0) {
cVar1 = FileSystem_GetBaseDir(local_228,(int)((ulonglong)uVar7 >> 0x20));
if (cVar1 != '\0') {
param_1[0xc] = (CFSSearchPathsInit)0x0;
bVar2 = (bool)IsLowViolenceBuild();
local_235 = true;
this = (KeyValues *)KeyValues::GetFirstValue(local_22c);
joined_r0x000d8b1a:
if (this != (KeyValues *)0x0) {
do {
pcVar3 = (char *)KeyValues::GetName(this);
pcVar4 = (char *)KeyValues::GetString(this,(char *)0x0,"");
iVar5 = V_stristr(pcVar4,"WebDavRedirector");
if (iVar5 == 0) {
pcVar6 = (char *)V_stristr(pcVar4,"|gameinfo_path|");
if (pcVar4 == pcVar6) {
FileSystem_AddLoadedSearchPath
(param_1,pcVar3,&local_235,true,*(char **)param_1,pcVar4 + 0xf,bVar2);
}
else {
pcVar6 = (char *)V_stristr(pcVar4,"|all_source_engine_paths|");
if (pcVar4 != pcVar6) goto LAB_000d8baa;
pcVar6 = pcVar4 + 0x19;
FileSystem_AddLoadedSearchPath
(param_1,pcVar3,&local_235,false,local_228,pcVar6,bVar2);
cVar1 = FileSystem_IsHldsUpdateToolDedicatedServer();
if (cVar1 != '\0') goto code_r0x000d8d62;
}
}
this = (KeyValues *)KeyValues::GetNextValue(this);
if (this == (KeyValues *)0x0) break;
} while( true );
}
KeyValues::deleteThis();
(**(code **)(**(int **)(param_1 + 8) + 0x2c))(*(int **)(param_1 + 8),"executable_path",1);
(**(code **)(**(int **)(param_1 + 8) + 0x2c))(*(int **)(param_1 + 8),"gamebin",1);
(**(code **)(**(int **)(param_1 + 8) + 0x2c))(*(int **)(param_1 + 8),&DAT_002a3f11,1);
if (param_1[0xc] == (CFSSearchPathsInit)0x0) {
iVar5 = 0;
}
else {
(**(code **)(**(int **)(param_1 + 8) + 0x1c))
(*(int **)(param_1 + 8),param_1 + 0xc,"DEFAULT_WRITE_PATH",1,0);
iVar5 = 0;
}
goto LAB_000d8ab9;
}
iVar5 = SetupFileSystemError(0,3,"FileSystem_GetBaseDir failed.");
}
}
LAB_000d8ab9:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return iVar5;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
code_r0x000d8d62:
pcVar4 = local_124;
V_snprintf(pcVar4,0x104,"..%c%s",0x2f,pcVar6);
LAB_000d8baa:
FileSystem_AddLoadedSearchPath(param_1,pcVar3,&local_235,false,local_228,pcVar4,bVar2);
this = (KeyValues *)KeyValues::GetNextValue(this);
goto joined_r0x000d8b1a;
}
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.