mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Ensure that displayed thumbnails are always refreshed correctly after selecting 'Download Thumbnails' from quick menu
This commit is contained in:
parent
daad277b90
commit
98889e1652
@ -2788,6 +2788,7 @@ menu_ctx_driver_t menu_ctx_mui = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
menu_display_osk_ptr_at_pos,
|
||||
NULL, /* update_savestate_thumbnail_path */
|
||||
NULL, /* update_savestate_thumbnail_image */
|
||||
|
@ -91,6 +91,7 @@ menu_ctx_driver_t menu_ctx_null = {
|
||||
NULL, /* pointer_tap */
|
||||
NULL, /* update_thumbnail_path */
|
||||
NULL, /* update_thumbnail_image */
|
||||
NULL, /* refresh_thumbnail_image */
|
||||
NULL, /* set_thumbnail_system */
|
||||
NULL, /* get_thumbnail_system */
|
||||
NULL, /* set_thumbnail_content */
|
||||
|
@ -423,6 +423,20 @@ static void ozone_update_thumbnail_image(void *data)
|
||||
video_driver_texture_unload(&ozone->left_thumbnail);
|
||||
}
|
||||
|
||||
static void ozone_refresh_thumbnail_image(void *data)
|
||||
{
|
||||
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||
|
||||
if (!ozone)
|
||||
return;
|
||||
|
||||
/* Only refresh thumbnails if thumbnails are enabled
|
||||
* and we are currently viewing a playlist */
|
||||
if ((menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT)) &&
|
||||
(ozone->is_playlist && ozone->depth == 1))
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
|
||||
/* TODO: Scale text */
|
||||
static void ozone_context_reset(void *data, bool is_threaded)
|
||||
{
|
||||
@ -2338,6 +2352,7 @@ menu_ctx_driver_t menu_ctx_ozone = {
|
||||
ozone_pointer_tap,
|
||||
ozone_update_thumbnail_path,
|
||||
ozone_update_thumbnail_image,
|
||||
ozone_refresh_thumbnail_image,
|
||||
ozone_set_thumbnail_system,
|
||||
ozone_get_thumbnail_system,
|
||||
ozone_set_thumbnail_content,
|
||||
|
@ -4271,6 +4271,44 @@ static void rgui_update_thumbnail_image(void *userdata)
|
||||
rgui_scan_selected_entry_thumbnail(rgui, true);
|
||||
}
|
||||
|
||||
static void rgui_refresh_thumbnail_image(void *userdata)
|
||||
{
|
||||
rgui_t *rgui = (rgui_t*)userdata;
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (!rgui || !settings)
|
||||
return;
|
||||
|
||||
/* Only refresh thumbnails if thumbnails are enabled */
|
||||
if ((rgui->show_fs_thumbnail || settings->bools.menu_rgui_inline_thumbnails) &&
|
||||
(menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT)))
|
||||
{
|
||||
/* In all cases, reset current thumbnails */
|
||||
fs_thumbnail.width = 0;
|
||||
fs_thumbnail.height = 0;
|
||||
fs_thumbnail.is_valid = false;
|
||||
free(fs_thumbnail.path);
|
||||
fs_thumbnail.path = NULL;
|
||||
|
||||
mini_thumbnail.width = 0;
|
||||
mini_thumbnail.height = 0;
|
||||
mini_thumbnail.is_valid = false;
|
||||
free(mini_thumbnail.path);
|
||||
mini_thumbnail.path = NULL;
|
||||
|
||||
mini_left_thumbnail.width = 0;
|
||||
mini_left_thumbnail.height = 0;
|
||||
mini_left_thumbnail.is_valid = false;
|
||||
free(mini_left_thumbnail.path);
|
||||
mini_left_thumbnail.path = NULL;
|
||||
|
||||
/* Only load thumbnails if currently viewing a
|
||||
* playlist (note that thumbnails are loaded
|
||||
* immediately, for an optimal user experience) */
|
||||
if (rgui->is_playlist)
|
||||
rgui_scan_selected_entry_thumbnail(rgui, true);
|
||||
}
|
||||
}
|
||||
|
||||
static void rgui_update_menu_sublabel(rgui_t *rgui)
|
||||
{
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
@ -4689,6 +4727,7 @@ menu_ctx_driver_t menu_ctx_rgui = {
|
||||
rgui_pointer_tap,
|
||||
NULL, /* update_thumbnail_path */
|
||||
rgui_update_thumbnail_image,
|
||||
rgui_refresh_thumbnail_image,
|
||||
rgui_set_thumbnail_system,
|
||||
rgui_get_thumbnail_system,
|
||||
NULL, /* set_thumbnail_content */
|
||||
|
@ -1090,6 +1090,11 @@ static void stripes_update_thumbnail_image(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static void stripes_refresh_thumbnail_image(void *data)
|
||||
{
|
||||
stripes_update_thumbnail_image(data);
|
||||
}
|
||||
|
||||
static void stripes_set_thumbnail_system(void *data, char*s, size_t len)
|
||||
{
|
||||
stripes_handle_t *stripes = (stripes_handle_t*)data;
|
||||
@ -4451,6 +4456,7 @@ menu_ctx_driver_t menu_ctx_stripes = {
|
||||
stripes_pointer_tap,
|
||||
stripes_update_thumbnail_path,
|
||||
stripes_update_thumbnail_image,
|
||||
stripes_refresh_thumbnail_image,
|
||||
stripes_set_thumbnail_system,
|
||||
stripes_get_thumbnail_system,
|
||||
stripes_set_thumbnail_content,
|
||||
|
@ -248,6 +248,7 @@ typedef struct xmb_handle
|
||||
bool assets_missing;
|
||||
bool is_playlist;
|
||||
bool is_db_manager_list;
|
||||
bool is_quick_menu;
|
||||
|
||||
uint8_t system_tab_end;
|
||||
uint8_t tabs[XMB_SYSTEM_TAB_MAX_LENGTH];
|
||||
@ -1035,6 +1036,59 @@ static void xmb_update_thumbnail_image(void *data)
|
||||
video_driver_texture_unload(&xmb->left_thumbnail);
|
||||
}
|
||||
|
||||
static unsigned xmb_get_system_tab(xmb_handle_t *xmb, unsigned i)
|
||||
{
|
||||
if (i <= xmb->system_tab_end)
|
||||
{
|
||||
return xmb->tabs[i];
|
||||
}
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
static void xmb_refresh_thumbnail_image(void *data)
|
||||
{
|
||||
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
||||
|
||||
if (!xmb)
|
||||
return;
|
||||
|
||||
/* Only refresh thumbnails if thumbnails are enabled */
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||
{
|
||||
unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN);
|
||||
unsigned xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr);
|
||||
|
||||
/* Only refresh thumbnails if we are viewing a playlist or
|
||||
* the quick menu... */
|
||||
|
||||
/* If we are currently viewing a playlist, then it's almost inevitable
|
||||
* that we've just gone up a level from the quick menu. In this case,
|
||||
* xmb_set_thumbnail_system() will have been called, which resets
|
||||
* thumbnail path data. We therefore have to regenerate the thumbnail
|
||||
* paths... */
|
||||
if (((xmb_system_tab > XMB_SYSTEM_TAB_SETTINGS && depth == 1) ||
|
||||
(xmb_system_tab < XMB_SYSTEM_TAB_SETTINGS && depth == 4)) &&
|
||||
xmb->is_playlist)
|
||||
{
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT))
|
||||
xmb_update_thumbnail_path(xmb, 0 /* will be ignored */, 'R');
|
||||
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||
xmb_update_thumbnail_path(xmb, 0 /* will be ignored */, 'L');
|
||||
|
||||
xmb_update_thumbnail_image(xmb);
|
||||
}
|
||||
else if (xmb->is_quick_menu)
|
||||
{
|
||||
/* If this is the quick menu (most likely, since this is
|
||||
* where the 'download thumbnails' option is located),
|
||||
* then thumbnail paths are already valid - just need to
|
||||
* update images */
|
||||
xmb_update_thumbnail_image(xmb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void xmb_set_thumbnail_system(void *data, char*s, size_t len)
|
||||
{
|
||||
xmb_handle_t *xmb = (xmb_handle_t*)data;
|
||||
@ -1139,15 +1193,6 @@ static void xmb_update_savestate_thumbnail_image(void *data)
|
||||
video_driver_texture_unload(&xmb->savestate_thumbnail);
|
||||
}
|
||||
|
||||
static unsigned xmb_get_system_tab(xmb_handle_t *xmb, unsigned i)
|
||||
{
|
||||
if (i <= xmb->system_tab_end)
|
||||
{
|
||||
return xmb->tabs[i];
|
||||
}
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
static void xmb_selection_pointer_changed(
|
||||
xmb_handle_t *xmb, bool allow_animations)
|
||||
{
|
||||
@ -2192,6 +2237,9 @@ static void xmb_populate_entries(void *data,
|
||||
/* Determine whether this is a database manager list */
|
||||
xmb->is_db_manager_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST));
|
||||
|
||||
/* Determine whether this is the quick menu */
|
||||
xmb->is_quick_menu = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS));
|
||||
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL))
|
||||
{
|
||||
xmb_selection_pointer_changed(xmb, false);
|
||||
@ -5768,6 +5816,7 @@ menu_ctx_driver_t menu_ctx_xmb = {
|
||||
xmb_pointer_tap,
|
||||
xmb_update_thumbnail_path,
|
||||
xmb_update_thumbnail_image,
|
||||
xmb_refresh_thumbnail_image,
|
||||
xmb_set_thumbnail_system,
|
||||
xmb_get_thumbnail_system,
|
||||
xmb_set_thumbnail_content,
|
||||
|
@ -735,6 +735,7 @@ menu_ctx_driver_t menu_ctx_xui = {
|
||||
NULL, /* pointer_tap */
|
||||
NULL, /* update_thumbnail_path */
|
||||
NULL, /* update_thumbnail_image */
|
||||
NULL, /* refresh_thumbnail_image */
|
||||
NULL, /* set_thumbnail_system */
|
||||
NULL, /* get_thumbnail_system */
|
||||
NULL, /* set_thumbnail_content */
|
||||
|
@ -79,6 +79,7 @@ enum rarch_menu_ctl_state
|
||||
RARCH_MENU_CTL_BIND_INIT,
|
||||
RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH,
|
||||
RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE,
|
||||
RARCH_MENU_CTL_REFRESH_THUMBNAIL_IMAGE,
|
||||
RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH,
|
||||
RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE,
|
||||
MENU_NAVIGATION_CTL_CLEAR,
|
||||
|
@ -2553,6 +2553,13 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
menu_driver_ctx->update_thumbnail_image(menu_userdata);
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_REFRESH_THUMBNAIL_IMAGE:
|
||||
{
|
||||
if (!menu_driver_ctx || !menu_driver_ctx->refresh_thumbnail_image)
|
||||
return false;
|
||||
menu_driver_ctx->refresh_thumbnail_image(menu_userdata);
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH:
|
||||
{
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
@ -384,6 +384,7 @@ typedef struct menu_ctx_driver
|
||||
menu_entry_t *entry, unsigned action);
|
||||
void (*update_thumbnail_path)(void *data, unsigned i, char pos);
|
||||
void (*update_thumbnail_image)(void *data);
|
||||
void (*refresh_thumbnail_image)(void *data);
|
||||
void (*set_thumbnail_system)(void *data, char* s, size_t len);
|
||||
void (*get_thumbnail_system)(void *data, char* s, size_t len);
|
||||
void (*set_thumbnail_content)(void *data, const char *s);
|
||||
|
@ -232,16 +232,7 @@ static void cb_task_pl_thumbnail_refresh_menu(
|
||||
retro_task_t *task, void *task_data,
|
||||
void *user_data, const char *err)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
/* RGUI is a special case where update_thumbnail_image()
|
||||
* toggles fullscreen thumbnails - it should therefore
|
||||
* never be 'refreshed' like this */
|
||||
if(!string_is_equal(settings->arrays.menu_driver, "rgui"))
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
|
||||
menu_driver_ctl(RARCH_MENU_CTL_REFRESH_THUMBNAIL_IMAGE, NULL);
|
||||
}
|
||||
|
||||
/*******************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user