1
0
mirror of https://github.com/libretro/RetroArch synced 2025-04-18 14:42:30 +00:00

(XMB+Ozone) Animation corrections ()

This commit is contained in:
sonninnos 2023-08-25 23:02:19 +03:00 committed by GitHub
parent 2bb955fe19
commit 2623f8d085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 327 additions and 247 deletions

@ -61,11 +61,14 @@
#include "../../content.h" #include "../../content.h"
#include "../../core_info.h" #include "../../core_info.h"
#define ANIMATION_PUSH_ENTRY_DURATION 166 #define ANIMATION_PUSH_ENTRY_DURATION 166.66667f
#define ANIMATION_CURSOR_DURATION 133 #define ANIMATION_CURSOR_DURATION 166.66667f
#define ANIMATION_CURSOR_PULSE 500 #define ANIMATION_CURSOR_PULSE 166.66667f * 3
#define OZONE_THUMBNAIL_STREAM_DELAY 5 * 16.66667f #define OZONE_THUMBNAIL_STREAM_DELAY 16.66667f * 5
#define OZONE_EASING_ALPHA EASING_OUT_CIRC
#define OZONE_EASING_XY EASING_OUT_QUAD
#define FONT_SIZE_FOOTER 18 #define FONT_SIZE_FOOTER 18
#define FONT_SIZE_TITLE 36 #define FONT_SIZE_TITLE 36
@ -1523,7 +1526,7 @@ static void ozone_animate_cursor(ozone_handle_t *ozone,
int i; int i;
gfx_animation_ctx_entry_t entry; gfx_animation_ctx_entry_t entry;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_XY;
entry.tag = (uintptr_t)&ozone_default_theme; entry.tag = (uintptr_t)&ozone_default_theme;
entry.duration = ANIMATION_CURSOR_PULSE; entry.duration = ANIMATION_CURSOR_PULSE;
entry.userdata = ozone; entry.userdata = ozone;
@ -3740,7 +3743,7 @@ static void ozone_entries_update_thumbnail_bar(
ozone->flags &= ~OZONE_FLAG_IS_STATE_SLOT; ozone->flags &= ~OZONE_FLAG_IS_STATE_SLOT;
entry.duration = ANIMATION_CURSOR_DURATION; entry.duration = ANIMATION_CURSOR_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_XY;
entry.tag = tag; entry.tag = tag;
entry.subject = &ozone->animations.thumbnail_bar_position; entry.subject = &ozone->animations.thumbnail_bar_position;
@ -3890,7 +3893,7 @@ static void ozone_sidebar_update_collapse(
bool collapse = false; bool collapse = false;
uintptr_t tag = (uintptr_t)&ozone->sidebar_collapsed; uintptr_t tag = (uintptr_t)&ozone->sidebar_collapsed;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_XY;
entry.tag = tag; entry.tag = tag;
entry.userdata = ozone; entry.userdata = ozone;
entry.duration = ANIMATION_CURSOR_DURATION; entry.duration = ANIMATION_CURSOR_DURATION;
@ -3994,7 +3997,7 @@ static void ozone_go_to_sidebar(
entry.cb = NULL; entry.cb = NULL;
entry.duration = ANIMATION_CURSOR_DURATION; entry.duration = ANIMATION_CURSOR_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_ALPHA;
entry.subject = &ozone->animations.cursor_alpha; entry.subject = &ozone->animations.cursor_alpha;
entry.tag = tag; entry.tag = tag;
entry.target_value = 1.0f; entry.target_value = 1.0f;
@ -4291,7 +4294,7 @@ static void ozone_leave_sidebar(
entry.cb = NULL; entry.cb = NULL;
entry.duration = ANIMATION_CURSOR_DURATION; entry.duration = ANIMATION_CURSOR_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_ALPHA;
entry.subject = &ozone->animations.cursor_alpha; entry.subject = &ozone->animations.cursor_alpha;
entry.tag = tag; entry.tag = tag;
entry.target_value = 1.0f; entry.target_value = 1.0f;
@ -4304,7 +4307,6 @@ static void ozone_leave_sidebar(
#ifdef HAVE_AUDIOMIXER #ifdef HAVE_AUDIOMIXER
audio_driver_mixer_play_scroll_sound(true); audio_driver_mixer_play_scroll_sound(true);
#endif #endif
} }
static void ozone_free_node(ozone_node_t *node) static void ozone_free_node(ozone_node_t *node)
@ -4564,7 +4566,7 @@ static void ozone_sidebar_goto(
entry.cb = NULL; entry.cb = NULL;
entry.duration = ANIMATION_CURSOR_DURATION; entry.duration = ANIMATION_CURSOR_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_ALPHA;
entry.subject = &ozone->animations.cursor_alpha; entry.subject = &ozone->animations.cursor_alpha;
entry.tag = tag; entry.tag = tag;
entry.target_value = 1.0f; entry.target_value = 1.0f;
@ -4575,7 +4577,7 @@ static void ozone_sidebar_goto(
/* Scroll animation */ /* Scroll animation */
entry.cb = NULL; entry.cb = NULL;
entry.duration = ANIMATION_CURSOR_DURATION; entry.duration = ANIMATION_CURSOR_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_XY;
entry.subject = &ozone->animations.scroll_y_sidebar; entry.subject = &ozone->animations.scroll_y_sidebar;
entry.tag = tag; entry.tag = tag;
entry.target_value = ozone_sidebar_get_scroll_y(ozone, video_info_height); entry.target_value = ozone_sidebar_get_scroll_y(ozone, video_info_height);
@ -5300,7 +5302,7 @@ static void ozone_update_scroll(
entry.cb = NULL; entry.cb = NULL;
entry.duration = ANIMATION_CURSOR_DURATION; entry.duration = ANIMATION_CURSOR_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_ALPHA;
entry.subject = &ozone->animations.cursor_alpha; entry.subject = &ozone->animations.cursor_alpha;
entry.tag = tag; entry.tag = tag;
entry.target_value = 1.0f; entry.target_value = 1.0f;
@ -5311,7 +5313,7 @@ static void ozone_update_scroll(
/* Scroll animation */ /* Scroll animation */
entry.cb = NULL; entry.cb = NULL;
entry.duration = ANIMATION_CURSOR_DURATION; entry.duration = ANIMATION_CURSOR_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_ALPHA;
entry.subject = &ozone->animations.scroll_y; entry.subject = &ozone->animations.scroll_y;
entry.tag = tag; entry.tag = tag;
entry.target_value = new_scroll; entry.target_value = new_scroll;
@ -5326,6 +5328,27 @@ static void ozone_update_scroll(
} }
} }
static unsigned ozone_get_sublabel_max_width(ozone_handle_t *ozone,
unsigned video_info_width,
unsigned entry_padding)
{
settings_t *settings = config_get_ptr();
float menu_scale_factor = settings->floats.menu_scale_factor;
unsigned sublabel_max_width = video_info_width - (menu_scale_factor * (entry_padding * 2));
if (ozone->depth == 1)
sublabel_max_width -= (unsigned) ozone->dimensions_sidebar_width;
if (ozone->show_thumbnail_bar)
{
if (ozone->is_quick_menu && menu_is_running_quick_menu())
sublabel_max_width -= ozone->dimensions.thumbnail_bar_width - entry_padding * 2;
else
sublabel_max_width -= ozone->dimensions.thumbnail_bar_width - entry_padding;
}
return sublabel_max_width;
}
static void ozone_compute_entries_position( static void ozone_compute_entries_position(
ozone_handle_t *ozone, ozone_handle_t *ozone,
bool menu_show_sublabels, bool menu_show_sublabels,
@ -5397,21 +5420,10 @@ static void ozone_compute_entries_position(
{ {
if (!string_is_empty(entry.sublabel)) if (!string_is_empty(entry.sublabel))
{ {
int sublabel_max_width; unsigned sublabel_max_width = ozone_get_sublabel_max_width(ozone, video_info_width, entry_padding);
char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH]; char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH];
wrapped_sublabel_str[0] = '\0'; wrapped_sublabel_str[0] = '\0';
node->height += ozone->dimensions.entry_spacing + 40 * scale_factor;
sublabel_max_width = video_info_width
- entry_padding * 2
- ozone->dimensions.entry_icon_padding * 2;
if (ozone->depth == 1)
sublabel_max_width -= (unsigned) ozone->dimensions_sidebar_width;
if (ozone->show_thumbnail_bar)
sublabel_max_width -= ozone->dimensions.thumbnail_bar_width - entry_padding * 2;
(ozone->word_wrap)(wrapped_sublabel_str, (ozone->word_wrap)(wrapped_sublabel_str,
sizeof(wrapped_sublabel_str), sizeof(wrapped_sublabel_str),
entry.sublabel, entry.sublabel,
@ -5421,6 +5433,7 @@ static void ozone_compute_entries_position(
0); 0);
node->sublabel_lines = ozone_count_lines(wrapped_sublabel_str); node->sublabel_lines = ozone_count_lines(wrapped_sublabel_str);
node->height += ozone->dimensions.entry_spacing + 40 * scale_factor;
if (node->sublabel_lines > 1) if (node->sublabel_lines > 1)
{ {
@ -5642,7 +5655,6 @@ border_iterate:
{ {
char rich_label[255]; char rich_label[255];
char entry_value_ticker[255]; char entry_value_ticker[255];
char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH];
uintptr_t texture; uintptr_t texture;
menu_entry_t entry; menu_entry_t entry;
gfx_animation_ctx_ticker_t ticker; gfx_animation_ctx_ticker_t ticker;
@ -5750,17 +5762,8 @@ border_iterate:
{ {
if (node->wrap && !string_is_empty(sublabel_str)) if (node->wrap && !string_is_empty(sublabel_str))
{ {
int sublabel_max_width = video_info_width - entry_padding * 2 - ozone->dimensions.entry_icon_padding * 2; unsigned sublabel_max_width = ozone_get_sublabel_max_width(ozone, video_info_width, entry_padding);
char wrapped_sublabel_str[MENU_SUBLABEL_MAX_LENGTH];
if (ozone->depth == 1)
sublabel_max_width -= (unsigned)ozone->dimensions_sidebar_width;
if (ozone->show_thumbnail_bar)
{
if (ozone->is_quick_menu && menu_is_running_quick_menu())
sublabel_max_width -= ozone->dimensions.thumbnail_bar_width - entry_padding * 2;
else
sublabel_max_width -= ozone->dimensions.thumbnail_bar_width - entry_padding;
}
wrapped_sublabel_str[0] = '\0'; wrapped_sublabel_str[0] = '\0';
(ozone->word_wrap)(wrapped_sublabel_str, (ozone->word_wrap)(wrapped_sublabel_str,
@ -5770,6 +5773,7 @@ border_iterate:
sublabel_max_width / ozone->fonts.entries_sublabel.glyph_width, sublabel_max_width / ozone->fonts.entries_sublabel.glyph_width,
ozone->fonts.entries_sublabel.wideglyph_width, ozone->fonts.entries_sublabel.wideglyph_width,
0); 0);
sublabel_str = wrapped_sublabel_str; sublabel_str = wrapped_sublabel_str;
} }
} }
@ -6128,8 +6132,7 @@ static void ozone_draw_thumbnail_bar(
&& gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT); && gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT);
show_left_thumbnail = show_left_thumbnail =
(ozone->thumbnails.left.status != GFX_THUMBNAIL_STATUS_MISSING) (ozone->thumbnails.left.status != GFX_THUMBNAIL_STATUS_MISSING)
&& gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT) && gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT);
&& (!(ozone->flags2 & OZONE_FLAG2_SELECTION_CORE_IS_VIEWER));
/* Special "viewer" mode for savestate thumbnails */ /* Special "viewer" mode for savestate thumbnails */
if ( ((ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR) && !string_is_empty(ozone->savestate_thumbnail_file_path)) if ( ((ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR) && !string_is_empty(ozone->savestate_thumbnail_file_path))
@ -6163,7 +6166,7 @@ static void ozone_draw_thumbnail_bar(
* and no right thumbnail is available, show a centred * and no right thumbnail is available, show a centred
* message and return immediately */ * message and return immediately */
if ( (ozone->flags2 & OZONE_FLAG2_SELECTION_CORE_IS_VIEWER) if ( (ozone->flags2 & OZONE_FLAG2_SELECTION_CORE_IS_VIEWER)
&& (!show_right_thumbnail)) && (!show_right_thumbnail && !show_left_thumbnail))
{ {
ozone_draw_no_thumbnail_available( ozone_draw_no_thumbnail_available(
ozone, ozone,
@ -7001,11 +7004,11 @@ static void ozone_hide_fullscreen_thumbnails(ozone_handle_t *ozone, bool animate
gfx_animation_ctx_entry_t animation_entry; gfx_animation_ctx_entry_t animation_entry;
/* Configure fade out animation */ /* Configure fade out animation */
animation_entry.easing_enum = EASING_OUT_QUAD; animation_entry.easing_enum = OZONE_EASING_ALPHA;
animation_entry.tag = alpha_tag;
animation_entry.duration = gfx_thumb_get_ptr()->fade_duration; animation_entry.duration = gfx_thumb_get_ptr()->fade_duration;
animation_entry.target_value = 0.0f;
animation_entry.subject = &ozone->animations.fullscreen_thumbnail_alpha; animation_entry.subject = &ozone->animations.fullscreen_thumbnail_alpha;
animation_entry.tag = alpha_tag;
animation_entry.target_value = 0.0f;
animation_entry.cb = NULL; animation_entry.cb = NULL;
animation_entry.userdata = NULL; animation_entry.userdata = NULL;
@ -7050,7 +7053,8 @@ static void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone)
{ {
/* imageviewer content requires special treatment, /* imageviewer content requires special treatment,
* since only the right thumbnail is ever loaded */ * since only the right thumbnail is ever loaded */
if (!gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)) 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))
return; return;
} }
else else
@ -7090,11 +7094,11 @@ static void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone)
ozone->fullscreen_thumbnail_label[0] = '\0'; ozone->fullscreen_thumbnail_label[0] = '\0';
/* Configure fade in animation */ /* Configure fade in animation */
animation_entry.easing_enum = EASING_OUT_QUAD; animation_entry.easing_enum = OZONE_EASING_ALPHA;
animation_entry.tag = alpha_tag;
animation_entry.duration = gfx_thumb_get_ptr()->fade_duration; animation_entry.duration = gfx_thumb_get_ptr()->fade_duration;
animation_entry.target_value = 1.0f;
animation_entry.subject = &ozone->animations.fullscreen_thumbnail_alpha; animation_entry.subject = &ozone->animations.fullscreen_thumbnail_alpha;
animation_entry.tag = alpha_tag;
animation_entry.target_value = 1.0f;
animation_entry.cb = NULL; animation_entry.cb = NULL;
animation_entry.userdata = NULL; animation_entry.userdata = NULL;
@ -7848,10 +7852,10 @@ static void ozone_toggle_metadata_override(ozone_handle_t *ozone)
gfx_animation_kill_by_tag(&alpha_tag); gfx_animation_kill_by_tag(&alpha_tag);
/* Set common animation parameters */ /* Set common animation parameters */
animation_entry.easing_enum = EASING_OUT_QUAD; animation_entry.easing_enum = OZONE_EASING_ALPHA;
animation_entry.tag = alpha_tag;
animation_entry.duration = gfx_thumb_get_ptr()->fade_duration; animation_entry.duration = gfx_thumb_get_ptr()->fade_duration;
animation_entry.subject = &ozone->animations.left_thumbnail_alpha; animation_entry.subject = &ozone->animations.left_thumbnail_alpha;
animation_entry.tag = alpha_tag;
animation_entry.cb = NULL; animation_entry.cb = NULL;
animation_entry.userdata = NULL; animation_entry.userdata = NULL;
@ -8233,6 +8237,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))
{ {
/* Allow launch if already using "imageviewer" core */
if (string_is_equal(runloop_state_get_ptr()->system.info.library_name, "image display"))
break;
if (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS) if (ozone->flags2 & OZONE_FLAG2_SHOW_FULLSCREEN_THUMBNAILS)
ozone_hide_fullscreen_thumbnails(ozone, true); ozone_hide_fullscreen_thumbnails(ozone, true);
else else
@ -8870,12 +8878,18 @@ static void ozone_update_thumbnail_image(void *data)
/* Left thumbnail /* Left thumbnail
* > Disabled for image (and video/music) content */ * > Disabled for image (and video/music) content */
if ( (!(ozone->flags2 & OZONE_FLAG2_SELECTION_CORE_IS_VIEWER)) if ( (!(ozone->flags2 & OZONE_FLAG2_SELECTION_CORE_IS_VIEWER))
&& (gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT))) && (gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT)))
ozone->thumbnails.pending = (ozone->thumbnails.pending == OZONE_PENDING_THUMBNAIL_RIGHT) ozone->thumbnails.pending = (ozone->thumbnails.pending == OZONE_PENDING_THUMBNAIL_RIGHT)
? OZONE_PENDING_THUMBNAIL_BOTH ? OZONE_PENDING_THUMBNAIL_BOTH
: OZONE_PENDING_THUMBNAIL_LEFT; : OZONE_PENDING_THUMBNAIL_LEFT;
/* Use left thumbnail as imageviewer failsafe if right is not enabled */
if ( (ozone->flags2 & OZONE_FLAG2_SELECTION_CORE_IS_VIEWER)
&& ( gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
&& (!gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT)))
ozone->thumbnails.pending = OZONE_PENDING_THUMBNAIL_LEFT;
show_thumbnail_bar = ozone->show_thumbnail_bar; show_thumbnail_bar = ozone->show_thumbnail_bar;
want_thumbnail_bar = (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR) ? true : false; want_thumbnail_bar = (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR) ? true : false;
if (show_thumbnail_bar != want_thumbnail_bar) if (show_thumbnail_bar != want_thumbnail_bar)
@ -8899,11 +8913,11 @@ static void ozone_refresh_thumbnail_image(void *data, unsigned i)
/* Only refresh thumbnails if thumbnails are enabled */ /* Only refresh thumbnails if thumbnails are enabled */
if ( ( gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_RIGHT) 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)) || gfx_thumbnail_is_enabled(menu_st->thumbnail_path_data, GFX_THUMBNAIL_LEFT))
&& (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR) && (ozone->flags & OZONE_FLAG_WANT_THUMBNAIL_BAR)
&& ( (ozone->is_quick_menu) && ( (ozone->is_quick_menu)
|| (ozone->flags & OZONE_FLAG_IS_PLAYLIST) || (ozone->flags & OZONE_FLAG_IS_PLAYLIST)
|| (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST))) || (ozone->flags & OZONE_FLAG_IS_EXPLORE_LIST)))
ozone_update_thumbnail_image(ozone); ozone_update_thumbnail_image(ozone);
} }
@ -9035,6 +9049,8 @@ static void ozone_set_layout(
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool font_inited = false; bool font_inited = false;
float scale_factor = ozone->last_scale_factor; float scale_factor = ozone->last_scale_factor;
float font_min_size = 9.0f;
float font_size = font_min_size;
/* Calculate dimensions */ /* Calculate dimensions */
ozone->dimensions.header_height = HEADER_HEIGHT * scale_factor; ozone->dimensions.header_height = HEADER_HEIGHT * scale_factor;
@ -9136,28 +9152,53 @@ static void ozone_set_layout(
break; break;
} }
font_inited = ozone_init_font(&ozone->fonts.footer, /* Sidebar */
is_threaded, font_path, FONT_SIZE_FOOTER * scale_factor); font_size = FONT_SIZE_SIDEBAR * scale_factor;
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited)) if (font_size < font_min_size)
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS; font_size = font_min_size;
font_inited = ozone_init_font(&ozone->fonts.time,
is_threaded, font_path, FONT_SIZE_TIME * scale_factor);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS;
font_inited = ozone_init_font(&ozone->fonts.entries_label,
is_threaded, font_path, FONT_SIZE_ENTRIES_LABEL * scale_factor);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS;
font_inited = ozone_init_font(&ozone->fonts.entries_sublabel,
is_threaded, font_path, FONT_SIZE_ENTRIES_SUBLABEL * scale_factor);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS;
font_inited = ozone_init_font(&ozone->fonts.sidebar, font_inited = ozone_init_font(&ozone->fonts.sidebar,
is_threaded, font_path, FONT_SIZE_SIDEBAR * scale_factor); is_threaded, font_path, font_size);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS;
/* Entries */
font_size = FONT_SIZE_ENTRIES_LABEL * scale_factor;
if (font_size < font_min_size)
font_size = font_min_size;
font_inited = ozone_init_font(&ozone->fonts.entries_label,
is_threaded, font_path, font_size);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS;
/* Sublabels */
font_size = FONT_SIZE_ENTRIES_SUBLABEL * scale_factor;
if (font_size < font_min_size - 2)
font_size = font_min_size - 2;
font_inited = ozone_init_font(&ozone->fonts.entries_sublabel,
is_threaded, font_path, font_size);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS;
/* Time */
font_size = FONT_SIZE_TIME * scale_factor;
if (font_size < font_min_size - 2)
font_size = font_min_size - 2;
font_inited = ozone_init_font(&ozone->fonts.time,
is_threaded, font_path, font_size);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS;
/* Footer */
font_size = FONT_SIZE_FOOTER * scale_factor;
if (font_size < font_min_size - 2)
font_size = font_min_size - 2;
font_inited = ozone_init_font(&ozone->fonts.footer,
is_threaded, font_path, font_size);
if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited)) if (!(((ozone->flags & OZONE_FLAG_HAS_ALL_ASSETS) > 0) && font_inited))
ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS; ozone->flags &= ~OZONE_FLAG_HAS_ALL_ASSETS;
@ -11591,7 +11632,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
entry.cb = NULL; entry.cb = NULL;
entry.duration = ANIMATION_PUSH_ENTRY_DURATION; entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_ALPHA;
entry.subject = &ozone->animations.messagebox_alpha; entry.subject = &ozone->animations.messagebox_alpha;
entry.tag = messagebox_tag; entry.tag = messagebox_tag;
entry.target_value = 1.0f; entry.target_value = 1.0f;
@ -11614,7 +11655,7 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
entry.cb = ozone_messagebox_fadeout_cb; entry.cb = ozone_messagebox_fadeout_cb;
entry.duration = ANIMATION_PUSH_ENTRY_DURATION; entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_ALPHA;
entry.subject = &ozone->animations.messagebox_alpha; entry.subject = &ozone->animations.messagebox_alpha;
entry.tag = messagebox_tag; entry.tag = messagebox_tag;
entry.target_value = 0.0f; entry.target_value = 0.0f;
@ -11731,24 +11772,6 @@ static void ozone_list_open(
ozone->flags |= (OZONE_FLAG_DRAW_OLD_LIST); ozone->flags |= (OZONE_FLAG_DRAW_OLD_LIST);
/* Left/right animation */
if (animate)
{
ozone->animations.list_alpha = 0.0f;
entry.cb = ozone_animation_end;
entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
entry.easing_enum = EASING_OUT_QUAD;
entry.subject = &ozone->animations.list_alpha;
entry.tag = (uintptr_t)NULL;
entry.target_value = 1.0f;
entry.userdata = ozone;
gfx_animation_push(&entry);
}
else
ozone->animations.list_alpha = 1.0f;
/* Sidebar animation */ /* Sidebar animation */
ozone_sidebar_update_collapse(ozone, ozone_collapse_sidebar, animate); ozone_sidebar_update_collapse(ozone, ozone_collapse_sidebar, animate);
@ -11769,13 +11792,17 @@ static void ozone_list_open(
{ {
entry.cb = NULL; entry.cb = NULL;
entry.duration = ANIMATION_PUSH_ENTRY_DURATION; entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_XY;
entry.subject = &ozone->sidebar_offset; entry.subject = &ozone->sidebar_offset;
entry.tag = sidebar_tag; entry.tag = sidebar_tag;
entry.target_value = 0.0f; entry.target_value = 0.0f;
entry.userdata = NULL; entry.userdata = NULL;
gfx_animation_push(&entry); gfx_animation_push(&entry);
/* Skip "left/right" animation if animating already */
if (ozone->sidebar_offset != entry.target_value)
animate = false;
} }
else else
ozone->sidebar_offset = 0.0f; ozone->sidebar_offset = 0.0f;
@ -11788,17 +11815,39 @@ static void ozone_list_open(
entry.cb = ozone_collapse_end; entry.cb = ozone_collapse_end;
entry.duration = ANIMATION_PUSH_ENTRY_DURATION; entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
entry.easing_enum = EASING_OUT_QUAD; entry.easing_enum = OZONE_EASING_XY;
entry.subject = &ozone->sidebar_offset; entry.subject = &ozone->sidebar_offset;
entry.tag = sidebar_tag; entry.tag = sidebar_tag;
entry.target_value = -ozone->dimensions_sidebar_width; entry.target_value = -ozone->dimensions_sidebar_width;
entry.userdata = (void*)ozone; entry.userdata = ozone;
gfx_animation_push(&entry); gfx_animation_push(&entry);
/* Skip "left/right" animation if animating already */
if (ozone->sidebar_offset != entry.target_value)
animate = false;
} }
else else
ozone->sidebar_offset = -ozone->dimensions_sidebar_width; ozone->sidebar_offset = -ozone->dimensions_sidebar_width;
} }
/* Left/right animation */
if (animate)
{
ozone->animations.list_alpha = 0.0f;
entry.cb = ozone_animation_end;
entry.duration = ANIMATION_PUSH_ENTRY_DURATION;
entry.easing_enum = OZONE_EASING_ALPHA;
entry.subject = &ozone->animations.list_alpha;
entry.tag = (uintptr_t)NULL;
entry.target_value = 1.0f;
entry.userdata = ozone;
gfx_animation_push(&entry);
}
else
ozone->animations.list_alpha = 1.0f;
} }
static void ozone_populate_entries( static void ozone_populate_entries(
@ -12082,8 +12131,6 @@ static void ozone_populate_entries(
ozone->flags &= ~OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE; ozone->flags &= ~OZONE_FLAG_FULLSCREEN_THUMBNAILS_AVAILABLE;
} }
/* TODO: Fancy toggle animation */
static void ozone_toggle(void *userdata, bool menu_on) static void ozone_toggle(void *userdata, bool menu_on)
{ {
settings_t *settings = NULL; settings_t *settings = NULL;

@ -70,11 +70,12 @@
#define XMB_TAB_MAX_LENGTH 255 #define XMB_TAB_MAX_LENGTH 255
#ifndef XMB_DELAY
#define XMB_DELAY 166.66667f #define XMB_DELAY 166.66667f
#endif
#define XMB_THUMBNAIL_STREAM_DELAY 5 * 16.66667f #define XMB_THUMBNAIL_STREAM_DELAY 16.66667f * 5
#define XMB_EASING_ALPHA EASING_OUT_CIRC
#define XMB_EASING_XY EASING_OUT_QUAD
/* Specifies minimum period (in usec) between /* Specifies minimum period (in usec) between
* tab switch events when input repeat is * tab switch events when input repeat is
@ -1515,6 +1516,12 @@ static void xmb_selection_pointer_changed(
menu_list_t *menu_list = menu_st->entries.list; menu_list_t *menu_list = menu_st->entries.list;
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0); file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t selection = menu_st->selection_ptr; size_t selection = menu_st->selection_ptr;
settings_t *settings = config_get_ptr();
unsigned menu_xmb_animation_move_up_down
= settings->uints.menu_xmb_animation_move_up_down;
if (menu_xmb_animation_move_up_down > 1)
allow_animations = false;
if (!xmb) if (!xmb)
return; return;
@ -1638,9 +1645,9 @@ static void xmb_selection_pointer_changed(
xmb_update_savestate_thumbnail_image(xmb); xmb_update_savestate_thumbnail_image(xmb);
} }
if ( (!allow_animations) if ( !allow_animations
|| (real_iy < -threshold || real_iy < -threshold
|| real_iy > height+threshold)) || real_iy > height + threshold)
{ {
node->alpha = node->label_alpha = ia; node->alpha = node->label_alpha = ia;
node->y = iy; node->y = iy;
@ -1648,9 +1655,6 @@ static void xmb_selection_pointer_changed(
} }
else else
{ {
settings_t *settings = config_get_ptr();
unsigned menu_xmb_animation_move_up_down = settings->uints.menu_xmb_animation_move_up_down;
/* Move up/down animation */ /* Move up/down animation */
gfx_animation_ctx_entry_t anim_entry; gfx_animation_ctx_entry_t anim_entry;
@ -1694,8 +1698,10 @@ static void xmb_list_open_old(xmb_handle_t *xmb,
file_list_t *list, int dir, size_t current) file_list_t *list, int dir, size_t current)
{ {
unsigned i, height; unsigned i, height;
int threshold = xmb->icon_size * 10; int threshold = xmb->icon_size * 10;
size_t end = list ? list->size : 0; size_t end = list ? list->size : 0;
settings_t *settings = config_get_ptr();
bool menu_horizontal_animation = settings->bools.menu_horizontal_animation;
video_driver_get_size(NULL, &height); video_driver_get_size(NULL, &height);
@ -1715,7 +1721,9 @@ static void xmb_list_open_old(xmb_handle_t *xmb,
real_y = node->y + xmb->margins_screen_top; real_y = node->y + xmb->margins_screen_top;
if (real_y < -threshold || real_y > height + threshold) if ( !menu_horizontal_animation
|| real_y < -threshold
|| real_y > height + threshold)
{ {
node->alpha = ia; node->alpha = ia;
node->label_alpha = 0; node->label_alpha = 0;
@ -1725,10 +1733,12 @@ static void xmb_list_open_old(xmb_handle_t *xmb,
{ {
gfx_animation_ctx_entry_t anim_entry; gfx_animation_ctx_entry_t anim_entry;
node->alpha /= 5;
anim_entry.duration = XMB_DELAY; anim_entry.duration = XMB_DELAY;
anim_entry.target_value = ia; anim_entry.target_value = ia;
anim_entry.subject = &node->alpha; anim_entry.subject = &node->alpha;
anim_entry.easing_enum = EASING_OUT_QUAD; anim_entry.easing_enum = XMB_EASING_ALPHA;
anim_entry.tag = (uintptr_t)list; anim_entry.tag = (uintptr_t)list;
anim_entry.cb = NULL; anim_entry.cb = NULL;
@ -1741,6 +1751,7 @@ static void xmb_list_open_old(xmb_handle_t *xmb,
anim_entry.target_value = xmb->icon_size * dir * -2; anim_entry.target_value = xmb->icon_size * dir * -2;
anim_entry.subject = &node->x; anim_entry.subject = &node->x;
anim_entry.easing_enum = XMB_EASING_XY;
gfx_animation_push(&anim_entry); gfx_animation_push(&anim_entry);
} }
@ -1756,9 +1767,8 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
size_t end = list ? list->size : 0; size_t end = list ? list->size : 0;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
bool savestate_thumbnail_enable = settings bool menu_horizontal_animation = settings->bools.menu_horizontal_animation;
? settings->bools.savestate_thumbnail_enable bool savestate_thumbnail_enable = settings->bools.savestate_thumbnail_enable;
: false;
video_driver_get_size(NULL, &height); video_driver_get_size(NULL, &height);
@ -1797,7 +1807,9 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
else else
ia = xmb->items_passive_alpha; ia = xmb->items_passive_alpha;
if (real_y < -threshold || real_y > height+threshold) if ( !menu_horizontal_animation
|| real_y < -threshold
|| real_y > height + threshold)
{ {
node->alpha = node->label_alpha = ia; node->alpha = node->label_alpha = ia;
node->x = 0; node->x = 0;
@ -1806,10 +1818,12 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
{ {
gfx_animation_ctx_entry_t anim_entry; gfx_animation_ctx_entry_t anim_entry;
node->alpha /= 5;
anim_entry.duration = XMB_DELAY; anim_entry.duration = XMB_DELAY;
anim_entry.target_value = ia; anim_entry.target_value = ia;
anim_entry.subject = &node->alpha; anim_entry.subject = &node->alpha;
anim_entry.easing_enum = EASING_OUT_QUAD; anim_entry.easing_enum = XMB_EASING_ALPHA;
anim_entry.tag = (uintptr_t)list; anim_entry.tag = (uintptr_t)list;
anim_entry.cb = NULL; anim_entry.cb = NULL;
@ -1821,6 +1835,7 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
anim_entry.target_value = 0; anim_entry.target_value = 0;
anim_entry.subject = &node->x; anim_entry.subject = &node->x;
anim_entry.easing_enum = XMB_EASING_XY;
gfx_animation_push(&anim_entry); gfx_animation_push(&anim_entry);
} }
@ -1851,6 +1866,7 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
{ {
/* This shows savestate thumbnail after /* This shows savestate thumbnail after
* opening savestate submenu */ * opening savestate submenu */
xmb->skip_thumbnail_reset = false;
xmb_update_savestate_thumbnail_path(xmb, (unsigned)current); xmb_update_savestate_thumbnail_path(xmb, (unsigned)current);
xmb_update_savestate_thumbnail_image(xmb); xmb_update_savestate_thumbnail_image(xmb);
} }
@ -1896,11 +1912,22 @@ static void xmb_push_animations(xmb_node_t *node,
uintptr_t tag, float ia, float ix) uintptr_t tag, float ia, float ix)
{ {
gfx_animation_ctx_entry_t anim_entry; gfx_animation_ctx_entry_t anim_entry;
settings_t *settings = config_get_ptr();
bool menu_horizontal_animation = settings->bools.menu_horizontal_animation;
if (!menu_horizontal_animation)
{
node->alpha = node->label_alpha = ia;
node->x = ix;
return;
}
node->alpha /= 5;
anim_entry.duration = XMB_DELAY; anim_entry.duration = XMB_DELAY;
anim_entry.target_value = ia; anim_entry.target_value = ia;
anim_entry.subject = &node->alpha; anim_entry.subject = &node->alpha;
anim_entry.easing_enum = EASING_OUT_QUAD; anim_entry.easing_enum = XMB_EASING_ALPHA;
anim_entry.tag = tag; anim_entry.tag = tag;
anim_entry.cb = NULL; anim_entry.cb = NULL;
@ -1912,6 +1939,7 @@ static void xmb_push_animations(xmb_node_t *node,
anim_entry.target_value = ix; anim_entry.target_value = ix;
anim_entry.subject = &node->x; anim_entry.subject = &node->x;
anim_entry.easing_enum = XMB_EASING_XY;
gfx_animation_push(&anim_entry); gfx_animation_push(&anim_entry);
} }
@ -2071,11 +2099,12 @@ static xmb_node_t* xmb_get_node(xmb_handle_t *xmb, unsigned i)
static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb) static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb)
{ {
unsigned j; unsigned j;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
+ xmb->system_tab_end; + xmb->system_tab_end;
bool menu_horizontal_animation = settings->bools.menu_horizontal_animation;
unsigned xmb_animation_horizontal_highlight = unsigned xmb_animation_horizontal_highlight =
settings->uints.menu_xmb_animation_horizontal_highlight; settings->uints.menu_xmb_animation_horizontal_highlight;
for (j = 0; j <= list_size; j++) for (j = 0; j <= list_size; j++)
{ {
@ -2093,11 +2122,15 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb)
iz = xmb->categories_active_zoom; iz = xmb->categories_active_zoom;
} }
if (!xmb->allow_horizontal_animation) if ( !xmb->allow_horizontal_animation
return; || !menu_horizontal_animation)
{
/* Horizontal icon animation */ node->alpha = ia;
node->zoom = iz;
continue;
}
/* Horizontal icon highlight animation */
entry.target_value = ia; entry.target_value = ia;
entry.subject = &node->alpha; entry.subject = &node->alpha;
/* TODO/FIXME - integer conversion resulted in change of sign */ /* TODO/FIXME - integer conversion resulted in change of sign */
@ -2179,17 +2212,26 @@ static void xmb_list_switch(xmb_handle_t *xmb)
xmb_list_switch_horizontal_list(xmb); xmb_list_switch_horizontal_list(xmb);
anim_entry.duration = XMB_DELAY; /* Horizontal tab icon scroll */
anim_entry.target_value = xmb->icon_spacing_horizontal if (menu_horizontal_animation)
* -(float)xmb->categories_selection_ptr; {
anim_entry.subject = &xmb->categories_x_pos; anim_entry.duration = XMB_DELAY;
anim_entry.easing_enum = EASING_OUT_QUAD; anim_entry.target_value = xmb->icon_spacing_horizontal
/* TODO/FIXME - integer conversion resulted in change of sign */ * -(float)xmb->categories_selection_ptr;
anim_entry.tag = -1; anim_entry.subject = &xmb->categories_x_pos;
anim_entry.cb = NULL; anim_entry.easing_enum = XMB_EASING_XY;
/* TODO/FIXME - integer conversion resulted in change of sign */
anim_entry.tag = -1;
anim_entry.cb = NULL;
if (anim_entry.subject) if (anim_entry.subject)
gfx_animation_push(&anim_entry); gfx_animation_push(&anim_entry);
}
else
{
xmb->categories_x_pos = xmb->icon_spacing_horizontal
* -(float)xmb->categories_selection_ptr;
}
dir = -1; dir = -1;
if ( xmb->categories_selection_ptr if ( xmb->categories_selection_ptr
@ -2218,7 +2260,7 @@ static void xmb_list_switch(xmb_handle_t *xmb)
} }
} }
static void xmb_list_open_horizontal_list(xmb_handle_t *xmb) static void xmb_list_open_horizontal_list(xmb_handle_t *xmb, bool animate)
{ {
unsigned j; unsigned j;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
@ -2238,16 +2280,21 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb)
else if (xmb->depth <= 1) else if (xmb->depth <= 1)
ia = xmb->categories_passive_alpha; ia = xmb->categories_passive_alpha;
anim_entry.duration = XMB_DELAY; if (animate)
anim_entry.target_value = ia; {
anim_entry.subject = &node->alpha; anim_entry.duration = XMB_DELAY;
anim_entry.easing_enum = EASING_OUT_QUAD; anim_entry.target_value = ia;
/* TODO/FIXME - integer conversion resulted in change of sign */ anim_entry.subject = &node->alpha;
anim_entry.tag = -1; anim_entry.easing_enum = XMB_EASING_ALPHA;
anim_entry.cb = NULL; /* TODO/FIXME - integer conversion resulted in change of sign */
anim_entry.tag = -1;
anim_entry.cb = NULL;
if (anim_entry.subject) if (anim_entry.subject)
gfx_animation_push(&anim_entry); gfx_animation_push(&anim_entry);
}
else
node->alpha = ia;
} }
} }
@ -2449,13 +2496,13 @@ static void xmb_context_reset_horizontal_list(
len = fill_pathname_base( len = fill_pathname_base(
sysname, path, sizeof(sysname)); sysname, path, sizeof(sysname));
/* Manually strip the extension (and dot) from sysname */ /* Manually strip the extension (and dot) from sysname */
sysname[len-4] = sysname[len-4] =
sysname[len-3] = sysname[len-3] =
sysname[len-2] = sysname[len-2] =
sysname[len-1] = '\0'; sysname[len-1] = '\0';
len = fill_pathname_join_special( len = fill_pathname_join_special(
texturepath, iconpath, sysname, texturepath, iconpath, sysname,
sizeof(texturepath)); sizeof(texturepath));
texturepath[ len] = '.'; texturepath[ len] = '.';
texturepath[++len] = 'p'; texturepath[++len] = 'p';
texturepath[++len] = 'n'; texturepath[++len] = 'n';
@ -2463,16 +2510,15 @@ static void xmb_context_reset_horizontal_list(
texturepath[++len] = '\0'; texturepath[++len] = '\0';
/* If the playlist icon doesn't exist return default */ /* If the playlist icon doesn't exist return default */
if (!path_is_valid(texturepath)) if (!path_is_valid(texturepath))
{ {
len = fill_pathname_join_special(texturepath, iconpath, "default", len = fill_pathname_join_special(texturepath, iconpath, "default",
sizeof(texturepath)); sizeof(texturepath));
texturepath[ len] = '.'; texturepath[ len] = '.';
texturepath[++len] = 'p'; texturepath[++len] = 'p';
texturepath[++len] = 'n'; texturepath[++len] = 'n';
texturepath[++len] = 'g'; texturepath[++len] = 'g';
texturepath[++len] = '\0'; texturepath[++len] = '\0';
} }
ti.width = 0; ti.width = 0;
@ -2593,15 +2639,15 @@ static void xmb_list_open(xmb_handle_t *xmb)
{ {
gfx_animation_ctx_entry_t entry; gfx_animation_ctx_entry_t entry;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
unsigned bool menu_horizontal_animation = settings->bools.menu_horizontal_animation;
menu_xmb_animation_opening_main_menu = unsigned menu_xmb_animation_opening_main_menu =
settings->uints.menu_xmb_animation_opening_main_menu; settings->uints.menu_xmb_animation_opening_main_menu;
int dir = 0; struct menu_state *menu_st = menu_state_get_ptr();
struct menu_state *menu_st = menu_state_get_ptr(); menu_list_t *menu_list = menu_st->entries.list;
menu_list_t *menu_list = menu_st->entries.list; file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0); size_t selection = menu_st->selection_ptr;
size_t selection = menu_st->selection_ptr; int dir = 0;
xmb->depth = (int) xmb->depth = (int)
xmb_list_get_size(xmb, MENU_LIST_PLAIN); xmb_list_get_size(xmb, MENU_LIST_PLAIN);
@ -2613,7 +2659,7 @@ static void xmb_list_open(xmb_handle_t *xmb)
else else
return; /* If menu hasn't changed, do nothing */ return; /* If menu hasn't changed, do nothing */
xmb_list_open_horizontal_list(xmb); xmb_list_open_horizontal_list(xmb, menu_horizontal_animation);
xmb_list_open_old(xmb, &xmb->selection_buf_old, xmb_list_open_old(xmb, &xmb->selection_buf_old,
dir, xmb->selection_ptr_old); dir, xmb->selection_ptr_old);
@ -2622,8 +2668,7 @@ static void xmb_list_open(xmb_handle_t *xmb)
dir, selection); dir, selection);
/* Main Menu opening animation */ /* Main Menu opening animation */
entry.target_value = xmb->icon_size * -(xmb->depth * 2 - 2);
entry.target_value = xmb->icon_size * -(xmb->depth*2-2);
entry.subject = &xmb->x; entry.subject = &xmb->x;
/* TODO/FIXME - integer conversion resulted in change of sign */ /* TODO/FIXME - integer conversion resulted in change of sign */
entry.tag = -1; entry.tag = -1;
@ -2652,12 +2697,20 @@ static void xmb_list_open(xmb_handle_t *xmb)
if ( xmb->depth == 1 if ( xmb->depth == 1
|| xmb->depth == 2) || xmb->depth == 2)
{ {
gfx_animation_push(&entry); if (menu_horizontal_animation)
{
gfx_animation_push(&entry);
entry.target_value = xmb->depth - 1; entry.target_value = xmb->depth - 1;
entry.subject = &xmb->textures_arrow_alpha; entry.subject = &xmb->textures_arrow_alpha;
gfx_animation_push(&entry); gfx_animation_push(&entry);
}
else
{
xmb->x = xmb->icon_size * -(xmb->depth * 2 - 2);
xmb->textures_arrow_alpha = xmb->depth - 1;
}
} }
xmb->old_depth = xmb->depth; xmb->old_depth = xmb->depth;
@ -3866,7 +3919,7 @@ static int xmb_draw_item(
if (menu_xmb_vertical_fade_factor) if (menu_xmb_vertical_fade_factor)
{ {
float min_alpha = 0.1f; float min_alpha = 0.01f;
float max_alpha = (i == current) float max_alpha = (i == current)
? xmb->items_active_alpha ? xmb->items_active_alpha
: xmb->items_passive_alpha; : xmb->items_passive_alpha;
@ -3877,7 +3930,7 @@ static int xmb_draw_item(
float factor = menu_xmb_vertical_fade_factor / 100.0f / icon_ratio; float factor = menu_xmb_vertical_fade_factor / 100.0f / icon_ratio;
if (!xmb->use_ps3_layout) if (!xmb->use_ps3_layout)
scr_margin -= (xmb->margins_screen_top / 10); scr_margin -= (icon_space / 8);
/* Top */ /* Top */
if (i < current) if (i < current)
@ -3892,8 +3945,8 @@ static int xmb_draw_item(
if (new_alpha > max_alpha) if (new_alpha > max_alpha)
new_alpha = max_alpha; new_alpha = max_alpha;
/* Horizontal animation requires breathing room on x-axis */ /* Avoid adjusting animating rows */
if (node->x > (-icon_space * 2) && node->x < (icon_space * 2)) if (new_alpha < node->alpha || node->x == 0)
node->alpha = node->label_alpha = new_alpha; node->alpha = node->label_alpha = new_alpha;
} }
@ -4289,11 +4342,6 @@ static void xmb_draw_items(
if (list == &xmb->selection_buf_old) if (list == &xmb->selection_buf_old)
{ {
xmb_node_t *node = (xmb_node_t*)list->list[current].userdata;
if (node && (uint8_t)(255 * node->alpha) == 0)
return;
/* Draw only current item for "back" icon */ /* Draw only current item for "back" icon */
first = (unsigned)current; first = (unsigned)current;
last = (unsigned)current; last = (unsigned)current;
@ -4389,13 +4437,11 @@ static void xmb_hide_fullscreen_thumbnails(
gfx_animation_ctx_entry_t animation_entry; gfx_animation_ctx_entry_t animation_entry;
/* Configure fade out animation */ /* Configure fade out animation */
animation_entry.easing_enum = EASING_OUT_QUAD; animation_entry.easing_enum = XMB_EASING_ALPHA;
animation_entry.tag = alpha_tag; animation_entry.tag = alpha_tag;
animation_entry.duration = animation_entry.duration = gfx_thumb_get_ptr()->fade_duration;
gfx_thumb_get_ptr()->fade_duration;
animation_entry.target_value = 0.0f; animation_entry.target_value = 0.0f;
animation_entry.subject = animation_entry.subject = &xmb->fullscreen_thumbnail_alpha;
&xmb->fullscreen_thumbnail_alpha;
animation_entry.cb = NULL; animation_entry.cb = NULL;
animation_entry.userdata = NULL; animation_entry.userdata = NULL;
@ -4489,7 +4535,7 @@ static void xmb_show_fullscreen_thumbnails(
if (animate) if (animate)
{ {
/* Configure fade in animation */ /* Configure fade in animation */
animation_entry.easing_enum = EASING_OUT_QUAD; animation_entry.easing_enum = XMB_EASING_ALPHA;
animation_entry.tag = alpha_tag; animation_entry.tag = alpha_tag;
animation_entry.duration = gfx_thumb_get_ptr()->fade_duration; animation_entry.duration = gfx_thumb_get_ptr()->fade_duration;
animation_entry.target_value = 1.0f; animation_entry.target_value = 1.0f;
@ -4575,22 +4621,24 @@ static enum menu_action xmb_parse_menu_entry_action(
* > This is always true when scroll * > This is always true when scroll
* acceleration is greater than zero */ * acceleration is greater than zero */
size_t scroll_accel = menu_st->scroll.acceleration; size_t scroll_accel = menu_st->scroll.acceleration;
#ifdef HAVE_AUDIOMIXER
settings_t *settings = config_get_ptr();
size_t category = xmb->categories_selection_ptr;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + xmb->system_tab_end;
/* We only want the scrolling sound to play if any of the following are true:
* 1. Wraparound is enabled (since the category is guaranteed to change)
* 2. We're scrolling right, but we aren't on the last category
* 3. We're scrolling left, but we aren't on the first category */
bool fail_condition = ((action == MENU_ACTION_RIGHT)
? (category == list_size)
: (category == 0)) && !(settings->bools.menu_navigation_wraparound_enable);
if (((current_time - xmb->last_tab_switch_time) >= XMB_TAB_SWITCH_REPEAT_DELAY || #ifdef HAVE_AUDIOMIXER
scroll_accel <= 0) && !fail_condition) settings_t *settings = config_get_ptr();
audio_driver_mixer_play_scroll_sound(action == MENU_ACTION_RIGHT); size_t category = xmb->categories_selection_ptr;
size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) + xmb->system_tab_end;
/* We only want the scrolling sound to play if any of the following are true:
* 1. Wraparound is enabled (since the category is guaranteed to change)
* 2. We're scrolling right, but we aren't on the last category
* 3. We're scrolling left, but we aren't on the first category */
bool fail_condition = ((action == MENU_ACTION_RIGHT)
? (category == list_size)
: (category == 0)) && !(settings->bools.menu_navigation_wraparound_enable);
if ( ((current_time - xmb->last_tab_switch_time) >= XMB_TAB_SWITCH_REPEAT_DELAY || scroll_accel <= 0)
&& !fail_condition)
audio_driver_mixer_play_scroll_sound(action == MENU_ACTION_RIGHT);
#endif #endif
if (scroll_accel > 0) if (scroll_accel > 0)
{ {
/* Ignore input action if tab switch period /* Ignore input action if tab switch period
@ -4663,6 +4711,10 @@ static enum menu_action xmb_parse_menu_entry_action(
&& xmb_fullscreen_thumbnails_available(xmb, menu_st) && xmb_fullscreen_thumbnails_available(xmb, menu_st)
&& xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr) == XMB_SYSTEM_TAB_MAIN) && xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr) == XMB_SYSTEM_TAB_MAIN)
{ {
/* Allow launch if already using "imageviewer" core */
if (string_is_equal(runloop_state_get_ptr()->system.info.library_name, "image display"))
break;
if (xmb->show_fullscreen_thumbnails) if (xmb->show_fullscreen_thumbnails)
xmb_hide_fullscreen_thumbnails(xmb, true); xmb_hide_fullscreen_thumbnails(xmb, true);
else else
@ -5969,7 +6021,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
/* Left thumbnail, left side */ /* Left thumbnail, left side */
if (show_left_thumbnail) if (show_left_thumbnail)
{ {
float y_offset = ((xmb->depth != 1) ? 1.2f : 0.0f) * xmb->icon_size; float y_offset = xmb->icon_size * 1.2f;
float thumb_width = left_thumbnail_margin_width; float thumb_width = left_thumbnail_margin_width;
float thumb_height = thumbnail_margin_height_under - xmb->margins_title_bottom - y_offset; float thumb_height = thumbnail_margin_height_under - xmb->margins_title_bottom - y_offset;
float scaled_thumb_width = thumb_width * thumbnail_scale_factor; float scaled_thumb_width = thumb_width * thumbnail_scale_factor;
@ -6184,8 +6236,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info)
if (dispctx && dispctx->blend_begin) if (dispctx && dispctx->blend_begin)
dispctx->blend_begin(userdata); dispctx->blend_begin(userdata);
/* Horizontal tab icons only needed on root depth */ if (!xmb->assets_missing)
if (!xmb->assets_missing && xmb->depth == 1)
{ {
for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) for (i = 0; i <= xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
+ xmb->system_tab_end; i++) + xmb->system_tab_end; i++)
@ -6444,7 +6495,7 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width)
xmb->icon_spacing_horizontal = 200.0 * scale_factor; xmb->icon_spacing_horizontal = 200.0 * scale_factor;
xmb->icon_spacing_vertical = 64.0 * scale_factor; xmb->icon_spacing_vertical = 64.0 * scale_factor;
xmb->margins_screen_top = (256 + 32) * scale_factor; xmb->margins_screen_top = (256 + 16) * scale_factor;
xmb->margins_screen_left = 336.0 * scale_factor; xmb->margins_screen_left = 336.0 * scale_factor;
xmb->margins_title_left = (margins_title * scale_factor) + (4 * scale_factor) + (margins_title_h_offset * scale_factor); xmb->margins_title_left = (margins_title * scale_factor) + (4 * scale_factor) + (margins_title_h_offset * scale_factor);
@ -6464,7 +6515,7 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
float scale_factor = xmb->last_scale_factor; float scale_factor = xmb->last_scale_factor;
float margins_title = xmb->margins_title; float margins_title = xmb->margins_title;
float margins_title_h_offset = xmb->margins_title_horizontal_offset; float margins_title_h_offset = xmb->margins_title_horizontal_offset;
unsigned new_font_size = 28.0 * scale_factor; unsigned new_font_size = 24.0 * scale_factor;
xmb->above_subitem_offset = 1.5; xmb->above_subitem_offset = 1.5;
xmb->above_item_offset = -1.0; xmb->above_item_offset = -1.0;
@ -6497,9 +6548,9 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width)
xmb->cursor_size = 64.0 * scale_factor; xmb->cursor_size = 64.0 * scale_factor;
xmb->icon_size = 128.0 * scale_factor; xmb->icon_size = 128.0 * scale_factor;
xmb->icon_spacing_horizontal = 250.0 * scale_factor; xmb->icon_spacing_horizontal = 250.0 * scale_factor;
xmb->icon_spacing_vertical = 108.0 * scale_factor; xmb->icon_spacing_vertical = 96.0 * scale_factor;
xmb->margins_screen_top = (256 + 32) * scale_factor; xmb->margins_screen_top = (256 + 16) * scale_factor;
xmb->margins_screen_left = 136.0 * scale_factor; xmb->margins_screen_left = 136.0 * scale_factor;
xmb->margins_title_left = (margins_title * scale_factor) + (4 * scale_factor) + (margins_title_h_offset * scale_factor); xmb->margins_title_left = (margins_title * scale_factor) + (4 * scale_factor) + (margins_title_h_offset * scale_factor);
@ -6704,7 +6755,7 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
xmb->textures_arrow_alpha = 0; xmb->textures_arrow_alpha = 0;
xmb->depth = 1; xmb->depth = 1;
xmb->old_depth = 1; xmb->old_depth = 1;
xmb->alpha = 0; xmb->alpha = 1.0f;
xmb->system_tab_end = 0; xmb->system_tab_end = 0;
xmb->tabs[xmb->system_tab_end] = XMB_SYSTEM_TAB_MAIN; xmb->tabs[xmb->system_tab_end] = XMB_SYSTEM_TAB_MAIN;
@ -7574,14 +7625,13 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action
file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0); file_list_t *selection_buf = MENU_LIST_GET_SELECTION(menu_list, 0);
size_t selection = menu_st->selection_ptr; size_t selection = menu_st->selection_ptr;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
bool menu_horizontal_animation = settings->bools.menu_horizontal_animation;
if (!xmb) if (!xmb)
return; return;
/* Check whether to enable the horizontal animation. */ /* Check whether to enable the horizontal animation.
if ( menu_horizontal_animation * Deep copy required for 'previous' icon. */
&& xmb->allow_horizontal_animation) if (xmb->allow_horizontal_animation)
{ {
unsigned first = 0, last = 0; unsigned first = 0, last = 0;
unsigned height = 0; unsigned height = 0;
@ -7604,7 +7654,7 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action
first = 0; first = 0;
} }
else else
xmb->selection_ptr_old = 0; xmb->selection_ptr_old = selection;
list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL) list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL)
+ xmb->system_tab_end; + xmb->system_tab_end;
@ -7763,21 +7813,12 @@ static void xmb_context_destroy(void *data)
static void xmb_toggle(void *userdata, bool menu_on) static void xmb_toggle(void *userdata, bool menu_on)
{ {
gfx_animation_ctx_entry_t entry; gfx_animation_ctx_entry_t entry;
bool tmp = false;
xmb_handle_t *xmb = (xmb_handle_t*)userdata; xmb_handle_t *xmb = (xmb_handle_t*)userdata;
struct menu_state *menu_st = menu_state_get_ptr(); struct menu_state *menu_st = menu_state_get_ptr();
if (!xmb) if (!xmb || !menu_on)
return; return;
xmb->depth = (int)xmb_list_get_size(xmb, MENU_LIST_PLAIN);
if (!menu_on)
{
xmb->alpha = 0;
return;
}
/* Have to reset this, otherwise savestate /* Have to reset this, otherwise savestate
* thumbnail won't update after selecting * thumbnail won't update after selecting
* 'save state' option */ * 'save state' option */
@ -7789,22 +7830,10 @@ static void xmb_toggle(void *userdata, bool menu_on)
xmb->fullscreen_thumbnails_available = false; xmb->fullscreen_thumbnails_available = false;
} }
entry.duration = XMB_DELAY * 2; if (MENU_ENTRIES_NEEDS_REFRESH(menu_st))
entry.target_value = 1.0f; menu_st->flags &= ~MENU_ST_FLAG_PREVENT_POPULATE;
entry.subject = &xmb->alpha;
entry.easing_enum = EASING_OUT_QUAD;
/* TODO/FIXME - integer conversion resulted in change of sign */
entry.tag = -1;
entry.cb = NULL;
gfx_animation_push(&entry);
tmp = !MENU_ENTRIES_NEEDS_REFRESH(menu_st);
if (tmp)
menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE;
else else
menu_st->flags &= ~MENU_ST_FLAG_PREVENT_POPULATE; menu_st->flags |= MENU_ST_FLAG_PREVENT_POPULATE;
xmb_toggle_horizontal_list(xmb); xmb_toggle_horizontal_list(xmb);
} }

@ -10971,8 +10971,8 @@ unsigned menu_displaylist_build_list(
{MENU_ENUM_LABEL_MATERIALUI_MENU_TRANSITION_ANIMATION, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_MATERIALUI_MENU_TRANSITION_ANIMATION, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_MENU_HORIZONTAL_ANIMATION, PARSE_ONLY_BOOL, true}, {MENU_ENUM_LABEL_MENU_HORIZONTAL_ANIMATION, PARSE_ONLY_BOOL, true},
{MENU_ENUM_LABEL_MENU_XMB_ANIMATION_HORIZONTAL_HIGHLIGHT, PARSE_ONLY_UINT, false}, {MENU_ENUM_LABEL_MENU_XMB_ANIMATION_HORIZONTAL_HIGHLIGHT, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_MENU_XMB_ANIMATION_OPENING_MAIN_MENU, PARSE_ONLY_UINT, false},
{MENU_ENUM_LABEL_MENU_XMB_ANIMATION_MOVE_UP_DOWN, PARSE_ONLY_UINT, true}, {MENU_ENUM_LABEL_MENU_XMB_ANIMATION_MOVE_UP_DOWN, PARSE_ONLY_UINT, true},
{MENU_ENUM_LABEL_MENU_XMB_ANIMATION_OPENING_MAIN_MENU, PARSE_ONLY_UINT, true},
}; };
for (i = 0; i < ARRAY_SIZE(build_list); i++) for (i = 0; i < ARRAY_SIZE(build_list); i++)
@ -10980,6 +10980,7 @@ unsigned menu_displaylist_build_list(
switch (build_list[i].enum_idx) switch (build_list[i].enum_idx)
{ {
case MENU_ENUM_LABEL_MENU_XMB_ANIMATION_HORIZONTAL_HIGHLIGHT: case MENU_ENUM_LABEL_MENU_XMB_ANIMATION_HORIZONTAL_HIGHLIGHT:
case MENU_ENUM_LABEL_MENU_XMB_ANIMATION_OPENING_MAIN_MENU:
if (menu_horizontal_animation) if (menu_horizontal_animation)
build_list[i].checked = true; build_list[i].checked = true;
break; break;

@ -4067,6 +4067,9 @@ static void setting_get_string_representation_uint_menu_xmb_animation_move_up_do
case 1: case 1:
strlcpy(s, "Easing Out Expo", len); strlcpy(s, "Easing Out Expo", len);
break; break;
case 2:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NONE), len);
break;
} }
} }
@ -17381,7 +17384,7 @@ static bool setting_append_list(
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation = (*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_menu_xmb_animation_move_up_down; &setting_get_string_representation_uint_menu_xmb_animation_move_up_down;
menu_settings_list_current_add_range(list, list_info, 0, 1, 1, true, true); menu_settings_list_current_add_range(list, list_info, 0, 2, 1, true, true);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_RADIO_BUTTONS; (*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_RADIO_BUTTONS;
CONFIG_UINT( CONFIG_UINT(