mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-13 18:50:56 +01:00
Use buttons instead of axes for the d-pad, enabling mapping from gamepads with only digital dpad outputs (#203)
This commit is contained in:
parent
e3b156bd96
commit
8656655bb1
@ -166,13 +166,25 @@ class Settings {
|
||||
KEY_CSTICK_AXIS_HORIZONTAL
|
||||
)
|
||||
val dPadKeys = listOf(
|
||||
KEY_DPAD_AXIS_VERTICAL,
|
||||
KEY_DPAD_AXIS_HORIZONTAL
|
||||
// KEY_DPAD_AXIS_VERTICAL,
|
||||
// KEY_DPAD_AXIS_HORIZONTAL,
|
||||
KEY_BUTTON_UP,
|
||||
KEY_BUTTON_DOWN,
|
||||
KEY_BUTTON_LEFT,
|
||||
KEY_BUTTON_RIGHT
|
||||
)
|
||||
val axisTitles = listOf(
|
||||
R.string.controller_axis_vertical,
|
||||
R.string.controller_axis_vertical,
|
||||
R.string.controller_axis_horizontal
|
||||
)
|
||||
|
||||
val dPadTitles = listOf(
|
||||
R.string.direction_up,
|
||||
R.string.direction_down,
|
||||
R.string.direction_left,
|
||||
R.string.direction_right,
|
||||
)
|
||||
|
||||
val triggerKeys = listOf(
|
||||
KEY_BUTTON_L,
|
||||
KEY_BUTTON_R,
|
||||
|
@ -79,6 +79,14 @@ class InputBindingSetting(
|
||||
else -> false
|
||||
}
|
||||
|
||||
fun isDpadButtons(): Boolean =
|
||||
when (abstractSetting.key) {
|
||||
Settings.KEY_BUTTON_DOWN,
|
||||
Settings.KEY_BUTTON_LEFT,
|
||||
Settings.KEY_BUTTON_UP,
|
||||
Settings.KEY_BUTTON_RIGHT -> true
|
||||
else -> false
|
||||
}
|
||||
/**
|
||||
* Returns true if this key is for the 3DS L/R or ZL/ZR buttons. Note, these are not real
|
||||
* triggers on the 3DS, but we support them as such on a physical gamepad.
|
||||
|
@ -612,7 +612,7 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
|
||||
add(HeaderSetting(R.string.controller_dpad))
|
||||
Settings.dPadKeys.forEachIndexed { i: Int, key: String ->
|
||||
val button = getInputObject(key)
|
||||
add(InputBindingSetting(button, Settings.axisTitles[i]))
|
||||
add(InputBindingSetting(button, Settings.dPadTitles[i]))
|
||||
}
|
||||
|
||||
add(HeaderSetting(R.string.controller_triggers))
|
||||
|
@ -110,6 +110,10 @@
|
||||
<string name="controller_dpad">D-Pad</string>
|
||||
<string name="controller_axis_vertical">Up/Down Axis</string>
|
||||
<string name="controller_axis_horizontal">Left/Right Axis</string>
|
||||
<string name="direction_up">Up</string>
|
||||
<string name="direction_down">Down</string>
|
||||
<string name="direction_left">Left</string>
|
||||
<string name="direction_right">Right</string>
|
||||
<string name="input_dialog_title">Bind %1$s %2$s</string>
|
||||
<string name="input_dialog_description">Press or move an input.</string>
|
||||
<string name="input_binding">Input Binding</string>
|
||||
|
Loading…
Reference in New Issue
Block a user