diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/pm/pm.cpp | 45 |
2 files changed, 46 insertions, 1 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 4f7aebf3f..9387373c1 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -396,7 +396,7 @@ static ResultCode GetProcessId(Core::System& system, u64* out_process_id, Handle | |||
| 396 | // Get the process id. | 396 | // Get the process id. |
| 397 | *out_process_id = process->GetId(); | 397 | *out_process_id = process->GetId(); |
| 398 | 398 | ||
| 399 | return ResultInvalidHandle; | 399 | return ResultSuccess; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | static ResultCode GetProcessId32(Core::System& system, u32* out_process_id_low, | 402 | static ResultCode GetProcessId32(Core::System& system, u32* out_process_id_low, |
diff --git a/src/core/hle/service/pm/pm.cpp b/src/core/hle/service/pm/pm.cpp index 277abc17a..057666021 100644 --- a/src/core/hle/service/pm/pm.cpp +++ b/src/core/hle/service/pm/pm.cpp | |||
| @@ -91,6 +91,8 @@ public: | |||
| 91 | {4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"}, | 91 | {4, &DebugMonitor::GetApplicationProcessId, "GetApplicationProcessId"}, |
| 92 | {5, nullptr, "HookToCreateApplicationProgress"}, | 92 | {5, nullptr, "HookToCreateApplicationProgress"}, |
| 93 | {6, nullptr, "ClearHook"}, | 93 | {6, nullptr, "ClearHook"}, |
| 94 | {65000, &DebugMonitor::AtmosphereGetProcessInfo, "AtmosphereGetProcessInfo"}, | ||
| 95 | {65001, nullptr, "AtmosphereGetCurrentLimitInfo"}, | ||
| 94 | }; | 96 | }; |
| 95 | // clang-format on | 97 | // clang-format on |
| 96 | 98 | ||
| @@ -125,6 +127,49 @@ private: | |||
| 125 | GetApplicationPidGeneric(ctx, kernel.GetProcessList()); | 127 | GetApplicationPidGeneric(ctx, kernel.GetProcessList()); |
| 126 | } | 128 | } |
| 127 | 129 | ||
| 130 | void AtmosphereGetProcessInfo(Kernel::HLERequestContext& ctx) { | ||
| 131 | // https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/pm/source/impl/pm_process_manager.cpp#L614 | ||
| 132 | // This implementation is incomplete; only a handle to the process is returned. | ||
| 133 | IPC::RequestParser rp{ctx}; | ||
| 134 | const auto pid = rp.PopRaw<u64>(); | ||
| 135 | |||
| 136 | LOG_WARNING(Service_PM, "(Partial Implementation) called, pid={:016X}", pid); | ||
| 137 | |||
| 138 | const auto process = SearchProcessList(kernel.GetProcessList(), [pid](const auto& proc) { | ||
| 139 | return proc->GetProcessID() == pid; | ||
| 140 | }); | ||
| 141 | |||
| 142 | if (!process.has_value()) { | ||
| 143 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 144 | rb.Push(ResultProcessNotFound); | ||
| 145 | return; | ||
| 146 | } | ||
| 147 | |||
| 148 | struct ProgramLocation { | ||
| 149 | u64 program_id; | ||
| 150 | u8 storage_id; | ||
| 151 | }; | ||
| 152 | static_assert(sizeof(ProgramLocation) == 0x10, "ProgramLocation has an invalid size"); | ||
| 153 | |||
| 154 | struct OverrideStatus { | ||
| 155 | u64 keys_held; | ||
| 156 | u64 flags; | ||
| 157 | }; | ||
| 158 | static_assert(sizeof(OverrideStatus) == 0x10, "OverrideStatus has an invalid size"); | ||
| 159 | |||
| 160 | OverrideStatus override_status{}; | ||
| 161 | ProgramLocation program_location{ | ||
| 162 | .program_id = (*process)->GetProgramID(), | ||
| 163 | .storage_id = 0, | ||
| 164 | }; | ||
| 165 | |||
| 166 | IPC::ResponseBuilder rb{ctx, 10, 1}; | ||
| 167 | rb.Push(ResultSuccess); | ||
| 168 | rb.PushCopyObjects(*process); | ||
| 169 | rb.PushRaw(program_location); | ||
| 170 | rb.PushRaw(override_status); | ||
| 171 | } | ||
| 172 | |||
| 128 | const Kernel::KernelCore& kernel; | 173 | const Kernel::KernelCore& kernel; |
| 129 | }; | 174 | }; |
| 130 | 175 | ||