[libretro] Port Backup Ram Cart changes from downstream (#498)

This commit is contained in:
ichee 2023-03-28 07:36:08 -04:00 committed by GitHub
parent 42f0944c50
commit aed9e6c5a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 3 deletions

View File

@ -1261,7 +1261,7 @@ static void check_variables(bool first_run)
bool update_frameskip = false;
struct retro_variable var = {0};
var.key = "genesis_plus_gx_bram";
var.key = "genesis_plus_gx_system_bram";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
#if defined(_WIN32)
@ -1284,6 +1284,25 @@ static void check_variables(bool first_run)
}
}
var.key = "genesis_plus_gx_cart_bram";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
#if defined(_WIN32)
char slash = '\\';
#else
char slash = '/';
#endif
if (!var.value || !strcmp(var.value, "per cart"))
{
snprintf(CART_BRAM, sizeof(CART_BRAM), "%s%ccart.brm", save_dir, slash);
}
else
{
snprintf(CART_BRAM, sizeof(CART_BRAM), "%s%c%s_cart.brm", save_dir, slash, g_rom_name);
}
}
var.key = "genesis_plus_gx_system_hw";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
@ -3182,7 +3201,6 @@ bool retro_load_game(const struct retro_game_info *info)
snprintf(CD_BIOS_EU, sizeof(CD_BIOS_EU), "%s%cbios_CD_E.bin", dir, slash);
snprintf(CD_BIOS_US, sizeof(CD_BIOS_US), "%s%cbios_CD_U.bin", dir, slash);
snprintf(CD_BIOS_JP, sizeof(CD_BIOS_JP), "%s%cbios_CD_J.bin", dir, slash);
snprintf(CART_BRAM, sizeof(CART_BRAM), "%s%ccart.brm", save_dir, slash);
check_variables(true);

View File

@ -146,7 +146,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
"disabled"
},
{
"genesis_plus_gx_bram",
"genesis_plus_gx_system_bram",
"CD System BRAM",
NULL,
"When running Sega CD content, specifies whether to share a single save file between all games from a specific region (Per-BIOS) or to create a separate save file for each game (Per-Game). Note that the Sega CD has limited internal storage, sufficient only for a handful of titles. To avoid running out of space, the 'Per-Game' setting is recommended.",
@ -159,6 +159,20 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"per bios"
},
{
"genesis_plus_gx_cart_bram",
"CD Backup Cart BRAM",
NULL,
"When running Sega CD content, specifies whether to share a single backup ram cart for all games (Per-Cart) or to create a separate backup ram cart for each game (Per-Game).",
NULL,
"system",
{
{ "per cart", "Per-Cart" },
{ "per game", "Per-Game" },
{ NULL, NULL },
},
"per cart"
},
{
"genesis_plus_gx_add_on",
"CD add-on (MD mode) (Requires Restart)",