From fcf5d6bcdd0a5cabd6a9496c5954cc53857e630b Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Thu, 18 Jul 2019 19:11:30 +0200 Subject: [PATCH 1/9] Add sanitization settings to playlist. Add sanitization functions to libretro-common. Add sanitization functionality to menu display. --- Makefile.common | 3 +- .../include/playlists/label_sanitization.h | 38 ++++ .../playlists/label_sanitization.c | 205 ++++++++++++++++++ menu/menu_displaylist.c | 67 ++++-- playlist.c | 106 +++++---- playlist.h | 13 ++ 6 files changed, 371 insertions(+), 61 deletions(-) create mode 100644 libretro-common/include/playlists/label_sanitization.h create mode 100644 libretro-common/playlists/label_sanitization.c diff --git a/Makefile.common b/Makefile.common index 2238365813..6c4d73938b 100644 --- a/Makefile.common +++ b/Makefile.common @@ -259,7 +259,8 @@ OBJ += \ $(LIBRETRO_COMM_DIR)/features/features_cpu.o \ performance_counters.o \ verbosity.o \ - midi/drivers/null_midi.o + midi/drivers/null_midi.o \ + $(LIBRETRO_COMM_DIR)/playlists/label_sanitization.o ifeq ($(HAVE_AUDIOMIXER), 1) diff --git a/libretro-common/include/playlists/label_sanitization.h b/libretro-common/include/playlists/label_sanitization.h new file mode 100644 index 0000000000..53f19fac20 --- /dev/null +++ b/libretro-common/include/playlists/label_sanitization.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2010-2019 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (file_path.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#include + +void label_sanitize(char *label, size_t size, char *lchars, char *rchars, int dcount); + +void label_default_display(char *label, size_t size); + +void label_remove_parens(char *label, size_t size); + +void label_remove_brackets(char *label, size_t size); + +void label_remove_parens_and_brackets(char *label, size_t size); + +void label_keep_region(char *label, size_t size); + +void label_keep_disc(char *label, size_t size); + +void label_keep_region_and_disc(char *label, size_t size); diff --git a/libretro-common/playlists/label_sanitization.c b/libretro-common/playlists/label_sanitization.c new file mode 100644 index 0000000000..c9cb24fd00 --- /dev/null +++ b/libretro-common/playlists/label_sanitization.c @@ -0,0 +1,205 @@ +/* Copyright (C) 2010-2019 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (file_path.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include + +/* + * Does not work with nested blocks. + */ +void label_sanitize(char *label, size_t size, char *lchars, char *rchars, int dcount) +{ + bool copy = true; + int rindex = 0; + int lindex = 0; + char new_label[size]; + + for (; lindex < size && label[lindex] != '\0'; lindex++) + { + if (copy) + { + // check for the start of the range + for (int dindex = 0; dindex < dcount; dindex++) + { + if (label[lindex] == lchars[dindex]) + copy = false; + } + + if (copy) + new_label[rindex++] = label[lindex]; + } + else + { + // check for the end of the range + for (int dindex = 0; dindex < dcount; dindex++) + { + if (label[lindex] == rchars[dindex]) + copy = true; + } + } + } + + new_label[rindex] = label[lindex]; + + strcpy(label, new_label); +} + +void label_default_display(char *label, size_t size) +{ + return; +} + +void label_remove_parens(char *label, size_t size) +{ + label_sanitize(label, size, "(", ")", 1); +} + +void label_remove_brackets(char *label, size_t size) +{ + label_sanitize(label, size, "[", "]", 1); +} + +void label_remove_parens_and_brackets(char *label, size_t size) +{ + label_sanitize(label, size, "([", ")]", 2); +} + +void label_keep_region(char *label, size_t size) +{ + bool copy = true; + int rindex = 0; + int lindex = 0; + char new_label[size]; + + for (; lindex < size && label[lindex] != '\0'; lindex++) + { + if (copy) + { + if (label[lindex] == '(' || label[lindex] == '[') + { + if (!(label[lindex + 1] == 'E' + && label[lindex + 2] == 'u' + && label[lindex + 3] == 'r' + && label[lindex + 4] == 'o' + && label[lindex + 5] == 'p' + && label[lindex + 6] == 'e') + && !(label[lindex + 1] == 'J' + && label[lindex + 2] == 'a' + && label[lindex + 3] == 'p' + && label[lindex + 4] == 'a' + && label[lindex + 5] == 'n') + && !(label[lindex + 1] == 'U' + && label[lindex + 2] == 'S' + && label[lindex + 3] == 'A')) + copy = false; + } + + if (copy) + new_label[rindex++] = label[lindex]; + } + else if (label[lindex] == ')' || label[lindex] == ']') + copy = true; + } + + new_label[rindex] = label[lindex]; + + strcpy(label, new_label); +} + +void label_keep_disc(char *label, size_t size) +{ + bool copy = true; + int rindex = 0; + int lindex = 0; + char new_label[size]; + + for (; lindex < size && label[lindex] != '\0'; lindex++) + { + if (copy) + { + if (label[lindex] == '(' || label[lindex] == '[') + { + if (!(label[lindex + 1] == 'D' + && label[lindex + 2] == 'i' + && label[lindex + 3] == 's' + && label[lindex + 4] == 'c')) + copy = false; + } + + if (copy) + new_label[rindex++] = label[lindex]; + } + else if (label[lindex] == ')' || label[lindex] == ']') + copy = true; + } + + new_label[rindex] = label[lindex]; + + strcpy(label, new_label); +} + +void label_keep_region_and_disc(char *label, size_t size) +{ + bool copy = true; + int rindex = 0; + int lindex = 0; + char new_label[size]; + + for (; lindex < size && label[lindex] != '\0'; lindex++) + { + if (copy) + { + if (label[lindex] == '(' || label[lindex] == '[') + { + if (!(label[lindex + 1] == 'D' + && label[lindex + 2] == 'i' + && label[lindex + 3] == 's' + && label[lindex + 4] == 'c') + && !(label[lindex + 1] == 'E' + && label[lindex + 2] == 'u' + && label[lindex + 3] == 'r' + && label[lindex + 4] == 'o' + && label[lindex + 5] == 'p' + && label[lindex + 6] == 'e') + && !(label[lindex + 1] == 'J' + && label[lindex + 2] == 'a' + && label[lindex + 3] == 'p' + && label[lindex + 4] == 'a' + && label[lindex + 5] == 'n') + && !(label[lindex + 1] == 'U' + && label[lindex + 2] == 'S' + && label[lindex + 3] == 'A')) + copy = false; + } + + if (copy) + new_label[rindex++] = label[lindex]; + } + else if (label[lindex] == ')' || label[lindex] == ']') + copy = true; + } + + new_label[rindex] = label[lindex]; + + strcpy(label, new_label); +} diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index bb48a4d6e5..a7b296e5bd 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -905,6 +906,32 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, /* Preallocate the file list */ file_list_reserve(info->list, list_size); + void (*sanitization)(char*, size_t); + + switch (playlist_get_label_display_mode(playlist)) + { + case LABEL_DISPLAY_MODE_REMOVE_PARENTHESES : + sanitization = &label_remove_parens; + break; + case LABEL_DISPLAY_MODE_REMOVE_BRACKETS : + sanitization = &label_remove_brackets; + break; + case LABEL_DISPLAY_MODE_REMOVE_PARENTHESES_AND_BRACKETS : + sanitization = &label_remove_parens_and_brackets; + break; + case LABEL_DISPLAY_MODE_KEEP_DISC_INDEX : + sanitization = &label_keep_disc; + break; + case LABEL_DISPLAY_MODE_KEEP_REGION : + sanitization = &label_keep_region; + break; + case LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX : + sanitization = &label_keep_region_and_disc; + break; + default : + sanitization = &label_default_display; + } + for (i = 0; i < list_size; i++) { char menu_entry_label[PATH_MAX_LENGTH]; @@ -924,9 +951,14 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, * no further action is necessary */ if (string_is_empty(entry->label)) + { fill_short_pathname_representation(menu_entry_label, entry->path, sizeof(menu_entry_label)); + } else + { strlcpy(menu_entry_label, entry->label, sizeof(menu_entry_label)); + (*sanitization)(menu_entry_label, sizeof(menu_entry_label)); + } if (show_inline_core_name) { @@ -2698,6 +2730,7 @@ static bool menu_displaylist_parse_playlist_manager_settings( FILE_TYPE_PLAYLIST_ENTRY, 0, 0); /* TODO: Add + * - Label display mode * - Remove invalid entries */ return true; @@ -2710,10 +2743,10 @@ static unsigned menu_displaylist_parse_pl_thumbnail_download_list( settings_t *settings = config_get_ptr(); unsigned count = 0; struct string_list *str_list = NULL; - + if (!settings) return count; - + str_list = dir_list_new_special( settings->paths.directory_playlist, DIR_LIST_COLLECTIONS, NULL); @@ -3476,7 +3509,7 @@ bool menu_displaylist_setting(menu_displaylist_ctx_parse_entry_t *entry) typedef struct menu_displaylist_build_info { enum msg_hash_enums enum_idx; enum menu_displaylist_parse_type parse_type; -} menu_displaylist_build_info_t; +} menu_displaylist_build_info_t; typedef struct menu_displaylist_build_info_selective { enum msg_hash_enums enum_idx; @@ -3710,15 +3743,15 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct case DISPLAYLIST_PERFCOUNTERS_FRONTEND: { unsigned i; - struct retro_perf_counter **counters = + struct retro_perf_counter **counters = (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? retro_get_perf_counter_libretro() : retro_get_perf_counter_rarch(); - unsigned num = + unsigned num = (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? retro_get_perf_count_libretro() : retro_get_perf_count_rarch(); - unsigned id = + unsigned id = (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN : MENU_SETTINGS_PERF_COUNTERS_BEGIN; @@ -7529,9 +7562,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, { char desc_label[400]; char descriptor[300]; - const struct retro_keybind *keybind = + const struct retro_keybind *keybind = &input_config_binds[p][retro_id]; - const struct retro_keybind *auto_bind = + const struct retro_keybind *auto_bind = (const struct retro_keybind*) input_config_get_bind_auto(p, retro_id); @@ -7551,7 +7584,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, /* Add user index when display driver == rgui and sublabels * are disabled, but only if there is more than one user */ if ( (is_rgui) - && (max_users > 1) + && (max_users > 1) && !settings->bools.menu_show_sublabels) { snprintf(desc_label, sizeof(desc_label), @@ -7572,9 +7605,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, { char desc_label[400]; char descriptor[300]; - const struct retro_keybind *keybind = + const struct retro_keybind *keybind = &input_config_binds[p][retro_id]; - const struct retro_keybind *auto_bind = + const struct retro_keybind *auto_bind = (const struct retro_keybind*) input_config_get_bind_auto(p, retro_id); @@ -7593,7 +7626,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, /* Add user index when display driver == rgui and sublabels * are disabled, but only if there is more than one user */ if ( (is_rgui) - && (max_users > 1) + && (max_users > 1) && !settings->bools.menu_show_sublabels) { snprintf(desc_label, sizeof(desc_label), @@ -7740,7 +7773,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, if (settings->bools.menu_show_load_content) { const struct retro_subsystem_info* subsystem = subsystem_data; - /* Core not loaded completely, use the data we + /* Core not loaded completely, use the data we * peeked on load core */ if (menu_displaylist_parse_settings_enum(info->list, @@ -8068,7 +8101,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, new_exts[0] = '\0'; filebrowser_clear_type(); - + if (type == DISPLAYLIST_SHADER_PRESET) info->type_default = FILE_TYPE_SHADER_PRESET; else if (type == DISPLAYLIST_SHADER_PASS) @@ -8081,7 +8114,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, else if (type == DISPLAYLIST_SHADER_PASS) string_list_append(str_list, "cg", attr); } - + if (video_shader_is_supported(RARCH_SHADER_GLSL)) { if (type == DISPLAYLIST_SHADER_PRESET) @@ -8089,7 +8122,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, else if (type == DISPLAYLIST_SHADER_PASS) string_list_append(str_list, "glsl", attr); } - + if (video_shader_is_supported(RARCH_SHADER_SLANG)) { if (type == DISPLAYLIST_SHADER_PRESET) @@ -8288,7 +8321,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, case DISPLAYLIST_DATABASE_PLAYLISTS: case DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL: { - bool is_horizontal = + bool is_horizontal = (type == DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); diff --git a/playlist.c b/playlist.c index a112a2b7d8..b47df0b5da 100644 --- a/playlist.c +++ b/playlist.c @@ -43,6 +43,7 @@ struct content_playlist { bool modified; + enum playlist_label_display_mode label_display_mode; size_t size; size_t cap; @@ -224,6 +225,13 @@ char *playlist_get_conf_path(playlist_t *playlist) return playlist->conf_path; } +enum playlist_label_display_mode playlist_get_label_display_mode(playlist_t *playlist) +{ + if (!playlist) + return LABEL_DISPLAY_MODE_DEFAULT; + return playlist->label_display_mode; +} + /** * playlist_get_index: * @playlist : Playlist handle. @@ -743,29 +751,29 @@ bool playlist_push(playlist_t *playlist, if (!playlist_core_path_equal(real_core_path, playlist->entries[i].core_path)) continue; - if ( !string_is_empty(entry->subsystem_ident) - && !string_is_empty(playlist->entries[i].subsystem_ident) + if ( !string_is_empty(entry->subsystem_ident) + && !string_is_empty(playlist->entries[i].subsystem_ident) && !string_is_equal(playlist->entries[i].subsystem_ident, entry->subsystem_ident)) continue; - if ( string_is_empty(entry->subsystem_ident) + if ( string_is_empty(entry->subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident)) continue; - if ( !string_is_empty(entry->subsystem_ident) + if ( !string_is_empty(entry->subsystem_ident) && string_is_empty(playlist->entries[i].subsystem_ident)) continue; - if ( !string_is_empty(entry->subsystem_name) - && !string_is_empty(playlist->entries[i].subsystem_name) + if ( !string_is_empty(entry->subsystem_name) + && !string_is_empty(playlist->entries[i].subsystem_name) && !string_is_equal(playlist->entries[i].subsystem_name, entry->subsystem_name)) continue; - if ( string_is_empty(entry->subsystem_name) + if ( string_is_empty(entry->subsystem_name) && !string_is_empty(playlist->entries[i].subsystem_name)) continue; - if ( !string_is_empty(entry->subsystem_name) + if ( !string_is_empty(entry->subsystem_name) && string_is_empty(playlist->entries[i].subsystem_name)) continue; @@ -842,7 +850,7 @@ bool playlist_push(playlist_t *playlist, if (playlist->size == playlist->cap) { - struct playlist_entry *last_entry = + struct playlist_entry *last_entry = &playlist->entries[playlist->cap - 1]; if (last_entry) @@ -1000,11 +1008,11 @@ void playlist_write_runtime_file(playlist_t *playlist) JSON_Writer_WriteColon(context.writer); JSON_Writer_WriteSpace(context.writer, 1); JSON_Writer_WriteString(context.writer, - playlist->entries[i].path - ? playlist->entries[i].path + playlist->entries[i].path + ? playlist->entries[i].path : "", - playlist->entries[i].path - ? strlen(playlist->entries[i].path) + playlist->entries[i].path + ? strlen(playlist->entries[i].path) : 0, JSON_UTF8); JSON_Writer_WriteComma(context.writer); @@ -1291,11 +1299,11 @@ void playlist_write_file(playlist_t *playlist) JSON_Writer_WriteColon(context.writer); JSON_Writer_WriteSpace(context.writer, 1); JSON_Writer_WriteString(context.writer, - playlist->entries[i].path - ? playlist->entries[i].path + playlist->entries[i].path + ? playlist->entries[i].path : "", - playlist->entries[i].path - ? strlen(playlist->entries[i].path) + playlist->entries[i].path + ? strlen(playlist->entries[i].path) : 0, JSON_UTF8); JSON_Writer_WriteComma(context.writer); @@ -1307,11 +1315,11 @@ void playlist_write_file(playlist_t *playlist) JSON_Writer_WriteColon(context.writer); JSON_Writer_WriteSpace(context.writer, 1); JSON_Writer_WriteString(context.writer, - playlist->entries[i].label - ? playlist->entries[i].label + playlist->entries[i].label + ? playlist->entries[i].label : "", - playlist->entries[i].label - ? strlen(playlist->entries[i].label) + playlist->entries[i].label + ? strlen(playlist->entries[i].label) : 0, JSON_UTF8); JSON_Writer_WriteComma(context.writer); @@ -1345,8 +1353,8 @@ void playlist_write_file(playlist_t *playlist) JSON_Writer_WriteColon(context.writer); JSON_Writer_WriteSpace(context.writer, 1); JSON_Writer_WriteString(context.writer, playlist->entries[i].crc32 ? playlist->entries[i].crc32 : "", - playlist->entries[i].crc32 - ? strlen(playlist->entries[i].crc32) + playlist->entries[i].crc32 + ? strlen(playlist->entries[i].crc32) : 0, JSON_UTF8); JSON_Writer_WriteComma(context.writer); @@ -1358,8 +1366,8 @@ void playlist_write_file(playlist_t *playlist) JSON_Writer_WriteColon(context.writer); JSON_Writer_WriteSpace(context.writer, 1); JSON_Writer_WriteString(context.writer, playlist->entries[i].db_name ? playlist->entries[i].db_name : "", - playlist->entries[i].db_name - ? strlen(playlist->entries[i].db_name) + playlist->entries[i].db_name + ? strlen(playlist->entries[i].db_name) : 0, JSON_UTF8); @@ -1373,8 +1381,8 @@ void playlist_write_file(playlist_t *playlist) JSON_Writer_WriteColon(context.writer); JSON_Writer_WriteSpace(context.writer, 1); JSON_Writer_WriteString(context.writer, playlist->entries[i].subsystem_ident ? playlist->entries[i].subsystem_ident : "", - playlist->entries[i].subsystem_ident - ? strlen(playlist->entries[i].subsystem_ident) + playlist->entries[i].subsystem_ident + ? strlen(playlist->entries[i].subsystem_ident) : 0, JSON_UTF8); } @@ -1389,15 +1397,15 @@ void playlist_write_file(playlist_t *playlist) JSON_Writer_WriteColon(context.writer); JSON_Writer_WriteSpace(context.writer, 1); JSON_Writer_WriteString(context.writer, - playlist->entries[i].subsystem_name - ? playlist->entries[i].subsystem_name + playlist->entries[i].subsystem_name + ? playlist->entries[i].subsystem_name : "", - playlist->entries[i].subsystem_name - ? strlen(playlist->entries[i].subsystem_name) + playlist->entries[i].subsystem_name + ? strlen(playlist->entries[i].subsystem_name) : 0, JSON_UTF8); } - if ( playlist->entries[i].subsystem_roms && + if ( playlist->entries[i].subsystem_roms && playlist->entries[i].subsystem_roms->size > 0) { unsigned j; @@ -1417,11 +1425,11 @@ void playlist_write_file(playlist_t *playlist) const struct string_list *roms = playlist->entries[i].subsystem_roms; JSON_Writer_WriteSpace(context.writer, 8); JSON_Writer_WriteString(context.writer, - !string_is_empty(roms->elems[j].data) - ? roms->elems[j].data + !string_is_empty(roms->elems[j].data) + ? roms->elems[j].data : "", - !string_is_empty(roms->elems[j].data) - ? strlen(roms->elems[j].data) + !string_is_empty(roms->elems[j].data) + ? strlen(roms->elems[j].data) : 0, JSON_UTF8); @@ -2146,13 +2154,14 @@ playlist_t *playlist_init(const char *path, size_t size) return NULL; } - playlist->modified = false; - playlist->size = 0; - playlist->cap = size; - playlist->conf_path = strdup(path); - playlist->default_core_name = NULL; - playlist->default_core_path = NULL; - playlist->entries = entries; + playlist->modified = false; + playlist->size = 0; + playlist->cap = size; + playlist->conf_path = strdup(path); + playlist->default_core_name = NULL; + playlist->default_core_path = NULL; + playlist->entries = entries; + playlist->label_display_mode = LABEL_DISPLAY_MODE_DEFAULT; playlist_read_file(playlist, path); @@ -2378,3 +2387,14 @@ void playlist_set_default_core_name(playlist_t *playlist, const char *core_name) playlist->modified = true; } } + +void playlist_set_label_display_mode(playlist_t *playlist, enum playlist_label_display_mode label_display_mode) +{ + if (!playlist) + return; + + if (playlist->label_display_mode != label_display_mode) { + playlist->label_display_mode = label_display_mode; + playlist->modified = true; + } +} diff --git a/playlist.h b/playlist.h index ce29f849cb..0e2677f184 100644 --- a/playlist.h +++ b/playlist.h @@ -41,6 +41,17 @@ enum playlist_file_mode PLAYLIST_SAVE }; +enum playlist_label_display_mode +{ + LABEL_DISPLAY_MODE_DEFAULT = 0, + LABEL_DISPLAY_MODE_REMOVE_PARENTHESES, + LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + LABEL_DISPLAY_MODE_REMOVE_PARENTHESES_AND_BRACKETS, + LABEL_DISPLAY_MODE_KEEP_REGION, + LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX +}; + struct playlist_entry { char *path; @@ -213,9 +224,11 @@ void playlist_get_db_name(playlist_t *playlist, size_t idx, char *playlist_get_default_core_path(playlist_t *playlist); char *playlist_get_default_core_name(playlist_t *playlist); +enum playlist_label_display_mode playlist_get_label_display_mode(playlist_t *playlist); void playlist_set_default_core_path(playlist_t *playlist, const char *core_path); void playlist_set_default_core_name(playlist_t *playlist, const char *core_name); +void playlist_set_label_display_mode(playlist_t *playlist, enum playlist_label_display_mode label_display_mode); RETRO_END_DECLS From 55f4c04ff2eee5769832a471f18c6054c491a75c Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Thu, 18 Jul 2019 21:13:14 +0200 Subject: [PATCH 2/9] Add label_display_mode to playlist. Add label_display_mode to JSON format. Add label_display_mode to old playlist format. Add label_display_mode to configuration. Add label sanitization functions to libretro common. --- intl/msg_hash_lbl.h | 18 ++ intl/msg_hash_us.h | 36 +++ .../include/playlists/label_sanitization.h | 18 +- .../playlists/label_sanitization.c | 256 +++++++++--------- menu/cbs/menu_cbs_deferred_push.c | 6 + menu/cbs/menu_cbs_get_value.c | 22 ++ menu/cbs/menu_cbs_left.c | 26 +- menu/cbs/menu_cbs_ok.c | 43 +++ menu/cbs/menu_cbs_right.c | 24 ++ menu/cbs/menu_cbs_title.c | 6 + menu/menu_cbs.h | 1 + menu/menu_displaylist.c | 41 ++- menu/menu_displaylist.h | 1 + menu/menu_driver.h | 2 + msg_hash.h | 13 + playlist.c | 51 +++- 16 files changed, 428 insertions(+), 136 deletions(-) diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index f433e13eb6..62d22b2fee 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -273,6 +273,8 @@ MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION, "deferred_dropdown_box_list_resolution") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_DEFAULT_CORE, "deferred_dropdown_box_list_playlist_default_core") +MSG_HASH(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE, + "deferred_dropdown_box_list_playlist_label_display_mode") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST, "deferred_configurations_list") MSG_HASH(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST, @@ -887,6 +889,22 @@ MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE, "playlist_manager_default_core") MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_RESET_CORES, "playlist_manager_reset_cores") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "playlist_manager_label_display_mode") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "playlist_manager_label_display_mode_default") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "playlist_manager_label_display_mode_remove_parens") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "playlist_manager_label_display_mode_remove_brackets") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "playlist_manager_label_display_mode_remove_parens_and_brackets") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "playlist_manager_label_display_mode_keep_region") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "playlist_manager_label_display_mode_keep_disc_index") +MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "playlist_manager_label_display_mode_keep_region_and_disc_index") MSG_HASH(MENU_ENUM_LABEL_PLAYLIST_SETTINGS_BEGIN, "playlist_settings_begin") MSG_HASH(MENU_ENUM_LABEL_POINTER_ENABLE, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index ed13497a41..e1c6c56589 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2196,6 +2196,42 @@ MSG_HASH( MSG_PLAYLIST_MANAGER_CORES_RESET, "Cores reset: " ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Touch Support" diff --git a/libretro-common/include/playlists/label_sanitization.h b/libretro-common/include/playlists/label_sanitization.h index 53f19fac20..077a60498a 100644 --- a/libretro-common/include/playlists/label_sanitization.h +++ b/libretro-common/include/playlists/label_sanitization.h @@ -20,8 +20,24 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include -void label_sanitize(char *label, size_t size, char *lchars, char *rchars, int dcount); +void label_sanitize(char *label, size_t size, bool (*left)(char*), bool (*right)(char*)); + +bool left_parens(char *left); +bool right_parens(char *right); + +bool left_brackets(char *left); +bool right_brackets(char *right); + +bool left_parens_or_brackets(char *left); +bool right_parens_or_brackets(char *right); + +bool left_parens_or_brackets_excluding_region(char *left); + +bool left_parens_or_brackets_excluding_disc(char *left); + +bool left_parens_or_brackets_excluding_region_or_disc(char *left); void label_default_display(char *label, size_t size); diff --git a/libretro-common/playlists/label_sanitization.c b/libretro-common/playlists/label_sanitization.c index c9cb24fd00..91ca5bd2fb 100644 --- a/libretro-common/playlists/label_sanitization.c +++ b/libretro-common/playlists/label_sanitization.c @@ -21,13 +21,12 @@ */ #include -#include #include /* * Does not work with nested blocks. */ -void label_sanitize(char *label, size_t size, char *lchars, char *rchars, int dcount) +void label_sanitize(char *label, size_t size, bool (*left)(char*), bool (*right)(char*)) { bool copy = true; int rindex = 0; @@ -39,24 +38,14 @@ void label_sanitize(char *label, size_t size, char *lchars, char *rchars, int dc if (copy) { // check for the start of the range - for (int dindex = 0; dindex < dcount; dindex++) - { - if (label[lindex] == lchars[dindex]) - copy = false; - } + if ((*left)(&label[lindex])) + copy = false; if (copy) new_label[rindex++] = label[lindex]; } - else - { - // check for the end of the range - for (int dindex = 0; dindex < dcount; dindex++) - { - if (label[lindex] == rchars[dindex]) - copy = true; - } - } + else if ((*right)(&label[lindex])) + copy = true; } new_label[rindex] = label[lindex]; @@ -64,6 +53,124 @@ void label_sanitize(char *label, size_t size, char *lchars, char *rchars, int dc strcpy(label, new_label); } +bool left_parens(char *left) +{ + return left[0] == '('; +} + +bool right_parens(char *right) +{ + return right[0] == ')'; +} + +bool left_brackets(char *left) +{ + return left[0] == '['; +} + +bool right_brackets(char *right) +{ + return right[0] == ']'; +} + +bool left_parens_or_brackets(char *left) +{ + return left[0] == '(' || left[0] == '['; +} + +bool right_parens_or_brackets(char *right) +{ + return right[0] == ']' || right[0] == ']'; +} + +bool left_parens_or_brackets_excluding_region(char *left) +{ + if (left_parens_or_brackets(left)) + { + if ((left[1] == 'A' + && left[2] == 'u' + && left[3] == 's' + && left[4] == 'r' + && left[5] == 'a' + && left[6] == 'l' + && left[7] == 'i' + && left[8] == 'a') + || (left[1] == 'E' + && left[2] == 'u' + && left[3] == 'r' + && left[4] == 'o' + && left[5] == 'p' + && left[6] == 'e') + || (left[1] == 'J' + && left[2] == 'a' + && left[3] == 'p' + && left[4] == 'a' + && left[5] == 'n') + || (left[1] == 'U' + && left[2] == 'S' + && left[3] == 'A')) + return false; + else + return true; + } + else + return false; +} + +bool left_parens_or_brackets_excluding_disc(char *left) +{ + if (left_parens_or_brackets(left)) + { + if (left[1] == 'D' + && left[2] == 'i' + && left[3] == 's' + && left[4] == 'c') + return false; + else + return true; + } + else + return false; +} + +bool left_parens_or_brackets_excluding_region_or_disc(char *left) +{ + if (left_parens_or_brackets(left)) + { + if ((left[1] == 'A' + && left[2] == 'u' + && left[3] == 's' + && left[4] == 'r' + && left[5] == 'a' + && left[6] == 'l' + && left[7] == 'i' + && left[8] == 'a') + || (left[1] == 'E' + && left[2] == 'u' + && left[3] == 'r' + && left[4] == 'o' + && left[5] == 'p' + && left[6] == 'e') + || (left[1] == 'J' + && left[2] == 'a' + && left[3] == 'p' + && left[4] == 'a' + && left[5] == 'n') + || (left[1] == 'U' + && left[2] == 'S' + && left[3] == 'A') + || (left[1] == 'D' + && left[2] == 'i' + && left[3] == 's' + && left[4] == 'c')) + return false; + else + return true; + } + else + return false; +} + void label_default_display(char *label, size_t size) { return; @@ -71,135 +178,30 @@ void label_default_display(char *label, size_t size) void label_remove_parens(char *label, size_t size) { - label_sanitize(label, size, "(", ")", 1); + label_sanitize(label, size, left_parens, right_parens); } void label_remove_brackets(char *label, size_t size) { - label_sanitize(label, size, "[", "]", 1); + label_sanitize(label, size, left_brackets, right_brackets); } void label_remove_parens_and_brackets(char *label, size_t size) { - label_sanitize(label, size, "([", ")]", 2); + label_sanitize(label, size, left_parens_or_brackets, right_parens_or_brackets); } void label_keep_region(char *label, size_t size) { - bool copy = true; - int rindex = 0; - int lindex = 0; - char new_label[size]; - - for (; lindex < size && label[lindex] != '\0'; lindex++) - { - if (copy) - { - if (label[lindex] == '(' || label[lindex] == '[') - { - if (!(label[lindex + 1] == 'E' - && label[lindex + 2] == 'u' - && label[lindex + 3] == 'r' - && label[lindex + 4] == 'o' - && label[lindex + 5] == 'p' - && label[lindex + 6] == 'e') - && !(label[lindex + 1] == 'J' - && label[lindex + 2] == 'a' - && label[lindex + 3] == 'p' - && label[lindex + 4] == 'a' - && label[lindex + 5] == 'n') - && !(label[lindex + 1] == 'U' - && label[lindex + 2] == 'S' - && label[lindex + 3] == 'A')) - copy = false; - } - - if (copy) - new_label[rindex++] = label[lindex]; - } - else if (label[lindex] == ')' || label[lindex] == ']') - copy = true; - } - - new_label[rindex] = label[lindex]; - - strcpy(label, new_label); + label_sanitize(label, size, left_parens_or_brackets_excluding_region, right_parens_or_brackets); } void label_keep_disc(char *label, size_t size) { - bool copy = true; - int rindex = 0; - int lindex = 0; - char new_label[size]; - - for (; lindex < size && label[lindex] != '\0'; lindex++) - { - if (copy) - { - if (label[lindex] == '(' || label[lindex] == '[') - { - if (!(label[lindex + 1] == 'D' - && label[lindex + 2] == 'i' - && label[lindex + 3] == 's' - && label[lindex + 4] == 'c')) - copy = false; - } - - if (copy) - new_label[rindex++] = label[lindex]; - } - else if (label[lindex] == ')' || label[lindex] == ']') - copy = true; - } - - new_label[rindex] = label[lindex]; - - strcpy(label, new_label); + label_sanitize(label, size, left_parens_or_brackets_excluding_disc, right_parens_or_brackets); } void label_keep_region_and_disc(char *label, size_t size) { - bool copy = true; - int rindex = 0; - int lindex = 0; - char new_label[size]; - - for (; lindex < size && label[lindex] != '\0'; lindex++) - { - if (copy) - { - if (label[lindex] == '(' || label[lindex] == '[') - { - if (!(label[lindex + 1] == 'D' - && label[lindex + 2] == 'i' - && label[lindex + 3] == 's' - && label[lindex + 4] == 'c') - && !(label[lindex + 1] == 'E' - && label[lindex + 2] == 'u' - && label[lindex + 3] == 'r' - && label[lindex + 4] == 'o' - && label[lindex + 5] == 'p' - && label[lindex + 6] == 'e') - && !(label[lindex + 1] == 'J' - && label[lindex + 2] == 'a' - && label[lindex + 3] == 'p' - && label[lindex + 4] == 'a' - && label[lindex + 5] == 'n') - && !(label[lindex + 1] == 'U' - && label[lindex + 2] == 'S' - && label[lindex + 3] == 'A')) - copy = false; - } - - if (copy) - new_label[rindex++] = label[lindex]; - } - else if (label[lindex] == ')' || label[lindex] == ']') - copy = true; - } - - new_label[rindex] = label[lindex]; - - strcpy(label, new_label); + label_sanitize(label, size, left_parens_or_brackets_excluding_region_or_disc, right_parens_or_brackets); } diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 1fb62b7dde..68c5c8a45c 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -640,6 +640,7 @@ generic_deferred_push_clear_general(deferred_push_dropdown_box_list, PUSH_DEFAUL generic_deferred_push_clear_general(deferred_push_dropdown_box_list_special, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_SPECIAL) generic_deferred_push_clear_general(deferred_push_dropdown_box_list_resolution, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_RESOLUTION) generic_deferred_push_clear_general(deferred_push_dropdown_box_list_playlist_default_core, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_DEFAULT_CORE) +generic_deferred_push_clear_general(deferred_push_dropdown_box_list_playlist_label_display_mode, PUSH_DEFAULT, DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_LABEL_DISPLAY_MODE) static int menu_cbs_init_bind_deferred_push_compare_label( menu_file_list_cbs_t *cbs, @@ -680,6 +681,11 @@ static int menu_cbs_init_bind_deferred_push_compare_label( BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_dropdown_box_list_playlist_default_core); return 0; } + else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE))) + { + BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_dropdown_box_list_playlist_label_display_mode); + return 0; + } else if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_BROWSE_URL_LIST))) { BIND_ACTION_DEFERRED_PUSH(cbs, deferred_push_browse_url_list); diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 2cc762ad63..96dd2234ad 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1098,6 +1098,24 @@ static void menu_action_setting_disp_set_label_playlist_associations(file_list_t strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), len); } +static void menu_action_setting_disp_set_label_playlist_label_display_mode( + file_list_t* list, + unsigned *w, unsigned type, unsigned i, + const char *label, + char *s, size_t len, + const char *path, + char *s2, size_t len2) +{ + playlist_t *playlist = playlist_get_cached(); + enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); + + *w = 19; + + strlcpy(s2, path, len2); + + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + label_display_mode * 3), len); +} + static void menu_action_setting_disp_set_label_core_options(file_list_t* list, unsigned *w, unsigned type, unsigned i, const char *label, @@ -1345,6 +1363,10 @@ static int menu_cbs_init_bind_get_string_representation_compare_label( BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_playlist_associations); break; + case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE: + BIND_ACTION_GET_VALUE(cbs, + menu_action_setting_disp_set_label_playlist_label_display_mode); + break; default: return - 1; } diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index f794ceb9f2..ebf714924d 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -247,7 +247,7 @@ static int action_left_mainmenu(unsigned type, const char *label, file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); size_t selection = menu_navigation_get_selection(); - menu_file_list_cbs_t *cbs = selection_buf ? + menu_file_list_cbs_t *cbs = selection_buf ? (menu_file_list_cbs_t*) selection_buf->list[selection].actiondata : NULL; @@ -434,6 +434,27 @@ static int playlist_association_left(unsigned type, const char *label, return 0; } +static int playlist_label_display_mode_left(unsigned type, const char *label, + bool wraparound) +{ + playlist_t *playlist = playlist_get_cached(); + + if (!playlist) + return -1; + + enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); + + if (label_display_mode != LABEL_DISPLAY_MODE_DEFAULT) + label_display_mode--; + else if (wraparound) + label_display_mode = LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX; + + playlist_set_label_display_mode(playlist, label_display_mode); + playlist_write_file(playlist); + + return 0; +} + static int core_setting_left(unsigned type, const char *label, bool wraparound) { @@ -676,6 +697,9 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE: BIND_ACTION_LEFT(cbs, playlist_association_left); break; + case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE: + BIND_ACTION_LEFT(cbs, playlist_label_display_mode_left); + break; default: return -1; } diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 1f9eb35a29..e865100e27 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -177,6 +177,8 @@ static enum msg_hash_enums action_ok_dl_to_enum(unsigned lbl) return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION; case ACTION_OK_DL_DROPDOWN_BOX_LIST_PLAYLIST_DEFAULT_CORE: return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_DEFAULT_CORE; + case ACTION_OK_DL_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE: + return MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE; case ACTION_OK_DL_MIXER_STREAM_SETTINGS_LIST: return MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST; case ACTION_OK_DL_ACCOUNTS_LIST: @@ -390,6 +392,15 @@ int generic_action_ok_displaylist_push(const char *path, info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_DEFAULT_CORE; dl_type = DISPLAYLIST_GENERIC; break; + case ACTION_OK_DL_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE: + info.type = type; + info.directory_ptr = idx; + info_path = path; + info_label = msg_hash_to_str( + MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE); + info.enum_idx = MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE; + dl_type = DISPLAYLIST_GENERIC; + break; case ACTION_OK_DL_USER_BINDS_LIST: info.type = type; info.directory_ptr = idx; @@ -5359,6 +5370,19 @@ static int action_ok_push_dropdown_item_playlist_default_core(const char *path, return action_cancel_pop_default(NULL, NULL, 0, 0); } +static int action_ok_push_dropdown_item_playlist_label_display_mode(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + playlist_t *playlist = playlist_get_cached(); + + playlist_set_label_display_mode(playlist, idx); + + /* In all cases, update file on disk */ + playlist_write_file(playlist); + + return action_cancel_pop_default(NULL, NULL, 0, 0); +} + static int action_ok_push_default(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -5547,6 +5571,16 @@ static int action_ok_playlist_default_core(const char *path, return 0; } +static int action_ok_playlist_label_display_mode(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + generic_action_ok_displaylist_push( + NULL, + NULL, NULL, 0, 0, 0, + ACTION_OK_DL_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE); + return 0; +} + static int action_ok_netplay_enable_host(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -6364,6 +6398,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE: BIND_ACTION_OK(cbs, action_ok_playlist_default_core); break; + case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE: + BIND_ACTION_OK(cbs, action_ok_playlist_label_display_mode); + break; case MENU_ENUM_LABEL_UPDATE_ASSETS: BIND_ACTION_OK(cbs, action_ok_update_assets); break; @@ -6530,6 +6567,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE: BIND_ACTION_OK(cbs, action_ok_playlist_default_core); break; + case MENU_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE: + BIND_ACTION_OK(cbs, action_ok_playlist_label_display_mode); + break; default: return -1; } @@ -6653,6 +6693,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, case MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_DEFAULT_CORE: BIND_ACTION_OK(cbs, action_ok_push_dropdown_item_playlist_default_core); break; + case MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE: + BIND_ACTION_OK(cbs, action_ok_push_dropdown_item_playlist_label_display_mode); + break; case MENU_SETTING_ACTION_CORE_DISK_OPTIONS: BIND_ACTION_OK(cbs, action_ok_push_default); break; diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 0bd03d20bb..4841a5d5a8 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -547,6 +547,27 @@ static int playlist_association_right(unsigned type, const char *label, return 0; } +static int playlist_label_display_mode_right(unsigned type, const char *label, + bool wraparound) +{ + playlist_t *playlist = playlist_get_cached(); + + if (!playlist) + return -1; + + enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); + + if (label_display_mode != LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX) + label_display_mode++; + else if (wraparound) + label_display_mode = LABEL_DISPLAY_MODE_DEFAULT; + + playlist_set_label_display_mode(playlist, label_display_mode); + playlist_write_file(playlist); + + return 0; +} + int core_setting_right(unsigned type, const char *label, bool wraparound) { @@ -825,6 +846,9 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE: BIND_ACTION_RIGHT(cbs, playlist_association_right); break; + case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE: + BIND_ACTION_RIGHT(cbs, playlist_label_display_mode_right); + break; default: return -1; } diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 0b75eb0891..9dd3f879c2 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -1366,6 +1366,12 @@ int menu_cbs_init_bind_title(menu_file_list_cbs_t *cbs, BIND_ACTION_GET_TITLE(cbs, action_get_title_dropdown_item); return 0; } + if (string_is_equal(label, + msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE))) + { + BIND_ACTION_GET_TITLE(cbs, action_get_title_dropdown_item); + return 0; + } if (string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_RPL_ENTRY_ACTIONS))) { BIND_ACTION_GET_TITLE(cbs, action_get_quick_menu_views_settings_list); diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 6a692b03ed..97900b390f 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -49,6 +49,7 @@ enum ACTION_OK_DL_DROPDOWN_BOX_LIST_SPECIAL, ACTION_OK_DL_DROPDOWN_BOX_LIST_RESOLUTION, ACTION_OK_DL_DROPDOWN_BOX_LIST_PLAYLIST_DEFAULT_CORE, + ACTION_OK_DL_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE, ACTION_OK_DL_OPEN_ARCHIVE, ACTION_OK_DL_OPEN_ARCHIVE_DETECT_CORE, ACTION_OK_DL_MUSIC, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index a7b296e5bd..4c2a1ffce3 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2729,8 +2729,14 @@ static bool menu_displaylist_parse_playlist_manager_settings( MENU_ENUM_LABEL_PLAYLIST_MANAGER_RESET_CORES, FILE_TYPE_PLAYLIST_ENTRY, 0, 0); + /* Label display mode */ + menu_entries_append_enum(info->list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE), + msg_hash_to_str(MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE), + MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + MENU_SETTING_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, 0, 0); + /* TODO: Add - * - Label display mode * - Remove invalid entries */ return true; @@ -3739,6 +3745,37 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct } } break; + case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_LABEL_DISPLAY_MODE: + { + playlist_t *playlist = playlist_get_cached(); + + if (playlist) + { + enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); + + for (int i = 0; MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + i != MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX; i += 3) + { + if (menu_entries_append_enum(list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + i), + "", + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, + 0, 0)) + count++; + } + + if (menu_entries_append_enum(list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX), + "", + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, + 0, 0)) + count++; + + menu_entries_set_checked(list, label_display_mode, true); + } + } + break; case DISPLAYLIST_PERFCOUNTERS_CORE: case DISPLAYLIST_PERFCOUNTERS_FRONTEND: { @@ -6616,6 +6653,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, case DISPLAYLIST_NETWORK_INFO: case DISPLAYLIST_DROPDOWN_LIST_RESOLUTION: case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_DEFAULT_CORE: + case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_LABEL_DISPLAY_MODE: case DISPLAYLIST_PERFCOUNTERS_CORE: case DISPLAYLIST_PERFCOUNTERS_FRONTEND: case DISPLAYLIST_MENU_SETTINGS_LIST: @@ -6636,6 +6674,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, break; case DISPLAYLIST_DROPDOWN_LIST_RESOLUTION: case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_DEFAULT_CORE: + case DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_LABEL_DISPLAY_MODE: menu_entries_append_enum(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_ENTRIES_TO_DISPLAY), msg_hash_to_str(MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY), diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index e0c2304a03..e4ad930ed7 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -61,6 +61,7 @@ enum menu_displaylist_ctl_state DISPLAYLIST_DROPDOWN_LIST_SPECIAL, DISPLAYLIST_DROPDOWN_LIST_RESOLUTION, DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_DEFAULT_CORE, + DISPLAYLIST_DROPDOWN_LIST_PLAYLIST_LABEL_DISPLAY_MODE, DISPLAYLIST_CDROM_DETAIL_INFO, DISPLAYLIST_INFO, DISPLAYLIST_HELP, diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 68a75bedc7..2712b073ed 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -87,6 +87,7 @@ enum menu_settings_type MENU_SETTING_DROPDOWN_ITEM, MENU_SETTING_DROPDOWN_ITEM_RESOLUTION, MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_DEFAULT_CORE, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, MENU_SETTING_DROPDOWN_SETTING_CORE_OPTIONS_ITEM, MENU_SETTING_DROPDOWN_SETTING_STRING_OPTIONS_ITEM, MENU_SETTING_DROPDOWN_SETTING_FLOAT_ITEM, @@ -121,6 +122,7 @@ enum menu_settings_type MENU_SETTING_ACTION_PAUSE_ACHIEVEMENTS, MENU_SETTING_ACTION_RESUME_ACHIEVEMENTS, MENU_SETTING_PLAYLIST_MANAGER_DEFAULT_CORE, + MENU_SETTING_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, MENU_WIFI, MENU_ROOM, MENU_ROOM_LAN, diff --git a/msg_hash.h b/msg_hash.h index 58c4060799..e48a55bff2 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1148,6 +1148,7 @@ enum msg_hash_enums MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_SPECIAL, MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_RESOLUTION, MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_DEFAULT_CORE, + MENU_ENUM_LABEL_DEFERRED_DROPDOWN_BOX_LIST_PLAYLIST_LABEL_DISPLAY_MODE, MENU_ENUM_LABEL_DEFERRED_MIXER_STREAM_SETTINGS_LIST, MENU_ENUM_LABEL_DEFERRED_CONFIGURATIONS_LIST, MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST, @@ -1833,6 +1834,16 @@ enum msg_hash_enums MSG_PLAYLIST_MANAGER_RESETTING_CORES, MSG_PLAYLIST_MANAGER_CORES_RESET, + MENU_LABEL(PLAYLIST_MANAGER_LABEL_DISPLAY_MODE), + + MENU_LABEL(PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT), + MENU_LABEL(PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS), + MENU_LABEL(PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS), + MENU_LABEL(PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS), + MENU_LABEL(PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION), + MENU_LABEL(PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX), + MENU_LABEL(PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX), + MENU_LABEL(CORE_UPDATER_SETTINGS), MENU_LABEL(LAKKA_SERVICES), MENU_LABEL(SHADER_APPLY_CHANGES), @@ -2534,6 +2545,8 @@ enum msg_hash_enums #define MENU_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE 0x86EDE19DU +#define MENU_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE 0xE0E1CD5BU + /* Menu settings */ #define MENU_LABEL_XMB_FONT 0x0ECA56CA2 diff --git a/playlist.c b/playlist.c index b47df0b5da..79eba48cde 100644 --- a/playlist.c +++ b/playlist.c @@ -68,6 +68,7 @@ typedef struct struct string_list **current_entry_string_list_val; char *current_meta_string; char **current_meta_val; + int *current_meta_int_val; char *current_items_string; bool in_items; bool in_subsystem_roms; @@ -1211,9 +1212,10 @@ void playlist_write_file(playlist_t *playlist) if (!string_is_empty(playlist->default_core_path) && !string_is_empty(playlist->default_core_name)) { - filestream_printf(file, "default_core_path = \"%s\"\ndefault_core_name = \"%s\"\n", + filestream_printf(file, "default_core_path = \"%s\"\ndefault_core_name = \"%s\"\nlabel_display_mode = \"%d\"\n", playlist->default_core_path, - playlist->default_core_name + playlist->default_core_name, + playlist->label_display_mode ); } } @@ -1242,8 +1244,8 @@ void playlist_write_file(playlist_t *playlist) STRLEN_CONST("version"), JSON_UTF8); JSON_Writer_WriteColon(context.writer); JSON_Writer_WriteSpace(context.writer, 1); - JSON_Writer_WriteString(context.writer, "1.1", - STRLEN_CONST("1.1"), JSON_UTF8); + JSON_Writer_WriteString(context.writer, "1.2", + STRLEN_CONST("1.2"), JSON_UTF8); JSON_Writer_WriteComma(context.writer); JSON_Writer_WriteNewLine(context.writer); @@ -1279,6 +1281,19 @@ void playlist_write_file(playlist_t *playlist) JSON_Writer_WriteComma(context.writer); JSON_Writer_WriteNewLine(context.writer); + char label_display_mode[4]; + snprintf(label_display_mode, sizeof(label_display_mode), "%u", playlist->label_display_mode); + + JSON_Writer_WriteSpace(context.writer, 2); + JSON_Writer_WriteString(context.writer, "label_display_mode", + STRLEN_CONST("label_display_mode"), JSON_UTF8); + JSON_Writer_WriteColon(context.writer); + JSON_Writer_WriteSpace(context.writer, 1); + JSON_Writer_WriteNumber(context.writer, label_display_mode, + strlen(label_display_mode), JSON_UTF8); + JSON_Writer_WriteComma(context.writer); + JSON_Writer_WriteNewLine(context.writer); + JSON_Writer_WriteSpace(context.writer, 2); JSON_Writer_WriteString(context.writer, "items", STRLEN_CONST("items"), JSON_UTF8); @@ -1729,6 +1744,8 @@ static JSON_Parser_HandlerResult JSONNumberHandler(JSON_Parser parser, char *pVa free(pCtx->current_meta_string); pCtx->current_meta_string = NULL; + + *pCtx->current_meta_int_val = (int)strtoul(pValue, NULL, 10); } } } @@ -1828,6 +1845,8 @@ static JSON_Parser_HandlerResult JSONObjectMemberHandler(JSON_Parser parser, cha pCtx->current_meta_val = &pCtx->playlist->default_core_path; else if (string_is_equal(pValue, "default_core_name")) pCtx->current_meta_val = &pCtx->playlist->default_core_name; + else if (string_is_equal(pValue, "label_display_mode")) + pCtx->current_meta_int_val = (int*)&pCtx->playlist->label_display_mode; else { /* ignore unknown members */ @@ -2017,8 +2036,8 @@ json_cleanup: metadata_char = filestream_getc(file); } - /* Search backwards for the next two newlines */ - while (metadata_counter < 2) + /* Search backwards for the next three newlines */ + while (metadata_counter < 3) { filestream_seek(file, -2, SEEK_CUR); if (filestream_error(file)) @@ -2049,6 +2068,26 @@ json_cleanup: get_old_format_metadata_value( metadata_line, default_core_name, sizeof(default_core_name)); + /* > Get label_display_mode */ + if (!filestream_gets(file, metadata_line, sizeof(metadata_line))) + goto end; + + if (strncmp("label_display_mode", + metadata_line, + STRLEN_CONST("label_display_mode")) == 0) + { + char *start = NULL; + start = strchr(metadata_line, '\"'); + + if (start) + { + start++; + + if (*start >= '0' && *start <= '9') + playlist->label_display_mode = *start - '0'; + } + } + /* > Populate playlist fields, if required */ if (!string_is_empty(default_core_path) && !string_is_empty(default_core_name)) From 8bbfd52a5e8d1d84b7700f54700517454d785311 Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Sun, 28 Jul 2019 11:55:46 +0200 Subject: [PATCH 3/9] Implement changes for Android, Xcode, C89 & CXX. Fix bad match in removal of parens and brackets. Use libretro string comparison features instead of a long char-wise comparison. --- griffin/griffin.c | 5 ++ .../playlists/label_sanitization.c | 68 ++++--------------- menu/cbs/menu_cbs_get_value.c | 6 +- menu/cbs/menu_cbs_left.c | 2 +- menu/cbs/menu_cbs_ok.c | 4 +- menu/cbs/menu_cbs_right.c | 2 +- menu/menu_displaylist.c | 9 +-- playlist.c | 2 +- 8 files changed, 34 insertions(+), 64 deletions(-) diff --git a/griffin/griffin.c b/griffin/griffin.c index 986abcdbe6..093589cbcf 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1618,3 +1618,8 @@ SSL #ifdef HAVE_EASTEREGG #include "../cores/libretro-gong/gong.c" #endif + +/*============================================================ +PLAYLIST NAME SANITIZATION +============================================================ */ +#include "../libretro-common/playlists/label-sanitization.c" diff --git a/libretro-common/playlists/label_sanitization.c b/libretro-common/playlists/label_sanitization.c index 91ca5bd2fb..e47da1160d 100644 --- a/libretro-common/playlists/label_sanitization.c +++ b/libretro-common/playlists/label_sanitization.c @@ -21,6 +21,7 @@ */ #include +#include #include /* @@ -37,7 +38,7 @@ void label_sanitize(char *label, size_t size, bool (*left)(char*), bool (*right) { if (copy) { - // check for the start of the range + /* check for the start of the range */ if ((*left)(&label[lindex])) copy = false; @@ -80,35 +81,17 @@ bool left_parens_or_brackets(char *left) bool right_parens_or_brackets(char *right) { - return right[0] == ']' || right[0] == ']'; + return right[0] == ')' || right[0] == ']'; } bool left_parens_or_brackets_excluding_region(char *left) { if (left_parens_or_brackets(left)) { - if ((left[1] == 'A' - && left[2] == 'u' - && left[3] == 's' - && left[4] == 'r' - && left[5] == 'a' - && left[6] == 'l' - && left[7] == 'i' - && left[8] == 'a') - || (left[1] == 'E' - && left[2] == 'u' - && left[3] == 'r' - && left[4] == 'o' - && left[5] == 'p' - && left[6] == 'e') - || (left[1] == 'J' - && left[2] == 'a' - && left[3] == 'p' - && left[4] == 'a' - && left[5] == 'n') - || (left[1] == 'U' - && left[2] == 'S' - && left[3] == 'A')) + if (string_is_equal_fast(&left[1], "Australia", 9) + || string_is_equal_fast(&left[1], "Europe", 6) + || string_is_equal_fast(&left[1], "Japan", 5) + || string_is_equal_fast(&left[1], "USA", 3)) return false; else return true; @@ -121,10 +104,7 @@ bool left_parens_or_brackets_excluding_disc(char *left) { if (left_parens_or_brackets(left)) { - if (left[1] == 'D' - && left[2] == 'i' - && left[3] == 's' - && left[4] == 'c') + if (string_is_equal_fast(&left[1], "Disc", 4)) return false; else return true; @@ -137,32 +117,11 @@ bool left_parens_or_brackets_excluding_region_or_disc(char *left) { if (left_parens_or_brackets(left)) { - if ((left[1] == 'A' - && left[2] == 'u' - && left[3] == 's' - && left[4] == 'r' - && left[5] == 'a' - && left[6] == 'l' - && left[7] == 'i' - && left[8] == 'a') - || (left[1] == 'E' - && left[2] == 'u' - && left[3] == 'r' - && left[4] == 'o' - && left[5] == 'p' - && left[6] == 'e') - || (left[1] == 'J' - && left[2] == 'a' - && left[3] == 'p' - && left[4] == 'a' - && left[5] == 'n') - || (left[1] == 'U' - && left[2] == 'S' - && left[3] == 'A') - || (left[1] == 'D' - && left[2] == 'i' - && left[3] == 's' - && left[4] == 'c')) + if (string_is_equal_fast(&left[1], "Australia", 9) + || string_is_equal_fast(&left[1], "Disc", 4) + || string_is_equal_fast(&left[1], "Europe", 6) + || string_is_equal_fast(&left[1], "Japan", 5) + || string_is_equal_fast(&left[1], "USA", 3)) return false; else return true; @@ -174,6 +133,7 @@ bool left_parens_or_brackets_excluding_region_or_disc(char *left) void label_default_display(char *label, size_t size) { return; + /* The default display will keep the label the same. */ } void label_remove_parens(char *label, size_t size) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 96dd2234ad..d71d7cfc11 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1113,7 +1113,11 @@ static void menu_action_setting_disp_set_label_playlist_label_display_mode( strlcpy(s2, path, len2); - strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + label_display_mode * 3), len); + int msg_index = (int)label_display_mode; + msg_index = msg_index * 3; + msg_index = msg_index + (int)MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT; + + strlcpy(s, msg_hash_to_str((enum msg_hash_enums)msg_index), len); } static void menu_action_setting_disp_set_label_core_options(file_list_t* list, diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index ebf714924d..007dd1eebb 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -445,7 +445,7 @@ static int playlist_label_display_mode_left(unsigned type, const char *label, enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); if (label_display_mode != LABEL_DISPLAY_MODE_DEFAULT) - label_display_mode--; + label_display_mode = (enum playlist_label_display_mode)((int)label_display_mode - 1); else if (wraparound) label_display_mode = LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index e865100e27..b6f506f1c2 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -2919,7 +2919,7 @@ static int action_ok_core_deferred_set(const char *new_core_path, strlcpy(resolved_core_path, new_core_path, sizeof(resolved_core_path)); playlist_resolve_path(PLAYLIST_SAVE, resolved_core_path, sizeof(resolved_core_path)); - /* the update function reads our entry + /* the update function reads our entry * as const, so these casts are safe */ entry.core_path = (char*)resolved_core_path; entry.core_name = core_display_name; @@ -5375,7 +5375,7 @@ static int action_ok_push_dropdown_item_playlist_label_display_mode(const char * { playlist_t *playlist = playlist_get_cached(); - playlist_set_label_display_mode(playlist, idx); + playlist_set_label_display_mode(playlist, (enum playlist_label_display_mode)idx); /* In all cases, update file on disk */ playlist_write_file(playlist); diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 4841a5d5a8..f371fbe8f2 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -558,7 +558,7 @@ static int playlist_label_display_mode_right(unsigned type, const char *label, enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); if (label_display_mode != LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX) - label_display_mode++; + label_display_mode = (enum playlist_label_display_mode)((int)label_display_mode + 1); else if (wraparound) label_display_mode = LABEL_DISPLAY_MODE_DEFAULT; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 4c2a1ffce3..1a449571d8 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3521,7 +3521,7 @@ typedef struct menu_displaylist_build_info_selective { enum msg_hash_enums enum_idx; enum menu_displaylist_parse_type parse_type; bool checked; -} menu_displaylist_build_info_selective_t; +} menu_displaylist_build_info_selective_t; unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ctl_state type) { @@ -3752,11 +3752,12 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct if (playlist) { enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); + int i; - for (int i = 0; MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + i != MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX; i += 3) + for (i = 0; MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + i != MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX; i += 3) { if (menu_entries_append_enum(list, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + i), + msg_hash_to_str((enum msg_hash_enums)((int)MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + i)), "", MENU_ENUM_LABEL_NO_ITEMS, MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, @@ -4205,7 +4206,7 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct for (i = 0; i < ARRAY_SIZE(build_list); i++) { bool parse_setting = true; - if (build_list[i].checked && + if (build_list[i].checked && string_is_equal(ui_companion_driver_get_ident(), "null")) parse_setting = false; if (parse_setting && diff --git a/playlist.c b/playlist.c index 79eba48cde..65d244d8e7 100644 --- a/playlist.c +++ b/playlist.c @@ -2084,7 +2084,7 @@ json_cleanup: start++; if (*start >= '0' && *start <= '9') - playlist->label_display_mode = *start - '0'; + playlist->label_display_mode = (enum playlist_label_display_mode)(*start - '0'); } } From 6d5960c16608cf9583735a3ba6c024e9c32bece4 Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Sun, 28 Jul 2019 13:41:20 +0200 Subject: [PATCH 4/9] Fix label_sanitization.c typo --- griffin/griffin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/griffin/griffin.c b/griffin/griffin.c index 093589cbcf..a8d6b1d642 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1622,4 +1622,4 @@ SSL /*============================================================ PLAYLIST NAME SANITIZATION ============================================================ */ -#include "../libretro-common/playlists/label-sanitization.c" +#include "../libretro-common/playlists/label_sanitization.c" From c69c3f4c47780ba8f5f6ff8b9eae7e67535b4497 Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Sun, 28 Jul 2019 13:42:07 +0200 Subject: [PATCH 5/9] Fix build for ISO C 90. --- playlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playlist.c b/playlist.c index 65d244d8e7..b17a5b197c 100644 --- a/playlist.c +++ b/playlist.c @@ -1225,6 +1225,7 @@ void playlist_write_file(playlist_t *playlist) JSONContext context = {0}; context.writer = JSON_Writer_Create(NULL); context.file = file; + char label_display_mode[4]; if (!context.writer) { @@ -1281,7 +1282,6 @@ void playlist_write_file(playlist_t *playlist) JSON_Writer_WriteComma(context.writer); JSON_Writer_WriteNewLine(context.writer); - char label_display_mode[4]; snprintf(label_display_mode, sizeof(label_display_mode), "%u", playlist->label_display_mode); JSON_Writer_WriteSpace(context.writer, 2); From 6bd79acc5de457a1a46670d15bd35b76f40be8f7 Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Sun, 28 Jul 2019 14:55:21 +0200 Subject: [PATCH 6/9] Fix C89 support. --- playlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playlist.c b/playlist.c index b17a5b197c..d978090927 100644 --- a/playlist.c +++ b/playlist.c @@ -1225,7 +1225,7 @@ void playlist_write_file(playlist_t *playlist) JSONContext context = {0}; context.writer = JSON_Writer_Create(NULL); context.file = file; - char label_display_mode[4]; + char label_display_mode[4] = {0}; if (!context.writer) { From 771134eb522ff676dc26dcab07b630e96a5e4ed8 Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Sun, 28 Jul 2019 15:52:48 +0200 Subject: [PATCH 7/9] More C89 compatibility fixes --- libretro-common/playlists/label_sanitization.c | 3 ++- menu/cbs/menu_cbs_get_value.c | 10 ++++++++-- menu/cbs/menu_cbs_left.c | 3 ++- menu/cbs/menu_cbs_right.c | 3 ++- menu/menu_displaylist.c | 3 +-- playlist.c | 2 +- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/libretro-common/playlists/label_sanitization.c b/libretro-common/playlists/label_sanitization.c index e47da1160d..faa6903504 100644 --- a/libretro-common/playlists/label_sanitization.c +++ b/libretro-common/playlists/label_sanitization.c @@ -21,6 +21,7 @@ */ #include +#include #include #include @@ -32,7 +33,7 @@ void label_sanitize(char *label, size_t size, bool (*left)(char*), bool (*right) bool copy = true; int rindex = 0; int lindex = 0; - char new_label[size]; + char new_label[PATH_MAX_LENGTH]; for (; lindex < size && label[lindex] != '\0'; lindex++) { diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index d71d7cfc11..b5f1c0211c 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1106,14 +1106,20 @@ static void menu_action_setting_disp_set_label_playlist_label_display_mode( const char *path, char *s2, size_t len2) { + enum playlist_label_display_mode label_display_mode; + int msg_index; playlist_t *playlist = playlist_get_cached(); - enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); + + if (!playlist) + return; + + label_display_mode = playlist_get_label_display_mode(playlist); *w = 19; strlcpy(s2, path, len2); - int msg_index = (int)label_display_mode; + msg_index = (int)label_display_mode; msg_index = msg_index * 3; msg_index = msg_index + (int)MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT; diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 007dd1eebb..62bc13bf35 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -437,12 +437,13 @@ static int playlist_association_left(unsigned type, const char *label, static int playlist_label_display_mode_left(unsigned type, const char *label, bool wraparound) { + enum playlist_label_display_mode label_display_mode; playlist_t *playlist = playlist_get_cached(); if (!playlist) return -1; - enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); + label_display_mode = playlist_get_label_display_mode(playlist); if (label_display_mode != LABEL_DISPLAY_MODE_DEFAULT) label_display_mode = (enum playlist_label_display_mode)((int)label_display_mode - 1); diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index f371fbe8f2..3abfc17c1f 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -550,12 +550,13 @@ static int playlist_association_right(unsigned type, const char *label, static int playlist_label_display_mode_right(unsigned type, const char *label, bool wraparound) { + enum playlist_label_display_mode label_display_mode; playlist_t *playlist = playlist_get_cached(); if (!playlist) return -1; - enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); + label_display_mode = playlist_get_label_display_mode(playlist); if (label_display_mode != LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX) label_display_mode = (enum playlist_label_display_mode)((int)label_display_mode + 1); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 1a449571d8..4168225426 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -850,6 +850,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, size_t list_size = playlist_size(playlist); settings_t *settings = config_get_ptr(); bool show_inline_core_name = false; + void (*sanitization)(char*, size_t); label_spacer[0] = '\0'; @@ -906,8 +907,6 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, /* Preallocate the file list */ file_list_reserve(info->list, list_size); - void (*sanitization)(char*, size_t); - switch (playlist_get_label_display_mode(playlist)) { case LABEL_DISPLAY_MODE_REMOVE_PARENTHESES : diff --git a/playlist.c b/playlist.c index d978090927..98a5ae9979 100644 --- a/playlist.c +++ b/playlist.c @@ -1222,10 +1222,10 @@ void playlist_write_file(playlist_t *playlist) else #endif { + char label_display_mode[4] = {0}; JSONContext context = {0}; context.writer = JSON_Writer_Create(NULL); context.file = file; - char label_display_mode[4] = {0}; if (!context.writer) { From 73eb9adb094f16341e238cd689296ded91cdc6b3 Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Sun, 28 Jul 2019 21:52:37 +0200 Subject: [PATCH 8/9] Add the new labels to the various language files. --- intl/msg_hash_ar.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_chs.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_cht.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_de.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_el.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_eo.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_es.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_fr.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_it.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_ja.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_ko.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_nl.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_pl.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_pt_br.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_pt_pt.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_ru.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_tr.h | 36 ++++++++++++++++++++++++++++++++++++ intl/msg_hash_vn.h | 36 ++++++++++++++++++++++++++++++++++++ 18 files changed, 648 insertions(+) diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 52cd158c06..6bcfdc0b92 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -1254,6 +1254,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "قائمة التشغيل") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "قوائم التشغيل") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Touch Support") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 068ade3983..d5c9007c57 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1270,6 +1270,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "游戏列表文件夹") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "游戏列表") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "触摸支持") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index c05caabdd7..913e548134 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -1156,6 +1156,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "遊戲列表目錄") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "遊戲列表") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "觸控支援") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index c0b908b8a3..06c52d982d 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -1205,6 +1205,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "Playlists") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Playlists") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Touch-Unterstützung") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index f4fff0d06b..c526d4fb68 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -2006,6 +2006,42 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Λίστες Αναπαραγωγής" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Υποστήριξη Αφής" diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 20da11c122..d47c486c5c 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -1063,6 +1063,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "Playlists") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Playlists") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Touch Support") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 37389dda31..12c721f8a3 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -2060,6 +2060,42 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Listas de reproducción" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Soporte táctil" diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index e32b67fd6d..c9e8aa15e6 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -2133,6 +2133,42 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Listes de lecture" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Prise en charge du tactile" diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 392e6dc05c..1cf313244c 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -1207,6 +1207,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "Playlists") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Playlists") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Supporto touch") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index e1fba83d25..b54902fb61 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -2171,6 +2171,42 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "プレイリスト" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "タッチ対応" diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 6244a23ae7..7b9a621f81 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -2160,6 +2160,42 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "실행목록" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "터치 지원" diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 0d284a41f0..00e303c24e 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -1062,6 +1062,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "Afspeellijsten") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Afspeellijsten") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Touch Ondersteuning") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 804af14033..23d207863c 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -1259,6 +1259,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "Listy odtwarzania") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Listy odtwarzania") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Obsługa dotyku") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index d6d9a8fd48..21f7fa2fde 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -2148,6 +2148,42 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Listas de Reprodução" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Suporte para Toque" diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index d6beaf706a..651b99a8e8 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -1147,6 +1147,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "Pasta de listas de reprodução") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Definições de listas de reprodução") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Suporte de ponteiros") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 8c8f9ac8b6..f44c96c75e 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -1171,6 +1171,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "Плейлисты") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Плейлисты") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Поддержка Touch") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, diff --git a/intl/msg_hash_tr.h b/intl/msg_hash_tr.h index 0d4c3e60f4..cc30ef6b1d 100644 --- a/intl/msg_hash_tr.h +++ b/intl/msg_hash_tr.h @@ -2128,6 +2128,42 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Oynatma Listeleri" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Dokunmatik Desteği" diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 25ad58009d..3899f82af9 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -1174,6 +1174,42 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_DIRECTORY, "Playlists Danh mục") MSG_HASH(MENU_ENUM_LABEL_VALUE_PLAYLIST_SETTINGS, "Playlists") +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Label Display Mode" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE, + "Change how the content labels are displayed in this playlist." + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT, + "Show full labels" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, + "Remove parentheses" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, + "Remove brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, + "Remove parentheses and brackets" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, + "Keep region" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX, + "Keep disc index" + ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX, + "Keep region and disc index" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_POINTER_ENABLE, "Touch Support") MSG_HASH(MENU_ENUM_LABEL_VALUE_PORT, From d3a98fea799617ac18aa0b854c9ca4f6d180966a Mon Sep 17 00:00:00 2001 From: Tim Van den Langenbergh Date: Mon, 29 Jul 2019 13:56:20 +0200 Subject: [PATCH 9/9] Make wording of messages for label display mode clearer. Use strlcpy for safety in sanitization. Change label sanitization to use the No-Intro conventions. Remove integer manipulation of enums for hash strings. Add handler for start button on label display mode. --- intl/msg_hash_ar.h | 8 +- intl/msg_hash_chs.h | 8 +- intl/msg_hash_cht.h | 8 +- intl/msg_hash_de.h | 8 +- intl/msg_hash_el.h | 8 +- intl/msg_hash_eo.h | 8 +- intl/msg_hash_es.h | 8 +- intl/msg_hash_fr.h | 8 +- intl/msg_hash_it.h | 8 +- intl/msg_hash_ja.h | 8 +- intl/msg_hash_ko.h | 8 +- intl/msg_hash_nl.h | 8 +- intl/msg_hash_pl.h | 8 +- intl/msg_hash_pt_br.h | 8 +- intl/msg_hash_pt_pt.h | 8 +- intl/msg_hash_ru.h | 8 +- intl/msg_hash_tr.h | 8 +- intl/msg_hash_us.h | 6 +- intl/msg_hash_vn.h | 8 +- .../include/playlists/label_sanitization.h | 18 +-- .../playlists/label_sanitization.c | 133 +++++++++++------- menu/cbs/menu_cbs_get_value.c | 28 +++- menu/cbs/menu_cbs_start.c | 17 +++ menu/menu_displaylist.c | 67 ++++++--- 24 files changed, 254 insertions(+), 159 deletions(-) diff --git a/intl/msg_hash_ar.h b/intl/msg_hash_ar.h index 6bcfdc0b92..3c817f5bc7 100644 --- a/intl/msg_hash_ar.h +++ b/intl/msg_hash_ar.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1268,15 +1268,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index d5c9007c57..fd51413317 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1284,15 +1284,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 913e548134..48ea2334b2 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1170,15 +1170,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 06c52d982d..e818681850 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) /* https://support.microsoft.com/en-us/kb/980263 */ #if (_MSC_VER >= 1700) #pragma execution_character_set("utf-8") @@ -1219,15 +1219,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_el.h b/intl/msg_hash_el.h index c526d4fb68..afd99e3457 100644 --- a/intl/msg_hash_el.h +++ b/intl/msg_hash_el.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -2020,15 +2020,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index d47c486c5c..32e94bcb72 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1077,15 +1077,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_es.h b/intl/msg_hash_es.h index 12c721f8a3..2848fb0417 100644 --- a/intl/msg_hash_es.h +++ b/intl/msg_hash_es.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -2074,15 +2074,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index c9e8aa15e6..85f5cc3c84 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -2147,15 +2147,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 1cf313244c..aa7c24ae87 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1221,15 +1221,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index b54902fb61..6a95e7206d 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500) #if (_MSC_VER >= 1700 && _MSC_VER < 1910) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -2185,15 +2185,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index 7b9a621f81..de358b5115 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -2174,15 +2174,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 00e303c24e..d17e9a3a10 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1076,15 +1076,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_pl.h b/intl/msg_hash_pl.h index 23d207863c..afaed9b765 100644 --- a/intl/msg_hash_pl.h +++ b/intl/msg_hash_pl.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1273,15 +1273,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 21f7fa2fde..d833b1d9c4 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -2162,15 +2162,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index 651b99a8e8..d78fa69b4a 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1161,15 +1161,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index f44c96c75e..9bf7e31d45 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1185,15 +1185,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_tr.h b/intl/msg_hash_tr.h index cc30ef6b1d..8b520e012a 100644 --- a/intl/msg_hash_tr.h +++ b/intl/msg_hash_tr.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -2142,15 +2142,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index e1c6c56589..a62ddf8d91 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2210,15 +2210,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index 3899f82af9..17625fce23 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) +#if defined(_MSC_VER) && !defined(_XBOX) && (_MSC_VER >= 1500 && _MSC_VER < 1900) #if (_MSC_VER >= 1700) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") @@ -1188,15 +1188,15 @@ MSG_HASH( ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS, - "Remove parentheses" + "Remove () content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS, - "Remove brackets" + "Remove [] content" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS, - "Remove parentheses and brackets" + "Remove () and []" ) MSG_HASH( MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION, diff --git a/libretro-common/include/playlists/label_sanitization.h b/libretro-common/include/playlists/label_sanitization.h index 077a60498a..db68babc84 100644 --- a/libretro-common/include/playlists/label_sanitization.h +++ b/libretro-common/include/playlists/label_sanitization.h @@ -22,7 +22,7 @@ #include #include -void label_sanitize(char *label, size_t size, bool (*left)(char*), bool (*right)(char*)); +void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*)); bool left_parens(char *left); bool right_parens(char *right); @@ -33,22 +33,22 @@ bool right_brackets(char *right); bool left_parens_or_brackets(char *left); bool right_parens_or_brackets(char *right); +bool left_exclusion(char *left, const char **strings, const size_t strings_count); + bool left_parens_or_brackets_excluding_region(char *left); bool left_parens_or_brackets_excluding_disc(char *left); bool left_parens_or_brackets_excluding_region_or_disc(char *left); -void label_default_display(char *label, size_t size); +void label_remove_parens(char *label); -void label_remove_parens(char *label, size_t size); +void label_remove_brackets(char *label); -void label_remove_brackets(char *label, size_t size); +void label_remove_parens_and_brackets(char *label); -void label_remove_parens_and_brackets(char *label, size_t size); +void label_keep_region(char *label); -void label_keep_region(char *label, size_t size); +void label_keep_disc(char *label); -void label_keep_disc(char *label, size_t size); - -void label_keep_region_and_disc(char *label, size_t size); +void label_keep_region_and_disc(char *label); diff --git a/libretro-common/playlists/label_sanitization.c b/libretro-common/playlists/label_sanitization.c index faa6903504..7b639d4aab 100644 --- a/libretro-common/playlists/label_sanitization.c +++ b/libretro-common/playlists/label_sanitization.c @@ -21,21 +21,58 @@ */ #include +#include #include #include #include +const size_t disc_strings_length = 3; + +const char *disc_strings[3] = { + "(CD", + "(Disc", + "(Disk" +}; + +const size_t region_strings_length = 20; + +/* + * We'll use the standard No-Intro regions for now. + */ +const char *region_strings[20] = { + "(Australia)", /* Don’t use with Europe */ + "(Brazil)", + "(Canada)", /* Don’t use with USA */ + "(China)", + "(France)", + "(Germany)", + "(Hong Kong)", + "(Italy)", + "(Japan)", + "(Korea)", + "(Netherlands)", + "(Spain)", + "(Sweden)", + "(USA)", /* Includes Canada */ + "(World)", + "(Europe)", /* Includes Australia */ + "(Asia)", + "(Japan, USA)", + "(Japan, Europe)", + "(USA, Europe)" +}; + /* * Does not work with nested blocks. */ -void label_sanitize(char *label, size_t size, bool (*left)(char*), bool (*right)(char*)) +void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*)) { bool copy = true; int rindex = 0; int lindex = 0; char new_label[PATH_MAX_LENGTH]; - for (; lindex < size && label[lindex] != '\0'; lindex++) + for (; lindex < PATH_MAX_LENGTH && label[lindex] != '\0'; lindex++) { if (copy) { @@ -50,9 +87,9 @@ void label_sanitize(char *label, size_t size, bool (*left)(char*), bool (*right) copy = true; } - new_label[rindex] = label[lindex]; + new_label[rindex] = '\0'; - strcpy(label, new_label); + strlcpy(label, new_label, PATH_MAX_LENGTH); } bool left_parens(char *left) @@ -85,84 +122,72 @@ bool right_parens_or_brackets(char *right) return right[0] == ')' || right[0] == ']'; } -bool left_parens_or_brackets_excluding_region(char *left) +bool left_exclusion(char *left, const char **strings, const size_t strings_count) { - if (left_parens_or_brackets(left)) + int i; + char exclusion_string[32]; + char comparison_string[32]; + + strlcpy(exclusion_string, left, 32); + string_to_upper(exclusion_string); + + for (i = 0; i < strings_count; i++) { - if (string_is_equal_fast(&left[1], "Australia", 9) - || string_is_equal_fast(&left[1], "Europe", 6) - || string_is_equal_fast(&left[1], "Japan", 5) - || string_is_equal_fast(&left[1], "USA", 3)) - return false; - else + strlcpy(comparison_string, strings[i], 32); + string_to_upper(comparison_string); + + if (string_is_equal_fast(exclusion_string, comparison_string, strlen(comparison_string))) return true; } - else - return false; + + return false; +} + +bool left_parens_or_brackets_excluding_region(char *left) +{ + return left_parens_or_brackets(left) + && !left_exclusion(left, region_strings, region_strings_length); } bool left_parens_or_brackets_excluding_disc(char *left) { - if (left_parens_or_brackets(left)) - { - if (string_is_equal_fast(&left[1], "Disc", 4)) - return false; - else - return true; - } - else - return false; + return left_parens_or_brackets(left) + && !left_exclusion(left, disc_strings, disc_strings_length); } bool left_parens_or_brackets_excluding_region_or_disc(char *left) { - if (left_parens_or_brackets(left)) - { - if (string_is_equal_fast(&left[1], "Australia", 9) - || string_is_equal_fast(&left[1], "Disc", 4) - || string_is_equal_fast(&left[1], "Europe", 6) - || string_is_equal_fast(&left[1], "Japan", 5) - || string_is_equal_fast(&left[1], "USA", 3)) - return false; - else - return true; - } - else - return false; + return left_parens_or_brackets(left) + && !left_exclusion(left, region_strings, region_strings_length) + && !left_exclusion(left, disc_strings, disc_strings_length); } -void label_default_display(char *label, size_t size) +void label_remove_parens(char *label) { - return; - /* The default display will keep the label the same. */ + label_sanitize(label, left_parens, right_parens); } -void label_remove_parens(char *label, size_t size) +void label_remove_brackets(char *label) { - label_sanitize(label, size, left_parens, right_parens); + label_sanitize(label, left_brackets, right_brackets); } -void label_remove_brackets(char *label, size_t size) +void label_remove_parens_and_brackets(char *label) { - label_sanitize(label, size, left_brackets, right_brackets); + label_sanitize(label, left_parens_or_brackets, right_parens_or_brackets); } -void label_remove_parens_and_brackets(char *label, size_t size) +void label_keep_region(char *label) { - label_sanitize(label, size, left_parens_or_brackets, right_parens_or_brackets); + label_sanitize(label, left_parens_or_brackets_excluding_region, right_parens_or_brackets); } -void label_keep_region(char *label, size_t size) +void label_keep_disc(char *label) { - label_sanitize(label, size, left_parens_or_brackets_excluding_region, right_parens_or_brackets); + label_sanitize(label, left_parens_or_brackets_excluding_disc, right_parens_or_brackets); } -void label_keep_disc(char *label, size_t size) +void label_keep_region_and_disc(char *label) { - label_sanitize(label, size, left_parens_or_brackets_excluding_disc, right_parens_or_brackets); -} - -void label_keep_region_and_disc(char *label, size_t size) -{ - label_sanitize(label, size, left_parens_or_brackets_excluding_region_or_disc, right_parens_or_brackets); + label_sanitize(label, left_parens_or_brackets_excluding_region_or_disc, right_parens_or_brackets); } diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index b5f1c0211c..0fed65bb95 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -1119,11 +1119,29 @@ static void menu_action_setting_disp_set_label_playlist_label_display_mode( strlcpy(s2, path, len2); - msg_index = (int)label_display_mode; - msg_index = msg_index * 3; - msg_index = msg_index + (int)MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT; - - strlcpy(s, msg_hash_to_str((enum msg_hash_enums)msg_index), len); + switch (label_display_mode) + { + case LABEL_DISPLAY_MODE_REMOVE_PARENTHESES : + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS), len); + break; + case LABEL_DISPLAY_MODE_REMOVE_BRACKETS : + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS), len); + break; + case LABEL_DISPLAY_MODE_REMOVE_PARENTHESES_AND_BRACKETS : + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS), len); + break; + case LABEL_DISPLAY_MODE_KEEP_DISC_INDEX : + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX), len); + break; + case LABEL_DISPLAY_MODE_KEEP_REGION : + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION), len); + break; + case LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX : + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX), len); + break; + default: + strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT), len); + } } static void menu_action_setting_disp_set_label_core_options(file_list_t* list, diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 51518a8a1c..23a21e0424 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -242,6 +242,20 @@ static int action_start_playlist_association(unsigned type, const char *label) return 0; } +static int action_start_playlist_label_display_mode(unsigned type, const char *label) +{ + playlist_t *playlist = playlist_get_cached(); + + if (!playlist) + return -1; + + /* Set label display mode to the default */ + playlist_set_label_display_mode(playlist, LABEL_DISPLAY_MODE_DEFAULT); + playlist_write_file(playlist); + + return 0; +} + static int action_start_video_resolution(unsigned type, const char *label) { unsigned width = 0, height = 0; @@ -319,6 +333,9 @@ static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs) case MENU_ENUM_LABEL_PLAYLIST_MANAGER_DEFAULT_CORE: BIND_ACTION_START(cbs, action_start_playlist_association); break; + case MENU_ENUM_LABEL_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE: + BIND_ACTION_START(cbs, action_start_playlist_label_display_mode); + break; default: return -1; } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 4168225426..152b6b7d10 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -850,7 +850,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, size_t list_size = playlist_size(playlist); settings_t *settings = config_get_ptr(); bool show_inline_core_name = false; - void (*sanitization)(char*, size_t); + void (*sanitization)(char*); label_spacer[0] = '\0'; @@ -928,7 +928,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, sanitization = &label_keep_region_and_disc; break; default : - sanitization = &label_default_display; + sanitization = NULL; } for (i = 0; i < list_size; i++) @@ -950,13 +950,12 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, * no further action is necessary */ if (string_is_empty(entry->label)) - { fill_short_pathname_representation(menu_entry_label, entry->path, sizeof(menu_entry_label)); - } else { strlcpy(menu_entry_label, entry->label, sizeof(menu_entry_label)); - (*sanitization)(menu_entry_label, sizeof(menu_entry_label)); + if (sanitization) + (*sanitization)(menu_entry_label); } if (show_inline_core_name) @@ -3751,18 +3750,54 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct if (playlist) { enum playlist_label_display_mode label_display_mode = playlist_get_label_display_mode(playlist); - int i; - for (i = 0; MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + i != MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX; i += 3) - { - if (menu_entries_append_enum(list, - msg_hash_to_str((enum msg_hash_enums)((int)MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT + i)), - "", - MENU_ENUM_LABEL_NO_ITEMS, - MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, - 0, 0)) - count++; - } + if (menu_entries_append_enum(list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_DEFAULT), + "", + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, + 0, 0)) + count++; + + if (menu_entries_append_enum(list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS), + "", + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, + 0, 0)) + count++; + + if (menu_entries_append_enum(list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_BRACKETS), + "", + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, + 0, 0)) + count++; + + if (menu_entries_append_enum(list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_REMOVE_PARENS_AND_BRACKETS), + "", + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, + 0, 0)) + count++; + + if (menu_entries_append_enum(list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION), + "", + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, + 0, 0)) + count++; + + if (menu_entries_append_enum(list, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_DISC_INDEX), + "", + MENU_ENUM_LABEL_NO_ITEMS, + MENU_SETTING_DROPDOWN_ITEM_PLAYLIST_LABEL_DISPLAY_MODE, + 0, 0)) + count++; if (menu_entries_append_enum(list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_MANAGER_LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX),