mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 15:32:59 +00:00
Merge pull request #10600 from jdgleaver/glui-desktop-view
(GLUI) Add desktop-style playlist view mode
This commit is contained in:
commit
29a28f0d02
@ -51,6 +51,10 @@ struct gfx_thumbnail_state
|
||||
/* Duration in ms of the thumbnail 'fade in' animation */
|
||||
float fade_duration;
|
||||
|
||||
/* When true, 'fade in' animation will also be
|
||||
* triggered for missing thumbnails */
|
||||
bool fade_missing;
|
||||
|
||||
/* Due to the asynchronous nature of thumbnail
|
||||
* loading, it is quite possible to trigger a load
|
||||
* then navigate to a different menu list before
|
||||
@ -111,6 +115,17 @@ void gfx_thumbnail_set_fade_duration(float duration)
|
||||
duration : DEFAULT_GFX_THUMBNAIL_FADE_DURATION;
|
||||
}
|
||||
|
||||
/* Specifies whether 'fade in' animation should be
|
||||
* triggered for missing thumbnails
|
||||
* > When 'true', allows menu driver to animate
|
||||
* any 'thumbnail unavailable' notifications */
|
||||
void gfx_thumbnail_set_fade_missing(bool fade_missing)
|
||||
{
|
||||
gfx_thumbnail_state_t *p_gfx_thumb = gfx_thumb_get_ptr();
|
||||
|
||||
p_gfx_thumb->fade_missing = fade_missing;
|
||||
}
|
||||
|
||||
/* Getters */
|
||||
|
||||
/* Fetches current streaming thumbnails request delay */
|
||||
@ -129,17 +144,63 @@ float gfx_thumbnail_get_fade_duration(void)
|
||||
return p_gfx_thumb->fade_duration;
|
||||
}
|
||||
|
||||
/* Fetches current enable state for missing
|
||||
* thumbnail 'fade in' animations */
|
||||
bool gfx_thumbnail_get_fade_missing(bool fade_missing)
|
||||
{
|
||||
gfx_thumbnail_state_t *p_gfx_thumb = gfx_thumb_get_ptr();
|
||||
|
||||
return p_gfx_thumb->fade_missing;
|
||||
}
|
||||
|
||||
/* Callbacks */
|
||||
|
||||
/* Initialises thumbnail 'fade in' animation */
|
||||
static void gfx_thumbnail_init_fade(gfx_thumbnail_t *thumbnail)
|
||||
{
|
||||
gfx_thumbnail_state_t *p_gfx_thumb = gfx_thumb_get_ptr();
|
||||
|
||||
/* Sanity check */
|
||||
if (!thumbnail)
|
||||
return;
|
||||
|
||||
/* A 'fade in' animation is triggered if:
|
||||
* - Thumbnail is available
|
||||
* - Thumbnail is missing and 'fade_missing' is enabled */
|
||||
if ((thumbnail->status == GFX_THUMBNAIL_STATUS_AVAILABLE) ||
|
||||
(p_gfx_thumb->fade_missing &&
|
||||
(thumbnail->status == GFX_THUMBNAIL_STATUS_MISSING)))
|
||||
{
|
||||
if (p_gfx_thumb->fade_duration > 0.0f)
|
||||
{
|
||||
gfx_animation_ctx_entry_t animation_entry;
|
||||
|
||||
thumbnail->alpha = 0.0f;
|
||||
|
||||
animation_entry.easing_enum = EASING_OUT_QUAD;
|
||||
animation_entry.tag = (uintptr_t)&thumbnail->alpha;
|
||||
animation_entry.duration = p_gfx_thumb->fade_duration;
|
||||
animation_entry.target_value = 1.0f;
|
||||
animation_entry.subject = &thumbnail->alpha;
|
||||
animation_entry.cb = NULL;
|
||||
animation_entry.userdata = NULL;
|
||||
|
||||
gfx_animation_push(&animation_entry);
|
||||
}
|
||||
else
|
||||
thumbnail->alpha = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* Used to process thumbnail data following completion
|
||||
* of image load task */
|
||||
static void gfx_thumbnail_handle_upload(
|
||||
retro_task_t *task, void *task_data, void *user_data, const char *err)
|
||||
{
|
||||
gfx_animation_ctx_entry_t animation_entry;
|
||||
gfx_thumbnail_state_t *p_gfx_thumb = gfx_thumb_get_ptr();
|
||||
struct texture_image *img = (struct texture_image*)task_data;
|
||||
gfx_thumbnail_tag_t *thumbnail_tag = (gfx_thumbnail_tag_t*)user_data;
|
||||
bool fade_enabled = false;
|
||||
|
||||
/* Sanity check */
|
||||
if (!thumbnail_tag)
|
||||
@ -165,6 +226,11 @@ static void gfx_thumbnail_handle_upload(
|
||||
* (saves a number of checks later) */
|
||||
thumbnail_tag->thumbnail->status = GFX_THUMBNAIL_STATUS_MISSING;
|
||||
|
||||
/* If we reach this stage, thumbnail 'fade in'
|
||||
* animations should be applied (based on current
|
||||
* thumbnail status and global configuration) */
|
||||
fade_enabled = true;
|
||||
|
||||
/* Check we have a valid image */
|
||||
if (!img)
|
||||
goto end;
|
||||
@ -184,24 +250,6 @@ static void gfx_thumbnail_handle_upload(
|
||||
/* Update thumbnail status */
|
||||
thumbnail_tag->thumbnail->status = GFX_THUMBNAIL_STATUS_AVAILABLE;
|
||||
|
||||
/* Trigger 'fade in' animation, if required */
|
||||
if (p_gfx_thumb->fade_duration > 0.0f)
|
||||
{
|
||||
thumbnail_tag->thumbnail->alpha = 0.0f;
|
||||
|
||||
animation_entry.easing_enum = EASING_OUT_QUAD;
|
||||
animation_entry.tag = (uintptr_t)&thumbnail_tag->thumbnail->alpha;
|
||||
animation_entry.duration = p_gfx_thumb->fade_duration;
|
||||
animation_entry.target_value = 1.0f;
|
||||
animation_entry.subject = &thumbnail_tag->thumbnail->alpha;
|
||||
animation_entry.cb = NULL;
|
||||
animation_entry.userdata = NULL;
|
||||
|
||||
gfx_animation_push(&animation_entry);
|
||||
}
|
||||
else
|
||||
thumbnail_tag->thumbnail->alpha = 1.0f;
|
||||
|
||||
end:
|
||||
/* Clean up */
|
||||
if (img)
|
||||
@ -211,7 +259,13 @@ end:
|
||||
}
|
||||
|
||||
if (thumbnail_tag)
|
||||
{
|
||||
/* Trigger 'fade in' animation, if required */
|
||||
if (fade_enabled)
|
||||
gfx_thumbnail_init_fade(thumbnail_tag->thumbnail);
|
||||
|
||||
free(thumbnail_tag);
|
||||
}
|
||||
}
|
||||
|
||||
/* Core interface */
|
||||
@ -248,8 +302,8 @@ void gfx_thumbnail_request(
|
||||
bool network_on_demand_thumbnails
|
||||
)
|
||||
{
|
||||
const char *thumbnail_path = NULL;
|
||||
bool has_thumbnail = false;
|
||||
const char *thumbnail_path = NULL;
|
||||
bool has_thumbnail = false;
|
||||
|
||||
if (!path_data || !thumbnail)
|
||||
return;
|
||||
@ -274,7 +328,7 @@ void gfx_thumbnail_request(
|
||||
(gfx_thumbnail_tag_t*)calloc(1, sizeof(gfx_thumbnail_tag_t));
|
||||
|
||||
if (!thumbnail_tag)
|
||||
return;
|
||||
goto end;
|
||||
|
||||
/* Configure user data */
|
||||
thumbnail_tag->thumbnail = thumbnail;
|
||||
@ -297,11 +351,11 @@ void gfx_thumbnail_request(
|
||||
static char last_img_name[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
if (!playlist)
|
||||
return;
|
||||
goto end;
|
||||
|
||||
/* Get current image name */
|
||||
if (!gfx_thumbnail_get_img_name(path_data, &img_name))
|
||||
return;
|
||||
goto end;
|
||||
|
||||
/* Only trigger a thumbnail download if image
|
||||
* name has changed since the last call of
|
||||
@ -316,13 +370,13 @@ void gfx_thumbnail_request(
|
||||
* overheads. We can avoid this entirely with
|
||||
* a simple string comparison) */
|
||||
if (string_is_equal(img_name, last_img_name))
|
||||
return;
|
||||
goto end;
|
||||
|
||||
strlcpy(last_img_name, img_name, sizeof(last_img_name));
|
||||
|
||||
/* Get system name */
|
||||
if (!gfx_thumbnail_get_system(path_data, &system))
|
||||
return;
|
||||
goto end;
|
||||
|
||||
/* Trigger thumbnail download */
|
||||
task_push_pl_entry_thumbnail_download(
|
||||
@ -331,6 +385,11 @@ void gfx_thumbnail_request(
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
end:
|
||||
/* Trigger 'fade in' animation, if required */
|
||||
if (thumbnail->status != GFX_THUMBNAIL_STATUS_PENDING)
|
||||
gfx_thumbnail_init_fade(thumbnail);
|
||||
}
|
||||
|
||||
/* Requests loading of a specific thumbnail image file
|
||||
|
@ -104,6 +104,12 @@ void gfx_thumbnail_set_stream_delay(float delay);
|
||||
* > If 'duration' is negative, default value is set */
|
||||
void gfx_thumbnail_set_fade_duration(float duration);
|
||||
|
||||
/* Specifies whether 'fade in' animation should be
|
||||
* triggered for missing thumbnails
|
||||
* > When 'true', allows menu driver to animate
|
||||
* any 'thumbnail unavailable' notifications */
|
||||
void gfx_thumbnail_set_fade_missing(bool fade_missing);
|
||||
|
||||
/* Getters */
|
||||
|
||||
/* Fetches current streaming thumbnails request delay */
|
||||
@ -112,6 +118,10 @@ float gfx_thumbnail_get_stream_delay(void);
|
||||
/* Fetches current 'fade in' animation duration */
|
||||
float gfx_thumbnail_get_fade_duration(void);
|
||||
|
||||
/* Fetches current enable state for missing
|
||||
* thumbnail 'fade in' animations */
|
||||
bool gfx_thumbnail_get_fade_missing(bool fade_missing);
|
||||
|
||||
/* Core interface */
|
||||
|
||||
/* When called, prevents the handling of any pending
|
||||
|
@ -8107,6 +8107,10 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LIST_LARGE,
|
||||
"List (Large)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_DESKTOP,
|
||||
"Desktop"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_DISABLED,
|
||||
"OFF"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -195,6 +195,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
|
||||
|
||||
gfx_thumbnail_set_stream_delay(-1.0f);
|
||||
gfx_thumbnail_set_fade_duration(-1.0f);
|
||||
gfx_thumbnail_set_fade_missing(false);
|
||||
|
||||
ozone_sidebar_update_collapse(ozone, false);
|
||||
|
||||
|
@ -5380,6 +5380,7 @@ static void *xmb_init(void **userdata, bool video_is_threaded)
|
||||
|
||||
gfx_thumbnail_set_stream_delay(-1.0f);
|
||||
gfx_thumbnail_set_fade_duration(-1.0f);
|
||||
gfx_thumbnail_set_fade_missing(false);
|
||||
|
||||
xmb->use_ps3_layout = xmb_use_ps3_layout(settings, width, height);
|
||||
xmb->last_use_ps3_layout = xmb->use_ps3_layout;
|
||||
|
@ -205,6 +205,7 @@ enum materialui_thumbnail_view_landscape
|
||||
MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LIST_SMALL,
|
||||
MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LIST_MEDIUM,
|
||||
MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LIST_LARGE,
|
||||
MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_DESKTOP,
|
||||
MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LAST
|
||||
};
|
||||
|
||||
|
@ -4133,6 +4133,11 @@ static void setting_get_string_representation_uint_materialui_menu_thumbnail_vie
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LIST_LARGE), len);
|
||||
break;
|
||||
case MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_DESKTOP:
|
||||
strlcpy(s,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_DESKTOP), len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -660,6 +660,7 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LIST_SMALL,
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LIST_MEDIUM,
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_LIST_LARGE,
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_THUMBNAIL_VIEW_LANDSCAPE_DESKTOP,
|
||||
|
||||
MENU_LABEL(MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION),
|
||||
MENU_ENUM_LABEL_VALUE_MATERIALUI_LANDSCAPE_LAYOUT_OPTIMIZATION_DISABLED,
|
||||
|
@ -1020,7 +1020,7 @@ void runtime_update_playlist(
|
||||
runtime_log_t *runtime_log = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
struct playlist_entry update_entry = {0};
|
||||
#if defined(HAVE_MENU) && defined(HAVE_OZONE)
|
||||
#if defined(HAVE_MENU) && (defined(HAVE_OZONE) || defined(HAVE_MATERIALUI))
|
||||
const char *menu_ident = menu_driver_ident();
|
||||
#endif
|
||||
|
||||
@ -1078,15 +1078,20 @@ void runtime_update_playlist(
|
||||
free(runtime_log);
|
||||
}
|
||||
|
||||
#if defined(HAVE_MENU) && defined(HAVE_OZONE)
|
||||
/* Ozone requires runtime/last played strings to be
|
||||
* populated even when no runtime is recorded */
|
||||
if (string_is_equal(menu_ident, "ozone"))
|
||||
#if defined(HAVE_MENU) && (defined(HAVE_OZONE) || defined(HAVE_MATERIALUI))
|
||||
/* Ozone and GLUI require runtime/last played strings
|
||||
* to be populated even when no runtime is recorded */
|
||||
if (update_entry.runtime_status != PLAYLIST_RUNTIME_VALID)
|
||||
{
|
||||
if (update_entry.runtime_status != PLAYLIST_RUNTIME_VALID)
|
||||
if (string_is_equal(menu_ident, "ozone") ||
|
||||
string_is_equal(menu_ident, "glui"))
|
||||
{
|
||||
runtime_log_get_runtime_str(NULL, runtime_str, sizeof(runtime_str));
|
||||
runtime_log_get_last_played_str(NULL, last_played_str, sizeof(last_played_str), timedate_style);
|
||||
|
||||
/* While runtime data does not exist, the playlist
|
||||
* entry does now contain valid information... */
|
||||
update_entry.runtime_status = PLAYLIST_RUNTIME_VALID;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user