diff --git a/config.def.h b/config.def.h index a656c49fe6..80a10a7f61 100644 --- a/config.def.h +++ b/config.def.h @@ -266,6 +266,12 @@ static const float default_input_overlay_opacity = 0.7f; static bool default_block_config_read = true; +#ifdef HAVE_LIBNX +static bool menu_use_preferred_system_color_theme = true; +#else +static bool menu_use_preferred_system_color_theme = false; +#endif + static bool quick_menu_show_take_screenshot = true; static bool quick_menu_show_save_load_state = true; static bool quick_menu_show_undo_save_load_state = true; diff --git a/configuration.c b/configuration.c index 4b391bcd2a..a9b64bc8cc 100644 --- a/configuration.c +++ b/configuration.c @@ -1387,6 +1387,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, SETTING_BOOL("quick_menu_show_save_content_dir_overrides", &settings->bools.quick_menu_show_save_content_dir_overrides, true, quick_menu_show_save_content_dir_overrides, false); SETTING_BOOL("quick_menu_show_information", &settings->bools.quick_menu_show_information, true, quick_menu_show_information, false); SETTING_BOOL("kiosk_mode_enable", &settings->bools.kiosk_mode_enable, true, kiosk_mode_enable, false); + 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); #ifdef HAVE_IMAGEVIEWER diff --git a/configuration.h b/configuration.h index be17dcdbd3..eae90fc0b8 100644 --- a/configuration.h +++ b/configuration.h @@ -175,6 +175,8 @@ typedef struct settings bool menu_content_show_history; bool menu_content_show_add; bool menu_content_show_playlists; + bool menu_use_preferred_system_color_theme; + bool menu_preferred_system_color_theme_set; bool menu_unified_controls; bool quick_menu_show_take_screenshot; bool quick_menu_show_save_load_state; diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 735fc4b348..04343e17f2 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3692,3 +3692,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 372b064faa..ba01b8d8fc 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -4711,3 +4711,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 823e6ef5d7..b7b82260ce 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3468,3 +3468,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 83af071a0f..3c7745ff02 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3604,3 +3604,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index 90c17e6578..a028ad0c3c 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -7695,3 +7695,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index e5bd3a414f..efe536b4ae 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3343,3 +3343,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index eee1deba98..3b76bc16d4 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7633,3 +7633,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index d4ac5377df..a5725ffe38 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3502,3 +3502,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 22cd3dea9c..ef28f825b8 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3562,3 +3562,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index c055952a4e..11abb76f1a 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -4011,3 +4011,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 799a1ee190..0ca5f38017 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3463,3 +3463,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 3e5b127709..fdd436f410 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1725,3 +1725,5 @@ MSG_HASH(MENU_ENUM_LABEL_STREAMING_TITLE, "streaming_title") MSG_HASH(MENU_ENUM_LABEL_RESET_TO_DEFAULT_CONFIG, "reset_to_default_config") +MSG_HASH(MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "menu_use_preferred_system_color_theme") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 0fa9f7584c..117ed1478a 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3349,3 +3349,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 76598fcfec..ce60cab76a 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3765,3 +3765,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index c7dd694772..29df5966e6 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7727,3 +7727,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index eb15d1330e..82959c4f57 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3429,3 +3429,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index c597017496..8df4fd9f6e 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3632,3 +3632,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 7978149985..98f684f272 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7727,3 +7727,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 0adedcd8be..7546e1f6a4 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3502,3 +3502,7 @@ MSG_HASH( MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, "Select a different color theme." ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use preferred system color theme") +MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + "Use your operating system's default color theme (if one is set).") diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 214dd3fbe2..c4ff5f6cf5 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -375,6 +375,7 @@ default_sublabel_macro(action_bind_sublabel_xmb_shadows_enable, default_sublabel_macro(action_bind_sublabel_xmb_vertical_thumbnails, MENU_ENUM_SUBLABEL_XMB_VERTICAL_THUMBNAILS) default_sublabel_macro(action_bind_sublabel_menu_color_theme, MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME) default_sublabel_macro(action_bind_sublabel_ozone_menu_color_theme, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME) +default_sublabel_macro(action_bind_sublabel_menu_use_preferred_system_color_theme, MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME) default_sublabel_macro(action_bind_sublabel_menu_wallpaper_opacity, MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_ribbon_enable, MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE) @@ -1076,6 +1077,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_wallpaper_opacity); break; + case MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_use_preferred_system_color_theme); + break; case MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_menu_color_theme); break; diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index a403750cf5..e25d2606bb 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -1135,17 +1135,14 @@ static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) static void *ozone_init(void **userdata, bool video_is_threaded) { -#ifdef HAVE_LIBNX - Result rc; - ColorSetId theme; -#endif + bool fallback_color_theme = false; unsigned width, height, color_theme = 0; ozone_handle_t *ozone = NULL; settings_t *settings = config_get_ptr(); menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); if (!menu) - goto error; + return false; if (!menu_display_init_first_driver(video_is_threaded)) goto error; @@ -1196,18 +1193,26 @@ static void *ozone_init(void **userdata, bool video_is_threaded) menu_display_allocate_white_texture(); /* Theme */ - /* TODO Add theme override in settings */ -#ifdef HAVE_LIBNX - rc = setsysInitialize(); - if (R_SUCCEEDED(rc)) + if (settings->bools.menu_use_preferred_system_color_theme) { - color_theme = (theme == ColorSetId_Dark) ? 1 : 0; - setsysGetColorSetId(&theme); - ozone_set_color_theme(ozone, color_theme); - setsysExit(); +#ifdef HAVE_LIBNX + if (R_SUCCEEDED(setsysInitialize())) + { + ColorSetId theme; + setsysGetColorSetId(&theme); + color_theme = (theme == ColorSetId_Dark) ? 1 : 0; + ozone_set_color_theme(ozone, color_theme); + settings->bools.menu_preferred_system_color_theme_set = true; + setsysExit(); + } + else + fallback_color_theme = true; +#endif } else -#endif + fallback_color_theme = true; + + if (fallback_color_theme) { color_theme = settings->uints.menu_ozone_color_theme; ozone_set_color_theme(ozone, color_theme); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b4c3d6c3a0..e6bf685225 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5988,6 +5988,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY, PARSE_ONLY_FLOAT, false) == 0) count++; + if (menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + PARSE_ONLY_BOOL, false) == 0) + count++; if (menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_THUMBNAILS, PARSE_ONLY_UINT, false) == 0) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 88f8e3d739..35fcd92743 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -776,9 +776,13 @@ static void setting_get_string_representation_uint_ozone_menu_color_theme( rarch_setting_t *setting, char *s, size_t len) { + settings_t *settings = config_get_ptr(); if (!setting) return; + if (settings->bools.menu_preferred_system_color_theme_set) + strlcpy(s, "System default", len); + switch (*setting->value.target.unsigned_integer) { case 1: @@ -7916,6 +7920,24 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, 0, XMB_THEME_LAST-1, 1, true, true); } #endif + if (string_is_equal(settings->arrays.menu_driver, "ozone")) + { + CONFIG_BOOL( + list, list_info, + &settings->bools.menu_use_preferred_system_color_theme, + MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME, + menu_show_load_core, + 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_BOOL( list, list_info, &settings->bools.menu_show_load_core, diff --git a/msg_hash.h b/msg_hash.h index 7a6f2722bd..0642ca9abe 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -460,6 +460,7 @@ enum msg_hash_enums MENU_LABEL(MENU_WALLPAPER_OPACITY), MENU_LABEL(MENU_FRAMEBUFFER_OPACITY), + MENU_LABEL(MENU_USE_PREFERRED_SYSTEM_COLOR_THEME), MENU_ENUM_LABEL_VALUE_CONFIG, MENU_ENUM_LABEL_VALUE_OVERLAY,