GBA Memory: Fix misaligned BIOS reads

This commit is contained in:
Jeffrey Pfau 2016-10-11 21:59:57 -07:00
parent 82df0e1cab
commit 4cbcc41e35
2 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@ Features:
Bugfixes: Bugfixes:
- LR35902: Fix core never exiting with certain event patterns - LR35902: Fix core never exiting with certain event patterns
- GB Timer: Improve DIV reset behavior - GB Timer: Improve DIV reset behavior
- GBA Memory: Fix misaligned BIOS reads
Misc: Misc:
- SDL: Remove scancode key input - SDL: Remove scancode key input
- GBA Video: Clean up unused timers - GBA Video: Clean up unused timers

View File

@ -352,7 +352,7 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
#define LOAD_BIOS \ #define LOAD_BIOS \
if (address < SIZE_BIOS) { \ if (address < SIZE_BIOS) { \
if (memory->activeRegion == REGION_BIOS) { \ if (memory->activeRegion == REGION_BIOS) { \
LOAD_32(value, address, memory->bios); \ LOAD_32(value, address & -4, memory->bios); \
} else { \ } else { \
mLOG(GBA_MEM, GAME_ERROR, "Bad BIOS Load32: 0x%08X", address); \ mLOG(GBA_MEM, GAME_ERROR, "Bad BIOS Load32: 0x%08X", address); \
value = memory->biosPrefetch; \ value = memory->biosPrefetch; \
@ -479,7 +479,7 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
case REGION_BIOS: case REGION_BIOS:
if (address < SIZE_BIOS) { if (address < SIZE_BIOS) {
if (memory->activeRegion == REGION_BIOS) { if (memory->activeRegion == REGION_BIOS) {
LOAD_16(value, address, memory->bios); LOAD_16(value, address & -2, memory->bios);
} else { } else {
mLOG(GBA_MEM, GAME_ERROR, "Bad BIOS Load16: 0x%08X", address); mLOG(GBA_MEM, GAME_ERROR, "Bad BIOS Load16: 0x%08X", address);
value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF; value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF;