diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 04343e17f2..8b2c710329 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -3695,4 +3695,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index ba01b8d8fc..a02caeeaa6 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -4714,4 +4714,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index b7b82260ce..1fb9e5dba5 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -3471,4 +3471,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 3c7745ff02..2637884ab6 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -3607,4 +3607,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index ede7afaa57..d6277e1154 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -7699,4 +7699,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index efe536b4ae..e2f0ebe25b 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -3346,4 +3346,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 3b76bc16d4..0dc0ecaff4 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -7636,4 +7636,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index a5725ffe38..748d6aee42 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -3505,4 +3505,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index ef28f825b8..028ca74cc1 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -3565,4 +3565,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 11abb76f1a..49e80b63d2 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -4014,4 +4014,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 0ca5f38017..0cae872621 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -3466,4 +3466,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 117ed1478a..94093064a7 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -3352,4 +3352,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index ce60cab76a..1a278f4484 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -3768,4 +3768,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 29df5966e6..41fe5e2788 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -7730,4 +7730,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 82959c4f57..68626e9a45 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -3432,4 +3432,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 8df4fd9f6e..36145db042 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -3635,4 +3635,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 98f684f272..9189992a5b 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -7730,4 +7730,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 7546e1f6a4..6f4a5c5cf3 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -3505,4 +3505,4 @@ MSG_HASH( 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).") + "Use your operating system's color theme (if any) - overrides theme settings.") diff --git a/menu/drivers/ozone.c b/menu/drivers/ozone.c index 52366b3214..5cfd2a35a1 100644 --- a/menu/drivers/ozone.c +++ b/menu/drivers/ozone.c @@ -422,8 +422,9 @@ ozone_theme_t ozone_theme_dark = { "dark" }; -static unsigned last_color_theme = 0; -static ozone_theme_t *ozone_default_theme = &ozone_theme_light; +static unsigned last_color_theme = 0; +static bool last_use_preferred_system_color_theme = false; +static ozone_theme_t *ozone_default_theme = &ozone_theme_light; typedef struct ozone_handle { @@ -1106,6 +1107,40 @@ static void ozone_draw_text( 1.0); } +static void ozone_set_theme_path(ozone_handle_t *ozone) +{ + fill_pathname_join( + ozone->theme_path, + ozone->png_path, + ozone->theme->name, + sizeof(ozone->theme_path) + ); +} + +static void ozone_unload_theme_textures(ozone_handle_t *ozone) +{ + int i; + + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + video_driver_texture_unload(&ozone->theme_textures[i]); +} + +static void ozone_reset_theme_textures(ozone_handle_t *ozone) +{ + int i; + + ozone_set_theme_path(ozone); + + for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) + { + char filename[PATH_MAX_LENGTH]; + strlcpy(filename, OZONE_THEME_TEXTURES_FILES[i], sizeof(filename)); + strlcat(filename, ".png", sizeof(filename)); + + menu_display_reset_textures_list(filename, ozone->theme_path, &ozone->theme_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); + } +} + static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) { ozone_theme_t *theme = ozone_default_theme; @@ -1130,6 +1165,9 @@ static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme) memcpy(ozone->theme_dynamic.entries_border, ozone->theme->entries_border, sizeof(ozone->theme_dynamic.entries_border)); memcpy(ozone->theme_dynamic.entries_icon, ozone->theme->entries_icon, sizeof(ozone->theme_dynamic.entries_icon)); + ozone_unload_theme_textures(ozone); + ozone_reset_theme_textures(ozone); + last_color_theme = color_theme; } @@ -1202,6 +1240,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) setsysGetColorSetId(&theme); color_theme = (theme == ColorSetId_Dark) ? 1 : 0; ozone_set_color_theme(ozone, color_theme); + settings->uints.menu_ozone_color_theme = color_theme; settings->bools.menu_preferred_system_color_theme_set = true; setsysExit(); } @@ -1253,13 +1292,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded) sizeof(ozone->tab_path) ); - /* Theme path */ - fill_pathname_join( - ozone->theme_path, - ozone->png_path, - ozone->theme->name, - sizeof(ozone->theme_path) - ); + last_use_preferred_system_color_theme = settings->bools.menu_use_preferred_system_color_theme; return menu; @@ -1361,14 +1394,7 @@ static void ozone_context_reset(void *data, bool is_threaded) } /* Theme textures */ - for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) - { - char filename[PATH_MAX_LENGTH]; - strlcpy(filename, OZONE_THEME_TEXTURES_FILES[i], sizeof(filename)); - strlcat(filename, ".png", sizeof(filename)); - - menu_display_reset_textures_list(filename, ozone->theme_path, &ozone->theme_textures[i], TEXTURE_FILTER_MIPMAP_LINEAR); - } + ozone_reset_theme_textures(ozone); /* Icons textures init */ for (i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) @@ -1407,8 +1433,7 @@ static void ozone_context_destroy(void *data) return; /* Theme */ - for (i = 0; i < OZONE_THEME_TEXTURE_LAST; i++) - video_driver_texture_unload(&ozone->theme_textures[i]); + ozone_unload_theme_textures(ozone); /* Icons */ for (i = 0; i < OZONE_ENTRIES_ICONS_TEXTURE_LAST; i++) @@ -2414,6 +2439,23 @@ static void ozone_navigation_alphabet(void *data, size_t *unused) ozone_selection_changed(ozone, true); } +static unsigned ozone_get_system_theme() +{ + unsigned ret = 0; +#ifdef HAVE_LIBNX + if (R_SUCCEEDED(setsysInitialize())) + { + ColorSetId theme; + setsysGetColorSetId(&theme); + ret = (theme == ColorSetId_Dark) ? 1 : 0; + setsysExit(); + } + + return ret; +#endif + return 0; +} + static void ozone_frame(void *data, video_frame_info_t *video_info) { menu_display_ctx_clearcolor_t clearcolor; @@ -2424,14 +2466,25 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) if (!ozone) return; - if (color_theme != last_color_theme) - ozone_set_color_theme(ozone, color_theme); + /* Change theme on the fly */ + if (color_theme != last_color_theme || last_use_preferred_system_color_theme != settings->bools.menu_use_preferred_system_color_theme) + { + if (!settings->bools.menu_use_preferred_system_color_theme) + ozone_set_color_theme(ozone, color_theme); + else + { + video_info->ozone_color_theme = ozone_get_system_theme(); + ozone_set_color_theme(ozone, video_info->ozone_color_theme); + } + + last_use_preferred_system_color_theme = settings->bools.menu_use_preferred_system_color_theme; + } ozone->frame_count++; menu_display_set_viewport(video_info->width, video_info->height); - /* Clear first layer of text */ + /* Clear text */ font_driver_bind_block(ozone->fonts.footer, &ozone->raster_blocks.footer); font_driver_bind_block(ozone->fonts.title, &ozone->raster_blocks.title); font_driver_bind_block(ozone->fonts.time, &ozone->raster_blocks.time); @@ -2447,7 +2500,6 @@ static void ozone_frame(void *data, video_frame_info_t *video_info) ozone->raster_blocks.sidebar.carr.coords.vertices = 0; /* Background */ - clearcolor.r = ozone->theme->background_r; clearcolor.g = ozone->theme->background_g; clearcolor.b = ozone->theme->background_b;