Skip to content

Commit

Permalink
Playlist + Explore corrections + cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos authored and LibretroAdmin committed Jul 24, 2023
1 parent 1b23ed1 commit 1805484
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 38 deletions.
5 changes: 5 additions & 0 deletions menu/cbs/menu_cbs_ok.c
Original file line number Diff line number Diff line change
Expand Up @@ -5839,6 +5839,11 @@ static int action_ok_delete_entry(const char *path,
menu_entries_pop_stack(&new_selection_ptr, 0, 1);
menu_st->selection_ptr = new_selection_ptr;

/* Thumbnail must be refreshed */
if (menu_st->driver_ctx && menu_st->driver_ctx->refresh_thumbnail_image)
menu_st->driver_ctx->refresh_thumbnail_image(
menu_st->userdata, new_selection_ptr);

return 0;
}

Expand Down
56 changes: 31 additions & 25 deletions menu/drivers/xmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,7 @@ static void xmb_refresh_thumbnail_image(void *data, unsigned i)
static void xmb_unload_thumbnail_textures(void *data)
{
xmb_handle_t *xmb = (xmb_handle_t*)data;

if (!xmb)
return;

Expand All @@ -1357,6 +1358,7 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
xmb_handle_t *xmb = (xmb_handle_t*)data;
struct menu_state *menu_st = menu_state_get_ptr();
size_t selection = menu_st->selection_ptr;

if (!xmb)
return;

Expand Down Expand Up @@ -1469,6 +1471,7 @@ static void xmb_update_savestate_thumbnail_image(void *data)
settings_t *settings = config_get_ptr();
unsigned thumbnail_upscale_threshold
= settings->uints.gfx_thumbnail_upscale_threshold;

if (!xmb || xmb->skip_thumbnail_reset)
return;

Expand Down Expand Up @@ -1686,7 +1689,7 @@ static void xmb_selection_pointer_changed(
static void xmb_list_open_old(xmb_handle_t *xmb,
file_list_t *list, int dir, size_t current)
{
unsigned i, height = 0;
unsigned i, height;
int threshold = xmb->icon_size * 10;
size_t end = list ? list->size : 0;

Expand All @@ -1708,7 +1711,7 @@ static void xmb_list_open_old(xmb_handle_t *xmb,

real_y = node->y + xmb->margins_screen_top;

if (real_y < -threshold || real_y > height+threshold)
if (real_y < -threshold || real_y > height + threshold)
{
node->alpha = ia;
node->label_alpha = 0;
Expand Down Expand Up @@ -1744,15 +1747,14 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
file_list_t *list, int dir, size_t current)
{
unsigned i, height;
unsigned xmb_system_tab = 0;
size_t skip = 0;
int threshold = xmb->icon_size * 10;
size_t end = list ? list->size : 0;
settings_t *settings = config_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr();
bool savestate_thumbnail_enable = settings
? settings->bools.savestate_thumbnail_enable
: false;
? settings->bools.savestate_thumbnail_enable
: false;

video_driver_get_size(NULL, &height);

Expand Down Expand Up @@ -1821,22 +1823,21 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
}

menu_st->entries.begin = skip;
xmb_system_tab = xmb_get_system_tab(xmb,
(unsigned)xmb->categories_selection_ptr);

if (xmb_system_tab <= XMB_SYSTEM_TAB_SETTINGS && xmb->depth > xmb->old_depth)
if ( gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)
|| gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
{
if ( gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)
|| gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
if (xmb->is_playlist || xmb->is_db_manager_list || xmb->is_explore_list)
{
if (xmb->is_playlist || xmb->is_db_manager_list || xmb->is_explore_list)
{
if (!(xmb->is_db_manager_list && xmb->depth > 4))
xmb_unload_thumbnail_textures(xmb);
if ( !(xmb->is_db_manager_list && xmb->depth > 4)
&& !xmb->skip_thumbnail_reset)
xmb_unload_thumbnail_textures(xmb);

xmb_set_thumbnail_content(xmb, NULL);
xmb_update_thumbnail_image(xmb);
}
xmb_set_thumbnail_content(xmb, NULL);
xmb_update_thumbnail_image(xmb);

if (!xmb->is_explore_list)
xmb->skip_thumbnail_reset = false;
}
}

Expand Down Expand Up @@ -2673,12 +2674,18 @@ static void xmb_populate_entries(void *data,
bool show_entry_idx = settings
? settings->bools.playlist_show_entry_idx : false;
bool was_db_manager_list = false;
static unsigned depth_prev = 0;
unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN);
int depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN);

if (!xmb)
return;

xmb->skip_thumbnail_reset = false;
if (xmb->is_quick_menu && depth < xmb->old_depth)
xmb->skip_thumbnail_reset = true;

xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr);
xmb_horizontal_type = (xmb_system_tab == UINT_MAX ? xmb_get_horizontal_selection_type(xmb) : 0);

/* Determine whether this is a playlist */
xmb->is_playlist =
(depth == 1
Expand Down Expand Up @@ -2716,7 +2723,6 @@ static void xmb_populate_entries(void *data,
was_db_manager_list = xmb->is_db_manager_list && depth >= 4;
xmb->is_db_manager_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST));

xmb->skip_thumbnail_reset = false;
if (was_db_manager_list)
{
xmb->is_db_manager_list = true;
Expand Down Expand Up @@ -2752,12 +2758,11 @@ static void xmb_populate_entries(void *data,
{
/* Quick Menu under Explore list must also be Quick Menu */
xmb->is_quick_menu |= menu_is_nonrunning_quick_menu() || menu_is_running_quick_menu();

if (!menu_explore_is_content_list() || xmb->is_quick_menu)
xmb->is_explore_list = false;
else if (!xmb->is_quick_menu && depth < depth_prev)
else if (!xmb->is_quick_menu && depth < xmb->old_depth)
xmb->skip_thumbnail_reset = true;
else
xmb->skip_thumbnail_reset = false;

/* 'is_playlist' must be cleared for 'xmb_set_thumbnail_content' */
if (xmb->is_explore_list)
Expand All @@ -2780,8 +2785,6 @@ static void xmb_populate_entries(void *data,
else
xmb_list_open(xmb);

depth_prev = depth;

xmb_set_title(xmb);
if (menu_dynamic_wallpaper_enable)
xmb_update_dynamic_wallpaper(xmb);
Expand Down Expand Up @@ -6848,6 +6851,7 @@ static void xmb_context_bg_destroy(xmb_handle_t *xmb)
{
if (!xmb)
return;

video_driver_texture_unload(&xmb->textures.bg);
gfx_display_deinit_white_texture();
}
Expand Down Expand Up @@ -7433,12 +7437,14 @@ static void xmb_context_reset(void *data, bool is_threaded)

if (xmb)
xmb_context_reset_internal(xmb, is_threaded, true);

video_driver_monitor_reset();
}

static void xmb_navigation_clear(void *data, bool pending_push)
{
xmb_handle_t *xmb = (xmb_handle_t*)data;

if (!pending_push)
xmb_selection_pointer_changed(xmb, true);
}
Expand Down
14 changes: 14 additions & 0 deletions menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -3828,6 +3828,20 @@ static int menu_displaylist_parse_horizontal_content_actions(
break;
}

/* Remove 'Remove' from Explore lists for now since it does not work correctly */
if (remove_entry_enabled)
{
struct menu_state *menu_st = menu_state_get_ptr();
menu_list_t *menu_list = menu_st->entries.list;
file_list_t *menu_stack = MENU_LIST_GET(menu_list, 0);
struct item_file *stack_top = menu_stack->list;
size_t depth = menu_stack->size;
unsigned current_type = (depth > 0 ? stack_top[depth - 1].type : 0);

if (current_type)
remove_entry_enabled = false;
}

if (remove_entry_enabled)
menu_entries_append(list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DELETE_ENTRY),
Expand Down
18 changes: 9 additions & 9 deletions playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ bool playlist_content_path_is_valid(const char *path)

/**
* playlist_push:
* @playlist : Playlist handle.
* @playlist : Playlist handle.
*
* Push entry to top of playlist.
**/
Expand Down Expand Up @@ -2054,7 +2054,7 @@ void playlist_free(playlist_t *playlist)

/**
* playlist_clear:
* @playlist : Playlist handle.
* @playlist : Playlist handle.
*
* Clears all playlist entries in playlist.
**/
Expand All @@ -2076,7 +2076,7 @@ void playlist_clear(playlist_t *playlist)

/**
* playlist_size:
* @playlist : Playlist handle.
* @playlist : Playlist handle.
*
* Gets size of playlist.
* Returns: size of playlist.
Expand All @@ -2090,7 +2090,7 @@ size_t playlist_size(playlist_t *playlist)

/**
* playlist_capacity:
* @playlist : Playlist handle.
* @playlist : Playlist handle.
*
* Gets maximum capacity of playlist.
* Returns: maximum capacity of playlist.
Expand Down Expand Up @@ -2488,10 +2488,10 @@ static bool playlist_read_file(playlist_t *playlist)
* non-whitespace ASCII character */
do
{
/* Read error or EOF (end of file) */
/* Read error or EOF (end of file) */
if ((test_char = intfstream_getc(file)) == EOF)
goto end;
}while (!isgraph(test_char) || test_char > 0x7F);
} while (!isgraph(test_char) || test_char > 0x7F);

playlist->old_format = (test_char != '{');

Expand Down Expand Up @@ -2780,7 +2780,7 @@ bool playlist_init_cached(const playlist_config_t *config)

/**
* playlist_init:
* @config : Playlist configuration object.
* @config : Playlist configuration object.
*
* Creates and initializes a playlist.
*
Expand Down Expand Up @@ -3173,8 +3173,8 @@ void playlist_get_db_name(playlist_t *playlist, size_t idx,
* (i.e. ignore history/favourites) */
if (
!string_is_empty(conf_path_basename)
&& !string_ends_with_size(conf_path_basename, "_history.lpl",
strlen(conf_path_basename), STRLEN_CONST("_history.lpl"))
&& !string_is_equal(conf_path_basename,
FILE_PATH_CONTENT_HISTORY)
&& !string_is_equal(conf_path_basename,
FILE_PATH_CONTENT_FAVORITES)
)
Expand Down
11 changes: 7 additions & 4 deletions retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -3503,7 +3503,7 @@ bool command_event(enum event_command cmd, void *data)
runloop_msg_queue_push(
msg_hash_to_str(MSG_ADD_TO_FAVORITES_FAILED), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
return false;
return true;
}

if (str_list)
Expand Down Expand Up @@ -3533,11 +3533,12 @@ bool command_event(enum event_command cmd, void *data)
playlist_qsort(g_defaults.content_favorites);

playlist_write_file(g_defaults.content_favorites);
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(
msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
}
}

break;
}
case CMD_EVENT_RESET_CORE_ASSOCIATION:
Expand Down Expand Up @@ -3567,7 +3568,9 @@ bool command_event(enum event_command cmd, void *data)
menu_st->userdata, i);
#endif

runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
runloop_msg_queue_push(
msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL,
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break;
}
case CMD_EVENT_RESTART_RETROARCH:
Expand Down

0 comments on commit 1805484

Please sign in to comment.