diff --git a/libraries/libstratosphere/include/stratosphere/pgl/sf/pgl_sf_i_shell_interface.hpp b/libraries/libstratosphere/include/stratosphere/pgl/sf/pgl_sf_i_shell_interface.hpp index a5fb69726..bafda6364 100644 --- a/libraries/libstratosphere/include/stratosphere/pgl/sf/pgl_sf_i_shell_interface.hpp +++ b/libraries/libstratosphere/include/stratosphere/pgl/sf/pgl_sf_i_shell_interface.hpp @@ -32,6 +32,7 @@ AMS_SF_METHOD_INFO(C, H, 8, Result, EnableApplicationCrashReport, (bool enabled), (enabled)) \ AMS_SF_METHOD_INFO(C, H, 9, Result, IsApplicationCrashReportEnabled, (ams::sf::Out out), (out)) \ AMS_SF_METHOD_INFO(C, H, 10, Result, EnableApplicationAllThreadDumpOnCrash, (bool enabled), (enabled)) \ + AMS_SF_METHOD_INFO(C, H, 11, Result, GetProcessId, (ams::sf::Out out, ncm::ProgramId program_id), (out, program_id)) \ AMS_SF_METHOD_INFO(C, H, 12, Result, TriggerApplicationSnapShotDumper, (pgl::SnapShotDumpType dump_type, const ams::sf::InBuffer &arg), (dump_type, arg)) \ AMS_SF_METHOD_INFO(C, H, 20, Result, GetShellEventObserver, (ams::sf::Out> out), (out)) \ AMS_SF_METHOD_INFO(C, H, 21, Result, Command21NotImplemented, (ams::sf::Out out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2), (out, in, buf1, buf2), hos::Version_11_0_0) diff --git a/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_shell_interface.hpp b/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_shell_interface.hpp index 77b7cf0dc..9f488b318 100644 --- a/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_shell_interface.hpp +++ b/libraries/libstratosphere/include/stratosphere/pgl/srv/pgl_srv_shell_interface.hpp @@ -37,6 +37,7 @@ namespace ams::pgl::srv { Result EnableApplicationCrashReportImpl(bool enabled); Result IsApplicationCrashReportEnabledImpl(bool *out); Result EnableApplicationAllThreadDumpOnCrashImpl(bool enabled); + Result GetProcessId(os::ProcessId *out, ncm::ProgramId program_id); Result TriggerApplicationSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size); }; @@ -62,6 +63,7 @@ namespace ams::pgl::srv { Result EnableApplicationCrashReport(bool enabled); Result IsApplicationCrashReportEnabled(ams::sf::Out out); Result EnableApplicationAllThreadDumpOnCrash(bool enabled); + Result GetProcessId(ams::sf::Out out, ncm::ProgramId program_id); Result TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg); Result GetShellEventObserver(ams::sf::Out> out); @@ -86,6 +88,7 @@ namespace ams::pgl::srv { Result EnableApplicationCrashReport(bool enabled); Result IsApplicationCrashReportEnabled(ams::tipc::Out out); Result EnableApplicationAllThreadDumpOnCrash(bool enabled); + Result GetProcessId(ams::tipc::Out out, ncm::ProgramId program_id); Result GetShellEventObserver(ams::tipc::OutMoveHandle out); }; static_assert(pgl::tipc::IsIShellInterface); diff --git a/libraries/libstratosphere/include/stratosphere/pm/impl/pm_shell_interface.hpp b/libraries/libstratosphere/include/stratosphere/pm/impl/pm_shell_interface.hpp index 1cccdab65..5510c7a41 100644 --- a/libraries/libstratosphere/include/stratosphere/pm/impl/pm_shell_interface.hpp +++ b/libraries/libstratosphere/include/stratosphere/pm/impl/pm_shell_interface.hpp @@ -30,7 +30,8 @@ AMS_SF_METHOD_INFO(C, H, 7, Result, BoostSystemMemoryResourceLimit, (u64 boost_size), (boost_size)) \ AMS_SF_METHOD_INFO(C, H, 8, Result, BoostApplicationThreadResourceLimit, (), ()) \ AMS_SF_METHOD_INFO(C, H, 9, void, GetBootFinishedEventHandle, (sf::OutCopyHandle out), (out), hos::Version_8_0_0) \ - AMS_SF_METHOD_INFO(C, H, 10, Result, BoostSystemThreadResourceLimit, (), ()) + AMS_SF_METHOD_INFO(C, H, 10, Result, BoostSystemThreadResourceLimit, (), ()) \ + AMS_SF_METHOD_INFO(C, H, 12, Result, GetProcessId, (sf::Out out, ncm::ProgramId program_id), (out, program_id)) AMS_SF_DEFINE_INTERFACE(ams::pm::impl, IShellInterface, AMS_PM_I_SHELL_INTERFACE_INTERFACE_INFO, 0x387D60C0) @@ -45,6 +46,7 @@ AMS_SF_DEFINE_INTERFACE(ams::pm::impl, IShellInterface, AMS_PM_I_SHELL_INTERFACE AMS_SF_METHOD_INFO(C, H, 7, void, NotifyBootFinished, (), ()) \ AMS_SF_METHOD_INFO(C, H, 8, Result, GetApplicationProcessIdForShell, (sf::Out out), (out)) \ AMS_SF_METHOD_INFO(C, H, 9, Result, BoostSystemMemoryResourceLimit, (u64 boost_size), (boost_size), hos::Version_4_0_0) \ - AMS_SF_METHOD_INFO(C, H, 10, Result, BoostSystemThreadResourceLimit, (), ()) + AMS_SF_METHOD_INFO(C, H, 10, Result, BoostSystemThreadResourceLimit, (), ()) \ + AMS_SF_METHOD_INFO(C, H, 12, Result, GetProcessId, (sf::Out out, ncm::ProgramId program_id), (out, program_id)) AMS_SF_DEFINE_INTERFACE(ams::pm::impl, IDeprecatedShellInterface, AMS_PM_I_DEPRECATED_SHELL_INTERFACE_INTERFACE_INFO, 0x387D60C0) diff --git a/libraries/libstratosphere/include/stratosphere/pm/pm_shell_api.hpp b/libraries/libstratosphere/include/stratosphere/pm/pm_shell_api.hpp index b4cd348c4..aa06a17cb 100644 --- a/libraries/libstratosphere/include/stratosphere/pm/pm_shell_api.hpp +++ b/libraries/libstratosphere/include/stratosphere/pm/pm_shell_api.hpp @@ -31,5 +31,6 @@ namespace ams::pm::shell { Result BoostSystemMemoryResourceLimit(u64 size); Result BoostApplicationThreadResourceLimit(); Result BoostSystemThreadResourceLimit(); + Result GetProcessId(os::ProcessId *out_process_id, const ncm::ProgramId program_id); } diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp index 52e43a5e3..f6c018bf0 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_interface.cpp @@ -67,6 +67,10 @@ namespace ams::pgl::srv { R_SUCCEED(); } + Result ShellInterfaceCommon::GetProcessId(os::ProcessId *out, ncm::ProgramId program_id) { + R_RETURN(pm::shell::GetProcessId(out, program_id)); + } + Result ShellInterfaceCommon::TriggerApplicationSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size) { AMS_UNUSED(arg_size); R_RETURN(pgl::srv::TriggerApplicationSnapShotDumper(dump_type, static_cast(arg))); @@ -116,6 +120,10 @@ namespace ams::pgl::srv { R_RETURN(this->TriggerApplicationSnapShotDumperImpl(dump_type, arg.GetPointer(), arg.GetSize())); } + Result ShellInterfaceCmif::GetProcessId(ams::sf::Out out, ncm::ProgramId program_id) { + R_RETURN(ShellInterfaceCommon::GetProcessId(out.GetPointer(), program_id)); + } + Result ShellInterfaceCmif::GetShellEventObserver(ams::sf::Out> out) { /* Allocate a new interface. */ auto session = ObjectFactory::CreateSharedEmplaced(m_allocator); @@ -170,6 +178,10 @@ namespace ams::pgl::srv { R_RETURN(this->EnableApplicationAllThreadDumpOnCrashImpl(enabled)); } + Result ShellInterfaceTipc::GetProcessId(ams::tipc::Out out, ncm::ProgramId program_id) { + R_RETURN(ShellInterfaceCommon::GetProcessId(out.GetPointer(), program_id)); + } + Result ShellInterfaceTipc::GetShellEventObserver(ams::tipc::OutMoveHandle out) { R_RETURN(pgl::srv::AllocateShellEventObserverForTipc(out.GetPointer())); } diff --git a/libraries/libstratosphere/source/pm/pm_shell_api.cpp b/libraries/libstratosphere/source/pm/pm_shell_api.cpp index 247d88cbb..f21f5df3f 100644 --- a/libraries/libstratosphere/source/pm/pm_shell_api.cpp +++ b/libraries/libstratosphere/source/pm/pm_shell_api.cpp @@ -58,6 +58,11 @@ namespace ams::pm::shell { Result BoostSystemThreadResourceLimit() { R_RETURN(::pmshellBoostSystemThreadResourceLimit()); } + + Result GetProcessId(os::ProcessId *out_process_id, const ncm::ProgramId program_id) { + static_assert(sizeof(*out_process_id) == sizeof(u64)); + R_RETURN(::pmshellGetProcessId(reinterpret_cast(out_process_id), static_cast(program_id))); + } #endif } diff --git a/stratosphere/pm/source/pm_shell_service.cpp b/stratosphere/pm/source/pm_shell_service.cpp index db69c6f12..c42e022f1 100644 --- a/stratosphere/pm/source/pm_shell_service.cpp +++ b/stratosphere/pm/source/pm_shell_service.cpp @@ -88,4 +88,8 @@ namespace ams::pm { R_RETURN(impl::BoostSystemThreadResourceLimit()); } + Result ShellService::GetProcessId(sf::Out out, ncm::ProgramId program_id) { + R_RETURN(impl::GetProcessId(out.GetPointer(), program_id)); + } + } diff --git a/stratosphere/pm/source/pm_shell_service.hpp b/stratosphere/pm/source/pm_shell_service.hpp index bb08d80bd..6766a2413 100644 --- a/stratosphere/pm/source/pm_shell_service.hpp +++ b/stratosphere/pm/source/pm_shell_service.hpp @@ -34,6 +34,7 @@ namespace ams::pm { Result BoostApplicationThreadResourceLimit(); void GetBootFinishedEventHandle(sf::OutCopyHandle out); Result BoostSystemThreadResourceLimit(); + Result GetProcessId(sf::Out out, ncm::ProgramId program_id); }; static_assert(pm::impl::IsIShellInterface);