The Xbox One S controller when connected via Bluetooth
is exposing its select button with the Linux KEY_BACK
code, which is outside of the normal input code
scan range for joysticks. This patch adds additional
scanning to pick up such extra buttons, and adds
them as buttons after the normal ranges to preserve
compatibility with existing key mappings.
It has been tested with the ScummVM core on:
- NVIDIA Shield TV running Android Nougat 7.0
- NVIDIA Shield Tablet running Android Nougat 7.0
- NVIDIA Shield Tablet running Android Lollipop 5.1
- Huawei Honor 7 running Android Marshmallow 6.0
- HTC Desire 500 running Android Jelly Bean 4.1
It's been tested using the touch screen, a USB mouse/keyboard combo, and a bluetooth mouse.
The Android version running on the device limits the functionality and user experience of the external mouse support.
Android Nougat and/or an NVIDIA SHIELD device with NVIDIA extensions provides the best user experience:
Android API < 14:
- Only left mouse button supported
- The Android mouse cursor will be visible along with the in game mouse cursor
- When the Android mouse cursor hits the edge of the screen it will not be possible to move the in-game mouse cursor further in that direction
Android API < 24 and no NVIDIA extensions available:
- Both left and right mouse buttons supported
- The Android mouse cursor will be visible along with the in game mouse cursor
- When the Android mouse cursor hits the edge of the screen it will not be possible to move the in-game mouse cursor further in that direction
Android API > 23 and/or NVIDIA extensions available (SHIELD devices):
- Both left and right mouse buttons supported
- The Android mouse cursor will be hidden
- The mouse is not limited by the (hidden) Android mouse cursor hitting the edge of the screen
Description of how the the touchscreen mouse support works:
- You can move the in-game mouse cursor using the touch screen. The in-game mouse cursor will move relative to your movements on the touch screen, it will not be centered on where you press the screen.
- One quick tap on the touch screen results in the left mouse button being clicked
- Two taps on the screen and keeping the second tap pressed down results in a left mouse being held down until you release
- Two fingers on the touch screen results in the right mouse button being clicked
The touch screen mouse functionality is active at the same time as overlay support. This might cause some confusion when using cores that are designed for mouse support but where you have also enabled overlay controls. At the top of android_input.c there's a define that can be used to turn off this functionality if it causes more problems than it solves.
This commit has two main changes to the OSX HID driver:
1.
Some joysticks have invalid/incorrect 'use' assigned to buttons and
axes. For example, my RetroUSB.com Genesis Retroport reports 8 buttons,
but they're reported as 1, 2, 3, 4, 1, 2, 3, 4, and my RetroLink
Gamecube-clone controller reports 2 axes with id 50.
OSX assigns each of these elements a unique cookie value, so it's still
possible to uniquely identify a button. Whenever a controller is
connected, the driver scans for all buttons and axes. When it identifies
a duplicate 'use' id, it reassigns it a new ID.
Whenever the input callback is called, it grabs the cookie value,
finds the input element with a matching cookie, and uses that element's
id instead of the one reported by the device.
The old joystick configs should not be broken by this - I'm using the
existing 'use' value wherever possible, and only changing it when it's
broken.
The 'faked' ids are done in a deterministic way, a joystick will never
have a button's 'faked' id change between launches of RetroArch.
2.
This enables HAT switch input.
of other sources being set.
API level 9 doesn't support stylus, but still needs to be handled.
Current code throws out additional sources that it doesn't
recognize. This instead ignores whether other sources are set.