Skip to content

Commit

Permalink
Merge pull request ekeeke#231 from ds22x/master
Browse files Browse the repository at this point in the history
Add an option to remove left side border ( Sega Master System)
  • Loading branch information
inactive123 authored Jan 19, 2021
2 parents 880ce97 + ed441bf commit e4151a2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
31 changes: 29 additions & 2 deletions libretro/libretro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -3219,4 +3246,4 @@ void retro_run(void)
audio_cb(soundbuffer, audio_update(soundbuffer));
}

#undef CHUNKSIZE
#undef CHUNKSIZE
11 changes: 11 additions & 0 deletions libretro/libretro_core_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions libretro/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e4151a2

Please sign in to comment.