all repos — mgba @ a00a02b8c4ea640bee8ec14d59b229dace7bce90

mGBA Game Boy Advance Emulator

GBA Memory: Fix STM/LDM to invalid VRAM
Vicki Pfau vi@endrift.com
Wed, 03 Jul 2019 10:19:05 -0700
commit

a00a02b8c4ea640bee8ec14d59b229dace7bce90

parent

77ec5e6e91dec006cc9975315a04c5be40f4782b

2 files changed, 10 insertions(+), 9 deletions(-)

jump to
M CHANGESCHANGES

@@ -31,6 +31,7 @@ - GB Audio: Sample inactive channels (fixes mgba.io/i/1455, mgba.io/i/1456)

- 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: - Qt: Fix some Qt display driver race conditions - Core: Improved lockstep driver reliability (Le Hoang Quyen)
M src/gba/memory.csrc/gba/memory.c

@@ -394,9 +394,9 @@ 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 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 @@ #define STORE_VRAM \

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); \