diff --git a/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/settings/SettingsManager.kt b/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/settings/SettingsManager.kt index 4373537bb5..cadaca219d 100644 --- a/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/settings/SettingsManager.kt +++ b/lemuroid-app/src/main/java/com/swordfish/lemuroid/app/mobile/feature/settings/SettingsManager.kt @@ -46,6 +46,8 @@ class SettingsManager(private val context: Context, sharedPreferences: Lazy>(mapOf()) + private var joinStickAndDPADifSupported = false + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_game) @@ -172,6 +175,7 @@ abstract class BaseGameActivity : ImmersiveActivity() { system = GameSystem.findById(game.systemId) lifecycleScope.launch { + joinStickAndDPADifSupported = settingsManager.joinStickDpad() loadGame() } @@ -655,7 +659,22 @@ abstract class BaseGameActivity : ImmersiveActivity() { if (port < 0) return when (event.source) { InputDevice.SOURCE_JOYSTICK -> { - if (controllerConfigsState.value[port]?.mergeDPADAndLeftStickEvents == true) { + var allowJoypad = controllerConfigsState.value[port]?.mergeDPADAndLeftStickEvents ?: false + + if(joinStickAndDPADifSupported) { + allowJoypad = when(system.id) { + SystemID.NES -> true + SystemID.SNES -> true + SystemID.GENESIS -> true + SystemID.GB -> true + SystemID.GBC -> true + SystemID.GBA -> true + SystemID.NDS -> true + else -> allowJoypad + } + } + + if (allowJoypad) { sendMergedMotionEvents(event, port) } else { sendSeparateMotionEvents(event, port) diff --git a/lemuroid-app/src/main/res/values/keys.xml b/lemuroid-app/src/main/res/values/keys.xml index ca00c4a6a5..02e3d3dfef 100644 --- a/lemuroid-app/src/main/res/values/keys.xml +++ b/lemuroid-app/src/main/res/values/keys.xml @@ -17,6 +17,7 @@ low_latency_audio enable_rumble enable_device_rumble + pref_key_join_stick_dpad max_cache_size_bytes allow_direct_game_load diff --git a/lemuroid-app/src/main/res/values/strings.xml b/lemuroid-app/src/main/res/values/strings.xml index f25946d3aa..048289cb99 100644 --- a/lemuroid-app/src/main/res/values/strings.xml +++ b/lemuroid-app/src/main/res/values/strings.xml @@ -87,6 +87,9 @@ Sync states More convenient, but heavier and less reliable. Choose which cores/systems you want to sync + D-Pad Emulation + Use joystick as D-Pad for systems that do not use a joystick. + Add to favorites Remove from favorites Resume