From 2d4fa02bbd47f4869f006c9ab35423b695e159fe Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Mon, 31 Jan 2022 21:29:46 -0500 Subject: [PATCH] Minor change to MMC5 mapper to only call memory init on WRAM if it exists. --- src/boards/mmc5.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/boards/mmc5.cpp b/src/boards/mmc5.cpp index ca641cd2..8015a12f 100644 --- a/src/boards/mmc5.cpp +++ b/src/boards/mmc5.cpp @@ -105,7 +105,7 @@ static uint8 *ExRAM = NULL; static uint8 MMC5battery = 0; const int MMC5WRAMMAX = 1<<7; // 7 bits in register interface (real MMC5 has only 4 pins, however) -static uint8 MMC5WRAMsize; //configuration, not state +static uint8 MMC5WRAMsize=0; //configuration, not state static uint8 MMC5WRAMIndex[MMC5WRAMMAX]; //configuration, not state static std::array MMC5ROMWrProtect; @@ -996,6 +996,7 @@ static SFORMAT MMC5_StateRegs[] = { static void GenMMC5_Init(CartInfo *info, int wsize, int battery) { if (wsize) { WRAM = (uint8*)FCEU_malloc(wsize * 1024); + FCEU_MemoryRand(WRAM, wsize * 1024); SetupCartPRGMapping(0x10, WRAM, wsize * 1024, 1); AddExState(WRAM, wsize * 1024, 0, "WRAM"); } @@ -1003,7 +1004,6 @@ static void GenMMC5_Init(CartInfo *info, int wsize, int battery) { MMC5fill = (uint8*)FCEU_malloc(1024); ExRAM = (uint8*)FCEU_malloc(1024); - FCEU_MemoryRand(WRAM, MMC5WRAMsize * 8 * 1024); FCEU_MemoryRand(MMC5fill,1024); FCEU_MemoryRand(ExRAM,1024);