mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
Add skip boot movie toggle (#2577)
* Add skip boot movie toggle * Hide boot movie controls when skipping * fix(session): resolve the skip movie key to its asset file
This commit is contained in:
1 parent
1e6aebd216
commit
0b8a3f1ee8
7 files changed
+33
-12
No files matched your search
Binary file not shown.
@@ -15,6 +15,7 @@ object BootMovie {
|
||||
const val DROIDDECK_30 = "dd30"
|
||||
const val DROIDDECK_60 = "dd60"
|
||||
const val CUSTOM = "custom"
|
||||
private const val SKIP = "skip"
|
||||
const val MAX_BYTES = 50L shl 20
|
||||
const val MAX_CONVERT_SECONDS = 60
|
||||
val PICKER_EXTENSIONS = listOf("webm", "mkv", "mp4", "mov", "m4v", "3gp")
|
||||
@@ -22,6 +23,7 @@ object BootMovie {
|
||||
private val ASSETS = mapOf(
|
||||
DROIDDECK_30 to "droiddeck-startup.webm",
|
||||
DROIDDECK_60 to "droiddeck-startup-60.webm",
|
||||
SKIP to "skip-startup.webm",
|
||||
)
|
||||
|
||||
internal val VIDEO_CODECS = setOf(MediaFormat.MIMETYPE_VIDEO_VP8, MediaFormat.MIMETYPE_VIDEO_VP9, MediaFormat.MIMETYPE_VIDEO_AV1)
|
||||
@@ -74,6 +76,7 @@ object BootMovie {
|
||||
|
||||
fun prepare(context: Context): File? {
|
||||
BootMovieLibrary.restore(context)
|
||||
if (SessionPrefs.skipBootMovie(context)) return assetFile(context, SKIP)
|
||||
val source = sourceOf(context, choice(context)) ?: return null
|
||||
return variant(context, source)
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ object BootMovieReport {
|
||||
line("== DroidDeck state")
|
||||
line("choice=${BootMovie.choice(context)} saved choice=${SessionPrefs.bootMovie(context)} pending pick=${SessionPrefs.bootMovieApplyNext(context)}")
|
||||
line("last Steam path seen=${SessionPrefs.bootMovieSteamSeen(context)}")
|
||||
line("sound=${SessionPrefs.bootMovieSound(context)} volume=${SessionPrefs.bootMovieVolume(context)} seconds=${SessionPrefs.bootMovieSeconds(context)}")
|
||||
line("sound=${SessionPrefs.bootMovieSound(context)} volume=${SessionPrefs.bootMovieVolume(context)} seconds=${SessionPrefs.bootMovieSeconds(context)} skip=${SessionPrefs.skipBootMovie(context)}")
|
||||
line("session running=${SessionState.running}")
|
||||
line()
|
||||
line("== The movie list as shown")
|
||||
|
||||
@@ -1164,6 +1164,11 @@ object SessionPrefs {
|
||||
fun setBootMovieVolume(context: Context, percent: Int) { prefs(context).edit().putInt("bootMovieVolume", percent.coerceIn(0, 100)).apply() }
|
||||
fun bootMovieSeconds(context: Context): Int = prefs(context).getInt("bootMovieSeconds", 0).coerceAtLeast(0)
|
||||
fun setBootMovieSeconds(context: Context, seconds: Int) { prefs(context).edit().putInt("bootMovieSeconds", seconds.coerceAtLeast(0)).apply() }
|
||||
fun skipBootMovie(context: Context): Boolean = prefs(context).getBoolean("skipBootMovie", false)
|
||||
fun setSkipBootMovie(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("skipBootMovie", on).apply()
|
||||
setBootMovieApplyNext(context, true)
|
||||
}
|
||||
fun bootMovieApplyNext(context: Context): Boolean = prefs(context).getBoolean("bootMovieApplyNext", false)
|
||||
fun setBootMovieApplyNext(context: Context, on: Boolean) { prefs(context).edit().putBoolean("bootMovieApplyNext", on).apply() }
|
||||
fun bootMovieSteamSeen(context: Context): String? = prefs(context).getString("bootMovieSteamSeen", null)
|
||||
|
||||
@@ -25,7 +25,7 @@ object SettingsReset {
|
||||
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite",
|
||||
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
|
||||
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
|
||||
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds",
|
||||
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
|
||||
"bootMovieApplyNext", "bootMovieSteamSeen",
|
||||
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsHud", "bottomHud", "bottomStripMetrics", "bottomStripTabs", "statsDash", "statsSpeedUnit",
|
||||
)
|
||||
|
||||
@@ -142,18 +142,29 @@ private fun TabChip(label: String, selected: Boolean, modifier: Modifier = Modif
|
||||
@Composable
|
||||
internal fun BootMovieGroup(s: ModeSettings, a: ModeSettingsActions, host: MenuHost) {
|
||||
var tab by rememberSaveable { mutableStateOf(MovieTab.INSTALLED) }
|
||||
val app = LocalContext.current.applicationContext
|
||||
var skipBootMovie by remember { mutableStateOf(SessionPrefs.skipBootMovie(app)) }
|
||||
SettingsGroup(stringResource(R.string.boot_movie)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 10.dp)) {
|
||||
TabChip(stringResource(R.string.boot_movie_tab_installed), tab == MovieTab.INSTALLED, Modifier.weight(1f)) { tab = MovieTab.INSTALLED }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_import), tab == MovieTab.IMPORT, Modifier.weight(1f)) { tab = MovieTab.IMPORT }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_repo), tab == MovieTab.REPO, Modifier.weight(1f)) { tab = MovieTab.REPO }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_sound), tab == MovieTab.SOUND, Modifier.weight(1f)) { tab = MovieTab.SOUND }
|
||||
ToggleRow(
|
||||
host, "boot-movie-skip", stringResource(R.string.boot_movie_skip),
|
||||
stringResource(R.string.boot_movie_skip_hint), skipBootMovie,
|
||||
) { enabled ->
|
||||
skipBootMovie = enabled
|
||||
SessionPrefs.setSkipBootMovie(app, enabled)
|
||||
}
|
||||
when (tab) {
|
||||
MovieTab.INSTALLED -> InstalledTab(a)
|
||||
MovieTab.IMPORT -> ImportTab(s, a)
|
||||
MovieTab.REPO -> RepoTab(a)
|
||||
MovieTab.SOUND -> SoundTab(s, a, host)
|
||||
if (!skipBootMovie) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.fillMaxWidth().padding(horizontal = 10.dp, vertical = 10.dp)) {
|
||||
TabChip(stringResource(R.string.boot_movie_tab_installed), tab == MovieTab.INSTALLED, Modifier.weight(1f)) { tab = MovieTab.INSTALLED }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_import), tab == MovieTab.IMPORT, Modifier.weight(1f)) { tab = MovieTab.IMPORT }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_repo), tab == MovieTab.REPO, Modifier.weight(1f)) { tab = MovieTab.REPO }
|
||||
TabChip(stringResource(R.string.boot_movie_tab_sound), tab == MovieTab.SOUND, Modifier.weight(1f)) { tab = MovieTab.SOUND }
|
||||
}
|
||||
when (tab) {
|
||||
MovieTab.INSTALLED -> InstalledTab(a)
|
||||
MovieTab.IMPORT -> ImportTab(s, a)
|
||||
MovieTab.REPO -> RepoTab(a)
|
||||
MovieTab.SOUND -> SoundTab(s, a, host)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3532,6 +3532,8 @@
|
||||
<string name="boot_movie_droiddeck">DroidDeck · %1$d fps</string>
|
||||
<string name="boot_movie_note">60 fps looks smoother but uses more CPU while Steam starts. A movie picked in Steam\'s own settings shows up here too.</string>
|
||||
<string name="boot_movie_sound">Sound</string>
|
||||
<string name="boot_movie_skip">Skip boot movie</string>
|
||||
<string name="boot_movie_skip_hint">Use a 0.1-second black clip as Steam’s startup movie. Applies next session.</string>
|
||||
<string name="boot_movie_custom">Your own movie</string>
|
||||
<string name="boot_movie_custom_hint">MP4, MOV, MKV or WebM. Other formats and files over %1$d MB are converted to 720p WebM on the device, up to %2$d seconds.</string>
|
||||
<string name="boot_movie_import">Import</string>
|
||||
|
||||
Reference in new issue
Block a user