mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 08:15:46 +00:00
[android] Fix: Prevent crash on Bluetooth controller disconnect
This commit is contained in:
parent
d8bfc691d1
commit
abbc4fefee
1 changed files with 15 additions and 11 deletions
|
@ -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>()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue