aboutsummaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2021-11-02 18:41:57 -0400
committerGitHub <noreply@github.com>2021-11-02 18:41:57 -0400
commit3d1f2bb3aa2e5bced4ab2342b5e591224f09f0ba (patch)
tree5cbd9a62e1daf1c1de97444858064fe8210df077 /src/core/file_sys
parentb118fa8698dbe0e2b6e663c1c37a7eac03422905 (diff)
parentcb09ea0f0174162a85f47fdb8446b397c3c57e20 (diff)
Merge pull request #7268 from Morph1984/expected-resultval
common, result: Implement a subset of std::expected and use it in ResultVal
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/romfs_factory.cpp10
-rw-r--r--src/core/file_sys/savedata_factory.cpp4
-rw-r--r--src/core/file_sys/sdmc_factory.cpp2
3 files changed, 7 insertions, 9 deletions
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
index 638c6cea8..3d9ce863b 100644
--- a/src/core/file_sys/romfs_factory.cpp
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -39,13 +39,12 @@ void RomFSFactory::SetPackedUpdate(VirtualFile update_raw_file) {
ResultVal<VirtualFile> RomFSFactory::OpenCurrentProcess(u64 current_process_title_id) const {
if (!updatable) {
- return MakeResult<VirtualFile>(file);
+ return file;
}
const PatchManager patch_manager{current_process_title_id, filesystem_controller,
content_provider};
- return MakeResult<VirtualFile>(
- patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw));
+ return patch_manager.PatchRomFS(file, ivfc_offset, ContentRecordType::Program, update_raw);
}
ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecordType type) const {
@@ -58,8 +57,7 @@ ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecor
const PatchManager patch_manager{title_id, filesystem_controller, content_provider};
- return MakeResult<VirtualFile>(
- patch_manager.PatchRomFS(nca->GetRomFS(), nca->GetBaseIVFCOffset(), type));
+ return patch_manager.PatchRomFS(nca->GetRomFS(), nca->GetBaseIVFCOffset(), type);
}
ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFSWithProgramIndex(
@@ -83,7 +81,7 @@ ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage,
return ResultUnknown;
}
- return MakeResult<VirtualFile>(romfs);
+ return romfs;
}
std::shared_ptr<NCA> RomFSFactory::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 b5254dd75..0c8ec4ba2 100644
--- a/src/core/file_sys/savedata_factory.cpp
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -94,7 +94,7 @@ ResultVal<VirtualDir> SaveDataFactory::Create(SaveDataSpaceId space,
return ResultUnknown;
}
- return MakeResult<VirtualDir>(std::move(out));
+ return out;
}
ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space,
@@ -115,7 +115,7 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space,
return ResultUnknown;
}
- return MakeResult<VirtualDir>(std::move(out));
+ return out;
}
VirtualDir SaveDataFactory::GetSaveDataSpaceDirectory(SaveDataSpaceId space) const {
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp
index e5c72cd4d..c0e13e56f 100644
--- a/src/core/file_sys/sdmc_factory.cpp
+++ b/src/core/file_sys/sdmc_factory.cpp
@@ -25,7 +25,7 @@ SDMCFactory::SDMCFactory(VirtualDir sd_dir_, VirtualDir sd_mod_dir_)
SDMCFactory::~SDMCFactory() = default;
ResultVal<VirtualDir> SDMCFactory::Open() const {
- return MakeResult<VirtualDir>(sd_dir);
+ return sd_dir;
}
VirtualDir SDMCFactory::GetSDMCModificationLoadRoot(u64 title_id) const {