ams: globally prefer R_RETURN to return for ams::Result
This commit is contained in:
@@ -32,26 +32,26 @@ namespace ams::pgl {
|
||||
|
||||
Result GetProcessEventHandle(ams::sf::OutCopyHandle out) {
|
||||
::Event ev;
|
||||
R_TRY(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev)));
|
||||
out.SetValue(ev.revent, true);
|
||||
R_SUCCEED();
|
||||
ON_RESULT_SUCCESS { out.SetValue(ev.revent, true); };
|
||||
|
||||
R_RETURN(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev)));
|
||||
}
|
||||
|
||||
Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
||||
static_assert(sizeof(*out.GetPointer()) == sizeof(::PmProcessEventInfo));
|
||||
return ::pglEventObserverGetProcessEventInfo(std::addressof(m_observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer()));
|
||||
R_RETURN(::pglEventObserverGetProcessEventInfo(std::addressof(m_observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result GetProcessEventHandle(ams::tipc::OutCopyHandle out) {
|
||||
::Event ev;
|
||||
R_TRY(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev)));
|
||||
out.SetValue(ev.revent);
|
||||
R_SUCCEED();
|
||||
ON_RESULT_SUCCESS { out.SetValue(ev.revent); };
|
||||
|
||||
R_RETURN(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev)));
|
||||
}
|
||||
|
||||
Result GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out) {
|
||||
static_assert(sizeof(*out.GetPointer()) == sizeof(::PmProcessEventInfo));
|
||||
return ::pglEventObserverGetProcessEventInfo(std::addressof(m_observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer()));
|
||||
R_RETURN(::pglEventObserverGetProcessEventInfo(std::addressof(m_observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer())));
|
||||
}
|
||||
};
|
||||
static_assert(pgl::sf::IsIEventObserver<RemoteEventObserver>);
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace ams::pgl {
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
Result Initialize() {
|
||||
return ::pglInitialize();
|
||||
R_RETURN(::pglInitialize());
|
||||
}
|
||||
|
||||
void Finalize() {
|
||||
@@ -68,50 +68,50 @@ namespace ams::pgl {
|
||||
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 process_flags, u8 pgl_flags) {
|
||||
static_assert(sizeof(*out) == sizeof(u64));
|
||||
static_assert(sizeof(loc) == sizeof(::NcmProgramLocation));
|
||||
return ::pglLaunchProgram(reinterpret_cast<u64 *>(out), reinterpret_cast<const ::NcmProgramLocation *>(std::addressof(loc)), process_flags, pgl_flags);
|
||||
R_RETURN(::pglLaunchProgram(reinterpret_cast<u64 *>(out), reinterpret_cast<const ::NcmProgramLocation *>(std::addressof(loc)), process_flags, pgl_flags));
|
||||
}
|
||||
|
||||
Result TerminateProcess(os::ProcessId process_id) {
|
||||
return ::pglTerminateProcess(static_cast<u64>(process_id));
|
||||
R_RETURN(::pglTerminateProcess(static_cast<u64>(process_id)));
|
||||
}
|
||||
|
||||
Result LaunchProgramFromHost(os::ProcessId *out, const char *content_path, u32 process_flags) {
|
||||
static_assert(sizeof(*out) == sizeof(u64));
|
||||
return ::pglLaunchProgramFromHost(reinterpret_cast<u64 *>(out), content_path, process_flags);
|
||||
R_RETURN(::pglLaunchProgramFromHost(reinterpret_cast<u64 *>(out), content_path, process_flags));
|
||||
}
|
||||
|
||||
Result GetHostContentMetaInfo(pgl::ContentMetaInfo *out, const char *content_path) {
|
||||
static_assert(sizeof(*out) == sizeof(::PglContentMetaInfo));
|
||||
return ::pglGetHostContentMetaInfo(reinterpret_cast<::PglContentMetaInfo *>(out), content_path);
|
||||
R_RETURN(::pglGetHostContentMetaInfo(reinterpret_cast<::PglContentMetaInfo *>(out), content_path));
|
||||
}
|
||||
|
||||
Result GetApplicationProcessId(os::ProcessId *out) {
|
||||
static_assert(sizeof(*out) == sizeof(u64));
|
||||
return ::pglGetApplicationProcessId(reinterpret_cast<u64 *>(out));
|
||||
R_RETURN(::pglGetApplicationProcessId(reinterpret_cast<u64 *>(out)));
|
||||
}
|
||||
|
||||
Result BoostSystemMemoryResourceLimit(u64 size) {
|
||||
return ::pglBoostSystemMemoryResourceLimit(size);
|
||||
R_RETURN(::pglBoostSystemMemoryResourceLimit(size));
|
||||
}
|
||||
|
||||
Result IsProcessTracked(bool *out, os::ProcessId process_id) {
|
||||
return ::pglIsProcessTracked(out, static_cast<u64>(process_id));
|
||||
R_RETURN(::pglIsProcessTracked(out, static_cast<u64>(process_id)));
|
||||
}
|
||||
|
||||
Result EnableApplicationCrashReport(bool enabled) {
|
||||
return ::pglEnableApplicationCrashReport(enabled);
|
||||
R_RETURN(::pglEnableApplicationCrashReport(enabled));
|
||||
}
|
||||
|
||||
Result IsApplicationCrashReportEnabled(bool *out) {
|
||||
return ::pglIsApplicationCrashReportEnabled(out);
|
||||
R_RETURN(::pglIsApplicationCrashReportEnabled(out));
|
||||
}
|
||||
|
||||
Result EnableApplicationAllThreadDumpOnCrash(bool enabled) {
|
||||
return ::pglEnableApplicationAllThreadDumpOnCrash(enabled);
|
||||
R_RETURN(::pglEnableApplicationAllThreadDumpOnCrash(enabled));
|
||||
}
|
||||
|
||||
Result TriggerApplicationSnapShotDumper(const char *arg, SnapShotDumpType dump_type) {
|
||||
return ::pglTriggerApplicationSnapShotDumper(static_cast<::PglSnapShotDumpType>(dump_type), arg);
|
||||
R_RETURN(::pglTriggerApplicationSnapShotDumper(static_cast<::PglSnapShotDumpType>(dump_type), arg));
|
||||
}
|
||||
|
||||
Result GetEventObserver(pgl::EventObserver *out) {
|
||||
|
||||
@@ -400,7 +400,7 @@ namespace ams::pgl::srv {
|
||||
|
||||
Result TerminateProcess(os::ProcessId process_id) {
|
||||
/* Ask PM to terminate the process. */
|
||||
return pm::shell::TerminateProcess(process_id);
|
||||
R_RETURN(pm::shell::TerminateProcess(process_id));
|
||||
}
|
||||
|
||||
Result GetApplicationProcessId(os::ProcessId *out) {
|
||||
@@ -415,7 +415,7 @@ namespace ams::pgl::srv {
|
||||
|
||||
Result BoostSystemMemoryResourceLimit(u64 size) {
|
||||
/* Ask PM to boost the limit. */
|
||||
return pm::shell::BoostSystemMemoryResourceLimit(size);
|
||||
R_RETURN(pm::shell::BoostSystemMemoryResourceLimit(size));
|
||||
}
|
||||
|
||||
bool IsProcessTracked(os::ProcessId process_id) {
|
||||
@@ -493,7 +493,7 @@ namespace ams::pgl::srv {
|
||||
|
||||
/* Launch the snapshot dumper, clearing the global tracker process id. */
|
||||
ON_SCOPE_EXIT { g_ssd_process_id = os::InvalidProcessId; };
|
||||
return TriggerSnapShotDumper(process_id, dump_type, arg);
|
||||
R_RETURN(TriggerSnapShotDumper(process_id, dump_type, arg));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace ams::pgl::srv {
|
||||
}
|
||||
|
||||
Result ShellEventObserverCmif::GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
||||
return this->PopEventInfo(out.GetPointer());
|
||||
R_RETURN(this->PopEventInfo(out.GetPointer()));
|
||||
}
|
||||
|
||||
Result ShellEventObserverTipc::GetProcessEventHandle(ams::tipc::OutCopyHandle out) {
|
||||
@@ -80,7 +80,7 @@ namespace ams::pgl::srv {
|
||||
}
|
||||
|
||||
Result ShellEventObserverTipc::GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out) {
|
||||
return this->PopEventInfo(out.GetPointer());
|
||||
R_RETURN(this->PopEventInfo(out.GetPointer()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -133,8 +133,8 @@ namespace ams::pgl::srv {
|
||||
|
||||
Result GetContentPath(lr::Path *out, ncm::ContentType type, util::optional<u8> index) const {
|
||||
switch (m_extension_type) {
|
||||
case ExtensionType::Nsp: return this->GetContentPathInNsp(out, type, index);
|
||||
case ExtensionType::Nspd: return this->GetContentPathInNspd(out, type, index);
|
||||
case ExtensionType::Nsp: R_RETURN(this->GetContentPathInNsp(out, type, index));
|
||||
case ExtensionType::Nspd: R_RETURN(this->GetContentPathInNspd(out, type, index));
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ namespace ams::pgl::srv {
|
||||
R_UNLESS(has_content, pgl::ResultContentMetaNotFound());
|
||||
|
||||
/* Read the content meta buffer. */
|
||||
return ncm::ReadContentMetaPathWithoutExtendedDataOrDigest(std::addressof(m_content_meta_buffer), meta_path.str);
|
||||
R_RETURN(ncm::ReadContentMetaPathWithoutExtendedDataOrDigest(std::addressof(m_content_meta_buffer), meta_path.str));
|
||||
}
|
||||
|
||||
Result SearchContent(bool *out, lr::Path *out_path, const char *extension, fs::OpenDirectoryMode mode) const {
|
||||
@@ -332,7 +332,7 @@ namespace ams::pgl::srv {
|
||||
host_resolver.RedirectProgramPath(content_path, reader.GetProgramId());
|
||||
|
||||
/* Launch the program. */
|
||||
return pgl::srv::LaunchProgram(out, ncm::ProgramLocation::Make(reader.GetProgramId(), ncm::StorageId::Host), pm_flags, pgl::LaunchFlags_None);
|
||||
R_RETURN(pgl::srv::LaunchProgram(out, ncm::ProgramLocation::Make(reader.GetProgramId(), ncm::StorageId::Host), pm_flags, pgl::LaunchFlags_None));
|
||||
}
|
||||
|
||||
Result GetHostContentMetaInfo(pgl::ContentMetaInfo *out, const char *package_path) {
|
||||
|
||||
@@ -22,29 +22,29 @@
|
||||
namespace ams::pgl::srv {
|
||||
|
||||
Result ShellInterfaceCommon::LaunchProgramImpl(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) {
|
||||
return pgl::srv::LaunchProgram(out, loc, pm_flags, pgl_flags);
|
||||
R_RETURN(pgl::srv::LaunchProgram(out, loc, pm_flags, pgl_flags));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCommon::TerminateProcessImpl(os::ProcessId process_id) {
|
||||
return pgl::srv::TerminateProcess(process_id);
|
||||
R_RETURN(pgl::srv::TerminateProcess(process_id));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCommon::LaunchProgramFromHostImpl(os::ProcessId *out, const void *content_path, size_t content_path_size, u32 pm_flags) {
|
||||
AMS_UNUSED(content_path_size);
|
||||
return pgl::srv::LaunchProgramFromHost(out, static_cast<const char *>(content_path), pm_flags);
|
||||
R_RETURN(pgl::srv::LaunchProgramFromHost(out, static_cast<const char *>(content_path), pm_flags));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCommon::GetHostContentMetaInfoImpl(pgl::ContentMetaInfo *out, const void *content_path, size_t content_path_size) {
|
||||
AMS_UNUSED(content_path_size);
|
||||
return pgl::srv::GetHostContentMetaInfo(out, static_cast<const char *>(content_path));
|
||||
R_RETURN(pgl::srv::GetHostContentMetaInfo(out, static_cast<const char *>(content_path)));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCommon::GetApplicationProcessIdImpl(os::ProcessId *out) {
|
||||
return pgl::srv::GetApplicationProcessId(out);
|
||||
R_RETURN(pgl::srv::GetApplicationProcessId(out));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCommon::BoostSystemMemoryResourceLimitImpl(u64 size) {
|
||||
return pgl::srv::BoostSystemMemoryResourceLimit(size);
|
||||
R_RETURN(pgl::srv::BoostSystemMemoryResourceLimit(size));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCommon::IsProcessTrackedImpl(bool *out, os::ProcessId process_id) {
|
||||
@@ -69,51 +69,51 @@ namespace ams::pgl::srv {
|
||||
|
||||
Result ShellInterfaceCommon::TriggerApplicationSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size) {
|
||||
AMS_UNUSED(arg_size);
|
||||
return pgl::srv::TriggerApplicationSnapShotDumper(dump_type, static_cast<const char *>(arg));
|
||||
R_RETURN(pgl::srv::TriggerApplicationSnapShotDumper(dump_type, static_cast<const char *>(arg)));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) {
|
||||
return this->LaunchProgramImpl(out.GetPointer(), loc, pm_flags, pgl_flags);
|
||||
R_RETURN(this->LaunchProgramImpl(out.GetPointer(), loc, pm_flags, pgl_flags));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::TerminateProcess(os::ProcessId process_id) {
|
||||
return this->TerminateProcessImpl(process_id);
|
||||
R_RETURN(this->TerminateProcessImpl(process_id));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::LaunchProgramFromHost(ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags) {
|
||||
return this->LaunchProgramFromHostImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize(), pm_flags);
|
||||
R_RETURN(this->LaunchProgramFromHostImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize(), pm_flags));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::GetHostContentMetaInfo(ams::sf::Out<pgl::ContentMetaInfo> out, const ams::sf::InBuffer &content_path) {
|
||||
return this->GetHostContentMetaInfoImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize());
|
||||
R_RETURN(this->GetHostContentMetaInfoImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize()));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::GetApplicationProcessId(ams::sf::Out<os::ProcessId> out) {
|
||||
return this->GetApplicationProcessIdImpl(out.GetPointer());
|
||||
R_RETURN(this->GetApplicationProcessIdImpl(out.GetPointer()));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::BoostSystemMemoryResourceLimit(u64 size) {
|
||||
return this->BoostSystemMemoryResourceLimitImpl(size);
|
||||
R_RETURN(this->BoostSystemMemoryResourceLimitImpl(size));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::IsProcessTracked(ams::sf::Out<bool> out, os::ProcessId process_id) {
|
||||
return this->IsProcessTrackedImpl(out.GetPointer(), process_id);
|
||||
R_RETURN(this->IsProcessTrackedImpl(out.GetPointer(), process_id));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::EnableApplicationCrashReport(bool enabled) {
|
||||
return this->EnableApplicationCrashReportImpl(enabled);
|
||||
R_RETURN(this->EnableApplicationCrashReportImpl(enabled));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::IsApplicationCrashReportEnabled(ams::sf::Out<bool> out) {
|
||||
return this->IsApplicationCrashReportEnabledImpl(out.GetPointer());
|
||||
R_RETURN(this->IsApplicationCrashReportEnabledImpl(out.GetPointer()));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::EnableApplicationAllThreadDumpOnCrash(bool enabled) {
|
||||
return this->EnableApplicationAllThreadDumpOnCrashImpl(enabled);
|
||||
R_RETURN(this->EnableApplicationAllThreadDumpOnCrashImpl(enabled));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg) {
|
||||
return this->TriggerApplicationSnapShotDumperImpl(dump_type, arg.GetPointer(), arg.GetSize());
|
||||
R_RETURN(this->TriggerApplicationSnapShotDumperImpl(dump_type, arg.GetPointer(), arg.GetSize()));
|
||||
}
|
||||
|
||||
Result ShellInterfaceCmif::GetShellEventObserver(ams::sf::Out<ams::sf::SharedPointer<pgl::sf::IEventObserver>> out) {
|
||||
@@ -131,47 +131,47 @@ namespace ams::pgl::srv {
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::LaunchProgram(ams::tipc::Out<os::ProcessId> out, const ncm::ProgramLocation loc, u32 pm_flags, u8 pgl_flags) {
|
||||
return this->LaunchProgramImpl(out.GetPointer(), loc, pm_flags, pgl_flags);
|
||||
R_RETURN(this->LaunchProgramImpl(out.GetPointer(), loc, pm_flags, pgl_flags));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::TerminateProcess(os::ProcessId process_id) {
|
||||
return this->TerminateProcessImpl(process_id);
|
||||
R_RETURN(this->TerminateProcessImpl(process_id));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::LaunchProgramFromHost(ams::tipc::Out<os::ProcessId> out, const ams::tipc::InBuffer content_path, u32 pm_flags) {
|
||||
return this->LaunchProgramFromHostImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize(), pm_flags);
|
||||
R_RETURN(this->LaunchProgramFromHostImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize(), pm_flags));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::GetHostContentMetaInfo(ams::tipc::Out<pgl::ContentMetaInfo> out, const ams::tipc::InBuffer content_path) {
|
||||
return this->GetHostContentMetaInfoImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize());
|
||||
R_RETURN(this->GetHostContentMetaInfoImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize()));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::GetApplicationProcessId(ams::tipc::Out<os::ProcessId> out) {
|
||||
return this->GetApplicationProcessIdImpl(out.GetPointer());
|
||||
R_RETURN(this->GetApplicationProcessIdImpl(out.GetPointer()));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::BoostSystemMemoryResourceLimit(u64 size) {
|
||||
return this->BoostSystemMemoryResourceLimitImpl(size);
|
||||
R_RETURN(this->BoostSystemMemoryResourceLimitImpl(size));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::IsProcessTracked(ams::tipc::Out<bool> out, os::ProcessId process_id) {
|
||||
return this->IsProcessTrackedImpl(out.GetPointer(), process_id);
|
||||
R_RETURN(this->IsProcessTrackedImpl(out.GetPointer(), process_id));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::EnableApplicationCrashReport(bool enabled) {
|
||||
return this->EnableApplicationCrashReportImpl(enabled);
|
||||
R_RETURN(this->EnableApplicationCrashReportImpl(enabled));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::IsApplicationCrashReportEnabled(ams::tipc::Out<bool> out) {
|
||||
return this->IsApplicationCrashReportEnabledImpl(out.GetPointer());
|
||||
R_RETURN(this->IsApplicationCrashReportEnabledImpl(out.GetPointer()));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::EnableApplicationAllThreadDumpOnCrash(bool enabled) {
|
||||
return this->EnableApplicationAllThreadDumpOnCrashImpl(enabled);
|
||||
R_RETURN(this->EnableApplicationAllThreadDumpOnCrashImpl(enabled));
|
||||
}
|
||||
|
||||
Result ShellInterfaceTipc::GetShellEventObserver(ams::tipc::OutMoveHandle out) {
|
||||
return pgl::srv::AllocateShellEventObserverForTipc(out.GetPointer());
|
||||
R_RETURN(pgl::srv::AllocateShellEventObserverForTipc(out.GetPointer()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user