Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,9 @@ class ControllerHandler(
var startDownTime = 0L
var startUpTime = 0L
var backMenuPending = false
val novaShortcutState = NovaControllerShortcutState()
val novaShortcutState = NovaControllerShortcutState().apply {
guideShortcutsEnabled = prefConfig.guideShortcuts
}
val batteryStateUpdateRunnable: Runnable =
object : Runnable {
override fun run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class NovaControllerShortcutState {
private var yDown = false
private var backYConsumedByNova = false
var loneAppSwitchOpensQuickMenu = false
var guideShortcutsEnabled = true
private var appSwitchConsumedByNova = false

fun onButtonDown(keyCode: Int, repeatCount: Int): NovaControllerShortcutAction {
Expand Down Expand Up @@ -61,6 +62,9 @@ class NovaControllerShortcutState {
}

if (keyCode == KeyEvent.KEYCODE_BUTTON_MODE) {
if (!guideShortcutsEnabled) {
return NovaControllerShortcutAction.NONE
}
if (repeatCount == 0) {
guideDown = true
guideForwardedToHost = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class PreferenceConfiguration {
@JvmField var multiController = false
@JvmField var usbDriver = false
@JvmField var flipFaceButtons = false
@JvmField var guideShortcuts = true
@JvmField var onscreenController = false
@JvmField var onscreenControllerLayoutPreset: String? = null
@JvmField var hideOSCWhenHasGamepad = false
Expand Down Expand Up @@ -236,6 +237,7 @@ class PreferenceConfiguration {
private const val VIBRATE_FALLBACK_PREF_STRING = "checkbox_vibrate_fallback"
private const val VIBRATE_FALLBACK_STRENGTH_PREF_STRING = "seekbar_vibrate_fallback_strength"
private const val FLIP_FACE_BUTTONS_PREF_STRING = "checkbox_flip_face_buttons"
private const val GUIDE_SHORTCUTS_PREF_STRING = "checkbox_guide_shortcuts"
private const val LATENCY_TOAST_PREF_STRING = "checkbox_enable_post_stream_toast"
private const val FRAME_PACING_PREF_STRING = "frame_pacing"
private const val LOW_LATENCY_FRAME_BALANCE_PREF_STRING = "pref_low_latency_frame_balance"
Expand Down Expand Up @@ -335,6 +337,7 @@ class PreferenceConfiguration {
private const val DEFAULT_VIBRATE_FALLBACK = false
private const val DEFAULT_VIBRATE_FALLBACK_STRENGTH = 100
private const val DEFAULT_FLIP_FACE_BUTTONS = false
private const val DEFAULT_GUIDE_SHORTCUTS = true
private const val DEFAULT_AUDIO_CONFIG = "2"
private const val DEFAULT_LATENCY_TOAST = false
private const val DEFAULT_FRAME_PACING = "latency"
Expand Down Expand Up @@ -933,6 +936,7 @@ class PreferenceConfiguration {
config.vibrateFallbackToDeviceStrength =
prefs.getInt(VIBRATE_FALLBACK_STRENGTH_PREF_STRING, DEFAULT_VIBRATE_FALLBACK_STRENGTH)
config.flipFaceButtons = prefs.getBoolean(FLIP_FACE_BUTTONS_PREF_STRING, DEFAULT_FLIP_FACE_BUTTONS)
config.guideShortcuts = prefs.getBoolean(GUIDE_SHORTCUTS_PREF_STRING, DEFAULT_GUIDE_SHORTCUTS)
config.enableLatencyToast = prefs.getBoolean(LATENCY_TOAST_PREF_STRING, DEFAULT_LATENCY_TOAST)
config.enableBackMenu = prefs.getBoolean(CHECKBOX_ENABLE_QUIT_DIALOG, true)
config.enableFloatingButton =
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,8 @@
<string name="summary_checkbox_remember_mouse_mode">Remember mouse mode selected during stream. When disabled, mouse mode changed during stream will be temporary.</string>
<string name="title_checkbox_flip_face_buttons">Flip face buttons</string>
<string name="summary_checkbox_flip_face_buttons">Switches the face buttons A/B and X/Y for gamepads and the on-screen controls</string>
<string name="title_checkbox_guide_shortcuts">Guide button shortcuts</string>
<string name="summary_checkbox_guide_shortcuts">Use Guide+Start for the quick menu and Guide+Y for the HUD. Turn off to send Guide presses and holds to the host immediately.</string>
<string name="title_checkbox_gamepad_touchpad_as_mouse">Always control mouse with touchpad</string>
<string name="summary_checkbox_gamepad_touchpad_as_mouse">Forces gamepad touchpad input to control the host mouse, even when emulating a gamepad with a touchpad.</string>
<string name="title_checkbox_gamepad_motion_sensors">Allow use of gamepad motion sensors</string>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@
android:summary="@string/summary_checkbox_flip_face_buttons"
android:title="@string/title_checkbox_flip_face_buttons"
app:iconSpaceReserved="false" />
<CheckBoxPreference
android:defaultValue="true"
android:key="checkbox_guide_shortcuts"
android:summary="@string/summary_checkbox_guide_shortcuts"
android:title="@string/title_checkbox_guide_shortcuts"
app:iconSpaceReserved="false" />
<CheckBoxPreference
android:defaultValue="false"
android:key="checkbox_gamepad_touchpad_as_mouse"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,30 @@ class NovaControllerShortcutStateTest {
)
}

@Test
fun disabledGuideShortcutsPassGuideAndChordsThrough() {
val shortcuts = NovaControllerShortcutState()
shortcuts.guideShortcutsEnabled = false

assertEquals(
NovaControllerShortcutAction.NONE,
shortcuts.onButtonDown(KeyEvent.KEYCODE_BUTTON_MODE, repeatCount = 0)
)
assertEquals(
NovaControllerShortcutAction.NONE,
shortcuts.onButtonDown(KeyEvent.KEYCODE_BUTTON_MODE, repeatCount = 1)
)
assertEquals(
NovaControllerShortcutAction.NONE,
shortcuts.onButtonDown(KeyEvent.KEYCODE_BUTTON_Y, repeatCount = 0)
)
assertEquals(
NovaControllerShortcutAction.NONE,
shortcuts.onButtonUp(KeyEvent.KEYCODE_BUTTON_Y)
)
assertEquals(
NovaControllerShortcutAction.NONE,
shortcuts.onButtonUp(KeyEvent.KEYCODE_BUTTON_MODE)
)
}
}