mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 12:55:45 +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 {
|
fun dispatchGenericMotionEvent(event: MotionEvent): Boolean {
|
||||||
val controllerData =
|
var controllerData = androidControllers[event.device.controllerNumber]
|
||||||
androidControllers[event.device.controllerNumber] ?: return false
|
if (controllerData == null) {
|
||||||
|
updateControllerData()
|
||||||
|
controllerData = androidControllers[event.device.controllerNumber] ?: return false
|
||||||
|
}
|
||||||
|
|
||||||
event.device.motionRanges.forEach {
|
event.device.motionRanges.forEach {
|
||||||
NativeInput.onGamePadAxisEvent(
|
NativeInput.onGamePadAxisEvent(
|
||||||
controllerData.getGUID(),
|
controllerData.getGUID(),
|
||||||
|
@ -48,7 +52,7 @@ object InputHandler {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDevices(): Map<Int, YuzuPhysicalDevice> {
|
fun getDevices(): Map<Int, YuzuPhysicalDevice> {
|
||||||
val gameControllerDeviceIds = mutableMapOf<Int, YuzuPhysicalDevice>()
|
val gameControllerDeviceIds = mutableMapOf<Int, YuzuPhysicalDevice>()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue