all repos — mgba @ 4fd479897c6972377ac625f43306aa794bc4d5c0

mGBA Game Boy Advance Emulator

GBA: Process multiple timer events at once, if necessary
Jeffrey Pfau jeffrey@endrift.com
Tue, 11 Aug 2015 21:15:09 -0700
commit

4fd479897c6972377ac625f43306aa794bc4d5c0

parent

ebfcc70b3d4a6ef57b6ae05f32e912518174ed73

3 files changed, 6 insertions(+), 1 deletions(-)

jump to
M CHANGESCHANGES

@@ -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.csrc/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.csrc/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;