ams: use R_SUCCEED, R_THROW globally

This commit is contained in:
Michael Scire
2022-03-26 00:14:36 -07:00
parent e5b1739f65
commit dd78ede99f
370 changed files with 2107 additions and 2107 deletions

View File

@@ -34,7 +34,7 @@ namespace ams::pgl {
::Event ev;
R_TRY(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev)));
out.SetValue(ev.revent, true);
return ResultSuccess();
R_SUCCEED();
}
Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
@@ -46,7 +46,7 @@ namespace ams::pgl {
::Event ev;
R_TRY(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev)));
out.SetValue(ev.revent);
return ResultSuccess();
R_SUCCEED();
}
Result GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out) {

View File

@@ -133,7 +133,7 @@ namespace ams::pgl {
*out = pgl::EventObserver(std::move(observer_holder));
}
return ResultSuccess();
R_SUCCEED();
}
#else
Result Initialize() {

View File

@@ -201,7 +201,7 @@ namespace ams::pgl::srv {
/* TODO: Should we avoid leaking the object? Nintendo does not. */
R_TRY(GetGlobalsForTipc().server_manager.AddSession(out, object));
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -145,7 +145,7 @@ namespace ams::pgl::srv {
/* Set the globals. */
g_crashed_process_id = process_id;
g_ssd_process_id = ssd_process_id;
return ResultSuccess();
R_SUCCEED();
}
bool ShouldSnapShotAutoDump() {
@@ -395,7 +395,7 @@ namespace ams::pgl::srv {
/* We succeeded. */
*out = process_id;
return ResultSuccess();
R_SUCCEED();
}
Result TerminateProcess(os::ProcessId process_id) {
@@ -410,7 +410,7 @@ namespace ams::pgl::srv {
/* Return the id. */
*out = *application_process_id;
return ResultSuccess();
R_SUCCEED();
}
Result BoostSystemMemoryResourceLimit(u64 size) {

View File

@@ -42,7 +42,7 @@ namespace ams::pgl::srv {
/* Free the received info. */
lmem::FreeToUnitHeap(m_heap_handle, info);
return ResultSuccess();
R_SUCCEED();
}
void ShellEventObserverImpl::Notify(const pm::ProcessEventInfo &info) {
@@ -67,7 +67,7 @@ namespace ams::pgl::srv {
Result ShellEventObserverCmif::GetProcessEventHandle(ams::sf::OutCopyHandle out) {
out.SetValue(this->GetEvent().GetReadableHandle(), false);
return ResultSuccess();
R_SUCCEED();
}
Result ShellEventObserverCmif::GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
@@ -76,7 +76,7 @@ namespace ams::pgl::srv {
Result ShellEventObserverTipc::GetProcessEventHandle(ams::tipc::OutCopyHandle out) {
out.SetValue(this->GetEvent().GetReadableHandle());
return ResultSuccess();
R_SUCCEED();
}
Result ShellEventObserverTipc::GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out) {

View File

@@ -114,7 +114,7 @@ namespace ams::pgl::srv {
/* Ensure we have a content meta buffer. */
R_UNLESS(m_content_meta_buffer.Get() != nullptr, pgl::ResultContentMetaNotFound());
return ResultSuccess();
R_SUCCEED();
}
Result ReadProgramInfo() {
@@ -128,7 +128,7 @@ namespace ams::pgl::srv {
m_program_id = {key.id};
m_program_version = key.version;
m_content_meta_type = key.type;
return ResultSuccess();
R_SUCCEED();
}
Result GetContentPath(lr::Path *out, ncm::ContentType type, util::optional<u8> index) const {
@@ -182,7 +182,7 @@ namespace ams::pgl::srv {
R_TRY(this->SearchContent(std::addressof(has_content), out, file_name, fs::OpenDirectoryMode_File));
R_UNLESS(has_content, pgl::ResultApplicationContentNotFound());
return ResultSuccess();
R_SUCCEED();
}
Result GetContentPathInNspd(lr::Path *out, ncm::ContentType type, util::optional<u8> index) const {
@@ -209,14 +209,14 @@ namespace ams::pgl::srv {
R_TRY(this->SearchContent(std::addressof(has_content), out, file_name, fs::OpenDirectoryMode_Directory));
R_UNLESS(has_content, pgl::ResultApplicationContentNotFound());
return ResultSuccess();
R_SUCCEED();
}
Result GetProgramIndex(u8 *out) {
/* Nspd programs do not have indices. */
if (m_extension_type == ExtensionType::Nspd) {
*out = 0;
return ResultSuccess();
R_SUCCEED();
}
/* Create a reader. */
@@ -228,7 +228,7 @@ namespace ams::pgl::srv {
/* Return the index. */
*out = program_content_info->GetIdOffset();
return ResultSuccess();
R_SUCCEED();
}
Result SetExtensionType() {
@@ -239,12 +239,12 @@ namespace ams::pgl::srv {
if (HasSuffix(m_content_path, ".nsp")) {
m_extension_type = ExtensionType::Nsp;
return ResultSuccess();
R_SUCCEED();
} else if (HasSuffix(m_content_path, ".nspd") || HasSuffix(m_content_path, ".nspd/")) {
m_extension_type = ExtensionType::Nspd;
return ResultSuccess();
R_SUCCEED();
} else {
return fs::ResultPathNotFound();
R_THROW(fs::ResultPathNotFound());
}
}
@@ -297,13 +297,13 @@ namespace ams::pgl::srv {
}
}
return ResultSuccess();
R_SUCCEED();
}
}
/* We didn't find a match. */
*out = false;
return ResultSuccess();
R_SUCCEED();
}
};
@@ -351,7 +351,7 @@ namespace ams::pgl::srv {
.id_offset = reader.GetProgramIndex(),
};
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -49,22 +49,22 @@ namespace ams::pgl::srv {
Result ShellInterfaceCommon::IsProcessTrackedImpl(bool *out, os::ProcessId process_id) {
*out = pgl::srv::IsProcessTracked(process_id);
return ResultSuccess();
R_SUCCEED();
}
Result ShellInterfaceCommon::EnableApplicationCrashReportImpl(bool enabled) {
pgl::srv::EnableApplicationCrashReport(enabled);
return ResultSuccess();
R_SUCCEED();
}
Result ShellInterfaceCommon::IsApplicationCrashReportEnabledImpl(bool *out) {
*out = pgl::srv::IsApplicationCrashReportEnabled();
return ResultSuccess();
R_SUCCEED();
}
Result ShellInterfaceCommon::EnableApplicationAllThreadDumpOnCrashImpl(bool enabled) {
pgl::srv::EnableApplicationAllThreadDumpOnCrash(enabled);
return ResultSuccess();
R_SUCCEED();
}
Result ShellInterfaceCommon::TriggerApplicationSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size) {
@@ -122,12 +122,12 @@ namespace ams::pgl::srv {
R_UNLESS(session != nullptr, pgl::ResultOutOfMemory());
*out = std::move(session);
return ResultSuccess();
R_SUCCEED();
}
Result ShellInterfaceCmif::Command21NotImplemented(ams::sf::Out<u64> out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2) {
AMS_UNUSED(out, in, buf1, buf2);
return pgl::ResultNotImplemented();
R_THROW(pgl::ResultNotImplemented());
}
Result ShellInterfaceTipc::LaunchProgram(ams::tipc::Out<os::ProcessId> out, const ncm::ProgramLocation loc, u32 pm_flags, u8 pgl_flags) {