diff --git a/libretro/libretro.c b/libretro/libretro.c index 9365397c5..7f7989709 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -938,6 +938,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; @@ -1190,6 +1191,11 @@ static bool update_viewport(void) else vwidth = SMS_NTSC_OUT_WIDTH(vwidth); } + + if ((system_hw == SYSTEM_SMS || system_hw == SYSTEM_SMS2) && config.left_border) + { + bitmap.viewport.x = (config.overscan & 2) ? 7 : -8; + } if (config.render && interlaced) { @@ -1763,6 +1769,18 @@ static void check_variables(bool first_run) 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"; environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var); @@ -1889,9 +1907,17 @@ static void check_variables(bool first_run) { 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; + { + bitmap.viewport.x = (config.overscan & 2) * 7 ; + } } /* Reinitialise frameskipping, if required */ @@ -2354,6 +2380,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" }, @@ -3219,4 +3246,4 @@ void retro_run(void) audio_cb(soundbuffer, audio_update(soundbuffer)); } -#undef CHUNKSIZE +#undef CHUNKSIZE \ No newline at end of file diff --git a/libretro/libretro_core_options.h b/libretro/libretro_core_options.h index 6ead8814d..3bbfa9083 100644 --- a/libretro/libretro_core_options.h +++ b/libretro/libretro_core_options.h @@ -506,6 +506,17 @@ struct retro_core_option_definition option_defs_us[] = { }, "disabled" }, + { + "genesis_plus_gx_left_border", + "Hide Master System Left Border", + "Cuts off 8 pixels from both the left and right side of the screen when running Master System games, thereby hiding the border seen on the left side of the screen", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "disabled" + }, { "genesis_plus_gx_aspect_ratio", "Core-Provided Aspect Ratio", diff --git a/libretro/osd.h b/libretro/osd.h index 2adca827e..5df2e908e 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;