diff options
| author | 2023-07-14 20:16:39 -0400 | |
|---|---|---|
| committer | 2023-08-08 11:09:37 -0400 | |
| commit | 84cb20bc72031947ac9e625b4a2b5e0059dda441 (patch) | |
| tree | 94e816691b3800153f7955b03ae63cc36dfdb9dc /src/core/file_sys | |
| parent | Merge pull request #11216 from lat9nq/no-mesa-astc (diff) | |
| download | yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.tar.gz yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.tar.xz yuzu-84cb20bc72031947ac9e625b4a2b5e0059dda441.zip | |
core: remove ResultVal type
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/romfs_factory.cpp | 25 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_factory.h | 12 | ||||
| -rw-r--r-- | src/core/file_sys/savedata_factory.cpp | 22 | ||||
| -rw-r--r-- | src/core/file_sys/savedata_factory.h | 4 | ||||
| -rw-r--r-- | src/core/file_sys/sdmc_factory.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/sdmc_factory.h | 2 |
6 files changed, 20 insertions, 47 deletions
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp index ae7a3511b..aa4726cfa 100644 --- a/src/core/file_sys/romfs_factory.cpp +++ b/src/core/file_sys/romfs_factory.cpp | |||
| @@ -35,7 +35,7 @@ void RomFSFactory::SetPackedUpdate(VirtualFile update_raw_file) { | |||
| 35 | update_raw = std::move(update_raw_file); | 35 | update_raw = std::move(update_raw_file); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const { | 38 | VirtualFile RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const { |
| 39 | if (!updatable) { | 39 | if (!updatable) { |
| 40 | return file; | 40 | return file; |
| 41 | } | 41 | } |
| @@ -45,12 +45,11 @@ ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_titl | |||
| 45 | return patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw); | 45 | return patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecordType type) const { | 48 | VirtualFile RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecordType type) const { |
| 49 | auto nca = content_provider.GetEntry(title_id, type); | 49 | auto nca = content_provider.GetEntry(title_id, type); |
| 50 | 50 | ||
| 51 | if (nca == nullptr) { | 51 | if (nca == nullptr) { |
| 52 | // TODO: Find the right error code to use here | 52 | return nullptr; |
| 53 | return ResultUnknown; | ||
| 54 | } | 53 | } |
| 55 | 54 | ||
| 56 | const PatchManager patch_manager{title_id, filesystem_controller, content_provider}; | 55 | const PatchManager patch_manager{title_id, filesystem_controller, content_provider}; |
| @@ -58,28 +57,20 @@ ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecor | |||
| 58 | return patch_manager.PatchRomFS(nca->GetRomFS(), nca->GetBaseIVFCOffset(), type); | 57 | return patch_manager.PatchRomFS(nca->GetRomFS(), nca->GetBaseIVFCOffset(), type); |
| 59 | } | 58 | } |
| 60 | 59 | ||
| 61 | ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFSWithProgramIndex( | 60 | VirtualFile RomFSFactory::OpenPatchedRomFSWithProgramIndex(u64 title_id, u8 program_index, |
| 62 | u64 title_id, u8 program_index, ContentRecordType type) const { | 61 | ContentRecordType type) const { |
| 63 | const auto res_title_id = GetBaseTitleIDWithProgramIndex(title_id, program_index); | 62 | const auto res_title_id = GetBaseTitleIDWithProgramIndex(title_id, program_index); |
| 64 | 63 | ||
| 65 | return OpenPatchedRomFS(res_title_id, type); | 64 | return OpenPatchedRomFS(res_title_id, type); |
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage, | 67 | VirtualFile RomFSFactory::Open(u64 title_id, StorageId storage, ContentRecordType type) const { |
| 69 | ContentRecordType type) const { | ||
| 70 | const std::shared_ptr<NCA> res = GetEntry(title_id, storage, type); | 68 | const std::shared_ptr<NCA> res = GetEntry(title_id, storage, type); |
| 71 | if (res == nullptr) { | 69 | if (res == nullptr) { |
| 72 | // TODO(DarkLordZach): Find the right error code to use here | 70 | return nullptr; |
| 73 | return ResultUnknown; | ||
| 74 | } | ||
| 75 | |||
| 76 | const auto romfs = res->GetRomFS(); | ||
| 77 | if (romfs == nullptr) { | ||
| 78 | // TODO(DarkLordZach): Find the right error code to use here | ||
| 79 | return ResultUnknown; | ||
| 80 | } | 71 | } |
| 81 | 72 | ||
| 82 | return romfs; | 73 | return res->GetRomFS(); |
| 83 | } | 74 | } |
| 84 | 75 | ||
| 85 | std::shared_ptr<NCA> RomFSFactory::GetEntry(u64 title_id, StorageId storage, | 76 | std::shared_ptr<NCA> RomFSFactory::GetEntry(u64 title_id, StorageId storage, |
diff --git a/src/core/file_sys/romfs_factory.h b/src/core/file_sys/romfs_factory.h index 14936031f..7ec40d19d 100644 --- a/src/core/file_sys/romfs_factory.h +++ b/src/core/file_sys/romfs_factory.h | |||
| @@ -41,13 +41,11 @@ public: | |||
| 41 | ~RomFSFactory(); | 41 | ~RomFSFactory(); |
| 42 | 42 | ||
| 43 | void SetPackedUpdate(VirtualFile update_raw_file); | 43 | void SetPackedUpdate(VirtualFile update_raw_file); |
| 44 | [[nodiscard]] ResultVal<VirtualFile> OpenCurrentProcess(u64 current_process_title_id) const; | 44 | [[nodiscard]] VirtualFile OpenCurrentProcess(u64 current_process_title_id) const; |
| 45 | [[nodiscard]] ResultVal<VirtualFile> OpenPatchedRomFS(u64 title_id, | 45 | [[nodiscard]] VirtualFile OpenPatchedRomFS(u64 title_id, ContentRecordType type) const; |
| 46 | ContentRecordType type) const; | 46 | [[nodiscard]] VirtualFile OpenPatchedRomFSWithProgramIndex(u64 title_id, u8 program_index, |
| 47 | [[nodiscard]] ResultVal<VirtualFile> OpenPatchedRomFSWithProgramIndex( | 47 | ContentRecordType type) const; |
| 48 | u64 title_id, u8 program_index, ContentRecordType type) const; | 48 | [[nodiscard]] VirtualFile Open(u64 title_id, StorageId storage, ContentRecordType type) const; |
| 49 | [[nodiscard]] ResultVal<VirtualFile> Open(u64 title_id, StorageId storage, | ||
| 50 | ContentRecordType type) const; | ||
| 51 | 49 | ||
| 52 | private: | 50 | private: |
| 53 | [[nodiscard]] std::shared_ptr<NCA> GetEntry(u64 title_id, StorageId storage, | 51 | [[nodiscard]] std::shared_ptr<NCA> GetEntry(u64 title_id, StorageId storage, |
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index 70b36f170..a4d060007 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp | |||
| @@ -108,26 +108,16 @@ SaveDataFactory::SaveDataFactory(Core::System& system_, VirtualDir save_director | |||
| 108 | 108 | ||
| 109 | SaveDataFactory::~SaveDataFactory() = default; | 109 | SaveDataFactory::~SaveDataFactory() = default; |
| 110 | 110 | ||
| 111 | ResultVal<VirtualDir> SaveDataFactory::Create(SaveDataSpaceId space, | 111 | VirtualDir SaveDataFactory::Create(SaveDataSpaceId space, const SaveDataAttribute& meta) const { |
| 112 | const SaveDataAttribute& meta) const { | ||
| 113 | PrintSaveDataAttributeWarnings(meta); | 112 | PrintSaveDataAttributeWarnings(meta); |
| 114 | 113 | ||
| 115 | const auto save_directory = | 114 | const auto save_directory = |
| 116 | GetFullPath(system, dir, space, meta.type, meta.title_id, meta.user_id, meta.save_id); | 115 | GetFullPath(system, dir, space, meta.type, meta.title_id, meta.user_id, meta.save_id); |
| 117 | 116 | ||
| 118 | auto out = dir->CreateDirectoryRelative(save_directory); | 117 | return dir->CreateDirectoryRelative(save_directory); |
| 119 | |||
| 120 | // Return an error if the save data doesn't actually exist. | ||
| 121 | if (out == nullptr) { | ||
| 122 | // TODO(DarkLordZach): Find out correct error code. | ||
| 123 | return ResultUnknown; | ||
| 124 | } | ||
| 125 | |||
| 126 | return out; | ||
| 127 | } | 118 | } |
| 128 | 119 | ||
| 129 | ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space, | 120 | VirtualDir SaveDataFactory::Open(SaveDataSpaceId space, const SaveDataAttribute& meta) const { |
| 130 | const SaveDataAttribute& meta) const { | ||
| 131 | 121 | ||
| 132 | const auto save_directory = | 122 | const auto save_directory = |
| 133 | GetFullPath(system, dir, space, meta.type, meta.title_id, meta.user_id, meta.save_id); | 123 | GetFullPath(system, dir, space, meta.type, meta.title_id, meta.user_id, meta.save_id); |
| @@ -138,12 +128,6 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space, | |||
| 138 | return Create(space, meta); | 128 | return Create(space, meta); |
| 139 | } | 129 | } |
| 140 | 130 | ||
| 141 | // Return an error if the save data doesn't actually exist. | ||
| 142 | if (out == nullptr) { | ||
| 143 | // TODO(Subv): Find out correct error code. | ||
| 144 | return ResultUnknown; | ||
| 145 | } | ||
| 146 | |||
| 147 | return out; | 131 | return out; |
| 148 | } | 132 | } |
| 149 | 133 | ||
diff --git a/src/core/file_sys/savedata_factory.h b/src/core/file_sys/savedata_factory.h index d3633ef03..45c7c81fb 100644 --- a/src/core/file_sys/savedata_factory.h +++ b/src/core/file_sys/savedata_factory.h | |||
| @@ -89,8 +89,8 @@ public: | |||
| 89 | explicit SaveDataFactory(Core::System& system_, VirtualDir save_directory_); | 89 | explicit SaveDataFactory(Core::System& system_, VirtualDir save_directory_); |
| 90 | ~SaveDataFactory(); | 90 | ~SaveDataFactory(); |
| 91 | 91 | ||
| 92 | ResultVal<VirtualDir> Create(SaveDataSpaceId space, const SaveDataAttribute& meta) const; | 92 | VirtualDir Create(SaveDataSpaceId space, const SaveDataAttribute& meta) const; |
| 93 | ResultVal<VirtualDir> Open(SaveDataSpaceId space, const SaveDataAttribute& meta) const; | 93 | VirtualDir Open(SaveDataSpaceId space, const SaveDataAttribute& meta) const; |
| 94 | 94 | ||
| 95 | VirtualDir GetSaveDataSpaceDirectory(SaveDataSpaceId space) const; | 95 | VirtualDir GetSaveDataSpaceDirectory(SaveDataSpaceId space) const; |
| 96 | 96 | ||
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp index 1df022c9e..d5158cd64 100644 --- a/src/core/file_sys/sdmc_factory.cpp +++ b/src/core/file_sys/sdmc_factory.cpp | |||
| @@ -23,7 +23,7 @@ SDMCFactory::SDMCFactory(VirtualDir sd_dir_, VirtualDir sd_mod_dir_) | |||
| 23 | 23 | ||
| 24 | SDMCFactory::~SDMCFactory() = default; | 24 | SDMCFactory::~SDMCFactory() = default; |
| 25 | 25 | ||
| 26 | ResultVal<VirtualDir> SDMCFactory::Open() const { | 26 | VirtualDir SDMCFactory::Open() const { |
| 27 | return sd_dir; | 27 | return sd_dir; |
| 28 | } | 28 | } |
| 29 | 29 | ||
diff --git a/src/core/file_sys/sdmc_factory.h b/src/core/file_sys/sdmc_factory.h index 3aebfb25e..a445fdb16 100644 --- a/src/core/file_sys/sdmc_factory.h +++ b/src/core/file_sys/sdmc_factory.h | |||
| @@ -18,7 +18,7 @@ public: | |||
| 18 | explicit SDMCFactory(VirtualDir sd_dir_, VirtualDir sd_mod_dir_); | 18 | explicit SDMCFactory(VirtualDir sd_dir_, VirtualDir sd_mod_dir_); |
| 19 | ~SDMCFactory(); | 19 | ~SDMCFactory(); |
| 20 | 20 | ||
| 21 | ResultVal<VirtualDir> Open() const; | 21 | VirtualDir Open() const; |
| 22 | 22 | ||
| 23 | VirtualDir GetSDMCModificationLoadRoot(u64 title_id) const; | 23 | VirtualDir GetSDMCModificationLoadRoot(u64 title_id) const; |
| 24 | VirtualDir GetSDMCContentDirectory() const; | 24 | VirtualDir GetSDMCContentDirectory() const; |