GBA: Process multiple timer events at once, if necessary
Jeffrey Pfau jeffrey@endrift.com
Tue, 11 Aug 2015 21:15:09 -0700
3 files changed,
6 insertions(+),
1 deletions(-)
M
CHANGES
→
CHANGES
@@ -122,6 +122,7 @@ - Qt: Show checkmark for window sizes
- Qt: Set window path to loaded ROM - GBA Memory: Run multiple DMAs in a tight loop if they all occur before present - GBA Audio: Process multiple audio events at once, if necessary + - GBA: Process multiple timer events at once, if necessary 0.2.1: (2015-05-13) Bugfixes:
M
src/gba/gba.c
→
src/gba/gba.c
@@ -244,7 +244,7 @@ timer = &gba->timers[0];
if (timer->enable) { timer->nextEvent -= cycles; timer->lastEvent -= cycles; - if (timer->nextEvent <= 0) { + while (timer->nextEvent <= 0) { timer->lastEvent = timer->nextEvent; timer->nextEvent += timer->overflowInterval; gba->memory.io[REG_TM0CNT_LO >> 1] = timer->reload;
M
src/gba/serialize.c
→
src/gba/serialize.c
@@ -103,6 +103,10 @@ if (state->timers[0].overflowInterval < 0 || state->timers[1].overflowInterval < 0 || state->timers[2].overflowInterval < 0 || state->timers[3].overflowInterval < 0) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: overflowInterval is negative"); error = true; } + if (state->timers[0].nextEvent < 0 || state->timers[1].nextEvent < 0 || state->timers[2].nextEvent < 0 || state->timers[3].nextEvent < 0) { + GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: timer nextEvent is negative"); + error = true; + } if (state->audio.eventDiff < 0) { GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio eventDiff is negative"); error = true;