InputManager: Workaround macro chord trigger issue

This commit is contained in:
Stenzek 2024-11-24 21:54:43 +10:00
parent e987b56aae
commit c970740d12
No known key found for this signature in database

View File

@ -904,6 +904,23 @@ void InputManager::AddPadBindings(const SettingsInterface& si, const std::string
{
const float deadzone =
si.GetFloatValue(section.c_str(), fmt::format("Macro{}Deadzone", macro_button_index + 1).c_str(), 0.0f);
for (const std::string& binding : bindings)
{
// We currently can't use chords with a deadzone.
if (binding.find('&') != std::string::npos || deadzone == 0.0f)
{
if (deadzone != 0.0f)
WARNING_LOG("Chord binding {} not supported with trigger deadzone {}.", binding, deadzone);
AddBinding(binding, InputButtonEventHandler{[pad_index, macro_button_index](bool state) {
if (!System::IsValid())
return;
SetMacroButtonState(pad_index, macro_button_index, state);
}});
}
else
{
AddBindings(bindings, InputAxisEventHandler{[pad_index, macro_button_index, deadzone](float value) {
if (!System::IsValid())
return;
@ -913,6 +930,8 @@ void InputManager::AddPadBindings(const SettingsInterface& si, const std::string
}});
}
}
}
}
if (cinfo->vibration_caps != Controller::VibrationCapabilities::NoVibration)
{