Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,7 @@
#endif

#ifdef HAVE_OZONE
/* Ozone colour theme: 1 == Basic Black */
#define DEFAULT_OZONE_COLOR_THEME 1
#define DEFAULT_OZONE_COLOR_THEME "basic_black"
#define DEFAULT_OZONE_PADDING_FACTOR 1.0f
#define DEFAULT_OZONE_HEADER_ICON 1
#define DEFAULT_OZONE_HEADER_SEPARATOR 1
Expand Down
37 changes: 37 additions & 0 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,9 @@ static struct config_array_setting *populate_settings_array(

#ifdef HAVE_MENU
SETTING_ARRAY("menu_driver", settings->arrays.menu_driver, false, NULL, true);
#ifdef HAVE_OZONE
SETTING_ARRAY("ozone_menu_color_theme", settings->arrays.menu_ozone_color_theme, false, NULL, true);
#endif
#endif

SETTING_ARRAY("record_driver", settings->arrays.record_driver, false, NULL, true);
Expand Down Expand Up @@ -5457,6 +5460,9 @@ void config_set_defaults(void *data)
#endif
#ifdef HAVE_OZONE
*settings->paths.path_menu_ozone_font = '\0';
configuration_set_string(settings,
settings->arrays.menu_ozone_color_theme,
DEFAULT_OZONE_COLOR_THEME);
#endif

configuration_set_string(settings,
Expand Down Expand Up @@ -6930,6 +6936,37 @@ static bool config_load_file(global_t *global,
if (settings->floats.fastforward_ratio < 0.0f)
configuration_set_float(settings, settings->floats.fastforward_ratio, 0.0f);

#ifdef HAVE_OZONE
/* Convert legacy numeric values of Ozone color themes to string identifiers.
* Necessary to avoid breaking existing configs. */
{
static const char *legacy_ozone_color_themes[] = {
"basic_white",
"basic_black",
"nord",
"gruvbox_dark",
"boysenberry",
"hacking_the_kernel",
"twilight_zone",
"dracula",
"solarized_dark",
"solarized_light",
"gray_dark",
"gray_light",
"purple_rain",
"selenium",
"evergarden"
};
unsigned color_theme;

if ( config_get_uint(conf, MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME_STR, &color_theme)
&& color_theme < ARRAY_SIZE(legacy_ozone_color_themes))
configuration_set_string(settings,
settings->arrays.menu_ozone_color_theme,
legacy_ozone_color_themes[color_theme]);
}
#endif

#ifdef HAVE_CHEEVOS
if (*settings->arrays.cheevos_leaderboards_enable)
{
Expand Down
2 changes: 1 addition & 1 deletion configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ typedef struct settings
unsigned menu_materialui_thumbnail_view_portrait;
unsigned menu_materialui_thumbnail_view_landscape;
unsigned menu_materialui_landscape_layout_optimization;
unsigned menu_ozone_color_theme;
unsigned menu_ozone_header_icon;
unsigned menu_ozone_header_separator;
unsigned menu_ozone_font_scale;
Expand Down Expand Up @@ -1091,6 +1090,7 @@ typedef struct settings
char location_driver[32];
char cloud_sync_driver[32];
char menu_driver[32];
char menu_ozone_color_theme[32];
char cheevos_username[32];
char cheevos_token[32];
char cheevos_leaderboards_enable[32];
Expand Down
115 changes: 44 additions & 71 deletions menu/drivers/ozone.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ struct ozone_handle
unsigned selection_core_name_lines;
unsigned old_list_offset_y;
unsigned draw_entry_delay;
unsigned last_color_theme;
char last_color_theme[32];

uint32_t flags;

Expand Down Expand Up @@ -1783,60 +1783,38 @@ static void ozone_restart_cursor_animation(ozone_handle_t *ozone)
}

static void ozone_set_color_theme(ozone_handle_t *ozone,
unsigned color_theme)
{
const char *color_theme)
{
static const struct
{
const char *ident;
ozone_theme_t *theme;
} ozone_color_themes[] = {
{ "basic_white", &ozone_theme_light },
{ "basic_black", &ozone_theme_dark },
{ "nord", &ozone_theme_nord },
{ "gruvbox_dark", &ozone_theme_gruvbox_dark },
{ "boysenberry", &ozone_theme_boysenberry },
{ "hacking_the_kernel", &ozone_theme_hacking_the_kernel },
{ "twilight_zone", &ozone_theme_twilight_zone },
{ "dracula", &ozone_theme_dracula },
{ "solarized_dark", &ozone_theme_solarized_dark },
{ "solarized_light", &ozone_theme_solarized_light },
{ "gray_dark", &ozone_theme_gray_dark },
{ "gray_light", &ozone_theme_gray_light },
{ "purple_rain", &ozone_theme_purple_rain },
{ "selenium", &ozone_theme_selenium },
{ "evergarden", &ozone_theme_evergarden }
};
unsigned i;
ozone_theme_t *theme = ozone->default_theme;

switch (color_theme)
{
case OZONE_COLOR_THEME_BASIC_WHITE:
theme = &ozone_theme_light;
break;
case OZONE_COLOR_THEME_BASIC_BLACK:
theme = &ozone_theme_dark;
break;
case OZONE_COLOR_THEME_NORD:
theme = &ozone_theme_nord;
break;
case OZONE_COLOR_THEME_GRUVBOX_DARK:
theme = &ozone_theme_gruvbox_dark;
break;
case OZONE_COLOR_THEME_BOYSENBERRY:
theme = &ozone_theme_boysenberry;
break;
case OZONE_COLOR_THEME_HACKING_THE_KERNEL:
theme = &ozone_theme_hacking_the_kernel;
break;
case OZONE_COLOR_THEME_TWILIGHT_ZONE:
theme = &ozone_theme_twilight_zone;
break;
case OZONE_COLOR_THEME_DRACULA:
theme = &ozone_theme_dracula;
break;
case OZONE_COLOR_THEME_SELENIUM:
theme = &ozone_theme_selenium;
break;
case OZONE_COLOR_THEME_SOLARIZED_DARK:
theme = &ozone_theme_solarized_dark;
break;
case OZONE_COLOR_THEME_SOLARIZED_LIGHT:
theme = &ozone_theme_solarized_light;
break;
case OZONE_COLOR_THEME_GRAY_DARK:
theme = &ozone_theme_gray_dark;
break;
case OZONE_COLOR_THEME_GRAY_LIGHT:
theme = &ozone_theme_gray_light;
break;
case OZONE_COLOR_THEME_PURPLE_RAIN:
theme = &ozone_theme_purple_rain;
break;
case OZONE_COLOR_THEME_EVERGARDEN:
theme = &ozone_theme_evergarden;
break;
default:
for (i = 0; i < ARRAY_SIZE(ozone_color_themes); i++)
if (string_is_equal(color_theme, ozone_color_themes[i].ident))
{
theme = ozone_color_themes[i].theme;
break;
}
}

ozone->theme = theme;

Expand Down Expand Up @@ -1882,23 +1860,20 @@ static void ozone_set_color_theme(ozone_handle_t *ozone,
if (ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS || ozone->flags2 & OZONE_FLAG2_IGNORE_MISSING_ASSETS)
ozone_restart_cursor_animation(ozone);

ozone->last_color_theme = color_theme;
strlcpy(ozone->last_color_theme, color_theme, sizeof(ozone->last_color_theme));
}

static unsigned ozone_get_system_theme(void)
static const char *ozone_get_system_theme(void)
{
#ifdef HAVE_LIBNX
if (R_SUCCEEDED(setsysInitialize()))
{
ColorSetId theme;
unsigned ret = 0;
setsysGetColorSetId(&theme);
if (theme == ColorSetId_Dark)
ret = 1;
setsysExit();
return ret;
return (theme == ColorSetId_Dark) ? "basic_black" : "basic_white";
}
return 0;
return "basic_white";
#else
return DEFAULT_OZONE_COLOR_THEME;
#endif
Expand Down Expand Up @@ -3028,7 +3003,7 @@ static void ozone_reset_theme_textures(ozone_handle_t *ozone)
{
ozone_theme_t *theme = ozone_themes[j];

if (!theme->name || j != ozone->last_color_theme)
if (!theme->name || theme != ozone->theme)
continue;

fill_pathname_join_special(
Expand Down Expand Up @@ -9730,13 +9705,14 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
{
unsigned i;
bool fallback_color_theme = false;
unsigned width, height, color_theme = 0;
unsigned width, height;
ozone_handle_t *ozone = NULL;
settings_t *settings = config_get_ptr();
gfx_animation_t *p_anim = anim_get_ptr();
gfx_display_t *p_disp = disp_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
const char *color_theme = settings->arrays.menu_ozone_color_theme;
const char *directory_assets = settings->paths.directory_assets;

if (!menu)
Expand Down Expand Up @@ -9825,10 +9801,10 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
{
ColorSetId theme;
setsysGetColorSetId(&theme);
color_theme = (theme == ColorSetId_Dark) ? 1 : 0;
color_theme = (theme == ColorSetId_Dark) ? "basic_black" : "basic_white";
ozone_set_color_theme(ozone, color_theme);
configuration_set_uint(settings,
settings->uints.menu_ozone_color_theme, color_theme);
configuration_set_string(settings,
settings->arrays.menu_ozone_color_theme, color_theme);
configuration_set_bool(settings,
settings->bools.menu_preferred_system_color_theme_set, true);
setsysExit();
Expand All @@ -9841,10 +9817,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
fallback_color_theme = true;

if (fallback_color_theme)
{
color_theme = settings->uints.menu_ozone_color_theme;
ozone_set_color_theme(ozone, color_theme);
}

ozone->flags &= ~OZONE_FLAG_NEED_COMPUTE;
ozone->animations.scroll_y = 0.0f;
Expand Down Expand Up @@ -12464,7 +12437,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
bool ozone_last_use_preferred_system_color_theme;
ozone_handle_t* ozone = (ozone_handle_t*)data;
settings_t *settings = config_get_ptr();
unsigned color_theme = settings->uints.menu_ozone_color_theme;
const char *color_theme = settings->arrays.menu_ozone_color_theme;
bool use_preferred_system_color_theme = settings->bools.menu_use_preferred_system_color_theme;
uintptr_t messagebox_tag = (uintptr_t)ozone->pending_message;
bool draw_osk = menu_input_dialog_get_display_kb();
Expand Down Expand Up @@ -12578,14 +12551,14 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
ozone_last_use_preferred_system_color_theme =
ozone->flags2 & OZONE_FLAG2_LAST_USE_PREFERRED_SYSTEM_COLOR_THEME;

if ( (color_theme != ozone->last_color_theme)
if ( string_is_not_equal(color_theme, ozone->last_color_theme)
|| (ozone_last_use_preferred_system_color_theme != use_preferred_system_color_theme))
{
if (use_preferred_system_color_theme)
{
color_theme = ozone_get_system_theme();
configuration_set_uint(settings,
settings->uints.menu_ozone_color_theme, color_theme);
configuration_set_string(settings,
settings->arrays.menu_ozone_color_theme, color_theme);
}

ozone_set_color_theme(ozone, color_theme);
Expand Down
20 changes: 0 additions & 20 deletions menu/menu_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,26 +451,6 @@ enum rgui_particle_animation_effect
RGUI_PARTICLE_EFFECT_LAST
};

enum ozone_color_theme
{
OZONE_COLOR_THEME_BASIC_WHITE = 0,
OZONE_COLOR_THEME_BASIC_BLACK,
OZONE_COLOR_THEME_NORD,
OZONE_COLOR_THEME_GRUVBOX_DARK,
OZONE_COLOR_THEME_BOYSENBERRY,
OZONE_COLOR_THEME_HACKING_THE_KERNEL,
OZONE_COLOR_THEME_TWILIGHT_ZONE,
OZONE_COLOR_THEME_DRACULA,
OZONE_COLOR_THEME_SOLARIZED_DARK,
OZONE_COLOR_THEME_SOLARIZED_LIGHT,
OZONE_COLOR_THEME_GRAY_DARK,
OZONE_COLOR_THEME_GRAY_LIGHT,
OZONE_COLOR_THEME_PURPLE_RAIN,
OZONE_COLOR_THEME_SELENIUM,
OZONE_COLOR_THEME_EVERGARDEN,
OZONE_COLOR_THEME_LAST
};

enum ozone_header_icon
{
OZONE_HEADER_ICON_NONE = 0,
Expand Down
2 changes: 1 addition & 1 deletion menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -12609,7 +12609,7 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_XMB_THEME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_XMB_ALPHA_FACTOR, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME, PARSE_ONLY_STRING_OPTIONS, false},
{MENU_ENUM_LABEL_MATERIALUI_MENU_COLOR_THEME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_RGUI_MENU_COLOR_THEME, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_RGUI_MENU_THEME_PRESET, PARSE_ONLY_PATH, false},
Expand Down
Loading
Loading