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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 1204 additions and 277 deletions

View file

@ -63,7 +63,7 @@ ResultVal<ArchiveHandle> ArchiveManager::OpenArchive(ArchiveIdCode id_code,
++next_handle;
}
handle_map.emplace(next_handle, std::move(res));
return MakeResult(next_handle++);
return next_handle++;
}
ResultCode ArchiveManager::CloseArchive(ArchiveHandle handle) {
@ -103,7 +103,7 @@ ArchiveManager::OpenFileFromArchive(ArchiveHandle archive_handle, const FileSys:
}
auto file = std::make_shared<File>(system.Kernel(), std::move(backend).Unwrap(), path);
return std::make_pair(MakeResult(std::move(file)), open_timeout_ns);
return std::make_pair(std::move(file), open_timeout_ns);
}
ResultCode ArchiveManager::DeleteFileFromArchive(ArchiveHandle archive_handle,
@ -197,8 +197,7 @@ ResultVal<std::shared_ptr<Directory>> ArchiveManager::OpenDirectoryFromArchive(
return backend.Code();
}
auto directory = std::make_shared<Directory>(std::move(backend).Unwrap(), path);
return MakeResult(std::move(directory));
return std::make_shared<Directory>(std::move(backend).Unwrap(), path);
}
ResultVal<u64> ArchiveManager::GetFreeBytesInArchive(ArchiveHandle archive_handle) {
@ -206,7 +205,7 @@ ResultVal<u64> ArchiveManager::GetFreeBytesInArchive(ArchiveHandle archive_handl
if (archive == nullptr) {
return FileSys::ERR_INVALID_ARCHIVE_HANDLE;
}
return MakeResult(archive->GetFreeBytes());
return archive->GetFreeBytes();
}
ResultCode ArchiveManager::FormatArchive(ArchiveIdCode id_code,
@ -314,7 +313,7 @@ ResultVal<ArchiveResource> ArchiveManager::GetArchiveResource(MediaType media_ty
resource.cluster_size_in_bytes = 16384;
resource.partition_capacity_in_clusters = 0x80000; // 8GiB capacity
resource.free_space_in_clusters = 0x80000; // 8GiB free
return MakeResult(resource);
return resource;
}
void ArchiveManager::RegisterArchiveTypes() {

View file

@ -845,11 +845,11 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromGameCard(u64 title_id, Special
switch (type) {
case SpecialContentType::Update:
return MakeResult(static_cast<u16>(NCSDContentIndex::Update));
return static_cast<u16>(NCSDContentIndex::Update);
case SpecialContentType::Manual:
return MakeResult(static_cast<u16>(NCSDContentIndex::Manual));
return static_cast<u16>(NCSDContentIndex::Manual);
case SpecialContentType::DLPChild:
return MakeResult(static_cast<u16>(NCSDContentIndex::DLP));
return static_cast<u16>(NCSDContentIndex::DLP);
default:
UNREACHABLE();
}
@ -874,9 +874,9 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromTMD(MediaType media_type, u64
switch (type) {
case SpecialContentType::Manual:
return MakeResult(static_cast<u16>(FileSys::TMDContentIndex::Manual));
return static_cast<u16>(FileSys::TMDContentIndex::Manual);
case SpecialContentType::DLPChild:
return MakeResult(static_cast<u16>(FileSys::TMDContentIndex::DLP));
return static_cast<u16>(FileSys::TMDContentIndex::DLP);
default:
ASSERT(false);
}