mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-08 10:27:41 +00:00
ozone: use menu_thumbnail for thumbnails
This commit is contained in:
parent
f50567d340
commit
43b1768ee7
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -66,7 +66,8 @@
|
||||
"xutility": "c",
|
||||
"menu_input_dialog.h": "c",
|
||||
"menu_filebrowser.h": "c",
|
||||
"ozone_sidebar.h": "c"
|
||||
"ozone_sidebar.h": "c",
|
||||
"menu_thumbnail_path.h": "c"
|
||||
},
|
||||
"C_Cpp.dimInactiveRegions": false,
|
||||
}
|
@ -56,32 +56,6 @@
|
||||
#include "../../../tasks/tasks_internal.h"
|
||||
#include "../../../dynamic.h"
|
||||
|
||||
const char *ozone_thumbnails_ident(char pos)
|
||||
{
|
||||
char folder = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (pos == 'R')
|
||||
folder = settings->uints.menu_thumbnails;
|
||||
if (pos == 'L')
|
||||
folder = settings->uints.menu_left_thumbnails;
|
||||
|
||||
switch (folder)
|
||||
{
|
||||
case 1:
|
||||
return "Named_Snaps";
|
||||
case 2:
|
||||
return "Named_Titles";
|
||||
case 3:
|
||||
return "Named_Boxarts";
|
||||
case 0:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF);
|
||||
}
|
||||
|
||||
ozone_node_t *ozone_alloc_node(void)
|
||||
{
|
||||
ozone_node_t *node = (ozone_node_t*)malloc(sizeof(*node));
|
||||
@ -199,6 +173,10 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
|
||||
ozone->show_thumbnail_bar = false;
|
||||
ozone->dimensions.sidebar_width = 0.0f;
|
||||
|
||||
ozone->thumbnail_path_data = menu_thumbnail_path_init();
|
||||
if (!ozone->thumbnail_path_data)
|
||||
goto error;
|
||||
|
||||
ozone_sidebar_update_collapse(ozone, false);
|
||||
|
||||
ozone->system_tab_end = 0;
|
||||
@ -376,17 +354,8 @@ static void ozone_free(void *data)
|
||||
if (!string_is_empty(ozone->pending_message))
|
||||
free(ozone->pending_message);
|
||||
|
||||
if (!string_is_empty(ozone->thumbnail_content))
|
||||
free(ozone->thumbnail_content);
|
||||
|
||||
if (!string_is_empty(ozone->thumbnail_system))
|
||||
free(ozone->thumbnail_system);
|
||||
|
||||
if (!string_is_empty(ozone->thumbnail_file_path))
|
||||
free(ozone->thumbnail_file_path);
|
||||
|
||||
if (!string_is_empty(ozone->left_thumbnail_file_path))
|
||||
free(ozone->left_thumbnail_file_path);
|
||||
if (ozone->thumbnail_path_data)
|
||||
free(ozone->thumbnail_path_data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,54 +371,28 @@ unsigned ozone_count_lines(const char *str)
|
||||
|
||||
static void ozone_update_thumbnail_path(void *data, unsigned i, char pos)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
unsigned entry_type = 0;
|
||||
char new_path[PATH_MAX_LENGTH] = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||
playlist_t *playlist = NULL;
|
||||
const char *dir_thumbnails = settings->paths.directory_thumbnails;
|
||||
const char *core_name = NULL;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
|
||||
if (!ozone || string_is_empty(dir_thumbnails))
|
||||
goto end;
|
||||
|
||||
menu_entry_get(&entry, 0, i, NULL, true);
|
||||
|
||||
entry_type = menu_entry_get_type_new(&entry);
|
||||
|
||||
if (entry_type == FILE_TYPE_IMAGEVIEWER || entry_type == FILE_TYPE_IMAGE)
|
||||
{
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
ozone_node_t *node = (ozone_node_t*)
|
||||
file_list_get_userdata_at_offset(selection_buf, i);
|
||||
|
||||
if (node && !string_is_empty(node->fullpath) &&
|
||||
(pos == 'R' || (pos == 'L' && string_is_equal(ozone_thumbnails_ident('R'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))))
|
||||
{
|
||||
if (!string_is_empty(entry.path))
|
||||
fill_pathname_join(
|
||||
new_path,
|
||||
node->fullpath,
|
||||
entry.path,
|
||||
sizeof(new_path));
|
||||
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else if (filebrowser_get_type() != FILEBROWSER_NONE)
|
||||
{
|
||||
video_driver_texture_unload(&ozone->thumbnail);
|
||||
goto end;
|
||||
}
|
||||
if (!ozone)
|
||||
return;
|
||||
|
||||
playlist = playlist_get_cached();
|
||||
|
||||
/* imageviewer content requires special treatment... */
|
||||
menu_thumbnail_get_core_name(ozone->thumbnail_path_data, &core_name);
|
||||
if (string_is_equal(core_name, "imageviewer"))
|
||||
{
|
||||
if ((pos == 'R') || (pos == 'L' && !menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT)))
|
||||
menu_thumbnail_update_path(ozone->thumbnail_path_data, pos == 'R' ? MENU_THUMBNAIL_RIGHT : MENU_THUMBNAIL_LEFT);
|
||||
}
|
||||
else
|
||||
menu_thumbnail_update_path(ozone->thumbnail_path_data, pos == 'R' ? MENU_THUMBNAIL_RIGHT : MENU_THUMBNAIL_LEFT);
|
||||
|
||||
if (playlist)
|
||||
{
|
||||
const char *core_name = NULL;
|
||||
const char *core_label = NULL;
|
||||
playlist_get_index(playlist, i,
|
||||
NULL, NULL, NULL, &core_name, NULL, NULL);
|
||||
@ -511,133 +454,34 @@ static void ozone_update_thumbnail_path(void *data, unsigned i, char pos)
|
||||
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s",
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED));
|
||||
}
|
||||
|
||||
if (string_is_equal(core_name, "imageviewer"))
|
||||
{
|
||||
if (
|
||||
(pos == 'R') ||
|
||||
(
|
||||
pos == 'L' &&
|
||||
string_is_equal(ozone_thumbnails_ident('R'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))
|
||||
)
|
||||
)
|
||||
{
|
||||
if (!string_is_empty(entry.label))
|
||||
strlcpy(new_path, entry.label,
|
||||
sizeof(new_path));
|
||||
}
|
||||
else
|
||||
video_driver_texture_unload(&ozone->left_thumbnail);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
/* Append thumbnail system directory */
|
||||
if (!string_is_empty(ozone->thumbnail_system))
|
||||
fill_pathname_join(
|
||||
new_path,
|
||||
dir_thumbnails,
|
||||
ozone->thumbnail_system,
|
||||
sizeof(new_path));
|
||||
|
||||
if (!string_is_empty(new_path))
|
||||
{
|
||||
char *tmp_new2 = (char*)
|
||||
malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
tmp_new2[0] = '\0';
|
||||
|
||||
/* Append Named_Snaps/Named_Boxarts/Named_Titles */
|
||||
if (pos == 'R')
|
||||
fill_pathname_join(tmp_new2, new_path,
|
||||
ozone_thumbnails_ident('R'), PATH_MAX_LENGTH * sizeof(char));
|
||||
if (pos == 'L')
|
||||
fill_pathname_join(tmp_new2, new_path,
|
||||
ozone_thumbnails_ident('L'), PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
strlcpy(new_path, tmp_new2,
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
free(tmp_new2);
|
||||
}
|
||||
|
||||
/* Scrub characters that are not cross-platform and/or violate the
|
||||
* No-Intro filename standard:
|
||||
* http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip
|
||||
* Replace these characters in the entry name with underscores.
|
||||
*/
|
||||
if (!string_is_empty(ozone->thumbnail_content))
|
||||
{
|
||||
char *scrub_char_pointer = NULL;
|
||||
char *tmp_new = (char*)
|
||||
malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char *tmp = strdup(ozone->thumbnail_content);
|
||||
|
||||
tmp_new[0] = '\0';
|
||||
|
||||
while((scrub_char_pointer = strpbrk(tmp, "&*/:`\"<>?\\|")))
|
||||
*scrub_char_pointer = '_';
|
||||
|
||||
/* Look for thumbnail file with this scrubbed filename */
|
||||
|
||||
fill_pathname_join(tmp_new,
|
||||
new_path,
|
||||
tmp, PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
if (!string_is_empty(tmp_new))
|
||||
strlcpy(new_path,
|
||||
tmp_new, sizeof(new_path));
|
||||
|
||||
free(tmp_new);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
/* Append png extension */
|
||||
if (!string_is_empty(new_path))
|
||||
strlcat(new_path,
|
||||
file_path_str(FILE_PATH_PNG_EXTENSION),
|
||||
sizeof(new_path));
|
||||
|
||||
end:
|
||||
if (ozone && !string_is_empty(new_path))
|
||||
{
|
||||
if (pos == 'R')
|
||||
ozone->thumbnail_file_path = strdup(new_path);
|
||||
if (pos == 'L')
|
||||
ozone->left_thumbnail_file_path = strdup(new_path);
|
||||
}
|
||||
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
|
||||
static void ozone_update_thumbnail_image(void *data)
|
||||
{
|
||||
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||
const char *right_thumbnail_path = NULL;
|
||||
const char *left_thumbnail_path = NULL;
|
||||
|
||||
if (!ozone)
|
||||
return;
|
||||
|
||||
if (!(string_is_empty(ozone->thumbnail_file_path)))
|
||||
if (menu_thumbnail_get_path(ozone->thumbnail_path_data, MENU_THUMBNAIL_RIGHT, &right_thumbnail_path))
|
||||
{
|
||||
if (filestream_exists(ozone->thumbnail_file_path))
|
||||
task_push_image_load(ozone->thumbnail_file_path,
|
||||
if (filestream_exists(right_thumbnail_path))
|
||||
task_push_image_load(right_thumbnail_path,
|
||||
menu_display_handle_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&ozone->thumbnail);
|
||||
|
||||
free(ozone->thumbnail_file_path);
|
||||
ozone->thumbnail_file_path = NULL;
|
||||
}
|
||||
|
||||
if (!(string_is_empty(ozone->left_thumbnail_file_path)))
|
||||
if (menu_thumbnail_get_path(ozone->thumbnail_path_data, MENU_THUMBNAIL_LEFT, &left_thumbnail_path))
|
||||
{
|
||||
if (filestream_exists(ozone->left_thumbnail_file_path))
|
||||
task_push_image_load(ozone->left_thumbnail_file_path,
|
||||
if (filestream_exists(left_thumbnail_path))
|
||||
task_push_image_load(left_thumbnail_path,
|
||||
menu_display_handle_left_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&ozone->left_thumbnail);
|
||||
|
||||
free(ozone->left_thumbnail_file_path);
|
||||
ozone->left_thumbnail_file_path = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -829,18 +673,13 @@ static void ozone_context_reset(void *data, bool is_threaded)
|
||||
}
|
||||
|
||||
/* Thumbnails */
|
||||
if (!string_is_equal(ozone_thumbnails_ident('R'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT))
|
||||
ozone_update_thumbnail_path(ozone, 0, 'R');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
if (!string_is_equal(ozone_thumbnails_ident('L'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||
ozone_update_thumbnail_path(ozone, 0, 'L');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
|
||||
/* TODO: update savestate thumbnail image */
|
||||
|
||||
@ -1354,25 +1193,74 @@ static void ozone_draw_footer(ozone_handle_t *ozone, video_frame_info_t *video_i
|
||||
menu_display_blend_end(video_info);
|
||||
}
|
||||
|
||||
|
||||
static void ozone_set_thumbnail_content(void *data, const char *s)
|
||||
{
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||
if (!ozone)
|
||||
return;
|
||||
if (!string_is_empty(ozone->thumbnail_content))
|
||||
free(ozone->thumbnail_content);
|
||||
ozone->thumbnail_content = strdup(s);
|
||||
|
||||
if (ozone->is_playlist)
|
||||
{
|
||||
/* Playlist content */
|
||||
if (string_is_empty(s))
|
||||
menu_thumbnail_set_content_playlist(ozone->thumbnail_path_data,
|
||||
playlist_get_cached(), selection);
|
||||
}
|
||||
else if (ozone->is_db_manager_list)
|
||||
{
|
||||
/* Database list content */
|
||||
if (string_is_empty(s))
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (!string_is_empty(entry.path))
|
||||
menu_thumbnail_set_content(ozone->thumbnail_path_data, entry.path);
|
||||
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
}
|
||||
else if (string_is_equal(s, "imageviewer"))
|
||||
{
|
||||
/* Filebrowser image updates */
|
||||
menu_entry_t entry;
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
ozone_node_t *node = (ozone_node_t*)file_list_get_userdata_at_offset(selection_buf, selection);
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (node)
|
||||
if (!string_is_empty(entry.path) && !string_is_empty(node->fullpath))
|
||||
menu_thumbnail_set_content_image(ozone->thumbnail_path_data, node->fullpath, entry.path);
|
||||
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
else if (!string_is_empty(s))
|
||||
{
|
||||
/* Annoying leftovers...
|
||||
* This is required to ensure that thumbnails are
|
||||
* updated correctly when navigating deeply through
|
||||
* the sublevels of database manager lists.
|
||||
* Showing thumbnails on database entries is a
|
||||
* pointless nuisance and a waste of CPU cycles, IMHO... */
|
||||
menu_thumbnail_set_content(ozone->thumbnail_path_data, s);
|
||||
}
|
||||
}
|
||||
|
||||
static void ozone_reset_thumbnail_content(void *data)
|
||||
static void ozone_unload_thumbnail_textures(void *data)
|
||||
{
|
||||
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||
if (!ozone)
|
||||
return;
|
||||
if (!string_is_empty(ozone->thumbnail_content))
|
||||
free(ozone->thumbnail_content);
|
||||
ozone->thumbnail_content = NULL;
|
||||
|
||||
if (ozone->thumbnail)
|
||||
video_driver_texture_unload(&ozone->thumbnail);
|
||||
if (ozone->left_thumbnail)
|
||||
video_driver_texture_unload(&ozone->left_thumbnail);
|
||||
}
|
||||
|
||||
static void ozone_set_thumbnail_system(void *data, char*s, size_t len)
|
||||
@ -1381,30 +1269,31 @@ static void ozone_set_thumbnail_system(void *data, char*s, size_t len)
|
||||
if (!ozone)
|
||||
return;
|
||||
|
||||
if (!string_is_empty(ozone->thumbnail_system))
|
||||
free(ozone->thumbnail_system);
|
||||
/* There is only one mame thumbnail repo */
|
||||
if (strncmp("MAME", s, 4) == 0)
|
||||
strcpy(s, "MAME");
|
||||
ozone->thumbnail_system = strdup(s);
|
||||
menu_thumbnail_set_system(ozone->thumbnail_path_data, s);
|
||||
}
|
||||
|
||||
static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||
menu_animation_ctx_tag tag = (uintptr_t) selection_buf;
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
size_t new_selection = menu_navigation_get_selection();
|
||||
ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, new_selection);
|
||||
ozone_node_t *node = (ozone_node_t*) file_list_get_userdata_at_offset(selection_buf, new_selection);
|
||||
|
||||
const char *thumb_ident = ozone_thumbnails_ident('R');
|
||||
const char *left_thumb_ident = ozone_thumbnails_ident('L');
|
||||
menu_entry_init(&entry);
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (ozone->selection != new_selection)
|
||||
{
|
||||
unsigned entry_type = menu_entry_get_type_new(&entry);
|
||||
|
||||
ozone->selection_old = ozone->selection;
|
||||
ozone->selection = new_selection;
|
||||
|
||||
@ -1414,74 +1303,46 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
|
||||
ozone_update_scroll(ozone, allow_animation, node);
|
||||
|
||||
/* Update thumbnail */
|
||||
if (!string_is_equal(thumb_ident,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)) || !string_is_equal(left_thumb_ident,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||
{
|
||||
menu_entry_t entry;
|
||||
unsigned entry_type;
|
||||
unsigned i = ozone->selection;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, (unsigned)i, NULL, true);
|
||||
entry_type = menu_entry_get_type_new(&entry);
|
||||
bool update_thumbnails = false;
|
||||
|
||||
/* Playlist updates */
|
||||
if (ozone->is_playlist && ozone->depth == 1)
|
||||
{
|
||||
if (!string_is_empty(entry.path))
|
||||
ozone_set_thumbnail_content(ozone, entry.path);
|
||||
if (!string_is_equal(thumb_ident,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
ozone_update_thumbnail_path(ozone, i, 'R');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
if (!string_is_equal(left_thumb_ident,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
ozone_update_thumbnail_path(ozone, i, 'L');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
ozone_set_thumbnail_content( ozone, "");
|
||||
update_thumbnails = true;
|
||||
}
|
||||
else if (((entry_type == FILE_TYPE_IMAGE || entry_type == FILE_TYPE_IMAGEVIEWER ||
|
||||
entry_type == FILE_TYPE_RDB || entry_type == FILE_TYPE_RDB_ENTRY)
|
||||
&& ozone->tabs[ozone->categories_selection_ptr] <= OZONE_SYSTEM_TAB_SETTINGS))
|
||||
/* Database list updates
|
||||
* (pointless nuisance...) */
|
||||
else if (ozone->depth == 4 && ozone->is_db_manager_list)
|
||||
{
|
||||
if (!string_is_empty(entry.path))
|
||||
ozone_set_thumbnail_content(ozone, entry.path);
|
||||
if (!string_is_equal(thumb_ident,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
ozone_update_thumbnail_path(ozone, i, 'R');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
else if (!string_is_equal(left_thumb_ident,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
ozone_update_thumbnail_path(ozone, i, 'L');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
ozone_set_thumbnail_content(ozone, "");
|
||||
update_thumbnails = true;
|
||||
}
|
||||
else if (filebrowser_get_type() != FILEBROWSER_NONE)
|
||||
/* Filebrowser image updates */
|
||||
else if (entry_type == FILE_TYPE_IMAGEVIEWER || entry_type == FILE_TYPE_IMAGE)
|
||||
{
|
||||
ozone_reset_thumbnail_content(ozone);
|
||||
if (!string_is_equal(thumb_ident,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
ozone_update_thumbnail_path(ozone, i, 'R');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
else if (!string_is_equal(left_thumb_ident,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
ozone_update_thumbnail_path(ozone, i, 'L');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
ozone_set_thumbnail_content(ozone, "imageviewer");
|
||||
update_thumbnails = true;
|
||||
}
|
||||
|
||||
if (update_thumbnails)
|
||||
{
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT))
|
||||
ozone_update_thumbnail_path(ozone, 0 /* will be ignored */, 'R');
|
||||
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||
ozone_update_thumbnail_path(ozone, 0 /* will be ignored */, 'L');
|
||||
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
/* TODO: Update savestate thumbnail */
|
||||
|
||||
//TODO: update savestate thumbnail and path
|
||||
}
|
||||
|
||||
menu_entry_free(&entry);
|
||||
}
|
||||
|
||||
static void ozone_navigation_clear(void *data, bool pending_push)
|
||||
@ -1812,22 +1673,6 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL))
|
||||
{
|
||||
menu_driver_ctl(RARCH_MENU_CTL_UNSET_PREVENT_POPULATE, NULL);
|
||||
|
||||
/* Thumbnails */
|
||||
if (!string_is_equal(ozone_thumbnails_ident('R'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
ozone_update_thumbnail_path(ozone, 0, 'R');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
/* TODO: update savestate thumbnail image */
|
||||
if (!string_is_equal(ozone_thumbnails_ident('L'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
ozone_update_thumbnail_path(ozone, 0, 'L');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
|
||||
ozone_selection_changed(ozone, false);
|
||||
return;
|
||||
}
|
||||
@ -1836,9 +1681,10 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab
|
||||
|
||||
new_depth = (int)ozone_list_get_size(ozone, MENU_LIST_PLAIN);
|
||||
|
||||
ozone->fade_direction = new_depth <= ozone->depth;
|
||||
ozone->depth = new_depth;
|
||||
ozone->is_playlist = ozone_is_playlist(ozone, true);
|
||||
ozone->fade_direction = new_depth <= ozone->depth;
|
||||
ozone->depth = new_depth;
|
||||
ozone->is_playlist = ozone_is_playlist(ozone, true);
|
||||
ozone->is_db_manager_list = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DATABASE_MANAGER_LIST));
|
||||
|
||||
if (ozone->categories_selection_ptr == ozone->categories_active_idx_old)
|
||||
{
|
||||
@ -1847,37 +1693,22 @@ static void ozone_populate_entries(void *data, const char *path, const char *lab
|
||||
else
|
||||
{
|
||||
/* Thumbnails */
|
||||
if (!string_is_equal(ozone_thumbnails_ident('R'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||
{
|
||||
menu_entry_t entry;
|
||||
ozone_unload_thumbnail_textures(ozone);
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, ozone->selection, NULL, true);
|
||||
if (ozone->is_playlist)
|
||||
{
|
||||
ozone_set_thumbnail_content(ozone, "");
|
||||
|
||||
if (!string_is_empty(entry.path))
|
||||
ozone_set_thumbnail_content(ozone, entry.path);
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT))
|
||||
ozone_update_thumbnail_path(ozone, 0 /* will be ignored */, 'R');
|
||||
|
||||
menu_entry_free(&entry);
|
||||
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||
ozone_update_thumbnail_path(ozone, 0 /* will be ignored */, 'L');
|
||||
|
||||
ozone_update_thumbnail_path(ozone, 0, 'R');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
if (!string_is_equal(ozone_thumbnails_ident('L'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
menu_entry_get(&entry, 0, ozone->selection, NULL, true);
|
||||
|
||||
if (!string_is_empty(entry.path))
|
||||
ozone_set_thumbnail_content(ozone, entry.path);
|
||||
|
||||
menu_entry_free(&entry);
|
||||
|
||||
ozone_update_thumbnail_path(ozone, 0, 'L');
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
ozone_update_thumbnail_image(ozone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2409,8 +2240,8 @@ menu_ctx_driver_t menu_ctx_ozone = {
|
||||
ozone_populate_entries,
|
||||
ozone_toggle,
|
||||
ozone_navigation_clear,
|
||||
ozone_navigation_pointer_changed,
|
||||
ozone_navigation_pointer_changed,
|
||||
NULL,
|
||||
NULL,
|
||||
ozone_navigation_set,
|
||||
ozone_navigation_pointer_changed,
|
||||
ozone_navigation_alphabet,
|
||||
|
@ -24,7 +24,9 @@ typedef struct ozone_handle ozone_handle_t;
|
||||
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "../../menu_thumbnail_path.h"
|
||||
#include "../../menu_driver.h"
|
||||
|
||||
#include "../../../retroarch.h"
|
||||
|
||||
#define ANIMATION_PUSH_ENTRY_DURATION 166
|
||||
@ -229,18 +231,17 @@ struct ozone_handle
|
||||
/* Thumbnails data */
|
||||
bool show_thumbnail_bar;
|
||||
|
||||
char *thumbnail_content;
|
||||
char *thumbnail_system;
|
||||
char *thumbnail_file_path;
|
||||
char *left_thumbnail_file_path; /* name taken from xmb for consistency but not actually on the left */
|
||||
|
||||
uintptr_t thumbnail;
|
||||
uintptr_t left_thumbnail;
|
||||
|
||||
menu_thumbnail_path_data_t *thumbnail_path_data;
|
||||
|
||||
char selection_core_name[255];
|
||||
char selection_playtime[255];
|
||||
char selection_lastplayed[255];
|
||||
unsigned selection_core_name_lines;
|
||||
|
||||
bool is_db_manager_list;
|
||||
};
|
||||
|
||||
/* If you change this struct, also
|
||||
@ -307,8 +308,6 @@ void ozone_entries_update_thumbnail_bar(ozone_handle_t *ozone, bool is_playlist,
|
||||
|
||||
void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_info);
|
||||
|
||||
const char *ozone_thumbnails_ident(char pos);
|
||||
|
||||
unsigned ozone_count_lines(const char *str);
|
||||
|
||||
#endif
|
||||
|
@ -682,11 +682,9 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
||||
|
||||
/* Thumbnails */
|
||||
thumbnail = ozone->thumbnail &&
|
||||
!string_is_equal(ozone_thumbnails_ident('R'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF));
|
||||
menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT);
|
||||
left_thumbnail = ozone->left_thumbnail &&
|
||||
!string_is_equal(ozone_thumbnails_ident('L'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF));
|
||||
menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT);
|
||||
|
||||
/* If user requested "left" thumbnail instead of content metadata
|
||||
* and no thumbnails are available, show a centered message and
|
||||
|
Loading…
x
Reference in New Issue
Block a user