mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
revert(input): restore pre-overhaul controls (#2958)
This commit is contained in:
1 parent
33761c30ab
commit
9925873764
170 files changed
+3980
-4927
No files matched your search
@@ -69,18 +69,8 @@ object SessionDisplay {
|
||||
|
||||
const val UNFOLDED_MIN_DP = 600
|
||||
|
||||
/**
|
||||
* The game's share of a screen with the controls below it, at the game's [aspect] across the full width. A tab row under the bar
|
||||
* comes out of the controls while they keep [UNFOLDED_MIN_CONTROLS_SHARE] of the screen, and out of the game otherwise.
|
||||
*/
|
||||
fun unfoldedGameHeight(width: Int, height: Int, tabRow: Int = 0, aspect: Float = 16f / 9f): Int {
|
||||
val game = minOf((width / aspect.coerceAtLeast(.5f)).toInt(), (height * UNFOLDED_MAX_GAME_SHARE).toInt())
|
||||
val tabs = tabRow.coerceAtLeast(0)
|
||||
val roomy = height - game - tabs >= height * UNFOLDED_MIN_CONTROLS_SHARE
|
||||
return (if (roomy) game else game - tabs).coerceAtLeast(0) and 1.inv()
|
||||
}
|
||||
|
||||
const val UNFOLDED_MIN_CONTROLS_SHARE = .45f
|
||||
fun unfoldedGameHeight(width: Int, height: Int, tabRow: Int = 0): Int =
|
||||
(minOf(width * 9 / 16, (height * UNFOLDED_MAX_GAME_SHARE).toInt()) - tabRow.coerceAtLeast(0)).coerceAtLeast(0) and 1.inv()
|
||||
|
||||
fun unfoldedControlsWanted(
|
||||
enabled: Boolean,
|
||||
|
||||
@@ -664,38 +664,13 @@ object SessionPrefs {
|
||||
prefs(context).getString("shape", null)
|
||||
?: if (context.packageManager.hasSystemFeature("android.hardware.sensor.hinge_angle")) SHAPE_WIDE else SHAPE_AUTO
|
||||
|
||||
/** Overlay visibility. Older builds also stored the Steam layout here. */
|
||||
fun oscMode(context: Context, steamSession: Boolean? = null): String = when (val mode = prefs(context).getString("osc", OSC_AUTO)) {
|
||||
OSC_ALWAYS, OSC_NEVER -> mode
|
||||
OSC_STEAM_QAM -> if (steamSession == false) OSC_AUTO else OSC_STEAM_QAM
|
||||
OSC_STEAM_TOUCH -> if (steamSession == true) OSC_ALWAYS else OSC_AUTO
|
||||
else -> OSC_AUTO
|
||||
fun oscMode(context: Context, steamSession: Boolean = true): String {
|
||||
val saved = prefs(context).getString("osc", OSC_AUTO) ?: OSC_AUTO
|
||||
return if (!steamSession && saved == OSC_STEAM_QAM) OSC_AUTO else saved
|
||||
}
|
||||
|
||||
fun setOscMode(context: Context, mode: String) {
|
||||
val editor = prefs(context).edit()
|
||||
if (!prefs(context).contains("steamTouchLayout")) editor.putBoolean("steamTouchLayout", steamTouchLayout(context))
|
||||
editor.putString("osc", mode).apply()
|
||||
}
|
||||
|
||||
fun oscRearButtons(context: Context): Boolean = prefs(context).getBoolean("oscRearButtons", false)
|
||||
|
||||
fun setOscRearButtons(context: Context, shown: Boolean) {
|
||||
prefs(context).edit().putBoolean("oscRearButtons", shown).apply()
|
||||
}
|
||||
|
||||
fun oscTrackpads(context: Context): Boolean = prefs(context).getBoolean("oscTrackpads", false)
|
||||
|
||||
fun setOscTrackpads(context: Context, shown: Boolean) {
|
||||
prefs(context).edit().putBoolean("oscTrackpads", shown).apply()
|
||||
}
|
||||
|
||||
/** Draw Steam's touch layout for the game instead of DroidDeck's own. */
|
||||
fun steamTouchLayout(context: Context): Boolean =
|
||||
prefs(context).getBoolean("steamTouchLayout", prefs(context).getString("osc", null) == OSC_STEAM_TOUCH)
|
||||
|
||||
fun setSteamTouchLayout(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("steamTouchLayout", on).apply()
|
||||
prefs(context).edit().putString("osc", mode).apply()
|
||||
}
|
||||
|
||||
fun linuxDriver(context: Context): String =
|
||||
@@ -1974,7 +1949,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("pipAutoEnter", enabled).apply()
|
||||
}
|
||||
|
||||
fun unfoldedControls(context: Context): Boolean = prefs(context).getBoolean("unfoldedControls", true)
|
||||
fun unfoldedControls(context: Context): Boolean = prefs(context).getBoolean("unfoldedControls", false)
|
||||
|
||||
fun controlsBelowWanted(context: Context, mode: String, width: Int, height: Int, pip: Boolean = false): Boolean =
|
||||
SessionDisplay.unfoldedControlsWanted(
|
||||
|
||||
Reference in new issue
Block a user