GB Memory: Actually, HDMAs should start when LCD is off (fixes #2662)

This commit is contained in:
Vicki Pfau 2022-12-08 01:20:51 -08:00
parent dc5f6e37e1
commit 4f70b313fc
2 changed files with 2 additions and 3 deletions

View File

@ -5,6 +5,7 @@ Features:
Emulation fixes: Emulation fixes:
- GB Audio: Fix channels 1/2 not playing when resetting volume (fixes mgba.io/i/2614) - GB Audio: Fix channels 1/2 not playing when resetting volume (fixes mgba.io/i/2614)
- GB Audio: Fix channel 3 volume being changed between samples (fixes mgba.io/i/1896) - GB Audio: Fix channel 3 volume being changed between samples (fixes mgba.io/i/1896)
- GB Memory: Actually, HDMAs should start when LCD is off (fixes mgba.io/i/2662)
- GB Serialize: Don't write BGP/OBP when loading SCGB state (fixes mgba.io/i/2694) - GB Serialize: Don't write BGP/OBP when loading SCGB state (fixes mgba.io/i/2694)
- GB SIO: Further fix bidirectional transfer starting - GB SIO: Further fix bidirectional transfer starting
- GBA: Fix resetting key IRQ state (fixes mgba.io/i/2716) - GBA: Fix resetting key IRQ state (fixes mgba.io/i/2716)

View File

@ -558,7 +558,7 @@ uint8_t GBMemoryWriteHDMA5(struct GB* gb, uint8_t value) {
gb->memory.hdmaDest |= 0x8000; gb->memory.hdmaDest |= 0x8000;
bool wasHdma = gb->memory.isHdma; bool wasHdma = gb->memory.isHdma;
gb->memory.isHdma = value & 0x80; gb->memory.isHdma = value & 0x80;
if ((!wasHdma && !gb->memory.isHdma) || (GBRegisterLCDCIsEnable(gb->memory.io[GB_REG_LCDC]) && gb->video.mode == 0)) { if ((!wasHdma && !gb->memory.isHdma) || gb->video.mode == 0) {
if (gb->memory.isHdma) { if (gb->memory.isHdma) {
gb->memory.hdmaRemaining = 0x10; gb->memory.hdmaRemaining = 0x10;
} else { } else {
@ -566,8 +566,6 @@ uint8_t GBMemoryWriteHDMA5(struct GB* gb, uint8_t value) {
} }
gb->cpuBlocked = true; gb->cpuBlocked = true;
mTimingSchedule(&gb->timing, &gb->memory.hdmaEvent, 0); mTimingSchedule(&gb->timing, &gb->memory.hdmaEvent, 0);
} else if (gb->memory.isHdma && !GBRegisterLCDCIsEnable(gb->memory.io[GB_REG_LCDC])) {
return 0x80 | ((value + 1) & 0x7F);
} }
return value & 0x7F; return value & 0x7F;
} }