pgl: clean up and add new 23.0.0 command
This commit is contained in:
@@ -33,8 +33,8 @@ namespace ams::pgl {
|
|||||||
|
|
||||||
virtual ~EventObserverInterface() { /* ... */ }
|
virtual ~EventObserverInterface() { /* ... */ }
|
||||||
|
|
||||||
virtual Result GetSystemEvent(os::SystemEventType *out) = 0;
|
virtual Result GetShellEvent(os::SystemEventType *out) = 0;
|
||||||
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) = 0;
|
virtual Result GetShellEventInfo(pm::ProcessEventInfo *out) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EventObserverByCmif final : public EventObserverInterface {
|
class EventObserverByCmif final : public EventObserverInterface {
|
||||||
@@ -45,9 +45,9 @@ namespace ams::pgl {
|
|||||||
public:
|
public:
|
||||||
explicit EventObserverByCmif(ams::sf::SharedPointer<pgl::sf::IEventObserver> intf) : m_cmif_interface(intf) { /* ... */ }
|
explicit EventObserverByCmif(ams::sf::SharedPointer<pgl::sf::IEventObserver> intf) : m_cmif_interface(intf) { /* ... */ }
|
||||||
public:
|
public:
|
||||||
virtual Result GetSystemEvent(os::SystemEventType *out) override {
|
virtual Result GetShellEvent(os::SystemEventType *out) override {
|
||||||
ams::sf::NativeHandle handle;
|
ams::sf::NativeHandle handle;
|
||||||
R_TRY(m_cmif_interface->GetProcessEventHandle(std::addressof(handle)));
|
R_TRY(m_cmif_interface->GetShellEvent(std::addressof(handle)));
|
||||||
|
|
||||||
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), os::EventClearMode_AutoClear);
|
os::AttachReadableHandleToSystemEvent(out, handle.GetOsHandle(), handle.IsManaged(), os::EventClearMode_AutoClear);
|
||||||
handle.Detach();
|
handle.Detach();
|
||||||
@@ -55,8 +55,8 @@ namespace ams::pgl {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
|
virtual Result GetShellEventInfo(pm::ProcessEventInfo *out) override {
|
||||||
R_RETURN(m_cmif_interface->GetProcessEventInfo(out));
|
R_RETURN(m_cmif_interface->GetShellEventInfo(out));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -70,15 +70,15 @@ namespace ams::pgl {
|
|||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
explicit EventObserverByTipc(Args &&... args) : m_tipc_interface(std::forward<Args>(args)...) { /* ... */ }
|
explicit EventObserverByTipc(Args &&... args) : m_tipc_interface(std::forward<Args>(args)...) { /* ... */ }
|
||||||
public:
|
public:
|
||||||
virtual Result GetSystemEvent(os::SystemEventType *out) override {
|
virtual Result GetShellEvent(os::SystemEventType *out) override {
|
||||||
os::NativeHandle handle;
|
os::NativeHandle handle;
|
||||||
R_TRY(m_tipc_interface.GetProcessEventHandle(std::addressof(handle)));
|
R_TRY(m_tipc_interface.GetShellEvent(std::addressof(handle)));
|
||||||
os::AttachReadableHandleToSystemEvent(out, handle, true, os::EventClearMode_AutoClear);
|
os::AttachReadableHandleToSystemEvent(out, handle, true, os::EventClearMode_AutoClear);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Result GetProcessEventInfo(pm::ProcessEventInfo *out) override {
|
virtual Result GetShellEventInfo(pm::ProcessEventInfo *out) override {
|
||||||
R_RETURN(m_tipc_interface.GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo>(out)));
|
R_RETURN(m_tipc_interface.GetShellEventInfo(ams::tipc::Out<pm::ProcessEventInfo>(out)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -112,12 +112,12 @@ namespace ams::pgl {
|
|||||||
std::swap(m_impl, rhs.m_impl);
|
std::swap(m_impl, rhs.m_impl);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
Result GetSystemEvent(os::SystemEventType *out) {
|
Result GetShellEvent(os::SystemEventType *out) {
|
||||||
R_RETURN(m_impl->GetSystemEvent(out));
|
R_RETURN(m_impl->GetShellEvent(out));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetProcessEventInfo(pm::ProcessEventInfo *out) {
|
Result GetShellEventInfo(pm::ProcessEventInfo *out) {
|
||||||
R_RETURN(m_impl->GetProcessEventInfo(out));
|
R_RETURN(m_impl->GetShellEventInfo(out));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,15 +27,15 @@ namespace ams::pgl {
|
|||||||
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 process_flags, u8 pgl_flags);
|
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 process_flags, u8 pgl_flags);
|
||||||
Result TerminateProcess(os::ProcessId process_id);
|
Result TerminateProcess(os::ProcessId process_id);
|
||||||
Result LaunchProgramFromHost(os::ProcessId *out, const char *content_path, u32 process_flags);
|
Result LaunchProgramFromHost(os::ProcessId *out, const char *content_path, u32 process_flags);
|
||||||
Result GetHostContentMetaInfo(pgl::ContentMetaInfo *out, const char *content_path);
|
Result GetProgramLaunchPropertyFromHost(pgl::ProgramLaunchProperty *out, const char *content_path);
|
||||||
Result GetApplicationProcessId(os::ProcessId *out);
|
Result GetRunningApplicationProcessId(os::ProcessId *out);
|
||||||
Result BoostSystemMemoryResourceLimit(u64 size);
|
Result BoostSystemMemoryResourceLimit(u64 size);
|
||||||
Result IsProcessTracked(bool *out, os::ProcessId process_id);
|
Result IsRunningProcess(bool *out, os::ProcessId process_id);
|
||||||
Result EnableApplicationCrashReport(bool enabled);
|
Result EnableApplicationCrashReport(bool enabled);
|
||||||
Result IsApplicationCrashReportEnabled(bool *out);
|
Result IsApplicationCrashReportEnabled(bool *out);
|
||||||
Result EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
Result EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
||||||
Result TriggerApplicationSnapShotDumper(const char *arg, SnapShotDumpType dump_type);
|
Result TriggerSnapShotDumper(const char *arg, SnapShotDumpType dump_type);
|
||||||
|
Result CreateShellEvent(pgl::EventObserver *out);
|
||||||
Result GetEventObserver(pgl::EventObserver *out);
|
Result EnableApplicationCrashReport2(os::ProcessId process_id, bool enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ namespace ams::pgl {
|
|||||||
Full = 2,
|
Full = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TODO: Is this really nn::ncm::Content<Something>Info? */
|
struct ProgramLaunchProperty {
|
||||||
struct ContentMetaInfo {
|
|
||||||
u64 id;
|
u64 id;
|
||||||
u32 version;
|
u32 version;
|
||||||
ncm::ContentType content_type;
|
ncm::ContentType content_type;
|
||||||
@@ -44,7 +43,7 @@ namespace ams::pgl {
|
|||||||
ncm::ContentMetaType content_meta_type;
|
ncm::ContentMetaType content_meta_type;
|
||||||
u8 reserved_0F;
|
u8 reserved_0F;
|
||||||
|
|
||||||
static constexpr ContentMetaInfo Make(u64 id, u32 version, ncm::ContentType content_type, u8 id_offset) {
|
static constexpr ProgramLaunchProperty Make(u64 id, u32 version, ncm::ContentType content_type, u8 id_offset) {
|
||||||
return {
|
return {
|
||||||
.id = id,
|
.id = id,
|
||||||
.version = version,
|
.version = version,
|
||||||
@@ -53,6 +52,6 @@ namespace ams::pgl {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static_assert(sizeof(ContentMetaInfo) == 0x10 && util::is_pod<ContentMetaInfo>::value);
|
static_assert(sizeof(ProgramLaunchProperty) == 0x10 && util::is_pod<ProgramLaunchProperty>::value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
#include <stratosphere/pgl/pgl_types.hpp>
|
#include <stratosphere/pgl/pgl_types.hpp>
|
||||||
|
|
||||||
#define AMS_PGL_SF_I_EVENT_OBSERVER_INTERFACE_INFO(C, H) \
|
#define AMS_PGL_SF_I_EVENT_OBSERVER_INTERFACE_INFO(C, H) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 0, Result, GetProcessEventHandle, (ams::sf::OutCopyHandle out), (out)) \
|
AMS_SF_METHOD_INFO(C, H, 0, Result, GetShellEvent, (ams::sf::OutCopyHandle out), (out)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 1, Result, GetProcessEventInfo, (ams::sf::Out<pm::ProcessEventInfo> out), (out))
|
AMS_SF_METHOD_INFO(C, H, 1, Result, GetShellEventInfo, (ams::sf::Out<pm::ProcessEventInfo> out), (out))
|
||||||
|
|
||||||
AMS_SF_DEFINE_INTERFACE(ams::pgl::sf, IEventObserver, AMS_PGL_SF_I_EVENT_OBSERVER_INTERFACE_INFO, 0x00000000);
|
AMS_SF_DEFINE_INTERFACE(ams::pgl::sf, IEventObserver, AMS_PGL_SF_I_EVENT_OBSERVER_INTERFACE_INFO, 0x00000000);
|
||||||
|
|
||||||
|
|||||||
@@ -25,16 +25,15 @@
|
|||||||
AMS_SF_METHOD_INFO(C, H, 0, Result, LaunchProgram, (ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags), (out, loc, pm_flags, pgl_flags)) \
|
AMS_SF_METHOD_INFO(C, H, 0, Result, LaunchProgram, (ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags), (out, loc, pm_flags, pgl_flags)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 1, Result, TerminateProcess, (os::ProcessId process_id), (process_id)) \
|
AMS_SF_METHOD_INFO(C, H, 1, Result, TerminateProcess, (os::ProcessId process_id), (process_id)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 2, Result, LaunchProgramFromHost, (ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags), (out, content_path, pm_flags)) \
|
AMS_SF_METHOD_INFO(C, H, 2, Result, LaunchProgramFromHost, (ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags), (out, content_path, pm_flags)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 4, Result, GetHostContentMetaInfo, (ams::sf::Out<pgl::ContentMetaInfo> out, const ams::sf::InBuffer &content_path), (out, content_path)) \
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GetProgramLaunchPropertyFromHost, (ams::sf::Out<pgl::ProgramLaunchProperty> out, const ams::sf::InBuffer &content_path), (out, content_path)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 5, Result, GetApplicationProcessId, (ams::sf::Out<os::ProcessId> out), (out)) \
|
AMS_SF_METHOD_INFO(C, H, 5, Result, GetRunningApplicationProcessId, (ams::sf::Out<os::ProcessId> out), (out)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 6, Result, BoostSystemMemoryResourceLimit, (u64 size), (size)) \
|
AMS_SF_METHOD_INFO(C, H, 6, Result, BoostSystemMemoryResourceLimit, (u64 size), (size)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 7, Result, IsProcessTracked, (ams::sf::Out<bool> out, os::ProcessId process_id), (out, process_id)) \
|
AMS_SF_METHOD_INFO(C, H, 7, Result, IsRunningProcess, (ams::sf::Out<bool> out, os::ProcessId process_id), (out, process_id)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 8, Result, EnableApplicationCrashReport, (bool enabled), (enabled)) \
|
AMS_SF_METHOD_INFO(C, H, 8, Result, EnableApplicationCrashReport, (bool enabled), (enabled)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 9, Result, IsApplicationCrashReportEnabled, (ams::sf::Out<bool> out), (out)) \
|
AMS_SF_METHOD_INFO(C, H, 9, Result, IsApplicationCrashReportEnabled, (ams::sf::Out<bool> out), (out)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 10, Result, EnableApplicationAllThreadDumpOnCrash, (bool enabled), (enabled)) \
|
AMS_SF_METHOD_INFO(C, H, 10, Result, EnableApplicationAllThreadDumpOnCrash, (bool enabled), (enabled)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 11, Result, GetProcessId, (ams::sf::Out<os::ProcessId> out, ncm::ProgramId program_id), (out, program_id)) \
|
AMS_SF_METHOD_INFO(C, H, 12, Result, TriggerSnapShotDumper, (pgl::SnapShotDumpType dump_type, const ams::sf::InBuffer &arg), (dump_type, arg), hos::Version_10_0_0) \
|
||||||
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, CreateShellEvent, (ams::sf::Out<ams::sf::SharedPointer<pgl::sf::IEventObserver>> out), (out)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 20, Result, GetShellEventObserver, (ams::sf::Out<ams::sf::SharedPointer<pgl::sf::IEventObserver>> out), (out)) \
|
|
||||||
AMS_SF_METHOD_INFO(C, H, 21, Result, Command21NotImplemented, (ams::sf::Out<u64> out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2), (out, in, buf1, buf2), hos::Version_11_0_0)
|
AMS_SF_METHOD_INFO(C, H, 21, Result, Command21NotImplemented, (ams::sf::Out<u64> out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2), (out, in, buf1, buf2), hos::Version_11_0_0)
|
||||||
|
|
||||||
AMS_SF_DEFINE_INTERFACE(ams::pgl::sf, IShellInterface, AMS_PGL_I_SHELL_INTERFACE_INTERFACE_INFO, 0x00000000);
|
AMS_SF_DEFINE_INTERFACE(ams::pgl::sf, IShellInterface, AMS_PGL_I_SHELL_INTERFACE_INTERFACE_INFO, 0x00000000);
|
||||||
|
|||||||
@@ -30,15 +30,16 @@ namespace ams::pgl::srv {
|
|||||||
Result LaunchProgramImpl(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags);
|
Result LaunchProgramImpl(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags);
|
||||||
Result TerminateProcessImpl(os::ProcessId process_id);
|
Result TerminateProcessImpl(os::ProcessId process_id);
|
||||||
Result LaunchProgramFromHostImpl(os::ProcessId *out, const void *content_path, size_t content_path_size, u32 pm_flags);
|
Result LaunchProgramFromHostImpl(os::ProcessId *out, const void *content_path, size_t content_path_size, u32 pm_flags);
|
||||||
Result GetHostContentMetaInfoImpl(pgl::ContentMetaInfo *out, const void *content_path, size_t content_path_size);
|
Result GetProgramLaunchPropertyFromHostImpl(pgl::ProgramLaunchProperty *out, const void *content_path, size_t content_path_size);
|
||||||
Result GetApplicationProcessIdImpl(os::ProcessId *out);
|
Result GetRunningApplicationProcessIdImpl(os::ProcessId *out);
|
||||||
Result BoostSystemMemoryResourceLimitImpl(u64 size);
|
Result BoostSystemMemoryResourceLimitImpl(u64 size);
|
||||||
Result IsProcessTrackedImpl(bool *out, os::ProcessId process_id);
|
Result IsRunningProcessImpl(bool *out, os::ProcessId process_id);
|
||||||
Result EnableApplicationCrashReportImpl(bool enabled);
|
Result EnableApplicationCrashReportImpl(bool enabled);
|
||||||
Result IsApplicationCrashReportEnabledImpl(bool *out);
|
Result IsApplicationCrashReportEnabledImpl(bool *out);
|
||||||
Result EnableApplicationAllThreadDumpOnCrashImpl(bool enabled);
|
Result EnableApplicationAllThreadDumpOnCrashImpl(bool enabled);
|
||||||
Result GetProcessId(os::ProcessId *out, ncm::ProgramId program_id);
|
Result GetProcessIdImpl(os::ProcessId *out, ncm::ProgramId program_id);
|
||||||
Result TriggerApplicationSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size);
|
Result TriggerSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size);
|
||||||
|
Result EnableApplicationCrashReport2Impl(os::ProcessId process_id, bool enabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ShellInterfaceCmif : public ShellInterfaceCommon {
|
class ShellInterfaceCmif : public ShellInterfaceCommon {
|
||||||
@@ -56,17 +57,15 @@ namespace ams::pgl::srv {
|
|||||||
Result LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags);
|
Result LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags);
|
||||||
Result TerminateProcess(os::ProcessId process_id);
|
Result TerminateProcess(os::ProcessId process_id);
|
||||||
Result LaunchProgramFromHost(ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags);
|
Result LaunchProgramFromHost(ams::sf::Out<os::ProcessId> out, const ams::sf::InBuffer &content_path, u32 pm_flags);
|
||||||
Result GetHostContentMetaInfo(ams::sf::Out<pgl::ContentMetaInfo> out, const ams::sf::InBuffer &content_path);
|
Result GetProgramLaunchPropertyFromHost(ams::sf::Out<pgl::ProgramLaunchProperty> out, const ams::sf::InBuffer &content_path);
|
||||||
Result GetApplicationProcessId(ams::sf::Out<os::ProcessId> out);
|
Result GetRunningApplicationProcessId(ams::sf::Out<os::ProcessId> out);
|
||||||
Result BoostSystemMemoryResourceLimit(u64 size);
|
Result BoostSystemMemoryResourceLimit(u64 size);
|
||||||
Result IsProcessTracked(ams::sf::Out<bool> out, os::ProcessId process_id);
|
Result IsRunningProcess(ams::sf::Out<bool> out, os::ProcessId process_id);
|
||||||
Result EnableApplicationCrashReport(bool enabled);
|
Result EnableApplicationCrashReport(bool enabled);
|
||||||
Result IsApplicationCrashReportEnabled(ams::sf::Out<bool> out);
|
Result IsApplicationCrashReportEnabled(ams::sf::Out<bool> out);
|
||||||
Result EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
Result EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
||||||
Result GetProcessId(ams::sf::Out<os::ProcessId> out, ncm::ProgramId program_id);
|
Result TriggerSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg);
|
||||||
Result TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg);
|
Result CreateShellEvent(ams::sf::Out<ams::sf::SharedPointer<pgl::sf::IEventObserver>> out);
|
||||||
|
|
||||||
Result GetShellEventObserver(ams::sf::Out<ams::sf::SharedPointer<pgl::sf::IEventObserver>> out);
|
|
||||||
Result Command21NotImplemented(ams::sf::Out<u64> out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2);
|
Result Command21NotImplemented(ams::sf::Out<u64> out, u32 in, const ams::sf::InBuffer &buf1, const ams::sf::InBuffer &buf2);
|
||||||
};
|
};
|
||||||
static_assert(pgl::sf::IsIShellInterface<ShellInterfaceCmif>);
|
static_assert(pgl::sf::IsIShellInterface<ShellInterfaceCmif>);
|
||||||
@@ -81,15 +80,16 @@ namespace ams::pgl::srv {
|
|||||||
Result LaunchProgram(ams::tipc::Out<os::ProcessId> out, const ncm::ProgramLocation loc, u32 pm_flags, u8 pgl_flags);
|
Result LaunchProgram(ams::tipc::Out<os::ProcessId> out, const ncm::ProgramLocation loc, u32 pm_flags, u8 pgl_flags);
|
||||||
Result TerminateProcess(os::ProcessId process_id);
|
Result TerminateProcess(os::ProcessId process_id);
|
||||||
Result LaunchProgramFromHost(ams::tipc::Out<os::ProcessId> out, const ams::tipc::InBuffer content_path, u32 pm_flags);
|
Result LaunchProgramFromHost(ams::tipc::Out<os::ProcessId> out, const ams::tipc::InBuffer content_path, u32 pm_flags);
|
||||||
Result GetHostContentMetaInfo(ams::tipc::Out<pgl::ContentMetaInfo> out, const ams::tipc::InBuffer content_path);
|
Result GetProgramLaunchPropertyFromHost(ams::tipc::Out<pgl::ProgramLaunchProperty> out, const ams::tipc::InBuffer content_path);
|
||||||
Result GetApplicationProcessId(ams::tipc::Out<os::ProcessId> out);
|
Result GetRunningApplicationProcessId(ams::tipc::Out<os::ProcessId> out);
|
||||||
Result BoostSystemMemoryResourceLimit(u64 size);
|
Result BoostSystemMemoryResourceLimit(u64 size);
|
||||||
Result IsProcessTracked(ams::tipc::Out<bool> out, os::ProcessId process_id);
|
Result IsRunningProcess(ams::tipc::Out<bool> out, os::ProcessId process_id);
|
||||||
Result EnableApplicationCrashReport(bool enabled);
|
Result EnableApplicationCrashReport(bool enabled);
|
||||||
Result IsApplicationCrashReportEnabled(ams::tipc::Out<bool> out);
|
Result IsApplicationCrashReportEnabled(ams::tipc::Out<bool> out);
|
||||||
Result EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
Result EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
||||||
Result GetProcessId(ams::tipc::Out<os::ProcessId> out, ncm::ProgramId program_id);
|
Result GetProcessId(ams::tipc::Out<os::ProcessId> out, ncm::ProgramId program_id);
|
||||||
Result GetShellEventObserver(ams::tipc::OutMoveHandle out);
|
Result CreateShellEvent(ams::tipc::OutMoveHandle out);
|
||||||
|
Result EnableApplicationCrashReport2(os::ProcessId process_id, bool enabled);
|
||||||
};
|
};
|
||||||
static_assert(pgl::tipc::IsIShellInterface<ShellInterfaceTipc>);
|
static_assert(pgl::tipc::IsIShellInterface<ShellInterfaceTipc>);
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
#include <stratosphere/pgl/pgl_types.hpp>
|
#include <stratosphere/pgl/pgl_types.hpp>
|
||||||
|
|
||||||
#define AMS_PGL_TIPC_I_EVENT_OBSERVER_INTERFACE_INFO(C, H) \
|
#define AMS_PGL_TIPC_I_EVENT_OBSERVER_INTERFACE_INFO(C, H) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 0, Result, GetProcessEventHandle, (ams::tipc::OutCopyHandle out), (out)) \
|
AMS_TIPC_METHOD_INFO(C, H, 0, Result, GetShellEvent, (ams::tipc::OutCopyHandle out), (out)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 1, Result, GetProcessEventInfo, (ams::tipc::Out<pm::ProcessEventInfo> out), (out))
|
AMS_TIPC_METHOD_INFO(C, H, 1, Result, GetShellEventInfo, (ams::tipc::Out<pm::ProcessEventInfo> out), (out))
|
||||||
|
|
||||||
AMS_TIPC_DEFINE_INTERFACE(ams::pgl::tipc, IEventObserver, AMS_PGL_TIPC_I_EVENT_OBSERVER_INTERFACE_INFO);
|
AMS_TIPC_DEFINE_INTERFACE(ams::pgl::tipc, IEventObserver, AMS_PGL_TIPC_I_EVENT_OBSERVER_INTERFACE_INFO);
|
||||||
|
|
||||||
|
|||||||
@@ -22,17 +22,19 @@
|
|||||||
#include <stratosphere/pgl/pgl_types.hpp>
|
#include <stratosphere/pgl/pgl_types.hpp>
|
||||||
#include <stratosphere/pgl/tipc/pgl_tipc_i_event_observer.hpp>
|
#include <stratosphere/pgl/tipc/pgl_tipc_i_event_observer.hpp>
|
||||||
|
|
||||||
#define AMS_PGL_TIPC_I_SHELL_INTERFACE_INTERFACE_INFO(C, H) \
|
#define AMS_PGL_TIPC_I_SHELL_INTERFACE_INTERFACE_INFO(C, H) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 0, Result, LaunchProgram, (ams::tipc::Out<os::ProcessId> out, const ncm::ProgramLocation loc, u32 pm_flags, u8 pgl_flags), (out, loc, pm_flags, pgl_flags)) \
|
AMS_TIPC_METHOD_INFO(C, H, 0, Result, LaunchProgram, (ams::tipc::Out<os::ProcessId> out, const ncm::ProgramLocation loc, u32 pm_flags, u8 pgl_flags), (out, loc, pm_flags, pgl_flags)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 1, Result, TerminateProcess, (os::ProcessId process_id), (process_id)) \
|
AMS_TIPC_METHOD_INFO(C, H, 1, Result, TerminateProcess, (os::ProcessId process_id), (process_id)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 2, Result, LaunchProgramFromHost, (ams::tipc::Out<os::ProcessId> out, const ams::tipc::InBuffer content_path, u32 pm_flags), (out, content_path, pm_flags)) \
|
AMS_TIPC_METHOD_INFO(C, H, 2, Result, LaunchProgramFromHost, (ams::tipc::Out<os::ProcessId> out, const ams::tipc::InBuffer content_path, u32 pm_flags), (out, content_path, pm_flags)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 4, Result, GetHostContentMetaInfo, (ams::tipc::Out<pgl::ContentMetaInfo> out, const ams::tipc::InBuffer content_path), (out, content_path)) \
|
AMS_TIPC_METHOD_INFO(C, H, 4, Result, GetProgramLaunchPropertyFromHost, (ams::tipc::Out<pgl::ProgramLaunchProperty> out, const ams::tipc::InBuffer content_path), (out, content_path)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 5, Result, GetApplicationProcessId, (ams::tipc::Out<os::ProcessId> out), (out)) \
|
AMS_TIPC_METHOD_INFO(C, H, 5, Result, GetRunningApplicationProcessId, (ams::tipc::Out<os::ProcessId> out), (out)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 6, Result, BoostSystemMemoryResourceLimit, (u64 size), (size)) \
|
AMS_TIPC_METHOD_INFO(C, H, 6, Result, BoostSystemMemoryResourceLimit, (u64 size), (size)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 7, Result, IsProcessTracked, (ams::tipc::Out<bool> out, os::ProcessId process_id), (out, process_id)) \
|
AMS_TIPC_METHOD_INFO(C, H, 7, Result, IsRunningProcess, (ams::tipc::Out<bool> out, os::ProcessId process_id), (out, process_id)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 8, Result, EnableApplicationCrashReport, (bool enabled), (enabled)) \
|
AMS_TIPC_METHOD_INFO(C, H, 8, Result, EnableApplicationCrashReport, (bool enabled), (enabled)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 9, Result, IsApplicationCrashReportEnabled, (ams::tipc::Out<bool> out), (out)) \
|
AMS_TIPC_METHOD_INFO(C, H, 9, Result, IsApplicationCrashReportEnabled, (ams::tipc::Out<bool> out), (out)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 10, Result, EnableApplicationAllThreadDumpOnCrash, (bool enabled), (enabled)) \
|
AMS_TIPC_METHOD_INFO(C, H, 10, Result, EnableApplicationAllThreadDumpOnCrash, (bool enabled), (enabled)) \
|
||||||
AMS_TIPC_METHOD_INFO(C, H, 20, Result, GetShellEventObserver, (ams::tipc::OutMoveHandle out), (out))
|
AMS_TIPC_METHOD_INFO(C, H, 11, Result, GetProcessId, (ams::sf::Out<os::ProcessId> out, ncm::ProgramId program_id), (out, program_id), hos::Version_19_0_0) \
|
||||||
|
AMS_TIPC_METHOD_INFO(C, H, 20, Result, CreateShellEvent, (ams::tipc::OutMoveHandle out), (out)) \
|
||||||
|
AMS_TIPC_METHOD_INFO(C, H, 31, Result, EnableApplicationCrashReport2, (os::ProcessId process_id, bool enabled), (process_id, enabled), hos::Version_23_0_0)
|
||||||
|
|
||||||
AMS_TIPC_DEFINE_INTERFACE(ams::pgl::tipc, IShellInterface, AMS_PGL_TIPC_I_SHELL_INTERFACE_INTERFACE_INFO);
|
AMS_TIPC_DEFINE_INTERFACE(ams::pgl::tipc, IShellInterface, AMS_PGL_TIPC_I_SHELL_INTERFACE_INTERFACE_INFO);
|
||||||
|
|||||||
@@ -30,28 +30,28 @@ namespace ams::pgl {
|
|||||||
::pglEventObserverClose(std::addressof(m_observer));
|
::pglEventObserverClose(std::addressof(m_observer));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetProcessEventHandle(ams::sf::OutCopyHandle out) {
|
Result GetShellEvent(ams::sf::OutCopyHandle out) {
|
||||||
::Event ev;
|
::Event ev;
|
||||||
ON_RESULT_SUCCESS { out.SetValue(ev.revent, true); };
|
ON_RESULT_SUCCESS { out.SetValue(ev.revent, true); };
|
||||||
|
|
||||||
R_RETURN(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev)));
|
R_RETURN(::pglEventObserverGetShellEvent(std::addressof(m_observer), std::addressof(ev)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
Result GetShellEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
||||||
static_assert(sizeof(*out.GetPointer()) == sizeof(::PmProcessEventInfo));
|
static_assert(sizeof(*out.GetPointer()) == sizeof(::PmProcessEventInfo));
|
||||||
R_RETURN(::pglEventObserverGetProcessEventInfo(std::addressof(m_observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer())));
|
R_RETURN(::pglEventObserverGetShellEventInfo(std::addressof(m_observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer())));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetProcessEventHandle(ams::tipc::OutCopyHandle out) {
|
Result GetShellEvent(ams::tipc::OutCopyHandle out) {
|
||||||
::Event ev;
|
::Event ev;
|
||||||
ON_RESULT_SUCCESS { out.SetValue(ev.revent); };
|
ON_RESULT_SUCCESS { out.SetValue(ev.revent); };
|
||||||
|
|
||||||
R_RETURN(::pglEventObserverGetProcessEvent(std::addressof(m_observer), std::addressof(ev)));
|
R_RETURN(::pglEventObserverGetShellEvent(std::addressof(m_observer), std::addressof(ev)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out) {
|
Result GetShellEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out) {
|
||||||
static_assert(sizeof(*out.GetPointer()) == sizeof(::PmProcessEventInfo));
|
static_assert(sizeof(*out.GetPointer()) == sizeof(::PmProcessEventInfo));
|
||||||
R_RETURN(::pglEventObserverGetProcessEventInfo(std::addressof(m_observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer())));
|
R_RETURN(::pglEventObserverGetShellEventInfo(std::addressof(m_observer), reinterpret_cast<::PmProcessEventInfo *>(out.GetPointer())));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static_assert(pgl::sf::IsIEventObserver<RemoteEventObserver>);
|
static_assert(pgl::sf::IsIEventObserver<RemoteEventObserver>);
|
||||||
|
|||||||
@@ -80,22 +80,22 @@ namespace ams::pgl {
|
|||||||
R_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) {
|
Result GetHostProgramLaunchProperty(pgl::ProgramLaunchProperty *out, const char *content_path) {
|
||||||
static_assert(sizeof(*out) == sizeof(::PglContentMetaInfo));
|
static_assert(sizeof(*out) == sizeof(::PglProgramLaunchProperty));
|
||||||
R_RETURN(::pglGetHostContentMetaInfo(reinterpret_cast<::PglContentMetaInfo *>(out), content_path));
|
R_RETURN(::pglGetHostProgramLaunchProperty(reinterpret_cast<::PglProgramLaunchProperty *>(out), content_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetApplicationProcessId(os::ProcessId *out) {
|
Result GetRunningApplicationProcessId(os::ProcessId *out) {
|
||||||
static_assert(sizeof(*out) == sizeof(u64));
|
static_assert(sizeof(*out) == sizeof(u64));
|
||||||
R_RETURN(::pglGetApplicationProcessId(reinterpret_cast<u64 *>(out)));
|
R_RETURN(::pglGetRunningApplicationProcessId(reinterpret_cast<u64 *>(out)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result BoostSystemMemoryResourceLimit(u64 size) {
|
Result BoostSystemMemoryResourceLimit(u64 size) {
|
||||||
R_RETURN(::pglBoostSystemMemoryResourceLimit(size));
|
R_RETURN(::pglBoostSystemMemoryResourceLimit(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result IsProcessTracked(bool *out, os::ProcessId process_id) {
|
Result IsRunningProcess(bool *out, os::ProcessId process_id) {
|
||||||
R_RETURN(::pglIsProcessTracked(out, static_cast<u64>(process_id)));
|
R_RETURN(::pglIsRunningProcess(out, static_cast<u64>(process_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result EnableApplicationCrashReport(bool enabled) {
|
Result EnableApplicationCrashReport(bool enabled) {
|
||||||
@@ -110,13 +110,13 @@ namespace ams::pgl {
|
|||||||
R_RETURN(::pglEnableApplicationAllThreadDumpOnCrash(enabled));
|
R_RETURN(::pglEnableApplicationAllThreadDumpOnCrash(enabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result TriggerApplicationSnapShotDumper(const char *arg, SnapShotDumpType dump_type) {
|
Result TriggerSnapShotDumper(const char *arg, SnapShotDumpType dump_type) {
|
||||||
R_RETURN(::pglTriggerApplicationSnapShotDumper(static_cast<::PglSnapShotDumpType>(dump_type), arg));
|
R_RETURN(::pglTriggerSnapShotDumper(static_cast<::PglSnapShotDumpType>(dump_type), arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetEventObserver(pgl::EventObserver *out) {
|
Result CreateShellEvent(pgl::EventObserver *out) {
|
||||||
::PglEventObserver obs;
|
::PglEventObserver obs;
|
||||||
R_TRY(::pglGetEventObserver(std::addressof(obs)));
|
R_TRY(::pglCreateShellEvent(std::addressof(obs)));
|
||||||
|
|
||||||
if (hos::GetVersion() >= hos::Version_12_0_0) {
|
if (hos::GetVersion() >= hos::Version_12_0_0) {
|
||||||
auto observer_holder = MakeUniqueFromStaticExpHeap<impl::EventObserverByTipc<RemoteEventObserver>>(obs);
|
auto observer_holder = MakeUniqueFromStaticExpHeap<impl::EventObserverByTipc<RemoteEventObserver>>(obs);
|
||||||
@@ -135,6 +135,10 @@ namespace ams::pgl {
|
|||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result EnableApplicationCrashReport2(os::ProcessId process_id, bool enabled) {
|
||||||
|
R_RETURN(::pglEnableApplicationCrashReport2(process_id, enabled));
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
Result Initialize() {
|
Result Initialize() {
|
||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
@@ -159,12 +163,12 @@ namespace ams::pgl {
|
|||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetHostContentMetaInfo(pgl::ContentMetaInfo *out, const char *content_path) {
|
Result GetHostProgramLaunchProperty(pgl::ProgramLaunchProperty *out, const char *content_path) {
|
||||||
AMS_UNUSED(out, content_path);
|
AMS_UNUSED(out, content_path);
|
||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetApplicationProcessId(os::ProcessId *out) {
|
Result GetRunningApplicationProcessId(os::ProcessId *out) {
|
||||||
AMS_UNUSED(out);
|
AMS_UNUSED(out);
|
||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
}
|
}
|
||||||
@@ -174,7 +178,7 @@ namespace ams::pgl {
|
|||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
}
|
}
|
||||||
|
|
||||||
Result IsProcessTracked(bool *out, os::ProcessId process_id) {
|
Result IsRunningProcess(bool *out, os::ProcessId process_id) {
|
||||||
AMS_UNUSED(out, process_id);
|
AMS_UNUSED(out, process_id);
|
||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
}
|
}
|
||||||
@@ -194,15 +198,20 @@ namespace ams::pgl {
|
|||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
}
|
}
|
||||||
|
|
||||||
Result TriggerApplicationSnapShotDumper(const char *arg, SnapShotDumpType dump_type) {
|
Result TriggerSnapShotDumper(const char *arg, SnapShotDumpType dump_type) {
|
||||||
AMS_UNUSED(arg, dump_type);
|
AMS_UNUSED(arg, dump_type);
|
||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetEventObserver(pgl::EventObserver *out) {
|
Result CreateShellEvent(pgl::EventObserver *out) {
|
||||||
AMS_UNUSED(out);
|
AMS_UNUSED(out);
|
||||||
AMS_ABORT("TODO");
|
AMS_ABORT("TODO");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result EnableApplicationCrashReport2(os::ProcessId process_id, bool enabled) {
|
||||||
|
AMS_UNUSED(process_id, enabled);
|
||||||
|
AMS_ABORT("TODO");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ namespace ams::pgl::srv {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
util::optional<os::ProcessId> GetRunningApplicationProcessId() {
|
util::optional<os::ProcessId> GetRunningApplicationProcessIdInternal() {
|
||||||
os::ProcessId process_id;
|
os::ProcessId process_id;
|
||||||
if (R_SUCCEEDED(pm::shell::GetApplicationProcessIdForShell(std::addressof(process_id)))) {
|
if (R_SUCCEEDED(pm::shell::GetApplicationProcessIdForShell(std::addressof(process_id)))) {
|
||||||
return process_id;
|
return process_id;
|
||||||
@@ -403,9 +403,9 @@ namespace ams::pgl::srv {
|
|||||||
R_RETURN(pm::shell::TerminateProcess(process_id));
|
R_RETURN(pm::shell::TerminateProcess(process_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetApplicationProcessId(os::ProcessId *out) {
|
Result GetRunningApplicationProcessId(os::ProcessId *out) {
|
||||||
/* Get the application process id. */
|
/* Get the running application process id. */
|
||||||
auto application_process_id = GetRunningApplicationProcessId();
|
auto application_process_id = GetRunningApplicationProcessIdInternal();
|
||||||
R_UNLESS(application_process_id, pgl::ResultApplicationNotRunning());
|
R_UNLESS(application_process_id, pgl::ResultApplicationNotRunning());
|
||||||
|
|
||||||
/* Return the id. */
|
/* Return the id. */
|
||||||
@@ -418,7 +418,7 @@ namespace ams::pgl::srv {
|
|||||||
R_RETURN(pm::shell::BoostSystemMemoryResourceLimit(size));
|
R_RETURN(pm::shell::BoostSystemMemoryResourceLimit(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsProcessTracked(os::ProcessId process_id) {
|
bool IsRunningProcess(os::ProcessId process_id) {
|
||||||
/* Check whether a ProcessData exists for the process. */
|
/* Check whether a ProcessData exists for the process. */
|
||||||
std::scoped_lock lk(g_process_data_mutex);
|
std::scoped_lock lk(g_process_data_mutex);
|
||||||
return FindProcessData(process_id) != nullptr;
|
return FindProcessData(process_id) != nullptr;
|
||||||
@@ -426,7 +426,7 @@ namespace ams::pgl::srv {
|
|||||||
|
|
||||||
void EnableApplicationCrashReport(bool enabled) {
|
void EnableApplicationCrashReport(bool enabled) {
|
||||||
/* Get the application process id. */
|
/* Get the application process id. */
|
||||||
auto application_process_id = GetRunningApplicationProcessId();
|
auto application_process_id = GetRunningApplicationProcessIdInternal();
|
||||||
if (application_process_id) {
|
if (application_process_id) {
|
||||||
/* Find the data for the application process. */
|
/* Find the data for the application process. */
|
||||||
std::scoped_lock lk(g_process_data_mutex);
|
std::scoped_lock lk(g_process_data_mutex);
|
||||||
@@ -446,7 +446,7 @@ namespace ams::pgl::srv {
|
|||||||
|
|
||||||
bool IsApplicationCrashReportEnabled() {
|
bool IsApplicationCrashReportEnabled() {
|
||||||
/* Get the application process id. */
|
/* Get the application process id. */
|
||||||
auto application_process_id = GetRunningApplicationProcessId();
|
auto application_process_id = GetRunningApplicationProcessIdInternal();
|
||||||
if (!application_process_id) {
|
if (!application_process_id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -462,7 +462,7 @@ namespace ams::pgl::srv {
|
|||||||
|
|
||||||
void EnableApplicationAllThreadDumpOnCrash(bool enabled) {
|
void EnableApplicationAllThreadDumpOnCrash(bool enabled) {
|
||||||
/* Get the application process id. */
|
/* Get the application process id. */
|
||||||
auto application_process_id = GetRunningApplicationProcessId();
|
auto application_process_id = GetRunningApplicationProcessIdInternal();
|
||||||
if (application_process_id) {
|
if (application_process_id) {
|
||||||
/* Find the data for the application process. */
|
/* Find the data for the application process. */
|
||||||
std::scoped_lock lk(g_process_data_mutex);
|
std::scoped_lock lk(g_process_data_mutex);
|
||||||
@@ -486,7 +486,7 @@ namespace ams::pgl::srv {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const char *arg) {
|
Result TriggerSnapShotDumper(SnapShotDumpType dump_type, const char *arg) {
|
||||||
/* Try to get the application process id. */
|
/* Try to get the application process id. */
|
||||||
os::ProcessId process_id;
|
os::ProcessId process_id;
|
||||||
R_TRY(pm::shell::GetApplicationProcessIdForShell(std::addressof(process_id)));
|
R_TRY(pm::shell::GetApplicationProcessIdForShell(std::addressof(process_id)));
|
||||||
@@ -495,5 +495,21 @@ namespace ams::pgl::srv {
|
|||||||
ON_SCOPE_EXIT { g_ssd_process_id = os::InvalidProcessId; };
|
ON_SCOPE_EXIT { g_ssd_process_id = os::InvalidProcessId; };
|
||||||
R_RETURN(TriggerSnapShotDumper(process_id, dump_type, arg));
|
R_RETURN(TriggerSnapShotDumper(process_id, dump_type, arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnableApplicationCrashReport2(os::ProcessId process_id, bool enabled) {
|
||||||
|
/* Find the data for the process. */
|
||||||
|
std::scoped_lock lk(g_process_data_mutex);
|
||||||
|
ProcessData *data = FindProcessData(*process_id);
|
||||||
|
|
||||||
|
/* It's okay if we aren't tracking the process. */
|
||||||
|
if (data != nullptr) {
|
||||||
|
/* Set or clear the flag. */
|
||||||
|
if (enabled) {
|
||||||
|
data->flags |= ProcessDataFlag_DetailedCrashReportEnabled;
|
||||||
|
} else {
|
||||||
|
data->flags &= ~ProcessDataFlag_DetailedCrashReportEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,12 +27,13 @@ namespace ams::pgl::srv {
|
|||||||
|
|
||||||
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags);
|
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags);
|
||||||
Result TerminateProcess(os::ProcessId process_id);
|
Result TerminateProcess(os::ProcessId process_id);
|
||||||
Result GetApplicationProcessId(os::ProcessId *out);
|
Result GetRunningApplicationProcessId(os::ProcessId *out);
|
||||||
Result BoostSystemMemoryResourceLimit(u64 size);
|
Result BoostSystemMemoryResourceLimit(u64 size);
|
||||||
bool IsProcessTracked(os::ProcessId process_id);
|
bool IsRunningProcess(os::ProcessId process_id);
|
||||||
void EnableApplicationCrashReport(bool enabled);
|
void EnableApplicationCrashReport(bool enabled);
|
||||||
bool IsApplicationCrashReportEnabled();
|
bool IsApplicationCrashReportEnabled();
|
||||||
void EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
void EnableApplicationAllThreadDumpOnCrash(bool enabled);
|
||||||
Result TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const char *arg);
|
Result TriggerSnapShotDumper(SnapShotDumpType dump_type, const char *arg);
|
||||||
|
void EnableApplicationCrashReport2(os::ProcessId process_id, bool enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,21 +65,21 @@ namespace ams::pgl::srv {
|
|||||||
m_event.Signal();
|
m_event.Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellEventObserverCmif::GetProcessEventHandle(ams::sf::OutCopyHandle out) {
|
Result ShellEventObserverCmif::GetShellEvent(ams::sf::OutCopyHandle out) {
|
||||||
out.SetValue(this->GetEvent().GetReadableHandle(), false);
|
out.SetValue(this->GetEvent().GetReadableHandle(), false);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellEventObserverCmif::GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
Result ShellEventObserverCmif::GetShellEventInfo(ams::sf::Out<pm::ProcessEventInfo> out) {
|
||||||
R_RETURN(this->PopEventInfo(out.GetPointer()));
|
R_RETURN(this->PopEventInfo(out.GetPointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellEventObserverTipc::GetProcessEventHandle(ams::tipc::OutCopyHandle out) {
|
Result ShellEventObserverTipc::GetShellEvent(ams::tipc::OutCopyHandle out) {
|
||||||
out.SetValue(this->GetEvent().GetReadableHandle());
|
out.SetValue(this->GetEvent().GetReadableHandle());
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellEventObserverTipc::GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out) {
|
Result ShellEventObserverTipc::GetShellEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out) {
|
||||||
R_RETURN(this->PopEventInfo(out.GetPointer()));
|
R_RETURN(this->PopEventInfo(out.GetPointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,15 +60,15 @@ namespace ams::pgl::srv {
|
|||||||
|
|
||||||
class ShellEventObserverCmif : public ShellEventObserverImpl {
|
class ShellEventObserverCmif : public ShellEventObserverImpl {
|
||||||
public:
|
public:
|
||||||
Result GetProcessEventHandle(ams::sf::OutCopyHandle out);
|
Result GetShellEvent(ams::sf::OutCopyHandle out);
|
||||||
Result GetProcessEventInfo(ams::sf::Out<pm::ProcessEventInfo> out);
|
Result GetShellEventInfo(ams::sf::Out<pm::ProcessEventInfo> out);
|
||||||
};
|
};
|
||||||
static_assert(pgl::sf::IsIEventObserver<ShellEventObserverCmif>);
|
static_assert(pgl::sf::IsIEventObserver<ShellEventObserverCmif>);
|
||||||
|
|
||||||
class ShellEventObserverTipc : public ShellEventObserverImpl {
|
class ShellEventObserverTipc : public ShellEventObserverImpl {
|
||||||
public:
|
public:
|
||||||
Result GetProcessEventHandle(ams::tipc::OutCopyHandle out);
|
Result GetShellEvent(ams::tipc::OutCopyHandle out);
|
||||||
Result GetProcessEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out);
|
Result GetShellEventInfo(ams::tipc::Out<pm::ProcessEventInfo> out);
|
||||||
};
|
};
|
||||||
static_assert(pgl::tipc::IsIEventObserver<ShellEventObserverTipc>);
|
static_assert(pgl::tipc::IsIEventObserver<ShellEventObserverTipc>);
|
||||||
|
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ namespace ams::pgl::srv {
|
|||||||
R_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) {
|
Result GetProgramLaunchPropertyFromHost(pgl::ProgramLaunchProperty *out, const char *package_path) {
|
||||||
/* Read the package. */
|
/* Read the package. */
|
||||||
HostPackageReader reader;
|
HostPackageReader reader;
|
||||||
R_TRY(reader.Initialize(package_path, HostPackageMountName));
|
R_TRY(reader.Initialize(package_path, HostPackageMountName));
|
||||||
@@ -343,7 +343,7 @@ namespace ams::pgl::srv {
|
|||||||
/* Read the program info. */
|
/* Read the program info. */
|
||||||
R_TRY(reader.ReadProgramInfo());
|
R_TRY(reader.ReadProgramInfo());
|
||||||
|
|
||||||
/* Get the content meta info. */
|
/* Get the program launch property. */
|
||||||
*out = {
|
*out = {
|
||||||
.id = reader.GetProgramId().value,
|
.id = reader.GetProgramId().value,
|
||||||
.version = reader.GetProgramVersion(),
|
.version = reader.GetProgramVersion(),
|
||||||
|
|||||||
@@ -19,6 +19,6 @@
|
|||||||
namespace ams::pgl::srv {
|
namespace ams::pgl::srv {
|
||||||
|
|
||||||
Result LaunchProgramFromHost(os::ProcessId *out, const char *content_path, u32 pm_flags);
|
Result LaunchProgramFromHost(os::ProcessId *out, const char *content_path, u32 pm_flags);
|
||||||
Result GetHostContentMetaInfo(pgl::ContentMetaInfo *out, const char *content_path);
|
Result GetProgramLaunchPropertyFromHost(pgl::ProgramLaunchProperty *out, const char *content_path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,21 +34,21 @@ namespace ams::pgl::srv {
|
|||||||
R_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) {
|
Result ShellInterfaceCommon::GetProgramLaunchPropertyFromHostImpl(pgl::ProgramLaunchProperty *out, const void *content_path, size_t content_path_size) {
|
||||||
AMS_UNUSED(content_path_size);
|
AMS_UNUSED(content_path_size);
|
||||||
R_RETURN(pgl::srv::GetHostContentMetaInfo(out, static_cast<const char *>(content_path)));
|
R_RETURN(pgl::srv::GetProgramLaunchPropertyFromHost(out, static_cast<const char *>(content_path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCommon::GetApplicationProcessIdImpl(os::ProcessId *out) {
|
Result ShellInterfaceCommon::GetRunningApplicationProcessIdImpl(os::ProcessId *out) {
|
||||||
R_RETURN(pgl::srv::GetApplicationProcessId(out));
|
R_RETURN(pgl::srv::GetRunningApplicationProcessId(out));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCommon::BoostSystemMemoryResourceLimitImpl(u64 size) {
|
Result ShellInterfaceCommon::BoostSystemMemoryResourceLimitImpl(u64 size) {
|
||||||
R_RETURN(pgl::srv::BoostSystemMemoryResourceLimit(size));
|
R_RETURN(pgl::srv::BoostSystemMemoryResourceLimit(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCommon::IsProcessTrackedImpl(bool *out, os::ProcessId process_id) {
|
Result ShellInterfaceCommon::IsRunningProcessImpl(bool *out, os::ProcessId process_id) {
|
||||||
*out = pgl::srv::IsProcessTracked(process_id);
|
*out = pgl::srv::IsRunningProcess(process_id);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,13 +67,18 @@ namespace ams::pgl::srv {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCommon::GetProcessId(os::ProcessId *out, ncm::ProgramId program_id) {
|
Result ShellInterfaceCommon::GetProcessIdImpl(os::ProcessId *out, ncm::ProgramId program_id) {
|
||||||
R_RETURN(pm::shell::GetProcessId(out, program_id));
|
R_RETURN(pm::shell::GetProcessId(out, program_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCommon::TriggerApplicationSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size) {
|
Result ShellInterfaceCommon::TriggerSnapShotDumperImpl(SnapShotDumpType dump_type, const void *arg, size_t arg_size) {
|
||||||
AMS_UNUSED(arg_size);
|
AMS_UNUSED(arg_size);
|
||||||
R_RETURN(pgl::srv::TriggerApplicationSnapShotDumper(dump_type, static_cast<const char *>(arg)));
|
R_RETURN(pgl::srv::TriggerSnapShotDumper(dump_type, static_cast<const char *>(arg)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ShellInterfaceCommon::EnableApplicationCrashReport2Impl(os::ProcessId process_id, bool enabled) {
|
||||||
|
pgl::srv::EnableApplicationCrashReport2(process_id, enabled);
|
||||||
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCmif::LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) {
|
Result ShellInterfaceCmif::LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) {
|
||||||
@@ -88,20 +93,20 @@ namespace ams::pgl::srv {
|
|||||||
R_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) {
|
Result ShellInterfaceCmif::GetProgramLaunchPropertyFromHost(ams::sf::Out<pgl::ProgramLaunchProperty> out, const ams::sf::InBuffer &content_path) {
|
||||||
R_RETURN(this->GetHostContentMetaInfoImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize()));
|
R_RETURN(this->GetProgramLaunchPropertyFromHostImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCmif::GetApplicationProcessId(ams::sf::Out<os::ProcessId> out) {
|
Result ShellInterfaceCmif::GetRunningApplicationProcessId(ams::sf::Out<os::ProcessId> out) {
|
||||||
R_RETURN(this->GetApplicationProcessIdImpl(out.GetPointer()));
|
R_RETURN(this->GetRunningApplicationProcessIdImpl(out.GetPointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCmif::BoostSystemMemoryResourceLimit(u64 size) {
|
Result ShellInterfaceCmif::BoostSystemMemoryResourceLimit(u64 size) {
|
||||||
R_RETURN(this->BoostSystemMemoryResourceLimitImpl(size));
|
R_RETURN(this->BoostSystemMemoryResourceLimitImpl(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCmif::IsProcessTracked(ams::sf::Out<bool> out, os::ProcessId process_id) {
|
Result ShellInterfaceCmif::IsRunningProcess(ams::sf::Out<bool> out, os::ProcessId process_id) {
|
||||||
R_RETURN(this->IsProcessTrackedImpl(out.GetPointer(), process_id));
|
R_RETURN(this->IsRunningProcessImpl(out.GetPointer(), process_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCmif::EnableApplicationCrashReport(bool enabled) {
|
Result ShellInterfaceCmif::EnableApplicationCrashReport(bool enabled) {
|
||||||
@@ -116,15 +121,11 @@ namespace ams::pgl::srv {
|
|||||||
R_RETURN(this->EnableApplicationAllThreadDumpOnCrashImpl(enabled));
|
R_RETURN(this->EnableApplicationAllThreadDumpOnCrashImpl(enabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCmif::TriggerApplicationSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg) {
|
Result ShellInterfaceCmif::TriggerSnapShotDumper(SnapShotDumpType dump_type, const ams::sf::InBuffer &arg) {
|
||||||
R_RETURN(this->TriggerApplicationSnapShotDumperImpl(dump_type, arg.GetPointer(), arg.GetSize()));
|
R_RETURN(this->TriggerSnapShotDumperImpl(dump_type, arg.GetPointer(), arg.GetSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceCmif::GetProcessId(ams::sf::Out<os::ProcessId> out, ncm::ProgramId program_id) {
|
Result ShellInterfaceCmif::CreateShellEvent(ams::sf::Out<ams::sf::SharedPointer<pgl::sf::IEventObserver>> out) {
|
||||||
R_RETURN(ShellInterfaceCommon::GetProcessId(out.GetPointer(), program_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
Result ShellInterfaceCmif::GetShellEventObserver(ams::sf::Out<ams::sf::SharedPointer<pgl::sf::IEventObserver>> out) {
|
|
||||||
/* Allocate a new interface. */
|
/* Allocate a new interface. */
|
||||||
auto session = ObjectFactory::CreateSharedEmplaced<pgl::sf::IEventObserver, ShellEventObserverCmif>(m_allocator);
|
auto session = ObjectFactory::CreateSharedEmplaced<pgl::sf::IEventObserver, ShellEventObserverCmif>(m_allocator);
|
||||||
R_UNLESS(session != nullptr, pgl::ResultOutOfMemory());
|
R_UNLESS(session != nullptr, pgl::ResultOutOfMemory());
|
||||||
@@ -150,20 +151,20 @@ namespace ams::pgl::srv {
|
|||||||
R_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) {
|
Result ShellInterfaceTipc::GetProgramLaunchPropertyFromHost(ams::tipc::Out<pgl::ProgramLaunchProperty> out, const ams::tipc::InBuffer content_path) {
|
||||||
R_RETURN(this->GetHostContentMetaInfoImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize()));
|
R_RETURN(this->GetProgramLaunchPropertyFromHostImpl(out.GetPointer(), content_path.GetPointer(), content_path.GetSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceTipc::GetApplicationProcessId(ams::tipc::Out<os::ProcessId> out) {
|
Result ShellInterfaceTipc::GetRunningApplicationProcessId(ams::tipc::Out<os::ProcessId> out) {
|
||||||
R_RETURN(this->GetApplicationProcessIdImpl(out.GetPointer()));
|
R_RETURN(this->GetRunningApplicationProcessIdImpl(out.GetPointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceTipc::BoostSystemMemoryResourceLimit(u64 size) {
|
Result ShellInterfaceTipc::BoostSystemMemoryResourceLimit(u64 size) {
|
||||||
R_RETURN(this->BoostSystemMemoryResourceLimitImpl(size));
|
R_RETURN(this->BoostSystemMemoryResourceLimitImpl(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceTipc::IsProcessTracked(ams::tipc::Out<bool> out, os::ProcessId process_id) {
|
Result ShellInterfaceTipc::IsRunningProcess(ams::tipc::Out<bool> out, os::ProcessId process_id) {
|
||||||
R_RETURN(this->IsProcessTrackedImpl(out.GetPointer(), process_id));
|
R_RETURN(this->IsRunningProcessImpl(out.GetPointer(), process_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceTipc::EnableApplicationCrashReport(bool enabled) {
|
Result ShellInterfaceTipc::EnableApplicationCrashReport(bool enabled) {
|
||||||
@@ -179,11 +180,14 @@ namespace ams::pgl::srv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceTipc::GetProcessId(ams::tipc::Out<os::ProcessId> out, ncm::ProgramId program_id) {
|
Result ShellInterfaceTipc::GetProcessId(ams::tipc::Out<os::ProcessId> out, ncm::ProgramId program_id) {
|
||||||
R_RETURN(ShellInterfaceCommon::GetProcessId(out.GetPointer(), program_id));
|
R_RETURN(this->GetProcessIdImpl(out.GetPointer(), program_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ShellInterfaceTipc::GetShellEventObserver(ams::tipc::OutMoveHandle out) {
|
Result ShellInterfaceTipc::CreateShellEvent(ams::tipc::OutMoveHandle out) {
|
||||||
R_RETURN(pgl::srv::AllocateShellEventObserverForTipc(out.GetPointer()));
|
R_RETURN(pgl::srv::AllocateShellEventObserverForTipc(out.GetPointer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result ShellInterfaceTipc::EnableApplicationCrashReport2(os::ProcessId process_id, bool enabled) {
|
||||||
|
R_RETURN(this->EnableApplicationCrashReport2Impl(process_id, enabled));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user