mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-27 12:05:43 +00:00
Initial sceKernelRotateThreadReadyQueue().
Might not be right but it's closer. Makes games that call this func much faster.
This commit is contained in:
parent
db3f01044d
commit
411c711dac
@ -590,7 +590,7 @@ const HLEFunction ThreadManForUser[] =
|
||||
{0x75156e8f,sceKernelResumeThread,"sceKernelResumeThread"},
|
||||
{0x3ad58b8c,&WrapU_V<sceKernelSuspendDispatchThread>,"sceKernelSuspendDispatchThread"},
|
||||
{0x27e22ec2,&WrapU_U<sceKernelResumeDispatchThread>,"sceKernelResumeDispatchThread"},
|
||||
{0x912354a7,sceKernelRotateThreadReadyQueue,"sceKernelRotateThreadReadyQueue"},
|
||||
{0x912354a7,&WrapI_I<sceKernelRotateThreadReadyQueue>,"sceKernelRotateThreadReadyQueue"},
|
||||
{0x9ACE131E,sceKernelSleepThread,"sceKernelSleepThread"},
|
||||
{0x82826f70,sceKernelSleepThreadCB,"sceKernelSleepThreadCB"},
|
||||
{0xF475845D,&WrapI_IUU<sceKernelStartThread>,"sceKernelStartThread"},
|
||||
|
@ -1600,10 +1600,31 @@ u32 sceKernelResumeDispatchThread(u32 suspended)
|
||||
return oldDispatchSuspended;
|
||||
}
|
||||
|
||||
void sceKernelRotateThreadReadyQueue()
|
||||
int sceKernelRotateThreadReadyQueue(int priority)
|
||||
{
|
||||
DEBUG_LOG(HLE,"sceKernelRotateThreadReadyQueue : rescheduling");
|
||||
hleReSchedule("rotatethreadreadyqueue");
|
||||
|
||||
// TODO: Does it try better-priority threads? Is 0 special?
|
||||
if (!threadReadyQueue[priority].empty())
|
||||
{
|
||||
Thread *cur = __GetCurrentThread();
|
||||
// TODO: Who gets switched to with currentThread-priority? Next or next-next?
|
||||
if (cur->nt.currentPriority == priority)
|
||||
__KernelChangeReadyState(currentThread, true);
|
||||
|
||||
size_t readySize = threadReadyQueue[priority].size();
|
||||
if (readySize > 1)
|
||||
{
|
||||
SceUID first = threadReadyQueue[priority][0];
|
||||
memmove(&threadReadyQueue[priority][0], &threadReadyQueue[priority][1], (readySize - 1) * sizeof(SceUID));
|
||||
threadReadyQueue[priority][readySize - 1] = first;
|
||||
}
|
||||
hleReSchedule("rotatethreadreadyqueue");
|
||||
}
|
||||
// TODO: Does it reschedule in other cases?
|
||||
|
||||
// TODO: Any way to get a different return?
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sceKernelDeleteThread(int threadHandle)
|
||||
|
@ -46,7 +46,7 @@ u32 sceKernelReferThreadStatus(u32 uid, u32 statusPtr);
|
||||
u32 sceKernelReferThreadRunStatus(u32 uid, u32 statusPtr);
|
||||
int sceKernelReleaseWaitThread(SceUID threadID);
|
||||
void sceKernelChangeCurrentThreadAttr();
|
||||
void sceKernelRotateThreadReadyQueue();
|
||||
int sceKernelRotateThreadReadyQueue(int priority);
|
||||
void sceKernelCheckThreadStack();
|
||||
void sceKernelSuspendThread();
|
||||
void sceKernelResumeThread();
|
||||
|
Loading…
x
Reference in New Issue
Block a user