mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 15:15:40 +00:00
Timers: Don't hang when counter+target = 0 for timer1
This needs proper research into how it behaves with IRQs.
This commit is contained in:
parent
3c7229dfe2
commit
35a8c5b47c
|
@ -96,7 +96,7 @@ TickCount Timers::GetTicksUntilIRQ(u32 timer) const
|
||||||
return std::numeric_limits<TickCount>::max();
|
return std::numeric_limits<TickCount>::max();
|
||||||
|
|
||||||
TickCount ticks_until_irq = std::numeric_limits<TickCount>::max();
|
TickCount ticks_until_irq = std::numeric_limits<TickCount>::max();
|
||||||
if (cs.mode.irq_at_target)
|
if (cs.mode.irq_at_target && cs.counter < cs.target)
|
||||||
ticks_until_irq = static_cast<TickCount>(cs.target - cs.counter);
|
ticks_until_irq = static_cast<TickCount>(cs.target - cs.counter);
|
||||||
if (cs.mode.irq_on_overflow)
|
if (cs.mode.irq_on_overflow)
|
||||||
ticks_until_irq = std::min(ticks_until_irq, static_cast<TickCount>(0xFFFFu - cs.counter));
|
ticks_until_irq = std::min(ticks_until_irq, static_cast<TickCount>(0xFFFFu - cs.counter));
|
||||||
|
|
Loading…
Reference in a new issue