XMB: Trigger bg-image load on theme change (#17599)

This commit is contained in:
sonninnos 2025-02-19 17:05:34 +02:00 committed by GitHub
parent 8bf7e76f45
commit b5e01422e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 36 deletions

View File

@ -1164,13 +1164,13 @@ static void xmb_render_messagebox_internal(
string_list_deinitialize(&list); string_list_deinitialize(&list);
} }
static char *xmb_path_dynamic_wallpaper(xmb_handle_t *xmb, static char *xmb_path_dynamic_wallpaper(xmb_handle_t *xmb)
bool menu_dynamic_wallpaper_enable,
unsigned xmb_color_theme,
const char *path_menu_wallpaper,
const char *dir_dynamic_wallpapers
)
{ {
settings_t *settings = config_get_ptr();
bool menu_dynamic_wallpaper_enable = settings->bools.menu_dynamic_wallpaper_enable;
unsigned xmb_color_theme = settings->uints.menu_xmb_color_theme;
const char *path_menu_wallpaper = settings->paths.path_menu_wallpaper;
const char *dir_dynamic_wallpapers = settings->paths.directory_dynamic_wallpapers;
char path[PATH_MAX_LENGTH]; char path[PATH_MAX_LENGTH];
unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN); unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN);
@ -1208,18 +1208,9 @@ static char *xmb_path_dynamic_wallpaper(xmb_handle_t *xmb,
return strdup(path); return strdup(path);
} }
static void xmb_update_dynamic_wallpaper(xmb_handle_t *xmb, bool reset, static void xmb_update_dynamic_wallpaper(xmb_handle_t *xmb, bool reset)
bool menu_dynamic_wallpaper_enable,
unsigned xmb_color_theme,
const char *path_menu_wallpaper,
const char *dir_dynamic_wallpapers)
{ {
const char *path = xmb_path_dynamic_wallpaper(xmb, const char *path = xmb_path_dynamic_wallpaper(xmb);
menu_dynamic_wallpaper_enable,
xmb_color_theme,
path_menu_wallpaper,
dir_dynamic_wallpapers
);
if (!string_is_equal(path, xmb->bg_file_path) || reset) if (!string_is_equal(path, xmb->bg_file_path) || reset)
{ {
@ -1229,16 +1220,14 @@ static void xmb_update_dynamic_wallpaper(xmb_handle_t *xmb, bool reset,
video_driver_supports_rgba(), 0, video_driver_supports_rgba(), 0,
menu_display_handle_wallpaper_upload, NULL); menu_display_handle_wallpaper_upload, NULL);
if (xmb->bg_file_path) free(xmb->bg_file_path);
free(xmb->bg_file_path);
xmb->bg_file_path = strdup(path); xmb->bg_file_path = strdup(path);
} }
else else
{ {
xmb_load_image(xmb, NULL, MENU_IMAGE_NONE); xmb_load_image(xmb, NULL, MENU_IMAGE_NONE);
if (xmb->bg_file_path) free(xmb->bg_file_path);
free(xmb->bg_file_path);
xmb->bg_file_path = NULL; xmb->bg_file_path = NULL;
} }
} }
@ -3165,12 +3154,7 @@ static void xmb_populate_entries(void *data,
xmb_unload_icon_thumbnail_textures(xmb); xmb_unload_icon_thumbnail_textures(xmb);
if (xmb->allow_dynamic_wallpaper) if (xmb->allow_dynamic_wallpaper)
xmb_update_dynamic_wallpaper(xmb, false, xmb_update_dynamic_wallpaper(xmb, false);
settings->bools.menu_dynamic_wallpaper_enable,
settings->uints.menu_xmb_color_theme,
settings->paths.path_menu_wallpaper,
settings->paths.directory_dynamic_wallpapers
);
/* Determine whether to show entry index */ /* Determine whether to show entry index */
xmb->entry_index_str[0] = '\0'; xmb->entry_index_str[0] = '\0';
@ -5597,6 +5581,7 @@ static enum menu_action xmb_parse_menu_entry_action(
|| xmb->want_fullscreen_thumbnails) || xmb->want_fullscreen_thumbnails)
{ {
xmb_hide_fullscreen_thumbnails(xmb, true); xmb_hide_fullscreen_thumbnails(xmb, true);
new_action = MENU_ACTION_NOOP;
} }
break; break;
case MENU_ACTION_SCAN: case MENU_ACTION_SCAN:
@ -6494,12 +6479,7 @@ static void xmb_context_reset_internal(xmb_handle_t *xmb,
xmb->assets_missing = false; xmb->assets_missing = false;
if (!xmb_context_reset_textures(xmb, iconpath, menu_xmb_theme)) if (!xmb_context_reset_textures(xmb, iconpath, menu_xmb_theme))
xmb->assets_missing = true; xmb->assets_missing = true;
xmb_update_dynamic_wallpaper(xmb, true, xmb_update_dynamic_wallpaper(xmb, true);
settings->bools.menu_dynamic_wallpaper_enable,
settings->uints.menu_xmb_color_theme,
settings->paths.path_menu_wallpaper,
settings->paths.directory_dynamic_wallpapers
);
/* Reset previous selection buffer */ /* Reset previous selection buffer */
if (xmb->depth > 2) if (xmb->depth > 2)
@ -9108,6 +9088,20 @@ static int xmb_list_bind_init(menu_file_list_cbs_t *cbs,
static int xmb_list_push(void *data, void *userdata, static int xmb_list_push(void *data, void *userdata,
menu_displaylist_info_t *info, unsigned type) menu_displaylist_info_t *info, unsigned type)
{ {
#if 1
switch (type)
{
case DISPLAYLIST_MENU_SETTINGS_LIST:
{
xmb_handle_t *xmb = (xmb_handle_t*)userdata;
xmb_update_dynamic_wallpaper(xmb, false);
break;
}
}
/* Use common lists for all drivers */
return -1;
#else
int ret = -1; int ret = -1;
core_info_list_t *list = NULL; core_info_list_t *list = NULL;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -9143,9 +9137,6 @@ static int xmb_list_push(void *data, void *userdata,
= settings->paths.menu_content_show_settings_password; = settings->paths.menu_content_show_settings_password;
const char *kiosk_mode_password = settings->paths.kiosk_mode_password; const char *kiosk_mode_password = settings->paths.kiosk_mode_password;
/* Use common lists for all drivers */
return -1;
switch (type) switch (type)
{ {
case DISPLAYLIST_LOAD_CONTENT_LIST: case DISPLAYLIST_LOAD_CONTENT_LIST:
@ -9403,6 +9394,7 @@ static int xmb_list_push(void *data, void *userdata,
break; break;
} }
return ret; return ret;
#endif
} }
static bool xmb_menu_init_list(void *data) static bool xmb_menu_init_list(void *data)

View File

@ -18785,6 +18785,8 @@ static bool setting_append_list(
general_write_handler, general_write_handler,
general_read_handler); general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].action_left = &setting_uint_action_left_with_refresh;
(*list)[list_info->index - 1].action_right = &setting_uint_action_right_with_refresh;
(*list)[list_info->index - 1].get_string_representation = (*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_xmb_menu_color_theme; &setting_get_string_representation_uint_xmb_menu_color_theme;
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);