From 9e518fb27a9aa6c324fe4fd3ec66181471569450 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 30 Oct 2016 02:52:20 -0700 Subject: [PATCH] GBA Memory: Fix VCOUNT being writable --- CHANGES | 1 + src/gba/io.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index f22b44424..cbf3a8e65 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,7 @@ Bugfixes: - VFS: Fix resizing memory chunks when not needed - GB Memory: Fix patching ROM bank 0 - GB: Fix audio not being deinitialized + - GBA Memory: Fix VCOUNT being writable Misc: - PSP2: Improved controller rumble - GB, GBA: Prevent loading null ROMs diff --git a/src/gba/io.c b/src/gba/io.c index 9a1efd16d..efb64616c 100644 --- a/src/gba/io.c +++ b/src/gba/io.c @@ -336,7 +336,7 @@ void GBAIOInit(struct GBA* gba) { } void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) { - if (address < REG_SOUND1CNT_LO && address != REG_DISPSTAT) { + if (address < REG_SOUND1CNT_LO && (address > REG_VCOUNT || address == REG_DISPCNT)) { value = gba->video.renderer->writeVideoRegister(gba->video.renderer, address, value); } else { switch (address) { @@ -346,6 +346,10 @@ void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) { GBAVideoWriteDISPSTAT(&gba->video, value); return; + case REG_VCOUNT: + mLOG(GBA_IO, GAME_ERROR, "Write to read-only I/O register: %03X", address); + return; + // Audio case REG_SOUND1CNT_LO: GBAAudioWriteSOUND1CNT_LO(&gba->audio, value);