diff options
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 22 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.h | 4 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index 987199747..f4e16e4be 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "core/file_sys/card_image.h" | 9 | #include "core/file_sys/card_image.h" |
| 10 | #include "core/file_sys/common_funcs.h" | ||
| 10 | #include "core/file_sys/content_archive.h" | 11 | #include "core/file_sys/content_archive.h" |
| 11 | #include "core/file_sys/nca_metadata.h" | 12 | #include "core/file_sys/nca_metadata.h" |
| 12 | #include "core/file_sys/patch_manager.h" | 13 | #include "core/file_sys/patch_manager.h" |
| @@ -47,6 +48,27 @@ ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_titl | |||
| 47 | patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw)); | 48 | patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw)); |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 51 | ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecordType type) const { | ||
| 52 | auto nca = content_provider.GetEntry(title_id, type); | ||
| 53 | |||
| 54 | if (nca == nullptr) { | ||
| 55 | // TODO: Find the right error code to use here | ||
| 56 | return RESULT_UNKNOWN; | ||
| 57 | } | ||
| 58 | |||
| 59 | const PatchManager patch_manager{title_id, filesystem_controller, content_provider}; | ||
| 60 | |||
| 61 | return MakeResult<VirtualFile>( | ||
| 62 | patch_manager.PatchRomFS(nca->GetRomFS(), nca->GetBaseIVFCOffset(), type)); | ||
| 63 | } | ||
| 64 | |||
| 65 | ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFSWithProgramIndex( | ||
| 66 | u64 title_id, u8 program_index, ContentRecordType type) const { | ||
| 67 | const auto res_title_id = GetBaseTitleIDWithProgramIndex(title_id, program_index); | ||
| 68 | |||
| 69 | return OpenPatchedRomFS(res_title_id, type); | ||
| 70 | } | ||
| 71 | |||
| 50 | ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, | 72 | ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, |
| 51 | ContentRecordType type) const { | 73 | ContentRecordType type) const { |
| 52 | const std::shared_ptr<NCA> res = GetEntry(title_id, storage, type); | 74 | const std::shared_ptr<NCA> res = GetEntry(title_id, storage, type); |
diff --git a/src/core/file_sys/romfs_factory.h b/src/core/file_sys/romfs_factory.h index ec704dfa8..96dd0d578 100644 --- a/src/core/file_sys/romfs_factory.h +++ b/src/core/file_sys/romfs_factory.h | |||
| @@ -42,6 +42,10 @@ public: | |||
| 42 | 42 | ||
| 43 | void SetPackedUpdate(VirtualFile update_raw); | 43 | void SetPackedUpdate(VirtualFile update_raw); |
| 44 | [[nodiscard]] ResultVal<VirtualFile> OpenCurrentProcess(u64 current_process_title_id) const; | 44 | [[nodiscard]] ResultVal<VirtualFile> OpenCurrentProcess(u64 current_process_title_id) const; |
| 45 | [[nodiscard]] ResultVal<VirtualFile> OpenPatchedRomFS(u64 title_id, | ||
| 46 | ContentRecordType type) const; | ||
| 47 | [[nodiscard]] ResultVal<VirtualFile> OpenPatchedRomFSWithProgramIndex( | ||
| 48 | u64 title_id, u8 program_index, ContentRecordType type) const; | ||
| 45 | [[nodiscard]] ResultVal<VirtualFile> Open(u64 title_id, StorageId storage, | 49 | [[nodiscard]] ResultVal<VirtualFile> Open(u64 title_id, StorageId storage, |
| 46 | ContentRecordType type) const; | 50 | ContentRecordType type) const; |
| 47 | 51 | ||