mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Allow On-Demand Thumbnails in Explore menu (#14385)
This commit is contained in:
parent
788d602ec7
commit
c4c55077a1
@ -42,6 +42,7 @@ struct gfx_thumbnail_path_data
|
||||
{
|
||||
enum playlist_thumbnail_mode playlist_right_mode;
|
||||
enum playlist_thumbnail_mode playlist_left_mode;
|
||||
size_t playlist_index;
|
||||
char system[PATH_MAX_LENGTH];
|
||||
char content_path[PATH_MAX_LENGTH];
|
||||
char content_label[PATH_MAX_LENGTH];
|
||||
@ -319,9 +320,9 @@ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data,
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Sets current thumbnail content according to the specified label and optional database name.
|
||||
/* Sets current thumbnail content according to the specified label.
|
||||
* Returns true if content is valid */
|
||||
bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label, const char *db_name)
|
||||
bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label)
|
||||
{
|
||||
if (!path_data)
|
||||
return false;
|
||||
@ -341,6 +342,7 @@ bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char
|
||||
/* Must also reset playlist thumbnail display modes */
|
||||
path_data->playlist_right_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT;
|
||||
path_data->playlist_left_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT;
|
||||
path_data->playlist_index = 0;
|
||||
|
||||
if (string_is_empty(label))
|
||||
return false;
|
||||
@ -355,10 +357,6 @@ bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char
|
||||
* Just use label value (it doesn't matter) */
|
||||
strlcpy(path_data->content_path, label, sizeof(path_data->content_path));
|
||||
|
||||
/* Database name required for Explore thumbnails */
|
||||
if (!string_is_empty(db_name))
|
||||
strlcpy(path_data->content_db_name, db_name, sizeof(path_data->content_db_name));
|
||||
|
||||
/* Redundant error check... */
|
||||
return !string_is_empty(path_data->content_img);
|
||||
}
|
||||
@ -389,6 +387,7 @@ bool gfx_thumbnail_set_content_image(
|
||||
/* Must also reset playlist thumbnail display modes */
|
||||
path_data->playlist_right_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT;
|
||||
path_data->playlist_left_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT;
|
||||
path_data->playlist_index = 0;
|
||||
|
||||
if (string_is_empty(img_dir) || string_is_empty(img_name))
|
||||
return false;
|
||||
@ -462,6 +461,7 @@ bool gfx_thumbnail_set_content_playlist(
|
||||
/* Must also reset playlist thumbnail display modes */
|
||||
path_data->playlist_right_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT;
|
||||
path_data->playlist_left_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT;
|
||||
path_data->playlist_index = 0;
|
||||
|
||||
if (!playlist)
|
||||
return false;
|
||||
@ -506,6 +506,9 @@ bool gfx_thumbnail_set_content_playlist(
|
||||
|
||||
/* Determine content image name */
|
||||
fill_content_img(path_data);
|
||||
|
||||
/* Store playlist index */
|
||||
path_data->playlist_index = idx;
|
||||
|
||||
/* Redundant error check... */
|
||||
if (string_is_empty(path_data->content_img))
|
||||
@ -821,3 +824,10 @@ bool gfx_thumbnail_get_content_dir(
|
||||
|
||||
return !string_is_empty(content_dir);
|
||||
}
|
||||
|
||||
/* Fetches current playlist index. */
|
||||
size_t gfx_thumbnail_get_playlist_index(
|
||||
gfx_thumbnail_path_data_t *path_data)
|
||||
{
|
||||
return (path_data) ? path_data->playlist_index : 0;
|
||||
}
|
||||
|
@ -85,9 +85,9 @@ bool gfx_thumbnail_is_enabled(gfx_thumbnail_path_data_t *path_data, enum gfx_thu
|
||||
* associated database name */
|
||||
bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data, const char *system, playlist_t *playlist);
|
||||
|
||||
/* Sets current thumbnail content according to the specified label and optional database name.
|
||||
/* Sets current thumbnail content according to the specified label.
|
||||
* Returns true if content is valid */
|
||||
bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label, const char *db_name);
|
||||
bool gfx_thumbnail_set_content(gfx_thumbnail_path_data_t *path_data, const char *label);
|
||||
|
||||
/* Sets current thumbnail content to the specified image.
|
||||
* Returns true if content is valid */
|
||||
@ -149,6 +149,9 @@ bool gfx_thumbnail_get_img_name(gfx_thumbnail_path_data_t *path_data, const char
|
||||
* Returns true if content directory is valid. */
|
||||
bool gfx_thumbnail_get_content_dir(gfx_thumbnail_path_data_t *path_data, char *content_dir, size_t len);
|
||||
|
||||
/* Fetches current playlist index. */
|
||||
size_t gfx_thumbnail_get_playlist_index(gfx_thumbnail_path_data_t *path_data);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -7083,7 +7083,7 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (!string_is_empty(entry.path))
|
||||
gfx_thumbnail_set_content(ozone->thumbnail_path_data, entry.path, NULL);
|
||||
gfx_thumbnail_set_content(ozone->thumbnail_path_data, entry.path);
|
||||
}
|
||||
}
|
||||
#if defined(HAVE_LIBRETRODB)
|
||||
@ -7093,7 +7093,6 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
|
||||
if (string_is_empty(s))
|
||||
{
|
||||
menu_entry_t entry;
|
||||
const char *db_name;
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
MENU_ENTRY_INIT(entry);
|
||||
@ -7101,20 +7100,40 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
|
||||
entry.rich_label_enabled = false;
|
||||
entry.value_enabled = false;
|
||||
entry.sublabel_enabled = false;
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (!entry.type)
|
||||
/* First entry */
|
||||
menu_entry_get(&entry, 0, 0, NULL, true);
|
||||
if (string_is_empty(entry.path))
|
||||
return;
|
||||
|
||||
db_name = menu_explore_get_entry_database(entry.type);
|
||||
/* No thumbnails for intermediate lists without playlist items */
|
||||
if (!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) &&
|
||||
!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
|
||||
{
|
||||
gfx_thumbnail_set_content_playlist(ozone->thumbnail_path_data, NULL, 0);
|
||||
ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string_is_empty(entry.path) && !string_is_empty(db_name))
|
||||
gfx_thumbnail_set_content(ozone->thumbnail_path_data,
|
||||
entry.path,
|
||||
db_name);
|
||||
/* Selected entry */
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
if (string_is_empty(entry.path))
|
||||
return;
|
||||
|
||||
ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available =
|
||||
(!string_is_empty(db_name) && menu_explore_get_entry_icon(entry.type));
|
||||
/* No thumbnails for header non-items */
|
||||
if (string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) ||
|
||||
string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
|
||||
{
|
||||
gfx_thumbnail_set_content_playlist(ozone->thumbnail_path_data, NULL, 0);
|
||||
ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ozone->want_thumbnail_bar = ozone->fullscreen_thumbnails_available =
|
||||
(menu_explore_set_entry_playlist_index(entry.type, ozone->thumbnail_path_data) >= 0 &&
|
||||
menu_explore_get_entry_icon(entry.type));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -7147,7 +7166,7 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
|
||||
* the sublevels of database manager lists.
|
||||
* Showing thumbnails on database entries is a
|
||||
* pointless nuisance and a waste of CPU cycles, IMHO... */
|
||||
gfx_thumbnail_set_content(ozone->thumbnail_path_data, s, NULL);
|
||||
gfx_thumbnail_set_content(ozone->thumbnail_path_data, s);
|
||||
}
|
||||
|
||||
ozone_update_content_metadata(ozone);
|
||||
@ -8129,8 +8148,7 @@ static void ozone_refresh_thumbnail_image(void *data, unsigned i)
|
||||
if (!i)
|
||||
ozone_update_content_metadata(ozone);
|
||||
|
||||
/* Only refresh thumbnails if thumbnails are enabled
|
||||
* and we are currently viewing a playlist */
|
||||
/* Only refresh thumbnails if thumbnails are enabled */
|
||||
if ((gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) ||
|
||||
gfx_thumbnail_is_enabled(ozone->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) &&
|
||||
ozone->want_thumbnail_bar &&
|
||||
@ -9223,7 +9241,8 @@ static void ozone_render(void *data,
|
||||
menu_navigation_set_selection(i);
|
||||
|
||||
/* If this is a playlist, must update thumbnails */
|
||||
if (ozone->is_playlist && (ozone->depth == 1 || ozone->depth == 4))
|
||||
if ((ozone->is_playlist && (ozone->depth == 1 || ozone->depth == 4)) ||
|
||||
ozone->is_explore_list)
|
||||
{
|
||||
ozone->skip_thumbnail_reset = false;
|
||||
ozone_set_thumbnail_content(ozone, "");
|
||||
@ -9335,6 +9354,10 @@ static void ozone_render(void *data,
|
||||
unsigned gfx_thumbnail_upscale_threshold = settings->uints.gfx_thumbnail_upscale_threshold;
|
||||
bool network_on_demand_thumbnails = settings->bools.network_on_demand_thumbnails;
|
||||
|
||||
/* Explore list needs cached selection index */
|
||||
if (ozone->is_explore_list)
|
||||
selection = gfx_thumbnail_get_playlist_index(ozone->thumbnail_path_data);
|
||||
|
||||
switch (ozone->thumbnails.pending)
|
||||
{
|
||||
case OZONE_PENDING_THUMBNAIL_BOTH:
|
||||
@ -10133,7 +10156,7 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
|
||||
* content + right/left thumbnails
|
||||
* (otherwise last loaded thumbnail will
|
||||
* persist, and be shown on the wrong entry) */
|
||||
gfx_thumbnail_set_content(ozone->thumbnail_path_data, NULL, NULL);
|
||||
gfx_thumbnail_set_content(ozone->thumbnail_path_data, NULL);
|
||||
ozone_unload_thumbnail_textures(ozone);
|
||||
update_thumbnails = true;
|
||||
ozone->want_thumbnail_bar = false;
|
||||
|
@ -6523,11 +6523,17 @@ static void rgui_load_current_thumbnails(rgui_t *rgui, bool download_missing)
|
||||
/* On demand thumbnail downloads */
|
||||
if (thumbnails_missing && download_missing)
|
||||
{
|
||||
const char *system = NULL;
|
||||
const char *system = NULL;
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
/* Explore list needs cached selection index */
|
||||
if (rgui->is_explore_list)
|
||||
selection = gfx_thumbnail_get_playlist_index(rgui->thumbnail_path_data);
|
||||
|
||||
if (gfx_thumbnail_get_system(rgui->thumbnail_path_data, &system))
|
||||
task_push_pl_entry_thumbnail_download(system,
|
||||
playlist_get_cached(), (unsigned)menu_navigation_get_selection(),
|
||||
playlist, (unsigned)selection,
|
||||
false, true);
|
||||
}
|
||||
#endif
|
||||
@ -6704,33 +6710,43 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load)
|
||||
(selection < list_size))
|
||||
{
|
||||
menu_entry_t entry;
|
||||
const char *db_name;
|
||||
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
entry.value_enabled = false;
|
||||
entry.sublabel_enabled = false;
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (!entry.type)
|
||||
/* First entry */
|
||||
menu_entry_get(&entry, 0, 0, NULL, true);
|
||||
if (string_is_empty(entry.path))
|
||||
return;
|
||||
|
||||
db_name = menu_explore_get_entry_database(entry.type);
|
||||
|
||||
if (!string_is_empty(entry.path) && !string_is_empty(db_name))
|
||||
/* No thumbnails for intermediate lists without playlist items */
|
||||
if (!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) &&
|
||||
!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
|
||||
{
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
const struct playlist_entry *playlist_entry = NULL;
|
||||
size_t playlist_index =
|
||||
menu_explore_get_entry_playlist_index(list->list[selection].type, &playlist, &playlist_entry);
|
||||
gfx_thumbnail_set_content_playlist(rgui->thumbnail_path_data, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
rgui->playlist_index = playlist_index;
|
||||
/* Selected entry */
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
if (string_is_empty(entry.path))
|
||||
return;
|
||||
|
||||
gfx_thumbnail_set_content(rgui->thumbnail_path_data, entry.path, db_name);
|
||||
/* No thumbnails for header non-items */
|
||||
if (string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) ||
|
||||
string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
|
||||
{
|
||||
gfx_thumbnail_set_content_playlist(rgui->thumbnail_path_data, NULL, 0);
|
||||
return;
|
||||
}
|
||||
else
|
||||
gfx_thumbnail_set_content(rgui->thumbnail_path_data, NULL, NULL);
|
||||
{
|
||||
rgui->playlist_index =
|
||||
menu_explore_set_entry_playlist_index(entry.type, rgui->thumbnail_path_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1300,20 +1300,10 @@ static void xmb_refresh_thumbnail_image(void *data, unsigned i)
|
||||
return;
|
||||
|
||||
/* Only refresh thumbnails if thumbnails are enabled */
|
||||
if ( gfx_thumbnail_is_enabled(xmb->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) ||
|
||||
gfx_thumbnail_is_enabled(xmb->thumbnail_path_data, GFX_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 (((((xmb_system_tab > XMB_SYSTEM_TAB_SETTINGS && depth == 1) ||
|
||||
(xmb_system_tab < XMB_SYSTEM_TAB_SETTINGS && depth == 4)) &&
|
||||
xmb->is_playlist)) ||
|
||||
xmb->is_quick_menu)
|
||||
xmb_update_thumbnail_image(xmb);
|
||||
}
|
||||
if ((gfx_thumbnail_is_enabled(xmb->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) ||
|
||||
gfx_thumbnail_is_enabled(xmb->thumbnail_path_data, GFX_THUMBNAIL_LEFT)) &&
|
||||
(xmb->is_quick_menu || xmb->is_playlist || xmb->is_explore_list))
|
||||
xmb_update_thumbnail_image(xmb);
|
||||
}
|
||||
|
||||
static void xmb_set_thumbnail_system(void *data, char*s, size_t len)
|
||||
@ -1407,7 +1397,7 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
|
||||
|
||||
if (!string_is_empty(entry.path))
|
||||
{
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data, entry.path, NULL);
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data, entry.path);
|
||||
xmb->fullscreen_thumbnails_available = true;
|
||||
}
|
||||
}
|
||||
@ -1419,7 +1409,6 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
|
||||
if (string_is_empty(s))
|
||||
{
|
||||
menu_entry_t entry;
|
||||
const char *db_name;
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
MENU_ENTRY_INIT(entry);
|
||||
@ -1427,20 +1416,40 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
|
||||
entry.rich_label_enabled = false;
|
||||
entry.value_enabled = false;
|
||||
entry.sublabel_enabled = false;
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (!entry.type)
|
||||
/* First entry */
|
||||
menu_entry_get(&entry, 0, 0, NULL, true);
|
||||
if (string_is_empty(entry.path))
|
||||
return;
|
||||
|
||||
db_name = menu_explore_get_entry_database(entry.type);
|
||||
/* No thumbnails for intermediate lists without playlist items */
|
||||
if (!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) &&
|
||||
!string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
|
||||
{
|
||||
gfx_thumbnail_set_content_playlist(xmb->thumbnail_path_data, NULL, 0);
|
||||
xmb->fullscreen_thumbnails_available = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string_is_empty(entry.path) && !string_is_empty(db_name))
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data,
|
||||
entry.path,
|
||||
db_name);
|
||||
/* Selected entry */
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
if (string_is_empty(entry.path))
|
||||
return;
|
||||
|
||||
xmb->fullscreen_thumbnails_available =
|
||||
(!string_is_empty(db_name) && menu_explore_get_entry_icon(entry.type));
|
||||
/* No thumbnails for header non-items */
|
||||
if (string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADD_ADDITIONAL_FILTER)) ||
|
||||
string_is_equal(entry.path, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_SEARCH_NAME)))
|
||||
{
|
||||
gfx_thumbnail_set_content_playlist(xmb->thumbnail_path_data, NULL, 0);
|
||||
xmb->fullscreen_thumbnails_available = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmb->fullscreen_thumbnails_available =
|
||||
(menu_explore_set_entry_playlist_index(entry.type, xmb->thumbnail_path_data) >= 0 &&
|
||||
menu_explore_get_entry_icon(entry.type));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1477,7 +1486,7 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
|
||||
* the sublevels of database manager lists.
|
||||
* Showing thumbnails on database entries is a
|
||||
* pointless nuisance and a waste of CPU cycles, IMHO... */
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data, s, NULL);
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data, s);
|
||||
xmb->fullscreen_thumbnails_available = true;
|
||||
}
|
||||
}
|
||||
@ -1622,7 +1631,7 @@ static void xmb_selection_pointer_changed(
|
||||
* persist, and be shown on the wrong entry) */
|
||||
xmb->fullscreen_thumbnails_available = false;
|
||||
xmb->thumbnails.pending = XMB_PENDING_THUMBNAIL_NONE;
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data, NULL, NULL);
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data, NULL);
|
||||
gfx_thumbnail_cancel_pending_requests();
|
||||
gfx_thumbnail_reset(&xmb->thumbnails.right);
|
||||
gfx_thumbnail_reset(&xmb->thumbnails.left);
|
||||
@ -2697,7 +2706,7 @@ static void xmb_populate_entries(void *data,
|
||||
{
|
||||
xmb->fullscreen_thumbnails_available = false;
|
||||
xmb->thumbnails.pending = XMB_PENDING_THUMBNAIL_NONE;
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data, NULL, NULL);
|
||||
gfx_thumbnail_set_content(xmb->thumbnail_path_data, NULL);
|
||||
gfx_thumbnail_cancel_pending_requests();
|
||||
gfx_thumbnail_reset(&xmb->thumbnails.right);
|
||||
gfx_thumbnail_reset(&xmb->thumbnails.left);
|
||||
@ -4557,6 +4566,10 @@ static void xmb_render(void *data,
|
||||
unsigned gfx_thumbnail_upscale_threshold = settings->uints.gfx_thumbnail_upscale_threshold;
|
||||
bool network_on_demand_thumbnails = settings->bools.network_on_demand_thumbnails;
|
||||
|
||||
/* Explore list needs cached selection index */
|
||||
if (xmb->is_explore_list)
|
||||
selection = gfx_thumbnail_get_playlist_index(xmb->thumbnail_path_data);
|
||||
|
||||
switch (xmb->thumbnails.pending)
|
||||
{
|
||||
case XMB_PENDING_THUMBNAIL_BOTH:
|
||||
|
@ -1141,6 +1141,20 @@ int menu_entries_get_title(char *s, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get current menu label */
|
||||
int menu_entries_get_label(char *s, size_t len)
|
||||
{
|
||||
struct menu_state *menu_st = &menu_driver_state;
|
||||
const file_list_t *list = MENU_LIST_GET(menu_st->entries.list, 0);
|
||||
|
||||
if (list && list->size)
|
||||
{
|
||||
strlcpy(s, list->list[list->size - 1].label, len);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Used to close an active message box (help or info)
|
||||
* TODO/FIXME: The way that message boxes are handled
|
||||
* is complete garbage. generic_menu_iterate() and
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "menu_shader.h"
|
||||
#include "../gfx/gfx_animation.h"
|
||||
#include "../gfx/gfx_display.h"
|
||||
|
||||
#include "../gfx/gfx_thumbnail_path.h"
|
||||
#include "../gfx/font_driver.h"
|
||||
#include "../performance_counters.h"
|
||||
|
||||
@ -668,6 +668,8 @@ const char *menu_explore_get_entry_database(unsigned type);
|
||||
ssize_t menu_explore_get_entry_playlist_index(unsigned type,
|
||||
playlist_t **playlist,
|
||||
const struct playlist_entry **entry);
|
||||
ssize_t menu_explore_set_entry_playlist_index(unsigned type,
|
||||
gfx_thumbnail_path_data_t *thumbnail_path_data);
|
||||
void menu_explore_context_init(void);
|
||||
void menu_explore_context_deinit(void);
|
||||
void menu_explore_free_state(explore_state_t *state);
|
||||
|
@ -160,6 +160,8 @@ typedef struct menu_entry
|
||||
|
||||
int menu_entries_get_title(char *title, size_t title_len);
|
||||
|
||||
int menu_entries_get_label(char *label, size_t label_len);
|
||||
|
||||
int menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
|
||||
|
||||
file_list_t *menu_entries_get_selection_buf_ptr(size_t idx);
|
||||
|
@ -1330,6 +1330,9 @@ ssize_t menu_explore_get_entry_playlist_index(unsigned type,
|
||||
{
|
||||
*playlist_entry = entry;
|
||||
*playlist = p;
|
||||
|
||||
/* Playlist needs to get cached for on-demand thumbnails */
|
||||
playlist_set_cached_external(p);
|
||||
return j;
|
||||
}
|
||||
}
|
||||
@ -1338,6 +1341,30 @@ ssize_t menu_explore_get_entry_playlist_index(unsigned type,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t menu_explore_set_entry_playlist_index(unsigned type,
|
||||
gfx_thumbnail_path_data_t *thumbnail_path_data)
|
||||
{
|
||||
const char *db_name;
|
||||
ssize_t playlist_index = -1;
|
||||
playlist_t *playlist = NULL;
|
||||
const struct playlist_entry *playlist_entry = NULL;
|
||||
|
||||
db_name = menu_explore_get_entry_database(type);
|
||||
if (!string_is_empty(db_name))
|
||||
playlist_index = menu_explore_get_entry_playlist_index(type, &playlist, &playlist_entry);
|
||||
|
||||
if (playlist_index >= 0 && playlist && playlist_entry)
|
||||
{
|
||||
gfx_thumbnail_set_system(thumbnail_path_data, db_name, playlist);
|
||||
gfx_thumbnail_set_content_playlist(thumbnail_path_data,
|
||||
playlist, playlist_index);
|
||||
return playlist_index;
|
||||
}
|
||||
|
||||
gfx_thumbnail_set_content_playlist(thumbnail_path_data, NULL, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void menu_explore_context_init(void)
|
||||
{
|
||||
if (!explore_state)
|
||||
|
@ -578,6 +578,17 @@ static void cb_task_pl_entry_thumbnail_refresh_menu(
|
||||
else
|
||||
#endif
|
||||
{
|
||||
char str[255];
|
||||
menu_entries_get_label(str, sizeof(str));
|
||||
|
||||
/* Explore menu selection index does not match playlist index even in System list. */
|
||||
if (string_is_equal(str, msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_TAB)))
|
||||
{
|
||||
if (!string_is_equal(pl_thumb->playlist_path,
|
||||
playlist_get_conf_path(current_playlist)))
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (((pl_thumb->list_index != menu_navigation_get_selection()) &&
|
||||
(pl_thumb->list_index != menu->rpl_entry_selection_ptr)) ||
|
||||
!string_is_equal(pl_thumb->playlist_path,
|
||||
|
Loading…
x
Reference in New Issue
Block a user