KeSetBasePriorityThread: Some games apparently pass in the thread handle instead

This commit is contained in:
Dr. Chat 2015-05-17 11:03:02 -05:00
parent 83d52beaf2
commit f14a52358a
1 changed files with 12 additions and 2 deletions

View File

@ -247,8 +247,18 @@ SHIM_CALL KeSetBasePriorityThread_shim(PPCContext* ppc_state,
int32_t prev_priority = 0;
XThread* thread =
(XThread*)XObject::GetObject(state, SHIM_MEM_ADDR(thread_ptr));
XThread* thread = NULL;
if (thread_ptr < 0x1000) {
// They passed in a handle (for some reason)
X_STATUS result =
state->object_table()->GetObject(thread_ptr, (XObject**)&thread);
// Log it in case this is the source of any problems in the future
XELOGD("KeSetBasePriorityThread - Interpreting thread ptr as handle!");
} else {
thread = (XThread*)XObject::GetObject(state, SHIM_MEM_ADDR(thread_ptr));
}
if (thread) {
prev_priority = thread->QueryPriority();
thread->SetPriority(increment);