ams: use R_SUCCEED, R_THROW globally
This commit is contained in:
@@ -29,7 +29,7 @@ namespace ams::mitm::fs {
|
||||
/* Helpers. */
|
||||
Result EnsureSdInitialized() {
|
||||
R_UNLESS(serviceIsActive(std::addressof(g_sd_filesystem.s)), ams::fs::ResultSdCardNotPresent());
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void FormatAtmosphereRomfsPath(char *dst_path, size_t dst_path_size, ncm::ProgramId program_id, const char *src_path) {
|
||||
@@ -230,7 +230,7 @@ namespace ams::mitm::fs {
|
||||
/* Set output. */
|
||||
file_guard.Cancel();
|
||||
*out = f;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result CreateAndOpenAtmosphereSdFile(FsFile *out, ncm::ProgramId program_id, const char *path, size_t size) {
|
||||
@@ -254,7 +254,7 @@ namespace ams::mitm::fs {
|
||||
/* Set output. */
|
||||
file_guard.Cancel();
|
||||
*out = f;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace ams::mitm::bpc {
|
||||
/* NOTE: Preferred reboot type will be parsed from settings later on. */
|
||||
g_reboot_type = RebootType::ToPayload;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result DetectPreferredRebootFunctionality() {
|
||||
@@ -163,7 +163,7 @@ namespace ams::mitm::bpc {
|
||||
g_reboot_type = RebootType::ToPayload;
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace ams::mitm::bpc {
|
||||
Result BpcMitmService::RebootSystem() {
|
||||
R_UNLESS(bpc::IsRebootManaged(), sm::mitm::ResultShouldForwardToSession());
|
||||
bpc::RebootSystem();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result BpcMitmService::ShutdownSystem() {
|
||||
bpc::ShutdownSystem();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace ams::mitm::socket::resolver {
|
||||
*out_errno = 0;
|
||||
*out_size = size;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ResolverImpl::GetAddrInfoRequest(u32 cancel_handle, const sf::ClientProcessId &client_pid, bool use_nsd_resolve, const sf::InBuffer &node, const sf::InBuffer &srv, const sf::InBuffer &serialized_hint, const sf::OutBuffer &out_addrinfo, sf::Out<u32> out_errno, sf::Out<s32> out_retval, sf::Out<u32> out_size) {
|
||||
@@ -144,7 +144,7 @@ namespace ams::mitm::socket::resolver {
|
||||
*out_errno = 0;
|
||||
*out_size = size;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ResolverImpl::GetHostByNameRequestWithOptions(const sf::ClientProcessId &client_pid, const sf::InAutoSelectBuffer &name, const sf::OutAutoSelectBuffer &out_hostent, sf::Out<u32> out_size, u32 options_version, const sf::InAutoSelectBuffer &options, u32 num_options, sf::Out<s32> out_host_error, sf::Out<s32> out_errno) {
|
||||
@@ -166,7 +166,7 @@ namespace ams::mitm::socket::resolver {
|
||||
*out_errno = 0;
|
||||
*out_size = size;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ResolverImpl::GetAddrInfoRequestWithOptions(const sf::ClientProcessId &client_pid, const sf::InBuffer &node, const sf::InBuffer &srv, const sf::InBuffer &serialized_hint, const sf::OutAutoSelectBuffer &out_addrinfo, sf::Out<u32> out_size, sf::Out<s32> out_retval, u32 options_version, const sf::InAutoSelectBuffer &options, u32 num_options, sf::Out<s32> out_host_error, sf::Out<s32> out_errno) {
|
||||
@@ -206,13 +206,13 @@ namespace ams::mitm::socket::resolver {
|
||||
*out_errno = 0;
|
||||
*out_size = size;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ResolverImpl::AtmosphereReloadHostsFile() {
|
||||
/* Perform a hosts file reload. */
|
||||
InitializeResolverRedirections();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace ams::mitm::fs {
|
||||
R_TRY(subdir_fs->Initialize(AtmosphereHblWebContentDirPath));
|
||||
|
||||
out.SetValue(MakeSharedFileSystem(std::make_shared<fs::ReadOnlyFileSystem>(std::move(subdir_fs)), false), target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result OpenProgramSpecificWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id) {
|
||||
@@ -142,7 +142,7 @@ namespace ams::mitm::fs {
|
||||
out.SetValue(MakeSharedFileSystem(std::move(new_fs), false), target_object_id);
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result OpenWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId client_program_id, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id, bool try_program_specific) {
|
||||
@@ -185,7 +185,7 @@ namespace ams::mitm::fs {
|
||||
R_TRY(redir_fs->InitializeWithFixedPath("/Nintendo", emummc::GetNintendoDirPath()));
|
||||
|
||||
out.SetValue(MakeSharedFileSystem(std::move(redir_fs), false), target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FsMitmService::OpenSaveDataFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> out, u8 _space_id, const fs::SaveDataAttribute &attribute) {
|
||||
@@ -260,7 +260,7 @@ namespace ams::mitm::fs {
|
||||
|
||||
/* Set output. */
|
||||
out.SetValue(MakeSharedFileSystem(std::move(dirsave_ifs), false), target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FsMitmService::OpenBisStorage(sf::Out<sf::SharedPointer<ams::fssrv::sf::IStorage>> out, u32 _bis_partition_id) {
|
||||
@@ -302,7 +302,7 @@ namespace ams::mitm::fs {
|
||||
}
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FsMitmService::OpenDataStorageByCurrentProcess(sf::Out<sf::SharedPointer<ams::fssrv::sf::IStorage>> out) {
|
||||
@@ -319,7 +319,7 @@ namespace ams::mitm::fs {
|
||||
|
||||
/* Get a layered storage for the process romfs. */
|
||||
out.SetValue(MakeSharedStorage(GetLayeredRomfsStorage(m_client_info.program_id, data_storage, true)), target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FsMitmService::OpenDataStorageByDataId(sf::Out<sf::SharedPointer<ams::fssrv::sf::IStorage>> out, ncm::DataId _data_id, u8 storage_id) {
|
||||
@@ -339,7 +339,7 @@ namespace ams::mitm::fs {
|
||||
|
||||
/* Get a layered storage for the data id. */
|
||||
out.SetValue(MakeSharedStorage(GetLayeredRomfsStorage(data_id, data_storage, false)), target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FsMitmService::OpenDataStorageWithProgramIndex(sf::Out<sf::SharedPointer<ams::fssrv::sf::IStorage>> out, u8 program_index) {
|
||||
@@ -360,7 +360,7 @@ namespace ams::mitm::fs {
|
||||
|
||||
/* Get a layered storage for the process romfs. */
|
||||
out.SetValue(MakeSharedStorage(GetLayeredRomfsStorage(program_id, data_storage, true)), target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FsMitmService::RegisterProgramIndexMapInfo(const sf::InBuffer &info_buffer, s32 info_count) {
|
||||
@@ -370,7 +370,7 @@ namespace ams::mitm::fs {
|
||||
/* Register with ourselves. */
|
||||
R_ABORT_UNLESS(g_program_index_map_info_manager.Reset(reinterpret_cast<const fs::ProgramIndexMapInfo *>(info_buffer.GetPointer()), info_count));
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace ams::mitm::fs {
|
||||
|
||||
/* Check if we have nothing to do. */
|
||||
if (size == 0) {
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
/* Fast case. */
|
||||
@@ -69,7 +69,7 @@ namespace ams::mitm::fs {
|
||||
}
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *_buffer, size_t size) override {
|
||||
@@ -80,7 +80,7 @@ namespace ams::mitm::fs {
|
||||
|
||||
/* Check if we have nothing to do. */
|
||||
if (size == 0) {
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
/* Fast case. */
|
||||
@@ -117,7 +117,7 @@ namespace ams::mitm::fs {
|
||||
}
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace ams::mitm::fs {
|
||||
}
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result LayeredRomfsStorageImpl::GetSize(s64 *out_size) {
|
||||
@@ -378,11 +378,11 @@ namespace ams::mitm::fs {
|
||||
}
|
||||
|
||||
*out_size = this->GetSize();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result LayeredRomfsStorageImpl::Flush() {
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result LayeredRomfsStorageImpl::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
@@ -397,12 +397,12 @@ namespace ams::mitm::fs {
|
||||
R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize());
|
||||
reinterpret_cast<QueryRangeInfo *>(dst)->Clear();
|
||||
}
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
/* TODO: How to deal with this? */
|
||||
return fs::ResultUnsupportedOperation();
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
default:
|
||||
return fs::ResultUnsupportedOperation();
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace ams::mitm::fs {
|
||||
}
|
||||
|
||||
virtual Result DoCommit() override final {
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
virtual Result DoGetFreeSpaceSize(s64 *out, const ams::fs::Path &path) {
|
||||
|
||||
@@ -44,10 +44,10 @@ namespace ams::mitm::fs {
|
||||
*out_str = "safe";
|
||||
break;
|
||||
default:
|
||||
return fs::ResultInvalidSaveDataSpaceId();
|
||||
R_THROW(fs::ResultInvalidSaveDataSpaceId());
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetSaveDataTypeString(const char **out_str, SaveDataType save_data_type) {
|
||||
@@ -75,10 +75,10 @@ namespace ams::mitm::fs {
|
||||
break;
|
||||
default:
|
||||
/* TODO: Better result? */
|
||||
return fs::ResultInvalidArgument();
|
||||
R_THROW(fs::ResultInvalidArgument());
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
constexpr inline bool IsEmptyAccountId(const UserId &uid) {
|
||||
@@ -108,7 +108,7 @@ namespace ams::mitm::fs {
|
||||
|
||||
R_UNLESS(out_path_len < dst_size, fs::ResultTooLongPath());
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ams::mitm::ns {
|
||||
bool is_hbl;
|
||||
if (R_SUCCEEDED(pm::info::IsHblProgramId(&is_hbl, application_id)) && is_hbl) {
|
||||
nsamResolveApplicationContentPathFwd(m_forward_service.get(), static_cast<u64>(application_id), static_cast<NcmContentType>(content_type));
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
return nsamResolveApplicationContentPathFwd(m_forward_service.get(), static_cast<u64>(application_id), static_cast<NcmContentType>(content_type));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ams::mitm::ns {
|
||||
bool is_hbl;
|
||||
if (R_SUCCEEDED(pm::info::IsHblProgramId(std::addressof(is_hbl), application_id)) && is_hbl) {
|
||||
nswebResolveApplicationContentPath(m_srv.get(), static_cast<u64>(application_id), static_cast<NcmContentType>(content_type));
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
return nswebResolveApplicationContentPath(m_srv.get(), static_cast<u64>(application_id), static_cast<NcmContentType>(content_type));
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace ams::mitm::ns {
|
||||
const sf::cmif::DomainObjectId target_object_id{serviceGetObjectId(std::addressof(doc.s))};
|
||||
|
||||
out.SetValue(sf::CreateSharedObjectEmplaced<impl::IDocumentInterface, NsDocumentService>(m_client_info, std::make_unique<NsDocumentInterface>(doc)), target_object_id);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace ams::mitm::settings {
|
||||
Result SetMitmService::EnsureLocale() {
|
||||
/* Optimization: if locale has already been gotten, we can stop. */
|
||||
if (AMS_LIKELY(m_got_locale)) {
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
std::scoped_lock lk(m_lock);
|
||||
@@ -77,7 +77,7 @@ namespace ams::mitm::settings {
|
||||
}
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void SetMitmService::InvalidateLocale() {
|
||||
@@ -105,7 +105,7 @@ namespace ams::mitm::settings {
|
||||
}
|
||||
|
||||
out.SetValue(m_locale.language_code);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SetMitmService::GetRegionCode(sf::Out<settings::RegionCode> out) {
|
||||
@@ -124,7 +124,7 @@ namespace ams::mitm::settings {
|
||||
}
|
||||
|
||||
out.SetValue(m_locale.region_code);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace ams::mitm::settings {
|
||||
*out = g_firmware_version;
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace ams::mitm::settings {
|
||||
/* GetFirmwareVersion sanitizes the revision fields. */
|
||||
out.GetPointer()->revision_major = 0;
|
||||
out.GetPointer()->revision_minor = 0;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SetSysMitmService::GetFirmwareVersion2(sf::Out<settings::FirmwareVersion> out) {
|
||||
@@ -108,7 +108,7 @@ namespace ams::mitm::settings {
|
||||
R_CONVERT_ALL(sm::mitm::ResultShouldForwardToSession());
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SetSysMitmService::GetSettingsItemValue(sf::Out<u64> out_size, const sf::OutBuffer &out, const settings::SettingsName &name, const settings::SettingsItemKey &key) {
|
||||
@@ -117,7 +117,7 @@ namespace ams::mitm::settings {
|
||||
R_CONVERT_ALL(sm::mitm::ResultShouldForwardToSession());
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SetSysMitmService::GetDebugModeFlag(sf::Out<bool> out) {
|
||||
@@ -129,7 +129,7 @@ namespace ams::mitm::settings {
|
||||
settings::fwdbg::GetSettingsItemValue(std::addressof(en), sizeof(en), "atmosphere", "enable_am_debug_mode");
|
||||
|
||||
out.SetValue(en != 0);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace ams::settings::fwdbg {
|
||||
R_UNLESS(len > 0, settings::ResultEmptySettingsName());
|
||||
R_UNLESS(len <= SettingsNameLengthMax, settings::ResultTooLongSettingsName());
|
||||
R_UNLESS(IsValidSettingsFormat(name, len), settings::ResultInvalidFormatSettingsName());
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ValidateSettingsItemKey(const char *key) {
|
||||
@@ -136,7 +136,7 @@ namespace ams::settings::fwdbg {
|
||||
R_UNLESS(len > 0, settings::ResultEmptySettingsItemKey());
|
||||
R_UNLESS(len <= SettingsNameLengthMax, settings::ResultTooLongSettingsItemKey());
|
||||
R_UNLESS(IsValidSettingsFormat(key, len), settings::ResultInvalidFormatSettingsItemKey());
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result AllocateValue(void **out, size_t size) {
|
||||
@@ -144,35 +144,35 @@ namespace ams::settings::fwdbg {
|
||||
|
||||
*out = g_value_storage + g_allocated_value_storage_size;
|
||||
g_allocated_value_storage_size += size;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FindSettingsName(const char **out, const char *name) {
|
||||
for (auto &stored : g_names) {
|
||||
if (std::strcmp(stored.value, name) == 0) {
|
||||
*out = stored.value;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
} else if (std::strcmp(stored.value, "") == 0) {
|
||||
*out = stored.value;
|
||||
std::strcpy(stored.value, name);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
}
|
||||
return settings::ResultSettingsItemKeyAllocationFailed();
|
||||
R_THROW(settings::ResultSettingsItemKeyAllocationFailed());
|
||||
}
|
||||
|
||||
Result FindSettingsItemKey(const char **out, const char *key) {
|
||||
for (auto &stored : g_item_keys) {
|
||||
if (std::strcmp(stored.value, key) == 0) {
|
||||
*out = stored.value;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
} else if (std::strcmp(stored.value, "") == 0) {
|
||||
std::strcpy(stored.value, key);
|
||||
*out = stored.value;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
}
|
||||
return settings::ResultSettingsItemKeyAllocationFailed();
|
||||
R_THROW(settings::ResultSettingsItemKeyAllocationFailed());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -182,7 +182,7 @@ namespace ams::settings::fwdbg {
|
||||
|
||||
T value = static_cast<T>(strtoul(value_str, nullptr, 0));
|
||||
std::memcpy(out.value, std::addressof(value), sizeof(T));
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetEntry(SdKeyValueStoreEntry **out, const char *name, const char *key) {
|
||||
@@ -200,7 +200,7 @@ namespace ams::settings::fwdbg {
|
||||
R_UNLESS(*it == test_entry, settings::ResultSettingsItemNotFound());
|
||||
|
||||
*out = std::addressof(*it);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ParseSettingsItemValueImpl(const char *name, const char *key, const char *val_tup) {
|
||||
@@ -253,7 +253,7 @@ namespace ams::settings::fwdbg {
|
||||
} else if (strncasecmp(type, "u64", type_len) == 0) {
|
||||
R_TRY((ParseSettingsItemIntegralValue<u64>(new_value, value_str)));
|
||||
} else {
|
||||
return settings::ResultInvalidFormatSettingsItemValue();
|
||||
R_THROW(settings::ResultInvalidFormatSettingsItemValue());
|
||||
}
|
||||
|
||||
/* Insert the entry. */
|
||||
@@ -267,7 +267,7 @@ namespace ams::settings::fwdbg {
|
||||
}
|
||||
|
||||
R_UNLESS(inserted, settings::ResultSettingsItemValueAllocationFailed());
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ParseSettingsItemValue(const char *name, const char *key, const char *value) {
|
||||
@@ -303,7 +303,7 @@ namespace ams::settings::fwdbg {
|
||||
util::ini::ParseFile(file.get(), std::addressof(parse_result), SystemSettingsIniHandler);
|
||||
R_TRY(parse_result);
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void LoadDefaultCustomSettings() {
|
||||
@@ -435,7 +435,7 @@ namespace ams::settings::fwdbg {
|
||||
R_TRY(GetEntry(std::addressof(entry), name, key));
|
||||
|
||||
*out_size = entry->value_size;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GetSdCardKeyValueStoreSettingsItemValue(size_t *out_size, void *dst, size_t dst_size, const char *name, const char *key) {
|
||||
@@ -449,7 +449,7 @@ namespace ams::settings::fwdbg {
|
||||
std::memcpy(dst, entry->value, size);
|
||||
}
|
||||
*out_size = size;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace ams::mitm::sysupdater {
|
||||
R_TRY(updater::MarkVerifyingRequired(updater::BootModeType::Safe, g_boot_image_update_buffer, sizeof(g_boot_image_update_buffer)));
|
||||
|
||||
/* Pre-commit is now marked. */
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result UpdateBootImages() {
|
||||
@@ -59,7 +59,7 @@ namespace ams::mitm::sysupdater {
|
||||
R_TRY(updater::MarkVerified(boot_mode, g_boot_image_update_buffer, sizeof(g_boot_image_update_buffer)));
|
||||
|
||||
/* The boot images are updated. */
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
};
|
||||
|
||||
/* Get the boot image update type. */
|
||||
@@ -72,7 +72,7 @@ namespace ams::mitm::sysupdater {
|
||||
R_TRY(UpdateBootImageImpl(updater::BootModeType::Normal, boot_image_update_type));
|
||||
|
||||
/* Both sets of images are updated. */
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,7 +92,7 @@ namespace ams::mitm::sysupdater {
|
||||
/* Update the boot images. */
|
||||
R_TRY(UpdateBootImages());
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ams::mitm::sysupdater {
|
||||
R_CONVERT(ncm::ResultInstallTaskCancelled, ns::ResultCanceled());
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
AsyncPrepareSdCardUpdateImpl::~AsyncPrepareSdCardUpdateImpl() {
|
||||
@@ -66,7 +66,7 @@ namespace ams::mitm::sysupdater {
|
||||
|
||||
/* Set our thread info. */
|
||||
m_thread_info = info;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result AsyncPrepareSdCardUpdateImpl::Execute() {
|
||||
|
||||
@@ -34,13 +34,13 @@ namespace ams::mitm::sysupdater {
|
||||
return result;
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Result GetAndSaveErrorContext(T &async) {
|
||||
R_TRY(this->SaveErrorContextIfFailed(async, async.Get()));
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -50,7 +50,7 @@ namespace ams::mitm::sysupdater {
|
||||
return result;
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
const err::ErrorContext &GetErrorContextImpl() {
|
||||
@@ -66,12 +66,12 @@ namespace ams::mitm::sysupdater {
|
||||
|
||||
Result Cancel() {
|
||||
this->CancelImpl();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
virtual Result GetErrorContext(sf::Out<err::ErrorContext> out) {
|
||||
*out = {};
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
private:
|
||||
virtual void CancelImpl() = 0;
|
||||
@@ -105,7 +105,7 @@ namespace ams::mitm::sysupdater {
|
||||
|
||||
virtual Result GetErrorContext(sf::Out<err::ErrorContext> out) override {
|
||||
*out = ErrorContextHolder::GetErrorContextImpl();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result Run();
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace ams::mitm::sysupdater {
|
||||
const bool is_nsp = util::Strnicmp(extension, NspExtension, NcaNspExtensionSize) == 0;
|
||||
R_UNLESS(is_nca || is_nsp, fs::ResultPathNotFound());
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ParseMountName(const char **path, std::shared_ptr<ams::fs::fsa::IFileSystem> *out) {
|
||||
@@ -88,13 +88,13 @@ namespace ams::mitm::sysupdater {
|
||||
/* Set the output fs. */
|
||||
*out = std::move(fsa);
|
||||
} else {
|
||||
return fs::ResultPathNotFound();
|
||||
R_THROW(fs::ResultPathNotFound());
|
||||
}
|
||||
|
||||
/* Ensure that there's something that could be a mount name delimiter. */
|
||||
R_UNLESS(util::Strnlen(*path, fs::EntryNameLengthMax) != 0, fs::ResultPathNotFound());
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ParseNsp(const char **path, std::shared_ptr<ams::fs::fsa::IFileSystem> *out, std::shared_ptr<ams::fs::fsa::IFileSystem> base_fs) {
|
||||
@@ -132,7 +132,7 @@ namespace ams::mitm::sysupdater {
|
||||
/* Update the path. */
|
||||
*path = work_path;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ParseNca(const char **path, std::shared_ptr<fssystem::NcaReader> *out, std::shared_ptr<ams::fs::fsa::IFileSystem> base_fs) {
|
||||
@@ -154,7 +154,7 @@ namespace ams::mitm::sysupdater {
|
||||
|
||||
/* Set output reader. */
|
||||
*out = std::move(nca_reader);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result OpenMetaStorage(std::shared_ptr<ams::fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, std::shared_ptr<fssystem::NcaReader> nca_reader, fssystem::NcaFsHeader::FsType *out_fs_type) {
|
||||
@@ -173,7 +173,7 @@ namespace ams::mitm::sysupdater {
|
||||
|
||||
/* Set the output fs type. */
|
||||
*out_fs_type = fs_header_reader.GetFsType();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result OpenContentMetaFileSystem(std::shared_ptr<ams::fs::fsa::IFileSystem> *out, const char *path) {
|
||||
@@ -211,7 +211,7 @@ namespace ams::mitm::sysupdater {
|
||||
case fssystem::NcaFsHeader::FsType::PartitionFs: return creator_intfs->partition_fs_creator->Create(out, std::move(storage));
|
||||
case fssystem::NcaFsHeader::FsType::RomFs: return creator_intfs->rom_fs_creator->Create(out, std::move(storage));
|
||||
default:
|
||||
return fs::ResultInvalidNcaFileSystemType();
|
||||
R_THROW(fs::ResultInvalidNcaFileSystemType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace ams::mitm::sysupdater {
|
||||
R_SUCCEED_IF(done);
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ConvertToFsCommonPath(char *dst, size_t dst_size, const char *package_root_path, const char *entry_path) {
|
||||
@@ -118,13 +118,13 @@ namespace ams::mitm::sysupdater {
|
||||
*out = ncm::ContentInfo::Make(*content_id, entry.file_size, ncm::ContentType::Meta);
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}));
|
||||
|
||||
/* If we didn't find anything, error. */
|
||||
R_UNLESS(found_system_update, ncm::ResultSystemUpdateNotFoundInPackage());
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ValidateSystemUpdate(Result *out_result, Result *out_exfat_result, UpdateValidationInfo *out_info, const ncm::PackagedContentMetaReader &update_reader, const char *package_root) {
|
||||
@@ -212,7 +212,7 @@ namespace ams::mitm::sysupdater {
|
||||
util::SNPrintf(path, sizeof(path), "%s%s%s", package_root, content_id_str.data, content_info->GetType() == ncm::ContentType::Meta ? ".cnmt.nca" : ".nca");
|
||||
if (R_FAILED(ValidateResult(fs::OpenFile(std::addressof(file), path, ams::fs::OpenMode_Read)))) {
|
||||
*done = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
}
|
||||
ON_SCOPE_EXIT { fs::CloseFile(file); };
|
||||
@@ -221,12 +221,12 @@ namespace ams::mitm::sysupdater {
|
||||
s64 file_size;
|
||||
if (R_FAILED(ValidateResult(fs::GetFileSize(std::addressof(file_size), file)))) {
|
||||
*done = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
if (file_size != content_size) {
|
||||
*out_result = ncm::ResultInvalidContentHash();
|
||||
*done = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
/* Read and hash the file in chunks. */
|
||||
@@ -238,7 +238,7 @@ namespace ams::mitm::sysupdater {
|
||||
const size_t cur_size = std::min(static_cast<size_t>(content_size - ofs), data_buffer_size);
|
||||
if (R_FAILED(ValidateResult(fs::ReadFile(file, ofs, data_buffer, cur_size)))) {
|
||||
*done = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
sha.Update(data_buffer, cur_size);
|
||||
@@ -254,7 +254,7 @@ namespace ams::mitm::sysupdater {
|
||||
if (std::memcmp(std::addressof(calc_digest), std::addressof(content_info->digest), sizeof(ncm::Digest)) != 0) {
|
||||
*out_result = ncm::ResultInvalidContentHash();
|
||||
*done = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace ams::mitm::sysupdater {
|
||||
content_meta_valid[validation_index] = true;
|
||||
*out_info = {};
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}));
|
||||
|
||||
/* If we're otherwise going to succeed, ensure that every content was found. */
|
||||
@@ -284,7 +284,7 @@ namespace ams::mitm::sysupdater {
|
||||
}
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FormatUserPackagePath(ncm::Path *out, const ncm::Path &user_path) {
|
||||
@@ -300,7 +300,7 @@ namespace ams::mitm::sysupdater {
|
||||
out->str[len - 1] = '\x00';
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
const char *GetFirmwareVariationSettingName(settings::system::PlatformRegion region) {
|
||||
@@ -382,7 +382,7 @@ namespace ams::mitm::sysupdater {
|
||||
|
||||
/* Set the parsed update info. */
|
||||
out.SetValue(update_info);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SystemUpdateService::ValidateUpdate(sf::Out<Result> out_validate_result, sf::Out<Result> out_validate_exfat_result, sf::Out<UpdateValidationInfo> out_validate_info, const ncm::Path &path) {
|
||||
@@ -407,7 +407,7 @@ namespace ams::mitm::sysupdater {
|
||||
R_TRY(ValidateSystemUpdate(out_validate_result.GetPointer(), out_validate_exfat_result.GetPointer(), out_validate_info.GetPointer(), reader, package_root.str));
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
};
|
||||
|
||||
Result SystemUpdateService::SetupUpdate(sf::CopyHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat) {
|
||||
@@ -435,7 +435,7 @@ namespace ams::mitm::sysupdater {
|
||||
out_event_handle.SetValue(async_result.GetImpl().GetEvent().GetReadableHandle(), false);
|
||||
*out_async = std::move(async_result);
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SystemUpdateService::GetPrepareUpdateProgress(sf::Out<SystemUpdateProgress> out) {
|
||||
@@ -445,7 +445,7 @@ namespace ams::mitm::sysupdater {
|
||||
/* Get the progress. */
|
||||
auto install_progress = m_update_task->GetProgress();
|
||||
out.SetValue({ .current_size = install_progress.installed_size, .total_size = install_progress.total_size });
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SystemUpdateService::HasPreparedUpdate(sf::Out<bool> out) {
|
||||
@@ -453,7 +453,7 @@ namespace ams::mitm::sysupdater {
|
||||
R_UNLESS(m_setup_update, ns::ResultCardUpdateNotSetup());
|
||||
|
||||
out.SetValue(m_update_task->GetProgress().state == ncm::InstallProgressState::Downloaded);
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SystemUpdateService::ApplyPreparedUpdate() {
|
||||
@@ -466,7 +466,7 @@ namespace ams::mitm::sysupdater {
|
||||
/* Apply the task. */
|
||||
R_TRY(m_apply_manager.ApplyPackageTask(std::addressof(*m_update_task)));
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SystemUpdateService::SetupUpdateImpl(sf::NativeHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat, ncm::FirmwareVariationId firmware_variation_id) {
|
||||
@@ -485,7 +485,7 @@ namespace ams::mitm::sysupdater {
|
||||
|
||||
/* The update is now set up. */
|
||||
m_setup_update = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SystemUpdateService::InitializeUpdateTask(sf::NativeHandle &&transfer_memory, u64 transfer_memory_size, const ncm::Path &path, bool exfat, ncm::FirmwareVariationId firmware_variation_id) {
|
||||
@@ -516,7 +516,7 @@ namespace ams::mitm::sysupdater {
|
||||
/* We successfully setup the update. */
|
||||
tmem_guard.Cancel();
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ namespace ams::mitm::sysupdater {
|
||||
.stack_size = m_stack_size,
|
||||
};
|
||||
m_bitmap |= mask;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
}
|
||||
|
||||
return ns::ResultOutOfMaxRunningTask();
|
||||
R_THROW(ns::ResultOutOfMaxRunningTask());
|
||||
}
|
||||
|
||||
void ThreadAllocator::Free(const ThreadInfo &info) {
|
||||
|
||||
Reference in New Issue
Block a user