mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
(RGUI) Overhaul 'Lock Menu Aspect Ratio' option
This commit is contained in:
parent
7b9fcfd280
commit
f114e14d48
@ -385,10 +385,10 @@ static bool show_advanced_settings = false;
|
||||
|
||||
static unsigned rgui_color_theme = RGUI_THEME_CLASSIC_GREEN;
|
||||
static unsigned rgui_thumbnail_downscaler = RGUI_THUMB_SCALE_POINT;
|
||||
static bool rgui_lock_aspect = false;
|
||||
static unsigned rgui_internal_upscale_level = RGUI_UPSCALE_NONE;
|
||||
static bool rgui_full_width_layout = true;
|
||||
static unsigned rgui_aspect = RGUI_ASPECT_RATIO_4_3;
|
||||
static unsigned rgui_aspect_lock = RGUI_ASPECT_RATIO_LOCK_NONE;
|
||||
|
||||
#else
|
||||
static bool default_block_config_read = false;
|
||||
|
@ -1509,7 +1509,6 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("rgui_background_filler_thickness_enable", &settings->bools.menu_rgui_background_filler_thickness_enable, true, true, false);
|
||||
SETTING_BOOL("rgui_border_filler_thickness_enable", &settings->bools.menu_rgui_border_filler_thickness_enable, true, true, false);
|
||||
SETTING_BOOL("rgui_border_filler_enable", &settings->bools.menu_rgui_border_filler_enable, true, true, false);
|
||||
SETTING_BOOL("menu_rgui_lock_aspect", &settings->bools.menu_rgui_lock_aspect, true, rgui_lock_aspect, false);
|
||||
SETTING_BOOL("menu_rgui_full_width_layout", &settings->bools.menu_rgui_full_width_layout, true, rgui_full_width_layout, false);
|
||||
#endif
|
||||
#ifdef HAVE_XMB
|
||||
@ -1695,6 +1694,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
|
||||
SETTING_UINT("rgui_thumbnail_downscaler", &settings->uints.menu_rgui_thumbnail_downscaler, true, rgui_thumbnail_downscaler, false);
|
||||
SETTING_UINT("rgui_internal_upscale_level", &settings->uints.menu_rgui_internal_upscale_level, true, rgui_internal_upscale_level, false);
|
||||
SETTING_UINT("rgui_aspect_ratio", &settings->uints.menu_rgui_aspect_ratio, true, rgui_aspect, false);
|
||||
SETTING_UINT("rgui_aspect_ratio_lock", &settings->uints.menu_rgui_aspect_ratio_lock, true, rgui_aspect_lock, false);
|
||||
#endif
|
||||
#ifdef HAVE_LIBNX
|
||||
SETTING_UINT("split_joycon_p1", &settings->uints.input_split_joycon[0], true, 0, false);
|
||||
|
@ -171,7 +171,6 @@ typedef struct settings
|
||||
bool menu_rgui_background_filler_thickness_enable;
|
||||
bool menu_rgui_border_filler_thickness_enable;
|
||||
bool menu_rgui_border_filler_enable;
|
||||
bool menu_rgui_lock_aspect;
|
||||
bool menu_rgui_full_width_layout;
|
||||
bool menu_xmb_shadows_enable;
|
||||
bool menu_xmb_vertical_thumbnails;
|
||||
@ -444,6 +443,7 @@ typedef struct settings
|
||||
unsigned menu_font_color_blue;
|
||||
unsigned menu_rgui_internal_upscale_level;
|
||||
unsigned menu_rgui_aspect_ratio;
|
||||
unsigned menu_rgui_aspect_ratio_lock;
|
||||
unsigned menu_ticker_type;
|
||||
|
||||
unsigned playlist_show_inline_core_name;
|
||||
|
@ -1605,12 +1605,12 @@ MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE,
|
||||
"menu_rgui_border_filler_thickness_enable")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE,
|
||||
"menu_rgui_background_filler_thickness_enable")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT,
|
||||
"menu_rgui_lock_aspect")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_INTERNAL_UPSCALE_LEVEL,
|
||||
"rgui_internal_upscale_level")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO,
|
||||
"rgui_aspect_ratio")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||
"rgui_aspect_ratio_lock")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_FULL_WIDTH_LAYOUT,
|
||||
"menu_rgui_full_width_layout")
|
||||
MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_REWIND,
|
||||
|
@ -3042,6 +3042,18 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10_CENTRE,
|
||||
"16:10 (Centered)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_NONE,
|
||||
"OFF"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_FIT_SCREEN,
|
||||
"Fit Screen"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_INTEGER,
|
||||
"Integer Scale"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY,
|
||||
"Thumbnails"
|
||||
@ -6813,11 +6825,11 @@ MSG_HASH(
|
||||
"Increase coarseness of menu background chequerboard pattern."
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MENU_RGUI_LOCK_ASPECT,
|
||||
MENU_ENUM_LABEL_VALUE_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||
"Lock Menu Aspect Ratio"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_MENU_RGUI_LOCK_ASPECT,
|
||||
MENU_ENUM_SUBLABEL_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||
"Ensures that the menu is always displayed with the correct aspect ratio. If disabled, the quick menu will be stretched to match the currently loaded content."
|
||||
)
|
||||
MSG_HASH(
|
||||
|
@ -520,7 +520,7 @@ default_sublabel_macro(action_bind_sublabel_menu_rgui_border_filler_enable,
|
||||
default_sublabel_macro(action_bind_sublabel_menu_rgui_border_filler_thickness_enable, MENU_ENUM_SUBLABEL_MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_rgui_background_filler_thickness_enable, MENU_ENUM_SUBLABEL_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_linear_filter, MENU_ENUM_SUBLABEL_MENU_LINEAR_FILTER)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_rgui_lock_aspect, MENU_ENUM_SUBLABEL_MENU_RGUI_LOCK_ASPECT)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_rgui_aspect_ratio_lock, MENU_ENUM_SUBLABEL_MENU_RGUI_ASPECT_RATIO_LOCK)
|
||||
default_sublabel_macro(action_bind_sublabel_rgui_menu_color_theme, MENU_ENUM_SUBLABEL_RGUI_MENU_COLOR_THEME)
|
||||
default_sublabel_macro(action_bind_sublabel_rgui_menu_theme_preset, MENU_ENUM_SUBLABEL_RGUI_MENU_THEME_PRESET)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_rgui_thumbnail_downscaler, MENU_ENUM_SUBLABEL_MENU_RGUI_THUMBNAIL_DOWNSCALER)
|
||||
@ -2387,8 +2387,8 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_MENU_LINEAR_FILTER:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_linear_filter);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_lock_aspect);
|
||||
case MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO_LOCK:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_aspect_ratio_lock);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_RGUI_MENU_COLOR_THEME:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_rgui_menu_color_theme);
|
||||
|
@ -427,6 +427,12 @@ typedef struct
|
||||
uint16_t border_light_color;
|
||||
} rgui_colors_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned aspect_ratio_idx;
|
||||
video_viewport_t viewport;
|
||||
} rgui_video_settings_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool bg_modified;
|
||||
@ -450,8 +456,9 @@ typedef struct
|
||||
char menu_title[255]; /* Must be a fixed length array... */
|
||||
char menu_sublabel[255]; /* Must be a fixed length array... */
|
||||
unsigned menu_aspect_ratio;
|
||||
unsigned menu_aspect_ratio_idx;
|
||||
unsigned content_aspect_ratio_idx;
|
||||
unsigned menu_aspect_ratio_lock;
|
||||
rgui_video_settings_t menu_video_settings;
|
||||
rgui_video_settings_t content_video_settings;
|
||||
struct scaler_ctx image_scaler;
|
||||
} rgui_t;
|
||||
|
||||
@ -1912,6 +1919,127 @@ static void rgui_wallpaper_free(void)
|
||||
wallpaper.data = NULL;
|
||||
}
|
||||
|
||||
bool rgui_is_video_config_equal(rgui_video_settings_t *config_a, rgui_video_settings_t *config_b)
|
||||
{
|
||||
return (config_a->aspect_ratio_idx == config_b->aspect_ratio_idx) &&
|
||||
(config_a->viewport.width == config_b->viewport.width) &&
|
||||
(config_a->viewport.height == config_b->viewport.height) &&
|
||||
(config_a->viewport.x == config_b->viewport.x) &&
|
||||
(config_a->viewport.y == config_b->viewport.y);
|
||||
}
|
||||
|
||||
static void rgui_get_video_config(rgui_video_settings_t *video_settings)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
/* Could use settings->video_viewport_custom directly,
|
||||
* but this seems to be the standard way of doing it... */
|
||||
video_viewport_t *custom_vp = video_viewport_get_custom();
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
video_settings->aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
||||
video_settings->viewport.width = custom_vp->width;
|
||||
video_settings->viewport.height = custom_vp->height;
|
||||
video_settings->viewport.x = custom_vp->x;
|
||||
video_settings->viewport.y = custom_vp->y;
|
||||
}
|
||||
|
||||
static void rgui_set_video_config(rgui_video_settings_t *video_settings)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
/* Could use settings->video_viewport_custom directly,
|
||||
* but this seems to be the standard way of doing it... */
|
||||
video_viewport_t *custom_vp = video_viewport_get_custom();
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
settings->uints.video_aspect_ratio_idx = video_settings->aspect_ratio_idx;
|
||||
custom_vp->width = video_settings->viewport.width;
|
||||
custom_vp->height = video_settings->viewport.height;
|
||||
custom_vp->x = video_settings->viewport.x;
|
||||
custom_vp->y = video_settings->viewport.y;
|
||||
|
||||
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
||||
(float)custom_vp->width / custom_vp->height;
|
||||
|
||||
video_driver_set_aspect_ratio();
|
||||
}
|
||||
|
||||
/* Note: This function is only called when aspect ratio
|
||||
* lock is enabled */
|
||||
static void rgui_update_menu_viewport(rgui_t *rgui)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
size_t fb_pitch;
|
||||
unsigned fb_width, fb_height;
|
||||
struct video_viewport vp;
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
menu_display_get_fb_size(&fb_width, &fb_height, &fb_pitch);
|
||||
video_driver_get_viewport_info(&vp);
|
||||
|
||||
/* Could do this once in rgui_init(), but seems cleaner to
|
||||
* handle all video config in one place... */
|
||||
rgui->menu_video_settings.aspect_ratio_idx = ASPECT_RATIO_CUSTOM;
|
||||
|
||||
/* Determine custom viewport layout */
|
||||
if (fb_width > 0 && fb_height > 0 && vp.full_width > 0 && vp.full_height > 0)
|
||||
{
|
||||
/* Check whether we need to perform integer scaling */
|
||||
bool do_integer_scaling = (settings->uints.menu_rgui_aspect_ratio_lock == RGUI_ASPECT_RATIO_LOCK_INTEGER);
|
||||
|
||||
if (do_integer_scaling)
|
||||
{
|
||||
unsigned width_scale = (vp.full_width / fb_width);
|
||||
unsigned height_scale = (vp.full_height / fb_height);
|
||||
unsigned scale = (width_scale <= height_scale) ? width_scale : height_scale;
|
||||
|
||||
if (scale > 0)
|
||||
{
|
||||
rgui->menu_video_settings.viewport.width = scale * fb_width;
|
||||
rgui->menu_video_settings.viewport.height = scale * fb_height;
|
||||
}
|
||||
else
|
||||
do_integer_scaling = false;
|
||||
}
|
||||
|
||||
if (!do_integer_scaling)
|
||||
{
|
||||
float display_aspect_ratio = (float)vp.full_width / (float)vp.full_height;
|
||||
float aspect_ratio = (float)fb_width / (float)fb_height;
|
||||
|
||||
if (aspect_ratio > display_aspect_ratio)
|
||||
{
|
||||
rgui->menu_video_settings.viewport.width = vp.full_width;
|
||||
rgui->menu_video_settings.viewport.height = fb_height * vp.full_width / fb_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
rgui->menu_video_settings.viewport.height = vp.full_height;
|
||||
rgui->menu_video_settings.viewport.width = fb_width * vp.full_height / fb_height;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sanity check */
|
||||
rgui->menu_video_settings.viewport.width = (rgui->menu_video_settings.viewport.width < 1) ?
|
||||
1 : rgui->menu_video_settings.viewport.width;
|
||||
rgui->menu_video_settings.viewport.height = (rgui->menu_video_settings.viewport.height < 1) ?
|
||||
1 : rgui->menu_video_settings.viewport.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
rgui->menu_video_settings.viewport.width = 1;
|
||||
rgui->menu_video_settings.viewport.height = 1;
|
||||
}
|
||||
|
||||
rgui->menu_video_settings.viewport.x = (vp.full_width - rgui->menu_video_settings.viewport.width) / 2;
|
||||
rgui->menu_video_settings.viewport.y = (vp.full_height - rgui->menu_video_settings.viewport.height) / 2;
|
||||
}
|
||||
|
||||
static bool rgui_set_aspect_ratio(rgui_t *rgui)
|
||||
{
|
||||
#if !defined(GEKKO)
|
||||
@ -1933,7 +2061,6 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui)
|
||||
rgui_frame_buf.height = 240;
|
||||
rgui_frame_buf.width = 320;
|
||||
base_term_width = rgui_frame_buf.width;
|
||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_4_3;
|
||||
|
||||
/* Allocate frame buffer
|
||||
* (4 extra lines to cache the chequered background) */
|
||||
@ -1950,28 +2077,23 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui)
|
||||
case RGUI_ASPECT_RATIO_16_9:
|
||||
rgui_frame_buf.width = 426;
|
||||
base_term_width = rgui_frame_buf.width;
|
||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_16_9;
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_16_9_CENTRE:
|
||||
rgui_frame_buf.width = 426;
|
||||
base_term_width = 320;
|
||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_16_9;
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_16_10:
|
||||
rgui_frame_buf.width = 384;
|
||||
base_term_width = rgui_frame_buf.width;
|
||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_16_10;
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_16_10_CENTRE:
|
||||
rgui_frame_buf.width = 384;
|
||||
base_term_width = 320;
|
||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_16_10;
|
||||
break;
|
||||
default:
|
||||
/* 4:3 */
|
||||
rgui_frame_buf.width = 320;
|
||||
base_term_width = rgui_frame_buf.width;
|
||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_4_3;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2020,12 +2142,10 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui)
|
||||
|
||||
/* If aspect ratio lock is enabled, notify
|
||||
* video driver of change */
|
||||
if (settings->bools.menu_rgui_lock_aspect)
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
unsigned aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
||||
settings->uints.video_aspect_ratio_idx = rgui->menu_aspect_ratio_idx;
|
||||
video_driver_set_aspect_ratio();
|
||||
settings->uints.video_aspect_ratio_idx = aspect_ratio_idx;
|
||||
rgui_update_menu_viewport(rgui);
|
||||
rgui_set_video_config(&rgui->menu_video_settings);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -2053,9 +2173,13 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
|
||||
rgui->menu_title[0] = '\0';
|
||||
rgui->menu_sublabel[0] = '\0';
|
||||
|
||||
/* Cache initial video settings */
|
||||
rgui_get_video_config(&rgui->content_video_settings);
|
||||
|
||||
/* Set aspect ratio
|
||||
* - Allocates frame buffer
|
||||
* - Configures variable 'menu display' settings */
|
||||
rgui->menu_aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||
if (!rgui_set_aspect_ratio(rgui))
|
||||
goto error;
|
||||
|
||||
@ -2160,6 +2284,21 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
|
||||
|
||||
if (settings->uints.menu_rgui_aspect_ratio != rgui->menu_aspect_ratio)
|
||||
rgui_set_aspect_ratio(rgui);
|
||||
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock != rgui->menu_aspect_ratio_lock)
|
||||
{
|
||||
rgui->menu_aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock == RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
rgui_set_video_config(&rgui->content_video_settings);
|
||||
}
|
||||
else
|
||||
{
|
||||
rgui_update_menu_viewport(rgui);
|
||||
rgui_set_video_config(&rgui->menu_video_settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rgui_set_texture(void)
|
||||
@ -2423,9 +2562,10 @@ static void rgui_populate_entries(void *data,
|
||||
const char *path,
|
||||
const char *label, unsigned k)
|
||||
{
|
||||
rgui_t *rgui = (rgui_t*)data;
|
||||
rgui_t *rgui = (rgui_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!rgui)
|
||||
if (!rgui || !settings)
|
||||
return;
|
||||
|
||||
/* Check whether we are currently viewing a playlist */
|
||||
@ -2438,6 +2578,22 @@ static void rgui_populate_entries(void *data,
|
||||
menu_entries_get_title(rgui->menu_title, sizeof(rgui->menu_title));
|
||||
|
||||
rgui_navigation_set(data, true);
|
||||
|
||||
/* If aspect ratio lock is enabled, must restore
|
||||
* content video settings when accessing the video
|
||||
* settings menu... */
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_SETTINGS_LIST)))
|
||||
{
|
||||
/* Make sure that any changes made while accessing
|
||||
* the video settings menu are preserved */
|
||||
rgui_video_settings_t current_video_settings = {0};
|
||||
rgui_get_video_config(¤t_video_settings);
|
||||
if (rgui_is_video_config_equal(¤t_video_settings, &rgui->menu_video_settings))
|
||||
rgui_set_video_config(&rgui->content_video_settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int rgui_environ(enum menu_environ_cb type,
|
||||
@ -2505,36 +2661,29 @@ static void rgui_toggle(void *userdata, bool menu_on)
|
||||
if (!rgui || !settings)
|
||||
return;
|
||||
|
||||
if (settings->bools.menu_rgui_lock_aspect)
|
||||
if (settings->uints.menu_rgui_aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
if (menu_on)
|
||||
{
|
||||
/* Cache last used content aspect ratio */
|
||||
rgui->content_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
||||
/* Cache content video settings */
|
||||
rgui_get_video_config(&rgui->content_video_settings);
|
||||
|
||||
/* Check if aspect ratio needs to change */
|
||||
if (rgui->content_aspect_ratio_idx != rgui->menu_aspect_ratio_idx)
|
||||
{
|
||||
settings->uints.video_aspect_ratio_idx = rgui->menu_aspect_ratio_idx;
|
||||
video_driver_set_aspect_ratio();
|
||||
|
||||
/* If content is using a custom aspect ratio, we
|
||||
* have to stop here - otherwise, restore content
|
||||
* aspect ratio setting */
|
||||
if (rgui->content_aspect_ratio_idx != ASPECT_RATIO_CUSTOM)
|
||||
settings->uints.video_aspect_ratio_idx = rgui->content_aspect_ratio_idx;
|
||||
}
|
||||
/* Update menu viewport */
|
||||
rgui_update_menu_viewport(rgui);
|
||||
|
||||
/* Apply menu video settings */
|
||||
rgui_set_video_config(&rgui->menu_video_settings);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If content is using a custom aspect ratio, this
|
||||
* must be restored */
|
||||
if (rgui->content_aspect_ratio_idx == ASPECT_RATIO_CUSTOM
|
||||
&& settings->uints.video_aspect_ratio_idx == rgui->menu_aspect_ratio_idx)
|
||||
settings->uints.video_aspect_ratio_idx = rgui->content_aspect_ratio_idx;
|
||||
/* Restore content video settings *if* user
|
||||
* has not changed video settings since menu was
|
||||
* last toggled on */
|
||||
rgui_video_settings_t current_video_settings = {0};
|
||||
rgui_get_video_config(¤t_video_settings);
|
||||
|
||||
if (settings->uints.video_aspect_ratio_idx != rgui->menu_aspect_ratio_idx)
|
||||
video_driver_set_aspect_ratio();
|
||||
if (rgui_is_video_config_equal(¤t_video_settings, &rgui->menu_video_settings))
|
||||
rgui_set_video_config(&rgui->content_video_settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,6 +259,14 @@ enum rgui_aspect_ratio
|
||||
RGUI_ASPECT_RATIO_LAST
|
||||
};
|
||||
|
||||
enum rgui_aspect_ratio_lock
|
||||
{
|
||||
RGUI_ASPECT_RATIO_LOCK_NONE = 0,
|
||||
RGUI_ASPECT_RATIO_LOCK_FIT_SCREEN,
|
||||
RGUI_ASPECT_RATIO_LOCK_INTEGER,
|
||||
RGUI_ASPECT_RATIO_LOCK_LAST
|
||||
};
|
||||
|
||||
enum menu_action
|
||||
{
|
||||
MENU_ACTION_NOOP = 0,
|
||||
|
@ -6119,8 +6119,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
|
||||
PARSE_ONLY_UINT, false) == 0)
|
||||
count++;
|
||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT,
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||
PARSE_ONLY_UINT, false) == 0)
|
||||
count++;
|
||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_MENU_HORIZONTAL_ANIMATION,
|
||||
|
@ -933,6 +933,36 @@ static void setting_get_string_representation_uint_rgui_aspect_ratio(
|
||||
}
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_rgui_aspect_ratio_lock(
|
||||
rarch_setting_t *setting,
|
||||
char *s, size_t len)
|
||||
{
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
switch (*setting->value.target.unsigned_integer)
|
||||
{
|
||||
case RGUI_ASPECT_RATIO_LOCK_NONE:
|
||||
strlcpy(s,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_NONE),
|
||||
len);
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_LOCK_FIT_SCREEN:
|
||||
strlcpy(s,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_FIT_SCREEN),
|
||||
len);
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_LOCK_INTEGER:
|
||||
strlcpy(s,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_INTEGER),
|
||||
len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void setting_get_string_representation_uint_menu_ticker_type(
|
||||
rarch_setting_t *setting,
|
||||
char *s, size_t len)
|
||||
@ -8353,21 +8383,21 @@ static bool setting_append_list(
|
||||
menu_settings_list_current_add_range(list, list_info, 0, RGUI_ASPECT_RATIO_LAST-1, 1, true, true);
|
||||
#endif
|
||||
|
||||
CONFIG_BOOL(
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
&settings->bools.menu_rgui_lock_aspect,
|
||||
MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT,
|
||||
MENU_ENUM_LABEL_VALUE_MENU_RGUI_LOCK_ASPECT,
|
||||
true,
|
||||
MENU_ENUM_LABEL_VALUE_OFF,
|
||||
MENU_ENUM_LABEL_VALUE_ON,
|
||||
&settings->uints.menu_rgui_aspect_ratio_lock,
|
||||
MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||
MENU_ENUM_LABEL_VALUE_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||
rgui_aspect_lock,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler,
|
||||
SD_FLAG_NONE
|
||||
);
|
||||
general_read_handler);
|
||||
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
|
||||
(*list)[list_info->index - 1].get_string_representation =
|
||||
&setting_get_string_representation_uint_rgui_aspect_ratio_lock;
|
||||
menu_settings_list_current_add_range(list, list_info, 0, RGUI_ASPECT_RATIO_LOCK_LAST-1, 1, true, true);
|
||||
|
||||
CONFIG_UINT(
|
||||
list, list_info,
|
||||
|
@ -865,9 +865,9 @@ enum msg_hash_enums
|
||||
MENU_LABEL(MENU_RGUI_BORDER_FILLER_ENABLE),
|
||||
MENU_LABEL(MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE),
|
||||
MENU_LABEL(MENU_RGUI_BORDER_FILLER_THICKNESS_ENABLE),
|
||||
MENU_LABEL(MENU_RGUI_LOCK_ASPECT),
|
||||
MENU_LABEL(MENU_RGUI_INTERNAL_UPSCALE_LEVEL),
|
||||
MENU_LABEL(MENU_RGUI_ASPECT_RATIO),
|
||||
MENU_LABEL(MENU_RGUI_ASPECT_RATIO_LOCK),
|
||||
MENU_LABEL(MENU_RGUI_FULL_WIDTH_LAYOUT),
|
||||
MENU_LABEL(MENU_LINEAR_FILTER),
|
||||
MENU_LABEL(MENU_HORIZONTAL_ANIMATION),
|
||||
@ -1992,6 +1992,10 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10,
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10_CENTRE,
|
||||
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_NONE,
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_FIT_SCREEN,
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_INTEGER,
|
||||
|
||||
/* Callback strings */
|
||||
MENU_ENUM_LABEL_CB_CORE_CONTENT_DIRS_LIST,
|
||||
MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD,
|
||||
|
Loading…
Reference in New Issue
Block a user