We don't want camelcase notation variable names for RetroArch
This commit is contained in:
parent
8291b18771
commit
b82a20ea0c
|
@ -1875,100 +1875,100 @@ static const char *meta_key_to_name(unsigned int meta_key)
|
||||||
* and displays the current shortcut key */
|
* and displays the current shortcut key */
|
||||||
static void win32_localize_menu(HMENU menu)
|
static void win32_localize_menu(HMENU menu)
|
||||||
{
|
{
|
||||||
int index = 0;
|
|
||||||
#ifndef LEGACY_WIN32
|
#ifndef LEGACY_WIN32
|
||||||
MENUITEMINFOW menuItemInfo;
|
MENUITEMINFOW menu_item_info;
|
||||||
#else
|
#else
|
||||||
MENUITEMINFOA menuItemInfo;
|
MENUITEMINFOA menu_item_info;
|
||||||
#endif
|
#endif
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
BOOL okay;
|
BOOL okay;
|
||||||
enum msg_hash_enums label_enum;
|
enum msg_hash_enums label_enum;
|
||||||
memset(&menuItemInfo, 0, sizeof(menuItemInfo));
|
memset(&menu_item_info, 0, sizeof(menu_item_info));
|
||||||
menuItemInfo.cbSize = sizeof(menuItemInfo);
|
menu_item_info.cbSize = sizeof(menu_item_info);
|
||||||
menuItemInfo.dwTypeData = NULL;
|
menu_item_info.dwTypeData = NULL;
|
||||||
#if(WINVER >= 0x0500)
|
#if(WINVER >= 0x0500)
|
||||||
menuItemInfo.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_STATE | MIIM_SUBMENU;
|
menu_item_info.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_STATE | MIIM_SUBMENU;
|
||||||
#else
|
#else
|
||||||
menuItemInfo.fMask = MIIM_ID | MIIM_STATE | MIIM_SUBMENU;
|
menu_item_info.fMask = MIIM_ID | MIIM_STATE | MIIM_SUBMENU;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LEGACY_WIN32
|
#ifndef LEGACY_WIN32
|
||||||
okay = GetMenuItemInfoW(menu, index, true, &menuItemInfo);
|
okay = GetMenuItemInfoW(menu, index, true, &menu_item_info);
|
||||||
#else
|
#else
|
||||||
okay = GetMenuItemInfoA(menu, index, true, &menuItemInfo);
|
okay = GetMenuItemInfoA(menu, index, true, &menu_item_info);
|
||||||
#endif
|
#endif
|
||||||
if (!okay)
|
if (!okay)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Recursion - call this on submenu items too */
|
/* Recursion - call this on submenu items too */
|
||||||
if (menuItemInfo.hSubMenu)
|
if (menu_item_info.hSubMenu)
|
||||||
win32_localize_menu(menuItemInfo.hSubMenu);
|
win32_localize_menu(menu_item_info.hSubMenu);
|
||||||
|
|
||||||
label_enum = menu_id_to_label_enum(menuItemInfo.wID);
|
label_enum = menu_id_to_label_enum(menu_item_info.wID);
|
||||||
if (label_enum != MSG_UNKNOWN)
|
if (label_enum != MSG_UNKNOWN)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
#ifndef LEGACY_WIN32
|
#ifndef LEGACY_WIN32
|
||||||
wchar_t* newLabel_unicode = NULL;
|
wchar_t* new_label_unicode = NULL;
|
||||||
#else
|
#else
|
||||||
char* newLabel_ansi = NULL;
|
char* new_label_ansi = NULL;
|
||||||
#endif
|
#endif
|
||||||
const char* newLabel = msg_hash_to_str(label_enum);
|
const char* new_label = msg_hash_to_str(label_enum);
|
||||||
unsigned int metaKey = menu_id_to_meta_key(menuItemInfo.wID);
|
unsigned int meta_key = menu_id_to_meta_key(menu_item_info.wID);
|
||||||
const char* newLabel2 = newLabel;
|
const char* new_label2 = new_label;
|
||||||
const char* metaKeyName = NULL;
|
const char* meta_key_name = NULL;
|
||||||
char* newLabelText = NULL;
|
char* new_label_text = NULL;
|
||||||
|
|
||||||
/* specific replacements:
|
/* specific replacements:
|
||||||
Load Content = "Ctrl+O"
|
Load Content = "Ctrl+O"
|
||||||
Fullscreen = "Alt+Enter" */
|
Fullscreen = "Alt+Enter" */
|
||||||
if (label_enum ==
|
if (label_enum ==
|
||||||
MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST)
|
MENU_ENUM_LABEL_VALUE_LOAD_CONTENT_LIST)
|
||||||
metaKeyName = "Ctrl+O";
|
meta_key_name = "Ctrl+O";
|
||||||
else if (label_enum ==
|
else if (label_enum ==
|
||||||
MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY)
|
MENU_ENUM_LABEL_VALUE_INPUT_META_FULLSCREEN_TOGGLE_KEY)
|
||||||
metaKeyName = "Alt+Enter";
|
meta_key_name = "Alt+Enter";
|
||||||
else
|
else
|
||||||
metaKeyName = meta_key_to_name(metaKey);
|
meta_key_name = meta_key_to_name(meta_key);
|
||||||
|
|
||||||
/* Append localized name, tab character, and Shortcut Key */
|
/* Append localized name, tab character, and Shortcut Key */
|
||||||
if (metaKeyName && string_is_not_equal(metaKeyName, "nul"))
|
if (meta_key_name && string_is_not_equal(meta_key_name, "nul"))
|
||||||
{
|
{
|
||||||
int len1 = strlen(newLabel);
|
int len1 = strlen(new_label);
|
||||||
int len2 = strlen(metaKeyName);
|
int len2 = strlen(meta_key_name);
|
||||||
int bufSize = len1 + len2 + 2;
|
int bufSize = len1 + len2 + 2;
|
||||||
newLabelText = (char*)malloc(bufSize);
|
new_label_text = (char*)malloc(bufSize);
|
||||||
|
|
||||||
if (newLabelText)
|
if (new_label_text)
|
||||||
{
|
{
|
||||||
newLabel2 = newLabelText;
|
new_label2 = new_label_text;
|
||||||
snprintf(newLabelText, bufSize, "%s\t%s", newLabel, metaKeyName);
|
snprintf(new_label_text, bufSize, "%s\t%s", new_label, meta_key_name);
|
||||||
/* Make first character of shortcut name uppercase */
|
/* Make first character of shortcut name uppercase */
|
||||||
newLabelText[len1 + 1] = toupper(newLabelText[len1 + 1]);
|
new_label_text[len1 + 1] = toupper(new_label_text[len1 + 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef LEGACY_WIN32
|
#ifndef LEGACY_WIN32
|
||||||
/* Convert string from UTF-8, then assign menu text */
|
/* Convert string from UTF-8, then assign menu text */
|
||||||
newLabel_unicode = utf8_to_utf16_string_alloc(newLabel2);
|
new_label_unicode = utf8_to_utf16_string_alloc(new_label2);
|
||||||
len = wcslen(newLabel_unicode);
|
len = wcslen(new_label_unicode);
|
||||||
menuItemInfo.cch = len;
|
menu_item_info.cch = len;
|
||||||
menuItemInfo.dwTypeData = newLabel_unicode;
|
menu_item_info.dwTypeData = new_label_unicode;
|
||||||
SetMenuItemInfoW(menu, index, true, &menuItemInfo);
|
SetMenuItemInfoW(menu, index, true, &menu_item_info);
|
||||||
free(newLabel_unicode);
|
free(new_label_unicode);
|
||||||
#else
|
#else
|
||||||
newLabel_ansi = utf8_to_local_string_alloc(newLabel2);
|
new_label_ansi = utf8_to_local_string_alloc(new_label2);
|
||||||
len = strlen(newLabel_ansi);
|
len = strlen(new_label_ansi);
|
||||||
menuItemInfo.cch = len;
|
menu_item_info.cch = len;
|
||||||
menuItemInfo.dwTypeData = newLabel_ansi;
|
menu_item_info.dwTypeData = new_label_ansi;
|
||||||
SetMenuItemInfoA(menu, index, true, &menuItemInfo);
|
SetMenuItemInfoA(menu, index, true, &menu_item_info);
|
||||||
free(newLabel_ansi);
|
free(new_label_ansi);
|
||||||
#endif
|
#endif
|
||||||
if (newLabelText)
|
if (new_label_text)
|
||||||
free(newLabelText);
|
free(new_label_text);
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue