From 9c69b86d71f0ceaffc488a636c8480e89f4d315a Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 16 Jan 2023 00:09:35 -0800 Subject: [PATCH] GBA Memory: Make VRAM access stalls only apply to BG RAM --- CHANGES | 4 ++++ src/gba/memory.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index c5c54e2fd..ec1e9eab4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +0.10.2: (Future) +Emulation fixes: + - GBA Memory: Make VRAM access stalls only apply to BG RAM + 0.10.1: (2023-01-10) Emulation fixes: - GB Audio: Fix channels 1/2 not playing when resetting volume (fixes mgba.io/i/2614) diff --git a/src/gba/memory.c b/src/gba/memory.c index c9a1f59dd..ba862afb9 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -397,7 +397,7 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) { LOAD_32(value, address & 0x0001FFFC, gba->video.vram); \ } \ ++wait; \ - if (gba->video.shouldStall) { \ + if (gba->video.shouldStall && (address & 0x0001FFFF) < ((GBARegisterDISPCNTGetMode(gba->memory.io[REG_DISPCNT >> 1]) >= 3) ? 0x00014000 : 0x00010000)) { \ wait += GBAMemoryStallVRAM(gba, wait, 1); \ } @@ -557,7 +557,7 @@ uint32_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) { } else { LOAD_16(value, address & 0x0001FFFE, gba->video.vram); } - if (gba->video.shouldStall) { + if (gba->video.shouldStall && (address & 0x0001FFFF) < ((GBARegisterDISPCNTGetMode(gba->memory.io[REG_DISPCNT >> 1]) >= 3) ? 0x00014000 : 0x00010000)) { wait += GBAMemoryStallVRAM(gba, wait, 0); } break; @@ -777,7 +777,7 @@ uint32_t GBALoad8(struct ARMCore* cpu, uint32_t address, int* cycleCounter) { } \ } \ ++wait; \ - if (gba->video.shouldStall) { \ + if (gba->video.shouldStall && (address & 0x0001FFFF) < ((GBARegisterDISPCNTGetMode(gba->memory.io[REG_DISPCNT >> 1]) >= 3) ? 0x00014000 : 0x00010000)) { \ wait += GBAMemoryStallVRAM(gba, wait, 1); \ } @@ -904,7 +904,7 @@ void GBAStore16(struct ARMCore* cpu, uint32_t address, int16_t value, int* cycle gba->video.renderer->writeVRAM(gba->video.renderer, address & 0x0001FFFE); } } - if (gba->video.shouldStall) { + if (gba->video.shouldStall && (address & 0x0001FFFF) < ((GBARegisterDISPCNTGetMode(gba->memory.io[REG_DISPCNT >> 1]) >= 3) ? 0x00014000 : 0x00010000)) { wait += GBAMemoryStallVRAM(gba, wait, 0); } break;