GBA Memory: Fix DMAs from BIOS while not in BIOS

DMAs appear to have special protections against reading from the BIOS, causing
BIOS reads to be entirely zero. This behavior needs confirmation on hardware,
but seems to make sense.
This commit is contained in:
Jeffrey Pfau 2015-10-25 14:18:07 -07:00
parent b5afb04ca5
commit b8b7ec0b12
2 changed files with 12 additions and 2 deletions

View File

@ -6,6 +6,7 @@ Features:
Bugfixes:
- Util: Fix PowerPC PNG read/write pixel order
- Qt: Use safer isLoaded check in GameController
- GBA Memory: Fix DMAs from BIOS while not in BIOS
Misc:
- Qt: Window size command line options are now supported
- Qt: Increase usability of key mapper

View File

@ -330,7 +330,12 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
LOAD_32(value, address, memory->bios); \
} else { \
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load32: 0x%08X", address); \
value = memory->biosPrefetch; \
if (memory->activeDMA) { \
/* TODO: Test on hardware */ \
value = 0; \
} else { \
value = memory->biosPrefetch; \
} \
} \
} else { \
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load32: 0x%08X", address); \
@ -446,7 +451,11 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
LOAD_16(value, address, memory->bios);
} else {
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load16: 0x%08X", address);
value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF;
if (memory->activeDMA) {
value = 0;
} else {
value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF;
}
}
} else {
GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load16: 0x%08X", address);