| 337 | } |
| 338 | |
| 339 | void ReloadMetaLayer() { |
| 340 | Meta->Load(); |
| 341 | |
| 342 | const fextl::string ContainerPrefix {FindContainerPrefix()}; |
| 343 | auto ExpandPathIfExists = [&ContainerPrefix](FEXCore::Config::ConfigOption Config, const fextl::string& PathName) { |
| 344 | const auto NewPath = ExpandPath(ContainerPrefix, PathName); |
| 345 | if (!NewPath.empty()) { |
| 346 | FEXCore::Config::Set(Config, NewPath); |
| 347 | } |
| 348 | }; |
| 349 | |
| 350 | if (FEXCore::Config::Exists(FEXCore::Config::CONFIG_ROOTFS)) { |
| 351 | const auto PathName = *Meta->Get(FEXCore::Config::CONFIG_ROOTFS); |
| 352 | const auto ExpandedString = ExpandPath(ContainerPrefix, *PathName); |
| 353 | if (!ExpandedString.empty()) { |
| 354 | // Adjust the path if it ended up being relative |
| 355 | FEXCore::Config::Set(FEXCore::Config::CONFIG_ROOTFS, ExpandedString); |
| 356 | } else if (!PathName->empty()) { |
| 357 | // If the filesystem doesn't exist then let's see if it exists in the fex-emu folder |
| 358 | const auto PathNameCopy = *PathName; |
| 359 | for (auto Global : {true, false}) { |
| 360 | for (auto DirectoryFetchers : {GetDataDirectory, GetConfigDirectory}) { |
| 361 | fextl::string NamedRootFS = DirectoryFetchers(Global) + "RootFS/" + PathNameCopy; |
| 362 | if (FHU::Filesystem::Exists(NamedRootFS)) { |
| 363 | FEXCore::Config::Set(FEXCore::Config::CONFIG_ROOTFS, NamedRootFS); |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | if (FEXCore::Config::Exists(FEXCore::Config::CONFIG_THUNKHOSTLIBS)) { |
| 370 | const auto PathName = *Meta->Get(FEXCore::Config::CONFIG_THUNKHOSTLIBS); |
| 371 | ExpandPathIfExists(FEXCore::Config::CONFIG_THUNKHOSTLIBS, *PathName); |
| 372 | } |
| 373 | if (FEXCore::Config::Exists(FEXCore::Config::CONFIG_THUNKGUESTLIBS)) { |
| 374 | const auto PathName = *Meta->Get(FEXCore::Config::CONFIG_THUNKGUESTLIBS); |
| 375 | ExpandPathIfExists(FEXCore::Config::CONFIG_THUNKGUESTLIBS, *PathName); |
| 376 | } |
| 377 | if (FEXCore::Config::Exists(FEXCore::Config::CONFIG_THUNKCONFIG)) { |
| 378 | const auto PathName = *Meta->Get(FEXCore::Config::CONFIG_THUNKCONFIG); |
| 379 | const auto ExpandedString = ExpandPath(ContainerPrefix, *PathName); |
| 380 | if (!ExpandedString.empty()) { |
| 381 | // Adjust the path if it ended up being relative |
| 382 | FEXCore::Config::Set(FEXCore::Config::CONFIG_THUNKCONFIG, ExpandedString); |
| 383 | } else if (!PathName->empty()) { |
| 384 | // If the filesystem doesn't exist then let's see if it exists in the fex-emu folder |
| 385 | const auto PathNameCopy = *PathName; |
| 386 | for (auto Global : {true, false}) { |
| 387 | for (auto DirectoryFetchers : {GetDataDirectory, GetConfigDirectory}) { |
| 388 | fextl::string NamedConfig = DirectoryFetchers(Global) + "ThunkConfigs/" + PathNameCopy; |
| 389 | if (FHU::Filesystem::Exists(NamedConfig)) { |
| 390 | FEXCore::Config::Set(FEXCore::Config::CONFIG_THUNKCONFIG, NamedConfig); |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | } |
| 396 | if (FEXCore::Config::Exists(FEXCore::Config::CONFIG_OUTPUTLOG)) { |