From d79d4fd764c194e6c8c4d57ed0fd308e401c2f6e Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Tue, 25 Sep 2018 09:19:42 -0400 Subject: patch_manager: Add support for packed updates Will prefer any installed update over the packed version. --- src/core/file_sys/patch_manager.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/core/file_sys/patch_manager.cpp') diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 539698f6e..b43880e92 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp @@ -184,8 +184,8 @@ static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType t romfs = std::move(packed); } -VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, - ContentRecordType type) const { +VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, ContentRecordType type, + VirtualFile update_raw) const { LOG_INFO(Loader, "Patching RomFS for title_id={:016X}, type={:02X}", title_id, static_cast(type)); @@ -205,6 +205,13 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, FormatTitleVersion(installed->GetEntryVersion(update_tid).get_value_or(0))); romfs = new_nca->GetRomFS(); } + } else if (update_raw != nullptr) { + const auto new_nca = std::make_shared(update, romfs, ivfc_offset); + if (new_nca->GetStatus() == Loader::ResultStatus::Success && + new_nca->GetRomFS() != nullptr) { + LOG_INFO(Loader, " RomFS: Update (XCI) applied successfully"); + romfs = new_nca->GetRomFS(); + } } // LayeredFS @@ -224,7 +231,7 @@ static bool IsDirValidAndNonEmpty(const VirtualDir& dir) { return dir != nullptr && (!dir->GetFiles().empty() || !dir->GetSubdirectories().empty()); } -std::map> PatchManager::GetPatchVersionNames() const { +std::map PatchManager::GetPatchVersionNames(VirtualFile update_raw) const { std::map> out; const auto installed = Service::FileSystem::GetUnionContents(); @@ -245,6 +252,8 @@ std::map> PatchManager::GetPatchVersionNam "Update", FormatTitleVersion(meta_ver.get(), TitleVersionFormat::ThreeElements)); } + } else if (update_raw != nullptr) { + out[PatchType::Update] = "XCI"; } } -- cgit v1.2.3 From 5acaeb04c4f4ebdffda37717347f6a0c82a71aa4 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Tue, 25 Sep 2018 14:07:13 -0400 Subject: patch_manager: Add support for NSP packed updates Reads as Update (NSP) in add-ons --- src/core/file_sys/patch_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys/patch_manager.cpp') diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index b43880e92..3fc44fb5c 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp @@ -209,7 +209,7 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, Content const auto new_nca = std::make_shared(update, romfs, ivfc_offset); if (new_nca->GetStatus() == Loader::ResultStatus::Success && new_nca->GetRomFS() != nullptr) { - LOG_INFO(Loader, " RomFS: Update (XCI) applied successfully"); + LOG_INFO(Loader, " RomFS: Update (PACKED) applied successfully"); romfs = new_nca->GetRomFS(); } } @@ -253,7 +253,7 @@ std::map PatchManager::GetPatchVersionNames(VirtualFile FormatTitleVersion(meta_ver.get(), TitleVersionFormat::ThreeElements)); } } else if (update_raw != nullptr) { - out[PatchType::Update] = "XCI"; + out[PatchType::Update] = "PACKED"; } } -- cgit v1.2.3 From 38c2ac95af814e21e65e2785b276c4f64bfead71 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Fri, 5 Oct 2018 08:53:45 -0400 Subject: romfs_factory: Extract packed update setter to new function --- src/core/file_sys/patch_manager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core/file_sys/patch_manager.cpp') diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 3fc44fb5c..1ac00ebb0 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp @@ -206,7 +206,7 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, Content romfs = new_nca->GetRomFS(); } } else if (update_raw != nullptr) { - const auto new_nca = std::make_shared(update, romfs, ivfc_offset); + const auto new_nca = std::make_shared(update_raw, romfs, ivfc_offset); if (new_nca->GetStatus() == Loader::ResultStatus::Success && new_nca->GetRomFS() != nullptr) { LOG_INFO(Loader, " RomFS: Update (PACKED) applied successfully"); @@ -231,7 +231,8 @@ static bool IsDirValidAndNonEmpty(const VirtualDir& dir) { return dir != nullptr && (!dir->GetFiles().empty() || !dir->GetSubdirectories().empty()); } -std::map PatchManager::GetPatchVersionNames(VirtualFile update_raw) const { +std::map> PatchManager::GetPatchVersionNames( + VirtualFile update_raw) const { std::map> out; const auto installed = Service::FileSystem::GetUnionContents(); @@ -253,7 +254,7 @@ std::map PatchManager::GetPatchVersionNames(VirtualFile FormatTitleVersion(meta_ver.get(), TitleVersionFormat::ThreeElements)); } } else if (update_raw != nullptr) { - out[PatchType::Update] = "PACKED"; + out.insert_or_assign("Update", "PACKED"); } } -- cgit v1.2.3