diff --git a/CHANGES b/CHANGES index 9631a21f1..29b904e24 100644 --- a/CHANGES +++ b/CHANGES @@ -88,6 +88,7 @@ Misc: - GUI: Increase scrolling speed - Qt: Rearchitect game closing codepath - Wii: Add pixelated resample filter + - GBA: Better debug logging if event processing breaks 0.4.1: (2016-07-11) Bugfixes: diff --git a/src/gba/gba.c b/src/gba/gba.c index c2213473e..d8436e47e 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -234,33 +234,41 @@ static void GBAProcessEvents(struct ARMCore* cpu) { testEvent = GBAVideoProcessEvents(&gba->video, cycles); if (testEvent < nextEvent) { +#ifndef NDEBUG if (testEvent == 0) { - abort(); + mLOG(GBA, ERROR, "Video requiring 0 cycles"); } +#endif nextEvent = testEvent; } testEvent = GBAAudioProcessEvents(&gba->audio, cycles); if (testEvent < nextEvent) { +#ifndef NDEBUG if (testEvent == 0) { - abort(); + mLOG(GBA, ERROR, "Audio requiring 0 cycles"); } +#endif nextEvent = testEvent; } testEvent = GBATimersProcessEvents(gba, cycles); if (testEvent < nextEvent) { +#ifndef NDEBUG if (testEvent == 0) { - abort(); + mLOG(GBA, ERROR, "Timers requiring 0 cycles"); } +#endif nextEvent = testEvent; } testEvent = GBAMemoryRunDMAs(gba, cycles); if (testEvent < nextEvent) { +#ifndef NDEBUG if (testEvent == 0) { - abort(); + mLOG(GBA, ERROR, "DMAs requiring 0 cycles"); } +#endif nextEvent = testEvent; } @@ -275,9 +283,14 @@ static void GBAProcessEvents(struct ARMCore* cpu) { if (cpu->halted) { cpu->cycles = cpu->nextEvent; } - if (cpu->nextEvent == 0) { + if (nextEvent == 0) { break; } +#ifndef NDEBUG + else if (nextEvent < 0) { + mLOG(GBA, FATAL, "Negative cycles will pass: %i", nextEvent); + } +#endif } while (cpu->cycles >= cpu->nextEvent); }