mirror of https://github.com/mgba-emu/mgba.git
GBA: Process multiple timer events at once, if necessary
This commit is contained in:
parent
ebfcc70b3d
commit
4fd479897c
1
CHANGES
1
CHANGES
|
@ -122,6 +122,7 @@ Misc:
|
|||
- 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:
|
||||
|
|
|
@ -244,7 +244,7 @@ static int32_t GBATimersProcessEvents(struct GBA* gba, int32_t cycles) {
|
|||
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;
|
||||
|
|
|
@ -103,6 +103,10 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue