diff options
Diffstat (limited to 'src/core/hle/service/pm/pm.cpp')
| -rw-r--r-- | src/core/hle/service/pm/pm.cpp | 100 |
1 files changed, 49 insertions, 51 deletions
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index 3d431c305f..ff7053b690 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp @@ -47,7 +47,13 @@ void GetApplicationPidGeneric(Kernel::KernelCore& kernel, HLERequestContext& ctx class BootMode final : public ServiceFramework<BootMode> { public: - explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} {} + explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} { + static const FunctionInfo functions[] = { + {0, &BootMode::GetBootMode, "GetBootMode"}, + {1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"}, + }; + RegisterHandlers(functions); + } private: void GetBootMode(HLERequestContext& ctx) { @@ -67,19 +73,28 @@ private: rb.Push(ResultSuccess); } - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &BootMode::GetBootMode, "GetBootMode"}, - FunctionInfo{1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"} - ); SystemBootMode boot_mode = SystemBootMode::Normal; }; class DebugMonitor final : public ServiceFramework<DebugMonitor> { public: - explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "pm:dmnt"} {} + explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "pm:dmnt"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetJitDebugProcessIdList"}, + {1, nullptr, "StartProcess"}, + {2, &DebugMonitor::GetProcessId, "GetProcessId"}, + {3, nullptr, "HookToCreateProcess"}, + {4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"}, + {5, nullptr, "HookToCreateApplicationProgress"}, + {6, nullptr, "ClearHook"}, + {65000, &DebugMonitor::AtmosphereGetProcessInfo, "AtmosphereGetProcessInfo"}, + {65001, nullptr, "AtmosphereGetCurrentLimitInfo"}, + }; + // clang-format on + + RegisterHandlers(functions); + } private: void GetProcessId(HLERequestContext& ctx) { @@ -149,26 +164,19 @@ private: rb.PushRaw(program_location); rb.PushRaw(override_status); } - - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "GetJitDebugProcessIdList"}, - FunctionInfo{1, nullptr, "StartProcess"}, - FunctionInfo{2, &DebugMonitor::GetProcessId, "GetProcessId"}, - FunctionInfo{3, nullptr, "HookToCreateProcess"}, - FunctionInfo{4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"}, - FunctionInfo{5, nullptr, "HookToCreateApplicationProgress"}, - FunctionInfo{6, nullptr, "ClearHook"}, - FunctionInfo{65000, &DebugMonitor::AtmosphereGetProcessInfo, "AtmosphereGetProcessInfo"}, - FunctionInfo{65001, nullptr, "AtmosphereGetCurrentLimitInfo"} - ); }; class Info final : public ServiceFramework<Info> { public: - explicit Info(Core::System& system_) : ServiceFramework{system_, "pm:info"} {} + explicit Info(Core::System& system_) : ServiceFramework{system_, "pm:info"} { + static const FunctionInfo functions[] = { + {0, &Info::GetProgramId, "GetProgramId"}, + {65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"}, + {65001, nullptr, "AtmosphereHasLaunchedProgram"}, + {65002, nullptr, "AtmosphereGetProcessInfo"}, + }; + RegisterHandlers(functions); + } private: void GetProgramId(HLERequestContext& ctx) { @@ -210,24 +218,27 @@ private: rb.Push(ResultSuccess); rb.Push(process->GetProcessId()); } - - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &Info::GetProgramId, "GetProgramId"}, - FunctionInfo{65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"}, - FunctionInfo{65001, nullptr, "AtmosphereHasLaunchedProgram"}, - FunctionInfo{65002, nullptr, "AtmosphereGetProcessInfo"} - ); }; class Shell final : public ServiceFramework<Shell> { public: - explicit Shell(Core::System& system_) : ServiceFramework{system_, "pm:shell"} {} + explicit Shell(Core::System& system_) : ServiceFramework{system_, "pm:shell"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "LaunchProgram"}, + {1, nullptr, "TerminateProcess"}, + {2, nullptr, "TerminateProgram"}, + {3, nullptr, "GetProcessEventHandle"}, + {4, nullptr, "GetProcessEventInfo"}, + {5, nullptr, "NotifyBootFinished"}, + {6, &Shell::GetApplicationProcessIdForShell, "GetApplicationProcessIdForShell"}, + {7, nullptr, "BoostSystemMemoryResourceLimit"}, + {8, nullptr, "BoostApplicationThreadResourceLimit"}, + {9, nullptr, "GetBootFinishedEventHandle"}, + }; + // clang-format on - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + RegisterHandlers(functions); } private: @@ -236,19 +247,6 @@ private: auto list = kernel.GetProcessList(); GetApplicationPidGeneric(system.Kernel(), ctx, list); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, nullptr, "LaunchProgram"}, - FunctionInfo{1, nullptr, "TerminateProcess"}, - FunctionInfo{2, nullptr, "TerminateProgram"}, - FunctionInfo{3, nullptr, "GetProcessEventHandle"}, - FunctionInfo{4, nullptr, "GetProcessEventInfo"}, - FunctionInfo{5, nullptr, "NotifyBootFinished"}, - FunctionInfo{6, &Shell::GetApplicationProcessIdForShell, "GetApplicationProcessIdForShell"}, - FunctionInfo{7, nullptr, "BoostSystemMemoryResourceLimit"}, - FunctionInfo{8, nullptr, "BoostApplicationThreadResourceLimit"}, - FunctionInfo{9, nullptr, "GetBootFinishedEventHandle"} - ); }; void LoopProcess(Core::System& system) { |
