summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2026-02-07 16:36:37 +0100
committerJosJuice <josjuice@gmail.com>2026-02-08 10:38:43 +0100
commitbd92388d2f36c32dee474cbcb5a0e0bba5035656 (patch)
treeb3b5a65fa6fe1bcda12b08e0da8e06cb889e2c01 /Source/Android
parenta8fbe8f28f622851333538ee0a2899bc159161ba (diff)
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.
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt14
1 files changed, 3 insertions, 11 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt
index 360800d656..71b37ff513 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/input/model/ControllerInterface.kt
@@ -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)
}
}