all repos — mgba @ 0293e723d805c3255c2873f4a1cb9de0128ee217

mGBA Game Boy Advance Emulator

GBA: Better debug logging if event processing breaks
Jeffrey Pfau jeffrey@endrift.com
Sun, 04 Sep 2016 09:32:07 -0700
commit

0293e723d805c3255c2873f4a1cb9de0128ee217

parent

ee3edbbd19a9bff0b7e3428dd0c09ca37b452291

2 files changed, 19 insertions(+), 5 deletions(-)

jump to
M CHANGESCHANGES

@@ -88,6 +88,7 @@ - PSP2: Stop underclocking when menuing

- 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:
M src/gba/gba.csrc/gba/gba.c

@@ -234,33 +234,41 @@ #endif

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 @@

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); }