mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Thread: Log error when delaying a waiting thread.
This will handle double delaying and delaying in general.
This commit is contained in:
parent
c1fa4958d9
commit
b9ae574679
3 changed files with 27 additions and 16 deletions
|
@ -365,28 +365,30 @@ bool hleExecuteDebugBreak(const HLEFunction &func)
|
|||
return true;
|
||||
}
|
||||
|
||||
u32 hleDelayResult(u32 result, const char *reason, int usec)
|
||||
{
|
||||
if (__KernelIsDispatchEnabled())
|
||||
{
|
||||
CoreTiming::ScheduleEvent(usToCycles(usec), delayedResultEvent, __KernelGetCurThread());
|
||||
u32 hleDelayResult(u32 result, const char *reason, int usec) {
|
||||
if (!__KernelIsDispatchEnabled()) {
|
||||
WARN_LOG(HLE, "%s: Dispatch disabled, not delaying HLE result (right thing to do?)", latestSyscall ? latestSyscall->name : "?");
|
||||
} else {
|
||||
SceUID thread = __KernelGetCurThread();
|
||||
if (KernelIsThreadWaiting(thread))
|
||||
ERROR_LOG(HLE, "%s: Delaying a thread that's already waiting", latestSyscall ? latestSyscall->name : "?");
|
||||
CoreTiming::ScheduleEvent(usToCycles(usec), delayedResultEvent, thread);
|
||||
__KernelWaitCurThread(WAITTYPE_HLEDELAY, 1, result, 0, false, reason);
|
||||
}
|
||||
else
|
||||
WARN_LOG(HLE, "Dispatch disabled, not delaying HLE result (right thing to do?)");
|
||||
return result;
|
||||
}
|
||||
|
||||
u64 hleDelayResult(u64 result, const char *reason, int usec)
|
||||
{
|
||||
if (__KernelIsDispatchEnabled())
|
||||
{
|
||||
u64 param = (result & 0xFFFFFFFF00000000) | __KernelGetCurThread();
|
||||
u64 hleDelayResult(u64 result, const char *reason, int usec) {
|
||||
if (!__KernelIsDispatchEnabled()) {
|
||||
WARN_LOG(HLE, "%s: Dispatch disabled, not delaying HLE result (right thing to do?)", latestSyscall ? latestSyscall->name : "?");
|
||||
} else {
|
||||
SceUID thread = __KernelGetCurThread();
|
||||
if (KernelIsThreadWaiting(thread))
|
||||
ERROR_LOG(HLE, "%s: Delaying a thread that's already waiting", latestSyscall ? latestSyscall->name : "?");
|
||||
u64 param = (result & 0xFFFFFFFF00000000) | thread;
|
||||
CoreTiming::ScheduleEvent(usToCycles(usec), delayedResultEvent, param);
|
||||
__KernelWaitCurThread(WAITTYPE_HLEDELAY, 1, (u32) result, 0, false, reason);
|
||||
__KernelWaitCurThread(WAITTYPE_HLEDELAY, 1, (u32)result, 0, false, reason);
|
||||
}
|
||||
else
|
||||
WARN_LOG(HLE, "Dispatch disabled, not delaying HLE result (right thing to do?)");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1212,7 +1212,15 @@ bool KernelIsThreadDormant(SceUID threadID) {
|
|||
PSPThread *t = kernelObjects.Get<PSPThread>(threadID, error);
|
||||
if (t)
|
||||
return (t->nt.status & (THREADSTATUS_DEAD | THREADSTATUS_DORMANT)) != 0;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool KernelIsThreadWaiting(SceUID threadID) {
|
||||
u32 error;
|
||||
PSPThread *t = kernelObjects.Get<PSPThread>(threadID, error);
|
||||
if (t)
|
||||
return (t->nt.status & (THREADSTATUS_WAITSUSPEND)) != 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 __KernelGetWaitValue(SceUID threadID, u32 &error) {
|
||||
|
|
|
@ -173,6 +173,7 @@ u32 __KernelGetCurThreadStack();
|
|||
u32 __KernelGetCurThreadStackStart();
|
||||
const char *__KernelGetThreadName(SceUID threadID);
|
||||
bool KernelIsThreadDormant(SceUID threadID);
|
||||
bool KernelIsThreadWaiting(SceUID threadID);
|
||||
|
||||
void __KernelSaveContext(PSPThreadContext *ctx, bool vfpuEnabled);
|
||||
void __KernelLoadContext(PSPThreadContext *ctx, bool vfpuEnabled);
|
||||
|
|
Loading…
Add table
Reference in a new issue