mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-27 02:50:32 +00:00
Added an option to hide the SGB border when playing GameBoy games, as well as using the GameBoy's 10:9 aspect ratio for the 'Auto' and 'Pixel Perfect' (previously '8:9') core aspect ratio option when the border option is enabled
This commit is contained in:
parent
007a042a11
commit
7468ca11c4
@ -51,12 +51,17 @@ static double get_aspect_ratio()
|
||||
{
|
||||
double ratio;
|
||||
|
||||
if (aspect_ratio_mode == 0 && program->superFamicom.region == "NTSC")
|
||||
if (aspect_ratio_mode == 0 && program->gameBoy.program && sgb_border_disabled == true)
|
||||
ratio = 10.0/9.0;
|
||||
else if (aspect_ratio_mode == 0 && program->superFamicom.region == "NTSC")
|
||||
ratio = 1.306122;
|
||||
else if (aspect_ratio_mode == 0 && program->superFamicom.region == "PAL")
|
||||
ratio = 1.584216;
|
||||
else if (aspect_ratio_mode == 1) // 8:7
|
||||
ratio = 8.0/7.0;
|
||||
else if (aspect_ratio_mode == 1) // 8:7 or 10:9 depending on whenever the SGB border is shown
|
||||
if (program->gameBoy.program && sgb_border_disabled == true)
|
||||
ratio = 10.0/9.0;
|
||||
else
|
||||
ratio = 8.0/7.0;
|
||||
else if (aspect_ratio_mode == 2) // 4:3
|
||||
return 4.0/3.0;
|
||||
else if (aspect_ratio_mode == 3) // NTSC
|
||||
@ -368,6 +373,18 @@ static void update_variables(void)
|
||||
retro_pointer_superscope_reverse_buttons = false;
|
||||
|
||||
}
|
||||
|
||||
var.key = "bsnes_hide_sgb_border";
|
||||
var.value = NULL;
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
||||
{
|
||||
if (strcmp(var.value, "ON") == 0)
|
||||
sgb_border_disabled = true;
|
||||
else if (strcmp(var.value, "OFF") == 0)
|
||||
sgb_border_disabled = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void update_geometry(void)
|
||||
|
@ -55,7 +55,7 @@ struct retro_core_option_definition option_defs_us[] = {
|
||||
"Choose the preferred content aspect ratio. This will only apply when RetroArch's aspect ratio is set to 'Core provided' in the Video settings.",
|
||||
{
|
||||
{ "Auto", NULL },
|
||||
{ "8:7", NULL },
|
||||
{ "8:7", "Pixel Perfect" },
|
||||
{ "4:3", NULL },
|
||||
{ "NTSC", NULL },
|
||||
{ "PAL", NULL },
|
||||
@ -502,6 +502,17 @@ struct retro_core_option_definition option_defs_us[] = {
|
||||
},
|
||||
"OFF"
|
||||
},
|
||||
{
|
||||
"bsnes_hide_sgb_border",
|
||||
"Hide SGB Border",
|
||||
"Allows hiding the border when playing Super GameBoy games.",
|
||||
{
|
||||
{ "ON", "enabled" },
|
||||
{ "OFF", "disabled" },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"OFF"
|
||||
},
|
||||
|
||||
{ NULL, NULL, NULL, {{0}}, NULL },
|
||||
};
|
||||
|
@ -24,6 +24,8 @@ using namespace nall;
|
||||
|
||||
static Emulator::Interface *emulator;
|
||||
|
||||
static bool sgb_border_disabled = false;
|
||||
|
||||
// Touchscreen Lightgun Support
|
||||
static const int POINTER_PRESSED_CYCLES = 4; // For touchscreen sensitivity
|
||||
struct retro_pointer_state
|
||||
@ -385,7 +387,14 @@ auto Program::videoFrame(const uint16* data, uint pitch, uint width, uint height
|
||||
if (!overscan)
|
||||
{
|
||||
uint multiplier = height / 240;
|
||||
data += 8 * (pitch >> 1) * multiplier;
|
||||
if ((sgb_border_disabled) && (program->gameBoy.program))
|
||||
{
|
||||
data += 47 * (pitch >> 1) * multiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
data += 8 * (pitch >> 1) * multiplier;
|
||||
}
|
||||
if (program->gameBoy.program)
|
||||
{
|
||||
height -= 16.1 * multiplier;
|
||||
@ -395,7 +404,14 @@ auto Program::videoFrame(const uint16* data, uint pitch, uint width, uint height
|
||||
height -= 16 * multiplier;
|
||||
}
|
||||
}
|
||||
video_cb(data, width, height, pitch);
|
||||
if ((!overscan) & (sgb_border_disabled) && (program->gameBoy.program))
|
||||
{
|
||||
video_cb(data + 48, width - 96, height - 79, pitch);
|
||||
}
|
||||
else
|
||||
{
|
||||
video_cb(data, width, height, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
// Double the fun!
|
||||
|
Loading…
Reference in New Issue
Block a user