GBA Memory: Fix STM/LDM to invalid VRAM

This commit is contained in:
Vicki Pfau 2019-07-03 10:19:05 -07:00
parent a50239be3b
commit 07c4613162
2 changed files with 10 additions and 9 deletions

View File

@ -5,6 +5,7 @@ Emulation fixes:
- GB Video: Increment BCPS/OCPS even in mode 3 (fixes mgba.io/i/1462)
- GB Audio: Deschedule channel 3 when disabled (fixes mgba.io/i/1463)
- GB Audio: Deschedule channel 1 when disabled by sweep (fixes mgba.io/i/1467)
- GBA Memory: Fix STM/LDM to invalid VRAM
Other fixes:
- Switch: Fix threading-related crash on second launch
- Qt: Fix FPS target maxing out at 59.727 (fixes mgba.io/i/1421)

View File

@ -394,9 +394,9 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
if ((address & (SIZE_VRAM | 0x00014000)) == SIZE_VRAM && (GBARegisterDISPCNTGetMode(gba->memory.io[REG_DISPCNT >> 1]) >= 3)) { \
mLOG(GBA_MEM, GAME_ERROR, "Bad VRAM Load32: 0x%08X", address); \
value = 0; \
break; \
} else { \
LOAD_32(value, address & 0x00017FFC, gba->video.vram); \
} \
LOAD_32(value, address & 0x00017FFC, gba->video.vram); \
} else { \
LOAD_32(value, address & 0x0001FFFC, gba->video.vram); \
} \
@ -735,13 +735,13 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) {
if ((address & 0x0001FFFF) >= SIZE_VRAM) { \
if ((address & (SIZE_VRAM | 0x00014000)) == SIZE_VRAM && (GBARegisterDISPCNTGetMode(gba->memory.io[REG_DISPCNT >> 1]) >= 3)) { \
mLOG(GBA_MEM, GAME_ERROR, "Bad VRAM Store32: 0x%08X", address); \
break; \
} \
LOAD_32(oldValue, address & 0x00017FFC, gba->video.vram); \
if (oldValue != value) { \
STORE_32(value, address & 0x00017FFC, gba->video.vram); \
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x00017FFC) + 2); \
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x00017FFC)); \
} else { \
LOAD_32(oldValue, address & 0x00017FFC, gba->video.vram); \
if (oldValue != value) { \
STORE_32(value, address & 0x00017FFC, gba->video.vram); \
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x00017FFC) + 2); \
gba->video.renderer->writeVRAM(gba->video.renderer, (address & 0x00017FFC)); \
} \
} \
} else { \
LOAD_32(oldValue, address & 0x0001FFFC, gba->video.vram); \