mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-08 04:25:37 +00:00
InputManager: Workaround macro chord trigger issue
This commit is contained in:
parent
e987b56aae
commit
c970740d12
@ -904,13 +904,32 @@ void InputManager::AddPadBindings(const SettingsInterface& si, const std::string
|
|||||||
{
|
{
|
||||||
const float deadzone =
|
const float deadzone =
|
||||||
si.GetFloatValue(section.c_str(), fmt::format("Macro{}Deadzone", macro_button_index + 1).c_str(), 0.0f);
|
si.GetFloatValue(section.c_str(), fmt::format("Macro{}Deadzone", macro_button_index + 1).c_str(), 0.0f);
|
||||||
AddBindings(bindings, InputAxisEventHandler{[pad_index, macro_button_index, deadzone](float value) {
|
for (const std::string& binding : bindings)
|
||||||
if (!System::IsValid())
|
{
|
||||||
return;
|
// 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);
|
||||||
|
|
||||||
const bool state = (value > deadzone);
|
AddBinding(binding, InputButtonEventHandler{[pad_index, macro_button_index](bool state) {
|
||||||
SetMacroButtonState(pad_index, macro_button_index, 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;
|
||||||
|
|
||||||
|
const bool state = (value > deadzone);
|
||||||
|
SetMacroButtonState(pad_index, macro_button_index, state);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user