(Ozone) Add 'Use System Preferred Color Theme' (enabled for Switch)

This commit is contained in:
twinaphex 2018-10-27 17:10:53 +02:00
parent 624698d2d9
commit 689e612af8
27 changed files with 133 additions and 14 deletions

View File

@ -266,6 +266,12 @@ static const float default_input_overlay_opacity = 0.7f;
static bool default_block_config_read = true; 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_take_screenshot = true;
static bool quick_menu_show_save_load_state = true; static bool quick_menu_show_save_load_state = true;
static bool quick_menu_show_undo_save_load_state = true; static bool quick_menu_show_undo_save_load_state = true;

View File

@ -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_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("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("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_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("content_show_favorites", &settings->bools.menu_content_show_favorites, true, content_show_favorites, false);
#ifdef HAVE_IMAGEVIEWER #ifdef HAVE_IMAGEVIEWER

View File

@ -175,6 +175,8 @@ typedef struct settings
bool menu_content_show_history; bool menu_content_show_history;
bool menu_content_show_add; bool menu_content_show_add;
bool menu_content_show_playlists; bool menu_content_show_playlists;
bool menu_use_preferred_system_color_theme;
bool menu_preferred_system_color_theme_set;
bool menu_unified_controls; bool menu_unified_controls;
bool quick_menu_show_take_screenshot; bool quick_menu_show_take_screenshot;
bool quick_menu_show_save_load_state; bool quick_menu_show_save_load_state;

View File

@ -3692,3 +3692,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -4711,3 +4711,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3468,3 +3468,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3604,3 +3604,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -7695,3 +7695,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3343,3 +3343,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -7633,3 +7633,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3502,3 +3502,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3562,3 +3562,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -4011,3 +4011,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3463,3 +3463,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -1725,3 +1725,5 @@ MSG_HASH(MENU_ENUM_LABEL_STREAMING_TITLE,
"streaming_title") "streaming_title")
MSG_HASH(MENU_ENUM_LABEL_RESET_TO_DEFAULT_CONFIG, MSG_HASH(MENU_ENUM_LABEL_RESET_TO_DEFAULT_CONFIG,
"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")

View File

@ -3349,3 +3349,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3765,3 +3765,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -7727,3 +7727,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3429,3 +3429,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3632,3 +3632,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -7727,3 +7727,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -3502,3 +3502,7 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
"Select a different 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).")

View File

@ -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_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_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_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_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_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY)
default_sublabel_macro(action_bind_sublabel_menu_ribbon_enable, MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE) 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: case MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_wallpaper_opacity); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_wallpaper_opacity);
break; 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: case MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_menu_color_theme); BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_menu_color_theme);
break; break;

View File

@ -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) static void *ozone_init(void **userdata, bool video_is_threaded)
{ {
#ifdef HAVE_LIBNX bool fallback_color_theme = false;
Result rc;
ColorSetId theme;
#endif
unsigned width, height, color_theme = 0; unsigned width, height, color_theme = 0;
ozone_handle_t *ozone = NULL; ozone_handle_t *ozone = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu)); menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
if (!menu) if (!menu)
goto error; return false;
if (!menu_display_init_first_driver(video_is_threaded)) if (!menu_display_init_first_driver(video_is_threaded))
goto error; goto error;
@ -1196,18 +1193,26 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
menu_display_allocate_white_texture(); menu_display_allocate_white_texture();
/* Theme */ /* Theme */
/* TODO Add theme override in settings */ if (settings->bools.menu_use_preferred_system_color_theme)
#ifdef HAVE_LIBNX
rc = setsysInitialize();
if (R_SUCCEEDED(rc))
{ {
color_theme = (theme == ColorSetId_Dark) ? 1 : 0; #ifdef HAVE_LIBNX
setsysGetColorSetId(&theme); if (R_SUCCEEDED(setsysInitialize()))
ozone_set_color_theme(ozone, color_theme); {
setsysExit(); 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 else
#endif fallback_color_theme = true;
if (fallback_color_theme)
{ {
color_theme = settings->uints.menu_ozone_color_theme; color_theme = settings->uints.menu_ozone_color_theme;
ozone_set_color_theme(ozone, color_theme); ozone_set_color_theme(ozone, color_theme);

View File

@ -5988,6 +5988,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY, MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY,
PARSE_ONLY_FLOAT, false) == 0) PARSE_ONLY_FLOAT, false) == 0)
count++; 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, if (menu_displaylist_parse_settings_enum(menu, info,
MENU_ENUM_LABEL_THUMBNAILS, MENU_ENUM_LABEL_THUMBNAILS,
PARSE_ONLY_UINT, false) == 0) PARSE_ONLY_UINT, false) == 0)

View File

@ -776,9 +776,13 @@ static void setting_get_string_representation_uint_ozone_menu_color_theme(
rarch_setting_t *setting, rarch_setting_t *setting,
char *s, size_t len) char *s, size_t len)
{ {
settings_t *settings = config_get_ptr();
if (!setting) if (!setting)
return; return;
if (settings->bools.menu_preferred_system_color_theme_set)
strlcpy(s, "System default", len);
switch (*setting->value.target.unsigned_integer) switch (*setting->value.target.unsigned_integer)
{ {
case 1: 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); menu_settings_list_current_add_range(list, list_info, 0, XMB_THEME_LAST-1, 1, true, true);
} }
#endif #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( CONFIG_BOOL(
list, list_info, list, list_info,
&settings->bools.menu_show_load_core, &settings->bools.menu_show_load_core,

View File

@ -460,6 +460,7 @@ enum msg_hash_enums
MENU_LABEL(MENU_WALLPAPER_OPACITY), MENU_LABEL(MENU_WALLPAPER_OPACITY),
MENU_LABEL(MENU_FRAMEBUFFER_OPACITY), MENU_LABEL(MENU_FRAMEBUFFER_OPACITY),
MENU_LABEL(MENU_USE_PREFERRED_SYSTEM_COLOR_THEME),
MENU_ENUM_LABEL_VALUE_CONFIG, MENU_ENUM_LABEL_VALUE_CONFIG,
MENU_ENUM_LABEL_VALUE_OVERLAY, MENU_ENUM_LABEL_VALUE_OVERLAY,