mirror of
https://github.com/PabloMK7/citra.git
synced 2024-12-28 02:26:13 +00: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
|
KEY_CSTICK_AXIS_HORIZONTAL
|
||||||
)
|
)
|
||||||
val dPadKeys = listOf(
|
val dPadKeys = listOf(
|
||||||
KEY_DPAD_AXIS_VERTICAL,
|
// KEY_DPAD_AXIS_VERTICAL,
|
||||||
KEY_DPAD_AXIS_HORIZONTAL
|
// KEY_DPAD_AXIS_HORIZONTAL,
|
||||||
|
KEY_BUTTON_UP,
|
||||||
|
KEY_BUTTON_DOWN,
|
||||||
|
KEY_BUTTON_LEFT,
|
||||||
|
KEY_BUTTON_RIGHT
|
||||||
)
|
)
|
||||||
val axisTitles = listOf(
|
val axisTitles = listOf(
|
||||||
R.string.controller_axis_vertical,
|
R.string.controller_axis_vertical,
|
||||||
R.string.controller_axis_horizontal
|
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(
|
val triggerKeys = listOf(
|
||||||
KEY_BUTTON_L,
|
KEY_BUTTON_L,
|
||||||
KEY_BUTTON_R,
|
KEY_BUTTON_R,
|
||||||
|
|
|
@ -79,6 +79,14 @@ class InputBindingSetting(
|
||||||
else -> false
|
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
|
* 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.
|
* 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))
|
add(HeaderSetting(R.string.controller_dpad))
|
||||||
Settings.dPadKeys.forEachIndexed { i: Int, key: String ->
|
Settings.dPadKeys.forEachIndexed { i: Int, key: String ->
|
||||||
val button = getInputObject(key)
|
val button = getInputObject(key)
|
||||||
add(InputBindingSetting(button, Settings.axisTitles[i]))
|
add(InputBindingSetting(button, Settings.dPadTitles[i]))
|
||||||
}
|
}
|
||||||
|
|
||||||
add(HeaderSetting(R.string.controller_triggers))
|
add(HeaderSetting(R.string.controller_triggers))
|
||||||
|
|
|
@ -110,6 +110,10 @@
|
||||||
<string name="controller_dpad">D-Pad</string>
|
<string name="controller_dpad">D-Pad</string>
|
||||||
<string name="controller_axis_vertical">Up/Down Axis</string>
|
<string name="controller_axis_vertical">Up/Down Axis</string>
|
||||||
<string name="controller_axis_horizontal">Left/Right 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_title">Bind %1$s %2$s</string>
|
||||||
<string name="input_dialog_description">Press or move an input.</string>
|
<string name="input_dialog_description">Press or move an input.</string>
|
||||||
<string name="input_binding">Input Binding</string>
|
<string name="input_binding">Input Binding</string>
|
||||||
|
|
Loading…
Reference in a new issue