1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 13:52:21 +00:00

pm: work around HOS bug

This commit is contained in:
hexkyz 2019-07-23 19:38:14 +01:00 committed by GitHub
parent 00f4e5158f
commit 7e169bc7df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,18 +110,21 @@ namespace {
/* This uses debugging SVCs to retrieve a process's title id. */ /* This uses debugging SVCs to retrieve a process's title id. */
sts::ncm::TitleId GetProcessTitleId(u64 process_id) { sts::ncm::TitleId GetProcessTitleId(u64 process_id) {
/* Get a debug handle, or return our title id. */ /* Check if we should return our title id. */
AutoHandle debug_handle; /* Doing this here works around a bug fixed in 6.0.0. */
if (R_FAILED(svcDebugActiveProcess(debug_handle.GetPointer(), process_id))) { /* Not doing so will cause svcDebugActiveProcess to deadlock on lower firmwares if called for it's own process. */
u64 current_process_id = 0; u64 current_process_id = 0;
R_ASSERT(svcGetProcessId(&current_process_id, CUR_PROCESS_HANDLE)); R_ASSERT(svcGetProcessId(&current_process_id, CUR_PROCESS_HANDLE));
if (current_process_id == process_id) { if (current_process_id == process_id) {
return __stratosphere_title_id; return __stratosphere_title_id;
} else { }
/* Get a debug handle. */
AutoHandle debug_handle;
if (R_FAILED(svcDebugActiveProcess(debug_handle.GetPointer(), process_id))) {
/* If we fail to debug a process other than our own, abort. */ /* If we fail to debug a process other than our own, abort. */
std::abort(); std::abort();
} }
}
/* Loop until we get the event that tells us about the process. */ /* Loop until we get the event that tells us about the process. */
DebugEventInfo d; DebugEventInfo d;