Merge pull request #351 from ds22x/master

Libretro: Add an option to remove left side border ( Sega Master System)
This commit is contained in:
ekeeke 2021-02-18 09:09:07 +01:00 committed by GitHub
commit bb8f3b3113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -621,6 +621,7 @@ static void config_default(void)
config.ntsc = 0; config.ntsc = 0;
config.lcd = 0; config.lcd = 0;
config.render = 0; config.render = 0;
config.left_border = 0;
/* input options */ /* input options */
input.system[0] = SYSTEM_GAMEPAD; input.system[0] = SYSTEM_GAMEPAD;
@ -906,6 +907,12 @@ static void update_overclock(void)
} }
#endif #endif
static void check_sms_border(void)
{
if (config.left_border && (bitmap.viewport.x == 0) && ((system_hw == SYSTEM_MARKIII) || (system_hw & SYSTEM_SMS) || (system_hw == SYSTEM_PBC)))
bitmap.viewport.x = -8;
}
static void check_variables(void) static void check_variables(void)
{ {
unsigned orig_value; unsigned orig_value;
@ -1385,6 +1392,18 @@ static void check_variables(void)
config.invert_mouse = 1; config.invert_mouse = 1;
} }
var.key = "genesis_plus_gx_left_border";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
orig_value = config.left_border;
if (!var.value || !strcmp(var.value, "disabled"))
config.left_border = 0;
else if (var.value && !strcmp(var.value, "enabled"))
config.left_border = 1;
if (orig_value != config.left_border)
update_viewports = true;
}
#ifdef HAVE_OVERCLOCK #ifdef HAVE_OVERCLOCK
var.key = "genesis_plus_gx_overclock"; var.key = "genesis_plus_gx_overclock";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var); environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
@ -1434,6 +1453,7 @@ static void check_variables(void)
bitmap.viewport.x = (config.overscan & 2) ? 14 : -48; bitmap.viewport.x = (config.overscan & 2) ? 14 : -48;
else else
bitmap.viewport.x = (config.overscan & 2) * 7; bitmap.viewport.x = (config.overscan & 2) * 7;
check_sms_border();
} }
} }
@ -1996,6 +2016,7 @@ void retro_set_environment(retro_environment_t cb)
{ "genesis_plus_gx_lcd_filter", "LCD Ghosting filter; disabled|enabled" }, { "genesis_plus_gx_lcd_filter", "LCD Ghosting filter; disabled|enabled" },
{ "genesis_plus_gx_overscan", "Borders; disabled|top/bottom|left/right|full" }, { "genesis_plus_gx_overscan", "Borders; disabled|top/bottom|left/right|full" },
{ "genesis_plus_gx_gg_extra", "Game Gear extended screen; disabled|enabled" }, { "genesis_plus_gx_gg_extra", "Game Gear extended screen; disabled|enabled" },
{ "genesis_plus_gx_left_border", "Hide Master System Left Border; disabled|enabled" },
{ "genesis_plus_gx_aspect_ratio", "Core-provided aspect ratio; auto|NTSC PAR|PAL PAR" }, { "genesis_plus_gx_aspect_ratio", "Core-provided aspect ratio; auto|NTSC PAR|PAL PAR" },
{ "genesis_plus_gx_render", "Interlaced mode 2 output; single field|double field" }, { "genesis_plus_gx_render", "Interlaced mode 2 output; single field|double field" },
{ "genesis_plus_gx_gun_cursor", "Show Lightgun crosshair; disabled|enabled" }, { "genesis_plus_gx_gun_cursor", "Show Lightgun crosshair; disabled|enabled" },
@ -2357,7 +2378,7 @@ bool retro_unserialize(const void *data, size_t size)
overclock_delay = OVERCLOCK_FRAME_DELAY; overclock_delay = OVERCLOCK_FRAME_DELAY;
update_overclock(); update_overclock();
#endif #endif
check_sms_border();
return TRUE; return TRUE;
} }
@ -2625,6 +2646,7 @@ bool retro_load_game(const struct retro_game_info *info)
audio_init(SOUND_FREQUENCY, 0); audio_init(SOUND_FREQUENCY, 0);
system_init(); system_init();
system_reset(); system_reset();
check_sms_border();
is_running = false; is_running = false;
if (system_hw == SYSTEM_MCD) if (system_hw == SYSTEM_MCD)

View File

@ -123,6 +123,7 @@ typedef struct
uint8 ntsc; uint8 ntsc;
uint8 lcd; uint8 lcd;
uint8 gg_extra; uint8 gg_extra;
uint8 left_border;
uint8 render; uint8 render;
t_input_config input[MAX_INPUTS]; t_input_config input[MAX_INPUTS];
uint8 invert_mouse; uint8 invert_mouse;