From f86a9afc772f7b1f6705ca1a6e74fd1a536691d7 Mon Sep 17 00:00:00 2001 From: ekeeke Date: Sun, 12 Jul 2020 16:48:53 +0200 Subject: [PATCH] [Core/CD] fixed loading issue when backup RAM cart is filled with non-zero data --- core/cd_hw/cd_cart.h | 3 ++- core/genesis.c | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/cd_hw/cd_cart.h b/core/cd_hw/cd_cart.h index 8a21ba23..6ee7cad2 100644 --- a/core/cd_hw/cd_cart.h +++ b/core/cd_hw/cd_cart.h @@ -40,7 +40,8 @@ /* CD compatible ROM/RAM cartridge */ typedef struct { - uint8 area[0x840080]; /* cartridge ROM/RAM area (max. 8MB ROM + 64KB backup memory + Pro Action Replay 128KB ROM / 64KB RAM + cartridge infos) */ + uint8 reserved[0x80]; /* reserved for ROM cartridge infos (see md_cart.h) */ + uint8 area[0x840000]; /* cartridge ROM/RAM area (max. 8MB ROM + 64KB backup memory + Pro Action Replay 128KB ROM / 64KB RAM) */ uint8 boot; /* cartridge boot mode (0x00: boot from CD with ROM/RAM cartridge enabled, 0x40: boot from ROM cartridge with CD enabled) */ uint8 id; /* RAM cartridge ID (related to RAM size, 0 if disabled) */ uint8 prot; /* RAM cartridge write protection */ diff --git a/core/genesis.c b/core/genesis.c index 1d5d2726..2a069e7e 100644 --- a/core/genesis.c +++ b/core/genesis.c @@ -279,10 +279,18 @@ void gen_reset(int hard_reset) /* reset CD hardware */ scd_reset(1); } + + /* reset MD cartridge hardware (only when booting from cartridge) */ + if (scd.cartridge.boot) + { + md_cart_reset(hard_reset); + } + } + else + { + /* reset MD cartridge hardware */ + md_cart_reset(hard_reset); } - - /* reset MD cartridge hardware */ - md_cart_reset(hard_reset); /* Z80 bus is released & Z80 is reseted */ m68k.memory_map[0xa0].read8 = m68k_read_bus_8;