GBA Memory: Fix DMA behavior for SRAM accesses
Jeffrey Pfau jeffrey@endrift.com
Fri, 06 Nov 2015 21:06:09 -0800
3 files changed,
7 insertions(+),
3 deletions(-)
M
CHANGES
→
CHANGES
@@ -9,6 +9,7 @@ - Qt: Fix font size in memory viewer
- Qt: Fix a crash in the memory viewer - Libretro: Fix problems with rumble not turning off - GBA BIOS: Fix CpuSet on 0x01XXXXXX addresses + - GBA Memory: Fix DMA behavior for SRAM accesses Misc: - GBA Audio: Implement missing flags on SOUNDCNT_X register
M
src/gba/gba.h
→
src/gba/gba.h
@@ -85,7 +85,7 @@
struct ARMDebugger* debugger; uint32_t bus; - bool performingDMA; + int performingDMA; int timersEnabled; struct GBATimer timers[4];
M
src/gba/memory.c
→
src/gba/memory.c
@@ -586,6 +586,9 @@ if (memory->savedata.type == SAVEDATA_AUTODETECT) {
GBALog(gba, GBA_LOG_INFO, "Detected SRAM savegame"); GBASavedataInitSRAM(&memory->savedata); } + if (gba->performingDMA == 1) { + break; + } if (memory->savedata.type == SAVEDATA_SRAM) { value = memory->savedata.data[address & (SIZE_CART_SRAM - 1)]; } else if (memory->savedata.type == SAVEDATA_FLASH512 || memory->savedata.type == SAVEDATA_FLASH1M) {@@ -1464,7 +1467,7 @@ cycles += memory->waitstatesSeq16[sourceRegion] + memory->waitstatesSeq16[destRegion];
} } - gba->performingDMA = true; + gba->performingDMA = 1 | (number << 1); int32_t word; if (width == 4) { word = cpu->memory.load32(cpu, source, 0);@@ -1501,7 +1504,7 @@ dest += destOffset;
--wordsRemaining; } } - gba->performingDMA = false; + gba->performingDMA = 0; if (!wordsRemaining) { if (!GBADMARegisterIsRepeat(info->reg) || GBADMARegisterGetTiming(info->reg) == DMA_TIMING_NOW) {