Input: MMJOY prioritize button presses due to constant axis events

This commit is contained in:
Unknown 2017-11-29 10:20:28 +01:00 committed by Ivan
parent 5810b29298
commit dd4ccb059e
1 changed files with 15 additions and 12 deletions

View File

@ -312,18 +312,7 @@ void mm_joystick_handler::GetNextButtonPress(const std::string& padId, const std
// Return the new value if the button was pressed (aka. its value was bigger than 0 or the defined threshold)
// Use a pair to get all the legally pressed buttons and use the one with highest value (prioritize first)
std::pair<u16, std::string> pressed_button = { 0, "" };
for (const auto& button : button_list)
{
u16 value = data[button.first];
if (value > 0 && value > pressed_button.first)
pressed_button = { value, button.second };
}
for (const auto& button : pov_list)
{
u16 value = data[button.first];
if (value > 0 && value > pressed_button.first)
pressed_button = { value, button.second };
}
for (const auto& button : axis_list)
{
u32 keycode = button.first;
@ -341,6 +330,20 @@ void mm_joystick_handler::GetNextButtonPress(const std::string& padId, const std
}
}
for (const auto& button : pov_list)
{
u16 value = data[button.first];
if (value > 0 && value > pressed_button.first)
pressed_button = { value, button.second };
}
for (const auto& button : button_list)
{
u16 value = data[button.first];
if (value > 0 && value > pressed_button.first)
pressed_button = { value, button.second };
}
int preview_values[6] =
{
data[mmjoy_axis::joy_z_neg],