From: kub Date: Tue, 4 Feb 2025 20:52:57 +0000 (+0100) Subject: libretro, fix cart sram handling for MSU/MD+ cartridges X-Git-Tag: v2.04~63 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe90daf24050787f8b81154065bafde959cdb989;p=picodrive.git libretro, fix cart sram handling for MSU/MD+ cartridges --- diff --git a/pico/media.c b/pico/media.c index ff7a338a..e0c25b24 100644 --- a/pico/media.c +++ b/pico/media.c @@ -412,12 +412,6 @@ enum media_type_e PicoLoadMedia(const char *filename, lprintf("detected SMS ROM\n"); } - if (PicoCartInsert(rom_data, rom_size, carthw_cfg_fname)) { - media_type = PM_ERROR; - goto out; - } - rom_data = NULL; // now belongs to PicoCart - // insert CD if it was detected Pico.m.ncart_in = 0; if (cd_img_type != CT_UNKNOWN) { @@ -431,6 +425,12 @@ enum media_type_e PicoLoadMedia(const char *filename, Pico.m.ncart_in = 1; } + if (PicoCartInsert(rom_data, rom_size, carthw_cfg_fname)) { + media_type = PM_ERROR; + goto out; + } + rom_data = NULL; // now belongs to PicoCart + if (PicoIn.quirks & PQUIRK_FORCE_6BTN) PicoSetInputDevice(0, PICO_INPUT_PAD_6BTN); diff --git a/platform/libretro/libretro.c b/platform/libretro/libretro.c index 1fafa0bc..82fae8a9 100644 --- a/platform/libretro/libretro.c +++ b/platform/libretro/libretro.c @@ -1714,9 +1714,9 @@ size_t retro_get_memory_size(unsigned type) switch(type) { case RETRO_MEMORY_SAVE_RAM: - if (PicoIn.AHW & PAHW_MCD) + if ((PicoIn.AHW & PAHW_MCD) && Pico.romsize == 0) { - if (Pico.romsize == 0 && PicoIn.opt & POPT_EN_MCD_RAMCART) + if (PicoIn.opt & POPT_EN_MCD_RAMCART) return 0x12000; else /* bram */ return 0x2000;