Merge pull request #133 from jdgleaver/sega-cd-ram-cart

Fix MegaCD RAM cart saving
This commit is contained in:
Autechre 2020-10-06 20:21:27 +02:00 committed by GitHub
commit d1313fc553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 10 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@
tags
cscope.out
PicoDrive.map
*.map
config.mak
config.log
cpu/musashi/m68kmake

View File

@ -428,13 +428,13 @@ else ifeq ($(platform), emscripten)
# GCW0
else ifeq ($(platform), gcw0)
TARGET := $(TARGET_NAME)_libretro.so
CC = mipsel-linux-gcc
AR = mipsel-linux-ar
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
SHARED := -shared -nostdlib
fpic := -fPIC
LIBM :=
DONT_COMPILE_IN_ZLIB = 1
CFLAGS += -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
CFLAGS += -fomit-frame-pointer -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float
# Windows MSVC 2017 all architectures
else ifneq (,$(findstring windows_msvc2017,$(platform)))

View File

@ -78,9 +78,11 @@ static int get_ext(const char *fname, char ext[4],
strcpy(ext, fname + pos);
if (base != NULL) {
len = pos;
if (len + 1 < base_size)
len = base_size - 1;
if (pos + 1 < base_size)
pos = base_size - 1;
len = (pos < len) ? pos : len;
memcpy(base, fname, len);
base[len] = 0;
}

View File

@ -1203,7 +1203,9 @@ void *retro_get_memory_data(unsigned type)
switch(type)
{
case RETRO_MEMORY_SAVE_RAM:
if (PicoIn.AHW & PAHW_MCD)
/* Note: MCD RAM cart uses Pico.sv.data */
if ((PicoIn.AHW & PAHW_MCD) &&
!(PicoIn.opt & POPT_EN_MCD_RAMCART))
data = Pico_mcd->bram;
else
data = Pico.sv.data;
@ -1231,8 +1233,12 @@ size_t retro_get_memory_size(unsigned type)
{
case RETRO_MEMORY_SAVE_RAM:
if (PicoIn.AHW & PAHW_MCD)
// bram
return 0x2000;
{
if (PicoIn.opt & POPT_EN_MCD_RAMCART)
return 0x12000;
else /* bram */
return 0x2000;
}
if (Pico.m.frame_count == 0)
return Pico.sv.size;

View File

@ -87,7 +87,7 @@ struct retro_core_option_definition option_defs_us[] = {
{
"picodrive_ramcart",
"MegaCD RAM cart",
"Emulate a MegaCD RAM cart, used for save game data.",
"Emulate a MegaCD RAM cart, used for save game data. WARNING: When enabled, internal save data (BRAM) will be discarded.",
{
{ "disabled", NULL },
{ "enabled", NULL },