Merge pull request #1267 from unknownbrackets/sleep-fix

Fix sceKernelWakeupThread when called twice
This commit is contained in:
Henrik Rydgård 2013-04-13 02:07:12 -07:00
commit 55d0f4f1a6
2 changed files with 5 additions and 4 deletions

View File

@ -1404,7 +1404,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out
}
break;
// Get UMD file start sector .
// Get UMD file start sector.
case 0x01020006:
INFO_LOG(HLE, "sceIoIoCtl: Asked for start sector of file %i", id);
if (Memory::IsValidAddress(outdataPtr) && outlen >= 4) {
@ -1425,7 +1425,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out
char temp[256];
// We want the reported message to include the cmd, so it's unique.
sprintf(temp, "sceIoIoctl(%%s, %08x, %%08x, %%x, %%08x, %%x)", cmd);
Reporting::ReportMessage(temp, f->fullpath.c_str(), cmd, indataPtr, inlen, outdataPtr, outlen);
Reporting::ReportMessage(temp, f->fullpath.c_str(), indataPtr, inlen, outdataPtr, outlen);
ERROR_LOG(HLE, "UNIMPL 0=sceIoIoctl id: %08x, cmd %08x, indataPtr %08x, inlen %08x, outdataPtr %08x, outLen %08x", id,cmd,indataPtr,inlen,outdataPtr,outlen);
}
break;

View File

@ -2238,11 +2238,12 @@ void sceKernelWakeupThread()
Thread *t = kernelObjects.Get<Thread>(uid, error);
if (t)
{
if (t->nt.waitType != WAITTYPE_SLEEP) {
if (!t->isWaitingFor(WAITTYPE_SLEEP, 1)) {
t->nt.wakeupCount++;
DEBUG_LOG(HLE,"sceKernelWakeupThread(%i) - wakeupCount incremented to %i", uid, t->nt.wakeupCount);
RETURN(0);
} else {
VERBOSE_LOG(HLE,"sceKernelWakeupThread(%i) - woke thread at %i", uid, t->nt.wakeupCount);
__KernelResumeThreadFromWait(uid);
}
}
@ -2286,7 +2287,7 @@ static void __KernelSleepThread(bool doCallbacks) {
} else {
VERBOSE_LOG(HLE, "sceKernelSleepThread()");
RETURN(0);
__KernelWaitCurThread(WAITTYPE_SLEEP, 0, 0, 0, doCallbacks, "thread slept");
__KernelWaitCurThread(WAITTYPE_SLEEP, 1, 0, 0, doCallbacks, "thread slept");
}
}