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.
This commit is contained in:
Tim Van den Langenbergh 2019-07-29 13:56:20 +02:00
parent 73eb9adb09
commit d3a98fea79
24 changed files with 254 additions and 159 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
#include <stddef.h>
#include <boolean.h>
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);

View File

@ -21,21 +21,58 @@
*/
#include <playlists/label_sanitization.h>
#include <compat/strl.h>
#include <retro_miscellaneous.h>
#include <string/stdstring.h>
#include <string.h>
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)", /* Dont use with Europe */
"(Brazil)",
"(Canada)", /* Dont 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);
}

View File

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

View File

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

View File

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