Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Games] Filter out "virtual" Android joysticks #24382

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

garbear
Copy link
Member

@garbear garbear commented Jan 1, 2024

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:

  • shield-ask-remote
  • sunxi-ir-uinput
  • virtual-search

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?

  • Fixed controller input on Android

Screenshots

Before:

Screenshot_20231231-192717

After:

Screenshot_20231231-192456

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • Student submission (PR was done for educational purposes and will be treated as such)
  • None of the above (please explain below)

@KOPRajs
Copy link
Contributor

KOPRajs commented Jan 1, 2024

This is a quick fix, but ultimately this should be solved by finishing the player window. Then users can assign players as needed. There could be even enable / disable toggle function for every controller if needed.

EDIT: Basically it is already there, the controller is disabled by moving it in the first column.

@garbear
Copy link
Member Author

garbear commented Jan 1, 2024

Indeed, this code is removed (along with most of CGameAgentManager) in the player manager. I'll have to take virtual joysticks into consideration as I work on the Player Manager but certainly this code and basically all of GameAgentManager.cpp from this point to the end of the file are being removed and reworked for player management.

@garbear
Copy link
Member Author

garbear commented Jan 2, 2024

I haven't heard back from testers on the forum, but I'll merge this to get it into the nightlies for more testing and open a backport immediately, given that we expect to release 20.3 in less than a week. If anyone has any comments I'll open a follow-up PR and update the backport PR accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants