MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / LoadConfig

Function LoadConfig

Source/Common/Config.cpp:451–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449}
450
451void LoadConfig(fextl::unique_ptr<FEX::ArgLoader::ArgLoader> ArgsLoader, fextl::string ProgramName, char** const envp,
452 const PortableInformation& PortableInfo) {
453 const bool IsPortable = PortableInfo.IsPortable;
454 FEX::Config::InitializeConfigs(PortableInfo);
455 FEXCore::Config::Initialize();
456 if (!IsPortable) {
457 FEXCore::Config::AddLayer(CreateGlobalMainLayer());
458 }
459 FEXCore::Config::AddLayer(CreateMainLayer());
460
461 if (!ProgramName.empty()) {
462 if (!IsPortable) {
463 FEXCore::Config::AddLayer(CreateAppLayer(ProgramName, FEXCore::Config::LayerType::LAYER_GLOBAL_APP));
464 }
465 FEXCore::Config::AddLayer(CreateAppLayer(ProgramName, FEXCore::Config::LayerType::LAYER_LOCAL_APP));
466
467 auto SteamID = getenv("SteamAppId");
468 if (SteamID) {
469 // If a SteamID exists then let's search for Steam application configs as well.
470 // We want to key off both the SteamAppId number /and/ the executable since we may not want to thunk all binaries.
471 fextl::string SteamAppName = fextl::fmt::format("Steam_{}_{}", SteamID, ProgramName);
472 if (!IsPortable) {
473 FEXCore::Config::AddLayer(CreateAppLayer(SteamAppName, FEXCore::Config::LayerType::LAYER_GLOBAL_STEAM_APP));
474 }
475 FEXCore::Config::AddLayer(CreateAppLayer(SteamAppName, FEXCore::Config::LayerType::LAYER_LOCAL_STEAM_APP));
476 }
477 }
478
479 if (ArgsLoader && ArgsLoader->GetLoadType() == FEX::ArgLoader::ArgLoader::LoadType::WITH_FEXLOADER_PARSER) {
480 FEXCore::Config::AddLayer(std::move(ArgsLoader));
481 }
482
483 const char* AppConfig = getenv("FEX_APP_CONFIG");
484 if (AppConfig) {
485 fextl::string AppConfigStr = AppConfig;
486 if (IsPortable && FHU::Filesystem::IsRelative(AppConfig)) {
487 AppConfigStr = PortableInfo.InterpreterPath + AppConfigStr;
488 }
489
490 if (FHU::Filesystem::Exists(AppConfigStr)) {
491 FEXCore::Config::AddLayer(CreateUserOverrideLayer(AppConfigStr));
492 }
493 }
494
495 FEXCore::Config::AddLayer(CreateEnvironmentLayer(envp));
496 FEXCore::Config::Load();
497}
498
499#ifndef _WIN32
500const char* FindUserHomeThroughUID() {

Callers 5

ProcessInitFunction · 0.85
BTCpuProcessInitFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 14

InitializeConfigsFunction · 0.85
AddLayerFunction · 0.85
CreateGlobalMainLayerFunction · 0.85
CreateMainLayerFunction · 0.85
CreateAppLayerFunction · 0.85
getenvFunction · 0.85
formatFunction · 0.85
IsRelativeFunction · 0.85
CreateUserOverrideLayerFunction · 0.85
CreateEnvironmentLayerFunction · 0.85
GetLoadTypeMethod · 0.80
InitializeFunction · 0.50

Tested by

no test coverage detected