Fix crash in sceKernelExitDeleteThread().

0 means current thread, seen in Wild Arms XF.
Doesn't make the game run but at least it doesn't segfault.
This commit is contained in:
Unknown W. Brackets 2012-11-11 20:07:02 -08:00
parent 59d623a0f2
commit 808c7e9807

View file

@ -889,10 +889,24 @@ u32 sceKernelStartThread()
void sceKernelGetThreadStackFreeSize()
{
SceUID threadID = PARAM(0);
INFO_LOG(HLE,"sceKernelGetThreadStackFreeSize(%i)", threadID);
u32 error;
Thread *thread = kernelObjects.Get<Thread>(threadID, error);
SceUID threadID = PARAM(0);
Thread *thread;
INFO_LOG(HLE,"sceKernelGetThreadStackFreeSize(%i)", threadID);
if (threadID == 0)
thread = currentThread;
else
{
u32 error;
thread = kernelObjects.Get<Thread>(threadID, error);
if (thread == 0)
{
ERROR_LOG(HLE,"sceKernelGetThreadStackFreeSize: invalid thread id %i", threadID);
RETURN(error);
return;
}
}
// Scan the stack for 0xFF
int sz = 0;