mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-12 20:58:18 +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",
|
"xutility": "c",
|
||||||
"menu_input_dialog.h": "c",
|
"menu_input_dialog.h": "c",
|
||||||
"menu_filebrowser.h": "c",
|
"menu_filebrowser.h": "c",
|
||||||
"ozone_sidebar.h": "c"
|
"ozone_sidebar.h": "c",
|
||||||
|
"menu_thumbnail_path.h": "c"
|
||||||
},
|
},
|
||||||
"C_Cpp.dimInactiveRegions": false,
|
"C_Cpp.dimInactiveRegions": false,
|
||||||
}
|
}
|
@ -56,32 +56,6 @@
|
|||||||
#include "../../../tasks/tasks_internal.h"
|
#include "../../../tasks/tasks_internal.h"
|
||||||
#include "../../../dynamic.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 *ozone_alloc_node(void)
|
||||||
{
|
{
|
||||||
ozone_node_t *node = (ozone_node_t*)malloc(sizeof(*node));
|
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->show_thumbnail_bar = false;
|
||||||
ozone->dimensions.sidebar_width = 0.0f;
|
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_sidebar_update_collapse(ozone, false);
|
||||||
|
|
||||||
ozone->system_tab_end = 0;
|
ozone->system_tab_end = 0;
|
||||||
@ -376,17 +354,8 @@ static void ozone_free(void *data)
|
|||||||
if (!string_is_empty(ozone->pending_message))
|
if (!string_is_empty(ozone->pending_message))
|
||||||
free(ozone->pending_message);
|
free(ozone->pending_message);
|
||||||
|
|
||||||
if (!string_is_empty(ozone->thumbnail_content))
|
if (ozone->thumbnail_path_data)
|
||||||
free(ozone->thumbnail_content);
|
free(ozone->thumbnail_path_data);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,54 +371,28 @@ unsigned ozone_count_lines(const char *str)
|
|||||||
|
|
||||||
static void ozone_update_thumbnail_path(void *data, unsigned i, char pos)
|
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();
|
settings_t *settings = config_get_ptr();
|
||||||
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||||
playlist_t *playlist = NULL;
|
playlist_t *playlist = NULL;
|
||||||
const char *dir_thumbnails = settings->paths.directory_thumbnails;
|
const char *core_name = NULL;
|
||||||
|
|
||||||
menu_entry_init(&entry);
|
if (!ozone)
|
||||||
|
return;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
playlist = playlist_get_cached();
|
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)
|
if (playlist)
|
||||||
{
|
{
|
||||||
const char *core_name = NULL;
|
|
||||||
const char *core_label = NULL;
|
const char *core_label = NULL;
|
||||||
playlist_get_index(playlist, i,
|
playlist_get_index(playlist, i,
|
||||||
NULL, NULL, NULL, &core_name, NULL, NULL);
|
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",
|
snprintf(ozone->selection_lastplayed, sizeof(ozone->selection_lastplayed), "%s",
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED));
|
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)
|
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)
|
if (!ozone)
|
||||||
return;
|
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))
|
if (filestream_exists(right_thumbnail_path))
|
||||||
task_push_image_load(ozone->thumbnail_file_path,
|
task_push_image_load(right_thumbnail_path,
|
||||||
menu_display_handle_thumbnail_upload, NULL);
|
menu_display_handle_thumbnail_upload, NULL);
|
||||||
else
|
else
|
||||||
video_driver_texture_unload(&ozone->thumbnail);
|
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))
|
if (filestream_exists(left_thumbnail_path))
|
||||||
task_push_image_load(ozone->left_thumbnail_file_path,
|
task_push_image_load(left_thumbnail_path,
|
||||||
menu_display_handle_left_thumbnail_upload, NULL);
|
menu_display_handle_left_thumbnail_upload, NULL);
|
||||||
else
|
else
|
||||||
video_driver_texture_unload(&ozone->left_thumbnail);
|
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 */
|
/* Thumbnails */
|
||||||
if (!string_is_equal(ozone_thumbnails_ident('R'),
|
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT))
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
|
||||||
{
|
|
||||||
ozone_update_thumbnail_path(ozone, 0, 'R');
|
ozone_update_thumbnail_path(ozone, 0, 'R');
|
||||||
ozone_update_thumbnail_image(ozone);
|
|
||||||
}
|
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||||
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_path(ozone, 0, 'L');
|
||||||
ozone_update_thumbnail_image(ozone);
|
|
||||||
}
|
ozone_update_thumbnail_image(ozone);
|
||||||
|
|
||||||
/* TODO: update savestate thumbnail image */
|
/* 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);
|
menu_display_blend_end(video_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ozone_set_thumbnail_content(void *data, const char *s)
|
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;
|
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||||
if (!ozone)
|
if (!ozone)
|
||||||
return;
|
return;
|
||||||
if (!string_is_empty(ozone->thumbnail_content))
|
|
||||||
free(ozone->thumbnail_content);
|
if (ozone->is_playlist)
|
||||||
ozone->thumbnail_content = strdup(s);
|
{
|
||||||
|
/* 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;
|
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||||
if (!ozone)
|
if (!ozone)
|
||||||
return;
|
return;
|
||||||
if (!string_is_empty(ozone->thumbnail_content))
|
|
||||||
free(ozone->thumbnail_content);
|
if (ozone->thumbnail)
|
||||||
ozone->thumbnail_content = NULL;
|
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)
|
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)
|
if (!ozone)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!string_is_empty(ozone->thumbnail_system))
|
menu_thumbnail_set_system(ozone->thumbnail_path_data, s);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
|
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);
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
||||||
menu_animation_ctx_tag tag = (uintptr_t) selection_buf;
|
menu_animation_ctx_tag tag = (uintptr_t) selection_buf;
|
||||||
|
size_t selection = menu_navigation_get_selection();
|
||||||
|
|
||||||
size_t new_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');
|
menu_entry_init(&entry);
|
||||||
const char *left_thumb_ident = ozone_thumbnails_ident('L');
|
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||||
|
|
||||||
if (ozone->selection != new_selection)
|
if (ozone->selection != new_selection)
|
||||||
{
|
{
|
||||||
|
unsigned entry_type = menu_entry_get_type_new(&entry);
|
||||||
|
|
||||||
ozone->selection_old = ozone->selection;
|
ozone->selection_old = ozone->selection;
|
||||||
ozone->selection = new_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);
|
ozone_update_scroll(ozone, allow_animation, node);
|
||||||
|
|
||||||
/* Update thumbnail */
|
/* Update thumbnail */
|
||||||
if (!string_is_equal(thumb_ident,
|
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)) || !string_is_equal(left_thumb_ident,
|
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
|
||||||
{
|
{
|
||||||
menu_entry_t entry;
|
bool update_thumbnails = false;
|
||||||
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);
|
|
||||||
|
|
||||||
|
/* Playlist updates */
|
||||||
if (ozone->is_playlist && ozone->depth == 1)
|
if (ozone->is_playlist && ozone->depth == 1)
|
||||||
{
|
{
|
||||||
if (!string_is_empty(entry.path))
|
ozone_set_thumbnail_content( ozone, "");
|
||||||
ozone_set_thumbnail_content(ozone, entry.path);
|
update_thumbnails = true;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (((entry_type == FILE_TYPE_IMAGE || entry_type == FILE_TYPE_IMAGEVIEWER ||
|
/* Database list updates
|
||||||
entry_type == FILE_TYPE_RDB || entry_type == FILE_TYPE_RDB_ENTRY)
|
* (pointless nuisance...) */
|
||||||
&& ozone->tabs[ozone->categories_selection_ptr] <= OZONE_SYSTEM_TAB_SETTINGS))
|
else if (ozone->depth == 4 && ozone->is_db_manager_list)
|
||||||
{
|
{
|
||||||
if (!string_is_empty(entry.path))
|
ozone_set_thumbnail_content(ozone, "");
|
||||||
ozone_set_thumbnail_content(ozone, entry.path);
|
update_thumbnails = true;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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);
|
ozone_set_thumbnail_content(ozone, "imageviewer");
|
||||||
if (!string_is_equal(thumb_ident,
|
update_thumbnails = true;
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
}
|
||||||
{
|
|
||||||
ozone_update_thumbnail_path(ozone, i, 'R');
|
if (update_thumbnails)
|
||||||
ozone_update_thumbnail_image(ozone);
|
{
|
||||||
}
|
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT))
|
||||||
else if (!string_is_equal(left_thumb_ident,
|
ozone_update_thumbnail_path(ozone, 0 /* will be ignored */, 'R');
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
|
||||||
{
|
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||||
ozone_update_thumbnail_path(ozone, i, 'L');
|
ozone_update_thumbnail_path(ozone, 0 /* will be ignored */, 'L');
|
||||||
ozone_update_thumbnail_image(ozone);
|
|
||||||
}
|
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)
|
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))
|
if (menu_driver_ctl(RARCH_MENU_CTL_IS_PREVENT_POPULATE, NULL))
|
||||||
{
|
{
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_UNSET_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);
|
ozone_selection_changed(ozone, false);
|
||||||
return;
|
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);
|
new_depth = (int)ozone_list_get_size(ozone, MENU_LIST_PLAIN);
|
||||||
|
|
||||||
ozone->fade_direction = new_depth <= ozone->depth;
|
ozone->fade_direction = new_depth <= ozone->depth;
|
||||||
ozone->depth = new_depth;
|
ozone->depth = new_depth;
|
||||||
ozone->is_playlist = ozone_is_playlist(ozone, true);
|
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)
|
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
|
else
|
||||||
{
|
{
|
||||||
/* Thumbnails */
|
/* Thumbnails */
|
||||||
if (!string_is_equal(ozone_thumbnails_ident('R'),
|
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))
|
|
||||||
{
|
{
|
||||||
menu_entry_t entry;
|
ozone_unload_thumbnail_textures(ozone);
|
||||||
|
|
||||||
menu_entry_init(&entry);
|
if (ozone->is_playlist)
|
||||||
menu_entry_get(&entry, 0, ozone->selection, NULL, true);
|
{
|
||||||
|
ozone_set_thumbnail_content(ozone, "");
|
||||||
|
|
||||||
if (!string_is_empty(entry.path))
|
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT))
|
||||||
ozone_set_thumbnail_content(ozone, entry.path);
|
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);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2409,8 +2240,8 @@ menu_ctx_driver_t menu_ctx_ozone = {
|
|||||||
ozone_populate_entries,
|
ozone_populate_entries,
|
||||||
ozone_toggle,
|
ozone_toggle,
|
||||||
ozone_navigation_clear,
|
ozone_navigation_clear,
|
||||||
ozone_navigation_pointer_changed,
|
NULL,
|
||||||
ozone_navigation_pointer_changed,
|
NULL,
|
||||||
ozone_navigation_set,
|
ozone_navigation_set,
|
||||||
ozone_navigation_pointer_changed,
|
ozone_navigation_pointer_changed,
|
||||||
ozone_navigation_alphabet,
|
ozone_navigation_alphabet,
|
||||||
|
@ -24,7 +24,9 @@ typedef struct ozone_handle ozone_handle_t;
|
|||||||
|
|
||||||
#include <retro_miscellaneous.h>
|
#include <retro_miscellaneous.h>
|
||||||
|
|
||||||
|
#include "../../menu_thumbnail_path.h"
|
||||||
#include "../../menu_driver.h"
|
#include "../../menu_driver.h"
|
||||||
|
|
||||||
#include "../../../retroarch.h"
|
#include "../../../retroarch.h"
|
||||||
|
|
||||||
#define ANIMATION_PUSH_ENTRY_DURATION 166
|
#define ANIMATION_PUSH_ENTRY_DURATION 166
|
||||||
@ -229,18 +231,17 @@ struct ozone_handle
|
|||||||
/* Thumbnails data */
|
/* Thumbnails data */
|
||||||
bool show_thumbnail_bar;
|
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 thumbnail;
|
||||||
uintptr_t left_thumbnail;
|
uintptr_t left_thumbnail;
|
||||||
|
|
||||||
|
menu_thumbnail_path_data_t *thumbnail_path_data;
|
||||||
|
|
||||||
char selection_core_name[255];
|
char selection_core_name[255];
|
||||||
char selection_playtime[255];
|
char selection_playtime[255];
|
||||||
char selection_lastplayed[255];
|
char selection_lastplayed[255];
|
||||||
unsigned selection_core_name_lines;
|
unsigned selection_core_name_lines;
|
||||||
|
|
||||||
|
bool is_db_manager_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* If you change this struct, also
|
/* 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);
|
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);
|
unsigned ozone_count_lines(const char *str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -682,11 +682,9 @@ void ozone_draw_thumbnail_bar(ozone_handle_t *ozone, video_frame_info_t *video_i
|
|||||||
|
|
||||||
/* Thumbnails */
|
/* Thumbnails */
|
||||||
thumbnail = ozone->thumbnail &&
|
thumbnail = ozone->thumbnail &&
|
||||||
!string_is_equal(ozone_thumbnails_ident('R'),
|
menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT);
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF));
|
|
||||||
left_thumbnail = ozone->left_thumbnail &&
|
left_thumbnail = ozone->left_thumbnail &&
|
||||||
!string_is_equal(ozone_thumbnails_ident('L'),
|
menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT);
|
||||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF));
|
|
||||||
|
|
||||||
/* If user requested "left" thumbnail instead of content metadata
|
/* If user requested "left" thumbnail instead of content metadata
|
||||||
* and no thumbnails are available, show a centered message and
|
* and no thumbnails are available, show a centered message and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user