mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Initial attempt at a suspend/resume thread impl.
This commit is contained in:
parent
690e52bc34
commit
e6795b1a41
@ -692,14 +692,14 @@ const HLEFunction ThreadManForUser[] =
|
||||
{0xFFC36A14,WrapU_UU<sceKernelReferThreadRunStatus>,"sceKernelReferThreadRunStatus"},
|
||||
{0x17c1684e,WrapU_UU<sceKernelReferThreadStatus>,"sceKernelReferThreadStatus"},
|
||||
{0x2C34E053,WrapI_I<sceKernelReleaseWaitThread>,"sceKernelReleaseWaitThread"},
|
||||
{0x75156e8f,sceKernelResumeThread,"sceKernelResumeThread"},
|
||||
{0x75156e8f,WrapI_I<sceKernelResumeThread>,"sceKernelResumeThread"},
|
||||
{0x3ad58b8c,&WrapU_V<sceKernelSuspendDispatchThread>,"sceKernelSuspendDispatchThread"},
|
||||
{0x27e22ec2,&WrapU_U<sceKernelResumeDispatchThread>,"sceKernelResumeDispatchThread"},
|
||||
{0x912354a7,&WrapI_I<sceKernelRotateThreadReadyQueue>,"sceKernelRotateThreadReadyQueue"},
|
||||
{0x9ACE131E,WrapI_V<sceKernelSleepThread>,"sceKernelSleepThread"},
|
||||
{0x82826f70,WrapI_V<sceKernelSleepThreadCB>,"sceKernelSleepThreadCB"},
|
||||
{0xF475845D,&WrapI_IIU<sceKernelStartThread>,"sceKernelStartThread"},
|
||||
{0x9944f31f,sceKernelSuspendThread,"sceKernelSuspendThread"},
|
||||
{0x9944f31f,WrapI_I<sceKernelSuspendThread>,"sceKernelSuspendThread"},
|
||||
{0x616403ba,WrapI_I<sceKernelTerminateThread>,"sceKernelTerminateThread"},
|
||||
{0x383f7bcc,WrapI_I<sceKernelTerminateDeleteThread>,"sceKernelTerminateDeleteThread"},
|
||||
{0x840E8133,WrapI_IU<sceKernelWaitThreadEndCB>,"sceKernelWaitThreadEndCB"},
|
||||
|
@ -2484,16 +2484,60 @@ int sceKernelReleaseWaitThread(SceUID threadID)
|
||||
}
|
||||
}
|
||||
|
||||
void sceKernelSuspendThread()
|
||||
int sceKernelSuspendThread(SceUID threadID)
|
||||
{
|
||||
WARN_LOG_REPORT(HLE,"UNIMPL sceKernelSuspendThread");
|
||||
RETURN(0);
|
||||
u32 error;
|
||||
Thread *t = kernelObjects.Get<Thread>(threadID, error);
|
||||
if (t)
|
||||
{
|
||||
if (t->isStopped())
|
||||
{
|
||||
ERROR_LOG(HLE, "sceKernelSuspendThread(%d): thread not running", threadID);
|
||||
return SCE_KERNEL_ERROR_DORMANT;
|
||||
}
|
||||
if (t->isSuspended())
|
||||
{
|
||||
ERROR_LOG(HLE, "sceKernelSuspendThread(%d): thread already suspended", threadID);
|
||||
return SCE_KERNEL_ERROR_SUSPEND;
|
||||
}
|
||||
|
||||
WARN_LOG(HLE, "sceKernelSuspendThread(%d)", threadID);
|
||||
if (t->isReady())
|
||||
__KernelChangeReadyState(t, threadID, false);
|
||||
t->nt.status = (t->nt.status & ~THREADSTATUS_READY) | THREADSTATUS_SUSPEND;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(HLE, "sceKernelSuspendThread(%d): bad thread", threadID);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
void sceKernelResumeThread()
|
||||
int sceKernelResumeThread(SceUID threadID)
|
||||
{
|
||||
WARN_LOG_REPORT(HLE,"UNIMPL sceKernelResumeThread");
|
||||
RETURN(0);
|
||||
u32 error;
|
||||
Thread *t = kernelObjects.Get<Thread>(threadID, error);
|
||||
if (t)
|
||||
{
|
||||
if (!t->isSuspended())
|
||||
{
|
||||
ERROR_LOG(HLE, "sceKernelSuspendThread(%d): thread not suspended", threadID);
|
||||
return SCE_KERNEL_ERROR_NOT_SUSPEND;
|
||||
}
|
||||
WARN_LOG(HLE, "sceKernelResumeThread(%d)", threadID);
|
||||
t->nt.status &= ~THREADSTATUS_SUSPEND;
|
||||
|
||||
// If it was dormant, waiting, etc. before we don't flip it's ready state.
|
||||
if (t->nt.status == 0)
|
||||
__KernelChangeReadyState(t, threadID, true);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(HLE, "sceKernelResumeThread(%d): bad thread", threadID);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,8 +47,8 @@ int sceKernelReleaseWaitThread(SceUID threadID);
|
||||
void sceKernelChangeCurrentThreadAttr();
|
||||
int sceKernelRotateThreadReadyQueue(int priority);
|
||||
int sceKernelCheckThreadStack();
|
||||
void sceKernelSuspendThread();
|
||||
void sceKernelResumeThread();
|
||||
int sceKernelSuspendThread(SceUID threadID);
|
||||
int sceKernelResumeThread(SceUID threadID);
|
||||
int sceKernelWakeupThread(SceUID threadID);
|
||||
int sceKernelCancelWakeupThread(SceUID threadID);
|
||||
int sceKernelSleepThread();
|
||||
|
Loading…
Reference in New Issue
Block a user