From 32b7cc2fba9526ca64e561b433d8c7df13f5f066 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 24 Mar 2021 18:59:56 -0700 Subject: [PATCH] GB MBC: Force minimum SRAM size on rare MBCs that always have SRAM --- CHANGES | 1 + src/gb/mbc.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES b/CHANGES index 330f9d992..3bdeb0ed6 100644 --- a/CHANGES +++ b/CHANGES @@ -85,6 +85,7 @@ Other fixes: - FFmpeg: Fix encoding of time base - GB: Fix crash when changing ROM while in banked address space - GB: Fix loading model overrides + - GB MBC: Force minimum SRAM size on rare MBCs that always have SRAM - GB Serialize: Fix crash when loading pre-0.7 SGB savestates - GB Video: Fix SGB video logs - GB Video: Discard SGB packets in non-SGB mVLs diff --git a/src/gb/mbc.c b/src/gb/mbc.c index 53d577452..3cb9a1a5d 100644 --- a/src/gb/mbc.c +++ b/src/gb/mbc.c @@ -353,6 +353,9 @@ void GBMBCInit(struct GB* gb) { gb->memory.mbcWrite = _GBMBC6; gb->memory.mbcRead = _GBMBC6Read; gb->memory.directSramAccess = false; + if (!gb->sramSize) { + gb->sramSize = GB_SIZE_EXTERNAL_RAM; // Force minimum size for convenience + } gb->sramSize += GB_SIZE_MBC6_FLASH; // Flash is concatenated at the end break; case GB_MBC7: @@ -386,6 +389,9 @@ void GBMBCInit(struct GB* gb) { case GB_POCKETCAM: gb->memory.mbcWrite = _GBPocketCam; gb->memory.mbcRead = _GBPocketCamRead; + if (!gb->sramSize) { + gb->sramSize = GB_SIZE_EXTERNAL_RAM; // Force minimum size for convenience + } if (gb->memory.cam && gb->memory.cam->startRequestImage) { gb->memory.cam->startRequestImage(gb->memory.cam, GBCAM_WIDTH, GBCAM_HEIGHT, mCOLOR_ANY); }