GBA Memory: Fix DMA behavior for SRAM accesses

This commit is contained in:
Jeffrey Pfau 2015-11-06 21:06:09 -08:00
parent c6f4f23332
commit 4c1977d351
3 changed files with 7 additions and 3 deletions

View File

@ -19,6 +19,7 @@ Bugfixes:
- Libretro: Fix problems with rumble not turning off
- ARM7: Fix sign of unaligned LDRSH
- GBA BIOS: Fix CpuSet on 0x01XXXXXX addresses
- GBA Memory: Fix DMA behavior for SRAM accesses
Misc:
- Qt: Window size command line options are now supported
- Qt: Increase usability of key mapper

View File

@ -88,7 +88,7 @@ struct GBA {
struct ARMDebugger* debugger;
uint32_t bus;
bool performingDMA;
int performingDMA;
int timersEnabled;
struct GBATimer timers[4];

View File

@ -591,6 +591,9 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
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) {
@ -1480,7 +1483,7 @@ void GBAMemoryServiceDMA(struct GBA* gba, int number, struct GBADMA* info) {
}
}
gba->performingDMA = true;
gba->performingDMA = 1 | (number << 1);
int32_t word;
if (width == 4) {
word = cpu->memory.load32(cpu, source, 0);
@ -1517,7 +1520,7 @@ void GBAMemoryServiceDMA(struct GBA* gba, int number, struct GBADMA* info) {
--wordsRemaining;
}
}
gba->performingDMA = false;
gba->performingDMA = 0;
if (!wordsRemaining) {
if (!GBADMARegisterIsRepeat(info->reg) || GBADMARegisterGetTiming(info->reg) == DMA_TIMING_NOW) {