Skip to content

ozone thumbnails improvements#8468

Merged
inactive123 merged 5 commits into
libretro:masterfrom
natinusala:master
Mar 14, 2019
Merged

ozone thumbnails improvements#8468
inactive123 merged 5 commits into
libretro:masterfrom
natinusala:master

Conversation

@natinusala
Copy link
Copy Markdown
Contributor

  • fixed a crash introduced by commit 643cd19
  • changed the content metadata panel layout to have everything left-aligned
  • fixed the thumbnails position and size
  • changed the code to use the new menu_thumbnail system by @jdgleaver

@jdgleaver
Copy link
Copy Markdown
Contributor

@natinusala Looks great, but you'll want to move all of this:

if (playlist)
{
const char *core_label = NULL;
playlist_get_index(playlist, i,
NULL, NULL, NULL, &core_name, NULL, NULL);
/* Fill core name */
if (!core_name || string_is_equal(core_name, "DETECT"))
core_label = msg_hash_to_str(MSG_AUTODETECT);
else
core_label = core_name;
snprintf(ozone->selection_core_name, sizeof(ozone->selection_core_name),
"%s %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), core_label);
word_wrap(ozone->selection_core_name, ozone->selection_core_name, (unsigned)((float)ozone->dimensions.thumbnail_bar_width * (float)0.85) / ozone->footer_font_glyph_width, false);
ozone->selection_core_name_lines = ozone_count_lines(ozone->selection_core_name);
/* Fill play time if applicable */
if (settings->bools.content_runtime_log || settings->bools.content_runtime_log_aggregate)
{
unsigned runtime_hours = 0;
unsigned runtime_minutes = 0;
unsigned runtime_seconds = 0;
unsigned last_played_year = 0;
unsigned last_played_month = 0;
unsigned last_played_day = 0;
unsigned last_played_hour = 0;
unsigned last_played_minute = 0;
unsigned last_played_second = 0;
playlist_get_runtime_index(playlist, i, NULL, NULL,
&runtime_hours, &runtime_minutes, &runtime_seconds,
&last_played_year, &last_played_month, &last_played_day,
&last_played_hour, &last_played_minute, &last_played_second);
snprintf(ozone->selection_playtime, sizeof(ozone->selection_playtime), "%s %02u:%02u:%02u",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_RUNTIME), runtime_hours, runtime_minutes, runtime_seconds);
if (last_played_year == 0 && last_played_month == 0 && last_played_day == 0
&& last_played_hour == 0 && last_played_minute == 0 && last_played_second == 0)
{
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER));
}
else
{
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s %04u/%02u/%02u -\n%02u:%02u:%02u",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED),
last_played_year, last_played_month, last_played_day,
last_played_hour, last_played_minute, last_played_second);
}
}
else
{
snprintf(ozone->selection_playtime, sizeof(ozone->selection_playtime), "%s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED));
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED));
}
}

from ozone_update_thumbnail_path() to ozone_set_thumbnail_content(). As it is, you're running through that piece of code twice every time the selection changes, which is a waste of CPU cycles... 🙂

@jdgleaver
Copy link
Copy Markdown
Contributor

Also, you should probably check that setting thumbnails in ozone_populate_entries() doesn't cause you to load thumbnails twice when loading a playlist.

@natinusala
Copy link
Copy Markdown
Contributor Author

@jdgleaver all good, thanks for the feedback!

@jdgleaver
Copy link
Copy Markdown
Contributor

You are very welcome!

@inactive123 inactive123 merged commit f239828 into libretro:master Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants