Clean up sceKernelWaitThreadEnd() wrappers.

This commit is contained in:
Unknown W. Brackets 2013-01-07 10:02:11 -08:00
parent a849f90beb
commit 5ac7f6a211
3 changed files with 18 additions and 20 deletions

View File

@ -560,7 +560,7 @@ const HLEFunction ThreadManForUser[] =
{0x9944f31f,sceKernelSuspendThread,"sceKernelSuspendThread"},
{0x616403ba,WrapI_U<sceKernelTerminateThread>,"sceKernelTerminateThread"},
{0x383f7bcc,WrapI_I<sceKernelTerminateDeleteThread>,"sceKernelTerminateDeleteThread"},
{0x840E8133,sceKernelWaitThreadEndCB,"sceKernelWaitThreadEndCB"},
{0x840E8133,WrapI_IU<sceKernelWaitThreadEndCB>,"sceKernelWaitThreadEndCB"},
{0xd13bde95,sceKernelCheckThreadStack,"sceKernelCheckThreadStack"},
{0x94416130,WrapU_UUUU<sceKernelGetThreadmanIdList>,"sceKernelGetThreadmanIdList"},
@ -586,7 +586,7 @@ const HLEFunction ThreadManForUser[] =
{0xE1619D7C,sceKernelSysClock2USecWide,"sceKernelSysClock2USecWide"},
{0x110dec9a,sceKernelUSec2SysClock,"sceKernelUSec2SysClock"},
{0x278C0DF5,sceKernelWaitThreadEnd,"sceKernelWaitThreadEnd"},
{0x278C0DF5,WrapI_IU<sceKernelWaitThreadEnd>,"sceKernelWaitThreadEnd"},
{0xd59ead2f,sceKernelWakeupThread,"sceKernelWakeupThread"}, //AI Go, audio?
{0x0C106E53,0,"sceKernelRegisterThreadEventHandler"},

View File

@ -1807,47 +1807,45 @@ void sceKernelSleepThreadCB()
__KernelCheckCallbacks();
}
void sceKernelWaitThreadEnd()
int sceKernelWaitThreadEnd(SceUID threadID, u32 timeoutPtr)
{
SceUID id = PARAM(0);
DEBUG_LOG(HLE,"sceKernelWaitThreadEnd(%i)",id);
DEBUG_LOG(HLE, "sceKernelWaitThreadEnd(%i, %08x)", threadID);
u32 error;
Thread *t = kernelObjects.Get<Thread>(id, error);
Thread *t = kernelObjects.Get<Thread>(threadID, error);
if (t)
{
if (t->nt.status != THREADSTATUS_DORMANT) {
__KernelWaitCurThread(WAITTYPE_THREADEND, id, 0, 0, false);
__KernelWaitCurThread(WAITTYPE_THREADEND, threadID, 0, 0, false);
} else {
DEBUG_LOG(HLE,"sceKernelWaitThreadEnd - thread %i already ended. Doing nothing.", id);
DEBUG_LOG(HLE, "sceKernelWaitThreadEnd - thread %i already ended. Doing nothing.", threadID);
}
}
else
{
ERROR_LOG(HLE,"sceKernelWaitThreadEnd - bad thread %i", id);
ERROR_LOG(HLE, "sceKernelWaitThreadEnd - bad thread %i", threadID);
}
RETURN(0);
return 0;
}
void sceKernelWaitThreadEndCB()
int sceKernelWaitThreadEndCB(SceUID threadID, u32 timeoutPtr)
{
SceUID id = PARAM(0);
DEBUG_LOG(HLE,"sceKernelWaitThreadEnd(%i)",id);
DEBUG_LOG(HLE, "sceKernelWaitThreadEnd(%i)", threadID);
u32 error;
Thread *t = kernelObjects.Get<Thread>(id, error);
Thread *t = kernelObjects.Get<Thread>(threadID, error);
if (t)
{
if (t->nt.status != THREADSTATUS_DORMANT) {
__KernelWaitCurThread(WAITTYPE_THREADEND, id, 0, 0, true);
__KernelWaitCurThread(WAITTYPE_THREADEND, threadID, 0, 0, true);
} else {
DEBUG_LOG(HLE,"sceKernelWaitThreadEnd - thread %i already ended. Doing nothing.", id);
DEBUG_LOG(HLE,"sceKernelWaitThreadEnd - thread %i already ended. Doing nothing.", threadID);
}
__KernelCheckCallbacks();
}
else
{
ERROR_LOG(HLE,"sceKernelWaitThreadEnd - bad thread %i", id);
ERROR_LOG(HLE,"sceKernelWaitThreadEnd - bad thread %i", threadID);
}
RETURN(0);
return 0;
}
void sceKernelSuspendThread()

View File

@ -40,7 +40,7 @@ void sceKernelGetThreadCurrentPriority();
int sceKernelStartThread(SceUID threadToStartID, u32 argSize, u32 argBlockPtr);
u32 sceKernelSuspendDispatchThread();
u32 sceKernelResumeDispatchThread(u32 suspended);
void sceKernelWaitThreadEnd();
int sceKernelWaitThreadEnd(SceUID threadID, u32 timeoutPtr);
u32 sceKernelReferThreadStatus(u32 uid, u32 statusPtr);
u32 sceKernelReferThreadRunStatus(u32 uid, u32 statusPtr);
void sceKernelChangeCurrentThreadAttr();
@ -52,7 +52,7 @@ void sceKernelWakeupThread();
void sceKernelCancelWakeupThread();
int sceKernelTerminateDeleteThread(int threadno);
int sceKernelTerminateThread(u32 threadID);
void sceKernelWaitThreadEndCB();
int sceKernelWaitThreadEndCB(SceUID threadID, u32 timeoutPtr);
void sceKernelGetThreadExitStatus();
u32 sceKernelGetThreadmanIdType(u32);
u32 sceKernelGetThreadmanIdList(u32 type, u32 readBufPtr, u32 readBufSize, u32 idCountPtr);