all repos — mgba @ e80a2417484cb68e2177403fe9d522a22c8f4c0d

mGBA Game Boy Advance Emulator

GB Memory: Fix HDMA count starting in mode 0 (fixes #855)
Vicki Pfau vi@endrift.com
Sat, 12 Aug 2017 14:12:49 -0700
commit

e80a2417484cb68e2177403fe9d522a22c8f4c0d

parent

33fcd5ed84caa1fa4406e438a6345e9f0cae87c0

3 files changed, 7 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -18,6 +18,7 @@ - GB, GBA Savedata: Fix savestate-related save overwriting (fixes mgba.io/i/834)

- Qt: Fix timezone issues with time overrides - Qt: Fix sprite export pausing game indefinitely (fixes mgba.io/i/841) - GB Video: Fix potential hang when ending mode 0 + - GB Memory: Fix HDMA count starting in mode 0 (fixes mgba.io/i/855) Misc: - Qt: Don't rebuild library view if style hasn't changed - SDL: Fix 2.0.5 build on macOS under some circumstances
M src/gb/memory.csrc/gb/memory.c

@@ -464,10 +464,13 @@ gb->memory.hdmaDest |= 0x8000;

bool wasHdma = gb->memory.isHdma; gb->memory.isHdma = value & 0x80; if ((!wasHdma && !gb->memory.isHdma) || gb->video.mode == 0) { - gb->memory.hdmaRemaining = ((value & 0x7F) + 1) * 0x10; + if (gb->memory.isHdma) { + gb->memory.hdmaRemaining = 0x10; + } else { + gb->memory.hdmaRemaining = ((value & 0x7F) + 1) * 0x10; + } gb->cpuBlocked = true; mTimingSchedule(&gb->timing, &gb->memory.hdmaEvent, 0); - gb->cpu->nextEvent = gb->cpu->cycles; } }
M src/gb/video.csrc/gb/video.c

@@ -231,6 +231,7 @@ struct GBVideo* video = context;

GBVideoProcessDots(video); if (video->ly < GB_VIDEO_VERTICAL_PIXELS && video->p->memory.isHdma && video->p->memory.io[REG_HDMA5] != 0xFF) { video->p->memory.hdmaRemaining = 0x10; + video->p->cpuBlocked = true; mTimingDeschedule(timing, &video->p->memory.hdmaEvent); mTimingSchedule(timing, &video->p->memory.hdmaEvent, 0); }