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
@@ -20,6 +20,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 Video: Improve sprite cycle counting (fixes mgba.io/i/1274) - Qt: Updated Italian translation (by Vecna)
M
src/gba/dma.c
→
src/gba/dma.c
@@ -260,8 +260,6 @@ 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) { if (memory->savedata.type == SAVEDATA_AUTODETECT) {@@ -269,10 +267,10 @@ mLOG(GBA_MEM, INFO, "Detected EEPROM savegame");
GBASavedataInitEEPROM(&memory->savedata); } 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) {@@ -286,7 +284,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;