diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 3d15e657b9..03a0e28f93 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -608,7 +608,7 @@ u32 __KernelResumeThreadFromWait(SceUID threadID, int retval) // Only run when you can safely accept a context switch // Triggers a waitable event, that is, it wakes up all threads that waits for it // If any changes were made, it will context switch -bool __KernelTriggerWait(WaitType type, int id, bool dontSwitch) +bool __KernelTriggerWait(WaitType type, int id, bool useRetVal, int retVal, bool dontSwitch) { bool doneAnything = false; @@ -621,6 +621,8 @@ bool __KernelTriggerWait(WaitType type, int id, bool dontSwitch) { // This thread was waiting for the triggered object. __KernelResumeThreadFromWait(t); + if (useRetVal) + t->setReturnValue(retVal); doneAnything = true; } } @@ -639,6 +641,16 @@ bool __KernelTriggerWait(WaitType type, int id, bool dontSwitch) return true; } +bool __KernelTriggerWait(WaitType type, int id, bool dontSwitch) +{ + return __KernelTriggerWait(type, id, false, 0, dontSwitch); +} + +bool __KernelTriggerWait(WaitType type, int id, int retVal, bool dontSwitch) +{ + return __KernelTriggerWait(type, id, true, retVal, dontSwitch); +} + // makes the current thread wait for an event void __KernelWaitCurThread(WaitType type, SceUID waitID, u32 waitValue, u32 timeoutPtr, bool processCallbacks) { diff --git a/Core/HLE/sceKernelThread.h b/Core/HLE/sceKernelThread.h index 4e80b2afaf..f9093c0a9a 100644 --- a/Core/HLE/sceKernelThread.h +++ b/Core/HLE/sceKernelThread.h @@ -104,6 +104,7 @@ void __KernelLoadContext(ThreadContext *ctx); // TODO: Replace this with __KernelResumeThread over time as it's misguided. bool __KernelTriggerWait(WaitType type, int id, bool dontSwitch = false); +bool __KernelTriggerWait(WaitType type, int id, int retVal, bool dontSwitch); u32 __KernelResumeThreadFromWait(SceUID threadID); // can return an error value u32 __KernelResumeThreadFromWait(SceUID threadID, int retval); diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index 637f34ef26..e7ff30faac 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -220,9 +220,10 @@ void sceUmdWaitDriveStatCB() void sceUmdCancelWaitDriveStat() { - u32 stat = PARAM(0); - ERROR_LOG(HLE,"UNIMPL 0=sceUmdCancelWaitDriveStat(stat = %08x)", stat); + DEBUG_LOG(HLE,"0=sceUmdCancelWaitDriveStat()"); RETURN(0); + + __KernelTriggerWait(WAITTYPE_UMD, 0, SCE_KERNEL_ERROR_WAIT_CANCEL, false); } u32 sceUmdGetErrorStat()