diff options
| author | 2021-11-20 19:52:25 -0500 | |
|---|---|---|
| committer | 2021-11-20 20:56:29 -0500 | |
| commit | 9173f07a51ee355d79c60fed21e7731868db5e6d (patch) | |
| tree | f1f94b76f0094d24e1ac6a964b0ed272a329ddbe /src | |
| parent | service: pm: Add all relevant result codes (diff) | |
| download | yuzu-9173f07a51ee355d79c60fed21e7731868db5e6d.tar.gz yuzu-9173f07a51ee355d79c60fed21e7731868db5e6d.tar.xz yuzu-9173f07a51ee355d79c60fed21e7731868db5e6d.zip | |
service: pm: Implement AtmosphereGetProcessId
- Used by Skyline modding framework
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/pm/pm.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index b2e97a218..277abc17a 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp | |||
| @@ -134,6 +134,9 @@ public: | |||
| 134 | : ServiceFramework{system_, "pm:info"}, process_list{process_list_} { | 134 | : ServiceFramework{system_, "pm:info"}, process_list{process_list_} { |
| 135 | static const FunctionInfo functions[] = { | 135 | static const FunctionInfo functions[] = { |
| 136 | {0, &Info::GetProgramId, "GetProgramId"}, | 136 | {0, &Info::GetProgramId, "GetProgramId"}, |
| 137 | {65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"}, | ||
| 138 | {65001, nullptr, "AtmosphereHasLaunchedProgram"}, | ||
| 139 | {65002, nullptr, "AtmosphereGetProcessInfo"}, | ||
| 137 | }; | 140 | }; |
| 138 | RegisterHandlers(functions); | 141 | RegisterHandlers(functions); |
| 139 | } | 142 | } |
| @@ -160,6 +163,27 @@ private: | |||
| 160 | rb.Push((*process)->GetProgramID()); | 163 | rb.Push((*process)->GetProgramID()); |
| 161 | } | 164 | } |
| 162 | 165 | ||
| 166 | void AtmosphereGetProcessId(Kernel::HLERequestContext& ctx) { | ||
| 167 | IPC::RequestParser rp{ctx}; | ||
| 168 | const auto program_id = rp.PopRaw<u64>(); | ||
| 169 | |||
| 170 | LOG_DEBUG(Service_PM, "called, program_id={:016X}", program_id); | ||
| 171 | |||
| 172 | const auto process = SearchProcessList(process_list, [program_id](const auto& proc) { | ||
| 173 | return proc->GetProgramID() == program_id; | ||
| 174 | }); | ||
| 175 | |||
| 176 | if (!process.has_value()) { | ||
| 177 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 178 | rb.Push(ResultProcessNotFound); | ||
| 179 | return; | ||
| 180 | } | ||
| 181 | |||
| 182 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 183 | rb.Push(ResultSuccess); | ||
| 184 | rb.Push((*process)->GetProcessID()); | ||
| 185 | } | ||
| 186 | |||
| 163 | const std::vector<Kernel::KProcess*>& process_list; | 187 | const std::vector<Kernel::KProcess*>& process_list; |
| 164 | }; | 188 | }; |
| 165 | 189 | ||