From ccf021cef005578640a530b9a5a0f100eeddaa55 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 9 Sep 2013 21:39:56 -0700 Subject: [PATCH] Return a negative error code in __KernelGetWaitID. This way we can use 0 as a proper wait id. --- Core/HLE/sceKernelThread.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index a33e6a036a..488be08291 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1393,7 +1393,7 @@ SceUID __KernelGetWaitID(SceUID threadID, WaitType type, u32 &error) else { ERROR_LOG(SCEKERNEL, "__KernelGetWaitID ERROR: thread %i", threadID); - return 0; + return -1; } } @@ -2587,7 +2587,7 @@ int sceKernelWakeupThread(SceUID uid) Thread *t = kernelObjects.Get(uid, error); if (t) { - if (!t->isWaitingFor(WAITTYPE_SLEEP, 1)) { + if (!t->isWaitingFor(WAITTYPE_SLEEP, 0)) { t->nt.wakeupCount++; DEBUG_LOG(SCEKERNEL,"sceKernelWakeupThread(%i) - wakeupCount incremented to %i", uid, t->nt.wakeupCount); } else { @@ -2633,7 +2633,7 @@ static int __KernelSleepThread(bool doCallbacks) { DEBUG_LOG(SCEKERNEL, "sceKernelSleepThread() - wakeupCount decremented to %i", thread->nt.wakeupCount); } else { VERBOSE_LOG(SCEKERNEL, "sceKernelSleepThread()"); - __KernelWaitCurThread(WAITTYPE_SLEEP, 1, 0, 0, doCallbacks, "thread slept"); + __KernelWaitCurThread(WAITTYPE_SLEEP, 0, 0, 0, doCallbacks, "thread slept"); } return 0; }