diff options
author | RSDuck <rsduck@users.noreply.github.com> | 2020-07-28 00:44:58 +0200 |
---|---|---|
committer | RSDuck <rsduck@users.noreply.github.com> | 2020-07-28 00:44:58 +0200 |
commit | f56aa60eb693ed41212960db60e01ceecf5d64c5 (patch) | |
tree | e61479f88a19c13b68bcf07a5a2c781649da00a8 /src/ARM.cpp | |
parent | ea734084cad4334e0a1247be99320e37f3bd2ee1 (diff) |
check IRQ first then Idle loop
apparently I put it this way for a reason
Diffstat (limited to 'src/ARM.cpp')
-rw-r--r-- | src/ARM.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/ARM.cpp b/src/ARM.cpp index c1743ea..7eeacb7 100644 --- a/src/ARM.cpp +++ b/src/ARM.cpp @@ -660,19 +660,20 @@ void ARMv5::ExecuteJIT() if (StopExecution) { + // this order is crucial otherwise idle loops waiting for an IRQ won't function + if (IRQ) + TriggerIRQ(); + if (Halted || IdleLoop) { - bool idleLoop = IdleLoop; - IdleLoop = 0; - if ((Halted == 1 || idleLoop) && NDS::ARM9Timestamp < NDS::ARM9Target) + if ((Halted == 1 || IdleLoop) && NDS::ARM9Timestamp < NDS::ARM9Target) { + Cycles = 0; NDS::ARM9Timestamp = NDS::ARM9Target; } + IdleLoop = 0; break; } - - if (IRQ) - TriggerIRQ(); } NDS::ARM9Timestamp += Cycles; @@ -808,22 +809,21 @@ void ARMv4::ExecuteJIT() else ARMJIT::CompileBlock(this); - // TODO optimize this shit!!! if (StopExecution) { + if (IRQ) + TriggerIRQ(); + if (Halted || IdleLoop) { - bool idleLoop = IdleLoop; - IdleLoop = 0; - if ((Halted == 1 || idleLoop) && NDS::ARM7Timestamp < NDS::ARM7Target) + if ((Halted == 1 || IdleLoop) && NDS::ARM7Timestamp < NDS::ARM7Target) { + Cycles = 0; NDS::ARM7Timestamp = NDS::ARM7Target; } + IdleLoop = 0; break; } - - if (IRQ) - TriggerIRQ(); } NDS::ARM7Timestamp += Cycles; |