GBA DMA: Fix invalid DMA handling (fixes #1301)

This commit is contained in:
Vicki Pfau 2019-02-24 11:06:19 -08:00
parent f9f105a852
commit cce4b0fcd4
2 changed files with 5 additions and 7 deletions

View File

@ -27,6 +27,7 @@ Bugfixes:
- 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

View File

@ -260,15 +260,13 @@ void GBADMAService(struct GBA* gba, int number, struct GBADMA* info) {
}
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 @@ void GBADMAService(struct GBA* gba, int number, struct GBADMA* info) {
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;