Horizontal Playlists tab now shows playlist names without '.lpl'

extension
This commit is contained in:
twinaphex 2016-07-09 13:49:31 +02:00
parent 180c0c87c1
commit c8415e9194
6 changed files with 64 additions and 14 deletions

View File

@ -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:

View File

@ -14,10 +14,12 @@
*/
#include <compat/strl.h>
#include <file/file_path.h>
#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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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));
}

View File

@ -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,