mirror of
https://github.com/libretro/beetle-wswan-libretro.git
synced 2024-11-23 07:59:40 +00:00
Add a force landscape option. (#72)
* Add a force landscape option. * Apply refactoring changes from jdgleaver. Code is now way cleaner.
This commit is contained in:
parent
663101e8ed
commit
9355f252d7
44
libretro.c
44
libretro.c
@ -57,8 +57,16 @@ static bool libretro_supports_bitmasks = false;
|
||||
static bool overscan;
|
||||
static double last_sound_rate;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DISPLAY_ROTATION_MANUAL = 0,
|
||||
DISPLAY_ROTATION_PORTRAIT,
|
||||
DISPLAY_ROTATION_LANDSCAPE
|
||||
} retro_display_rotation_t;
|
||||
|
||||
static retro_display_rotation_t retro_display_rotation = DISPLAY_ROTATION_MANUAL;
|
||||
|
||||
static bool rotate_tall = false;
|
||||
static bool rotate_tall_override = false;
|
||||
static bool select_pressed_last_frame = false;
|
||||
static bool hw_rotate_enabled = false;
|
||||
|
||||
@ -641,16 +649,34 @@ static void check_variables(int startup)
|
||||
var.key = "wswan_rotate_display",
|
||||
var.value = NULL;
|
||||
|
||||
rotate_tall_override = false;
|
||||
retro_display_rotation = DISPLAY_ROTATION_MANUAL;
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
if (!strcmp(var.value, "enabled"))
|
||||
rotate_tall_override = true;
|
||||
|
||||
if (rotate_tall_override && !rotate_tall)
|
||||
{
|
||||
rotate_tall = true;
|
||||
rotate_display();
|
||||
if (!strcmp(var.value, "portrait"))
|
||||
retro_display_rotation = DISPLAY_ROTATION_PORTRAIT;
|
||||
else if (!strcmp(var.value, "landscape"))
|
||||
retro_display_rotation = DISPLAY_ROTATION_LANDSCAPE;
|
||||
}
|
||||
|
||||
switch (retro_display_rotation)
|
||||
{
|
||||
case DISPLAY_ROTATION_PORTRAIT:
|
||||
if (!rotate_tall)
|
||||
{
|
||||
rotate_tall = true;
|
||||
rotate_display();
|
||||
}
|
||||
break;
|
||||
case DISPLAY_ROTATION_LANDSCAPE:
|
||||
if (rotate_tall)
|
||||
{
|
||||
rotate_tall = false;
|
||||
rotate_display();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
var.key = "wswan_rotate_keymap",
|
||||
@ -949,7 +975,7 @@ static void update_input(void)
|
||||
}
|
||||
|
||||
select_button = bitmask & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT);
|
||||
if (!rotate_tall_override &&
|
||||
if ((retro_display_rotation == DISPLAY_ROTATION_MANUAL) &&
|
||||
select_button &&
|
||||
!select_pressed_last_frame)
|
||||
{
|
||||
|
@ -51,12 +51,13 @@ extern "C" {
|
||||
struct retro_core_option_definition option_defs_us[] = {
|
||||
{
|
||||
"wswan_rotate_display",
|
||||
"Rotate Display",
|
||||
"Rotate the console screen to achieve the correct layout of 'portrait' oriented games on a conventional (landscape) display. 'Manual' enables rotation via the controller (default button: SELECT).",
|
||||
"Display Rotation",
|
||||
"Sets the orientation of the console screen. 'Portrait' can be used to achieve the correct layout of 'portrait' oriented games on a conventional (landscape) display. 'Manual' enables rotation via the controller (default button: SELECT).",
|
||||
{
|
||||
{ "manual", "Manual" },
|
||||
{ "enabled", NULL },
|
||||
{ NULL, NULL},
|
||||
{ "manual", "Manual" },
|
||||
{ "portrait", "Portrait" },
|
||||
{ "landscape", "Landscape" },
|
||||
{ NULL, NULL },
|
||||
},
|
||||
"manual",
|
||||
},
|
||||
|
@ -93,4 +93,4 @@ struct retro_core_option_definition option_defs_tr[] = {
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user