From e3c383bb416b4a456322cd918b841238d5a01c03 Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Thu, 7 Feb 2019 17:12:27 +0000 Subject: [PATCH] (RGUI) Add 'Lock Menu Aspect Ratio' option --- config.def.h | 2 ++ configuration.c | 1 + configuration.h | 1 + intl/msg_hash_lbl.h | 2 ++ intl/msg_hash_us.h | 4 ++++ menu/drivers/rgui.c | 28 +++++++++++++++++++++++++++- menu/menu_displaylist.c | 4 ++++ menu/menu_setting.c | 16 ++++++++++++++++ msg_hash.h | 1 + 9 files changed, 58 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index f56066cf60..4d57ac2b12 100644 --- a/config.def.h +++ b/config.def.h @@ -376,6 +376,8 @@ 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; + #else static bool default_block_config_read = false; static bool automatically_add_content_to_playlist = false; diff --git a/configuration.c b/configuration.c index 3ba80b0f49..0ab83424d4 100644 --- a/configuration.c +++ b/configuration.c @@ -1456,6 +1456,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("menu_use_preferred_system_color_theme", &settings->bools.menu_use_preferred_system_color_theme, true, menu_use_preferred_system_color_theme, false); SETTING_BOOL("content_show_settings", &settings->bools.menu_content_show_settings, true, content_show_settings, false); SETTING_BOOL("content_show_favorites", &settings->bools.menu_content_show_favorites, true, content_show_favorites, false); + SETTING_BOOL("menu_rgui_lock_aspect", &settings->bools.menu_rgui_lock_aspect, true, rgui_lock_aspect, false); #ifdef HAVE_IMAGEVIEWER SETTING_BOOL("content_show_images", &settings->bools.menu_content_show_images, true, content_show_images, false); #endif diff --git a/configuration.h b/configuration.h index a399359686..2e72e25072 100644 --- a/configuration.h +++ b/configuration.h @@ -170,6 +170,7 @@ 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_xmb_shadows_enable; bool menu_xmb_vertical_thumbnails; bool menu_content_show_settings; diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 3b4071576b..e2110d7a7f 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1589,6 +1589,8 @@ 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_CONTENT_SHOW_REWIND, "menu_show_rewind_settings") MSG_HASH(MENU_ENUM_LABEL_CONTENT_SHOW_LATENCY, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 6e41fa8ae8..3011feb887 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -6640,6 +6640,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_MENU_RGUI_BACKGROUND_FILLER_THICKNESS_ENABLE, "Background filler thickness" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_MENU_RGUI_LOCK_ASPECT, + "Lock Menu Aspect Ratio" + ) MSG_HASH( MENU_ENUM_SUBLABEL_CRT_SWITCH_RESOLUTION, "For CRT displays only. Attempts to use exact core/game resolution and refresh rate." diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index b46f71708e..e601c33c5c 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -2227,6 +2227,32 @@ static int rgui_pointer_tap(void *data, return 0; } +static void rgui_toggle(void *userdata, bool menu_on) +{ + settings_t *settings = config_get_ptr(); + + if (settings->bools.menu_rgui_lock_aspect) + { + if (menu_on) + { + if (settings->uints.video_aspect_ratio_idx != ASPECT_RATIO_4_3) + { + unsigned aspect_ratio_idx = settings->uints.video_aspect_ratio_idx; + settings->uints.video_aspect_ratio_idx = ASPECT_RATIO_4_3; + video_driver_set_aspect_ratio(); + settings->uints.video_aspect_ratio_idx = aspect_ratio_idx; + } + } + else + { + if (settings->uints.video_aspect_ratio_idx != ASPECT_RATIO_4_3) + { + video_driver_set_aspect_ratio(); + } + } + } +} + menu_ctx_driver_t menu_ctx_rgui = { rgui_set_texture, rgui_set_message, @@ -2238,7 +2264,7 @@ menu_ctx_driver_t menu_ctx_rgui = { NULL, NULL, rgui_populate_entries, - NULL, + rgui_toggle, rgui_navigation_clear, NULL, NULL, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e80c6b3bab..ea826ea13f 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -6012,6 +6012,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist MENU_ENUM_LABEL_MENU_LINEAR_FILTER, PARSE_ONLY_BOOL, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_MENU_RGUI_LOCK_ASPECT, + PARSE_ONLY_BOOL, false) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_MENU_HORIZONTAL_ANIMATION, PARSE_ONLY_BOOL, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index f1fe94621d..81325575d0 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -7959,6 +7959,22 @@ static bool setting_append_list( SD_FLAG_NONE ); + CONFIG_BOOL( + 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, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + CONFIG_UINT( list, list_info, &settings->uints.menu_rgui_color_theme, diff --git a/msg_hash.h b/msg_hash.h index fb89883a62..77ccddc701 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -856,6 +856,7 @@ 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_LINEAR_FILTER), MENU_LABEL(MENU_HORIZONTAL_ANIMATION), MENU_LABEL(NAVIGATION_WRAPAROUND),