Logic fix, optimization, remove hack. See post-comments on #17215

This commit is contained in:
Henrik Rydgård 2023-04-01 22:30:34 +02:00
parent 47785aa2bb
commit 9146020aa4
2 changed files with 4 additions and 8 deletions

View file

@ -110,12 +110,6 @@ void UpdateNativeMenuKeys() {
cancelKeys.push_back(hardcodedCancelKeys[i]);
}
// For DInput controllers on Windows. Doesn't clash with XInput because that uses BUTTON_X etc.
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
confirmKeys.push_back(InputMapping(DEVICE_ID_PAD_0, NKCODE_BUTTON_2));
cancelKeys.push_back(InputMapping(DEVICE_ID_PAD_0, NKCODE_BUTTON_3));
#endif
SetDPadKeys(upKeys, downKeys, leftKeys, rightKeys);
SetConfirmCancelKeys(confirmKeys, cancelKeys);
SetTabLeftRightKeys(tabLeft, tabRight);
@ -527,7 +521,8 @@ bool InputMappingsFromPspButton(int btn, std::vector<MultiInputMapping> *mapping
}
bool mapped = false;
for (auto iter2 = iter->second.begin(); iter2 != iter->second.end(); ++iter2) {
if (mappings && (!ignoreMouse || iter2->HasMouse())) {
bool ignore = ignoreMouse && iter2->HasMouse();
if (mappings && !ignore) {
mapped = true;
mappings->push_back(*iter2);
}
@ -650,7 +645,6 @@ void SetInputMapping(int btn, const MultiInputMapping &key, bool replace) {
for (auto &mapping : key.mappings) {
g_seenDeviceIds.insert(mapping.deviceId);
}
UpdateNativeMenuKeys();
}
void RestoreDefault() {

View file

@ -188,6 +188,7 @@ void SingleControlMapper::MappedCallback(MultiInputMapping kdf) {
SetFocus();
break;
}
KeyMap::UpdateNativeMenuKeys();
g_Config.bMapMouse = false;
}
@ -1169,6 +1170,7 @@ UI::EventReturn VisualMappingScreen::OnBindAll(UI::EventParams &e) {
void VisualMappingScreen::HandleKeyMapping(MultiInputMapping key) {
KeyMap::SetInputMapping(nextKey_, key, replace_);
KeyMap::UpdateNativeMenuKeys();
if (bindAll_ < 0) {
// For analog, we do each direction in a row.