Don't fire single-button mappings while a combo using them is held

If you map something to L2+R2, the mappings for L2 and R2 on their own
would fire as well. Now, while a combo mapping is fully held, the
shorter mappings that share an input with it are suppressed - longest
match wins. Releasing part of the combo brings the shorter mappings
back, for the inputs that are still held.

Adds a ControlMapper unit test covering the sequence.

Fixes #20621

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JvJR8oJNSCimCM9KXVLjfq
This commit is contained in:
Henrik Rydgård
2026-09-03 12:37:31 -06:00
co-authored by Claude Opus 5
parent bdaf6dcaf4
commit 50616825da
5 changed files with 197 additions and 3 deletions
+11
View File
@@ -614,6 +614,17 @@ bool InputMappingToPspButton(const InputMapping &mapping, std::vector<int> *pspB
return found;
}
void GetAllComboMappingsNoLock(std::vector<MultiInputMapping> *combos) {
combos->clear();
for (const auto &iter : g_controllerMap) {
for (const auto &mapping : iter.second) {
if (mapping.mappings.size() > 1) {
combos->push_back(mapping);
}
}
}
}
// This is the main workhorse of the ControlMapper.
bool InputMappingsFromPspButtonNoLock(int btn, std::vector<MultiInputMapping> *mappings, bool ignoreMouse) {
auto iter = g_controllerMap.find(btn);