diff options
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 15 | ||||
| -rw-r--r-- | src/core/file_sys/patch_manager.h | 3 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.h | 1 |
4 files changed, 18 insertions, 5 deletions
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 | |||
| 184 | romfs = std::move(packed); | 184 | romfs = std::move(packed); |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, | 187 | VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, ContentRecordType type, |
| 188 | ContentRecordType type) const { | 188 | VirtualFile update_raw) const { |
| 189 | LOG_INFO(Loader, "Patching RomFS for title_id={:016X}, type={:02X}", title_id, | 189 | LOG_INFO(Loader, "Patching RomFS for title_id={:016X}, type={:02X}", title_id, |
| 190 | static_cast<u8>(type)); | 190 | static_cast<u8>(type)); |
| 191 | 191 | ||
| @@ -205,6 +205,13 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, | |||
| 205 | FormatTitleVersion(installed->GetEntryVersion(update_tid).get_value_or(0))); | 205 | FormatTitleVersion(installed->GetEntryVersion(update_tid).get_value_or(0))); |
| 206 | romfs = new_nca->GetRomFS(); | 206 | romfs = new_nca->GetRomFS(); |
| 207 | } | 207 | } |
| 208 | } else if (update_raw != nullptr) { | ||
| 209 | const auto new_nca = std::make_shared<NCA>(update, romfs, ivfc_offset); | ||
| 210 | if (new_nca->GetStatus() == Loader::ResultStatus::Success && | ||
| 211 | new_nca->GetRomFS() != nullptr) { | ||
| 212 | LOG_INFO(Loader, " RomFS: Update (XCI) applied successfully"); | ||
| 213 | romfs = new_nca->GetRomFS(); | ||
| 214 | } | ||
| 208 | } | 215 | } |
| 209 | 216 | ||
| 210 | // LayeredFS | 217 | // LayeredFS |
| @@ -224,7 +231,7 @@ static bool IsDirValidAndNonEmpty(const VirtualDir& dir) { | |||
| 224 | return dir != nullptr && (!dir->GetFiles().empty() || !dir->GetSubdirectories().empty()); | 231 | return dir != nullptr && (!dir->GetFiles().empty() || !dir->GetSubdirectories().empty()); |
| 225 | } | 232 | } |
| 226 | 233 | ||
| 227 | std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNames() const { | 234 | std::map<PatchType, std::string> PatchManager::GetPatchVersionNames(VirtualFile update_raw) const { |
| 228 | std::map<std::string, std::string, std::less<>> out; | 235 | std::map<std::string, std::string, std::less<>> out; |
| 229 | const auto installed = Service::FileSystem::GetUnionContents(); | 236 | const auto installed = Service::FileSystem::GetUnionContents(); |
| 230 | 237 | ||
| @@ -245,6 +252,8 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam | |||
| 245 | "Update", | 252 | "Update", |
| 246 | FormatTitleVersion(meta_ver.get(), TitleVersionFormat::ThreeElements)); | 253 | FormatTitleVersion(meta_ver.get(), TitleVersionFormat::ThreeElements)); |
| 247 | } | 254 | } |
| 255 | } else if (update_raw != nullptr) { | ||
| 256 | out[PatchType::Update] = "XCI"; | ||
| 248 | } | 257 | } |
| 249 | } | 258 | } |
| 250 | 259 | ||
diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index 6a864ec43..e87ce54e5 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h | |||
| @@ -46,7 +46,8 @@ public: | |||
| 46 | // - Game Updates | 46 | // - Game Updates |
| 47 | // - LayeredFS | 47 | // - LayeredFS |
| 48 | VirtualFile PatchRomFS(VirtualFile base, u64 ivfc_offset, | 48 | VirtualFile PatchRomFS(VirtualFile base, u64 ivfc_offset, |
| 49 | ContentRecordType type = ContentRecordType::Program) const; | 49 | ContentRecordType type = ContentRecordType::Program, |
| 50 | VirtualFile update_raw = nullptr) const; | ||
| 50 | 51 | ||
| 51 | // Returns a vector of pairs between patch names and patch versions. | 52 | // Returns a vector of pairs between patch names and patch versions. |
| 52 | // i.e. Update 3.2.2 will return {"Update", "3.2.2"} | 53 | // i.e. Update 3.2.2 will return {"Update", "3.2.2"} |
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index 4994c2532..a0ee16895 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp | |||
| @@ -24,6 +24,7 @@ RomFSFactory::RomFSFactory(Loader::AppLoader& app_loader) { | |||
| 24 | LOG_ERROR(Service_FS, "Unable to read RomFS!"); | 24 | LOG_ERROR(Service_FS, "Unable to read RomFS!"); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | app_loader.ReadUpdateRaw(update_raw); | ||
| 27 | updatable = app_loader.IsRomFSUpdatable(); | 28 | updatable = app_loader.IsRomFSUpdatable(); |
| 28 | ivfc_offset = app_loader.ReadRomFSIVFCOffset(); | 29 | ivfc_offset = app_loader.ReadRomFSIVFCOffset(); |
| 29 | } | 30 | } |
| @@ -35,7 +36,8 @@ ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess() { | |||
| 35 | return MakeResult<VirtualFile>(file); | 36 | return MakeResult<VirtualFile>(file); |
| 36 | 37 | ||
| 37 | const PatchManager patch_manager(Core::CurrentProcess()->GetTitleID()); | 38 | const PatchManager patch_manager(Core::CurrentProcess()->GetTitleID()); |
| 38 | return MakeResult<VirtualFile>(patch_manager.PatchRomFS(file, ivfc_offset)); | 39 | return MakeResult<VirtualFile>( |
| 40 | patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw)); | ||
| 39 | } | 41 | } |
| 40 | 42 | ||
| 41 | ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) { | 43 | ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) { |
diff --git a/src/core/file_sys/romfs_factory.h b/src/core/file_sys/romfs_factory.h index 2cace8180..1cd4cedf1 100644 --- a/src/core/file_sys/romfs_factory.h +++ b/src/core/file_sys/romfs_factory.h | |||
| @@ -37,6 +37,7 @@ public: | |||
| 37 | 37 | ||
| 38 | private: | 38 | private: |
| 39 | VirtualFile file; | 39 | VirtualFile file; |
| 40 | VirtualFile update_raw; | ||
| 40 | bool updatable; | 41 | bool updatable; |
| 41 | u64 ivfc_offset; | 42 | u64 ivfc_offset; |
| 42 | }; | 43 | }; |