GBA DMA: Fix invalid DMA handling (fixes #1301)
Vicki Pfau vi@endrift.com
Sun, 24 Feb 2019 11:06:19 -0800
2 files changed,
5 insertions(+),
7 deletions(-)
M
CHANGES
→
CHANGES
@@ -27,6 +27,7 @@ - GBA Video: Fix enabling layers in non-tile modes (fixes mgba.io/i/1317)
- Qt: Fix quick load recent accidentally saving (fixes mgba.io/i/1309) - GBA: Fix video timing when skipping BIOS (fixes mgba.io/i/1318) - 3DS: Work around menu freezing (fixes mgba.io/i/1294) + - GBA DMA: Fix invalid DMA handling (fixes mgba.io/i/1301) Misc: - GBA Savedata: EEPROM performance fixes - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
M
src/gba/dma.c
→
src/gba/dma.c
@@ -260,15 +260,13 @@ memory->dmaTransferRegister = cpu->memory.load32(cpu, source, 0);
} gba->bus = memory->dmaTransferRegister; cpu->memory.store32(cpu, dest, memory->dmaTransferRegister, 0); - memory->dmaTransferRegister &= 0xFFFF0000; - memory->dmaTransferRegister |= memory->dmaTransferRegister >> 16; } else { if (sourceRegion == REGION_CART2_EX && (memory->savedata.type == SAVEDATA_EEPROM || memory->savedata.type == SAVEDATA_EEPROM512)) { memory->dmaTransferRegister = GBASavedataReadEEPROM(&memory->savedata); - } else { - if (source) { - memory->dmaTransferRegister = cpu->memory.load16(cpu, source, 0); - } + memory->dmaTransferRegister |= memory->dmaTransferRegister << 16; + } else if (source) { + memory->dmaTransferRegister = cpu->memory.load16(cpu, source, 0); + memory->dmaTransferRegister |= memory->dmaTransferRegister << 16; } if (destRegion == REGION_CART2_EX) { if (memory->savedata.type == SAVEDATA_AUTODETECT) {@@ -282,7 +280,6 @@ } else {
cpu->memory.store16(cpu, dest, memory->dmaTransferRegister, 0); } - memory->dmaTransferRegister |= memory->dmaTransferRegister << 16; gba->bus = memory->dmaTransferRegister; } int sourceOffset = DMA_OFFSET[GBADMARegisterGetSrcControl(info->reg)] * width;