From 4d32c7af05758c8cd8842bee25e02856e6cfe30a Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 17 May 2015 21:26:27 -0700 Subject: [PATCH] Attempting a thread priority mapping. --- src/xenia/kernel/objects/xthread.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/xenia/kernel/objects/xthread.cc b/src/xenia/kernel/objects/xthread.cc index 639113190..255986f45 100644 --- a/src/xenia/kernel/objects/xthread.cc +++ b/src/xenia/kernel/objects/xthread.cc @@ -520,7 +520,19 @@ void XThread::RundownAPCs() { int32_t XThread::QueryPriority() { return GetThreadPriority(thread_handle_); } void XThread::SetPriority(int32_t increment) { - SetThreadPriority(thread_handle_, increment); + int target_priority = 0; + if (increment > 0x11) { + target_priority = THREAD_PRIORITY_HIGHEST; + } else if (increment > 0) { + target_priority = THREAD_PRIORITY_ABOVE_NORMAL; + } else if (increment < -0x22) { + target_priority = THREAD_PRIORITY_IDLE; + } else if (increment < -0x11) { + target_priority = THREAD_PRIORITY_LOWEST; + } else { + target_priority = THREAD_PRIORITY_NORMAL; + } + SetThreadPriority(thread_handle_, target_priority); } void XThread::SetAffinity(uint32_t affinity) {