summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/patch_manager.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-26 02:09:20 +0200
committerLioncash <mathew1800@gmail.com>2018-09-26 02:09:23 +0200
commit11104b48834b2f8e5c59edc46b794e6ab0bd9c4f (patch)
tree96e9e8906d1facc976b199be17b03094d23310f1 /src/core/file_sys/patch_manager.cpp
parentvfs_vector: Amend initializer list order in VectorVfsFile's constructor initializer list (diff)
downloadyuzu-11104b48834b2f8e5c59edc46b794e6ab0bd9c4f.tar
yuzu-11104b48834b2f8e5c59edc46b794e6ab0bd9c4f.tar.gz
yuzu-11104b48834b2f8e5c59edc46b794e6ab0bd9c4f.tar.bz2
yuzu-11104b48834b2f8e5c59edc46b794e6ab0bd9c4f.tar.lz
yuzu-11104b48834b2f8e5c59edc46b794e6ab0bd9c4f.tar.xz
yuzu-11104b48834b2f8e5c59edc46b794e6ab0bd9c4f.tar.zst
yuzu-11104b48834b2f8e5c59edc46b794e6ab0bd9c4f.zip
Diffstat (limited to 'src/core/file_sys/patch_manager.cpp')
-rw-r--r--src/core/file_sys/patch_manager.cpp57
1 files changed, 30 insertions, 27 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index 561ad67a7..4b3b5e665 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -70,37 +70,40 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType type) {
const auto load_dir = Service::FileSystem::GetModificationLoadRoot(title_id);
- if (type == ContentRecordType::Program && load_dir != nullptr && load_dir->GetSize() > 0) {
- auto extracted = ExtractRomFS(romfs);
-
- if (extracted != nullptr) {
- auto patch_dirs = load_dir->GetSubdirectories();
- std::sort(patch_dirs.begin(), patch_dirs.end(),
- [](const VirtualDir& l, const VirtualDir& r) {
- return l->GetName() < r->GetName();
- });
-
- std::vector<VirtualDir> layers;
- layers.reserve(patch_dirs.size() + 1);
- for (const auto& subdir : patch_dirs) {
- auto romfs_dir = subdir->GetSubdirectory("romfs");
- if (romfs_dir != nullptr)
- layers.push_back(std::move(romfs_dir));
- }
+ if (type != ContentRecordType::Program || load_dir == nullptr || load_dir->GetSize() <= 0) {
+ return;
+ }
- layers.push_back(std::move(extracted));
+ auto extracted = ExtractRomFS(romfs);
+ if (extracted == nullptr) {
+ return;
+ }
- auto layered = LayeredVfsDirectory::MakeLayeredDirectory(std::move(layers));
- if (layered != nullptr) {
- auto packed = CreateRomFS(std::move(layered));
+ auto patch_dirs = load_dir->GetSubdirectories();
+ std::sort(patch_dirs.begin(), patch_dirs.end(),
+ [](const VirtualDir& l, const VirtualDir& r) { return l->GetName() < r->GetName(); });
- if (packed != nullptr) {
- LOG_INFO(Loader, " RomFS: LayeredFS patches applied successfully");
- romfs = std::move(packed);
- }
- }
- }
+ std::vector<VirtualDir> layers;
+ layers.reserve(patch_dirs.size() + 1);
+ for (const auto& subdir : patch_dirs) {
+ auto romfs_dir = subdir->GetSubdirectory("romfs");
+ if (romfs_dir != nullptr)
+ layers.push_back(std::move(romfs_dir));
}
+ layers.push_back(std::move(extracted));
+
+ auto layered = LayeredVfsDirectory::MakeLayeredDirectory(std::move(layers));
+ if (layered == nullptr) {
+ return;
+ }
+
+ auto packed = CreateRomFS(std::move(layered));
+ if (packed == nullptr) {
+ return;
+ }
+
+ LOG_INFO(Loader, " RomFS: LayeredFS patches applied successfully");
+ romfs = std::move(packed);
}
VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset,