(XMB) Playlist entry index fixes (#14523)

This commit is contained in:
sonninnos 2022-10-17 00:46:27 +03:00 committed by GitHub
parent 415925c5dc
commit ababfcc0c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -399,6 +399,7 @@ typedef struct xmb_handle
/* Cached texts showing current entry index / current list size */
char entry_index_str[32];
char entry_index_offset;
/* These have to be huge, because runloop_st->name.savestate
* has a hard-coded size of 8192...
@ -1547,9 +1548,26 @@ static void xmb_selection_pointer_changed(
/* Update entry index text */
if (xmb->entry_idx_enabled)
snprintf(xmb->entry_index_str, sizeof(xmb->entry_index_str),
"%lu/%lu", (unsigned long)selection + 1,
{
size_t entry_idx_selection = selection + 1;
unsigned entry_idx_offset = xmb->entry_index_offset;
bool show_entry_idx = true;
if (xmb->is_explore_list)
{
if (entry_idx_selection > entry_idx_offset)
entry_idx_selection -= entry_idx_offset;
else
show_entry_idx = false;
}
if (!show_entry_idx)
xmb->entry_index_str[0] = '\0';
else
snprintf(xmb->entry_index_str, sizeof(xmb->entry_index_str),
"%lu/%lu", (unsigned long)entry_idx_selection,
(unsigned long)xmb->list_size);
}
ia = xmb->items_active_alpha;
iz = xmb->items_active_zoom;
@ -2589,7 +2607,9 @@ static void xmb_populate_entries(void *data,
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_IMAGES_LIST))
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_MUSIC_LIST))
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_VIDEO_LIST));
xmb->is_playlist = xmb->is_playlist && !string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL));
xmb->is_playlist = xmb->is_playlist &&
!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_INFORMATION)) &&
!string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RDB_ENTRY_DETAIL));
/* Determine whether this is a database manager list */
was_db_manager_list = xmb->is_db_manager_list && depth >= 4;
@ -2631,7 +2651,7 @@ 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_explore_list = show_entry_idx = false;
xmb->is_explore_list = false;
else if (!xmb->is_quick_menu)
xmb->skip_thumbnail_reset = true;
}
@ -2656,12 +2676,38 @@ static void xmb_populate_entries(void *data,
/* Determine whether to show entry index */
/* Update list size & entry index texts */
if ((xmb->entry_idx_enabled = show_entry_idx &&
!xmb->is_quick_menu &&
(xmb->is_playlist || xmb->is_explore_list)))
{
xmb->list_size = menu_entries_get_size();
snprintf(xmb->entry_index_str, sizeof(xmb->entry_index_str),
"%lu/%lu", (unsigned long)menu_navigation_get_selection() + 1,
(unsigned long)xmb->list_size);
size_t entry_idx_selection = menu_navigation_get_selection() + 1;
size_t list_size = menu_entries_get_size();
unsigned entry_idx_offset = 0;
if (xmb->is_explore_list)
{
entry_idx_offset = 2;
if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_EXPLORE_LIST)) ||
xmb_horizontal_type == MENU_EXPLORE_TAB)
entry_idx_offset = 1;
if (entry_idx_selection > entry_idx_offset)
entry_idx_selection -= entry_idx_offset;
else
show_entry_idx = false;
if (list_size >= entry_idx_offset)
list_size -= entry_idx_offset;
}
xmb->list_size = list_size;
xmb->entry_index_offset = entry_idx_offset;
if (!show_entry_idx)
xmb->entry_index_str[0] = '\0';
else
snprintf(xmb->entry_index_str, sizeof(xmb->entry_index_str),
"%lu/%lu", (unsigned long)entry_idx_selection,
(unsigned long)list_size);
}
/* By default, fullscreen thumbnails are only
@ -3725,20 +3771,24 @@ static int xmb_draw_item(
}
/* Draw entry index of current selection */
if (i == current && xmb->entry_idx_enabled)
if (i == current &&
xmb->entry_idx_enabled &&
!string_is_empty(xmb->entry_index_str))
{
float entry_idx_margin = 12 * xmb->last_scale_factor;
/* Calculate position depending on the current
* list and if Thumbnail Vertical Disposition
* is enabled (branchless version) */
float x_position = (
video_width - xmb->margins_title_left) *
video_width - entry_idx_margin) *
!menu_xmb_vertical_thumbnails +
(node->x + xmb->margins_screen_left +
xmb->icon_spacing_horizontal -
xmb->margins_label_left) *
menu_xmb_vertical_thumbnails;
float y_position = (
video_height - xmb->margins_title_bottom) *
video_height - entry_idx_margin) *
!menu_xmb_vertical_thumbnails +
(xmb->margins_screen_top + xmb->margins_label_top +
xmb->icon_spacing_vertical * xmb->active_item_factor) *