mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 17:43:02 +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_color_theme = RGUI_THEME_CLASSIC_GREEN;
|
||||||
static unsigned rgui_thumbnail_downscaler = RGUI_THUMB_SCALE_POINT;
|
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 unsigned rgui_internal_upscale_level = RGUI_UPSCALE_NONE;
|
||||||
static bool rgui_full_width_layout = true;
|
static bool rgui_full_width_layout = true;
|
||||||
static unsigned rgui_aspect = RGUI_ASPECT_RATIO_4_3;
|
static unsigned rgui_aspect = RGUI_ASPECT_RATIO_4_3;
|
||||||
|
static unsigned rgui_aspect_lock = RGUI_ASPECT_RATIO_LOCK_NONE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static bool default_block_config_read = false;
|
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_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_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("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);
|
SETTING_BOOL("menu_rgui_full_width_layout", &settings->bools.menu_rgui_full_width_layout, true, rgui_full_width_layout, false);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_XMB
|
#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_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_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", &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
|
#endif
|
||||||
#ifdef HAVE_LIBNX
|
#ifdef HAVE_LIBNX
|
||||||
SETTING_UINT("split_joycon_p1", &settings->uints.input_split_joycon[0], true, 0, false);
|
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_background_filler_thickness_enable;
|
||||||
bool menu_rgui_border_filler_thickness_enable;
|
bool menu_rgui_border_filler_thickness_enable;
|
||||||
bool menu_rgui_border_filler_enable;
|
bool menu_rgui_border_filler_enable;
|
||||||
bool menu_rgui_lock_aspect;
|
|
||||||
bool menu_rgui_full_width_layout;
|
bool menu_rgui_full_width_layout;
|
||||||
bool menu_xmb_shadows_enable;
|
bool menu_xmb_shadows_enable;
|
||||||
bool menu_xmb_vertical_thumbnails;
|
bool menu_xmb_vertical_thumbnails;
|
||||||
@ -444,6 +443,7 @@ typedef struct settings
|
|||||||
unsigned menu_font_color_blue;
|
unsigned menu_font_color_blue;
|
||||||
unsigned menu_rgui_internal_upscale_level;
|
unsigned menu_rgui_internal_upscale_level;
|
||||||
unsigned menu_rgui_aspect_ratio;
|
unsigned menu_rgui_aspect_ratio;
|
||||||
|
unsigned menu_rgui_aspect_ratio_lock;
|
||||||
unsigned menu_ticker_type;
|
unsigned menu_ticker_type;
|
||||||
|
|
||||||
unsigned playlist_show_inline_core_name;
|
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")
|
"menu_rgui_border_filler_thickness_enable")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE,
|
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE,
|
||||||
"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,
|
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_INTERNAL_UPSCALE_LEVEL,
|
||||||
"rgui_internal_upscale_level")
|
"rgui_internal_upscale_level")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO,
|
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO,
|
||||||
"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,
|
MSG_HASH(MENU_ENUM_LABEL_MENU_RGUI_FULL_WIDTH_LAYOUT,
|
||||||
"menu_rgui_full_width_layout")
|
"menu_rgui_full_width_layout")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_REWIND,
|
MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_REWIND,
|
||||||
|
@ -3042,6 +3042,18 @@ MSG_HASH(
|
|||||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10_CENTRE,
|
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10_CENTRE,
|
||||||
"16:10 (Centered)"
|
"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(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY,
|
MENU_ENUM_LABEL_VALUE_THUMBNAILS_DIRECTORY,
|
||||||
"Thumbnails"
|
"Thumbnails"
|
||||||
@ -6813,11 +6825,11 @@ MSG_HASH(
|
|||||||
"Increase coarseness of menu background chequerboard pattern."
|
"Increase coarseness of menu background chequerboard pattern."
|
||||||
)
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_MENU_RGUI_LOCK_ASPECT,
|
MENU_ENUM_LABEL_VALUE_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||||
"Lock Menu Aspect Ratio"
|
"Lock Menu Aspect Ratio"
|
||||||
)
|
)
|
||||||
MSG_HASH(
|
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."
|
"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(
|
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_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_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_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_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_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)
|
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:
|
case MENU_ENUM_LABEL_MENU_LINEAR_FILTER:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_linear_filter);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_linear_filter);
|
||||||
break;
|
break;
|
||||||
case MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT:
|
case MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO_LOCK:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_lock_aspect);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_rgui_aspect_ratio_lock);
|
||||||
break;
|
break;
|
||||||
case MENU_ENUM_LABEL_RGUI_MENU_COLOR_THEME:
|
case MENU_ENUM_LABEL_RGUI_MENU_COLOR_THEME:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_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;
|
uint16_t border_light_color;
|
||||||
} rgui_colors_t;
|
} rgui_colors_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned aspect_ratio_idx;
|
||||||
|
video_viewport_t viewport;
|
||||||
|
} rgui_video_settings_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
bool bg_modified;
|
bool bg_modified;
|
||||||
@ -450,8 +456,9 @@ typedef struct
|
|||||||
char menu_title[255]; /* Must be a fixed length array... */
|
char menu_title[255]; /* Must be a fixed length array... */
|
||||||
char menu_sublabel[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;
|
||||||
unsigned menu_aspect_ratio_idx;
|
unsigned menu_aspect_ratio_lock;
|
||||||
unsigned content_aspect_ratio_idx;
|
rgui_video_settings_t menu_video_settings;
|
||||||
|
rgui_video_settings_t content_video_settings;
|
||||||
struct scaler_ctx image_scaler;
|
struct scaler_ctx image_scaler;
|
||||||
} rgui_t;
|
} rgui_t;
|
||||||
|
|
||||||
@ -1912,6 +1919,127 @@ static void rgui_wallpaper_free(void)
|
|||||||
wallpaper.data = NULL;
|
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)
|
static bool rgui_set_aspect_ratio(rgui_t *rgui)
|
||||||
{
|
{
|
||||||
#if !defined(GEKKO)
|
#if !defined(GEKKO)
|
||||||
@ -1933,7 +2061,6 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui)
|
|||||||
rgui_frame_buf.height = 240;
|
rgui_frame_buf.height = 240;
|
||||||
rgui_frame_buf.width = 320;
|
rgui_frame_buf.width = 320;
|
||||||
base_term_width = rgui_frame_buf.width;
|
base_term_width = rgui_frame_buf.width;
|
||||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_4_3;
|
|
||||||
|
|
||||||
/* Allocate frame buffer
|
/* Allocate frame buffer
|
||||||
* (4 extra lines to cache the chequered background) */
|
* (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:
|
case RGUI_ASPECT_RATIO_16_9:
|
||||||
rgui_frame_buf.width = 426;
|
rgui_frame_buf.width = 426;
|
||||||
base_term_width = rgui_frame_buf.width;
|
base_term_width = rgui_frame_buf.width;
|
||||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_16_9;
|
|
||||||
break;
|
break;
|
||||||
case RGUI_ASPECT_RATIO_16_9_CENTRE:
|
case RGUI_ASPECT_RATIO_16_9_CENTRE:
|
||||||
rgui_frame_buf.width = 426;
|
rgui_frame_buf.width = 426;
|
||||||
base_term_width = 320;
|
base_term_width = 320;
|
||||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_16_9;
|
|
||||||
break;
|
break;
|
||||||
case RGUI_ASPECT_RATIO_16_10:
|
case RGUI_ASPECT_RATIO_16_10:
|
||||||
rgui_frame_buf.width = 384;
|
rgui_frame_buf.width = 384;
|
||||||
base_term_width = rgui_frame_buf.width;
|
base_term_width = rgui_frame_buf.width;
|
||||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_16_10;
|
|
||||||
break;
|
break;
|
||||||
case RGUI_ASPECT_RATIO_16_10_CENTRE:
|
case RGUI_ASPECT_RATIO_16_10_CENTRE:
|
||||||
rgui_frame_buf.width = 384;
|
rgui_frame_buf.width = 384;
|
||||||
base_term_width = 320;
|
base_term_width = 320;
|
||||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_16_10;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* 4:3 */
|
/* 4:3 */
|
||||||
rgui_frame_buf.width = 320;
|
rgui_frame_buf.width = 320;
|
||||||
base_term_width = rgui_frame_buf.width;
|
base_term_width = rgui_frame_buf.width;
|
||||||
rgui->menu_aspect_ratio_idx = ASPECT_RATIO_4_3;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2020,12 +2142,10 @@ static bool rgui_set_aspect_ratio(rgui_t *rgui)
|
|||||||
|
|
||||||
/* If aspect ratio lock is enabled, notify
|
/* If aspect ratio lock is enabled, notify
|
||||||
* video driver of change */
|
* 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;
|
rgui_update_menu_viewport(rgui);
|
||||||
settings->uints.video_aspect_ratio_idx = rgui->menu_aspect_ratio_idx;
|
rgui_set_video_config(&rgui->menu_video_settings);
|
||||||
video_driver_set_aspect_ratio();
|
|
||||||
settings->uints.video_aspect_ratio_idx = aspect_ratio_idx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2053,9 +2173,13 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
|
|||||||
rgui->menu_title[0] = '\0';
|
rgui->menu_title[0] = '\0';
|
||||||
rgui->menu_sublabel[0] = '\0';
|
rgui->menu_sublabel[0] = '\0';
|
||||||
|
|
||||||
|
/* Cache initial video settings */
|
||||||
|
rgui_get_video_config(&rgui->content_video_settings);
|
||||||
|
|
||||||
/* Set aspect ratio
|
/* Set aspect ratio
|
||||||
* - Allocates frame buffer
|
* - Allocates frame buffer
|
||||||
* - Configures variable 'menu display' settings */
|
* - Configures variable 'menu display' settings */
|
||||||
|
rgui->menu_aspect_ratio_lock = settings->uints.menu_rgui_aspect_ratio_lock;
|
||||||
if (!rgui_set_aspect_ratio(rgui))
|
if (!rgui_set_aspect_ratio(rgui))
|
||||||
goto error;
|
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)
|
if (settings->uints.menu_rgui_aspect_ratio != rgui->menu_aspect_ratio)
|
||||||
rgui_set_aspect_ratio(rgui);
|
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)
|
static void rgui_set_texture(void)
|
||||||
@ -2424,8 +2563,9 @@ static void rgui_populate_entries(void *data,
|
|||||||
const char *label, unsigned k)
|
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;
|
return;
|
||||||
|
|
||||||
/* Check whether we are currently viewing a playlist */
|
/* 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));
|
menu_entries_get_title(rgui->menu_title, sizeof(rgui->menu_title));
|
||||||
|
|
||||||
rgui_navigation_set(data, true);
|
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,
|
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)
|
if (!rgui || !settings)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (settings->bools.menu_rgui_lock_aspect)
|
if (settings->uints.menu_rgui_aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||||
{
|
{
|
||||||
if (menu_on)
|
if (menu_on)
|
||||||
{
|
{
|
||||||
/* Cache last used content aspect ratio */
|
/* Cache content video settings */
|
||||||
rgui->content_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
rgui_get_video_config(&rgui->content_video_settings);
|
||||||
|
|
||||||
/* Check if aspect ratio needs to change */
|
/* Update menu viewport */
|
||||||
if (rgui->content_aspect_ratio_idx != rgui->menu_aspect_ratio_idx)
|
rgui_update_menu_viewport(rgui);
|
||||||
{
|
|
||||||
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
|
/* Apply menu video settings */
|
||||||
* have to stop here - otherwise, restore content
|
rgui_set_video_config(&rgui->menu_video_settings);
|
||||||
* aspect ratio setting */
|
|
||||||
if (rgui->content_aspect_ratio_idx != ASPECT_RATIO_CUSTOM)
|
|
||||||
settings->uints.video_aspect_ratio_idx = rgui->content_aspect_ratio_idx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* If content is using a custom aspect ratio, this
|
/* Restore content video settings *if* user
|
||||||
* must be restored */
|
* has not changed video settings since menu was
|
||||||
if (rgui->content_aspect_ratio_idx == ASPECT_RATIO_CUSTOM
|
* last toggled on */
|
||||||
&& settings->uints.video_aspect_ratio_idx == rgui->menu_aspect_ratio_idx)
|
rgui_video_settings_t current_video_settings = {0};
|
||||||
settings->uints.video_aspect_ratio_idx = rgui->content_aspect_ratio_idx;
|
rgui_get_video_config(¤t_video_settings);
|
||||||
|
|
||||||
if (settings->uints.video_aspect_ratio_idx != rgui->menu_aspect_ratio_idx)
|
if (rgui_is_video_config_equal(¤t_video_settings, &rgui->menu_video_settings))
|
||||||
video_driver_set_aspect_ratio();
|
rgui_set_video_config(&rgui->content_video_settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +259,14 @@ enum rgui_aspect_ratio
|
|||||||
RGUI_ASPECT_RATIO_LAST
|
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
|
enum menu_action
|
||||||
{
|
{
|
||||||
MENU_ACTION_NOOP = 0,
|
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)
|
PARSE_ONLY_UINT, false) == 0)
|
||||||
count++;
|
count++;
|
||||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||||
MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT,
|
MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||||
PARSE_ONLY_BOOL, false) == 0)
|
PARSE_ONLY_UINT, false) == 0)
|
||||||
count++;
|
count++;
|
||||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||||
MENU_ENUM_LABEL_MENU_HORIZONTAL_ANIMATION,
|
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(
|
static void setting_get_string_representation_uint_menu_ticker_type(
|
||||||
rarch_setting_t *setting,
|
rarch_setting_t *setting,
|
||||||
char *s, size_t len)
|
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);
|
menu_settings_list_current_add_range(list, list_info, 0, RGUI_ASPECT_RATIO_LAST-1, 1, true, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CONFIG_BOOL(
|
CONFIG_UINT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
&settings->bools.menu_rgui_lock_aspect,
|
&settings->uints.menu_rgui_aspect_ratio_lock,
|
||||||
MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT,
|
MENU_ENUM_LABEL_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||||
MENU_ENUM_LABEL_VALUE_MENU_RGUI_LOCK_ASPECT,
|
MENU_ENUM_LABEL_VALUE_MENU_RGUI_ASPECT_RATIO_LOCK,
|
||||||
true,
|
rgui_aspect_lock,
|
||||||
MENU_ENUM_LABEL_VALUE_OFF,
|
|
||||||
MENU_ENUM_LABEL_VALUE_ON,
|
|
||||||
&group_info,
|
&group_info,
|
||||||
&subgroup_info,
|
&subgroup_info,
|
||||||
parent_group,
|
parent_group,
|
||||||
general_write_handler,
|
general_write_handler,
|
||||||
general_read_handler,
|
general_read_handler);
|
||||||
SD_FLAG_NONE
|
(*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(
|
CONFIG_UINT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
|
@ -865,9 +865,9 @@ enum msg_hash_enums
|
|||||||
MENU_LABEL(MENU_RGUI_BORDER_FILLER_ENABLE),
|
MENU_LABEL(MENU_RGUI_BORDER_FILLER_ENABLE),
|
||||||
MENU_LABEL(MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE),
|
MENU_LABEL(MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE),
|
||||||
MENU_LABEL(MENU_RGUI_BORDER_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_INTERNAL_UPSCALE_LEVEL),
|
||||||
MENU_LABEL(MENU_RGUI_ASPECT_RATIO),
|
MENU_LABEL(MENU_RGUI_ASPECT_RATIO),
|
||||||
|
MENU_LABEL(MENU_RGUI_ASPECT_RATIO_LOCK),
|
||||||
MENU_LABEL(MENU_RGUI_FULL_WIDTH_LAYOUT),
|
MENU_LABEL(MENU_RGUI_FULL_WIDTH_LAYOUT),
|
||||||
MENU_LABEL(MENU_LINEAR_FILTER),
|
MENU_LABEL(MENU_LINEAR_FILTER),
|
||||||
MENU_LABEL(MENU_HORIZONTAL_ANIMATION),
|
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,
|
||||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10_CENTRE,
|
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 */
|
/* Callback strings */
|
||||||
MENU_ENUM_LABEL_CB_CORE_CONTENT_DIRS_LIST,
|
MENU_ENUM_LABEL_CB_CORE_CONTENT_DIRS_LIST,
|
||||||
MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD,
|
MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user