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

@ -48,7 +48,7 @@ public:
}
std::memcpy(buffer, data->data(), data->size());
return MakeResult<std::size_t>(data->size());
return data->size();
}
ResultVal<std::size_t> Write(u64 offset, std::size_t length, bool flush,
@ -183,8 +183,7 @@ private:
if (ncch_data.romfs_file) {
std::unique_ptr<DelayGenerator> delay_generator =
std::make_unique<RomFSDelayGenerator>();
return MakeResult<std::unique_ptr<FileBackend>>(
std::make_unique<IVFCFile>(ncch_data.romfs_file, std::move(delay_generator)));
return std::make_unique<IVFCFile>(ncch_data.romfs_file, std::move(delay_generator));
} else {
LOG_INFO(Service_FS, "Unable to read RomFS");
return ERROR_ROMFS_NOT_FOUND;
@ -195,8 +194,8 @@ private:
if (ncch_data.update_romfs_file) {
std::unique_ptr<DelayGenerator> delay_generator =
std::make_unique<RomFSDelayGenerator>();
return MakeResult<std::unique_ptr<FileBackend>>(std::make_unique<IVFCFile>(
ncch_data.update_romfs_file, std::move(delay_generator)));
return std::make_unique<IVFCFile>(ncch_data.update_romfs_file,
std::move(delay_generator));
} else {
LOG_INFO(Service_FS, "Unable to read update RomFS");
return ERROR_ROMFS_NOT_FOUND;
@ -206,8 +205,7 @@ private:
ResultVal<std::unique_ptr<FileBackend>> OpenExeFS(const std::string& filename) const {
if (filename == "icon") {
if (ncch_data.icon) {
return MakeResult<std::unique_ptr<FileBackend>>(
std::make_unique<ExeFSSectionFile>(ncch_data.icon));
return std::make_unique<ExeFSSectionFile>(ncch_data.icon);
}
LOG_WARNING(Service_FS, "Unable to read icon");
@ -216,8 +214,7 @@ private:
if (filename == "logo") {
if (ncch_data.logo) {
return MakeResult<std::unique_ptr<FileBackend>>(
std::make_unique<ExeFSSectionFile>(ncch_data.logo));
return std::make_unique<ExeFSSectionFile>(ncch_data.logo);
}
LOG_WARNING(Service_FS, "Unable to read logo");
@ -226,8 +223,7 @@ private:
if (filename == "banner") {
if (ncch_data.banner) {
return MakeResult<std::unique_ptr<FileBackend>>(
std::make_unique<ExeFSSectionFile>(ncch_data.banner));
return std::make_unique<ExeFSSectionFile>(ncch_data.banner);
}
LOG_WARNING(Service_FS, "Unable to read banner");
@ -297,8 +293,7 @@ void ArchiveFactory_SelfNCCH::Register(Loader::AppLoader& app_loader) {
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SelfNCCH::Open(const Path& path,
u64 program_id) {
auto archive = std::make_unique<SelfNCCHArchive>(ncch_data[program_id]);
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
return std::make_unique<SelfNCCHArchive>(ncch_data[program_id]);
}
ResultCode ArchiveFactory_SelfNCCH::Format(const Path&, const FileSys::ArchiveFormatInfo&,