Plugins: Schedule plugins before game thread.

This commit is contained in:
Unknown W. Brackets
2020-09-08 09:31:09 -07:00
parent 2f4945aad8
commit ac7522b0dd
5 changed files with 26 additions and 16 deletions
+12 -10
View File
@@ -2246,10 +2246,7 @@ bool __KernelIsDispatchEnabled()
return dispatchEnabled && __InterruptsEnabled();
}
int sceKernelRotateThreadReadyQueue(int priority)
{
VERBOSE_LOG(SCEKERNEL, "sceKernelRotateThreadReadyQueue(%x)", priority);
int KernelRotateThreadReadyQueue(int priority) {
PSPThread *cur = __GetCurrentThread();
// 0 is special, it means "my current priority."
@@ -2259,11 +2256,9 @@ int sceKernelRotateThreadReadyQueue(int priority)
if (priority <= 0x07 || priority > 0x77)
return SCE_KERNEL_ERROR_ILLEGAL_PRIORITY;
if (!threadReadyQueue.empty(priority))
{
if (!threadReadyQueue.empty(priority)) {
// In other words, yield to everyone else.
if (cur->nt.currentPriority == priority)
{
if (cur->nt.currentPriority == priority) {
threadReadyQueue.push_back(priority, currentThread);
cur->nt.status = (cur->nt.status & ~THREADSTATUS_RUNNING) | THREADSTATUS_READY;
}
@@ -2272,11 +2267,18 @@ int sceKernelRotateThreadReadyQueue(int priority)
threadReadyQueue.rotate(priority);
}
hleReSchedule("rotatethreadreadyqueue");
hleEatCycles(250);
return 0;
}
int sceKernelRotateThreadReadyQueue(int priority) {
int result = KernelRotateThreadReadyQueue(priority);
if (result == 0) {
hleReSchedule("rotatethreadreadyqueue");
hleEatCycles(250);
}
return hleLogSuccessVerboseI(SCEKERNEL, result);
}
int sceKernelDeleteThread(int threadID) {
if (threadID == 0 || threadID == currentThread) {
ERROR_LOG(SCEKERNEL, "sceKernelDeleteThread(%i): cannot delete current thread", threadID);