diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index 442df696a3..a35e7dbb51 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -1184,6 +1184,8 @@ static const char *menu_hash_to_str_us_label_enum(enum msg_hash_enums msg) return "input_libretro_device_p%u"; case MENU_ENUM_LABEL_RUN: return "collection"; + case MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY: + return "playlist_collection_entry"; case MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY: return "cheevos_locked_entry"; case MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY: diff --git a/menu/cbs/menu_cbs_label.c b/menu/cbs/menu_cbs_label.c index ee37ec07c0..09386a4347 100644 --- a/menu/cbs/menu_cbs_label.c +++ b/menu/cbs/menu_cbs_label.c @@ -14,10 +14,12 @@ */ #include +#include #include "../menu_driver.h" #include "../menu_cbs.h" #include "../menu_navigation.h" +#include "../../file_path_special.h" #ifndef BIND_ACTION_LABEL #define BIND_ACTION_LABEL(cbs, name) \ @@ -25,35 +27,72 @@ cbs->action_label_ident = #name; #endif -static int action_bind_label_generic(char *s, size_t len) +static int action_bind_label_generic( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { return 0; } -static int action_bind_label_information(char *s, size_t len) +static int action_bind_label_information( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INFORMATION), len); return 0; } -static int action_bind_label_internal_memory(char *s, size_t len) +static int action_bind_label_internal_memory( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { strlcpy(s, msg_hash_to_str(MSG_INTERNAL_MEMORY), len); return 0; } -static int action_bind_label_external_application_dir(char *s, size_t len) +static int action_bind_label_external_application_dir( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { strlcpy(s, msg_hash_to_str(MSG_EXTERNAL_APPLICATION_DIR), len); return 0; } -static int action_bind_label_application_dir(char *s, size_t len) +static int action_bind_label_application_dir( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) { strlcpy(s, msg_hash_to_str(MSG_APPLICATION_DIR), len); return 0; } +static int action_bind_label_playlist_collection_entry( + file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len) +{ + if (strstr(path, file_path_str(FILE_PATH_LPL_EXTENSION))) + { + char path_base[PATH_MAX_LENGTH] = {0}; + fill_short_pathname_representation_noext(path_base, path, + sizeof(path_base)); + + strlcpy(s, path_base, len); + } + return 0; +} + int menu_cbs_init_bind_label(menu_file_list_cbs_t *cbs, const char *path, const char *label, unsigned type, size_t idx) { @@ -66,6 +105,9 @@ int menu_cbs_init_bind_label(menu_file_list_cbs_t *cbs, { switch (cbs->enum_idx) { + case MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY: + BIND_ACTION_LABEL(cbs, action_bind_label_playlist_collection_entry); + break; case MSG_INTERNAL_MEMORY: BIND_ACTION_LABEL(cbs, action_bind_label_internal_memory); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b2311ef408..bef40cd5f6 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3290,7 +3290,7 @@ static int menu_displaylist_parse_playlists_horizontal( items_found++; menu_entries_add_enum(info->list, path, label, - MSG_UNKNOWN, + MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY, file_type, 0, 0); } diff --git a/menu/menu_entries.h b/menu/menu_entries.h index e6ddcff6ad..6724b70dae 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -111,7 +111,10 @@ typedef struct menu_file_list_cbs int (*action_up)(unsigned type, const char *label); const char *action_up_ident; - int (*action_label)(char *s, size_t len); + int (*action_label)(file_list_t *list, + unsigned type, unsigned i, + const char *label, const char *path, + char *s, size_t len); const char *action_label_ident; int (*action_down)(unsigned type, const char *label); diff --git a/menu/menu_entry.c b/menu/menu_entry.c index 72ff6c3f1f..2b7a942c61 100644 --- a/menu/menu_entry.c +++ b/menu/menu_entry.c @@ -290,23 +290,25 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, if (cbs) { + const char *label = NULL; + enum msg_hash_enums enum_idx = MSG_UNKNOWN; + entry->enum_idx = cbs->enum_idx; - if (cbs->action_get_value && use_representation) - { - enum msg_hash_enums enum_idx = MSG_UNKNOWN; - const char *label = NULL; - menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL); + menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL); + if (cbs->action_get_value && use_representation) cbs->action_get_value(list, &entry->spacing, entry->type, i, label, entry->value, sizeof(entry->value), entry_label, path, entry->path, sizeof(entry->path)); - } if (cbs->action_label) - cbs->action_label(entry->rich_label, + cbs->action_label(list, + entry->type, i, + label, path, + entry->rich_label, sizeof(entry->rich_label)); } diff --git a/msg_hash.h b/msg_hash.h index 4923f60f66..5e675acfb2 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -284,6 +284,7 @@ enum msg_hash_enums MSG_EXTRACTING_FILE, MSG_NO_CONTENT_STARTING_DUMMY_CORE, + MENU_ENUM_LABEL_PLAYLIST_COLLECTION_ENTRY, MENU_ENUM_LABEL_CHEEVOS_UNLOCKED_ENTRY, MENU_ENUM_LABEL_CHEEVOS_LOCKED_ENTRY, MENU_ENUM_LABEL_FILEBROWSER_ENTRY,