#pragma once #include #include #include "pm_registration.hpp" #define BOOT2_TITLE_ID (0x0100000000000008ULL) enum ShellCmd { Shell_Cmd_LaunchProcess = 0, Shell_Cmd_TerminateProcessId = 1, Shell_Cmd_TerminateTitleId = 2, Shell_Cmd_GetProcessWaitEvent = 3, Shell_Cmd_GetProcessEventType = 4, Shell_Cmd_FinalizeExitedProcess = 5, Shell_Cmd_ClearProcessNotificationFlag = 6, Shell_Cmd_NotifyBootFinished = 7, Shell_Cmd_GetApplicationProcessId = 8, Shell_Cmd_BoostSystemMemoryResourceLimit = 9 }; enum ShellCmd_5X { Shell_Cmd_5X_LaunchProcess = 0, Shell_Cmd_5X_TerminateProcessId = 1, Shell_Cmd_5X_TerminateTitleId = 2, Shell_Cmd_5X_GetProcessWaitEvent = 3, Shell_Cmd_5X_GetProcessEventType = 4, Shell_Cmd_5X_NotifyBootFinished = 5, Shell_Cmd_5X_GetApplicationProcessId = 6, Shell_Cmd_5X_BoostSystemMemoryResourceLimit = 7 }; class ShellService final : public IServiceObject { public: Result dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) override; Result handle_deferred() override; ShellService *clone() override { return new ShellService(*this); } private: /* Actual commands. */ std::tuple launch_process(u64 launch_flags, Registration::TidSid tid_sid); std::tuple terminate_process_id(u64 pid); std::tuple terminate_title_id(u64 tid); std::tuple get_process_wait_event(); std::tuple get_process_event_type(); std::tuple finalize_exited_process(u64 pid); std::tuple clear_process_notification_flag(u64 pid); std::tuple notify_boot_finished(); std::tuple get_application_process_id(); std::tuple boost_system_memory_resource_limit(u64 sysmem_size); };