diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index 7e5f624603..ebe1217722 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -230,13 +230,13 @@ namespace KeyMap { std::string GetPspButtonName(int btn) { - return FindName(btn, key_names, key_names_count); + return FindName(btn, psp_button_names, psp_button_names_count); } static bool FindKeyMapping(int key, int *map_id, int *psp_button) { std::map::iterator it; - if (*map_id >= 0) { + if (*map_id <= 0) { // check user configuration std::map user_map = g_Config.iMappingMap; it = user_map.find(key); @@ -247,7 +247,7 @@ namespace KeyMap { } } - if (*map_id >= 1 && platform_keymap != NULL) { + if (*map_id <= 1 && platform_keymap != NULL) { // check optional platform specific keymap std::map port_map = *platform_keymap; it = port_map.find(key); @@ -258,13 +258,13 @@ namespace KeyMap { } } - if (*map_id >= 2) { + if (*map_id <= 2) { // check default keymap const std::map default_map = DefaultKeyMap::KeyMap; - const std::map::const_iterator it = default_map.find(key); - if (it != default_map.end()) { + const std::map::const_iterator const_it = default_map.find(key); + if (const_it != default_map.end()) { *map_id = 2; - *psp_button = it->second; + *psp_button = const_it->second; return true; } } @@ -302,9 +302,9 @@ namespace KeyMap { // We drive our iteration // with the list of key names. for (int i = 0; i < key_names_count; i++) { - const struct KeyMap_IntStrPair *key_name = key_names + i; - if (btn == KeyMap::KeyToPspButton((KeyMap::Key)key_name->key)) - return key_name->name; + const struct KeyMap_IntStrPair key_name = key_names[i]; + if (btn == KeyMap::KeyToPspButton((KeyMap::Key)(key_name.key))) + return key_name.name; } // all psp buttons are mapped from some key diff --git a/UI/MenuScreens.cpp b/UI/MenuScreens.cpp index 10e6227dfb..8ed8d2d042 100644 --- a/UI/MenuScreens.cpp +++ b/UI/MenuScreens.cpp @@ -1075,7 +1075,7 @@ void KeyMappingNewKeyDialog::render() { KeyScale(1.3f); KeyText(left, top += stride, keyI18N->T("Current key")); KeyScale(2.0f); - KeyText(left, top + stride, (KeyMap::GetPspButtonName(this.pspBtn)).c_str()); + KeyText(left, top + stride, (KeyMap::NameKeyFromPspButton(this->pspBtn)).c_str()); int right = dp_yres; KeyScale(1.4f);