mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-28 19:36:24 +02:00
android - set controller event as handled
This commit is contained in:
parent
1ea1a0ba68
commit
c74ad70c3d
1 changed files with 7 additions and 4 deletions
|
@ -8,10 +8,10 @@ class PhysicalControllerManager(val activity: MainActivity) {
|
||||||
private var ryujinxNative: RyujinxNative = RyujinxNative.instance
|
private var ryujinxNative: RyujinxNative = RyujinxNative.instance
|
||||||
|
|
||||||
fun onKeyEvent(event: KeyEvent) : Boolean{
|
fun onKeyEvent(event: KeyEvent) : Boolean{
|
||||||
if(controllerId != -1 && (event.flags and KeyEvent.FLAG_FALLBACK) == 0) {
|
|
||||||
val id = getGamePadButtonInputId(event.keyCode)
|
val id = getGamePadButtonInputId(event.keyCode)
|
||||||
|
|
||||||
if(id != GamePadButtonInputId.None) {
|
if(id != GamePadButtonInputId.None) {
|
||||||
|
val isNotFallback = (event.flags and KeyEvent.FLAG_FALLBACK) == 0
|
||||||
|
if (controllerId != -1 && isNotFallback) {
|
||||||
when (event.action) {
|
when (event.action) {
|
||||||
KeyEvent.ACTION_UP -> {
|
KeyEvent.ACTION_UP -> {
|
||||||
ryujinxNative.inputSetButtonReleased(id.ordinal, controllerId)
|
ryujinxNative.inputSetButtonReleased(id.ordinal, controllerId)
|
||||||
|
@ -23,6 +23,9 @@ class PhysicalControllerManager(val activity: MainActivity) {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
else if(!isNotFallback){
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue