core: backport some ResultCode updates (#6645)

Co-authored-by: Lioncash <mathew1800@gmail.com>
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
This commit is contained in:
GPUCode
2023-07-03 03:23:53 +03:00
committed by GitHub
parent 0b37c1da57
commit 2126c240cd
34 changed files with 1204 additions and 277 deletions

View File

@@ -108,8 +108,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
}
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<SDMCDelayGenerator>();
auto disk_file = std::make_unique<DiskFile>(std::move(file), mode, std::move(delay_generator));
return MakeResult<std::unique_ptr<FileBackend>>(std::move(disk_file));
return std::make_unique<DiskFile>(std::move(file), mode, std::move(delay_generator));
}
ResultCode SDMCArchive::DeleteFile(const Path& path) const {
@@ -358,8 +357,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SDMCArchive::OpenDirectory(const Pa
break; // Expected 'success' case
}
auto directory = std::make_unique<DiskDirectory>(full_path);
return MakeResult<std::unique_ptr<DirectoryBackend>>(std::move(directory));
return std::make_unique<DiskDirectory>(full_path);
}
u64 SDMCArchive::GetFreeBytes() const {
@@ -390,8 +388,7 @@ bool ArchiveFactory_SDMC::Initialize() {
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMC::Open(const Path& path,
u64 program_id) {
std::unique_ptr<DelayGenerator> delay_generator = std::make_unique<SDMCDelayGenerator>();
auto archive = std::make_unique<SDMCArchive>(sdmc_directory, std::move(delay_generator));
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
return std::make_unique<SDMCArchive>(sdmc_directory, std::move(delay_generator));
}
ResultCode ArchiveFactory_SDMC::Format(const Path& path,
@@ -405,7 +402,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_SDMC::GetFormatInfo(const Path& path
u64 program_id) const {
// TODO(Subv): Implement
LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive {}", GetName());
return ResultCode(-1);
return RESULT_UNKNOWN;
}
} // namespace FileSys