Change maximum number of joystick buttons allowed by the mapper. #4596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modern sticks (particularly throttles) have more than 32 buttons. See VKB STECS and Virpil Mongoose for examples.
What issue(s) does this PR address?
I was getting duplicate button presses when trying to map on my VKB STECS. Turns out it was wrapping after button 31.
Does this PR introduce new feature(s)?
No.
Does this PR introduce any breaking change(s)?
Yes. Any existing mapper files which map over 32 buttons will no longer function correctly because the buttons will no longer wrap.
For example, if a user mapped button 33 before this change, this would have wrapped to button 1 (33 % 32 = 1), so it would have gotten mapped as button one. After this change, it will no longer wrap, so the existing bind won't work, they'd have to rebind it properly.
If this is objectionable, we can introduce a "max joystick buttons" config parameter which is defaulted to 32 for the old behavior. Users could then increase this value to allow for more buttons.
Additional information
There is a performance impact as we are now polling 3x the number of button inputs. I tested this for about half an hour in Jane's ATF and any latency added was imperceptible to me on a Ryzen 7 3700X. Not sure how it would behave on something slower.
If this performance hit is objectionable, the "max joystick buttons" parameter described above can be similarly used to mitigate this too - set it to the number of buttons one actually has, and then you only incur the polling penalty for exactly that number of buttons.