mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
fix(input): keep Steam touch opt-in
This commit is contained in:
1 parent
6b3e476917
commit
59071d78db
3 files changed
+7
-13
No files matched your search
@@ -6151,9 +6151,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
SessionPrefs.OSC_ALWAYS -> true
|
||||
SessionPrefs.OSC_STEAM_QAM -> true
|
||||
SessionPrefs.OSC_NEVER -> false
|
||||
SessionPrefs.OSC_STEAM_TOUCH -> if (SessionState.mode == SessionService.MODE_STEAM)
|
||||
SessionPrefs.oscChosen(this) || !PadBridge.anyControllerConnected() && !SteamControllerBle.connected
|
||||
else !PadBridge.anyControllerConnected() && SessionState.mode != SessionService.MODE_DESKTOP
|
||||
SessionPrefs.OSC_STEAM_TOUCH -> SessionState.mode == SessionService.MODE_STEAM ||
|
||||
(!PadBridge.anyControllerConnected() && SessionState.mode != SessionService.MODE_DESKTOP)
|
||||
else -> !PadBridge.anyControllerConnected() && !SteamControllerBle.connected &&
|
||||
SessionState.mode != SessionService.MODE_DESKTOP
|
||||
}
|
||||
|
||||
@@ -828,9 +828,8 @@ object SessionPrefs {
|
||||
prefs(context).getString("shape", null)
|
||||
?: if (context.packageManager.hasSystemFeature("android.hardware.sensor.hinge_angle")) SHAPE_WIDE else SHAPE_AUTO
|
||||
|
||||
/** Until the player picks, Steam sessions use Steam's own touch controls and other sessions DroidDeck's. */
|
||||
fun oscMode(context: Context, steamSession: Boolean = true): String {
|
||||
val saved = prefs(context).getString("osc", null) ?: return if (steamSession) OSC_STEAM_TOUCH else OSC_AUTO
|
||||
val saved = prefs(context).getString("osc", OSC_AUTO) ?: OSC_AUTO
|
||||
return if (!steamSession && saved == OSC_STEAM_QAM) OSC_AUTO else saved
|
||||
}
|
||||
|
||||
@@ -838,8 +837,6 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("osc", mode).apply()
|
||||
}
|
||||
|
||||
fun oscChosen(context: Context) = prefs(context).contains("osc")
|
||||
|
||||
/** Whether changes made in a game apply to that game alone, or to the profile every game shares. */
|
||||
fun inputForAllGames(context: Context) = prefs(context).getBoolean("inputForAllGames", false)
|
||||
|
||||
|
||||
@@ -106,12 +106,10 @@ class InputLibraryGamesTest {
|
||||
assertEquals(40, ControllerPrefs.onScreenOpacity(context))
|
||||
}
|
||||
|
||||
@Test fun steamSessionsUseSteamTouchUntilTheyPick() {
|
||||
assertFalse(SessionPrefs.oscChosen(context))
|
||||
assertEquals(SessionPrefs.OSC_STEAM_TOUCH, SessionPrefs.oscMode(context, steamSession = true))
|
||||
@Test fun steamTouchIsOptIn() {
|
||||
assertEquals(SessionPrefs.OSC_AUTO, SessionPrefs.oscMode(context, steamSession = true))
|
||||
assertEquals(SessionPrefs.OSC_AUTO, SessionPrefs.oscMode(context, steamSession = false))
|
||||
SessionPrefs.setOscMode(context, SessionPrefs.OSC_ALWAYS)
|
||||
assertTrue(SessionPrefs.oscChosen(context))
|
||||
assertEquals(SessionPrefs.OSC_ALWAYS, SessionPrefs.oscMode(context, steamSession = true))
|
||||
SessionPrefs.setOscMode(context, SessionPrefs.OSC_STEAM_TOUCH)
|
||||
assertEquals(SessionPrefs.OSC_STEAM_TOUCH, SessionPrefs.oscMode(context, steamSession = true))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user