diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index da89ff34bbca..ff949a7ef66e 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1333,30 +1333,38 @@ u32 sceKernelReferThreadRunStatus(u32 threadID, u32 statusPtr) return 0; } -int sceKernelGetThreadExitStatus(SceUID threadID) -{ +int __KernelGetThreadExitStatus(SceUID threadID) { u32 error; PSPThread *t = kernelObjects.Get(threadID, error); if (t) { if (t->nt.status == THREADSTATUS_DORMANT) // TODO: can be dormant before starting, too, need to avoid that { - DEBUG_LOG(SCEKERNEL,"sceKernelGetThreadExitStatus(%i)", threadID); + DEBUG_LOG(SCEKERNEL, "sceKernelGetThreadExitStatus(%i)", threadID); return t->nt.exitStatus; } else { - DEBUG_LOG(SCEKERNEL,"sceKernelGetThreadExitStatus(%i): not dormant", threadID); + DEBUG_LOG(SCEKERNEL, "sceKernelGetThreadExitStatus(%i): not dormant", threadID); return SCE_KERNEL_ERROR_NOT_DORMANT; } } else { - ERROR_LOG(SCEKERNEL,"sceKernelGetThreadExitStatus Error %08x", error); + ERROR_LOG(SCEKERNEL, "sceKernelGetThreadExitStatus Error %08x", error); return SCE_KERNEL_ERROR_UNKNOWN_THID; } } +int sceKernelGetThreadExitStatus(SceUID threadID) +{ + u32 status = __KernelGetThreadExitStatus(threadID); + // Seems this is called in a tight-ish loop, maybe awaiting an interrupt - issue #13698 + // Guess based on sceKernelGetThreadId. + hleEatCycles(180); + return status; +} + u32 sceKernelGetThreadmanIdType(u32 uid) { int type; if (kernelObjects.GetIDType(uid, &type)) { diff --git a/Core/HLE/sceKernelThread.h b/Core/HLE/sceKernelThread.h index 65dce5ff54f4..3df1d70fc034 100644 --- a/Core/HLE/sceKernelThread.h +++ b/Core/HLE/sceKernelThread.h @@ -48,6 +48,7 @@ int sceKernelGetThreadCurrentPriority(); // Warning: will alter v0 in current MIPS state. int __KernelStartThread(SceUID threadToStartID, int argSize, u32 argBlockPtr, bool forceArgs = false); int __KernelStartThreadValidate(SceUID threadToStartID, int argSize, u32 argBlockPtr, bool forceArgs = false); +int __KernelGetThreadExitStatus(SceUID threadID); int sceKernelStartThread(SceUID threadToStartID, int argSize, u32 argBlockPtr); u32 sceKernelSuspendDispatchThread(); u32 sceKernelResumeDispatchThread(u32 suspended);