mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-08-14 05:52:32 -05:00
Android: Rework input device hotplug
Previously, when an input device was connected or disconnected, we would recreate all devices. This commit makes it so we only touch the relevant device instead. This matters because recreating a device causes us to drop all held buttons for that device. Due to Android only delivering inputs as events, we're unable to poll for currently held buttons when recreating a device. This recently became a problem for users of Ayn devices due to a firmware update. Every now and then, something about the display viewports changes, triggering an update to an input device that I assume is a touch input device. This input device isn't something users normally map in Dolphin's controller settings, but it changing was causing Dolphin to drop all held buttons for the device's built-in gamepad as well as any other connected gamepads.
This commit is contained in:
@@ -95,11 +95,6 @@ object ControllerInterface {
|
||||
deviceQualifier: String, axisNames: Array<String>, suspended: Boolean
|
||||
)
|
||||
|
||||
/**
|
||||
* Rescans for input devices.
|
||||
*/
|
||||
external fun refreshDevices()
|
||||
|
||||
external fun getAllDeviceStrings(): Array<String>
|
||||
|
||||
external fun getDevice(deviceString: String): CoreDevice?
|
||||
@@ -193,13 +188,10 @@ object ControllerInterface {
|
||||
}
|
||||
|
||||
private class InputDeviceListener : InputManager.InputDeviceListener {
|
||||
// Simple implementation for now. We could do something fancier if we wanted to.
|
||||
override fun onInputDeviceAdded(deviceId: Int) = refreshDevices()
|
||||
override external fun onInputDeviceAdded(deviceId: Int)
|
||||
|
||||
// Simple implementation for now. We could do something fancier if we wanted to.
|
||||
override fun onInputDeviceRemoved(deviceId: Int) = refreshDevices()
|
||||
override external fun onInputDeviceRemoved(deviceId: Int)
|
||||
|
||||
// Simple implementation for now. We could do something fancier if we wanted to.
|
||||
override fun onInputDeviceChanged(deviceId: Int) = refreshDevices()
|
||||
override external fun onInputDeviceChanged(deviceId: Int)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user