From ff7e1d7be91fb1c28f3d416b20da8fa189bcb99b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 8 Dec 2012 15:28:54 -0800 Subject: [PATCH] Fix running threads in processing callbacks state. ActionAfterMipsCall was setting it back when it saved it. --- Core/HLE/sceKernelThread.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 70b36bb0a9..ccbbfddc7f 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1664,6 +1664,7 @@ void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, bo after->waitType = thread->nt.waitType; after->waitId = thread->nt.waitID; after->waitInfo = thread->waitInfo; + after->isProcessingCallbacks = thread->isProcessingCallbacks; afterAction = after; @@ -1841,8 +1842,9 @@ void ActionAfterCallback::run() { // Check callbacks on the current thread only. // Returns true if any callbacks were processed on the current thread. -bool __KernelCheckThreadCallbacks(Thread *thread) { - if (!thread->isProcessingCallbacks) +bool __KernelCheckThreadCallbacks(Thread *thread, bool force) +{ + if (!thread->isProcessingCallbacks && !force) return false; for (int i = 0; i < THREAD_CALLBACK_NUM_TYPES; i++) { @@ -1865,7 +1867,7 @@ bool __KernelCheckCallbacks() { for (std::vector::iterator iter = threadqueue.begin(); iter != threadqueue.end(); iter++) { Thread *thread = *iter; - if (thread->isProcessingCallbacks && __KernelCheckThreadCallbacks(thread)) { + if (__KernelCheckThreadCallbacks(thread, false)) { processed = true; } } @@ -1877,13 +1879,7 @@ bool __KernelForceCallbacks() { Thread *curThread = __GetCurrentThread(); - // This thread can now process callbacks. - curThread->isProcessingCallbacks = true; - - bool callbacksProcessed = __KernelCheckThreadCallbacks(curThread); - - // Note - same thread as above - checking callbacks may switch threads. - curThread->isProcessingCallbacks = false; + bool callbacksProcessed = __KernelCheckThreadCallbacks(curThread, true); return callbacksProcessed; }