diff options
| -rw-r--r-- | src/core/hle/service/pm/pm.cpp | 32 | ||||
| -rw-r--r-- | src/core/hle/service/pm/pm.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 2 |
3 files changed, 33 insertions, 7 deletions
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index d03187410..fe6b5f798 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp | |||
| @@ -28,6 +28,17 @@ std::optional<Kernel::SharedPtr<Kernel::Process>> SearchProcessList( | |||
| 28 | return *iter; | 28 | return *iter; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx, | ||
| 32 | const std::vector<Kernel::SharedPtr<Kernel::Process>>& process_list) { | ||
| 33 | const auto process = SearchProcessList(process_list, [](const auto& process) { | ||
| 34 | return process->GetProcessID() == Kernel::Process::ProcessIDMin; | ||
| 35 | }); | ||
| 36 | |||
| 37 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 38 | rb.Push(RESULT_SUCCESS); | ||
| 39 | rb.Push(process.has_value() ? (*process)->GetProcessID() : NO_PROCESS_FOUND_PID); | ||
| 40 | } | ||
| 41 | |||
| 31 | } // Anonymous namespace | 42 | } // Anonymous namespace |
| 32 | 43 | ||
| 33 | class BootMode final : public ServiceFramework<BootMode> { | 44 | class BootMode final : public ServiceFramework<BootMode> { |
| @@ -71,7 +82,7 @@ public: | |||
| 71 | {1, nullptr, "StartDebugProcess"}, | 82 | {1, nullptr, "StartDebugProcess"}, |
| 72 | {2, &DebugMonitor::GetTitlePid, "GetTitlePid"}, | 83 | {2, &DebugMonitor::GetTitlePid, "GetTitlePid"}, |
| 73 | {3, nullptr, "EnableDebugForTitleId"}, | 84 | {3, nullptr, "EnableDebugForTitleId"}, |
| 74 | {4, nullptr, "GetApplicationPid"}, | 85 | {4, &DebugMonitor::GetApplicationPid, "GetApplicationPid"}, |
| 75 | {5, nullptr, "EnableDebugForApplication"}, | 86 | {5, nullptr, "EnableDebugForApplication"}, |
| 76 | {6, nullptr, "DisableDebug"}, | 87 | {6, nullptr, "DisableDebug"}, |
| 77 | }; | 88 | }; |
| @@ -103,6 +114,11 @@ private: | |||
| 103 | rb.Push((*process)->GetProcessID()); | 114 | rb.Push((*process)->GetProcessID()); |
| 104 | } | 115 | } |
| 105 | 116 | ||
| 117 | void GetApplicationPid(Kernel::HLERequestContext& ctx) { | ||
| 118 | LOG_DEBUG(Service_PM, "called"); | ||
| 119 | GetApplicationPidGeneric(ctx, kernel.GetProcessList()); | ||
| 120 | } | ||
| 121 | |||
| 106 | const Kernel::KernelCore& kernel; | 122 | const Kernel::KernelCore& kernel; |
| 107 | }; | 123 | }; |
| 108 | 124 | ||
| @@ -143,7 +159,8 @@ private: | |||
| 143 | 159 | ||
| 144 | class Shell final : public ServiceFramework<Shell> { | 160 | class Shell final : public ServiceFramework<Shell> { |
| 145 | public: | 161 | public: |
| 146 | explicit Shell() : ServiceFramework{"pm:shell"} { | 162 | explicit Shell(const Kernel::KernelCore& kernel) |
| 163 | : ServiceFramework{"pm:shell"}, kernel(kernel) { | ||
| 147 | // clang-format off | 164 | // clang-format off |
| 148 | static const FunctionInfo functions[] = { | 165 | static const FunctionInfo functions[] = { |
| 149 | {0, nullptr, "LaunchProcess"}, | 166 | {0, nullptr, "LaunchProcess"}, |
| @@ -152,14 +169,23 @@ public: | |||
| 152 | {3, nullptr, "GetProcessEventWaiter"}, | 169 | {3, nullptr, "GetProcessEventWaiter"}, |
| 153 | {4, nullptr, "GetProcessEventType"}, | 170 | {4, nullptr, "GetProcessEventType"}, |
| 154 | {5, nullptr, "NotifyBootFinished"}, | 171 | {5, nullptr, "NotifyBootFinished"}, |
| 155 | {6, nullptr, "GetApplicationPid"}, | 172 | {6, &Shell::GetApplicationPid, "GetApplicationPid"}, |
| 156 | {7, nullptr, "BoostSystemMemoryResourceLimit"}, | 173 | {7, nullptr, "BoostSystemMemoryResourceLimit"}, |
| 157 | {8, nullptr, "EnableAdditionalSystemThreads"}, | 174 | {8, nullptr, "EnableAdditionalSystemThreads"}, |
| 175 | {9, nullptr, "GetUnimplementedEventHandle"}, | ||
| 158 | }; | 176 | }; |
| 159 | // clang-format on | 177 | // clang-format on |
| 160 | 178 | ||
| 161 | RegisterHandlers(functions); | 179 | RegisterHandlers(functions); |
| 162 | } | 180 | } |
| 181 | |||
| 182 | private: | ||
| 183 | void GetApplicationPid(Kernel::HLERequestContext& ctx) { | ||
| 184 | LOG_DEBUG(Service_PM, "called"); | ||
| 185 | GetApplicationPidGeneric(ctx, kernel.GetProcessList()); | ||
| 186 | } | ||
| 187 | |||
| 188 | const Kernel::KernelCore& kernel; | ||
| 163 | }; | 189 | }; |
| 164 | 190 | ||
| 165 | void InstallInterfaces(Core::System& system) { | 191 | void InstallInterfaces(Core::System& system) { |
diff --git a/src/core/hle/service/pm/pm.h b/src/core/hle/service/pm/pm.h index cc8d3f215..852e7050c 100644 --- a/src/core/hle/service/pm/pm.h +++ b/src/core/hle/service/pm/pm.h | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | namespace Service::SM { | 7 | namespace Core { |
| 8 | class ServiceManager; | 8 | class System; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | namespace Service::PM { | 11 | namespace Service::PM { |
| @@ -16,6 +16,6 @@ enum class SystemBootMode { | |||
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | /// Registers all PM services with the specified service manager. | 18 | /// Registers all PM services with the specified service manager. |
| 19 | void InstallInterfaces(SM::ServiceManager& service_manager); | 19 | void InstallInterfaces(Core::System& system); |
| 20 | 20 | ||
| 21 | } // namespace Service::PM | 21 | } // namespace Service::PM |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index ec9d755b7..0c1af124b 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -242,7 +242,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system, | |||
| 242 | PCTL::InstallInterfaces(*sm); | 242 | PCTL::InstallInterfaces(*sm); |
| 243 | PCV::InstallInterfaces(*sm); | 243 | PCV::InstallInterfaces(*sm); |
| 244 | PlayReport::InstallInterfaces(*sm); | 244 | PlayReport::InstallInterfaces(*sm); |
| 245 | PM::InstallInterfaces(*sm); | 245 | PM::InstallInterfaces(system); |
| 246 | PSC::InstallInterfaces(*sm); | 246 | PSC::InstallInterfaces(*sm); |
| 247 | PSM::InstallInterfaces(*sm); | 247 | PSM::InstallInterfaces(*sm); |
| 248 | Set::InstallInterfaces(*sm); | 248 | Set::InstallInterfaces(*sm); |