| 449 | } |
| 450 | |
| 451 | void 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 |
| 500 | const char* FindUserHomeThroughUID() { |
no test coverage detected