diff options
| author | 2021-06-15 19:59:10 -0400 | |
|---|---|---|
| committer | 2021-06-28 10:08:08 -0400 | |
| commit | 844e0114b07f38feaf948d66a1336d350cfa6c6d (patch) | |
| tree | 054ecb8b45f2a550c2f8001a1b3abbd42afb9c04 /src/core/file_sys | |
| parent | core: Support LayeredFS mod from SDMC directory (diff) | |
| download | yuzu-844e0114b07f38feaf948d66a1336d350cfa6c6d.tar.gz yuzu-844e0114b07f38feaf948d66a1336d350cfa6c6d.tar.xz yuzu-844e0114b07f38feaf948d66a1336d350cfa6c6d.zip | |
core: Simplify SDMC mod loading
If someone else wants to support other mod formats in the SDMC
directory, that can be added later. For now, just allow RomFS modding
here and force people to do other types of mods the old way.
Addresses review comments.
Co-authored-by: LC <mathew1800@gmail.com>
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 25 | ||||
| -rw-r--r-- | src/core/file_sys/sdmc_factory.cpp | 3 |
2 files changed, 8 insertions, 20 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 6f5aa6da2..13d294ad8 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -529,26 +529,13 @@ PatchManager::PatchVersionNames PatchManager::GetPatchVersionNames(VirtualFile u | |||
| 529 | } | 529 | } |
| 530 | } | 530 | } |
| 531 | 531 | ||
| 532 | // SDMC mod directory (LayeredFS) | 532 | // SDMC mod directory (RomFS LayeredFS) |
| 533 | const auto sdmc_mod_dir = fs_controller.GetSDMCModificationLoadRoot(title_id); | 533 | const auto sdmc_mod_dir = fs_controller.GetSDMCModificationLoadRoot(title_id); |
| 534 | if (sdmc_mod_dir != nullptr && sdmc_mod_dir->GetSize() > 0) { | 534 | if (sdmc_mod_dir != nullptr && sdmc_mod_dir->GetSize() > 0 && |
| 535 | std::string types; | 535 | IsDirValidAndNonEmpty(FindSubdirectoryCaseless(sdmc_mod_dir, "romfs"))) { |
| 536 | 536 | const auto mod_disabled = | |
| 537 | const auto exefs_dir = FindSubdirectoryCaseless(sdmc_mod_dir, "exefs"); | 537 | std::find(disabled.begin(), disabled.end(), "SDMC") != disabled.end(); |
| 538 | if (IsDirValidAndNonEmpty(exefs_dir)) { | 538 | out.insert_or_assign(mod_disabled ? "[D] SDMC" : "SDMC", "LayeredFS"); |
| 539 | bool layeredfs = false; | ||
| 540 | |||
| 541 | if (layeredfs) | ||
| 542 | AppendCommaIfNotEmpty(types, "LayeredExeFS"); | ||
| 543 | } | ||
| 544 | if (IsDirValidAndNonEmpty(FindSubdirectoryCaseless(sdmc_mod_dir, "romfs"))) | ||
| 545 | AppendCommaIfNotEmpty(types, "LayeredFS"); | ||
| 546 | |||
| 547 | if (!types.empty()) { | ||
| 548 | const auto mod_disabled = | ||
| 549 | std::find(disabled.begin(), disabled.end(), "SDMC") != disabled.end(); | ||
| 550 | out.insert_or_assign(mod_disabled ? "[D] SDMC" : "SDMC", types); | ||
| 551 | } | ||
| 552 | } | 539 | } |
| 553 | 540 | ||
| 554 | // DLC | 541 | // DLC |
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp index f4dba8f16..7e878123c 100644 --- a/src/core/file_sys/sdmc_factory.cpp +++ b/src/core/file_sys/sdmc_factory.cpp | |||
| @@ -29,8 +29,9 @@ ResultVal<VirtualDir> SDMCFactory::Open() const { | |||
| 29 | 29 | ||
| 30 | VirtualDir SDMCFactory::GetSDMCModificationLoadRoot(u64 title_id) const { | 30 | VirtualDir SDMCFactory::GetSDMCModificationLoadRoot(u64 title_id) const { |
| 31 | // LayeredFS doesn't work on updates and title id-less homebrew | 31 | // LayeredFS doesn't work on updates and title id-less homebrew |
| 32 | if (title_id == 0 || (title_id & 0xFFF) == 0x800) | 32 | if (title_id == 0 || (title_id & 0xFFF) == 0x800) { |
| 33 | return nullptr; | 33 | return nullptr; |
| 34 | } | ||
| 34 | return GetOrCreateDirectoryRelative(dir, fmt::format("/atmosphere/contents/{:016X}", title_id)); | 35 | return GetOrCreateDirectoryRelative(dir, fmt::format("/atmosphere/contents/{:016X}", title_id)); |
| 35 | } | 36 | } |
| 36 | 37 | ||