mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
chore: simplify UI copy and repo text
This commit is contained in:
1 parent
af796545f6
commit
751f8ca114
96 files changed
+705
-1436
No files matched your search
@@ -56,8 +56,8 @@ import com.steamdeck.launcher.session.GameStorage
|
||||
|
||||
/**
|
||||
* The whole app outside a session: is the runtime installed, is there a newer one, frame
|
||||
* generation, and one button that starts Steam. Everything a Steam client can do — the library,
|
||||
* the store, downloads, settings — is the client's own job once [SessionActivity] has it on screen.
|
||||
* generation, and one button that starts Steam. Everything a Steam client can do - the library,
|
||||
* the store, downloads, settings - is the client's own job once [SessionActivity] has it on screen.
|
||||
*/
|
||||
class MainActivity : ComponentActivity() {
|
||||
private val ui = Handler(Looper.getMainLooper())
|
||||
@@ -480,7 +480,7 @@ class MainActivity : ComponentActivity() {
|
||||
val auto = td.autoId()
|
||||
androidRows = buildList {
|
||||
add(DriverRow(
|
||||
TurnipDriver.AUTO, "Auto — picked by GPU",
|
||||
TurnipDriver.AUTO, "Auto - picked by GPU",
|
||||
if (auto == "system") "system Vulkan: no bundled build for this GPU" else "${td.displayName(auto)} (bundled)",
|
||||
false,
|
||||
))
|
||||
@@ -491,8 +491,8 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Import off the main thread — a driver zip is a few MB and the glibc check reads the whole
|
||||
* library — then say what happened. A refusal's message is the user-facing reason.
|
||||
* Import off the main thread - a driver zip is a few MB and the glibc check reads the whole
|
||||
* library - then say what happened. A refusal's message is the user-facing reason.
|
||||
*/
|
||||
private fun importDriver(uri: Uri, linux: Boolean) {
|
||||
val name = displayNameOf(uri)
|
||||
@@ -544,7 +544,7 @@ class MainActivity : ComponentActivity() {
|
||||
}.getOrNull().let { v ->
|
||||
when (v?.lowercase()) {
|
||||
"false", "0" -> null
|
||||
else -> "Android 12 and later kill the extra processes an app starts for itself once there are more than a few, and a session is made of dozens: proot, gamescope, the client and its helpers, Wine. Where that is left on, the client dies with nothing in its log, because nothing in the session did it. Some phones have a \"restrict child processes\" switch in Developer options — turn it off. Otherwise, over adb:\n\n adb shell settings put global settings_enable_monitor_phantom_procs false\n\nThis phone " + (if (v == null) "has not been set either way, so the ROM's default applies." else "currently reports it as on.")
|
||||
else -> "Android 12 and later kill the extra processes an app starts for itself once there are more than a few, and a session is made of dozens: proot, gamescope, the client and its helpers, Wine. Where that is left on, the client dies with nothing in its log, because nothing in the session did it. Some phones have a \"restrict child processes\" switch in Developer options - turn it off. Otherwise, over adb:\n\n adb shell settings put global settings_enable_monitor_phantom_procs false\n\nThis phone " + (if (v == null) "has not been set either way, so the ROM's default applies." else "currently reports it as on.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,13 +56,13 @@ import java.io.File
|
||||
|
||||
/**
|
||||
* The session's screen: our Wayland compositor presenting onto this activity's Surface, and the
|
||||
* input that reaches it. The session itself — gamescope, the Steam client, audio — belongs to
|
||||
* input that reaches it. The session itself - gamescope, the Steam client, audio - belongs to
|
||||
* [SessionService] and keeps running when this activity does not exist, which is what lets the
|
||||
* user leave Big Picture for another app and come back to it still signed in and still
|
||||
* downloading.
|
||||
*
|
||||
* Three layers: the SurfaceView the compositor draws into, the on-screen pad (a canvas View,
|
||||
* since it is input rather than a menu), and one Compose layer on top for everything else —
|
||||
* since it is input rather than a menu), and one Compose layer on top for everything else -
|
||||
* the HUD line, the loading overlay, the drawer and its dialogs.
|
||||
*/
|
||||
class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
@@ -95,7 +95,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
|
||||
/**
|
||||
* Shows the on-screen pad when nothing is plugged in and takes it away the moment something
|
||||
* is — a user with a controller in their hands should not be looking at buttons they cannot
|
||||
* is - a user with a controller in their hands should not be looking at buttons they cannot
|
||||
* press, and a user without one must not be left with no way to answer Big Picture.
|
||||
*/
|
||||
private val deviceListener = object : InputManager.InputDeviceListener {
|
||||
@@ -264,7 +264,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
// The output size belongs to the session, not to the Surface: gamescope's display is
|
||||
// sized once when the session starts and cannot change. A foldable recreates the Surface
|
||||
// on the other panel, and recomputing the size there told the compositor a 21:9 buffer
|
||||
// was 16:9 — the picture came back squashed sideways. While a session runs, keep its size.
|
||||
// was 16:9 - the picture came back squashed sideways. While a session runs, keep its size.
|
||||
val size = if (SessionState.running) SessionState.outputSize else outputSize()
|
||||
SessionState.outputSize = size
|
||||
onScreenControls?.setPicture(drawnRect())
|
||||
@@ -318,7 +318,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
// period, so a long frame raises CPU clocks now rather than after the load averages up.
|
||||
PerfHints.arm(this, refreshHz())
|
||||
// The service owns everything below the compositor. It is started whenever no session is
|
||||
// running — NOT only when the compositor was just started: the compositor lives for the
|
||||
// running - NOT only when the compositor was just started: the compositor lives for the
|
||||
// whole process, so the second Play after a session ended used to re-attach the Surface,
|
||||
// start nothing, and leave the loading panel counting up over a dead session.
|
||||
if (!SessionState.running) {
|
||||
@@ -344,7 +344,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
// The on-screen controls follow the picture: into the bars beside or under it when there are any.
|
||||
onScreenControls?.setPicture(drawnRect())
|
||||
if (resized) {
|
||||
Log.i(TAG, "surface resized to ${width}x$height — rebinding the compositor")
|
||||
Log.i(TAG, "surface resized to ${width}x$height - rebinding the compositor")
|
||||
CompositorHost.resize(holder.surface) { applyFrameGen() }
|
||||
}
|
||||
}
|
||||
@@ -374,7 +374,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
val panelH = minOf(bounds.width(), bounds.height()).toFloat()
|
||||
// Never narrower than 16:9. A foldable's inner panel is nearly square, and a game handed a
|
||||
// square display draws for the frame it was made for and cuts the sides off itself.
|
||||
// Wider than 16:9 is fine — games and the client cope with a phone's 20:9 — so the
|
||||
// Wider than 16:9 is fine - games and the client cope with a phone's 20:9 - so the
|
||||
// panel's aspect is kept above that, unless the user pinned 16:9 for a foldable, and the
|
||||
// compositor letterboxes onto a squarer panel.
|
||||
val aspect = if (SessionPrefs.shapeMode(this) == SessionPrefs.SHAPE_WIDE) 16f / 9f
|
||||
@@ -516,12 +516,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
val down = event.action == KeyEvent.ACTION_DOWN
|
||||
if (down || event.action == KeyEvent.ACTION_UP) {
|
||||
var evdev = EvdevKeys.fromKeyCode(event.keyCode)
|
||||
// What the key stands for, and the key it would sit on without Shift — non-zero
|
||||
// What the key stands for, and the key it would sit on without Shift - non-zero
|
||||
// only for a character Shift puts there: every capital and the symbol row.
|
||||
val ch = event.unicodeChar
|
||||
val plain = if (ch > 0) EvdevKeys.unshiftedChar(ch) else 0
|
||||
// A soft keyboard's symbol keys are in neither the table nor a scan code, so they
|
||||
// reached the session as nothing at all — a sign-in took an address without its @.
|
||||
// reached the session as nothing at all - a sign-in took an address without its @.
|
||||
// Work back from the character instead: which key carries it.
|
||||
if (evdev <= 0 && ch > 0) {
|
||||
val code = EvdevKeys.fromKeyCode(EvdevKeys.keycodeForChar(if (plain != 0) plain else ch))
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.ArrayList;
|
||||
* needs no translating.
|
||||
*
|
||||
* <p>Ported down from Bannerlator's component: no sink suspend/resume and no route-change
|
||||
* recreate — those need the pasink native client, and a session here is a foreground activity
|
||||
* recreate - those need the pasink native client, and a session here is a foreground activity
|
||||
* that does not background the way a game container does.
|
||||
*/
|
||||
public class PulseAudioComponent extends EnvironmentComponent {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* The two fetches this app makes: the runtime catalog (a few hundred bytes of JSON) and the
|
||||
* runtime tarball itself (~790 MB). Plain HttpURLConnection — nothing here needs a client library,
|
||||
* runtime tarball itself (~790 MB). Plain HttpURLConnection - nothing here needs a client library,
|
||||
* and one fewer dependency is one fewer thing that can fail a release build.
|
||||
*/
|
||||
public final class Downloader {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.steamdeck.launcher.core;
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* One piece of a running session — the audio daemon, the network-link file, the session process
|
||||
* One piece of a running session - the audio daemon, the network-link file, the session process
|
||||
* itself. The session starts them in order and stops them in reverse.
|
||||
*/
|
||||
public abstract class EnvironmentComponent {
|
||||
|
||||
@@ -18,7 +18,7 @@ public final class FileUtils {
|
||||
|
||||
private FileUtils() {}
|
||||
|
||||
/** Recursive delete that does not follow symlinks — a rootfs is full of them. */
|
||||
/** Recursive delete that does not follow symlinks - a rootfs is full of them. */
|
||||
public static void delete(File file) {
|
||||
if (file == null || !file.exists() && !isSymlink(file)) return;
|
||||
if (file.isDirectory() && !isSymlink(file)) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Starts the session's host processes — proot and the audio daemon — and reports the exit status.
|
||||
* Starts the session's host processes - proot and the audio daemon - and reports the exit status.
|
||||
* The pid is read out of the hidden field on {@code java.lang.Process} because stopping a session
|
||||
* means killing that exact process: proot runs with {@code --kill-on-exit}, so the whole guest
|
||||
* tree goes with it.
|
||||
@@ -89,7 +89,7 @@ public final class ProcessHelper {
|
||||
thread.start();
|
||||
}
|
||||
|
||||
/** Splits on spaces, honouring backslash-escaped spaces — paths under /data are full of them. */
|
||||
/** Splits on spaces, honouring backslash-escaped spaces - paths under /data are full of them. */
|
||||
public static String[] splitCommand(String command) {
|
||||
List<String> parts = new ArrayList<>();
|
||||
StringBuilder current = new StringBuilder();
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* The small zstd tarballs that ship inside the apk (the Turnip driver, the PulseAudio modules).
|
||||
* The runtime rootfs is not one of these — it needs hard links and symlinks preserved, which
|
||||
* The runtime rootfs is not one of these - it needs hard links and symlinks preserved, which
|
||||
* {@link com.steamdeck.launcher.runtime.LinuxRuntimeInstaller} handles itself.
|
||||
*/
|
||||
public final class TarZst {
|
||||
|
||||
@@ -257,7 +257,7 @@ fun CollapsibleRail(
|
||||
|
||||
HorizontalDivider(color = MaterialTheme.colorScheme.outline.copy(alpha = 0.4f))
|
||||
|
||||
// ── Sections + items (SCROLLABLE so a tall rail — e.g. many File Manager favourites — is
|
||||
// ── Sections + items (SCROLLABLE so a tall rail - e.g. many File Manager favourites - is
|
||||
// fully reachable in both orientations; the header above and footer below stay pinned) ──
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@@ -307,7 +307,7 @@ fun CollapsibleRail(
|
||||
val iconTint = if (active) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant
|
||||
val labelColor = if (active) MaterialTheme.colorScheme.onSurface else MaterialTheme.colorScheme.onSurfaceVariant
|
||||
if (collapsed) {
|
||||
// Icon-only width is unchanged — a TINY label goes UNDER the icon (2 lines max,
|
||||
// Icon-only width is unchanged - a TINY label goes UNDER the icon (2 lines max,
|
||||
// centre-aligned, wrapping/abbreviated) so every button stays identifiable without
|
||||
// widening the rail.
|
||||
Column(
|
||||
@@ -362,7 +362,7 @@ fun CollapsibleRail(
|
||||
/**
|
||||
* Portrait counterpart to [CollapsibleRail]: the same navigation [items] laid out as a horizontal
|
||||
* icon-over-label bar pinned across the top, with an accent underline under the selected one. Mirrors
|
||||
* the container editor's top tab bar so every editor reads the same — pin this in portrait wherever a
|
||||
* the container editor's top tab bar so every editor reads the same - pin this in portrait wherever a
|
||||
* [CollapsibleRail] is used in landscape. Optional [links] (Help / Reset …) are appended after a
|
||||
* faint separator, exactly like the rail's links.
|
||||
*
|
||||
@@ -407,7 +407,7 @@ fun RailTopTabs(
|
||||
}
|
||||
}
|
||||
|
||||
/** One cell of [RailTopTabs] — icon over a small label, with an accent underline (zero-width when
|
||||
/** One cell of [RailTopTabs] - icon over a small label, with an accent underline (zero-width when
|
||||
* unselected, so every cell keeps the same height). Mirrors the container editor's TopCell. */
|
||||
@Composable
|
||||
private fun TopTabCell(
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.json.JSONArray
|
||||
*
|
||||
* Stores an ordered (insertion-order) list of absolute path strings as a JSON array
|
||||
* under "file_manager_favorites" in SharedPreferences "file_manager_prefs". Only the
|
||||
* absolute path is kept — everything shown on a favourite card (drive label, container
|
||||
* absolute path is kept - everything shown on a favourite card (drive label, container
|
||||
* name, display path) is derived live, so a renamed or deleted container resolves
|
||||
* correctly for free.
|
||||
*/
|
||||
|
||||
@@ -137,21 +137,21 @@ import java.util.Locale
|
||||
/**
|
||||
* What to do when a pasted item already exists at the destination.
|
||||
*
|
||||
* OVERWRITE and MERGE resolve to the same call — `copyWithProgress` recurses into an existing
|
||||
* directory and truncates existing files — but they mean different things to the user, so both are
|
||||
* OVERWRITE and MERGE resolve to the same call - `copyWithProgress` recurses into an existing
|
||||
* directory and truncates existing files - but they mean different things to the user, so both are
|
||||
* offered and the wording is chosen per item type (files overwrite, folders merge).
|
||||
*/
|
||||
enum class ConflictChoice { OVERWRITE, MERGE, KEEP_BOTH, SKIP }
|
||||
|
||||
/**
|
||||
* Ordering for the file list. Folders always lead regardless of direction — a descending sort that
|
||||
* Ordering for the file list. Folders always lead regardless of direction - a descending sort that
|
||||
* buries every folder under the files is never what someone means by "Z to A".
|
||||
*/
|
||||
/**
|
||||
* Shortens a path from the LEFT, keeping whole segments.
|
||||
*
|
||||
* Compose's TextOverflow can only ellipsise the tail, which for a path throws away the part that
|
||||
* matters — `/storage/emulated/0/Winlator/Game…` tells you nothing about where you are.
|
||||
* matters - `/storage/emulated/0/Winlator/Game…` tells you nothing about where you are.
|
||||
*/
|
||||
private fun elidePathStart(path: String, max: Int): String {
|
||||
if (path.length <= max) return path
|
||||
@@ -196,7 +196,7 @@ private fun isWithin(child: File, ancestor: File): Boolean {
|
||||
|
||||
// ── DOS file attributes (Read-only / Hidden) ──
|
||||
// The in-container file manager (wfm.exe) exposes these in its Properties dialog; this mirrors the
|
||||
// same two toggles for files browsed from the app side. No root — we only touch permission bits the
|
||||
// same two toggles for files browsed from the app side. No root - we only touch permission bits the
|
||||
// app owns (container files) and the Wine DOS-attribute xattr.
|
||||
|
||||
// FILE_ATTRIBUTE_HIDDEN, as Wine encodes it in the user.DOSATTRIB extended attribute.
|
||||
@@ -204,7 +204,7 @@ private const val FILE_ATTRIBUTE_HIDDEN = 0x2
|
||||
private const val DOSATTRIB_XATTR = "user.DOSATTRIB"
|
||||
|
||||
// Snapshot of a file's two toggleable attributes. hiddenSupported is false when the underlying
|
||||
// filesystem can't store the DOSATTRIB xattr (the FUSE /storage volumes) — the Hidden toggle is then
|
||||
// filesystem can't store the DOSATTRIB xattr (the FUSE /storage volumes) - the Hidden toggle is then
|
||||
// disabled while Read-only keeps working.
|
||||
private data class FileAttrState(
|
||||
val readOnly: Boolean,
|
||||
@@ -226,7 +226,7 @@ private fun parseDosAttrib(raw: ByteArray): Int {
|
||||
// comes back hiddenSupported=false (Hidden toggle disabled), Read-only always resolves.
|
||||
private fun readFileAttrs(file: File): FileAttrState {
|
||||
val path = file.absolutePath
|
||||
// Read-only reflects the OWNER write bit — that's what Wine maps to FILE_ATTRIBUTE_READONLY.
|
||||
// Read-only reflects the OWNER write bit - that's what Wine maps to FILE_ATTRIBUTE_READONLY.
|
||||
val readOnly = runCatching {
|
||||
(android.system.Os.stat(path).st_mode and android.system.OsConstants.S_IWUSR) == 0
|
||||
}.getOrDefault(!file.canWrite())
|
||||
@@ -309,7 +309,7 @@ fun describeLocation(file: File): FavLocation {
|
||||
}
|
||||
|
||||
// Semantic identity colours for the favourite-card drive badge. Intentionally NOT theme
|
||||
// accent colours — they identify the storage source at a glance. Returns (background, foreground).
|
||||
// accent colours - they identify the storage source at a glance. Returns (background, foreground).
|
||||
private fun badgeColors(loc: FavLocation): Pair<Color, Color> {
|
||||
val white = Color(0xFFFFFFFF)
|
||||
return when {
|
||||
@@ -350,13 +350,13 @@ fun FileManagerScreen(
|
||||
val rootDir = remember {
|
||||
// Both modes: honour an explicit caller-supplied start dir (e.g. Log Manager's game-log
|
||||
// folder), else open at the INTERNAL STORAGE ROOT. Selection screens (drive-folder pick,
|
||||
// local component pick, imports) previously defaulted to Download which — combined with the
|
||||
// currentRoot floor below — trapped users in Download with no way up (reported bug).
|
||||
// local component pick, imports) previously defaulted to Download which - combined with the
|
||||
// currentRoot floor below - trapped users in Download with no way up (reported bug).
|
||||
initialDir?.takeIf { it.isDirectory } ?: File("/storage/emulated/0")
|
||||
}
|
||||
|
||||
var currentDir by remember { mutableStateOf(rootDir) }
|
||||
// The up/back FLOOR — back + the up-arrow are disabled while currentDir == currentRoot. It MUST be
|
||||
// The up/back FLOOR - back + the up-arrow are disabled while currentDir == currentRoot. It MUST be
|
||||
// the VOLUME ROOT of the start dir (internal /storage/emulated/0, or an SD card /storage/XXXX-XXXX),
|
||||
// NOT the start dir itself: otherwise opening at any subfolder disables up/back and traps the user
|
||||
// there. (Mirrors the volume-root logic in favLocationOf above.)
|
||||
@@ -377,7 +377,7 @@ fun FileManagerScreen(
|
||||
var selectedEntry by remember { mutableStateOf<File?>(null) }
|
||||
var showMenuFor by remember { mutableStateOf<File?>(null) }
|
||||
// Clipboard holds a LIST so one paste can carry a whole selection. Cut/copy semantics are a
|
||||
// flag on the batch rather than per item — mixing the two in one clipboard has no sane meaning.
|
||||
// flag on the batch rather than per item - mixing the two in one clipboard has no sane meaning.
|
||||
var clipboardFiles by remember { mutableStateOf<List<File>>(emptyList()) }
|
||||
var isCutOperation by remember { mutableStateOf(false) }
|
||||
// Multi-select. Keyed by absolute path rather than File so a directory reload (which builds
|
||||
@@ -398,10 +398,10 @@ fun FileManagerScreen(
|
||||
var sortDesc by remember { mutableStateOf(browsePrefs.getBoolean("fmSortDesc", false)) }
|
||||
var showHidden by remember { mutableStateOf(browsePrefs.getBoolean("fmShowHidden", true)) }
|
||||
var showSortMenu by remember { mutableStateOf(false) }
|
||||
// View mode: list of cards (default) or a thumbnail grid. Density applies to the list only —
|
||||
// View mode: list of cards (default) or a thumbnail grid. Density applies to the list only -
|
||||
// a grid tile has no second line to compact.
|
||||
// The grid/list toggle is the SOURCE OF TRUTH in BOTH orientations (it drives the view and its
|
||||
// choice persists across rotation). Grid is the default — most useful in landscape, and in
|
||||
// choice persists across rotation). Grid is the default - most useful in landscape, and in
|
||||
// portrait GridCells.Adaptive naturally renders fewer columns (~2). Do NOT force portrait to list:
|
||||
// that broke the toggle on-device (tapping it did nothing in portrait).
|
||||
var gridView by remember { mutableStateOf(browsePrefs.getBoolean("fmGridView", true)) }
|
||||
@@ -502,7 +502,7 @@ fun FileManagerScreen(
|
||||
suspend fun askConflict(file: File): ConflictChoice? {
|
||||
pendingConflict = file
|
||||
conflictChoice = null
|
||||
// Poll rather than plumb a CompletableDeferred through Compose state — the dialog answers
|
||||
// Poll rather than plumb a CompletableDeferred through Compose state - the dialog answers
|
||||
// by setting conflictChoice, and this coroutine is already off the critical path.
|
||||
while (pendingConflict != null && conflictChoice == null) kotlinx.coroutines.delay(50)
|
||||
return conflictChoice
|
||||
@@ -556,7 +556,7 @@ fun FileManagerScreen(
|
||||
operationLabel = buildString {
|
||||
append(if (cut) "Moving" else "Copying")
|
||||
if (sources.size > 1) append(" ${done + 1}/${sources.size}")
|
||||
append(" — ").append(src.name)
|
||||
append(" - ").append(src.name)
|
||||
}
|
||||
var lastPct = -1
|
||||
val onProgress = FileOps.ProgressCallback { copied, total ->
|
||||
@@ -745,7 +745,7 @@ fun FileManagerScreen(
|
||||
isOperationRunning = true
|
||||
var failed = 0
|
||||
victims.forEachIndexed { i, f ->
|
||||
operationLabel = "Deleting ${i + 1}/${victims.size} — ${f.name}"
|
||||
operationLabel = "Deleting ${i + 1}/${victims.size} - ${f.name}"
|
||||
if (!withContext(Dispatchers.IO) { FileOps.delete(f) }) failed++
|
||||
}
|
||||
isOperationRunning = false
|
||||
@@ -761,7 +761,7 @@ fun FileManagerScreen(
|
||||
)
|
||||
}
|
||||
|
||||
// Paste conflict — one per colliding item, with "apply to all" for a long batch.
|
||||
// Paste conflict - one per colliding item, with "apply to all" for a long batch.
|
||||
pendingConflict?.let { conflict ->
|
||||
val isDir = conflict.isDirectory
|
||||
OutlinedAlertDialog(
|
||||
@@ -856,7 +856,7 @@ fun FileManagerScreen(
|
||||
val driveChipAlpha = if (showFavorites) 0.45f else 1f
|
||||
Box {
|
||||
// The drive/location selector opens the drive dropdown, so give it the same outlined
|
||||
// look as the "New Folder" button + the rail location items — it reads as a button, not
|
||||
// look as the "New Folder" button + the rail location items - it reads as a button, not
|
||||
// plain text. Border uses the theme accent token; behaviour unchanged.
|
||||
val driveChipShape = RoundedCornerShape(8.dp)
|
||||
Text(
|
||||
@@ -909,7 +909,7 @@ fun FileManagerScreen(
|
||||
|
||||
if (showFavorites) {
|
||||
Text(
|
||||
text = "★ Favorites",
|
||||
text = "Favorites",
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
@@ -918,12 +918,12 @@ fun FileManagerScreen(
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
} else if (LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
// PORTRAIT: hide the current-folder name — it's redundant with the path bar directly
|
||||
// PORTRAIT: hide the current-folder name - it's redundant with the path bar directly
|
||||
// below (which shows the full path). The spacer keeps the action icons right-aligned.
|
||||
Spacer(Modifier.weight(1f))
|
||||
} else {
|
||||
// LANDSCAPE: the CURRENT FOLDER, not the full path. A path ellipsised on the right
|
||||
// hides its tail — the only part that says where you are ("…/Winlator/Game…"). The
|
||||
// hides its tail - the only part that says where you are ("…/Winlator/Game…"). The
|
||||
// full path moves to the line below, where it has room.
|
||||
Text(
|
||||
text = currentDir.name.ifBlank { currentDir.absolutePath },
|
||||
@@ -1029,7 +1029,7 @@ fun FileManagerScreen(
|
||||
)
|
||||
}
|
||||
|
||||
// Free space on the volume being browsed — worth knowing before starting a 60 GB copy.
|
||||
// Free space on the volume being browsed - worth knowing before starting a 60 GB copy.
|
||||
val freeSpace = remember(currentDir.absolutePath, entries) {
|
||||
runCatching { currentDir.usableSpace }.getOrDefault(0L)
|
||||
}
|
||||
@@ -1225,7 +1225,7 @@ fun FileManagerScreen(
|
||||
val locationSections = buildList {
|
||||
add(RailSection("STORAGE", storageItems))
|
||||
if (quickItems.isNotEmpty()) add(RailSection("QUICK", quickItems))
|
||||
if (favItems.isNotEmpty()) add(RailSection("★ FAVORITES", favItems))
|
||||
if (favItems.isNotEmpty()) add(RailSection("FAVORITES", favItems))
|
||||
}
|
||||
|
||||
Row(modifier = Modifier.weight(1f).fillMaxWidth()) {
|
||||
@@ -1431,7 +1431,7 @@ fun FileManagerScreen(
|
||||
|
||||
// The context-menu item list shared by the list rows (FileItemRow) and the grid tiles
|
||||
// (FileGridTile), so both open the identical menu. Gating (isDir/canRun/isInno/looksLikeArchive) is
|
||||
// recomputed from [file] here — one source of truth for what each item shows. Every item dismisses
|
||||
// recomputed from [file] here - one source of truth for what each item shows. Every item dismisses
|
||||
// the menu first, then runs its action.
|
||||
@Composable
|
||||
private fun FileContextMenuItems(
|
||||
@@ -1462,7 +1462,7 @@ private fun FileContextMenuItems(
|
||||
onClick = { onDismissMenu(); onProperties() },
|
||||
)
|
||||
MenuItemDivider()
|
||||
// Favorites are directories — only folders get the pin toggle.
|
||||
// Favorites are directories - only folders get the pin toggle.
|
||||
if (isDir) {
|
||||
DropdownMenuItem(
|
||||
text = { Text(if (isFavorite) "Remove from Favorites" else "Add to Favorites") },
|
||||
@@ -1708,7 +1708,7 @@ private fun FavoritesList(
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text(
|
||||
text = "No favorites yet — pin a folder with its ⋮ menu to jump back here fast.",
|
||||
text = "No favorites yet - pin a folder with its ⋮ menu to jump back here fast.",
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
fontSize = 13.sp,
|
||||
modifier = Modifier.padding(horizontal = 32.dp),
|
||||
@@ -1729,7 +1729,7 @@ private fun FavoritesList(
|
||||
}
|
||||
}
|
||||
|
||||
// A single favourite — matches the FileItemRow card style (surfaceContainer + outline +
|
||||
// A single favourite - matches the FileItemRow card style (surfaceContainer + outline +
|
||||
// RoundedCornerShape(10.dp)). Shows the folder name, a coloured drive badge + origin text,
|
||||
// and the full display path; tapping jumps into it, the filled star unpins.
|
||||
@Composable
|
||||
@@ -1818,7 +1818,7 @@ private fun FavoriteCard(
|
||||
/**
|
||||
* One entry in the File Manager's grid view: a big thumbnail with the name under it.
|
||||
*
|
||||
* Deliberately drops size and date — at this width they truncate to noise. The grid is for
|
||||
* Deliberately drops size and date - at this width they truncate to noise. The grid is for
|
||||
* recognising things by sight (screenshots, covers, game folders); the list stays the view for
|
||||
* reading details.
|
||||
*/
|
||||
@@ -1852,7 +1852,7 @@ private fun FileGridTile(
|
||||
if (bmp != null) exeIcon = bmp.asImageBitmap()
|
||||
}
|
||||
}
|
||||
// The tile has no ⋮ button — long-press opens this menu, anchored to the Box around the Card.
|
||||
// The tile has no ⋮ button - long-press opens this menu, anchored to the Box around the Card.
|
||||
Box {
|
||||
Card(
|
||||
modifier = Modifier
|
||||
@@ -1942,7 +1942,7 @@ private fun FileGridTile(
|
||||
|
||||
/**
|
||||
* Properties sheet for a single file or folder: basic info plus the two Windows/Wine file attributes
|
||||
* the in-container file manager (wfm.exe) also exposes — Read-only and Hidden. Each toggle applies
|
||||
* the in-container file manager (wfm.exe) also exposes - Read-only and Hidden. Each toggle applies
|
||||
* immediately (off the main thread) and refreshes the listing via [onChanged].
|
||||
*
|
||||
* State is keyed on the file so it always reflects the entry it was opened for. On a filesystem that
|
||||
@@ -1980,7 +1980,7 @@ private fun FilePropertiesDialog(
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
Spacer(Modifier.height(6.dp))
|
||||
PropertyLine("Location", file.parent ?: "—")
|
||||
PropertyLine("Location", file.parent ?: "-")
|
||||
PropertyLine(
|
||||
"Type",
|
||||
if (file.isDirectory) "Folder"
|
||||
@@ -2033,7 +2033,7 @@ private fun FilePropertiesDialog(
|
||||
attrs = attrs?.copy(hidden = want)
|
||||
onChanged()
|
||||
} else {
|
||||
// The write failed after all — disable the toggle rather than lie.
|
||||
// The write failed after all - disable the toggle rather than lie.
|
||||
attrs = attrs?.copy(hiddenSupported = false)
|
||||
Toast.makeText(context, "Couldn't change Hidden on this storage", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
|
||||
// Single source of truth for the app's AlertDialogs: a drop-in wrapper around the Material3
|
||||
// slot-based AlertDialog that adds a 1dp outline around the whole popup box — matching the
|
||||
// slot-based AlertDialog that adds a 1dp outline around the whole popup box - matching the
|
||||
// outline that Modifier.outlinedMenuCard() (MenuStyle.kt) puts on the app's menus. Signature
|
||||
// mirrors androidx.compose.material3.AlertDialog exactly (compose-bom 2024.02.00 → material3
|
||||
// 1.2.0), so every call site can swap AlertDialog( → OutlinedAlertDialog( unchanged. The
|
||||
|
||||
@@ -11,8 +11,8 @@ import kotlin.math.max
|
||||
*
|
||||
* Walks the PE resource directory to the first RT_GROUP_ICON, picks the largest /
|
||||
* deepest-colour entry it references, then decodes that RT_ICON image. Icon images
|
||||
* are either PNG (Vista+) — decoded directly — or a classic DIB (BITMAPINFOHEADER +
|
||||
* XOR pixels + 1-bpp AND mask) — decoded by hand here.
|
||||
* are either PNG (Vista+) - decoded directly - or a classic DIB (BITMAPINFOHEADER +
|
||||
* XOR pixels + 1-bpp AND mask) - decoded by hand here.
|
||||
*
|
||||
* Everything is best-effort: any malformed/oversized/unsupported input returns null.
|
||||
*/
|
||||
|
||||
@@ -30,9 +30,9 @@ data class StorageRoot(
|
||||
* sandbox) even though it is mounted and healthy. The framework knows about it regardless, so the
|
||||
* volume set is built from several independent sources:
|
||||
*
|
||||
* 1. [StorageManager.getStorageVolumes] — the authoritative list, read over Binder.
|
||||
* 2. [Context.getExternalFilesDirs] — per-app directories, granted separately from shared storage.
|
||||
* 3. `/storage` and `/mnt/media_rw` directory listings — the filesystem view, as a backstop.
|
||||
* 1. [StorageManager.getStorageVolumes] - the authoritative list, read over Binder.
|
||||
* 2. [Context.getExternalFilesDirs] - per-app directories, granted separately from shared storage.
|
||||
* 3. `/storage` and `/mnt/media_rw` directory listings - the filesystem view, as a backstop.
|
||||
*
|
||||
* Those sources overlap heavily: one SD card is reachable as `/storage/<uuid>`, as
|
||||
* `/mnt/media_rw/<uuid>`, and via its app-specific directory, and typically only some of them are
|
||||
@@ -71,7 +71,7 @@ object StorageRoots {
|
||||
val appDirs = appSpecificDirs(context)
|
||||
val storageManager = context.getSystemService(StorageManager::class.java)
|
||||
|
||||
// 1 + 2 — framework-reported volumes. Authoritative, and unaffected by our mount view.
|
||||
// 1 + 2 - framework-reported volumes. Authoritative, and unaffected by our mount view.
|
||||
storageManager?.storageVolumes.orEmpty()
|
||||
.filter { isMounted(it.state) }
|
||||
.forEach { volume ->
|
||||
@@ -92,7 +92,7 @@ object StorageRoots {
|
||||
appDirs.filter { belongsTo(storageManager!!, it, volume) }.forEach { entry.seeds += it }
|
||||
}
|
||||
|
||||
// 3 — filesystem backstop, for any volume the framework did not report.
|
||||
// 3 - filesystem backstop, for any volume the framework did not report.
|
||||
File("/storage").listFiles().orEmpty().forEach { child ->
|
||||
if (!child.isDirectory || child.name == "self" || child.name == "emulated") return@forEach
|
||||
volumeOf(child.name).candidates += child
|
||||
@@ -179,7 +179,7 @@ object StorageRoots {
|
||||
|
||||
/**
|
||||
* Names a volume the way the rest of the file manager does. The framework description is only
|
||||
* used when it says something more useful than "SD card" — on some devices it is a bare disk
|
||||
* used when it says something more useful than "SD card" - on some devices it is a bare disk
|
||||
* name like "android", which tells the user nothing about which card they are looking at.
|
||||
*/
|
||||
private fun labelFor(context: Context, volume: StorageVolume, uuid: String?): String {
|
||||
|
||||
@@ -20,7 +20,7 @@ object FrameGen {
|
||||
|
||||
/** Win-FG's Performance preset, pinned: changing it live rebuilds the whole chain. */
|
||||
private const val WINFG_PERF_PRESET = 2
|
||||
/** Bidirectional flow with the occlusion gate — the chain's own default. */
|
||||
/** Bidirectional flow with the occlusion gate - the chain's own default. */
|
||||
private const val WINFG_MODEL = 4
|
||||
/** Optical-flow resolution as a fraction of the output; Bannerlator's per-engine defaults. */
|
||||
private const val FLOW_SCALE_WINFG = 0.60f
|
||||
@@ -39,7 +39,7 @@ object FrameGen {
|
||||
.putString("engine", engine).putInt("multiplier", multiplier).apply()
|
||||
}
|
||||
|
||||
/** "Off", "Win-FG 2×", "LSFG 3×" — for the main screen. */
|
||||
/** "Off", "Win-FG 2×", "LSFG 3×" - for the main screen. */
|
||||
fun label(context: Context): String = when (engine(context)) {
|
||||
ENGINE_WINFG -> "Win-FG ${multiplier(context)}×"
|
||||
ENGINE_LSFG -> "LSFG ${multiplier(context)}×"
|
||||
@@ -84,12 +84,12 @@ object FrameGen {
|
||||
|
||||
/**
|
||||
* Off, or an engine at 2x/3x/4x; saved on pick, then [onChanged]. The LSFG rows are greyed
|
||||
* and unpickable until Lossless Scaling is installed in the Steam client — the engine cannot
|
||||
* and unpickable until Lossless Scaling is installed in the Steam client - the engine cannot
|
||||
* run without its DLL, so offering it would only produce a setting that silently does nothing.
|
||||
*/
|
||||
fun showPicker(activity: android.app.Activity, onChanged: () -> Unit) {
|
||||
val lsfgReady = LsfgNative.isInstalled(activity)
|
||||
val lsfgNote = if (lsfgReady) "" else " — install Lossless Scaling in Steam"
|
||||
val lsfgNote = if (lsfgReady) "" else " - install Lossless Scaling in Steam"
|
||||
val choices = listOf("Off",
|
||||
"Win-FG 2×", "Win-FG 3×", "Win-FG 4×",
|
||||
"LSFG 2×$lsfgNote", "LSFG 3×$lsfgNote", "LSFG 4×$lsfgNote")
|
||||
|
||||
@@ -13,11 +13,11 @@ import java.util.List;
|
||||
* choice per mode covers all of it.
|
||||
*
|
||||
* <p>Distinct from the Android driver the app's compositor loads to put the finished frame on the
|
||||
* screen ({@link TurnipDriver}), which every session ends in — and NOT interchangeable with it:
|
||||
* screen ({@link TurnipDriver}), which every session ends in - and NOT interchangeable with it:
|
||||
* these are glibc processes, that one is bionic.
|
||||
*
|
||||
* <p>"" (the default) means the driver the runtime was built with, at
|
||||
* {@code usr/lib/libvulkan_freedreno.so} inside it — nothing is set and nothing is touched.
|
||||
* {@code usr/lib/libvulkan_freedreno.so} inside it - nothing is set and nothing is touched.
|
||||
* Otherwise the value is an imported driver's id ({@link LinuxVulkanDriverManager}), and the
|
||||
* session is handed that driver's ICD manifest in {@code BL_VK_DRIVER}: the session script points
|
||||
* the Vulkan loader at it with {@code VK_DRIVER_FILES} after checking both the manifest and the
|
||||
@@ -47,13 +47,13 @@ public final class LinuxVulkanDriver {
|
||||
}
|
||||
|
||||
/**
|
||||
* Label for a stored value. An id that is no longer installed says so — the launch path falls
|
||||
* Label for a stored value. An id that is no longer installed says so - the launch path falls
|
||||
* back to the runtime's own driver for it.
|
||||
*/
|
||||
public static String optionLabel(Context context, String value) {
|
||||
if (value == null || value.isEmpty()) return "Runtime default (built into the runtime)";
|
||||
LinuxVulkanDriverManager m = new LinuxVulkanDriverManager(context);
|
||||
if (!m.isInstalled(value)) return value + " (imported, missing — uses the runtime default)";
|
||||
if (!m.isInstalled(value)) return value + " (imported, missing - uses the runtime default)";
|
||||
String ver = m.getDriverVersion(value);
|
||||
return m.getDriverName(value) + (ver.isEmpty() ? "" : " " + ver) + " (imported)";
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* Imported LINUX Vulkan drivers: glibc Turnip ICDs ({@code Turnip-<tag>[-variant]-Linux.zip} from
|
||||
* Banners-Turnip) for the runtime — the gamescope session that runs Valve's native ARM64 Steam
|
||||
* Banners-Turnip) for the runtime - the gamescope session that runs Valve's native ARM64 Steam
|
||||
* client, and the labwc desktop beside it. This is the driver that DRAWS there: the client's own UI
|
||||
* (OpenGL through the runtime's Zink), every game the client launches (D3D through Proton's
|
||||
* DXVK/VKD3D) and everything on the desktop. Putting the frame on the screen stays the Android
|
||||
@@ -31,7 +31,7 @@ import java.util.zip.ZipInputStream;
|
||||
*
|
||||
* <p>Not interchangeable with that one: the client and its games are glibc processes and cannot
|
||||
* load a bionic object at all, and this one cannot be loaded by the app. The check that separates
|
||||
* them is the libc the driver links against — {@code libc.so.6} here, {@code libc.so} there.
|
||||
* them is the libc the driver links against - {@code libc.so.6} here, {@code libc.so} there.
|
||||
*
|
||||
* <p>Layout (under the app's files dir, which the session sees by its full host path):
|
||||
* <pre>
|
||||
@@ -171,7 +171,7 @@ public class LinuxVulkanDriverManager {
|
||||
// are in the driver's .dynstr, so a byte scan is enough and needs no ELF parsing:
|
||||
// glibc's is versioned ("libc.so.6"), bionic's is not ("libc.so").
|
||||
if (!containsAscii(so, "libc.so.6")) {
|
||||
throw new IllegalArgumentException(soName + " is not a glibc driver — it links Android's libc. "
|
||||
throw new IllegalArgumentException(soName + " is not a glibc driver - it links Android's libc. "
|
||||
+ "The Linux runtime needs a \"-Linux\" zip; a plain or \"-Wayland\" Turnip cannot be "
|
||||
+ "loaded by the Steam client at all.");
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.io.File;
|
||||
*
|
||||
* <p>The 25 compute shaders are not redistributable. They live as resources inside the user's
|
||||
* paid {@code Lossless.dll} (Steam app 993090), which in this app the user installs from the
|
||||
* Steam client itself — so the DLL sits in the runtime's own Steam library. It is mapped
|
||||
* Steam client itself - so the DLL sits in the runtime's own Steam library. It is mapped
|
||||
* read-only and parsed as data, never loaded or executed. Extraction is slow enough to be worth
|
||||
* doing once (the DXBC chain is translated to SPIR-V), so the result is cached, keyed on the
|
||||
* DLL's size and hash. Call {@link #ensureCache} off the main thread.
|
||||
|
||||
@@ -27,19 +27,19 @@ import java.util.zip.ZipInputStream;
|
||||
* The Vulkan driver the in-app compositor runs on. It has to be Turnip: the system Adreno driver
|
||||
* does not implement VK_EXT_image_drm_format_modifier, so importing the dma-bufs gamescope hands
|
||||
* over fails and the session renders nothing. Two builds ship in the apk, one per Adreno
|
||||
* generation, and the GPU decides which is unpacked — unless the user has imported an AdrenoTools
|
||||
* generation, and the GPU decides which is unpacked - unless the user has imported an AdrenoTools
|
||||
* zip of their own and chosen it, which then wins.
|
||||
*
|
||||
* <p>The guest's own Turnip is a different copy entirely — a glibc build inside the rootfs, or an
|
||||
* <p>The guest's own Turnip is a different copy entirely - a glibc build inside the rootfs, or an
|
||||
* imported one ({@link LinuxVulkanDriverManager}). This one is the bionic build the app process
|
||||
* loads through adrenotools, and it is what every session ends in: whatever draws inside the
|
||||
* runtime, this is the driver that puts the frame on the panel.
|
||||
*
|
||||
* <p>Every driver, bundled or imported, lives under {@code files/graphics_driver/<id>/} with a
|
||||
* {@code meta.json} whose {@code libraryName} names the .so beside it — the AdrenoTools layout.
|
||||
* {@code meta.json} whose {@code libraryName} names the .so beside it - the AdrenoTools layout.
|
||||
* The import path is ported from Bannerlator's {@code AdrenotoolsManager} (GPL-3.0), including
|
||||
* the refusal of zips that belong in the Linux runtime list: a "-Linux" (glibc) Turnip names no
|
||||
* library on purpose, and installed here it would put the compositor on the system Vulkan — a
|
||||
* library on purpose, and installed here it would put the compositor on the system Vulkan - a
|
||||
* black screen wearing a driver's name.
|
||||
*/
|
||||
public final class TurnipDriver {
|
||||
@@ -52,11 +52,11 @@ public final class TurnipDriver {
|
||||
public static final List<String> BUNDLED = Collections.unmodifiableList(Arrays.asList(DRIVER_A7XX, DRIVER_A8XX));
|
||||
/** Overrides the pick, for a device we cannot reach: a7xx, a8xx or system. */
|
||||
private static final String OVERRIDE_FILE = "Download/steamdeck-driver";
|
||||
/** Stored choice meaning "pick by GPU" — the default, and what a removed import falls back to. */
|
||||
/** Stored choice meaning "pick by GPU" - the default, and what a removed import falls back to. */
|
||||
public static final String AUTO = "";
|
||||
|
||||
public static final String HELP_TEXT =
|
||||
"The driver the app's compositor puts frames on the screen with — the last step of every "
|
||||
"The driver the app's compositor puts frames on the screen with - the last step of every "
|
||||
+ "session, Steam or desktop. AdrenoTools zips only (vulkan.adXXXX.so): a \"-Linux\" Turnip "
|
||||
+ "belongs in the Linux runtime list above and is refused here. The compositor loads its "
|
||||
+ "driver once per app process, so a change takes effect after the app is fully closed and "
|
||||
@@ -70,7 +70,7 @@ public final class TurnipDriver {
|
||||
this.contentDir = new File(context.getFilesDir(), "graphics_driver");
|
||||
}
|
||||
|
||||
/** Absolute directory holding the driver, with a trailing slash — adrenotools wants both. */
|
||||
/** Absolute directory holding the driver, with a trailing slash - adrenotools wants both. */
|
||||
public String driverPath(String driverId) {
|
||||
return new File(contentDir, driverId).getAbsolutePath() + "/";
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public final class TurnipDriver {
|
||||
return library != null && !library.isEmpty() && new File(new File(contentDir, driverId), library).isFile();
|
||||
}
|
||||
|
||||
/** Imported drivers only — the bundled two are listed by {@link #BUNDLED}. */
|
||||
/** Imported drivers only - the bundled two are listed by {@link #BUNDLED}. */
|
||||
public List<String> enumerateImported() {
|
||||
ArrayList<String> ids = new ArrayList<>();
|
||||
File[] dirs = contentDir.listFiles();
|
||||
@@ -141,7 +141,7 @@ public final class TurnipDriver {
|
||||
/**
|
||||
* Import an AdrenoTools zip. Returns the new driver id.
|
||||
* @throws IllegalArgumentException with a user-facing reason when the zip is not an AdrenoTools
|
||||
* driver — including when it is a Linux runtime driver, which says which list it belongs in;
|
||||
* driver - including when it is a Linux runtime driver, which says which list it belongs in;
|
||||
* {@link IOException} on read/extract failures.
|
||||
*/
|
||||
public String installFromZip(Uri zipUri, String displayName) throws IOException {
|
||||
@@ -220,7 +220,7 @@ public final class TurnipDriver {
|
||||
return libraryName + " is not a 64-bit AArch64 ELF shared library";
|
||||
// A glibc build that happens to carry a libraryName would load nothing in this process.
|
||||
if (LinuxVulkanDriverManager.containsAscii(library, "libc.so.6"))
|
||||
return libraryName + " links glibc — a \"-Linux\" Turnip, which belongs under \"Linux runtime driver\"";
|
||||
return libraryName + " links glibc - a \"-Linux\" Turnip, which belongs under \"Linux runtime driver\"";
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ public final class TurnipDriver {
|
||||
}
|
||||
|
||||
/**
|
||||
* The user's choice first — an imported driver, or one of the bundled two pinned by hand —
|
||||
* The user's choice first - an imported driver, or one of the bundled two pinned by hand -
|
||||
* then the Downloads override, then the GPU. A chosen import that has since been removed logs
|
||||
* and falls through, so a stale preference never blocks a session.
|
||||
*/
|
||||
@@ -291,7 +291,7 @@ public final class TurnipDriver {
|
||||
String model = gpuModel();
|
||||
Log.i(TAG, "gpu model: " + (model == null ? "unknown" : model));
|
||||
if (model != null) {
|
||||
// "Adreno750", "adreno_830" — the generation is the first digit of the three.
|
||||
// "Adreno750", "adreno_830" - the generation is the first digit of the three.
|
||||
java.util.regex.Matcher m = java.util.regex.Pattern.compile("(\\d)\\d\\d").matcher(model);
|
||||
if (m.find()) {
|
||||
char generation = m.group(1).charAt(0);
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.nio.channels.FileChannel;
|
||||
* snapshot is published alongside under a seqlock so the native reader can replay
|
||||
* a full keyframe to heal any desync (open, ring overflow) without duplicate
|
||||
* input. Ring layout (magic/version/offsets) is a paired ABI with the native
|
||||
* {@code FakeInputRingHeader} — keep the two in lockstep.
|
||||
* {@code FakeInputRingHeader} - keep the two in lockstep.
|
||||
*/
|
||||
public class FakeInputWriter {
|
||||
private static final String TAG = "FakeInputWriter";
|
||||
@@ -73,7 +73,7 @@ public class FakeInputWriter {
|
||||
private static final int BUFFER_SIZE = EVENT_SIZE * MAX_EVENTS_PER_UPDATE;
|
||||
private static final int MAX_FAKE_INPUT_SLOTS = 4;
|
||||
|
||||
// Ring layout — MUST match FakeInputRingHeader in fakeinput.cpp.
|
||||
// Ring layout - MUST match FakeInputRingHeader in fakeinput.cpp.
|
||||
private static final int RING_CAPACITY_EVENTS = 4096;
|
||||
private static final int RING_HEADER_SIZE = 64;
|
||||
private static final int RING_SIZE = RING_HEADER_SIZE + (RING_CAPACITY_EVENTS * EVENT_SIZE);
|
||||
|
||||
@@ -69,9 +69,9 @@ class OnScreenControls(context: Context, private val pad: PadBridge) : View(cont
|
||||
|
||||
private val controls = listOf(
|
||||
Control("up", "▲", -1, 0, -1, dp(26f)),
|
||||
Control("right", "▶", -1, 1, -1, dp(26f)),
|
||||
Control("right", ">", -1, 1, -1, dp(26f)),
|
||||
Control("down", "▼", -1, 2, -1, dp(26f)),
|
||||
Control("left", "◀", -1, 3, -1, dp(26f)),
|
||||
Control("left", "<", -1, 3, -1, dp(26f)),
|
||||
Control("ls", "L", -1, -1, 0, dp(48f)),
|
||||
Control("rs", "R", -1, -1, 1, dp(48f)),
|
||||
Control("a", "A", 0, -1, -1, dp(30f)),
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class PadBridge {
|
||||
/** True when the device this event came from is a gamepad or joystick, not the touchscreen. */
|
||||
public static boolean isFromController(InputDevice device) {
|
||||
if (device == null) return false;
|
||||
// A virtual device is the system's own synthetic input, not a pad somebody is holding —
|
||||
// A virtual device is the system's own synthetic input, not a pad somebody is holding -
|
||||
// counting it would hide the on-screen controls with nothing to replace them.
|
||||
if (device.isVirtual()) return false;
|
||||
int sources = device.getSources();
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlin.math.roundToInt
|
||||
* - two fingers up / down .......... scroll wheel
|
||||
*
|
||||
* The listener gets pointer positions in the view's pixels; the activity maps them onto the
|
||||
* compositor. Mouse events are not handled here — a mouse has real buttons.
|
||||
* compositor. Mouse events are not handled here - a mouse has real buttons.
|
||||
*/
|
||||
class PointerGestures(
|
||||
private val slopPx: Float,
|
||||
|
||||
@@ -8,8 +8,8 @@ import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* The hosted packages that go into the runtime on request — the desktop, the emulators, and the
|
||||
* builds we mirror or make ourselves — described by desktop.json beside the runtime's own catalog.
|
||||
* The hosted packages that go into the runtime on request - the desktop, the emulators, and the
|
||||
* builds we mirror or make ourselves - described by desktop.json beside the runtime's own catalog.
|
||||
*
|
||||
* Two kinds. A `tar` extracts over the rootfs like the runtime itself (the same extractor, links
|
||||
* and modes preserved). An `appimage` is one file dropped in /opt/appimages with a .desktop entry
|
||||
@@ -68,7 +68,7 @@ object DesktopCatalog {
|
||||
if (entry.sha256.isNotEmpty()) {
|
||||
listener?.onProgress("Verifying", -1)
|
||||
val actual = LinuxRuntimeInstaller.sha256(download)
|
||||
if (!entry.sha256.equals(actual, ignoreCase = true)) return "Checksum mismatch — nothing was changed"
|
||||
if (!entry.sha256.equals(actual, ignoreCase = true)) return "Checksum mismatch - nothing was changed"
|
||||
}
|
||||
listener?.onProgress("Installing ${entry.name}", -1)
|
||||
when (entry.kind) {
|
||||
|
||||
@@ -73,7 +73,7 @@ class LinuxNetworkLinkComponent(
|
||||
|
||||
/**
|
||||
* The guest's resolver, from the network it is actually on. glibc reads /etc/resolv.conf,
|
||||
* and the image ships two public servers there, which is why Steam resolves at all — but a
|
||||
* and the image ships two public servers there, which is why Steam resolves at all - but a
|
||||
* captive portal, a private-DNS network or a v6-only carrier wants the network's own
|
||||
* servers. Those come first, IPv4 before IPv6 and never a link-local one (Android lists
|
||||
* fe80:: resolvers a guest cannot reach; handing Bannerlator's Wine guests exactly that was
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
* The glibc arm64 rootfs at {@code files/linuxfs} and the proot invocation that runs a program in
|
||||
* it as this app's own uid. It is a second runtime beside the Wine imagefs, not a container: no
|
||||
* Wine, no box64, no FEX. proot is packaged as {@code libproot.so} so the installer places it, with
|
||||
* its loader, in the native library directory — the only place an app on targetSdk 28 may execute
|
||||
* its loader, in the native library directory - the only place an app on targetSdk 28 may execute
|
||||
* a file from.
|
||||
*
|
||||
* <p>Ported from WinNative's gamescope runtime (GPL-3.0).
|
||||
@@ -61,7 +61,7 @@ public final class LinuxRuntime {
|
||||
/**
|
||||
* proot, preferred from the installed runtime and falling back to the copy in the apk.
|
||||
*
|
||||
* <p>It is an Android binary rather than part of the rootfs — it is what creates the rootfs —
|
||||
* <p>It is an Android binary rather than part of the rootfs - it is what creates the rootfs -
|
||||
* but it travels in the runtime tarball so that reinstalling the app cannot replace the one
|
||||
* binary everything else depends on, and so a device with no working packaged proot can still
|
||||
* run the runtime.
|
||||
@@ -106,8 +106,8 @@ public final class LinuxRuntime {
|
||||
|
||||
/**
|
||||
* The proot command line running {@code guestCommand} inside the rootfs. Host paths the session
|
||||
* needs — the app's files directory for the compositor and audio sockets, external storage for
|
||||
* the user's games — are bound at their own paths, so nothing on either side needs translating
|
||||
* needs - the app's files directory for the compositor and audio sockets, external storage for
|
||||
* the user's games - are bound at their own paths, so nothing on either side needs translating
|
||||
* and proot never touches the fds a dma-buf travels in. Android has no /dev/shm; a directory
|
||||
* under the cache stands in, which glibc's shm_open and Chromium's shared memory accept.
|
||||
*/
|
||||
@@ -116,7 +116,7 @@ public final class LinuxRuntime {
|
||||
return command(context, sessionRoot, runtimeDir, externalStorage, null, guestCommand);
|
||||
}
|
||||
|
||||
/** As above, plus {@code host:guest} bind specs — the installed games handed to Steam. */
|
||||
/** As above, plus {@code host:guest} bind specs - the installed games handed to Steam. */
|
||||
public static List<String> command(Context context, File sessionRoot, File runtimeDir,
|
||||
File externalStorage, List<String> extraBinds,
|
||||
List<String> guestCommand) {
|
||||
@@ -205,8 +205,8 @@ public final class LinuxRuntime {
|
||||
}
|
||||
|
||||
/**
|
||||
* An app process may not open {@code /dev/dri} — the nodes exist but are labelled
|
||||
* {@code graphics_device}, which stock policy grants surfaceflinger and not us — yet libdrm and
|
||||
* An app process may not open {@code /dev/dri} - the nodes exist but are labelled
|
||||
* {@code graphics_device}, which stock policy grants surfaceflinger and not us - yet libdrm and
|
||||
* everything built on it identify a GPU by its render node, and gamescope refuses to offer
|
||||
* linux-dmabuf without one. The KGSL device Turnip actually drives ({@code gpu_device}, which we
|
||||
* may open) stands in: it appears as a render node with the sysfs entries libdrm reads, and our
|
||||
|
||||
@@ -8,8 +8,8 @@ import java.io.File
|
||||
/**
|
||||
* Starting the Steam client signed out of Valve's servers.
|
||||
*
|
||||
* The client can run without a connection — installed games launch, Proton and the frame-gen are
|
||||
* all local — but only if it has credentials from an earlier successful sign-in. Two keys in
|
||||
* The client can run without a connection - installed games launch, Proton and the frame-gen are
|
||||
* all local - but only if it has credentials from an earlier successful sign-in. Two keys in
|
||||
* loginusers.vdf decide what it does when it cannot reach a CM: WantsOfflineMode makes it go
|
||||
* offline on its own, SkipOfflineModeWarning stops it asking first. Both are read once, while the
|
||||
* client starts, which is why this belongs to the main screen and not to the in-session drawer:
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.concurrent.Executors
|
||||
* ADPF (Android 12+): a PerformanceHintManager session over the compositor thread, told the
|
||||
* panel's frame period as its target and each presented frame's interval as the actual. When a
|
||||
* frame runs long the power HAL raises CPU clocks for the next one at once, instead of the
|
||||
* governor waiting for the load average to climb — the difference between a menu that stutters
|
||||
* governor waiting for the load average to climb - the difference between a menu that stutters
|
||||
* on the first scroll and one that does not.
|
||||
*
|
||||
* The session may only carry this process's threads, so the guest (gamescope, the Steam client
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
/**
|
||||
* The numbers behind the top-right line: the game's own frame rate and, when frame generation
|
||||
* is on, what the screen is actually being shown — "60 → 118 fps" is the proof that the engine
|
||||
* is on, what the screen is actually being shown - "60 → 118 fps" is the proof that the engine
|
||||
* is doing something, and "FG starting" or a reason is the proof that it is not.
|
||||
*
|
||||
* The base rate is counted here from the compositor's per-frame callback, so it is right with or
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.steamdeck.launcher.runtime.LinuxRuntime
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Third-party Proton builds for the client — GE-Proton and proton-cachyos, both published as
|
||||
* Third-party Proton builds for the client - GE-Proton and proton-cachyos, both published as
|
||||
* native ARM64 tarballs. The runtime's own registrar (bannerlator-proton-extra) downloads and
|
||||
* installs one into the client's compatibilitytools.d and patches it past pressure-vessel; this
|
||||
* side only leaves it the request, one line in ~/.bl-proton-extra, which the session script reads
|
||||
|
||||
@@ -7,14 +7,14 @@ import android.widget.Toast
|
||||
|
||||
/**
|
||||
* Other apps on the device that sign into the user's Steam account with their own client. Steam
|
||||
* allows one session per account: the moment one of them signs in, ours is signed out — which
|
||||
* allows one session per account: the moment one of them signs in, ours is signed out - which
|
||||
* shows up as "Session Replaced" in the client's log 2-3 seconds after every login, and looks
|
||||
* like a bug in this app.
|
||||
*
|
||||
* Installed is the most a normal app can know (since Android 7 `getRunningAppProcesses()` returns
|
||||
* only the caller's own), so the list is checked for presence and then asked to stop.
|
||||
* `killBackgroundProcesses` is a normal permission: it ends an app's background processes and
|
||||
* leaves anything in the foreground alone — and background is exactly the case that keeps
|
||||
* leaves anything in the foreground alone - and background is exactly the case that keeps
|
||||
* happening, because GameHub declares boot receivers and is running from the moment the phone
|
||||
* starts without ever having been opened. Telling someone to close an app they never opened is
|
||||
* not much help. Ported from Bannerlator's Linux session (GPL-3.0).
|
||||
@@ -56,8 +56,8 @@ object RivalClients {
|
||||
}
|
||||
Toast.makeText(
|
||||
context,
|
||||
if (asked) "Closed $who in the background — it signs into your Steam account."
|
||||
else "If $who is open, close it first — it signs into your Steam account and will sign this client out.",
|
||||
if (asked) "Closed $who in the background - it signs into your Steam account."
|
||||
else "If $who is open, close it first - it signs into your Steam account and will sign this client out.",
|
||||
Toast.LENGTH_LONG,
|
||||
).show()
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ object SessionFiles {
|
||||
}
|
||||
|
||||
/**
|
||||
* Where the session writes its log. Downloads is the point — a failed run is handed over as a
|
||||
* folder rather than dug out of app-private storage — but the session script redirects its own
|
||||
* Where the session writes its log. Downloads is the point - a failed run is handed over as a
|
||||
* folder rather than dug out of app-private storage - but the session script redirects its own
|
||||
* output there with `exec`, and a redirection a non-interactive shell cannot open ends that
|
||||
* shell. So a public directory is used only once it is proven writable; otherwise the app's
|
||||
* own files directory, which is bound into the session anyway, stands in.
|
||||
|
||||
@@ -42,7 +42,7 @@ import java.util.Locale
|
||||
* keep all three alive while the app is not on screen.
|
||||
*
|
||||
* The session deliberately does **not** belong to the activity. Android demotes a process the
|
||||
* moment it loses its last visible activity, and the low-memory killer then reaps the guest — so
|
||||
* moment it loses its last visible activity, and the low-memory killer then reaps the guest - so
|
||||
* leaving Big Picture to answer a message would come back to a dead Steam. A foreground service
|
||||
* holds the process at perceptible priority, a partial wake lock keeps the CPU from dropping the
|
||||
* guest's threads, and a high-performance WiFi lock keeps the radio out of power-save so a
|
||||
@@ -305,8 +305,8 @@ class SessionService : Service() {
|
||||
SessionState.fakeInputDir = fakeInputDir
|
||||
}
|
||||
// The desktop is wlroots (labwc), and wlroots allocates its buffers through gbm on a real
|
||||
// DRM render node. Ours is a KGSL stand-in that gbm cannot use — labwc dies at "unable to
|
||||
// create allocator" — so the desktop shell is composited by pixman (software, a shm
|
||||
// DRM render node. Ours is a KGSL stand-in that gbm cannot use - labwc dies at "unable to
|
||||
// create allocator" - so the desktop shell is composited by pixman (software, a shm
|
||||
// allocator, no DRM). Accelerated clients on it pay a CPU copy; a 2D emulator does not
|
||||
// notice, a demanding one does. steamdeck-wlr-renderer in Downloads (pixman/vulkan/gles2)
|
||||
// overrides it, for trying acceleration on a device that has a real node.
|
||||
@@ -561,7 +561,7 @@ class SessionService : Service() {
|
||||
// seccomp-trapped syscall then failed with ENOSYS, they spun on retries at a full core
|
||||
// for over an hour, and the reaper could not even open /proc to kill them. So: SIGTERM,
|
||||
// a grace for proot's own cleanup, SIGKILL only if it will not go, then a sweep of the
|
||||
// tree it had — snapshotted first, each pid checked against its start time so a number
|
||||
// tree it had - snapshotted first, each pid checked against its start time so a number
|
||||
// reused by a new process is never touched. Same shape as Bannerlator's fix (4509d788).
|
||||
if (sessionPid != -1) {
|
||||
val prootPid = sessionPid
|
||||
@@ -595,7 +595,7 @@ class SessionService : Service() {
|
||||
* guest would survive as an orphan holding the rootfs and the GPU. Treat the swipe as "quit".
|
||||
*/
|
||||
override fun onTaskRemoved(rootIntent: Intent?) {
|
||||
Log.i(TAG, "task removed — ending the session")
|
||||
Log.i(TAG, "task removed - ending the session")
|
||||
stopSession(0)
|
||||
super.onTaskRemoved(rootIntent)
|
||||
}
|
||||
@@ -620,7 +620,7 @@ class SessionService : Service() {
|
||||
}
|
||||
Log.i(TAG, "wake lock held=${wakeLock?.isHeld}")
|
||||
} catch (t: Throwable) {
|
||||
Log.w(TAG, "no wake lock (${t.message}) — the session may be killed in the background")
|
||||
Log.w(TAG, "no wake lock (${t.message}) - the session may be killed in the background")
|
||||
}
|
||||
try {
|
||||
val wifi = applicationContext.getSystemService(Context.WIFI_SERVICE) as? WifiManager
|
||||
@@ -634,7 +634,7 @@ class SessionService : Service() {
|
||||
} catch (t: Throwable) {
|
||||
// A partial wake lock keeps the process alive but does not stop WiFi power-save from
|
||||
// throttling a backgrounded download to nothing, which is what this lock is for.
|
||||
Log.w(TAG, "no wifi lock (${t.message}) — a backgrounded download may stall")
|
||||
Log.w(TAG, "no wifi lock (${t.message}) - a backgrounded download may stall")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
|
||||
/**
|
||||
* The pointer, drawn by the app. The nested desktop asks its parent compositor to show a cursor
|
||||
* and ours does not, and the Steam session has none either; this is the arrow for both, at the
|
||||
* position the app last sent. Takes no touches.
|
||||
*/
|
||||
@Composable
|
||||
fun CursorOverlay(position: Offset, visible: Boolean, scale: Float) {
|
||||
if (!visible) return
|
||||
|
||||
@@ -19,19 +19,12 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/** One hosted package as the dialog shows it. */
|
||||
class PackageRow(
|
||||
val id: String, val name: String, val tier: Int, val version: String, val size: String,
|
||||
val notes: String, val installed: String?,
|
||||
/** What the package can launch on its own under gamescope: label to path inside the runtime. */
|
||||
val launchers: List<Pair<String, String>> = emptyList(),
|
||||
)
|
||||
|
||||
/**
|
||||
* The desktop and everything that goes on it, installed into the runtime on request. Tier 1 is
|
||||
* packaged natively for this hardware; tier 2 is an upstream ARM64 build we mirror and expect
|
||||
* little of on a phone; tier 3 is built by us from source.
|
||||
*/
|
||||
@Composable
|
||||
fun DesktopAppsDialog(
|
||||
rows: List<PackageRow>?,
|
||||
@@ -39,7 +32,6 @@ fun DesktopAppsDialog(
|
||||
busyPercent: Int,
|
||||
onInstall: (String) -> Unit,
|
||||
onRemove: (String) -> Unit,
|
||||
/** Start [path] as its own session under gamescope. */
|
||||
onLaunch: (path: String) -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
@@ -58,7 +50,7 @@ fun DesktopAppsDialog(
|
||||
rows == null -> Text("Could not reach the package catalog", color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
rows.isEmpty() -> Text("Loading the catalog…", color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
else -> Text(
|
||||
"▶ starts an emulator fullscreen under gamescope, with the GPU — on the desktop, Vulkan programs cannot draw. " +
|
||||
" starts an emulator fullscreen under gamescope, with the GPU - on the desktop, Vulkan programs cannot draw. " +
|
||||
"ROMs are at /root/ROMs, the phone at /root/Storage.",
|
||||
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
@@ -70,8 +62,8 @@ fun DesktopAppsDialog(
|
||||
Text(
|
||||
when (row.tier) {
|
||||
1 -> "Native for this hardware"
|
||||
2 -> "Upstream ARM64 builds — experimental on a phone"
|
||||
else -> "Built from source — experimental"
|
||||
2 -> "Upstream ARM64 builds - experimental on a phone"
|
||||
else -> "Built from source - experimental"
|
||||
},
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
@@ -83,7 +75,7 @@ fun DesktopAppsDialog(
|
||||
Text(row.name, style = MaterialTheme.typography.bodyMedium)
|
||||
Text(
|
||||
(if (row.installed != null) "installed ${row.installed}" else "${row.version} · ${row.size}") +
|
||||
(if (row.notes.isNotEmpty()) " — ${row.notes}" else ""),
|
||||
(if (row.notes.isNotEmpty()) " - ${row.notes}" else ""),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
@@ -91,14 +83,11 @@ fun DesktopAppsDialog(
|
||||
if (row.installed != null) TextButton(enabled = busyStage == null, onClick = { onRemove(row.id) }) { Text("Remove") }
|
||||
else TextButton(enabled = busyStage == null, onClick = { onInstall(row.id) }) { Text("Install") }
|
||||
}
|
||||
// An emulator starts as a session of its own, fullscreen under gamescope: that
|
||||
// is where the GPU is. On the desktop (software-composited) a Vulkan program
|
||||
// has no swapchain to draw into and dies at its first frame.
|
||||
if (row.installed != null && row.launchers.isNotEmpty()) {
|
||||
Row(modifier = Modifier.fillMaxWidth().padding(start = 12.dp, bottom = 2.dp)) {
|
||||
for ((label, path) in row.launchers) {
|
||||
TextButton(enabled = busyStage == null, onClick = { onLaunch(path) }) {
|
||||
Text("▶ $label", style = MaterialTheme.typography.labelMedium)
|
||||
Text(" $label", style = MaterialTheme.typography.labelMedium)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,6 @@ import com.steamdeck.launcher.gpu.FrameGen
|
||||
import java.io.File
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/** Everything the front end shows; the activity owns the values and the work behind them. */
|
||||
class FrontEndState(
|
||||
val installed: String?,
|
||||
val ready: Boolean,
|
||||
@@ -127,14 +126,11 @@ class FrontEndState(
|
||||
val logsEnabled: Boolean,
|
||||
val steamGames: List<Library.SteamGame>,
|
||||
val emulators: List<Library.Emulator>,
|
||||
/** A session alive in the background: what it is, or null. */
|
||||
val running: String?,
|
||||
val frameGenEngine: String = FrameGen.ENGINE_OFF,
|
||||
val frameGenMultiplier: Int = 2,
|
||||
val lsfgReady: Boolean = false,
|
||||
/** A page shown in the pane instead of the selection ("settings:steam", "settings:lxqt", "performance"), or null. */
|
||||
val pageKey: String? = null,
|
||||
/** The colour theme in use (ui/Themes ids). */
|
||||
val theme: String = Themes.PAPER,
|
||||
)
|
||||
|
||||
@@ -159,18 +155,11 @@ class FrontEndActions(
|
||||
val onOffline: () -> Unit,
|
||||
val onEmulatorHelp: () -> Unit,
|
||||
val onCredits: () -> Unit,
|
||||
/** Leaves the page in the pane (back key, the rail, or the page's own Back). */
|
||||
val onPageBack: () -> Unit = {},
|
||||
val onTheme: (String) -> Unit = {},
|
||||
)
|
||||
|
||||
// ───────────────────────────── Motion ─────────────────────────────
|
||||
|
||||
/**
|
||||
* One place for every duration and spring on this screen. The durations honour the system
|
||||
* animator scale, so a device set to "no animations" in developer options collapses them to
|
||||
* an instant snap instead of ignoring the user's choice.
|
||||
*/
|
||||
internal object Motion {
|
||||
var scale = 1f
|
||||
val Ease = CubicBezierEasing(0.2f, 0.8f, 0.2f, 1f)
|
||||
@@ -183,15 +172,10 @@ internal object Motion {
|
||||
private val Shape10 = RoundedCornerShape(10.dp)
|
||||
private val Shape12 = RoundedCornerShape(12.dp)
|
||||
|
||||
/** A colour for a thing that has no art: stable per name, so it does not change between visits. */
|
||||
private fun hueOf(name: String) = (name.hashCode().toUInt() % 360u).toFloat()
|
||||
private fun tint(h: Float, s: Float = 0.7f, v: Float = 0.58f) = Color.hsv(h, s, v)
|
||||
private fun artBrush(h: Float) = Brush.linearGradient(listOf(tint(h), tint((h + 32f) % 360f, 0.65f, 0.30f), tint((h + 64f) % 360f, 0.6f, 0.14f)))
|
||||
|
||||
/**
|
||||
* A row that rises into place: the i-th row of a page starts 60 ms after the one before it, so
|
||||
* a page change reads as one cascade rather than a cut.
|
||||
*/
|
||||
@Composable
|
||||
internal fun Rise(i: Int, modifier: Modifier = Modifier, content: @Composable () -> Unit) {
|
||||
val state = remember { MutableTransitionState(false) }.apply { targetState = true }
|
||||
@@ -203,7 +187,6 @@ internal fun Rise(i: Int, modifier: Modifier = Modifier, content: @Composable ()
|
||||
) { content() }
|
||||
}
|
||||
|
||||
/** Alpha + lift on first composition, delayed by the item's index: sub-list children stagger in. */
|
||||
@Composable
|
||||
private fun Modifier.staggerIn(i: Int): Modifier {
|
||||
val t = remember { Animatable(0f) }
|
||||
@@ -211,7 +194,6 @@ private fun Modifier.staggerIn(i: Int): Modifier {
|
||||
return graphicsLayer { alpha = t.value; translationY = (1f - t.value) * 10.dp.toPx() }
|
||||
}
|
||||
|
||||
/** A diagonal band of light that sweeps across the content once, whenever [trigger] turns on. */
|
||||
@Composable
|
||||
private fun Modifier.shine(trigger: Boolean, strength: Float = 0.22f): Modifier {
|
||||
val x = remember { Animatable(-1f) }
|
||||
@@ -232,20 +214,10 @@ private fun Modifier.shine(trigger: Boolean, strength: Float = 0.22f): Modifier
|
||||
}
|
||||
}
|
||||
|
||||
// ───────────────────────────── Screen ─────────────────────────────
|
||||
|
||||
/**
|
||||
* The front end: a rail of what can be launched - Steam and its games, the desktop and its
|
||||
* emulators and their games - and the chosen thing on the right with its launch button. A
|
||||
* session running in the background is the first thing on the rail, and tapping it goes back
|
||||
* to it. Landscape puts the rail beside the content; a narrow screen puts it above.
|
||||
*/
|
||||
@Composable
|
||||
fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -> Unit)? = null) {
|
||||
var selected by rememberSaveable { mutableStateOf("steam") }
|
||||
// Every category starts folded when the app opens: three headers and their counts, and the
|
||||
// rail unfolds only what the user reaches for. (rememberSaveable keeps a fold across a
|
||||
// rotation, not across launches, which is the point.)
|
||||
var openDesktop by rememberSaveable { mutableStateOf(false) }
|
||||
var openSteam by rememberSaveable { mutableStateOf(false) }
|
||||
var openEmu by rememberSaveable { mutableStateOf("") }
|
||||
@@ -278,7 +250,6 @@ fun FrontEndScreen(s: FrontEndState, a: FrontEndActions, page: (@Composable () -
|
||||
}
|
||||
}
|
||||
|
||||
// ───────────────────────────── Rail ─────────────────────────────
|
||||
|
||||
@Composable
|
||||
private fun Rail(
|
||||
@@ -311,7 +282,6 @@ private fun Rail(
|
||||
LinearProgressIndicator(modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp))
|
||||
}
|
||||
|
||||
// A session in the background: the way back to it, first.
|
||||
var lastRunning by remember { mutableStateOf("") }
|
||||
if (s.running != null) lastRunning = s.running
|
||||
AnimatedVisibility(
|
||||
@@ -320,7 +290,6 @@ private fun Rail(
|
||||
exit = shrinkVertically(Motion.tw(220)) + fadeOut(Motion.tw(180)),
|
||||
) { RunningTile(lastRunning, a.onResume) }
|
||||
|
||||
// The rail's selection is one pill that glides between rows; the rows only recolour.
|
||||
val pal = LocalPalette.current
|
||||
var navOrigin by remember { mutableStateOf(Offset.Zero) }
|
||||
val positions = remember { mutableStateMapOf<String, Rect>() }
|
||||
@@ -370,8 +339,6 @@ private fun Rail(
|
||||
NavItem("Settings", "settings:lxqt", selected == "settings:lxqt", small = true, tiny = true, muted = true, i = s.emulators.count { it.installed }, register = register, unregister = unregister) { a.onDesktopSettings() }
|
||||
}
|
||||
Spacer(Modifier.height(6.dp))
|
||||
// Setup: the same fold as Steam and Desktop. A row that holds a value opens a small menu
|
||||
// in place; a row that opens a page lights up while the page is shown.
|
||||
val menus = remember { MenuHost() }
|
||||
val item: @Composable (String, String?, Int, String?, () -> Unit) -> Unit = { label, value, i, key, act ->
|
||||
NavItem(label, key ?: "x", key != null && selected == key, small = true, tiny = true, muted = true, value = value, i = i, register = register, unregister = unregister) { act() }
|
||||
@@ -385,7 +352,6 @@ private fun Rail(
|
||||
item("Frame generation", s.frameGenLabel, 3, null) { menus.open = "fg" }
|
||||
AnchoredMenu(
|
||||
menus.open == "fg", onDismiss = { if (menus.open == "fg") menus.open = null }, title = "Frame generation",
|
||||
note = "Extra frames between the real ones on the way to the screen, so 30 fps looks like 60. Takes effect at once, mid-game included.",
|
||||
) {
|
||||
val need = if (s.lsfgReady) null else "install Lossless Scaling in Steam"
|
||||
MenuItem("Off", checked = s.frameGenEngine == FrameGen.ENGINE_OFF) { a.onFrameGenPick(FrameGen.ENGINE_OFF, 2); menus.open = null }
|
||||
@@ -399,7 +365,6 @@ private fun Rail(
|
||||
item("Session logs", if (s.logsEnabled) "on" else "off", 6, null) { menus.open = "logs" }
|
||||
AnchoredMenu(
|
||||
menus.open == "logs", onDismiss = { if (menus.open == "logs") menus.open = null }, title = "Session logs",
|
||||
note = "Each session leaves a folder in Downloads: the guest log, the device and network reports, the app's own log.",
|
||||
) {
|
||||
MenuItem("On", checked = s.logsEnabled) { if (!s.logsEnabled) a.onLogs(); menus.open = null }
|
||||
MenuItem("Off", checked = !s.logsEnabled) { if (s.logsEnabled) a.onLogs(); menus.open = null }
|
||||
@@ -409,7 +374,6 @@ private fun Rail(
|
||||
item("Start offline", when { s.offlineAccount == null -> "sign in first"; s.offline -> "on"; else -> "off" }, 7, null) { if (s.offlineAccount != null) menus.open = "offline" }
|
||||
AnchoredMenu(
|
||||
menus.open == "offline", onDismiss = { if (menus.open == "offline") menus.open = null }, title = "Start offline",
|
||||
note = "The client starts as ${s.offlineAccount ?: "the saved account"} without the network: the library and installed games, no store.",
|
||||
) {
|
||||
MenuItem("On", checked = s.offline) { if (!s.offline) a.onOffline(); menus.open = null }
|
||||
MenuItem("Off", checked = !s.offline) { if (s.offline) a.onOffline(); menus.open = null }
|
||||
@@ -423,8 +387,8 @@ private fun Rail(
|
||||
}, 8, null, a.onRuntime)
|
||||
Box {
|
||||
item("Theme", Themes.byId(s.theme).label, 9, null) { menus.open = "theme" }
|
||||
AnchoredMenu(menus.open == "theme", onDismiss = { if (menus.open == "theme") menus.open = null }, title = "Theme", note = "The icon's three colours, dealt out three ways. Applies at once.") {
|
||||
for (t in Themes.all) MenuItem(t.label, checked = s.theme == t.id, detail = t.detail) { a.onTheme(t.id); menus.open = null }
|
||||
AnchoredMenu(menus.open == "theme", onDismiss = { if (menus.open == "theme") menus.open = null }, title = "Theme") {
|
||||
for (t in Themes.all) MenuItem(t.label, checked = s.theme == t.id) { a.onTheme(t.id); menus.open = null }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -469,7 +433,6 @@ private fun RunningTile(name: String, onResume: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
/** A sub-list that unfolds; its children stagger in through [NavItem]'s index. */
|
||||
@Composable
|
||||
private fun Sub(open: Boolean, content: @Composable () -> Unit) {
|
||||
val line = LocalPalette.current.line
|
||||
@@ -517,7 +480,7 @@ private fun NavItem(
|
||||
.padding(horizontal = 10.dp, vertical = if (small) 7.dp else 9.dp),
|
||||
) {
|
||||
if (caret != null) {
|
||||
Text("▶", fontSize = 9.sp, color = sub, modifier = Modifier.width(14.dp).rotate(rot))
|
||||
Text("›", fontSize = 16.sp, color = sub, modifier = Modifier.width(14.dp).rotate(rot))
|
||||
}
|
||||
Text(
|
||||
label, fontSize = if (tiny) 13.sp else if (small) 14.sp else 15.sp,
|
||||
@@ -532,9 +495,7 @@ private fun NavItem(
|
||||
}
|
||||
}
|
||||
|
||||
// ───────────────────────────── Pane ─────────────────────────────
|
||||
|
||||
/** The chosen thing, behind a blurred wash of its own colour; a change sinks the old page out and cascades the new one in. */
|
||||
@Composable
|
||||
private fun Pane(s: FrontEndState, selected: String, a: FrontEndActions, page: (@Composable () -> Unit)?, modifier: Modifier) {
|
||||
Box(modifier = modifier) {
|
||||
@@ -591,8 +552,6 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
|
||||
when {
|
||||
selected == "steam" -> {
|
||||
Rise(0) { Eyebrow("Steam") }
|
||||
Rise(1) { Title("Valve's native client, under gamescope") }
|
||||
Rise(2) { Lede("Big Picture with a controller, or the client's desktop UI. Installed games launch straight from the rail or the shelf below.") }
|
||||
Rise(3) {
|
||||
Actions {
|
||||
PrimaryButton("Play", enabled = s.ready && !s.busy, onClick = a.onPlay)
|
||||
@@ -601,7 +560,7 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
|
||||
}
|
||||
}
|
||||
Rise(4) { SectionTitle("Installed", "${s.steamGames.size} game${if (s.steamGames.size == 1) "" else "s"}") }
|
||||
if (s.steamGames.isEmpty()) Rise(5) { Note("Nothing installed yet. Press Play, sign in, and install from the store; games appear here and on the left.") }
|
||||
if (s.steamGames.isEmpty()) Rise(5) { Note("No games installed.") }
|
||||
else Rise(5, Modifier.weight(1f).fillMaxWidth()) { ArtGrid(s.steamGames.map { g -> Tile(g.name, g.library, g.art, "steam:${g.appId}", null) { a.onSteamGame(g) } }) }
|
||||
}
|
||||
selected.startsWith("app:") -> {
|
||||
@@ -612,7 +571,6 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
|
||||
Rise(2) {
|
||||
Row {
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Lede("Starts the Steam session and launches the game straight away (steam://rungameid/${g.appId}).")
|
||||
Actions {
|
||||
PrimaryButton("Launch", enabled = s.ready && !s.busy) { a.onSteamGame(g) }
|
||||
Cog(a.onSteamSettings)
|
||||
@@ -631,8 +589,6 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
|
||||
}
|
||||
selected == "desktop" -> {
|
||||
Rise(0) { Eyebrow("Desktop") }
|
||||
Rise(1) { Title("Linux desktop environment") }
|
||||
Rise(2) { Lede("Files, Firefox and the emulators' own windows. Emulators and their games launch from the rail, under gamescope, where the GPU is.") }
|
||||
Rise(3) {
|
||||
Actions {
|
||||
PrimaryButton(if (s.desktopInstalled) "Desktop" else "Install the desktop first", enabled = s.ready && !s.busy && s.desktopInstalled, onClick = a.onDesktop)
|
||||
@@ -642,7 +598,7 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
|
||||
}
|
||||
Rise(4) { SectionTitle("Emulators", "${s.emulators.count { it.installed }} installed · ${s.emulators.count { !it.installed }} available") }
|
||||
Rise(5) {
|
||||
Text("? why emulators do not run on the desktop", fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(bottom = 6.dp).clip(Shape10).clickable(onClick = a.onEmulatorHelp).padding(horizontal = 6.dp, vertical = 4.dp))
|
||||
Text("? Why emulators?", fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(bottom = 6.dp).clip(Shape10).clickable(onClick = a.onEmulatorHelp).padding(horizontal = 6.dp, vertical = 4.dp))
|
||||
}
|
||||
Rise(6, Modifier.weight(1f).fillMaxWidth()) {
|
||||
ArtGrid(s.emulators.map { e -> Tile(e.name, if (e.installed) (if (e.id == "retroarch") "browses its own games" else "${e.games.size} game${if (e.games.size == 1) "" else "s"}") else "not installed", null, "emu:${e.id}", e.iconRes, dim = !e.installed) { if (e.installed) a.onEmulator(e) else a.onApps() } })
|
||||
@@ -653,7 +609,6 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
|
||||
if (e == null) Note("Not installed.") else {
|
||||
Rise(0) { Eyebrow("Desktop · ${e.system}") }
|
||||
Rise(1) { Title(e.name) }
|
||||
Rise(2) { Lede("Opens fullscreen under gamescope. Games are the ${e.system} files in the ROMs folder; each launches straight in.") }
|
||||
Rise(3) {
|
||||
Actions {
|
||||
Image(painterResource(e.iconRes), null, modifier = Modifier.size(40.dp))
|
||||
@@ -710,7 +665,6 @@ private fun Content(s: FrontEndState, selected: String, a: FrontEndActions, modi
|
||||
|
||||
private class Tile(val title: String, val sub: String, val art: File?, val key: String, val iconRes: Int? = null, val dim: Boolean = false, val onClick: () -> Unit)
|
||||
|
||||
// ───────────────────────────── Type + small parts ─────────────────────────────
|
||||
|
||||
@Composable
|
||||
internal fun Eyebrow(t: String) {
|
||||
@@ -746,11 +700,9 @@ private fun Chip(t: String, ok: Boolean) {
|
||||
)
|
||||
}
|
||||
|
||||
/** Hover/focus/press state shared by every control that lifts, glows or squashes. */
|
||||
@Composable
|
||||
private fun rememberHot(src: MutableInteractionSource): Boolean = src.collectIsFocusedAsState().value || src.collectIsHoveredAsState().value
|
||||
|
||||
/** The launch button: gradient, a sheen that sweeps on focus, a squash on press. */
|
||||
@Composable
|
||||
private fun PrimaryButton(text: String, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -760,7 +712,6 @@ private fun PrimaryButton(text: String, enabled: Boolean = true, onClick: () ->
|
||||
val pressed by src.collectIsPressedAsState()
|
||||
val scale by animateFloatAsState(if (pressed) 0.955f else if (hot) 1.02f else 1f, Motion.sp(0.5f, Spring.StiffnessMedium), label = "btnScale")
|
||||
val lift by animateFloatAsState(if (hot) 14f else 6f, Motion.tw(300), label = "btnLift")
|
||||
val nudge by animateFloatAsState(if (hot) 2f else 0f, Motion.sp(0.5f), label = "tri")
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier = Modifier
|
||||
@@ -771,7 +722,6 @@ private fun PrimaryButton(text: String, enabled: Boolean = true, onClick: () ->
|
||||
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick)
|
||||
.padding(horizontal = 18.dp, vertical = 11.dp),
|
||||
) {
|
||||
Text("▶", fontSize = 11.sp, color = if (enabled) colors.onPrimary else colors.onSurfaceVariant, modifier = Modifier.graphicsLayer { translationX = nudge.dp.toPx() })
|
||||
Text(text, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 0.5.sp, color = if (enabled) colors.onPrimary else colors.onSurfaceVariant, maxLines = 1)
|
||||
}
|
||||
}
|
||||
@@ -824,14 +774,12 @@ private fun Poster(art: File?, name: String, modifier: Modifier) {
|
||||
}
|
||||
}
|
||||
|
||||
// ───────────────────────────── Grid + tiles ─────────────────────────────
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
private fun ArtGrid(tiles: List<Tile>, wide: Boolean = false) {
|
||||
val square = tiles.isNotEmpty() && tiles.all { it.art == null && it.iconRes != null }
|
||||
LazyVerticalGrid(
|
||||
// Thumbnails to recognise a game by, not posters; icon tiles are squares.
|
||||
columns = GridCells.Adaptive(minSize = if (square) 64.dp else if (wide) 92.dp else 70.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
contentPadding = PaddingValues(top = 6.dp, bottom = 14.dp, start = 4.dp, end = 4.dp),
|
||||
@@ -845,7 +793,6 @@ private fun ArtGrid(tiles: List<Tile>, wide: Boolean = false) {
|
||||
}
|
||||
}
|
||||
|
||||
/** A tile lifts, rings and shines when the pad lands on it; its play badge pops in. */
|
||||
@Composable
|
||||
private fun GameTile(t: Tile, wide: Boolean, square: Boolean, src: MutableInteractionSource, hot: Boolean) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -866,7 +813,6 @@ private fun GameTile(t: Tile, wide: Boolean, square: Boolean, src: MutableIntera
|
||||
) {
|
||||
Box(modifier = Modifier.fillMaxWidth().shine(hot)) {
|
||||
Art(t.art, t.iconRes, t.title, Modifier.fillMaxWidth(), wide)
|
||||
// Qualified: the enclosing Column would otherwise pick its scoped overload.
|
||||
androidx.compose.animation.AnimatedVisibility(
|
||||
visible = hot, modifier = Modifier.align(Alignment.Center),
|
||||
enter = scaleIn(Motion.sp(0.5f), initialScale = 0.5f) + fadeIn(Motion.tw(200)),
|
||||
@@ -875,7 +821,7 @@ private fun GameTile(t: Tile, wide: Boolean, square: Boolean, src: MutableIntera
|
||||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
modifier = Modifier.size(if (square) 26.dp else 32.dp).graphicsLayer { shadowElevation = 10.dp.toPx(); shape = CircleShape; clip = false; spotShadowColor = pal.signal }.clip(CircleShape).background(pal.signal),
|
||||
) { Text("▶", fontSize = if (square) 9.sp else 11.sp, color = Color.White, modifier = Modifier.padding(start = 2.dp)) }
|
||||
) { Text("›", fontSize = if (square) 16.sp else 20.sp, color = Color.White) }
|
||||
}
|
||||
}
|
||||
Column(modifier = Modifier.padding(horizontal = 6.dp, vertical = 5.dp)) {
|
||||
@@ -888,7 +834,6 @@ private fun GameTile(t: Tile, wide: Boolean, square: Boolean, src: MutableIntera
|
||||
@Composable
|
||||
private fun Art(art: File?, iconRes: Int?, label: String, modifier: Modifier, wide: Boolean = false) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
// Game art is a poster (2:3) or a screenshot (16:9); an emulator's icon is a square.
|
||||
val ratio = if (art == null && iconRes != null) 1f else if (wide) 16f / 9f else 2f / 3f
|
||||
Box(modifier = modifier.aspectRatio(ratio).background(if (art == null && iconRes == null) artBrush(hueOf(label)) else Brush.linearGradient(listOf(colors.surfaceVariant, colors.surface)))) {
|
||||
when {
|
||||
|
||||
@@ -41,7 +41,6 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.steamdeck.launcher.R
|
||||
|
||||
/** Everything the main screen shows; the activity owns the values and the work behind them. */
|
||||
class MainUiState(
|
||||
val installed: String?,
|
||||
val ready: Boolean,
|
||||
@@ -53,29 +52,13 @@ class MainUiState(
|
||||
val failed: Boolean,
|
||||
val frameGenLabel: String,
|
||||
val desktopInstalled: Boolean,
|
||||
/** The account the client would sign in as offline, or null if it has never signed in. */
|
||||
val offlineAccount: String?,
|
||||
val offline: Boolean,
|
||||
/** The folder every session shows at /root/ROMs, or null if none is chosen. */
|
||||
val romsDir: String?,
|
||||
val logsEnabled: Boolean,
|
||||
/** Installed emulators that can run under gamescope: label to path inside the runtime. */
|
||||
val emulators: List<Pair<String, String>> = emptyList(),
|
||||
)
|
||||
|
||||
/**
|
||||
* The whole app outside a session, in one column that is sized to the window it has.
|
||||
*
|
||||
* Panels and densities vary too much for fixed dp: a 7" 1080p handheld in landscape has barely
|
||||
* 400dp of height, a foldable's inner screen has 900. So the column is designed at one size and
|
||||
* scaled by the height available — everything on it, text included, shrinks together until it
|
||||
* fits — with scrolling left as the last resort, and a width cap so the buttons never span a
|
||||
* wide panel. The system bars are kept clear of.
|
||||
*
|
||||
* Play and Desktop span the column; everything else is a tile in two columns, a title with the
|
||||
* setting's current value under it, so the menu is read at a glance and fits without scrolling
|
||||
* on a handheld.
|
||||
*/
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
fun MainScreen(
|
||||
@@ -104,7 +87,6 @@ fun MainScreen(
|
||||
.systemBarsPadding(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
// The column as designed needs about this much height; below it, scale everything.
|
||||
val designHeight = 480.dp
|
||||
val k = (maxHeight / designHeight).coerceIn(0.55f, 1f)
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -124,10 +106,6 @@ fun MainScreen(
|
||||
)
|
||||
Spacer(Modifier.height(6.dp * k))
|
||||
Text("SteamDeck", fontSize = 22.sp * k, color = colors.onBackground)
|
||||
Text(
|
||||
"Valve's native ARM64 Steam client, under gamescope",
|
||||
fontSize = 12.sp * k, color = colors.onSurfaceVariant, textAlign = TextAlign.Center,
|
||||
)
|
||||
Spacer(Modifier.height(14.dp * k))
|
||||
|
||||
val status = when {
|
||||
@@ -138,14 +116,14 @@ fun MainScreen(
|
||||
Text(status, fontSize = 15.sp * k, color = colors.onBackground)
|
||||
val detail = when {
|
||||
state.busy -> if (state.percent >= 0) "${state.stage} ${state.percent}%" else state.stage
|
||||
state.failed -> "Install failed — nothing was changed"
|
||||
state.failed -> "Install failed. Nothing changed."
|
||||
!state.ready -> state.available?.let { "$it · ${state.availableSize} download, one time" }
|
||||
?: "Could not reach the runtime catalog"
|
||||
state.available != null && state.available != state.installed ->
|
||||
"Runtime ${state.installed ?: "?"} installed · ${state.available} available"
|
||||
else -> "Runtime ${state.installed ?: "?"} installed"
|
||||
else -> null
|
||||
}
|
||||
Text(
|
||||
if (detail != null) Text(
|
||||
detail, fontSize = 12.sp * k, color = colors.onSurfaceVariant, textAlign = TextAlign.Center,
|
||||
modifier = Modifier.padding(top = 3.dp * k),
|
||||
)
|
||||
@@ -160,7 +138,6 @@ fun MainScreen(
|
||||
Spacer(Modifier.height(14.dp * k))
|
||||
|
||||
val buttonHeight = 40.dp * k
|
||||
// Each launch button has its own cog: what only matters for that mode lives there.
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp * k), modifier = Modifier.fillMaxWidth()) {
|
||||
Button(
|
||||
onClick = onPlay, enabled = state.ready && !state.busy,
|
||||
@@ -172,11 +149,9 @@ fun MainScreen(
|
||||
OutlinedButton(
|
||||
onClick = onDesktop, enabled = state.ready && !state.busy && state.desktopInstalled,
|
||||
modifier = Modifier.weight(1f).height(buttonHeight),
|
||||
) { Text(if (state.desktopInstalled) "Desktop" else "Desktop — install it under Desktop & apps", fontSize = 13.sp * k, maxLines = 1, overflow = TextOverflow.Ellipsis) }
|
||||
) { Text("Desktop", fontSize = 13.sp * k, maxLines = 1, overflow = TextOverflow.Ellipsis) }
|
||||
CogButton(k, onDesktopSettings)
|
||||
}
|
||||
// The ROMs folder, then every installed emulator as a session of its own under
|
||||
// gamescope (where the GPU is); the ? says why they are here and not on the desktop.
|
||||
FlowRow(
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp * k),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp * k),
|
||||
@@ -197,7 +172,7 @@ fun MainScreen(
|
||||
onClick = { onLaunchEmulator(path) }, enabled = state.ready && !state.busy,
|
||||
contentPadding = PaddingValues(horizontal = 10.dp * k, vertical = 0.dp),
|
||||
modifier = Modifier.height(30.dp * k),
|
||||
) { Text("▶ $label", fontSize = 11.sp * k, maxLines = 1) }
|
||||
) { Text(label, fontSize = 11.sp * k, maxLines = 1) }
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = onEmulatorHelp,
|
||||
@@ -205,15 +180,13 @@ fun MainScreen(
|
||||
modifier = Modifier.width(30.dp * k).height(30.dp * k),
|
||||
) { Text("?", fontSize = 12.sp * k) }
|
||||
}
|
||||
// Offline is read while the client starts, so it is decided here rather than in the
|
||||
// session's drawer, and it needs credentials from an earlier sign-in to be possible.
|
||||
OutlinedButton(
|
||||
onClick = onOffline, enabled = state.offlineAccount != null,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight),
|
||||
) {
|
||||
Text(
|
||||
when {
|
||||
state.offlineAccount == null -> "Start offline — sign in once first"
|
||||
state.offlineAccount == null -> "Start offline"
|
||||
state.offline -> "Start offline: on · ${state.offlineAccount}"
|
||||
else -> "Start offline: off"
|
||||
},
|
||||
@@ -260,7 +233,6 @@ fun MainScreen(
|
||||
}
|
||||
}
|
||||
|
||||
/** The cog beside a launch button. */
|
||||
@Composable
|
||||
private fun CogButton(k: Float, onClick: () -> Unit) {
|
||||
OutlinedButton(
|
||||
@@ -270,7 +242,6 @@ private fun CogButton(k: Float, onClick: () -> Unit) {
|
||||
) { Icon(Icons.Filled.Settings, contentDescription = "Settings", modifier = Modifier.size(18.dp * k)) }
|
||||
}
|
||||
|
||||
/** One tile of the two-column menu: what it is, and under it what it is set to. */
|
||||
@Composable
|
||||
private fun MenuTile(
|
||||
title: String,
|
||||
@@ -297,40 +268,12 @@ private fun MenuTile(
|
||||
}
|
||||
}
|
||||
|
||||
/** The ? beside the emulator row: what the ▶ buttons are, how to use them, and why. */
|
||||
@Composable
|
||||
fun EmulatorHelpDialog(onDismiss: () -> Unit) {
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text("Emulators") },
|
||||
text = {
|
||||
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
|
||||
Text("What the ▶ buttons are", style = MaterialTheme.typography.titleSmall)
|
||||
Text(
|
||||
"One per emulator installed under Desktop & apps. Each starts that emulator fullscreen, as a " +
|
||||
"session of its own under gamescope — the same way the Steam client runs — with the Steam " +
|
||||
"cog's display, driver and HDR settings.",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
Text("How to use them", style = MaterialTheme.typography.titleSmall)
|
||||
Text(
|
||||
"Put your games in the folder the ROMs chip beside these buttons points at. In the emulator, open root › ROMs " +
|
||||
"(/root/ROMs); the whole phone is at root › Storage. Firmware and BIOS files go in the " +
|
||||
"same way (RPCS3: File › Install Firmware). Back opens the drawer; Stop session ends it.",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
Text("Why not from the desktop", style = MaterialTheme.typography.titleSmall)
|
||||
Text(
|
||||
"The desktop draws in software (labwc on pixman) and cannot hand a program the GPU: a Vulkan " +
|
||||
"emulator started there dies at its first frame (\"Surface lost\"). gamescope can, so an " +
|
||||
"emulator that renders with Vulkan or OpenGL belongs here. The desktop stays for files, " +
|
||||
"Firefox and anything that draws in software.",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
}
|
||||
},
|
||||
text = { Text("Place games in the ROMs folder. In RPCS3, install firmware from File > Install Firmware.") },
|
||||
confirmButton = { TextButton(onClick = onDismiss) { Text("OK") } },
|
||||
)
|
||||
}
|
||||
@@ -353,11 +296,11 @@ fun CreditsDialog(onDismiss: () -> Unit) {
|
||||
title = { Text("Credits") },
|
||||
text = {
|
||||
Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
|
||||
Text("The412Banner — the app, the Wayland compositor, the runtime and the Steam session.", style = MaterialTheme.typography.bodyMedium)
|
||||
Text("The412Banner - the app, the Wayland compositor, the runtime and the Steam session.", style = MaterialTheme.typography.bodyMedium)
|
||||
Spacer(Modifier.height(10.dp))
|
||||
Text("maxjivi05 (Max) — the gamescope runtime this is built on: the proot session, the session shim, the fake-evdev interposer and the controller work, from WinNative.", style = MaterialTheme.typography.bodyMedium)
|
||||
Text("maxjivi05 (Max) - the gamescope runtime this is built on: the proot session, the session shim, the fake-evdev interposer and the controller work, from WinNative.", style = MaterialTheme.typography.bodyMedium)
|
||||
Spacer(Modifier.height(10.dp))
|
||||
Text("Winlator (brunodev85) — the audio stack, the gamepad model and the shape of a session's host-side components; WinNative and Bannerlator are both Winlator lineage.", style = MaterialTheme.typography.bodyMedium)
|
||||
Text("Winlator (brunodev85) - the audio stack, the gamepad model and the shape of a session's host-side components; WinNative and Bannerlator are both Winlator lineage.", style = MaterialTheme.typography.bodyMedium)
|
||||
Spacer(Modifier.height(10.dp))
|
||||
Text(
|
||||
"GPL-3.0. Valve, Steam, Steam Deck and Proton are trademarks of Valve Corporation; this project is not affiliated with Valve. gamescope, Mesa, Turnip, Xwayland, PulseAudio, proot and Arch Linux ARM are their authors' own.",
|
||||
|
||||
@@ -15,32 +15,25 @@ import com.steamdeck.launcher.core.FexPreset
|
||||
import com.steamdeck.launcher.session.SessionPrefs
|
||||
import com.steamdeck.launcher.session.SessionService
|
||||
|
||||
/** One driver as the page shows it. [removable] is false for the runtime's own and the bundled builds. */
|
||||
class DriverRow(val id: String, val name: String, val detail: String, val removable: Boolean)
|
||||
|
||||
/** Everything one mode's settings page shows; the activity owns the values. */
|
||||
class ModeSettings(
|
||||
val mode: String,
|
||||
val resolutionCap: Int,
|
||||
val shapeMode: String,
|
||||
val hdr: Boolean,
|
||||
/** Why HDR cannot be offered on this display, or null when it can. */
|
||||
val hdrReason: String?,
|
||||
val linuxRows: List<DriverRow>,
|
||||
val linuxSelected: String,
|
||||
val androidRows: List<DriverRow>,
|
||||
val androidSelected: String,
|
||||
val touchMode: String,
|
||||
/** Steam only. */
|
||||
val oscMode: String?,
|
||||
val directAudio: Boolean?,
|
||||
val mic: Boolean?,
|
||||
/** Desktop only. */
|
||||
val renderer: String?,
|
||||
/** Steam only: the second library's root ("" = internal only) and what this device offers. */
|
||||
val gameStorage: String? = null,
|
||||
val storageOptions: List<Pair<String, String>> = emptyList(),
|
||||
/** Steam only: the FEXCore preset for the games the client launches. */
|
||||
val fexPreset: String? = null,
|
||||
)
|
||||
|
||||
@@ -65,12 +58,6 @@ class ModeSettingsActions(
|
||||
val onDismiss: () -> Unit,
|
||||
)
|
||||
|
||||
/**
|
||||
* The cog beside Play / Desktop: a page in the front end's pane, one row per setting with its
|
||||
* value in a chip, and a small menu under the chip to change it. What only matters for that one
|
||||
* mode lives here - the display the session is sized to, HDR, the driver inside the runtime,
|
||||
* the display driver, and the input and audio choices - so the rail keeps what applies to both.
|
||||
*/
|
||||
@Composable
|
||||
fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
|
||||
val steam = s.mode == SessionService.MODE_STEAM
|
||||
@@ -88,7 +75,7 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
|
||||
ChoiceRow(
|
||||
host, "res", "Resolution", "Takes effect at the next session: gamescope sizes its display once, when it starts.",
|
||||
listOf(720 to "Up to 720p", 900 to "Up to 900p", 1080 to "Up to 1080p", 0 to "The panel's own")
|
||||
.map { (cap, label) -> cap to (if (cap == default) "$label — the default" else label) },
|
||||
.map { (cap, label) -> cap to (if (cap == default) "$label - the default" else label) },
|
||||
s.resolutionCap, note = "720p keeps the client's menus responsive; above 1080p costs frames for nothing a handheld can show.",
|
||||
onPick = a.onResolution,
|
||||
)
|
||||
@@ -151,7 +138,7 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
|
||||
if (steam && s.gameStorage != null) SettingsGroup("Game storage") {
|
||||
val custom = s.gameStorage.isNotEmpty() && s.gameStorage != "off" && s.storageOptions.none { it.second == s.gameStorage }
|
||||
val options = buildList {
|
||||
add("" to ("Automatic — the SD card when one is in" + (if (s.storageOptions.isEmpty()) " (none right now)" else "")))
|
||||
add("" to ("Automatic - the SD card when one is in" + (if (s.storageOptions.isEmpty()) " (none right now)" else "")))
|
||||
add("off" to "Internal only")
|
||||
for ((label, path) in s.storageOptions) add(path to label)
|
||||
if (custom) add(s.gameStorage to "Folder: ${s.gameStorage}")
|
||||
@@ -163,7 +150,7 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
|
||||
highlighted = open,
|
||||
) {
|
||||
androidx.compose.foundation.layout.Box {
|
||||
ValueChip(options.firstOrNull { it.first == s.gameStorage }?.second?.substringBefore(" —") ?: "—", open) { host.open = if (open) null else "storage" }
|
||||
ValueChip(options.firstOrNull { it.first == s.gameStorage }?.second?.substringBefore(" -") ?: "-", open) { host.open = if (open) null else "storage" }
|
||||
AnchoredMenu(
|
||||
open, onDismiss = { if (host.open == "storage") host.open = null }, title = "Second library",
|
||||
note = "An SD card and shared storage go through Android's file layer: a game that streams big assets from there can stall. Keep such games internal.",
|
||||
@@ -180,7 +167,7 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
|
||||
if (!steam && s.renderer != null) SettingsGroup("Renderer") {
|
||||
ChoiceRow(
|
||||
host, "renderer", "Desktop renderer", "How labwc composites the desktop. pixman is software and works everywhere.",
|
||||
listOf("pixman" to "pixman — software", "gles2" to "gles2", "vulkan" to "vulkan"), s.renderer,
|
||||
listOf("pixman" to "pixman - software", "gles2" to "gles2", "vulkan" to "vulkan"), s.renderer,
|
||||
note = "gles2 and vulkan need a real DRM render node, which the Adreno stand-in is not on most devices.", onPick = a.onRenderer,
|
||||
)
|
||||
}
|
||||
@@ -189,7 +176,6 @@ fun ModeSettingsPage(s: ModeSettings, a: ModeSettingsActions) {
|
||||
}
|
||||
}
|
||||
|
||||
/** A driver list as a menu: each build a line, imported ones with a remove control, an import at the end. */
|
||||
@Composable
|
||||
private fun DriverRowMenu(
|
||||
host: MenuHost, key: String, label: String, hint: String, rows: List<DriverRow>, selected: String, importLabel: String,
|
||||
@@ -199,7 +185,7 @@ private fun DriverRowMenu(
|
||||
val colors = MaterialTheme.colorScheme
|
||||
SettingsRow(label, hint, highlighted = open) {
|
||||
androidx.compose.foundation.layout.Box {
|
||||
ValueChip(rows.firstOrNull { it.id == selected }?.name ?: rows.firstOrNull()?.name ?: "—", open) { host.open = if (open) null else key }
|
||||
ValueChip(rows.firstOrNull { it.id == selected }?.name ?: rows.firstOrNull()?.name ?: "-", open) { host.open = if (open) null else key }
|
||||
AnchoredMenu(open, onDismiss = { if (host.open == key) host.open = null }, title = label) {
|
||||
for (row in rows) MenuItem(
|
||||
row.name, checked = row.id == selected, detail = row.detail.ifEmpty { null },
|
||||
|
||||
@@ -17,15 +17,8 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
/** One core as the page labels it: its number and, where known, its ceiling. */
|
||||
class CoreRow(val core: Int, val label: String)
|
||||
|
||||
/**
|
||||
* The two core masks a Steam session carries, kept separate because they are wanted at the same
|
||||
* time and suit different things: the client's menus and a game each get their own. Both apply
|
||||
* at the next session start; the game's is applied by the Proton wrapper at each launch. Below
|
||||
* them, the session fixes for a device the runtime does not sit well on.
|
||||
*/
|
||||
@Composable
|
||||
fun PerformancePage(
|
||||
cores: List<CoreRow>,
|
||||
@@ -63,7 +56,7 @@ fun PerformancePage(
|
||||
SettingsGroup("Steam client cores") {
|
||||
ToggleRow(
|
||||
host, "override", "Override Steam's own core choice",
|
||||
"Steam pins its interface to a subset of cores it picks — on one device 5 of 8, leaving out the fastest — which suits a running game and makes the menus sluggish when the client is all there is. On: the client, its UI helper and gamescope are pinned to the cores below instead, re-applied every few seconds.",
|
||||
"Steam pins its interface to a subset of cores it picks - on one device 5 of 8, leaving out the fastest - which suits a running game and makes the menus sluggish when the client is all there is. On: the client, its UI helper and gamescope are pinned to the cores below instead, re-applied every few seconds.",
|
||||
clientOverride, onChange = onClientOverride,
|
||||
)
|
||||
MultiRow(
|
||||
@@ -74,7 +67,7 @@ fun PerformancePage(
|
||||
SettingsGroup("Game cores") {
|
||||
MultiRow(
|
||||
host, "gameCores", "Game cores",
|
||||
"Applied by exec'ing the game through taskset, so every thread inherits the mask. Every core ticked sends nothing — that is what the scheduler does unaided. Untick the small cores to keep a heavy game off them.",
|
||||
"Applied by exec'ing the game through taskset, so every thread inherits the mask. Every core ticked sends nothing - that is what the scheduler does unaided. Untick the small cores to keep a heavy game off them.",
|
||||
coreItems, gameCores, note = "Tick or untick as many as you like; the menu stays open.", onToggle = onGameCore,
|
||||
)
|
||||
}
|
||||
@@ -103,7 +96,7 @@ fun PerformancePage(
|
||||
SettingsGroup("Session fixes") {
|
||||
ToggleRow(
|
||||
host, "sysmem", "Turnip: sysmem rendering",
|
||||
"Renders without the GPU's tile memory (TU_DEBUG=sysmem). A fix for an Adreno 8xx that shows corruption, and required on a 710/720/722 (set on its own there). Not a speed setting: elsewhere it COSTS frames — leave it off unless the picture is wrong.",
|
||||
"Renders without the GPU's tile memory (TU_DEBUG=sysmem). A fix for an Adreno 8xx that shows corruption, and required on a 710/720/722 (set on its own there). Not a speed setting: elsewhere it COSTS frames - leave it off unless the picture is wrong.",
|
||||
tuSysmem, onChange = onTuSysmem,
|
||||
)
|
||||
ToggleRow(
|
||||
|
||||
@@ -15,14 +15,8 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/** One third-party Proton as the dialog shows it. */
|
||||
class ProtonRow(val id: String, val name: String, val installed: String?, val queued: Boolean)
|
||||
|
||||
/**
|
||||
* GE-Proton and proton-cachyos: installed, queued for the next session, or neither. Installing
|
||||
* happens inside the runtime when a session starts (a download of several hundred MB), so the
|
||||
* dialog only ever queues or cancels a request, and removes an installed build.
|
||||
*/
|
||||
@Composable
|
||||
fun ProtonDialog(
|
||||
rows: List<ProtonRow>,
|
||||
@@ -37,7 +31,7 @@ fun ProtonDialog(
|
||||
text = {
|
||||
Column {
|
||||
Text(
|
||||
"Native ARM64 Proton builds beside the ARM64 Proton Valve ships. Installed when a session starts — a large download — and then chosen per game in Steam under Properties → Compatibility.",
|
||||
"Native ARM64 Proton builds beside the ARM64 Proton Valve ships. Installed when a session starts - a large download - and then chosen per game in Steam under Properties → Compatibility.",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
|
||||
@@ -11,7 +11,6 @@ import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/** The ROMs folder: where it is, and where the emulators will find it. */
|
||||
@Composable
|
||||
fun RomsDialog(path: String?, onChoose: () -> Unit, onClear: () -> Unit, onDismiss: () -> Unit) {
|
||||
AlertDialog(
|
||||
@@ -21,7 +20,7 @@ fun RomsDialog(path: String?, onChoose: () -> Unit, onClear: () -> Unit, onDismi
|
||||
Column {
|
||||
Text(
|
||||
"A folder on this device that every session shows as ROMs in the home folder " +
|
||||
"(/root/ROMs) — open it from any emulator's file dialog. All of internal " +
|
||||
"(/root/ROMs) - open it from any emulator's file dialog. All of internal " +
|
||||
"storage is there too, as Storage.",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
)
|
||||
|
||||
@@ -66,7 +66,6 @@ import com.steamdeck.launcher.gpu.FrameGen
|
||||
import com.steamdeck.launcher.session.SessionPrefs
|
||||
import kotlinx.coroutines.flow.collect
|
||||
|
||||
/** A line of numbers in the top-right corner. It takes no touches: everything goes to the game. */
|
||||
@Composable
|
||||
fun HudText(text: String) {
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.TopEnd) {
|
||||
@@ -83,11 +82,6 @@ fun HudText(text: String) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* What the user sees until the client draws its first frame: the runtime's milestone, the
|
||||
* client's download progress lifted out of its log, a clock, and a hint. Opaque, so a stale
|
||||
* frame from an earlier session never shows through, and it swallows touches.
|
||||
*/
|
||||
@Composable
|
||||
fun LoadingOverlay(step: String, percent: Int, elapsed: String, hint: String, ended: Boolean) {
|
||||
Column(
|
||||
@@ -116,7 +110,6 @@ fun LoadingOverlay(step: String, percent: Int, elapsed: String, hint: String, en
|
||||
}
|
||||
}
|
||||
|
||||
/** Everything the drawer shows and does. */
|
||||
class DrawerActions(
|
||||
val steam: Boolean,
|
||||
val hudOn: Boolean,
|
||||
@@ -125,16 +118,13 @@ class DrawerActions(
|
||||
val lsfgReady: Boolean,
|
||||
val oscMode: String,
|
||||
val touchMode: String,
|
||||
/** What "auto" resolves to right now: "touchpad" or "direct". */
|
||||
val touchAuto: String,
|
||||
val shapeMode: String,
|
||||
val fexPreset: String,
|
||||
val onHud: (Boolean) -> Unit,
|
||||
val onFrameGenPick: (engine: String, multiplier: Int) -> Unit,
|
||||
val onKeyboard: () -> Unit,
|
||||
/** Sends the Guide button (the client's menu); null on the desktop, where there is none. */
|
||||
val onSteamMenu: (() -> Unit)?,
|
||||
/** Sends Guide + A to open Steam's Quick Access Menu; null on the desktop. */
|
||||
val onQam: (() -> Unit)?,
|
||||
val onProtons: () -> Unit,
|
||||
val onOsc: (String) -> Unit,
|
||||
@@ -146,13 +136,6 @@ class DrawerActions(
|
||||
val onClose: () -> Unit,
|
||||
)
|
||||
|
||||
/**
|
||||
* The drawer Back opens over a running session, in the front end's own dress: a panel that
|
||||
* slides in from the right with the switches a player reaches for mid-game as rows whose values
|
||||
* open in place, what only applies at the next session under its own heading, and the two ways
|
||||
* out at the end. Steam and the desktop share the rows that mean the same on both; the client's
|
||||
* own (its menu, the virtual pad, the FEX preset, the compatibility tools) show only there.
|
||||
*/
|
||||
@Composable
|
||||
fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -174,7 +157,6 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
||||
.fillMaxHeight()
|
||||
.width(340.dp)
|
||||
.background(pal.background.copy(alpha = 0.97f))
|
||||
// The panel swallows its own touches so they do not close it.
|
||||
.clickable(interactionSource = remember { MutableInteractionSource() }, indication = null) {}
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(horizontal = 14.dp, vertical = 16.dp),
|
||||
@@ -182,10 +164,7 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(start = 4.dp, bottom = 6.dp)) {
|
||||
Box(modifier = Modifier.size(10.dp).clip(CircleShape).background(Brush.linearGradient(listOf(colors.primary, pal.primary2))))
|
||||
Spacer(Modifier.width(10.dp))
|
||||
Column {
|
||||
Text("SteamDeck", fontSize = 17.sp, fontWeight = FontWeight.Bold, color = colors.onBackground)
|
||||
Text(if (a.steam) "Steam session" else "Desktop session", fontSize = 11.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
Text(if (a.steam) "Steam" else "Desktop", fontSize = 17.sp, fontWeight = FontWeight.Bold, color = colors.onBackground)
|
||||
}
|
||||
if (a.onSteamMenu != null && a.onQam != null) {
|
||||
val qamInteraction = remember { MutableInteractionSource() }
|
||||
@@ -226,14 +205,14 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
||||
}
|
||||
|
||||
SettingsGroup("Now") {
|
||||
ToggleRow(host, "hud", "Performance HUD", "The frame counter in the corner.", a.hudOn, onChange = a.onHud)
|
||||
ToggleRow(host, "hud", "Performance HUD", null, a.hudOn, onChange = a.onHud)
|
||||
val fgOpen = host.open == "fg"
|
||||
val fgLabel = when (a.frameGenEngine) {
|
||||
FrameGen.ENGINE_WINFG -> "Win-FG ${a.frameGenMultiplier}×"
|
||||
FrameGen.ENGINE_LSFG -> "LSFG ${a.frameGenMultiplier}×"
|
||||
else -> "Off"
|
||||
}
|
||||
SettingsRow("Frame generation", "Extra frames between the real ones; takes effect at once, mid-game included.", highlighted = fgOpen) {
|
||||
SettingsRow("Frame generation", null, highlighted = fgOpen) {
|
||||
Box {
|
||||
ValueChip(fgLabel, fgOpen) { host.open = if (fgOpen) null else "fg" }
|
||||
AnchoredMenu(fgOpen, onDismiss = { if (host.open == "fg") host.open = null }, title = "Frame generation") {
|
||||
@@ -245,28 +224,28 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
||||
}
|
||||
}
|
||||
ChoiceRow(
|
||||
host, "touch", "Touch", "How a finger drives the pointer.",
|
||||
host, "touch", "Touch", null,
|
||||
listOf(SessionPrefs.TOUCH_AUTO to "Auto (${a.touchAuto})", SessionPrefs.TOUCH_PAD to "Touchpad", SessionPrefs.TOUCH_DIRECT to "Direct"), a.touchMode,
|
||||
note = "Touchpad: drag moves, tap clicks. Direct: the pointer jumps under the finger.", onPick = a.onTouch,
|
||||
onPick = a.onTouch,
|
||||
)
|
||||
if (a.steam) ChoiceRow(
|
||||
host, "osc", "On-screen controls", "The virtual pad drawn over a game.",
|
||||
host, "osc", "On-screen controls", null,
|
||||
listOf(SessionPrefs.OSC_AUTO to "Auto", SessionPrefs.OSC_ALWAYS to "Always", SessionPrefs.OSC_STEAM_QAM to "Steam + QAM", SessionPrefs.OSC_NEVER to "Never"), a.oscMode,
|
||||
note = "Auto shows the full pad when no controller is attached. Steam + QAM shows only those two buttons.", onPick = a.onOsc,
|
||||
onPick = a.onOsc,
|
||||
)
|
||||
ActionRow("Keyboard", "The on-screen keyboard, for a field the client or a program is waiting on.", "Show") { host.open = null; a.onKeyboard() }
|
||||
ActionRow("Keyboard", null, "Show") { host.open = null; a.onKeyboard() }
|
||||
}
|
||||
|
||||
SettingsGroup("Next session") {
|
||||
ChoiceRow(
|
||||
host, "shape", "Display shape", "gamescope sizes its display once, when a session starts.",
|
||||
host, "shape", "Display shape", null,
|
||||
listOf(SessionPrefs.SHAPE_AUTO to "The panel's shape", SessionPrefs.SHAPE_WIDE to "16:9 with bars"), a.shapeMode, onPick = a.onShape,
|
||||
)
|
||||
if (a.steam) ChoiceRow(
|
||||
host, "fex", "FEX preset", "How FEX translates the x86 games the client launches. Applies to the next game launch.",
|
||||
host, "fex", "FEX preset", null,
|
||||
FexPreset.all.map { it.id to it.label }, a.fexPreset, note = FexPreset.byId(a.fexPreset).detail, onPick = a.onFexPreset,
|
||||
)
|
||||
if (a.steam) ActionRow("Compatibility tools", "The Proton builds the client can run games with.", "Manage") { host.open = null; a.onProtons() }
|
||||
if (a.steam) ActionRow("Compatibility tools", null, "Manage") { host.open = null; a.onProtons() }
|
||||
}
|
||||
|
||||
Spacer(Modifier.height(18.dp))
|
||||
@@ -280,7 +259,6 @@ fun SessionDrawer(open: Boolean, a: DrawerActions) {
|
||||
}
|
||||
}
|
||||
|
||||
/** The one button that ends things: outlined in the error colour, filled on focus. */
|
||||
@Composable
|
||||
private fun DangerButton(text: String, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
|
||||
@@ -64,16 +64,10 @@ import androidx.compose.ui.window.Popup
|
||||
import androidx.compose.ui.window.PopupPositionProvider
|
||||
import androidx.compose.ui.window.PopupProperties
|
||||
|
||||
/*
|
||||
* Settings without a pop-up: a page of rows, each with its value in a chip on the right, and a
|
||||
* small faded menu that opens right under the chip when it is tapped. One menu at a time per
|
||||
* page; the rest of the page dims a little while it is open.
|
||||
*/
|
||||
|
||||
private val RowShape = RoundedCornerShape(12.dp)
|
||||
private val GroupShape = RoundedCornerShape(14.dp)
|
||||
|
||||
/** Which row's menu is open on a page, so the page can dim and only one menu shows. */
|
||||
class MenuHost {
|
||||
var open by mutableStateOf<String?>(null)
|
||||
}
|
||||
@@ -81,7 +75,6 @@ class MenuHost {
|
||||
@Composable
|
||||
fun rememberMenuHost(): MenuHost = remember { MenuHost() }
|
||||
|
||||
/** Under the anchor, right edges aligned; above it when the bottom of the window is too close. */
|
||||
private class BelowEndProvider(private val gap: Int) : PopupPositionProvider {
|
||||
override fun calculatePosition(anchorBounds: IntRect, windowSize: IntSize, layoutDirection: LayoutDirection, popupContentSize: IntSize): IntOffset {
|
||||
var x = anchorBounds.right - popupContentSize.width
|
||||
@@ -93,11 +86,6 @@ private class BelowEndProvider(private val gap: Int) : PopupPositionProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The menu itself, anchored to whatever composable it is placed inside (put it in the same Box as
|
||||
* the chip). It fades and scales in from its top-right corner and out again on dismiss; the popup
|
||||
* is only removed once the exit has finished.
|
||||
*/
|
||||
@Composable
|
||||
fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, note: String? = null, content: @Composable ColumnScope.() -> Unit) {
|
||||
val state = remember { MutableTransitionState(false) }
|
||||
@@ -138,7 +126,6 @@ fun AnchoredMenu(open: Boolean, onDismiss: () -> Unit, title: String? = null, no
|
||||
}
|
||||
}
|
||||
|
||||
/** One line of a menu: a check mark when it is the current value, a label, an optional second line. */
|
||||
@Composable
|
||||
fun MenuItem(
|
||||
label: String, checked: Boolean, enabled: Boolean = true, detail: String? = null,
|
||||
@@ -168,7 +155,6 @@ fun MenuItem(
|
||||
}
|
||||
}
|
||||
|
||||
/** The value on the right of a row: the current choice and a caret that turns while the menu is open. */
|
||||
@Composable
|
||||
fun ValueChip(text: String, open: Boolean, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -198,7 +184,6 @@ fun ValueChip(text: String, open: Boolean, enabled: Boolean = true, onClick: ()
|
||||
}
|
||||
}
|
||||
|
||||
/** A group of rows on one surface, with a section label above it. */
|
||||
@Composable
|
||||
fun SettingsGroup(title: String, content: @Composable ColumnScope.() -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -210,7 +195,6 @@ fun SettingsGroup(title: String, content: @Composable ColumnScope.() -> Unit) {
|
||||
Column(modifier = Modifier.fillMaxWidth().clip(GroupShape).background(colors.surface).border(1.dp, pal.line, GroupShape)) { content() }
|
||||
}
|
||||
|
||||
/** A row: label and hint on the left, whatever control on the right. */
|
||||
@Composable
|
||||
fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, control: @Composable () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
@@ -229,7 +213,6 @@ fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, cont
|
||||
Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
}
|
||||
|
||||
/** A row whose value is one of a list: the chip opens the menu, a pick closes it. */
|
||||
@Composable
|
||||
fun <T> ChoiceRow(
|
||||
host: MenuHost, key: String, label: String, hint: String?,
|
||||
@@ -239,7 +222,7 @@ fun <T> ChoiceRow(
|
||||
val open = host.open == key
|
||||
SettingsRow(label, hint, highlighted = open) {
|
||||
Box {
|
||||
ValueChip(options.firstOrNull { it.first == selected }?.second ?: "—", open, enabled) { host.open = if (open) null else key }
|
||||
ValueChip(options.firstOrNull { it.first == selected }?.second ?: "-", open, enabled) { host.open = if (open) null else key }
|
||||
AnchoredMenu(open, onDismiss = { if (host.open == key) host.open = null }, title = label, note = note) {
|
||||
for ((value, text) in options) MenuItem(text, checked = value == selected) { onPick(value); host.open = null }
|
||||
}
|
||||
@@ -247,12 +230,10 @@ fun <T> ChoiceRow(
|
||||
}
|
||||
}
|
||||
|
||||
/** On or off, as a two-line menu, so every row on the page behaves the same way under a pad. */
|
||||
@Composable
|
||||
fun ToggleRow(host: MenuHost, key: String, label: String, hint: String?, checked: Boolean, enabled: Boolean = true, onChange: (Boolean) -> Unit) =
|
||||
ChoiceRow(host, key, label, hint, listOf(true to "On", false to "Off"), checked, enabled, onPick = onChange)
|
||||
|
||||
/** Several of a list at once (the core masks): the menu stays open while boxes are ticked. */
|
||||
@Composable
|
||||
fun MultiRow(
|
||||
host: MenuHost, key: String, label: String, hint: String?,
|
||||
@@ -278,13 +259,11 @@ fun MultiRow(
|
||||
}
|
||||
}
|
||||
|
||||
/** A row that does something (import, choose a folder) instead of holding a value. */
|
||||
@Composable
|
||||
fun ActionRow(label: String, hint: String?, button: String, onClick: () -> Unit) {
|
||||
SettingsRow(label, hint) { SecondaryButton(button, onClick = onClick) }
|
||||
}
|
||||
|
||||
/** A page: eyebrow with a way back, title, lede, and the rows below it, dimmed while a menu is open. */
|
||||
@Composable
|
||||
fun SettingsPage(host: MenuHost, eyebrow: String, title: String, lede: String, onBack: () -> Unit, content: @Composable ColumnScope.() -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
|
||||
@@ -9,12 +9,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import com.steamdeck.launcher.session.SessionPrefs
|
||||
|
||||
/**
|
||||
* The app's colours, in the icon's three: black, white and its blue. Three ways to deal them
|
||||
* out, chosen under Setup › Theme. [primary] is what the selection pill and the Play button are
|
||||
* made of; [signal] is the small accent for rules, rings, dots and the eyebrow - the same colour
|
||||
* as [primary] in the blue themes, the blue itself in Paper, where the primary is white.
|
||||
*/
|
||||
class Palette(
|
||||
val id: String, val label: String, val detail: String,
|
||||
val background: Color, val surface: Color, val surfaceVariant: Color, val line: Color, val line2: Color,
|
||||
@@ -57,7 +51,6 @@ object Themes {
|
||||
|
||||
val LocalPalette = staticCompositionLocalOf { Themes.byId(Themes.PAPER) }
|
||||
|
||||
/** The app's theme; with no [theme] given, the one saved in the preferences. The app is never light. */
|
||||
@Composable
|
||||
fun SteamDeckTheme(theme: String? = null, content: @Composable () -> Unit) {
|
||||
val id = theme ?: SessionPrefs.theme(LocalContext.current)
|
||||
|
||||
@@ -76,8 +76,8 @@ object CompositorHost {
|
||||
/**
|
||||
* The window the guest presents through has changed (the Steam menu opening or closing over a
|
||||
* fullscreen game swaps gamescope between forwarding the game's own buffers and its composited
|
||||
* output). The engine's ring and history straddle that switch and come back wrong-sized — a
|
||||
* game shown as a strip in a corner — so it is disarmed and re-armed against the new window.
|
||||
* output). The engine's ring and history straddle that switch and come back wrong-sized - a
|
||||
* game shown as a strip in a corner - so it is disarmed and re-armed against the new window.
|
||||
*/
|
||||
fun rearmFrameGen(rearm: () -> Unit) {
|
||||
if (!started) return
|
||||
@@ -87,7 +87,7 @@ object CompositorHost {
|
||||
}
|
||||
|
||||
/**
|
||||
* The activity is going away. The compositor keeps running with nothing to present into —
|
||||
* The activity is going away. The compositor keeps running with nothing to present into -
|
||||
* the guest carries on, and its next frames land on the Surface the next activity brings.
|
||||
*/
|
||||
/** The Surface the compositor presents on; only its own owner may take it away. */
|
||||
|
||||
@@ -22,7 +22,7 @@ public final class WaylandCompositor {
|
||||
|
||||
/** Register a callback fired once, when the compositor presents the first client
|
||||
* frame to the output Surface. Used to dismiss the launch overlay in wayland mode
|
||||
* (there is no XServer window-content hook). Runs on the compositor thread — the
|
||||
* (there is no XServer window-content hook). Runs on the compositor thread - the
|
||||
* listener must marshal to the UI thread itself. */
|
||||
public static void setFirstFrameListener(Runnable r) { firstFrameListener = r; }
|
||||
|
||||
@@ -39,12 +39,12 @@ public final class WaylandCompositor {
|
||||
/** A window started presenting GPU frames ({@code window} describes it; {@code gpuName} is the
|
||||
* compositor's GPU), or {@code window == null} when that window closed. Compositor thread. */
|
||||
void onGameSurface(String window, String gpuName);
|
||||
/** One GPU frame from that window. Compositor thread — keep it cheap. */
|
||||
/** One GPU frame from that window. Compositor thread - keep it cheap. */
|
||||
void onGameFrame();
|
||||
/** The program behind that window, right after {@link #onGameSurface}: its Linux pid (the
|
||||
* Wayland client's credentials) and executable name ({@code ""} when unknown). The app arms its
|
||||
* launch-time CPU affinity on it — on X11 that comes from window events, which a Wayland session
|
||||
* has none of. Compositor thread — marshal to the UI thread. */
|
||||
* launch-time CPU affinity on it - on X11 that comes from window events, which a Wayland session
|
||||
* has none of. Compositor thread - marshal to the UI thread. */
|
||||
default void onGameProgram(int pid, String program) {}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public final class WaylandCompositor {
|
||||
private static native void nativeTextInputPreedit(byte[] utf8, int cursorBegin, int cursorEnd);
|
||||
private static native void nativeTextInputDelete(int before, int after);
|
||||
|
||||
/** Start the compositor headless (no output window) — bring-up tests only. */
|
||||
/** Start the compositor headless (no output window) - bring-up tests only. */
|
||||
public static native void nativeStart(String xdgRuntimeDir);
|
||||
|
||||
/** Start the compositor rendering to {@code surface}. XDG_RUNTIME_DIR = an
|
||||
@@ -201,7 +201,7 @@ public final class WaylandCompositor {
|
||||
|
||||
/** Zero-copy frames the compositor presented in its LAST completed 10 s stats window (the
|
||||
* "| N zero-copy frames" figure of its session-log stats line); 0 while zero-copy is off or
|
||||
* before the first window closes. Read-only, any thread — the in-game drawer polls it. */
|
||||
* before the first window closes. Read-only, any thread - the in-game drawer polls it. */
|
||||
public static native int nativeZeroCopyFrames();
|
||||
|
||||
/** Milliseconds since the compositor last put a game frame on the display layer without a copy;
|
||||
@@ -244,7 +244,7 @@ public final class WaylandCompositor {
|
||||
}
|
||||
|
||||
/** Write one line into the compositor's session log (Download/Wayland-logs) under the "display"
|
||||
* area, from Java. Used for facts the platform knows and the native side does not — the panel's
|
||||
* area, from Java. Used for facts the platform knows and the native side does not - the panel's
|
||||
* HDR capability, which lives behind android.view.Display. Safe before the compositor thread is
|
||||
* up (the line then only reaches logcat) and safe after it has gone. */
|
||||
public static native void nativeLogDisplay(String message);
|
||||
@@ -382,7 +382,7 @@ public final class WaylandCompositor {
|
||||
|
||||
/** Colour grade in the drawer's slider units (brightness/contrast -100..100, gamma 0.5..3.0,
|
||||
* saturation 0..200 percent; 0/0/1/100 = neutral, pass off) plus the FXAA / Toon / CRT / NTSC
|
||||
* toggles — the same signature as {@code VulkanRenderer.setScreenEffects}. */
|
||||
* toggles - the same signature as {@code VulkanRenderer.setScreenEffects}. */
|
||||
public static native void nativeSetScreenEffects(float brightness, float contrast, float gamma, float saturation,
|
||||
boolean fxaa, boolean toon, boolean crt, boolean ntsc);
|
||||
|
||||
|
||||
Reference in new issue
Block a user