check IRQ first then Idle loop

apparently I put it this way for a reason
This commit is contained in:
RSDuck
2020-07-28 00:44:58 +02:00
parent ea734084ca
commit f56aa60eb6
2 changed files with 29 additions and 27 deletions

View File

@ -660,19 +660,20 @@ void ARMv5::ExecuteJIT()
if (StopExecution)
{
if (Halted || IdleLoop)
{
bool idleLoop = IdleLoop;
IdleLoop = 0;
if ((Halted == 1 || idleLoop) && NDS::ARM9Timestamp < NDS::ARM9Target)
{
NDS::ARM9Timestamp = NDS::ARM9Target;
}
break;
}
// this order is crucial otherwise idle loops waiting for an IRQ won't function
if (IRQ)
TriggerIRQ();
if (Halted || IdleLoop)
{
if ((Halted == 1 || IdleLoop) && NDS::ARM9Timestamp < NDS::ARM9Target)
{
Cycles = 0;
NDS::ARM9Timestamp = NDS::ARM9Target;
}
IdleLoop = 0;
break;
}
}
NDS::ARM9Timestamp += Cycles;
@ -808,22 +809,21 @@ void ARMv4::ExecuteJIT()
else
ARMJIT::CompileBlock(this);
// TODO optimize this shit!!!
if (StopExecution)
{
if (Halted || IdleLoop)
{
bool idleLoop = IdleLoop;
IdleLoop = 0;
if ((Halted == 1 || idleLoop) && NDS::ARM7Timestamp < NDS::ARM7Target)
{
NDS::ARM7Timestamp = NDS::ARM7Target;
}
break;
}
if (IRQ)
TriggerIRQ();
if (Halted || IdleLoop)
{
if ((Halted == 1 || IdleLoop) && NDS::ARM7Timestamp < NDS::ARM7Target)
{
Cycles = 0;
NDS::ARM7Timestamp = NDS::ARM7Target;
}
IdleLoop = 0;
break;
}
}
NDS::ARM7Timestamp += Cycles;