[Games] Filter out "virtual" Android joysticks #24382
Merged
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.
Description
Currently, input in games is broken on some Android devices due to "virtual" Android joysticks. I attempted to fix this in #23482 by introducing stable player assignment based on when the last button was pressed.
However, this didn't apply to joysticks that specify a specific player number - intended to allow XInput controllers to map to their XInput player. Android specifies the virtual joystick as being specifically player 1, so the time-based sorting method didn't apply to it.
When doing some research on the reports for this problem, I discovered several "virtual" joysticks, all with a similar naming pattern:
So, to handle unseen virtual joysticks, I've introduced a heuristic to match virtual joysticks with similar names. See the comment in the code for how the heuristic works.
Motivation and context
Reported here:
How has this been tested?
Tested with my newest test build based on 21 Beta 2: https://github.com/garbear/xbmc/releases
What is the effect on users?
Screenshots
Before:
After:
Types of change