Browse Source
[android] Fix: Prevent crash on Bluetooth controller disconnect
pull/262/head
edendev
8 months ago
No known key found for this signature in database
GPG Key ID: BA8734FD0EE46976
1 changed files with
15 additions and
11 deletions
-
src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt
|
|
|
@ -37,8 +37,12 @@ object InputHandler { |
|
|
|
} |
|
|
|
|
|
|
|
fun dispatchGenericMotionEvent(event: MotionEvent): Boolean { |
|
|
|
val controllerData = |
|
|
|
androidControllers[event.device.controllerNumber] ?: return false |
|
|
|
var controllerData = androidControllers[event.device.controllerNumber] |
|
|
|
if (controllerData == null) { |
|
|
|
updateControllerData() |
|
|
|
controllerData = androidControllers[event.device.controllerNumber] ?: return false |
|
|
|
} |
|
|
|
|
|
|
|
event.device.motionRanges.forEach { |
|
|
|
NativeInput.onGamePadAxisEvent( |
|
|
|
controllerData.getGUID(), |
|
|
|
@ -48,7 +52,7 @@ object InputHandler { |
|
|
|
) |
|
|
|
} |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fun getDevices(): Map<Int, YuzuPhysicalDevice> { |
|
|
|
val gameControllerDeviceIds = mutableMapOf<Int, YuzuPhysicalDevice>() |
|
|
|
|