diff options
| author | 2022-04-07 23:02:44 +0200 | |
|---|---|---|
| committer | 2022-04-07 23:02:44 +0200 | |
| commit | f05e87402ae977dc515484ba643562e7ecb2fd68 (patch) | |
| tree | d809e5eea86ab5b4429d13114fa8abe02b03974d /src | |
| parent | Merge pull request #8162 from german77/bombslinger (diff) | |
| download | yuzu-f05e87402ae977dc515484ba643562e7ecb2fd68.tar.gz yuzu-f05e87402ae977dc515484ba643562e7ecb2fd68.tar.xz yuzu-f05e87402ae977dc515484ba643562e7ecb2fd68.zip | |
patch_manager: Apply layered exefs patches from 'atmosphere' SD directory
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 63 |
1 files changed, 38 insertions, 25 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index c4e185757..73e724f3d 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -148,29 +148,33 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { | |||
| 148 | 148 | ||
| 149 | // LayeredExeFS | 149 | // LayeredExeFS |
| 150 | const auto load_dir = fs_controller.GetModificationLoadRoot(title_id); | 150 | const auto load_dir = fs_controller.GetModificationLoadRoot(title_id); |
| 151 | const auto sdmc_load_dir = fs_controller.GetSDMCModificationLoadRoot(title_id); | ||
| 152 | |||
| 153 | std::vector<VirtualDir> patch_dirs = {sdmc_load_dir}; | ||
| 151 | if (load_dir != nullptr && load_dir->GetSize() > 0) { | 154 | if (load_dir != nullptr && load_dir->GetSize() > 0) { |
| 152 | auto patch_dirs = load_dir->GetSubdirectories(); | 155 | const auto load_patch_dirs = load_dir->GetSubdirectories(); |
| 153 | std::sort( | 156 | patch_dirs.insert(patch_dirs.end(), load_patch_dirs.begin(), load_patch_dirs.end()); |
| 154 | patch_dirs.begin(), patch_dirs.end(), | 157 | } |
| 155 | [](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); }); | ||
| 156 | |||
| 157 | std::vector<VirtualDir> layers; | ||
| 158 | layers.reserve(patch_dirs.size() + 1); | ||
| 159 | for (const auto& subdir : patch_dirs) { | ||
| 160 | if (std::find(disabled.begin(), disabled.end(), subdir->GetName()) != disabled.end()) | ||
| 161 | continue; | ||
| 162 | 158 | ||
| 163 | auto exefs_dir = FindSubdirectoryCaseless(subdir, "exefs"); | 159 | std::sort(patch_dirs.begin(), patch_dirs.end(), |
| 164 | if (exefs_dir != nullptr) | 160 | [](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); }); |
| 165 | layers.push_back(std::move(exefs_dir)); | ||
| 166 | } | ||
| 167 | layers.push_back(exefs); | ||
| 168 | 161 | ||
| 169 | auto layered = LayeredVfsDirectory::MakeLayeredDirectory(std::move(layers)); | 162 | std::vector<VirtualDir> layers; |
| 170 | if (layered != nullptr) { | 163 | layers.reserve(patch_dirs.size() + 1); |
| 171 | LOG_INFO(Loader, " ExeFS: LayeredExeFS patches applied successfully"); | 164 | for (const auto& subdir : patch_dirs) { |
| 172 | exefs = std::move(layered); | 165 | if (std::find(disabled.begin(), disabled.end(), subdir->GetName()) != disabled.end()) |
| 173 | } | 166 | continue; |
| 167 | |||
| 168 | auto exefs_dir = FindSubdirectoryCaseless(subdir, "exefs"); | ||
| 169 | if (exefs_dir != nullptr) | ||
| 170 | layers.push_back(std::move(exefs_dir)); | ||
| 171 | } | ||
| 172 | layers.push_back(exefs); | ||
| 173 | |||
| 174 | auto layered = LayeredVfsDirectory::MakeLayeredDirectory(std::move(layers)); | ||
| 175 | if (layered != nullptr) { | ||
| 176 | LOG_INFO(Loader, " ExeFS: LayeredExeFS patches applied successfully"); | ||
| 177 | exefs = std::move(layered); | ||
| 174 | } | 178 | } |
| 175 | 179 | ||
| 176 | if (Settings::values.dump_exefs) { | 180 | if (Settings::values.dump_exefs) { |
| @@ -536,11 +540,20 @@ PatchManager::PatchVersionNames PatchManager::GetPatchVersionNames(VirtualFile u | |||
| 536 | 540 | ||
| 537 | // SDMC mod directory (RomFS LayeredFS) | 541 | // SDMC mod directory (RomFS LayeredFS) |
| 538 | const auto sdmc_mod_dir = fs_controller.GetSDMCModificationLoadRoot(title_id); | 542 | const auto sdmc_mod_dir = fs_controller.GetSDMCModificationLoadRoot(title_id); |
| 539 | if (sdmc_mod_dir != nullptr && sdmc_mod_dir->GetSize() > 0 && | 543 | if (sdmc_mod_dir != nullptr && sdmc_mod_dir->GetSize() > 0) { |
| 540 | IsDirValidAndNonEmpty(FindSubdirectoryCaseless(sdmc_mod_dir, "romfs"))) { | 544 | std::string types; |
| 541 | const auto mod_disabled = | 545 | if (IsDirValidAndNonEmpty(FindSubdirectoryCaseless(sdmc_mod_dir, "exefs"))) { |
| 542 | std::find(disabled.begin(), disabled.end(), "SDMC") != disabled.end(); | 546 | AppendCommaIfNotEmpty(types, "LayeredExeFS"); |
| 543 | out.insert_or_assign(mod_disabled ? "[D] SDMC" : "SDMC", "LayeredFS"); | 547 | } |
| 548 | if (IsDirValidAndNonEmpty(FindSubdirectoryCaseless(sdmc_mod_dir, "romfs"))) { | ||
| 549 | AppendCommaIfNotEmpty(types, "LayeredFS"); | ||
| 550 | } | ||
| 551 | |||
| 552 | if (!types.empty()) { | ||
| 553 | const auto mod_disabled = | ||
| 554 | std::find(disabled.begin(), disabled.end(), "SDMC") != disabled.end(); | ||
| 555 | out.insert_or_assign(mod_disabled ? "[D] SDMC" : "SDMC", types); | ||
| 556 | } | ||
| 544 | } | 557 | } |
| 545 | 558 | ||
| 546 | // DLC | 559 | // DLC |