(XMB+Ozone) Thumbnail behavior adjustments (#14980)

This commit is contained in:
sonninnos 2023-02-14 21:35:56 +02:00 committed by GitHub
parent c3526132ad
commit 54b28f941d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 98 additions and 28 deletions

View File

@ -7830,6 +7830,20 @@ static void ozone_start_cursor_wiggle(
ozone->flags2 |= OZONE_FLAG2_CURSOR_WIGGLING; ozone->flags2 |= OZONE_FLAG2_CURSOR_WIGGLING;
} }
static void ozone_set_thumbnail_delay(bool on)
{
if (on)
{
gfx_thumbnail_set_stream_delay(OZONE_THUMBNAIL_STREAM_DELAY);
gfx_thumbnail_set_fade_duration(-1.0f);
}
else
{
gfx_thumbnail_set_stream_delay(0);
gfx_thumbnail_set_fade_duration(1);
}
}
/* Common thumbnail switch requires FILE_TYPE_RPL_ENTRY, /* Common thumbnail switch requires FILE_TYPE_RPL_ENTRY,
* which only works with playlists, therefore activate it * which only works with playlists, therefore activate it
* manually for Quick Menu, Explore and Database */ * manually for Quick Menu, Explore and Database */
@ -7900,11 +7914,13 @@ static enum menu_action ozone_parse_menu_entry_action(
{ {
ozone_show_fullscreen_thumbnails(ozone); ozone_show_fullscreen_thumbnails(ozone);
ozone->flags2 |= OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS; ozone->flags2 |= OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS;
ozone_set_thumbnail_delay(false);
new_action = MENU_ACTION_NOOP; new_action = MENU_ACTION_NOOP;
} }
else if ((ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) else if ((ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)
|| (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS)) || (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS))
{ {
ozone_set_thumbnail_delay(true);
ozone_hide_fullscreen_thumbnails(ozone, true); ozone_hide_fullscreen_thumbnails(ozone, true);
ozone->flags2 &= ~OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS; ozone->flags2 &= ~OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS;
new_action = MENU_ACTION_NOOP; new_action = MENU_ACTION_NOOP;
@ -8090,8 +8106,10 @@ static enum menu_action ozone_parse_menu_entry_action(
&& (ozone->flags & OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE) && (ozone->flags & OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE)
&& (ozone->show_thumbnail_bar)) && (ozone->show_thumbnail_bar))
{ {
ozone_show_fullscreen_thumbnails(ozone); if (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)
ozone->flags2 |= OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS; ozone_hide_fullscreen_thumbnails(ozone, true);
else
ozone_show_fullscreen_thumbnails(ozone);
new_action = MENU_ACTION_NOOP; new_action = MENU_ACTION_NOOP;
break; break;
} }
@ -8099,6 +8117,7 @@ static enum menu_action ozone_parse_menu_entry_action(
if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)
|| (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS)) || (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS))
{ {
ozone_set_thumbnail_delay(true);
ozone_hide_fullscreen_thumbnails(ozone, true); ozone_hide_fullscreen_thumbnails(ozone, true);
ozone->flags2 &= ~OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS; ozone->flags2 &= ~OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS;
if ( (!(ozone->flags & OZONE_FLAG_IS_STATE_SLOT)) if ( (!(ozone->flags & OZONE_FLAG_IS_STATE_SLOT))
@ -8153,6 +8172,7 @@ static enum menu_action ozone_parse_menu_entry_action(
if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) if ( (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)
|| (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS)) || (ozone->flags2 & OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS))
{ {
ozone_set_thumbnail_delay(true);
ozone_hide_fullscreen_thumbnails(ozone, true); ozone_hide_fullscreen_thumbnails(ozone, true);
ozone->flags &= ~OZONE_FLAG_SKIP_THUMBNAIL_RESET; ozone->flags &= ~OZONE_FLAG_SKIP_THUMBNAIL_RESET;
ozone->flags2 &= ~OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS; ozone->flags2 &= ~OZONE_FLAG2_WANT_FULLSCREEN_THUMBNAILS;
@ -10256,6 +10276,7 @@ static void ozone_draw_footer(
ozone_metadata_override_available(ozone, settings); ozone_metadata_override_available(ozone, settings);
bool thumbnail_cycle_enabled = bool thumbnail_cycle_enabled =
fullscreen_thumbnails_available && fullscreen_thumbnails_available &&
!(ozone->flags & OZONE_FLAG_IS_FILE_LIST) &&
!((ozone->is_quick_menu && menu_is_running_quick_menu()) !((ozone->is_quick_menu && menu_is_running_quick_menu())
|| (ozone->flags & OZONE_FLAG_IS_STATE_SLOT)); || (ozone->flags & OZONE_FLAG_IS_STATE_SLOT));
bool clear_setting_enabled = bool clear_setting_enabled =

View File

@ -4370,6 +4370,7 @@ static void xmb_show_fullscreen_thumbnails(
{ {
gfx_animation_ctx_entry_t animation_entry; gfx_animation_ctx_entry_t animation_entry;
const char *core_name = NULL; const char *core_name = NULL;
bool animate = !xmb->want_fullscreen_thumbnails;
uintptr_t alpha_tag = (uintptr_t) uintptr_t alpha_tag = (uintptr_t)
&xmb->fullscreen_thumbnail_alpha; &xmb->fullscreen_thumbnail_alpha;
@ -4437,14 +4438,19 @@ static void xmb_show_fullscreen_thumbnails(
xmb->title_name) == 0) xmb->title_name) == 0)
xmb->fullscreen_thumbnail_label[0] = '\0'; xmb->fullscreen_thumbnail_label[0] = '\0';
/* Configure fade in animation */ if (animate)
animation_entry.easing_enum = EASING_OUT_QUAD; {
animation_entry.tag = alpha_tag; /* Configure fade in animation */
animation_entry.duration = gfx_thumb_get_ptr()->fade_duration; animation_entry.easing_enum = EASING_OUT_QUAD;
animation_entry.target_value = 1.0f; animation_entry.tag = alpha_tag;
animation_entry.subject = &xmb->fullscreen_thumbnail_alpha; animation_entry.duration = gfx_thumb_get_ptr()->fade_duration;
animation_entry.cb = NULL; animation_entry.target_value = 1.0f;
animation_entry.userdata = NULL; animation_entry.subject = &xmb->fullscreen_thumbnail_alpha;
animation_entry.cb = NULL;
animation_entry.userdata = NULL;
}
else
xmb->fullscreen_thumbnail_alpha = 1.0f;
/* Push animation */ /* Push animation */
gfx_animation_push(&animation_entry); gfx_animation_push(&animation_entry);
@ -4471,6 +4477,20 @@ static bool INLINE xmb_fullscreen_thumbnails_available(xmb_handle_t *xmb)
return ret; return ret;
} }
static void xmb_set_thumbnail_delay(bool on)
{
if (on)
{
gfx_thumbnail_set_stream_delay(XMB_THUMBNAIL_STREAM_DELAY);
gfx_thumbnail_set_fade_duration(-1.0f);
}
else
{
gfx_thumbnail_set_stream_delay(0);
gfx_thumbnail_set_fade_duration(1);
}
}
/* Common thumbnail switch requires FILE_TYPE_RPL_ENTRY, /* Common thumbnail switch requires FILE_TYPE_RPL_ENTRY,
* which only works with playlists, therefore activate it * which only works with playlists, therefore activate it
* manually for Quick Menu, Explore and Database */ * manually for Quick Menu, Explore and Database */
@ -4552,10 +4572,12 @@ static enum menu_action xmb_parse_menu_entry_action(
xmb_hide_fullscreen_thumbnails(xmb, false); xmb_hide_fullscreen_thumbnails(xmb, false);
xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection()); xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection());
xmb->want_fullscreen_thumbnails = true; xmb->want_fullscreen_thumbnails = true;
xmb_set_thumbnail_delay(false);
new_action = MENU_ACTION_NOOP; new_action = MENU_ACTION_NOOP;
} }
else if (xmb->show_fullscreen_thumbnails || xmb->want_fullscreen_thumbnails) else if (xmb->show_fullscreen_thumbnails || xmb->want_fullscreen_thumbnails)
{ {
xmb_set_thumbnail_delay(true);
xmb_hide_fullscreen_thumbnails(xmb, true); xmb_hide_fullscreen_thumbnails(xmb, true);
xmb->want_fullscreen_thumbnails = false; xmb->want_fullscreen_thumbnails = false;
} }
@ -4590,16 +4612,20 @@ static enum menu_action xmb_parse_menu_entry_action(
/* Open fullscreen thumbnail with Ok when core is running /* Open fullscreen thumbnail with Ok when core is running
to prevent accidental imageviewer core launch */ to prevent accidental imageviewer core launch */
if (xmb->libretro_running && xmb->is_file_list && if ( xmb->libretro_running
xmb->fullscreen_thumbnails_available) && xmb->is_file_list
&& xmb_fullscreen_thumbnails_available(xmb))
{ {
xmb_hide_fullscreen_thumbnails(xmb, false); if (xmb->show_fullscreen_thumbnails)
xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection()); xmb_hide_fullscreen_thumbnails(xmb, true);
new_action = MENU_ACTION_NOOP; else
xmb_show_fullscreen_thumbnails(xmb, menu_navigation_get_selection());
return MENU_ACTION_NOOP;
} }
if (xmb->show_fullscreen_thumbnails || xmb->want_fullscreen_thumbnails) if (xmb->show_fullscreen_thumbnails || xmb->want_fullscreen_thumbnails)
{ {
xmb_set_thumbnail_delay(true);
xmb_hide_fullscreen_thumbnails(xmb, true); xmb_hide_fullscreen_thumbnails(xmb, true);
xmb->want_fullscreen_thumbnails = false; xmb->want_fullscreen_thumbnails = false;
if (!xmb->is_state_slot && !xmb->is_playlist && !xmb->is_explore_list) if (!xmb->is_state_slot && !xmb->is_playlist && !xmb->is_explore_list)
@ -4612,6 +4638,7 @@ static enum menu_action xmb_parse_menu_entry_action(
if (xmb->show_fullscreen_thumbnails || xmb->want_fullscreen_thumbnails) if (xmb->show_fullscreen_thumbnails || xmb->want_fullscreen_thumbnails)
{ {
xmb_set_thumbnail_delay(true);
xmb_hide_fullscreen_thumbnails(xmb, true); xmb_hide_fullscreen_thumbnails(xmb, true);
xmb->want_fullscreen_thumbnails = false; xmb->want_fullscreen_thumbnails = false;
return MENU_ACTION_NOOP; return MENU_ACTION_NOOP;
@ -5154,6 +5181,11 @@ static void xmb_draw_fullscreen_thumbnails(
unsigned xmb_color_theme, unsigned xmb_color_theme,
settings_t *settings, size_t selection) settings_t *settings, size_t selection)
{ {
static float right_thumbnail_draw_width_prev = 0.0f;
static float right_thumbnail_draw_height_prev = 0.0f;
static float left_thumbnail_draw_width_prev = 0.0f;
static float left_thumbnail_draw_height_prev = 0.0f;
/* Check whether fullscreen thumbnails are visible */ /* Check whether fullscreen thumbnails are visible */
if (xmb->fullscreen_thumbnail_alpha > 0.0f || xmb->want_fullscreen_thumbnails) if (xmb->fullscreen_thumbnail_alpha > 0.0f || xmb->want_fullscreen_thumbnails)
{ {
@ -5233,8 +5265,12 @@ static void xmb_draw_fullscreen_thumbnails(
left_thumbnail = &xmb->thumbnails.left; left_thumbnail = &xmb->thumbnails.left;
/* Get number of 'active' thumbnails */ /* Get number of 'active' thumbnails */
show_right_thumbnail = (right_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE); show_right_thumbnail = (
show_left_thumbnail = (left_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE); right_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE
|| right_thumbnail->status == GFX_THUMBNAIL_STATUS_PENDING);
show_left_thumbnail = (
left_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE
|| left_thumbnail->status == GFX_THUMBNAIL_STATUS_PENDING);
if ((xmb->is_quick_menu && !string_is_empty(xmb->savestate_thumbnail_file_path)) || if ((xmb->is_quick_menu && !string_is_empty(xmb->savestate_thumbnail_file_path)) ||
xmb->is_state_slot) xmb->is_state_slot)
@ -5296,31 +5332,49 @@ static void xmb_draw_fullscreen_thumbnails(
* layout until we have thumbnail draw dimensions. * layout until we have thumbnail draw dimensions.
* and we cannot get draw dimensions until we have * and we cannot get draw dimensions until we have
* the bounding box dimensions... */ * the bounding box dimensions... */
if (show_right_thumbnail) if ( show_right_thumbnail
&& right_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE)
{ {
gfx_thumbnail_get_draw_dimensions( gfx_thumbnail_get_draw_dimensions(
right_thumbnail, right_thumbnail,
thumbnail_box_width, thumbnail_box_height, 1.0f, thumbnail_box_width, thumbnail_box_height, 1.0f,
&right_thumbnail_draw_width, &right_thumbnail_draw_height); &right_thumbnail_draw_width, &right_thumbnail_draw_height);
right_thumbnail_draw_width_prev = right_thumbnail_draw_width;
right_thumbnail_draw_height_prev = right_thumbnail_draw_height;
/* Sanity check */ /* Sanity check */
if ((right_thumbnail_draw_width <= 0.0f) || if ((right_thumbnail_draw_width <= 0.0f) ||
(right_thumbnail_draw_height <= 0.0f)) (right_thumbnail_draw_height <= 0.0f))
goto error; goto error;
} }
else if (right_thumbnail->status == GFX_THUMBNAIL_STATUS_PENDING)
{
right_thumbnail_draw_width = right_thumbnail_draw_width_prev;
right_thumbnail_draw_height = right_thumbnail_draw_height_prev;
}
if (show_left_thumbnail) if ( show_left_thumbnail
&& left_thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE)
{ {
gfx_thumbnail_get_draw_dimensions( gfx_thumbnail_get_draw_dimensions(
left_thumbnail, left_thumbnail,
thumbnail_box_width, thumbnail_box_height, 1.0f, thumbnail_box_width, thumbnail_box_height, 1.0f,
&left_thumbnail_draw_width, &left_thumbnail_draw_height); &left_thumbnail_draw_width, &left_thumbnail_draw_height);
left_thumbnail_draw_width_prev = left_thumbnail_draw_width;
left_thumbnail_draw_height_prev = left_thumbnail_draw_height;
/* Sanity check */ /* Sanity check */
if ((left_thumbnail_draw_width <= 0.0f) || if ((left_thumbnail_draw_width <= 0.0f) ||
(left_thumbnail_draw_height <= 0.0f)) (left_thumbnail_draw_height <= 0.0f))
goto error; goto error;
} }
else if (left_thumbnail->status == GFX_THUMBNAIL_STATUS_PENDING)
{
left_thumbnail_draw_width = left_thumbnail_draw_width_prev;
left_thumbnail_draw_height = left_thumbnail_draw_height_prev;
}
/* Adjust thumbnail draw positions to achieve /* Adjust thumbnail draw positions to achieve
* uniform appearance (accounting for actual * uniform appearance (accounting for actual
@ -6676,28 +6730,23 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
xmb->fullscreen_thumbnail_selection = 0; xmb->fullscreen_thumbnail_selection = 0;
xmb->fullscreen_thumbnail_label[0] = '\0'; xmb->fullscreen_thumbnail_label[0] = '\0';
xmb->thumbnails.pending = xmb->thumbnails.pending = XMB_PENDING_THUMBNAIL_NONE;
XMB_PENDING_THUMBNAIL_NONE;
gfx_thumbnail_set_stream_delay(XMB_THUMBNAIL_STREAM_DELAY); gfx_thumbnail_set_stream_delay(XMB_THUMBNAIL_STREAM_DELAY);
gfx_thumbnail_set_fade_duration(-1.0f); gfx_thumbnail_set_fade_duration(-1.0f);
gfx_thumbnail_set_fade_missing(false); gfx_thumbnail_set_fade_missing(false);
xmb->use_ps3_layout = xmb->use_ps3_layout =
xmb_use_ps3_layout(settings->uints.menu_xmb_layout, xmb_use_ps3_layout(settings->uints.menu_xmb_layout, width, height);
width, height);
xmb->last_use_ps3_layout = xmb->use_ps3_layout; xmb->last_use_ps3_layout = xmb->use_ps3_layout;
xmb->last_scale_factor = xmb_get_scale_factor( xmb->last_scale_factor = xmb_get_scale_factor(
settings->floats.menu_scale_factor, settings->floats.menu_scale_factor,
xmb->use_ps3_layout, width); xmb->use_ps3_layout, width);
p_anim->updatetime_cb = p_anim->updatetime_cb = xmb_menu_animation_update_time;
xmb_menu_animation_update_time;
/* set word_wrap function pointer */ /* set word_wrap function pointer */
xmb->word_wrap = xmb->word_wrap =
msg_hash_get_wideglyph_str() msg_hash_get_wideglyph_str() ? word_wrap_wideglyph : word_wrap;
? word_wrap_wideglyph
: word_wrap;
return menu; return menu;