From 03d1482b296b3808dc201078480e41fa29939e67 Mon Sep 17 00:00:00 2001 From: ds22x Date: Wed, 17 Feb 2021 17:02:36 +0100 Subject: [PATCH] Add an option to remove left side border ( Sega Master System) --- core/vdp_ctrl.c | 6 ++++++ libretro/libretro.c | 16 ++++++++++++++++ libretro/osd.h | 1 + 3 files changed, 23 insertions(+) diff --git a/core/vdp_ctrl.c b/core/vdp_ctrl.c index cc40063..be0f02c 100644 --- a/core/vdp_ctrl.c +++ b/core/vdp_ctrl.c @@ -330,6 +330,12 @@ void vdp_reset(void) bitmap.viewport.x = (config.overscan & 2) ? 14 : -48; bitmap.viewport.y = (config.overscan & 1) ? (24 * (vdp_pal + 1)) : -24; } + else if ((system_hw == SYSTEM_SMS || system_hw == SYSTEM_SMS2) && config.left_border) + { + /* Horizontal display area reduced to 240 when hiding the left border */ + bitmap.viewport.x = (config.overscan & 2) ? 7 : -8; + bitmap.viewport.y = (config.overscan & 1) * 24 * (vdp_pal + 1); + } else { bitmap.viewport.x = (config.overscan & 2) * 7; diff --git a/libretro/libretro.c b/libretro/libretro.c index 902b149..3908260 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -621,6 +621,7 @@ static void config_default(void) config.ntsc = 0; config.lcd = 0; config.render = 0; + config.left_border = 0; /* input options */ input.system[0] = SYSTEM_GAMEPAD; @@ -1384,6 +1385,18 @@ static void check_variables(void) else 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 var.key = "genesis_plus_gx_overclock"; @@ -1432,6 +1445,8 @@ static void check_variables(void) bitmap.viewport.changed = 11; if ((system_hw == SYSTEM_GG) && !config.gg_extra) bitmap.viewport.x = (config.overscan & 2) ? 14 : -48; + else if ((system_hw == SYSTEM_SMS || system_hw == SYSTEM_SMS2) && config.left_border) + bitmap.viewport.x = (config.overscan & 2) ? 7 : -8; else bitmap.viewport.x = (config.overscan & 2) * 7; } @@ -1996,6 +2011,7 @@ void retro_set_environment(retro_environment_t cb) { "genesis_plus_gx_lcd_filter", "LCD Ghosting filter; disabled|enabled" }, { "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_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_render", "Interlaced mode 2 output; single field|double field" }, { "genesis_plus_gx_gun_cursor", "Show Lightgun crosshair; disabled|enabled" }, diff --git a/libretro/osd.h b/libretro/osd.h index 1ba4f61..8f83c83 100644 --- a/libretro/osd.h +++ b/libretro/osd.h @@ -123,6 +123,7 @@ typedef struct uint8 ntsc; uint8 lcd; uint8 gg_extra; + uint8 left_border; uint8 render; t_input_config input[MAX_INPUTS]; uint8 invert_mouse;