Compare commits

..
Author SHA1 Message Date
The412Banner ca08541851 fix(fex): x86-64 AppImages with a newer pango find a matching HarfBuzz 2026-12-06 15:52:54 +00:00
Kurt Himebauch 2525d5623e Reorganize Launcher, Performance, and Overview settings (#3778)
* Reorganize Launcher, Performance, and Overview settings

* Consume Steam integration reveal requests once
2026-12-06 09:19:11 -05:00
Kurt Himebauch 051b188159 Preserve installed resource IDs in Lab builds (#3781) 2026-12-06 08:18:50 -05:00
The412BannerandKurt Himebauch eeb76ae186 fix(game-env): the audio-stream probe of a game launch ends when the game does (#2965)
* fix(game-env): the audio-stream probe of a game launch ends when the game does

* fix(game-env): the audio-stream probe checks the game is still running before each sample

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
2026-12-06 07:59:59 -05:00
The412BannerandKurt Himebauch 63859fa776 fix(proton-run): skip an ARM64 Proton wrapper whose depot is missing and fall back to an installed Proton (#2727)
Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
2026-12-06 06:31:26 -05:00
Jay Pokale 98f14f4005 Fix typos in comments and docs (#3796) 2026-12-06 04:32:09 -05:00
The412Banner 59397f0ef9 feat(bionic): dd-directcontroller, XInput from the pad state for games started without Steam (#3792)
Two problems with games set to "Start without Steam" on DroidDeck-Bionic.

1. launch.sh set WINE_LSTEAMCLIENT=1 for every launch, so Wine replaced any steamclient(64).dll
   a game loads with lsteamclient, DroidDeck's bridge to its Steam client. A game started
   without Steam has no Steam client behind it; one that brings its own steamclient64.dll (a
   Steam emulator such as gbe_fork's ColdClient loader) quit after its splash screen because
   SteamAPI_Init failed. With DROIDDECK_NO_STEAM on, launch.sh now sets WINE_LSTEAMCLIENT=0
   unless the player set a value.

2. Wine's xinput reads the HID reports winebus makes from the evdev events fakeinput replays
   out of each controller ring, through a queue per handle. A game that reads them slower than
   the pad reports gets old stick positions: in Halo: The Master Chief Collection the character
   kept moving for a second or two after the stick was let go (vibration off in DroidDeck and
   in the game changed nothing).

dd-directcontroller (tools/bionic-runtime/dd-directcontroller) is an XInput DLL set
(xinput1_1..1_4, 9_1_0, uap; ARM64X for system32, i386 for syswow64) that answers
XInputGetState from the snapshot of the whole pad FakeInputWriter keeps in each ring file's
header (sequence-locked, read with 32-bit loads only). XInputSetState returns at once; a worker
thread hands rumble changes to a renamed copy of Wine's builtin xinput1_4
(dd-directcontroller-wine-xinput.dll), so rumble keeps DroidDeck's force-feedback path without
Wine's lock holding up a game thread. A pass-through mode sends every call to that copy. A
background thread reads the mode file every 250 ms ('1' direct, '0' pass-through) and does the
once-a-second ring and pad-node checks, so a game thread never waits on a file. Based on
Bannerlator's direct XInput DLL (GPL-3.0).

- launch.sh copies the DLLs into the prefix (replacing the links to the tool's builtins, never
  writing through them), sets xinput*=n,b and writes the mode file next to the controller
  folder (DD_DIRECTCONTROLLER_CONTROL) when the game is set to start without Steam;
  DD_DIRECTCONTROLLER=0 starts it in pass-through, and a game no longer set to start without
  Steam gets Wine's links back. DROIDDECK_NO_STEAM is kept in the environment it passes on.
- tools/bionic-runtime/build.sh builds and checks the DLLs (export tables of both ARM64X views,
  imports, no TLS directory, version resource) with a pinned llvm-mingw and runs the host test
  of the ring reader; the workflow caches the toolchain.
- App: a "Direct controller" switch under Controller > Device settings in the session menu,
  shown while the running game uses dd-directcontroller. It writes the mode file, so the game
  moves between the pad state and Wine's own xinput at once, and saves the choice for the game
  (DD_DIRECTCONTROLLER=0). A session deletes the mode file at start, so only a launch that uses
  dd-directcontroller brings the switch back. Translated in every language.


Review fixes: synchronized setting save; the DLL pins itself before its worker threads; pass-through forwards XInputPowerOffController; launch.sh keeps a native XInput DLL that is neither Wine's nor ours; switch requests run in order; XInputEnable reaches Wine's xinput when there is no rumble worker.
2026-12-06 04:16:37 -05:00
MaxsTechReview a8224c76a2 fix(components): pair native D3DX with its effect compilers (#3461) 2026-12-06 02:09:29 -05:00
DantalianandDantalian ed106ea840 fix(theme): pin the status bar black like the navigation bar (#3780)
Co-authored-by: Dantalian <Dantalian-dev@users.noreply.github.com>
2026-12-06 01:37:02 -05:00
The412Banner 96ae61541c fix(components): Match bundled .NET installers to their runtime
Detect modern .NET runtimes separately from .NET Framework and refresh cached detector results.
2026-12-06 01:06:57 -05:00
Tushar Gandhe a4751dacbe feat(settings): Keep search history and center opened settings
Recall recent Settings searches and bring the setting opened from search into view.
2026-12-06 00:34:44 -05:00
LunaDL f50691ebc9 fix(theme): Keep Inner Gamer animation from resetting screens
Keep the settings composition stable while the animated palette and speed change.
2026-12-06 00:03:11 -05:00
kalac2232 2ab642bf4e fix(session): Handle invalid filenames when trimming page cache
Walk files with NIO and skip unreadable entries. Keep page-cache trimming from interrupting session startup.
2026-12-05 23:34:33 -05:00
Kurt Himebauch cad55fc2b9 Keep adaptive sticks visible at rest
Separate adaptive stick capture from idle visibility and keep dock touch capture bounded.
2026-12-05 23:33:11 -05:00
Kurt Himebauch a02ea07386 ci: Fail main build on VirusTotal detections
Enable the existing fail_on_detection flag for the main APK scan.
2026-12-05 23:16:17 -05:00
Kurt Himebauch c1d6d425fa Exclude Android Native sleep from Steam playtime (#3777)
* Prepare Steam playtime before Android Native suspend

* Keep Steam wake recovery ordered and retry transient delivery

* Keep pending Steam wake recovery across idle requests

* Make Steam wake race tests wait on explicit gates

* Synchronize all Steam preparation timing tests
2026-12-05 22:58:01 -05:00
Kurt Himebauch 70be3d3eea Add a single-column Side strip HUD preset (#3783)
* Add a single-column Side strip HUD preset

* Keep only the 1% low in Side strip
2026-12-05 21:24:08 -05:00
MaxsTechReview f2206893d0 fix: Share logs includes Easy Anti-Cheat launcher logs from game prefixes (#3760)
* fix: Share logs includes Easy Anti-Cheat launcher logs from game prefixes

Anti-cheat launch failures only show the real error code in anticheatlauncher.log inside the game's compatdata prefix, which Share logs never collected. Recent .log files under each prefix's EasyAntiCheat folder are now added under anticheat/<appid>/ with high share priority.

* Keep only the anti-cheat app ID readable and keep launcher logs from every library

A numeric folder name is readable only as the app ID right under anticheat/; elsewhere it is hashed as before. Prefixes for the same app ID in a second library go under anticheat/<appid>/library<N>/ so neither log is dropped.

* Keep signed compatdata prefixes and mark unreadable ones as partial in Share logs

* Keep discovery records inside the manifest limit

* fix(logs): keep both prefix folders when signed and unsigned app ids collide

* fix(logs): give each anti-cheat prefix its own sibling folder in the archive

* fix(logs): share the current session's game logs before anti-cheat logs

* fix(logs): order enhanced exports by share priority and record denied anti-cheat folders
2026-12-05 20:42:07 -05:00
MaxsTechReviewandKurt Himebauch ce64f5ade4 fix(gog): create ISI savePath folders on first launch (#3452)
* fix(gog): create ISI savePath folders on first launch

* Use the existing case of GOG save folder roots

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
2026-12-05 20:29:55 -05:00
Kurt Himebauch c85e82683b Standardize native runtime defaults (#3779)
fix: standardize guest runtime defaults
2026-12-05 19:51:23 -05:00
LunaDLandKurt Himebauch 88d44b0dc6 Feat: Improve ARMv8.0 Steam compatibility with LSE emulation (#3720)
* feat: emulate LSE atomics so the Steam client starts on ARMv8.0 CPUs

* fix: keep NZCV across patched LSE min/max stubs and catch st* aliases

* fix: fail the LSE check when objdump fails

* fix: validate the CASP pair on a mismatch in the LSE emulator

* fix: sandboxes switch on the LSE emulator when it is preloaded

* fix: keep the MaliBridge pointer from main

* Handle LSE atomics before preload constructors

* Support early LSE handling in root guest processes

* Fix LSE-Emu signal and patching review findings

* Assert CASP and min/max sites use patched stubs

* Correct patch test statistics regexes

* Validate SIGILL syscall ABI and retain active state on restore failure

* Preserve the previous SIGILL disposition during early install

* Synchronize instruction fetch on generated LSE stubs

* Address LSE-Emu follow-up review findings

* Fix missing LSE signal handler state declarations

* Honor application signal mask when forwarding SIGILL

* Preserve SA_RESETHAND mask during handler forwarding

* Fix LSE opt-out after early handler install

* Avoid recursive SIGILL forwarding during LSE emulation

* Fix LSE SIGILL handler re-entry tracking

* Honor SA_NODEFER in forwarded SIGILL mask

* Preserve nested SIGILL delivery semantics

* Preserve explicit SIGILL mask with SA_NODEFER

* Reduce LSE patch contention across threads

* Guard nested faults before acquiring patch lock

* Fix early SIGILL restore and wake patch waiters

* Preserve libc restorer when restoring application SIGILL

* Wait for concurrent LSE patch instead of skipping

* Fix LSE patch lock release and fork recovery

* Avoid reinstalling the early SIGILL handler

* chore: retrigger CI

* Avoid proc maps reads in concurrent SIGILL patching

* Prevent late IFUNC handler install when emulation is disabled

* Clarify cached mapping lookup

* Move cached map declarations before find_gap

* Default LSE instruction patching to off

* Document conservative LSE emulation default

* Keep LSE instruction patching opt-in in sandbox preload

* Document default and opt-in LSE emulation checks

* Assert LSE patching remains opt-in in sandbox tests

* Align LSE device checks with SDK 34 patching behavior

* Check expected mprotect failures in opt-in device run

* Clarify LSE emulator device validation criteria

* Specify controlled SDK mprotect validation

* fix(lse-emu): publish SIGILL actions atomically

* fix(runtime): honor LSE_EMU=0 before preload

* test(runtime): keep LSE preload disabled when opted out

* fix(runtime): fully honor LSE_EMU=0 opt-out

* test(runtime): verify LSE opt-out removes inherited preload

* fix(runtime): filter inherited LSE preload without preload file

* fix(lse-emu): use bounded signal-safe action snapshots

* fix(runtime): split inherited preloads on spaces and colons

* test(runtime): cover both LSE preload entry orders

* fix(lse-emu): recycle displaced SIGILL snapshots

* fix(preload): preserve colliding path cache entries

* test(lse-emu): report patch failure details

* fix(lse-emu): serialize action snapshot publishers

* fix(lse-emu): fall back to reachable arena mapping

* fix(lse-emu): make signal action publication nonblocking

* refactor(lse-emu): remove obsolete publisher lock

* Fix SIGILL snapshot retirement and honor session LSE opt-out

* Preserve the Java staging API and isolate the SIGILL stress test

* fix(nativeguest): filter LSE preload when disabled

* fix(lse-emu): tighten seccomp and signal setup

* fix(session): preserve active LSE override while staging

* fix(lse-emu): return atomically displaced signal actions

* fix(lse-emu): stage raw signal masks safely

* fix(lse-emu): distinguish seccomp listener success

* fix(lse-emu): publish seccomp veto atomically

* fix(lse-emu): fail closed on RX restore errors

* fix(lse-emu): keep stack-using atomic stubs on trap path

* fix(lse-emu): allow patching with inherited seccomp

* test(lse-emu): cover LDAPR patch path

* test(lse-emu): assert LDAPR-only patching

* fix(nativeguest): filter disabled LSE from preload chains

* docs(lse-emu): define inherited seccomp patch policy

* fix(lse-emu): emulate LDAPR trap fallback

* refactor(lse-emu): remove unused seccomp query

* fix(nativeguest): release filtered preload chain in scope

* test(lse-emu): allow forwarded udf diagnostic

* fix(nativeguest): avoid unsafe preload fallback when disabled

* test(lse-emu): match full zero instruction field

* test(lse-emu): match complete instruction diagnostics

* Keep nested native preloads from duplicating host libraries

* fix(nativeguest): fail exec when disabled preload cannot map

* fix(nativeguest): stop exec when preload mapping fails

* fix(nativeguest): propagate preload filter allocation failures

* Consume only the selected one-shot SIGILL action

* Reclaim abandoned SIGILL action slots after fork

* Revalidate the live file mapping before optional LSE patching

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
2026-12-05 19:09:28 -05:00
153 changed files with 6616 additions and 537 deletions

No files matched your search

@@ -23,6 +23,11 @@ jobs:
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev \
libxcb1-dev libxcb-composite0-dev libglm-dev zstd
- name: llvm-mingw for dd-directcontroller
uses: actions/cache@v4
with:
path: ~/.cache/llvm-mingw-bylaws-20250920
key: llvm-mingw-bylaws-20250920-x86_64
- name: Build
run: |
set -euo pipefail
+4
View File
@@ -307,6 +307,9 @@ jobs:
aarch64-linux-gnu-gcc -O2 -Wall -o "$D/usr/local/bin/droiddeck-glprobe" tools/venus/glprobe.c -ldl
aarch64-linux-gnu-strip --strip-unneeded "$D/usr/local/bin/droiddeck-glprobe"
- name: Build the LSE atomics emulator for ARMv8.0 CPUs
run: bash tools/linuxfs/lse-emu/build.sh app/src/main/assets/linuxfs
- name: Check the preloads
run: |
set -euo pipefail
@@ -952,6 +955,7 @@ jobs:
with:
artifact: droiddeck-signed
variant: standard
fail_on_detection: true
secrets: inherit
packs:
@@ -64,6 +64,7 @@ import com.droiddeck.launcher.core.PhantomProcessStatus
import com.droiddeck.launcher.core.WirelessAdbFix
import com.droiddeck.launcher.core.WifiDiscovery
import com.droiddeck.launcher.core.SteamIntegration
import com.droiddeck.launcher.ui.SteamIntegrationFocusRequest
import com.droiddeck.launcher.core.WirelessAdbPairingService
import com.droiddeck.launcher.ui.CoreRow
import com.droiddeck.launcher.ui.PerformancePage
@@ -191,9 +192,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private var gamescopeRealtime by mutableStateOf(false)
private var paceCores by mutableStateOf(true)
private var gpuClockPin by mutableStateOf(false)
private var prootNoSeccomp by mutableStateOf(false)
private var prootFastPath by mutableStateOf(true)
private var nativeUserland by mutableStateOf(true)
private var desktopAsUser by mutableStateOf(false)
private var cursorComposite by mutableStateOf(true)
private var guestHostname by mutableStateOf(SessionPrefs.DEFAULT_GUEST_HOSTNAME)
@@ -242,7 +240,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private var wifiDiscoveryAsked by mutableStateOf(false)
private var wifiDiscoveryBlocked by mutableStateOf(false)
private var integrationState by mutableStateOf(SteamIntegration.State())
private var integrationFocus by mutableStateOf<SteamIntegration.Feature?>(null)
private var integrationFocus by mutableStateOf<SteamIntegrationFocusRequest?>(null)
private var pendingSessionLogExport: File? = null
private val wifiLocationReceiver = object : android.content.BroadcastReceiver() {
override fun onReceive(context: android.content.Context?, intent: Intent?) {
@@ -358,7 +356,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
SteamIntegration.dismissSuggestion(this)
refreshWifiDiscovery()
integrationState = readIntegration()
integrationFocus = feature
integrationFocus = SteamIntegrationFocusRequest(feature)
navRequest = "setup:integration"
}
@@ -1668,7 +1666,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
},
onSaveExport = { sg, layout -> exportSaves(sg.name, layout) { GameSaves.game(this@FrontEndActivity, sg) } },
onPerformance = { refreshCores(); showComponents = false; showMapping = false; showPerformance = true },
performancePanel = { PerformanceHost(embedded = true) },
performancePanel = { memory -> PerformanceHost(embedded = true, memory = memory) },
onRoms = { showRoms = true },
onFiles = { startActivity(Intent(this, com.droiddeck.launcher.files.FileManagerActivity::class.java)) },
onBrowseFiles = { dir ->
@@ -3114,7 +3112,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
}
@Composable
private fun PerformanceHost(embedded: Boolean = false) {
private fun PerformanceHost(embedded: Boolean = false, memory: @Composable () -> Unit = {}) {
if (embedded) androidx.compose.runtime.LaunchedEffect(Unit) { refreshCores() }
PerformancePage(
cores = CpuCores.all.map { c -> CoreRow(c, "cpu$c" + (CpuCores.maxGhz(c)?.let { String.format(java.util.Locale.US, " · %.1f GHz", it) } ?: "")) },
@@ -3125,7 +3123,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
fsyncFirst = fsyncFirst,
gamescopeRealtime = gamescopeRealtime,
gpuClockPin = gpuClockPin,
prootNoSeccomp = prootNoSeccomp, prootFastPath = prootFastPath, nativeUserland = nativeUserland, desktopAsUser = desktopAsUser, cursorComposite = cursorComposite,
nativeDesktopAvailable = com.droiddeck.launcher.runtime.NativeGuest.nextSession(this), desktopAsUser = desktopAsUser, cursorComposite = cursorComposite,
guestHostname = guestHostname, phantomWarning = phantomWarning,
onClientOverride = { on -> SessionPrefs.setClientCpusOverride(this, on); clientOverride = on },
onPaceCores = { on -> SessionPrefs.setPaceCores(this, on); paceCores = on },
@@ -3139,9 +3137,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
onFsyncFirst = { on -> SessionPrefs.setFsyncFirst(this, on); fsyncFirst = on },
onGamescopeRealtime = { on -> SessionPrefs.setGamescopeRealtime(this, on); gamescopeRealtime = on },
onGpuClockPin = { on -> SessionPrefs.setGpuClockPin(this, on); gpuClockPin = on },
onProotNoSeccomp = { on -> SessionPrefs.setProotNoSeccomp(this, on); prootNoSeccomp = on },
onProotFastPath = { on -> SessionPrefs.setProotFastPath(this, on); prootFastPath = on },
onNativeUserland = { on -> SessionPrefs.setNativeUserland(this, on); nativeUserland = on },
onDesktopAsUser = { on -> SessionPrefs.setDesktopAsUser(this, on); desktopAsUser = on },
onCursorComposite = { on -> SessionPrefs.setCursorComposite(this, on); cursorComposite = on },
onGuestHostname = { name -> SessionPrefs.setGuestHostname(this, name) },
@@ -3155,6 +3150,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
},
onDismiss = { showPerformance = false },
embedded = embedded,
memory = memory,
)
}
@@ -3464,9 +3460,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
gamescopeRealtime = SessionPrefs.gamescopeRealtime(this)
paceCores = SessionPrefs.paceCores(this)
gpuClockPin = SessionPrefs.gpuClockPin(this)
prootNoSeccomp = SessionPrefs.prootNoSeccomp(this)
prootFastPath = SessionPrefs.prootFastPath(this)
nativeUserland = SessionPrefs.nativeUserland(this)
desktopAsUser = SessionPrefs.desktopAsUser(this)
cursorComposite = SessionPrefs.cursorComposite(this)
guestHostname = SessionPrefs.guestHostname(this)
@@ -185,6 +185,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private var unfoldedControls by mutableStateOf(false)
private var unfoldedControlsWithController by mutableStateOf(false)
private var adaptiveSticks by mutableStateOf<Boolean?>(null)
private var directController by mutableStateOf<Boolean?>(null)
private var quickButtons by mutableStateOf<Map<InputCommand, Boolean>>(emptyMap())
private var picturePosition by mutableStateOf("center")
@@ -586,6 +587,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
drawerLayerOpen = false
drawerPinned = false
if (value) {
directController = com.droiddeck.launcher.session.DirectControllerSwitch.state(this)
releaseHeldKeys()
drawerXr = com.droiddeck.launcher.session.xr.XrPanels.showMenu()
drawerDocked = !drawerXr && dockDrawer() && openDockedMenu()
@@ -2140,6 +2142,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
primaryInputLayout?.let { com.droiddeck.launcher.input.InputLibraries.setAdaptiveSticks(this@SessionActivity, it.id, on) }
refreshInputProfile()
},
directController = directController,
onDirectController = { on ->
com.droiddeck.launcher.session.DirectControllerSwitch.set(this@SessionActivity, on)
directController = on
},
showFloatingSteamControls = SessionState.mode == SessionService.MODE_STEAM && SessionState.deckPad && unfoldedPanel == null &&
oscMode != SessionPrefs.OSC_NEVER && oscMode != SessionPrefs.OSC_STEAM_QAM &&
!steamTouchInUse && OnScreenLayout.supportsFloatingSteamControls(padType, primaryInputLayout),
@@ -3862,7 +3869,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
presentationFaultHint()?.let { return it }
if (log == null || !log.isFile) return null
return try {
var enosys = 0
var fexMissing = false
val size = log.length()
val text = java.io.RandomAccessFile(log, "r").use { f ->
@@ -3873,7 +3879,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
String(bytes, Charsets.ISO_8859_1)
}
text.lineSequence().forEach { line ->
if (line.contains("Function not implemented")) enosys++
if (line.contains(FEX_MISSING)) fexMissing = true
}
val steamSetup = com.droiddeck.launcher.session.SteamClientSetupFailure.find(text.lineSequence())
@@ -3895,9 +3900,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
} else if (fexMissing) {
val what = com.droiddeck.launcher.frontend.Library.nameForProgram(SessionState.program) ?: getString(R.string.session_end_program)
EndHint(getString(R.string.session_end_fex_missing, what), evenOnSuccess = true)
} else if (enosys >= 8) {
EndHint(resources.getQuantityString(R.plurals.session_hint_enosys, enosys, enosys,
getString(R.string.perf_title), getString(R.string.perf_seccomp), getString(R.string.perf_xalia)))
} else null
} catch (e: Exception) {
null
@@ -571,7 +571,6 @@ object AgentHost {
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
put("PROOT_LOADER", LinuxRuntime.prootLoader(app).path)
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(app).path)
if (SessionPrefs.prootNoSeccomp(app)) put("PROOT_NO_SECCOMP", "1")
LinuxRuntime.prootLibraryPath(app).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
}
}
@@ -14,8 +14,6 @@ object AgentNative {
fun run(context: Context, request: JSONObject, timeoutMs: Long): JSONObject {
val root = LinuxRuntime.rootDir(context)
com.droiddeck.launcher.session.SessionFiles.stage(context, root)
// with the setting off, staging leaves the rootfs as proot wants it
if (!com.droiddeck.launcher.session.SessionPrefs.nativeUserland(context)) NativeGuest.prepare(context, root)
if (!NativeGuest.available(root)) throw AgentException("NATIVE_UNAVAILABLE", "The rootfs has no native hook or glibc loader yet; start a session once")
val argvJson = request.optJSONArray("argv") ?: throw AgentException("INVALID_REQUEST", "argv is required")
val argv = (0 until argvJson.length()).map { argvJson.getString(it) }
@@ -0,0 +1,17 @@
package com.droiddeck.launcher.core
import java.io.File
object CpuFeatures {
internal fun lacksAtomics(cpuInfo: String): Boolean {
val cores = cpuInfo.lineSequence()
.filter { it.substringBefore(':').trim() == "Features" }
.map { it.substringAfter(':').trim().split(Regex("\\s+")) }
.toList()
return cores.isNotEmpty() && cores.any { "atomics" !in it }
}
val lacksAtomics: Boolean by lazy {
runCatching { lacksAtomics(File("/proc/cpuinfo").readText()) }.getOrDefault(false)
}
}
@@ -291,9 +291,12 @@ object DeviceReport {
k("Linux x86 (FEX)", if (com.droiddeck.launcher.runtime.LinuxFex.ready(context)) "ready" else "not set up")
k("gamescope realtime", SessionPrefs.gamescopeRealtime(context))
k("pace cores", SessionPrefs.paceCores(context))
k("proot without seccomp", SessionPrefs.prootNoSeccomp(context))
k("native userland (no proot)", SessionPrefs.nativeUserland(context))
k("proot fast path", SessionPrefs.prootFastPath(context))
k("guest runtime policy", "native preferred with PRoot fallback")
k("guest runtime", when (com.droiddeck.launcher.runtime.NativeGuest.sessionMode) {
true -> "native"
false -> "PRoot"
null -> if (com.droiddeck.launcher.runtime.NativeGuest.enabled(context)) "native available" else "native unavailable"
})
k("proot binary", LinuxRuntime.prootSource(context) + " " + LinuxRuntime.prootBinary(context).path)
k("proot fast path (eligible)", com.droiddeck.launcher.runtime.ProotFastPath.enabled(context))
k("Guest host name", SessionPrefs.guestHostname(context))
@@ -50,6 +50,17 @@ object GameEnvironment {
return withScopeValue(config, scope, NO_STEAM, if (on) "1" else null)
}
/** dd-directcontroller on DroidDeck-Bionic: "0" starts the game in pass-through (Wine's own xinput); unset = the pad state. */
const val DIRECT_CONTROLLER = "DD_DIRECTCONTROLLER"
fun gameDirectController(config: Config, scope: String): Boolean =
scope.isEmpty() || config.games[scope]?.get(DIRECT_CONTROLLER) != "0"
fun withGameDirectController(config: Config, scope: String, on: Boolean): Config {
require(scope.isNotEmpty() && validScope(scope))
return withScopeValue(config, scope, DIRECT_CONTROLLER, if (on) null else "0")
}
const val GAME_RESOLUTION = "DROIDDECK_GAME_RESOLUTION"
fun gameResolution(config: Config, scope: String): GameResolution.Choice? =
@@ -28,7 +28,8 @@ object AutoComponents {
else -> game.appId.takeIf { it > 0 }?.toString()
}
fun autoPicks(findings: List<WinCompSources.Finding>, catalog: Map<String, WinComponents.Component>): Map<String, WinComponents.AutoReason> {
fun autoPicks(findings: List<WinCompSources.Finding>, catalog: Map<String, WinComponents.Component>,
user: Map<String, Boolean> = emptyMap()): Map<String, WinComponents.AutoReason> {
val out = LinkedHashMap<String, WinComponents.AutoReason>()
for (f in findings) {
if (!f.auto || f.component == null) continue
@@ -37,6 +38,13 @@ object AutoComponents {
if (WinComponents.support(c, catalog) != WinComponents.Support.READY) continue
if (id !in out) out[id] = WinComponents.AutoReason(f.origin.name, listOf(f.original) + f.args)
}
if (user["d3dx9"] != false && (user["d3dx9"] == true || "d3dx9" in out)) {
val reason = out["d3dx9"] ?: WinComponents.AutoReason(WinCompSources.Origin.FOLDER.name, listOf("d3dx9"))
for (id in listOf("d3dcompiler_42", "d3dcompiler_43")) {
val c = catalog[id] ?: continue
if (WinComponents.support(c, catalog) == WinComponents.Support.READY) out.putIfAbsent(id, reason)
}
}
return out
}
@@ -228,8 +236,8 @@ object AutoComponents {
val findings = findings(context, game)
val refreshed = if (knownCatalog == null && asked && online(context)) catalogOf(context, true) else null
val catalog = knownCatalog ?: (refreshed ?: catalogOf(context, false) ?: catalogOf(context, true))?.associateBy { it.name } ?: return
val wanted = autoPicks(findings, catalog)
val user = WinComponents.selection(context, key).user
val wanted = autoPicks(findings, catalog, user)
val before = WinComponents.selection(context, key).auto
val installed = installedOf(context)
val kept = LinkedHashMap<String, WinComponents.AutoReason>()
@@ -373,7 +381,7 @@ object AutoComponents {
private const val FINDINGS = "wincomp-findings.json"
private const val DETECTORS = "d3"
private const val DETECTORS = "d4"
internal fun signature(context: Context, game: Library.SteamGame): String {
val folder = game.gameFiles
@@ -452,9 +460,9 @@ object AutoComponents {
}
return pendingSaved && pending.isEmpty()
}
val wanted = autoPicks(findings, catalog)
val selection = WinComponents.selection(context, key)
val user = selection.user
val wanted = autoPicks(findings, catalog, user)
val installed = installedOf(context)
val roots = selection.effective + wanted.keys.filter { user[it] != false }
val required = withParts(roots.filter { WinComponents.validId(it) }, catalog)
@@ -42,6 +42,7 @@ object DependencyDetector {
"dotnet45" to ".NET Framework 4.5", "dotnet452" to ".NET Framework 4.5.2",
"dotnet46" to ".NET Framework 4.6", "dotnet472" to ".NET Framework 4.7.2",
"dotnet48" to ".NET Framework 4.8", "dotnet35" to ".NET Framework 3.5",
"dotnetcoredesktop3" to ".NET Desktop 3", "dotnet50" to ".NET 5",
"dotnetcoredesktop6" to ".NET Desktop 6", "dotnetcoredesktop7" to ".NET Desktop 7",
"dotnetcoredesktop8" to ".NET Desktop 8",
)
@@ -50,7 +51,7 @@ object DependencyDetector {
"vcredist2005", "vcredist2008", "vcredist2010", "vcredist2012", "vcredist2013",
"vcredist2015", "vcredist2019", "vcredist2022",
"dotnet35", "dotnet40", "dotnet45", "dotnet452", "dotnet46", "dotnet472", "dotnet48",
"dotnetcoredesktop6", "dotnetcoredesktop7", "dotnetcoredesktop8",
"dotnetcoredesktop3", "dotnet50", "dotnetcoredesktop6", "dotnetcoredesktop7", "dotnetcoredesktop8",
"d3dx9", "d3dx11", "xact", "xact_x64", "xna31", "xna40", "physx", "oalinst", "XLiveRedist",
)
@@ -148,7 +149,7 @@ object DependencyDetector {
val comp = dotnetComponent("$path $name")
return when {
comp != null -> listOf(comp)
isDir -> emptyList()
isDir || CORE_RUNTIME.containsMatchIn(path) -> emptyList()
else -> listOf("dotnet48")
}
}
@@ -172,10 +173,20 @@ object DependencyDetector {
private val D3DX11_RE = Regex("""d3dx11_\d+\.dll""")
private val D3DCOMPILER_RE = Regex("""d3dcompiler_\d+\.dll""")
private fun dotnetComponent(s: String): String? = when {
s.contains("desktop-runtime-8") || Regex("""\b8\.\d""").containsMatchIn(s) -> "dotnetcoredesktop8"
s.contains("desktop-runtime-7") || Regex("""\b7\.\d""").containsMatchIn(s) -> "dotnetcoredesktop7"
s.contains("desktop-runtime-6") || Regex("""\b6\.\d""").containsMatchIn(s) -> "dotnetcoredesktop6"
private val CORE_RUNTIME = Regex("""(?:windowsdesktop|dotnet)-runtime-(\d+)\.""")
private val CORE_RUNTIMES = mapOf(
"3" to "dotnetcoredesktop3", "5" to "dotnet50", "6" to "dotnetcoredesktop6", "7" to "dotnetcoredesktop7", "8" to "dotnetcoredesktop8",
)
private fun dotnetComponent(s: String): String? {
CORE_RUNTIME.find(s)?.let { return CORE_RUNTIMES[it.groupValues[1]] }
return byVersion(s)
}
private fun byVersion(s: String): String? = when {
s.contains("desktop-runtime-8") || Regex("""(?<![\d.])8\.\d""").containsMatchIn(s) -> "dotnetcoredesktop8"
s.contains("desktop-runtime-7") || Regex("""(?<![\d.])7\.\d""").containsMatchIn(s) -> "dotnetcoredesktop7"
s.contains("desktop-runtime-6") || Regex("""(?<![\d.])6\.\d""").containsMatchIn(s) -> "dotnetcoredesktop6"
s.contains("ndp48") || s.contains("fx48") || s.contains("4.8") -> "dotnet48"
s.contains("ndp472") || s.contains("4.7.2") -> "dotnet472"
s.contains("ndp46") || s.contains("4.6") -> "dotnet46"
@@ -40,7 +40,8 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
PILL("pill", "Pill"),
MINIMAL("minimal", "Minimal"),
MEGA("mega", "Mega"),
STRIP("strip", "Strip");
STRIP("strip", "Strip"),
SIDE_STRIP("side_strip", "Side strip");
fun next(): DroidDeckHudSize {
val all = values()
@@ -96,6 +97,11 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
"showCPUUsage", "showTemp", "showVram", "showRAM", "showBattery", "showBatteryTemp", "showBatteryTime",
"showPower", "showDisplay", "showHdr", "showGpuModel",
),
SIDE_STRIP to listOf(
"showFPS", "showFPSGraph", "showAvg", "showLow1",
"showGPULoad", "showGpuTemp", "showCPUUsage", "showTemp", "showRAM", "showVram",
"showPower", "showBattery", "showBatteryTemp", "showBatteryTime",
),
)
@@ -110,6 +116,7 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
MEGA to DroidDeckHudStyle(row = 11.5f, unit = 11.5f * 0.62f, pad = 10f, lineGap = 3.5f, labelGap = 7f,
band = 9.5f, gutter = 16f),
STRIP to DroidDeckHudStyle(row = 11.5f, unit = 11.5f * 0.8f, pad = 10f, lineGap = 0f, labelGap = 13f),
SIDE_STRIP to DroidDeckHudStyle(row = 11.5f, unit = 9f, pad = 8f, lineGap = 4f, labelGap = 4f, key = 9f),
)
fun rowsFor(size: DroidDeckHudSize, values: Map<String, String>): List<String> =
@@ -573,6 +573,7 @@ class DroidDeckHudView(context: Context) : View(context) {
if (s == null) { contentW = 0f; contentH = 0f; return }
if (dock != DroidDeckHudDock.NONE) { buildDockTab(); return }
if (size == DroidDeckHudSize.STRIP) { buildStrip(s); return }
if (size == DroidDeckHudSize.SIDE_STRIP) { buildSideStrip(s); return }
buildRows(s)
if (contentW <= 0f || contentH <= 0f) return
if (size == DroidDeckHudSize.PILL) addSubtleClock(sp(10f), leftAligned = true)
@@ -684,8 +685,8 @@ class DroidDeckHudView(context: Context) : View(context) {
finishPanel(panel, halfRound = halfRound)
}
private fun finishPanel(panel: RectF, halfRound: Boolean) {
val r = if (halfRound) panel.height() / 2f else min(panel.height() / 2f, sp(56f))
private fun finishPanel(panel: RectF, halfRound: Boolean, maxRadius: Float = sp(56f), inset: Float = panelInset()) {
val r = if (halfRound) panel.height() / 2f else min(panel.height() / 2f, maxRadius)
val margin = outlineWidth() + sp(4f)
fun curveIn(top: Float, bottom: Float): Float {
val d = max(max(panel.top + r - top, bottom - (panel.bottom - r)), 0f)
@@ -703,8 +704,8 @@ class DroidDeckHudView(context: Context) : View(context) {
for (t in tileRects) right = max(right, t.right + curveIn(t.top, t.bottom) + margin)
panel.right = max(right, panel.left + sp(6f) + r)
dPanel = panel; dRadius = r
contentW = panel.right + panelInset()
contentH = panel.bottom + panelInset()
contentW = panel.right + inset
contentH = panel.bottom + inset
}
private fun clockTimeString(): String = DateFormat.getTimeFormat(context).format(Date())
@@ -936,6 +937,58 @@ class DroidDeckHudView(context: Context) : View(context) {
}
}
private fun buildSideStrip(s: HudMetrics.Snapshot) {
val style = size.style
val inset = sp(5f)
val panelWidth = sp(86f)
val pad = sp(style.pad)
val left = inset + pad
val right = inset + panelWidth - pad
val markHeight = sp(12f)
val markTop = inset + sp(6f)
val markLeft = left - DroidDeckMark.inkLeftFor(markHeight)
headerMark = RectF(markLeft, markTop, markLeft + DroidDeckMark.widthFor(markHeight), markTop + markHeight)
dDividerTop = markTop + markHeight + sp(6f)
if (showClockTime) {
val clock = clockTimeString()
val clockPx = sp(8.5f)
val clockWidth = measure(clock, clockPx)
if (right - clockWidth >= markLeft + DroidDeckMark.inkRightFor(markHeight) + sp(4f)) {
val baseline = markTop + (markHeight + capHeight(clockPx)) / 2f
glyphs.add(Glyph(right - clockWidth, baseline, clock, blend(colDim), clockPx))
}
}
val labelPx = sp(style.key)
val rowPx = sp(style.row)
val unitPx = sp(style.unit)
val lineGap = sp(style.lineGap)
var y = dDividerTop + sp(6f)
for (key in size.rowsIn(storedOrder)) {
if (!switchOn(key)) continue
if (key == "showFPSGraph") {
val height = sp(15f)
graphRect = RectF(left, y, right, y + height)
y += height + lineGap
continue
}
val valuePx = if (key == "showFPS") sp(16f) else rowPx
val row = reading(key, s, labelPx, valuePx, unitPx)
val available = right - left - measure(row.label.text, labelPx) - sp(style.labelGap)
val fit = (available / runWidth(row.vals)).coerceIn(0f, 1f)
val values = row.vals.map { Span(it.text, it.color, it.sizePx * fit, it.glow) }
val baseline = y - ascent(valuePx)
placeRun(left, baseline, listOf(row.label))
placeRun(right - runWidth(values), baseline, values)
y += lineH(valuePx) + lineGap
}
val panel = RectF(inset, inset, inset + panelWidth, y + sp(7f))
finishPanel(panel, halfRound = false, maxRadius = sp(11f), inset = inset)
}
private fun buildStrip(s: HudMetrics.Snapshot) {
val rowPx = sp(11.5f); val unitPx = rowPx * 0.8f; val fpsPx = sp(15f)
val padX = sp(10f); val groupGap = sp(13f)
@@ -156,7 +156,13 @@ object InputLibraries {
update(context) { library ->
library.copy(layouts = library.layouts.map { layout ->
if (layout.id != layoutId || !layout.editable) layout
else layout.copy(elements = layout.elements.map { if (it.kind == InputElementKind.STICK) it.copy(floating = on, hideWhenIdle = on) else it })
else {
fun updateSticks(elements: List<InputSurfaceElement>) = elements.map {
if (it.kind == InputElementKind.STICK) it.copy(floating = on, hideWhenIdle = it.hideStickAtRest, adaptiveCapture = on)
else it
}
layout.copy(elements = updateSticks(layout.elements), rotated = updateSticks(layout.rotated))
}
})
}
}.onSuccess { ControllerPrefs.setAdaptiveSticks(context, on) }.isSuccess
@@ -328,7 +334,8 @@ object InputLibraries {
for (e in list) elements.put(JSONObject().put("id", e.id).put("kind", e.kind.name)
.put("control", e.control.id).put("name", e.name).put("x", e.x.toDouble()).put("y", e.y.toDouble())
.put("width", e.width.toDouble()).put("height", e.height.toDouble()).put("floating", e.floating).put("hideWhenIdle", e.hideWhenIdle).put("mouseGestures", e.mouseGestures).put("toggle", e.toggle).put("icon", e.icon).put("image", e.image)
.put("elementOpacity", e.opacity.toDouble()).put("buttonShape", e.buttonShape.name).put("showLabel", e.showLabel).put("alwaysShown", e.alwaysShown))
.put("elementOpacity", e.opacity.toDouble()).put("buttonShape", e.buttonShape.name).put("showLabel", e.showLabel).put("alwaysShown", e.alwaysShown)
.put("adaptiveCapture", e.adaptiveCapture))
}
private fun decodeElements(array: JSONArray) = array.objects(64).map { e ->
@@ -336,7 +343,8 @@ object InputLibraries {
e.getDouble("y").toFloat(), e.getDouble("width").toFloat(), e.getDouble("height").toFloat(),
e.getString("id"), InputElementKind.valueOf(e.getString("kind")), e.getString("name"),
e.optBoolean("floating", true), e.optBoolean("hideWhenIdle", false), e.optBoolean("mouseGestures", false), e.optBoolean("toggle", false), e.optInt("icon", 0), e.optString("image", ""),
e.optDouble("elementOpacity", 1.0).toFloat(), InputButtonShape.valueOf(e.optString("buttonShape", InputButtonShape.ROUNDED.name)), e.optBoolean("showLabel", true), e.optBoolean("alwaysShown", false))
e.optDouble("elementOpacity", 1.0).toFloat(), InputButtonShape.valueOf(e.optString("buttonShape", InputButtonShape.ROUNDED.name)), e.optBoolean("showLabel", true), e.optBoolean("alwaysShown", false),
if (e.isNull("adaptiveCapture")) null else e.optBoolean("adaptiveCapture", false))
}
internal fun encode(library: InputLibrary): String {
@@ -32,7 +32,7 @@ data class SavedInputLayout(
fun withQuickButton(button: InputCommand, shown: Boolean) =
copy(style = style.copy(hidden = if (shown) style.hidden - button else style.hidden + button))
fun derived(id: String, name: String) = copy(id = id, name = name, origin = origin ?: this.id)
val adaptiveSticks get() = elements.filter { it.kind == InputElementKind.STICK }.takeIf { editable && it.isNotEmpty() }?.all { it.floating && it.hideWhenIdle }
val adaptiveSticks get() = elements.filter { it.kind == InputElementKind.STICK }.takeIf { editable && it.isNotEmpty() }?.all { it.adaptiveStick }
fun supports(role: InputRole) = screen.supports(role) && when (template) {
InputLayoutTemplate.OVERLAY -> role == InputRole.PRIMARY
InputLayoutTemplate.DECK, InputLayoutTemplate.TRACKPAD -> role == InputRole.SECONDARY
@@ -37,7 +37,12 @@ data class InputSurfaceElement(
val buttonShape: InputButtonShape = InputButtonShape.ROUNDED,
val showLabel: Boolean = true,
val alwaysShown: Boolean = false,
val adaptiveCapture: Boolean? = null,
) {
// Old layouts encoded Adaptive sticks as Floating + Hide when idle.
val adaptiveStick get() = kind == InputElementKind.STICK && floating && (adaptiveCapture ?: hideWhenIdle)
val hideStickAtRest get() = hideWhenIdle && (adaptiveCapture != null || !adaptiveStick)
val hasClick get() = kind == InputElementKind.STICK || kind == InputElementKind.TRACKPAD
fun bounded() = copy(x = x.coerceIn(0f, 0.97f), y = y.coerceIn(0f, 0.97f),
@@ -188,7 +188,7 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
settings.mapping[it.id] != ControllerPrefs.OFF && (it.id != "guide" || settings.steamButton) && (it.id != "qam" || settings.qamButton)
}.map { c ->
InputSurfaceElement(requireNotNull(InputControl.fromId(c.id)), (c.cx - c.halfW) / width, (c.cy - c.halfH) / height,
2 * c.halfW / width, 2 * c.halfH / height, floating = settings.adaptiveSticks, hideWhenIdle = c.stick >= 0 && settings.adaptiveSticks,
2 * c.halfW / width, 2 * c.halfH / height, floating = settings.adaptiveSticks, adaptiveCapture = if (c.stick >= 0) settings.adaptiveSticks else null,
buttonShape = if (c.id in shoulderIds) InputButtonShape.PILL else InputButtonShape.CIRCLE).let { if (previousStickGeometry) widenStickPreviously(it) else widenStick(it) }.bounded()
}.toMutableList()
if (settings.keyboardButton) result += keyboard()
@@ -37,8 +37,10 @@ object OnScreenLayout {
buttonsOnly: Boolean = false, dock: Dock? = null, rearButtons: Boolean? = null,
trackpads: Boolean? = null): List<InputSurfaceElement> {
val placed = placeElements(context, saved, width, height, safe, buttonsOnly, dock, rearButtons, trackpads)
// Below the game a stick covers nothing, so it keeps its base in view instead of appearing only under the thumb.
return if (dock == null) placed else placed.map { if (it.kind == InputElementKind.STICK) it.copy(hideWhenIdle = false) else it }
// Docked sticks stay visible and only pick up touches inside their own bounds.
return if (dock == null) placed else placed.map {
if (it.kind == InputElementKind.STICK) it.copy(hideWhenIdle = false, adaptiveCapture = false) else it
}
}
private fun placeElements(context: Context, saved: SavedInputLayout?, width: Int, height: Int, safe: Rect,
@@ -288,12 +288,26 @@ object BwrapSpawner {
}
private fun preload(session: List<Bind>, rootfs: String, env: MutableMap<String, String>): List<Bind> {
val libs = FileUtils.readString(File(rootfs, "etc/ld.so.preload"))?.lines()
?.map { it.trim() }?.filter { it.startsWith("/") && File(rootfs + it).isFile } ?: return emptyList()
if (libs.isEmpty()) return emptyList()
val configured = FileUtils.readString(File(rootfs, "etc/ld.so.preload"))?.lines()
?.map { it.trim() }?.filter { it.startsWith("/") && File(rootfs + it).isFile } ?: emptyList()
val lseDisabled = env["LSE_EMU"] == "0"
val libs = configured.filterNot { lseDisabled && it.endsWith("/liblse_emu.so") }
val inherited = env["LD_PRELOAD"]?.split(Regex("[\\s:]+"))
?.filter { it.isNotEmpty() && !(lseDisabled && it.substringAfterLast('/') == "liblse_emu.so") }
?: emptyList()
if (libs.isEmpty()) {
if (lseDisabled) {
if (inherited.isEmpty()) env.remove("LD_PRELOAD")
else env["LD_PRELOAD"] = inherited.joinToString(":")
}
return emptyList()
}
val binds = ArrayList<Bind>()
val paths = libs.map { lib -> "$PRELOAD_DIR/${lib.substringAfterLast('/')}".also { binds.add(Bind(rootfs + lib, it)) } }
env["LD_PRELOAD"] = (paths + listOfNotNull(env["LD_PRELOAD"]?.takeIf { it.isNotBlank() })).joinToString(":")
env["LD_PRELOAD"] = (paths + inherited).joinToString(":")
if (libs.any { it.endsWith("/liblse_emu.so") }) {
env.putIfAbsent("LSE_EMU", "1")
}
File(rootfs, NET_LINK).takeIf { it.isFile }?.let { binds.add(Bind(it.path, "/$NET_LINK")) }
env["FAKE_EVDEV_DIR"]?.let { File(it).parent }?.let { dev ->
binds.addAll(bindsFor(session, rootfs, dev, dev))
@@ -563,12 +577,15 @@ object BwrapSpawner {
private fun run(context: Context, plan: Plan, client: LocalSocket, out: DataOutputStream, id: Int) {
val verbose = plan.env["DROIDDECK_PROOT_VERBOSE"]?.toIntOrNull()
val native = if (NativeGuest.forSession(context)) nativeLaunch(context, plan) else null
val nativeSession = NativeGuest.forSession(context)
val native = if (nativeSession) nativeLaunch(context, plan) else null
val builder = if (native != null) {
ProcessBuilder(native.first).redirectErrorStream(true)
.directory(File(hostPath(plan.binds, plan.root.path, plan.cwd)).takeIf { it.isDirectory } ?: plan.root)
.also { b -> b.environment().apply { clear(); putAll(native.second) } }
} else {
val reason = if (nativeSession) "sandbox native launch unavailable" else "parent guest uses PRoot"
Log.i(TAG, "Flatpak: using PRoot ($reason)")
val cmd = LinuxRuntime.prootPrefix(context, plan.root, plan.cwd)
if (verbose != null) { cmd.add("-v"); cmd.add(verbose.toString()) }
plan.binds.forEach { cmd.add("-b"); cmd.add(it.spec) }
@@ -585,7 +602,6 @@ object BwrapSpawner {
putAll(prootEnvironment(plan, envTool))
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
}
}
@@ -6,7 +6,6 @@ import com.droiddeck.launcher.core.HostProcess
import com.droiddeck.launcher.session.OrphanReaper
import com.droiddeck.launcher.session.SessionFiles
import com.droiddeck.launcher.session.SessionPaths
import com.droiddeck.launcher.session.SessionPrefs
import java.io.File
import java.util.concurrent.atomic.AtomicBoolean
@@ -67,7 +66,6 @@ object GuestCommand {
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
if (linkDir != null) put("PROOT_L2S_DIR", linkDir.path)
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (k, v) -> put(k, v) } }
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
}
@@ -22,15 +22,15 @@ object NativeGuest {
}
fun enabled(context: Context): Boolean =
SessionPrefs.nativeUserland(context) && available(LinuxRuntime.rootDir(context))
available(LinuxRuntime.rootDir(context))
/**
* Whether the next session will start natively. The session stages the hook from the APK before
* it starts, so only the setting and the rootfs's loader decide, and a runtime still to be
* it starts, so the rootfs's loader decides, and a runtime still to be
* installed will have one.
*/
fun nextSession(context: Context): Boolean =
SessionPrefs.nativeUserland(context) && willRun(LinuxRuntime.rootDir(context), LinuxRuntime.isInstalled(context))
willRun(LinuxRuntime.rootDir(context), LinuxRuntime.isInstalled(context))
internal fun willRun(root: File, installed: Boolean): Boolean = !installed || loader(root) != null
@@ -39,7 +39,7 @@ object NativeGuest {
/**
* Whether a session's helpers (root commands, Flatpak sandboxes, installers) run natively: the
* session's own mode while one runs, as the setting can change under it and the rootfs is only
* session's own mode while one runs, as the rootfs is only
* prepared for native programs at a session's start.
*/
fun forSession(context: Context): Boolean = sessionMode ?: enabled(context)
@@ -104,8 +104,11 @@ object NativeGuest {
private fun hostProgram(root: File, program: String): File = File(root, program.removePrefix("/"))
/** The environment of the session process: the hook's root, the mounts proot used to make, the preload list. */
fun sessionEnvironment(root: File, binds: List<String>, program: String, hostname: String? = null): Map<String, String> {
val preload = preloadList(root)
fun sessionEnvironment(
root: File, binds: List<String>, program: String, hostname: String? = null, lseEmu: String? = null,
): Map<String, String> {
val preload = preloadList(root).filterNot { lseEmu == "0" && it.substringAfterLast('/') == "liblse_emu.so" }
val lse = lseEmu ?: "1".takeIf { preload.any { it.substringAfterLast('/') == "liblse_emu.so" } }
return linkedMapOf(
"DDNATV_ROOT" to root.path,
"DDNATV_EXEC" to execLoader.orEmpty(),
@@ -113,6 +116,7 @@ object NativeGuest {
"DDNATV_HOSTNAME" to hostname.orEmpty(),
"DDNATV_BINDS" to binds.joinToString("|") { if (it.contains(':')) it else "$it:$it" },
"DDNATV_PRELOAD" to preload.joinToString(":"),
"LSE_EMU" to lse.orEmpty(),
"LD_PRELOAD" to (preload.map { File(root, it.removePrefix("/")).path } + hook(root).path).joinToString(":"),
).filterValues { it.isNotEmpty() }
}
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.runtime
import android.content.Context
import android.os.Build
import android.util.Log
import com.droiddeck.launcher.session.SessionPrefs
import java.io.File
import java.security.MessageDigest
@@ -12,17 +11,14 @@ object ProotFastPath {
const val LIBRARY = "/usr/local/lib/libddfastpath.so"
const val MAX_BINDS = 256
fun allows(preference: Boolean, noSeccomp: Boolean, source: String, nativeUserland: Boolean = false): Boolean =
preference && !noSeccomp && !nativeUserland && source == LinuxRuntime.PROOT_PACK
internal fun allows(source: String, native: Boolean): Boolean =
!native && source == LinuxRuntime.PROOT_PACK
fun enabled(context: Context): Boolean {
val preference = SessionPrefs.prootFastPath(context)
val noSeccomp = SessionPrefs.prootNoSeccomp(context)
val nativeUserland = SessionPrefs.nativeUserland(context)
fun enabled(context: Context, native: Boolean = NativeGuest.forSession(context)): Boolean {
if (native) return false
val source = LinuxRuntime.prootSource(context)
val on = allows(preference, noSeccomp, source, nativeUserland)
if (preference && !noSeccomp && !nativeUserland && !on)
Log.i(TAG, "proot: fast path off - binary is $source, not the patched proot")
val on = allows(source, native)
if (!on) Log.i(TAG, "proot: fast path off - binary is $source, not the patched proot")
return on
}
@@ -8,7 +8,6 @@ import android.os.Process
import android.util.Log
import com.droiddeck.launcher.core.HostProcess
import com.droiddeck.launcher.session.OrphanReaper
import com.droiddeck.launcher.session.SessionPrefs
import org.json.JSONObject
import java.io.DataInputStream
import java.io.DataOutputStream
@@ -128,7 +127,6 @@ object RootSpawner {
clear()
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
}
}
@@ -343,7 +343,8 @@ object BottomDesktop {
LinuxRuntime.commandWithBinds(context, current.root, binds, guest)
}
val environment = if (current.nativeUserland) {
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, guest.first(), SessionPrefs.guestHostname(context))
val lseEmu = current.guest.lastOrNull { it.startsWith("LSE_EMU=") }?.substringAfter('=')
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, guest.first(), SessionPrefs.guestHostname(context), lseEmu)
.map { (k, v) -> "$k=$v" }.toTypedArray()
} else current.hostEnvironment
val line = command.joinToString(" ") { it.replace("\\", "\\\\").replace(" ", "\\ ") }
@@ -0,0 +1,46 @@
package com.droiddeck.launcher.session
import android.content.Context
import com.droiddeck.launcher.core.GameEnvironment
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
/**
* dd-directcontroller's mode file. DroidDeck-Bionic's launch.sh writes it beside the controller folder when a game set to start
* without Steam reads XInput through dd-directcontroller; the game's DLLs read it while it runs ('1' the pad state, '0' Wine's own
* xinput). No file = the session's game does not use dd-directcontroller.
*/
object DirectControllerSwitch {
const val FILE = "dd-directcontroller.mode"
fun file(context: Context): File = File(LinuxRuntime.sessionRoot(context), "dev/$FILE")
/** The running game's mode, or null when it does not use dd-directcontroller. */
fun state(context: Context): Boolean? = runCatching {
when (file(context).takeIf { it.isFile }?.readText()?.trim()) {
"1" -> true
"0" -> false
else -> null
}
}.getOrNull()
/** One request after another, in call order: the last switch sets both the live mode and the saved choice. */
private val queue = java.util.concurrent.Executors.newSingleThreadExecutor { Thread(it, "dd-directcontroller") }
/** Switches the running game now and remembers the choice for its next start. */
fun set(context: Context, on: Boolean) {
val app = context.applicationContext
queue.execute {
runCatching { file(app).takeIf { it.isFile }?.writeText(if (on) "1\n" else "0\n") }
val scope = NoSteamLaunch.scopeOf(SessionState.program, SessionState.programArgs) { NoSteamLaunch.battleNetTitleScope(app, it) }
if (!scope.isNullOrEmpty() && GameEnvironment.validScope(scope)) runCatching {
GameEnvironmentStore.setGameDirectController(app, scope, on)
}
}
}
/** A session starts without the file: only a launch that uses dd-directcontroller writes it again. */
fun clear(context: Context) {
file(context).delete()
}
}
@@ -5,6 +5,7 @@ import android.os.ParcelFileDescriptor
import android.system.Os
import android.system.OsConstants
import com.droiddeck.launcher.core.LogRedactor
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.runtime.BattleNet
import com.droiddeck.launcher.runtime.LinuxRuntime
import org.json.JSONArray
@@ -25,6 +26,7 @@ import java.nio.channels.SeekableByteChannel
import java.nio.file.FileVisitResult
import java.nio.file.Files
import java.nio.file.LinkOption
import java.nio.file.NoSuchFileException
import java.nio.file.Path
import java.nio.file.SimpleFileVisitor
import java.nio.file.StandardOpenOption
@@ -221,7 +223,7 @@ internal object EnhancedSessionLogShare {
Category.values().map { category ->
val budget = budgets.getValue(category)
val records = ArrayList<Record>()
val selected = candidates.filter { it.category == category }
val selected = candidates.filter { it.category == category }.sortedBy(::sharePriority)
val zip = File(out, "DroidDeck-${folder.name}-${category.suffix}.zip")
ZipOutputStream(zip.outputStream().buffered()).use { archive ->
val names = HashSet<String>()
@@ -616,7 +618,8 @@ internal object EnhancedSessionLogShare {
redactionLearningComplete: Boolean,
) {
val entries = JSONArray()
records.take(MAX_MANIFEST_RECORDS).forEach { record ->
val (discovery, rest) = records.partition { it.origin == "discovery" }
(discovery + rest).take(MAX_MANIFEST_RECORDS).forEach { record ->
entries.put(JSONObject().apply {
put("entry", record.entry)
put("origin", record.origin)
@@ -680,6 +683,15 @@ internal object EnhancedSessionLogShare {
categoryCounts[category] = (categoryCounts[category] ?: 0) + 1
}
}
fun addRecentLogs(root: File, entryPrefix: String, origin: String) {
val scan = walk(root, remaining(maxFiles, out.size))
truncated = truncated || scan.truncated
partial = partial || scan.partial
val base = root.toPath().toAbsolutePath().normalize()
scan.files.asSequence().filter { recent(it) && it.name.endsWith(".log", true) }.forEach { file ->
add(file, root, "$entryPrefix/${base.relativize(file.toPath().toAbsolutePath().normalize()).joinToString("/")}", origin)
}
}
CRITICAL_SESSION_FILES.forEach { name ->
File(folder, name).takeIf { it.exists() }?.let { add(it, folder, "${folder.name}/$name", "session-critical") }
}
@@ -713,16 +725,7 @@ internal object EnhancedSessionLogShare {
add(source.file, source.root, source.entry, "battlenet")
}
} else {
battleNetRoots(context).forEach { (prefix, root) ->
val scan = walk(root, remaining(maxFiles, out.size))
truncated = truncated || scan.truncated
partial = partial || scan.partial
scan.files.asSequence().filter { recent(it) && it.name.endsWith(".log", true) }
.forEach { file ->
val relative = root.toPath().toAbsolutePath().normalize().relativize(file.toPath().toAbsolutePath().normalize()).joinToString("/")
add(file, root, "battlenet/$prefix/$relative", "battlenet")
}
}
battleNetRoots(context).forEach { (prefix, root) -> addRecentLogs(root, "battlenet/$prefix", "battlenet") }
}
val sessionScan = walk(folder, remaining(maxFiles, out.size))
truncated = truncated || sessionScan.truncated
@@ -733,6 +736,9 @@ internal object EnhancedSessionLogShare {
if (relative == EnhancedDiagnostics.MANIFEST_FILE) return@forEach
add(file, folder, "${folder.name}/$relative", "session")
}
val antiCheat = antiCheatRoots(context)
partial = partial || antiCheat.partial
antiCheat.roots.forEach { (appId, root) -> addRecentLogs(root, "anticheat/$appId", "anticheat") }
if (SessionPaths.current()?.canonicalFile == folder.canonicalFile && !File(folder, "steam").exists()) {
val steam = File(SessionPrefs.activeSteamRoot(context), "logs")
val scan = directFiles(steam, remaining(maxFiles, out.size))
@@ -748,7 +754,8 @@ internal object EnhancedSessionLogShare {
private fun sharePriority(candidate: Candidate): Int = when {
candidate.origin == "session-critical" -> 0
candidate.origin == "session" && candidate.category == Category.GAMES -> 1
else -> 2
candidate.origin == "anticheat" -> 2
else -> 3
}
private fun remaining(maxFiles: Int, found: Int): Int = (maxFiles - found + 1).coerceAtLeast(0)
@@ -822,6 +829,39 @@ internal object EnhancedSessionLogShare {
return ScanResult(files, truncated, partial)
}
private class AntiCheatRoots(val roots: List<Pair<String, File>>, val partial: Boolean)
private fun antiCheatRoots(context: Context): AntiCheatRoots {
var partial = false
val seen = HashSet<String>()
val dirs = runCatching { Library.compatdataDirs(context) }.getOrElse { partial = true; emptyList() }
val roots = dirs.flatMapIndexed { library, compatdata ->
val prefixes = compatdata.listFiles() ?: run { partial = true; emptyArray() }
prefixes.filter { !Files.isSymbolicLink(it.toPath()) }.mapNotNull { prefix ->
val appId = steamAppId(prefix.name) ?: return@mapNotNull null
val root = File(prefix, EAC_LOG_DIR)
val directory = try {
Files.readAttributes(root.toPath(), BasicFileAttributes::class.java, LinkOption.NOFOLLOW_LINKS).isDirectory
} catch (_: NoSuchFileException) {
false
} catch (_: Exception) {
partial = true
false
}
if (!directory) return@mapNotNull null
val base = "$appId/library${library + 1}"
val key = base.takeIf { seen.add(it) } ?: "$base-${prefix.name}".takeIf { seen.add(it) }
if (key != null) key to root else { partial = true; null }
}
}
return AntiCheatRoots(roots, partial)
}
private fun steamAppId(name: String): String? =
name.takeIf { SIGNED_APP_ID.matches(it) }?.toLongOrNull()
?.takeIf { it in Int.MIN_VALUE.toLong()..0xffffffffL }
?.let { (it and 0xffffffffL).toString() }
private fun battleNetRoots(context: Context): List<Pair<String, File>> {
val drive = File(BattleNet.prefix(context), "pfx/drive_c")
val data = File(drive, "ProgramData/Battle.net")
@@ -928,7 +968,9 @@ internal object EnhancedSessionLogShare {
val normalized = name.replace('\\', '/').trimStart('/')
val parts = normalized.split('/')
if (normalized.isEmpty() || parts.any { it.isEmpty() || it == "." || it == ".." }) return null
return parts.joinToString("/") { safeComponent(it) }
return parts.mapIndexed { index, part ->
if (index == 1 && parts[0] == "anticheat" && APP_ID.matches(part)) part else safeComponent(part)
}.joinToString("/")
}
private fun safeComponent(value: String): String {
@@ -941,7 +983,7 @@ internal object EnhancedSessionLogShare {
private fun category(entry: String): Category {
val value = entry.lowercase(Locale.US)
if (value.startsWith("battlenet/") || value.startsWith("stores/") || value.startsWith("tools/") || value.startsWith("rpcs3/") ||
if (value.startsWith("battlenet/") || value.startsWith("anticheat/") || value.startsWith("stores/") || value.startsWith("tools/") || value.startsWith("rpcs3/") ||
value.contains("droiddeck-esync/") || GAME_LOG.matches(value.substringAfterLast('/')) ||
listOf("proton", "wine", "dxvk", "vkd3d", "battle.net", "game-debug", "bionic").any(value::contains)) return Category.GAMES
if (listOf("wayland", "gamescope", "xwayland", "vulkan", "gpu", "mesa", "egl", "glx", "drm", "compositor", "frame-trace").any(value::contains)) return Category.GRAPHICS
@@ -950,7 +992,7 @@ internal object EnhancedSessionLogShare {
private val GAME_LOG = Regex("steam-[0-9]+\\.(log|txt)")
private val KNOWN_COMPONENTS = setOf(
"steam", "graphics", "games", "battlenet", "client", "agent", "setup", "stores", "tools",
"steam", "graphics", "games", "battlenet", "anticheat", "anticheatlauncher.log", "client", "agent", "setup", "stores", "tools",
"droiddeck", "droiddeck-esync", "session.log", "app.log", "wayland.log", "audio.log",
"device.txt", "network.txt", "events.jsonl", "memory.csv", "capture.json", "crash.log",
"frame-trace.log", "process-trace.log", "game-lifecycle.log", "launches.log", "tools.tsv", "wanted.tsv", "prefixes.json",
@@ -961,11 +1003,15 @@ internal object EnhancedSessionLogShare {
private val KNOWN_COMPONENT_PATTERNS = listOf(
Regex("[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2,}-[a-z0-9-]{1,24}"),
Regex("steam-[0-9]+\\.(?:log|txt)"),
Regex("library[0-9]+(?:--?[0-9]{1,10})?"),
Regex("(?:battle\\.net-[0-9]+|battle\\.net-setup-[0-9]+|Agent-[0-9]+)\\.log"),
Regex("(?:Agent\\.[0-9]+|bna_[0-9]+)"),
Regex("stores-[0-9]{4}-[0-9]{2}-[0-9]{2}\\.log"),
Regex("library[0-9]{1,3}"),
Regex("entry-[0-9a-f]{16}(?:\\.[a-z0-9]{1,8})?"),
)
private val APP_ID = Regex("[0-9]{1,10}")
private val SIGNED_APP_ID = Regex("-?[0-9]{1,10}")
private val SAFE_SUFFIX = Regex("\\.[A-Za-z0-9]{1,8}$")
private val CRITICAL_SESSION_FILES = listOf(
"session.log", "app.log", "wayland.log", "audio.log", "device.txt", "network.txt",
@@ -973,6 +1019,7 @@ internal object EnhancedSessionLogShare {
)
private const val RECENT_MILLIS = 7L * 24 * 60 * 60 * 1000
private const val STORE_LOG_SCAN = 512
private const val EAC_LOG_DIR = "pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat"
private const val COPY_BUFFER_BYTES = 64 * 1024
private const val TRACE_SCAN_BYTES = 16L * 1024 * 1024
private const val LEGACY_LOG_MAX_BYTES = 8L * 1024 * 1024
@@ -91,6 +91,13 @@ object GameEnvironmentStore {
return config
}
@Synchronized
fun setGameDirectController(context: Context, scope: String, on: Boolean): GameEnvironment.Config {
val config = GameEnvironment.withGameDirectController(read(context), scope, on)
save(context, config)
return config
}
@Synchronized
fun setGameResolution(context: Context, scope: String, choice: com.droiddeck.launcher.core.GameResolution.Choice?): GameEnvironment.Config {
val config = GameEnvironment.withGameResolution(read(context), scope, choice)
@@ -2,10 +2,16 @@ package com.droiddeck.launcher.session
import android.util.Log
import java.io.File
import java.io.IOException
import java.nio.file.FileVisitResult
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.SimpleFileVisitor
import java.nio.file.attribute.BasicFileAttributes
internal object PageCacheTrim {
private const val TAG = "PageCacheTrim"
private const val MIN_FILE_BYTES = 8L shl 20
internal const val MIN_FILE_BYTES = 8L shl 20
private const val POLL_MS = 3000L
private const val RESCAN_MS = 120_000L
@@ -37,7 +43,7 @@ internal object PageCacheTrim {
if (mem != null && shouldTrim(mem, baseline)) {
val now = System.currentTimeMillis()
if (now - scanned > RESCAN_MS) {
files = roots().flatMap { root -> root.walkTopDown().onEnter { !java.nio.file.Files.isSymbolicLink(it.toPath()) }.filter { it.isFile && it.length() >= MIN_FILE_BYTES }.toList() }
files = roots().flatMap { root -> bigFiles(root) }
scanned = now
}
val began = System.nanoTime()
@@ -56,6 +62,34 @@ internal object PageCacheTrim {
}, "page-cache-trim").apply { isDaemon = true }.start()
}
// java.io's directory listing hands raw entry names to JNI NewStringUTF, which aborts the
// process on names that are not valid UTF-8; NIO decodes them with replacement instead.
// Without FOLLOW_LINKS, symlinked directories are never descended into, like the old onEnter,
// except that a starting directory that is itself a link has to be resolved first; a link
// whose target has vanished yields an empty result instead of an error.
internal fun bigFiles(root: File): List<File> {
val out = ArrayList<File>()
val start = root.toPath()
val real = if (Files.isSymbolicLink(start)) {
try {
start.toRealPath()
} catch (_: IOException) {
return out
}
} else start
Files.walkFileTree(real, object : SimpleFileVisitor<Path>() {
override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
if (attrs.isRegularFile && attrs.size() >= MIN_FILE_BYTES) out.add(file.toFile())
return FileVisitResult.CONTINUE
}
override fun visitFileFailed(file: Path, error: IOException): FileVisitResult = FileVisitResult.CONTINUE
override fun postVisitDirectory(dir: Path, error: IOException?): FileVisitResult = FileVisitResult.CONTINUE
})
return out
}
private fun drop(file: File) {
PageCacheNative.fadviseDontNeed(file.path)
}
@@ -5,6 +5,7 @@ import android.content.Context
import android.os.Environment
import android.util.Log
import com.droiddeck.launcher.R
import com.droiddeck.launcher.core.CpuFeatures
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.runtime.BwrapSpawner
import com.droiddeck.launcher.runtime.DesktopCatalog
@@ -22,6 +23,10 @@ object SessionFiles {
private const val NO_PAD_SWITCH = "Download/droiddeck-no-pad"
const val DIRECTAUDIO_DIR = "usr/local/lib/directaudio"
private const val STAGED_LEDGER = "usr/local/.droiddeck-staged"
internal const val LSE_EMU = "usr/local/lib/droiddeck-lse/liblse_emu.so"
internal fun lsePreload(lacksAtomics: Boolean, staged: Boolean, lseEmu: String? = null): String =
if (lacksAtomics && staged && lseEmu != "0") "/$LSE_EMU\n" else ""
private const val IME_MANIFEST = "usr/local/share/droiddeck/ime-files.json"
private const val IME_DEFAULT_MODE = 420
val DIRECTAUDIO_SETS = arrayOf("linux-wine11", "linux-wine11-systhread")
@@ -102,10 +107,23 @@ object SessionFiles {
}
private val STAGE_LOCK = Any()
@Volatile private var activeSessionLseEmu: String? = null
fun stage(context: Context, root: File, startsSession: Boolean = false) = synchronized(STAGE_LOCK) { stageNow(context, root, startsSession) }
fun stage(context: Context, root: File, startsSession: Boolean = false) =
stage(context, root, startsSession, lseEmu = null)
private fun stageNow(context: Context, root: File, startsSession: Boolean) {
fun stage(context: Context, root: File, startsSession: Boolean, lseEmu: String?) =
synchronized(STAGE_LOCK) {
val selection = if (startsSession) {
activeSessionLseEmu = lseEmu
lseEmu
} else {
lseEmu ?: activeSessionLseEmu
}
stageNow(context, root, startsSession, selection)
}
private fun stageNow(context: Context, root: File, startsSession: Boolean, lseEmu: String?) {
if (DesktopCatalog.desktopInstalled(root) && !DesktopCatalog.desktopFromPack(root)) try { DesktopCatalog.cleanLegacy(context) }
catch (e: Exception) { Log.w(TAG, "LXQt cleanup will retry next session", e) }
GameEnvironmentStore.publish(context)
@@ -281,6 +299,7 @@ object SessionFiles {
"usr/local/lib/droiddeck-pipewire.tzst" to "usr/local/lib/droiddeck-pipewire.tzst",
"usr/local/share/licenses/dwarfs/LICENSE" to "usr/local/share/licenses/dwarfs/LICENSE",
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
LSE_EMU to LSE_EMU,
) + mangoapp + xclipse.map { it to it } + maliCompat + msitools.map { it to it } + vr + gpuLoad + fexPreloads).filter { (asset, _) ->
val dir = asset.substringBeforeLast('/')
runCatching { context.assets.list("linuxfs/$dir")?.contains(asset.substringAfterLast('/')) == true }.getOrDefault(false)
@@ -343,20 +362,22 @@ object SessionFiles {
stageImeFiles(context, root, ledger)
ledger.save()
for (old in arrayOf("aarch64-unix", "aarch64-windows", "i386-windows")) File(root, "$DIRECTAUDIO_DIR/lib/wine/$old").deleteRecursively()
val preload = StringBuilder("/usr/local/lib/libddsession.so\n")
val preload = StringBuilder(lsePreload(CpuFeatures.lacksAtomics, File(root, LSE_EMU).isFile, lseEmu))
preload.append("/usr/local/lib/libddsession.so\n")
if (!File(Environment.getExternalStorageDirectory(), NO_PAD_SWITCH).exists()) {
preload.append("/usr/local/lib/libfakeinput.so\n")
}
val nativeUserland = SessionPrefs.nativeUserland(context)
if (nativeUserland) com.droiddeck.launcher.runtime.NativeGuest.prepare(context, root)
if (ProotFastPath.enabled(context)) {
com.droiddeck.launcher.runtime.NativeGuest.prepare(context, root)
val native = com.droiddeck.launcher.runtime.NativeGuest.available(root)
val nativePreload = preload.toString()
if (ProotFastPath.enabled(context, native)) {
val library = com.droiddeck.launcher.agent.AgentEnv.fastPathLibrary(context)
preload.append(library + "\n")
if (startsSession && library != ProotFastPath.LIBRARY) Log.i(TAG, "fast path preload: $library (debugging override)")
}
val etc = File(root, "etc").apply { mkdirs() }
File(etc, "droiddeck").mkdirs()
FileUtils.writeString(File(etc, "droiddeck/native-preload"), preload.toString())
FileUtils.writeString(File(etc, "droiddeck/native-preload"), nativePreload)
val staged = File(etc, "ld.so.preload.staged")
if (!FileUtils.writeString(staged, preload.toString())
|| !staged.renameTo(File(etc, "ld.so.preload"))) {
@@ -10,6 +10,7 @@ import com.droiddeck.launcher.gpu.Cardboard
import com.droiddeck.launcher.gpu.ScreenEffects
import com.droiddeck.launcher.gpu.SystemVulkanDriver
import com.droiddeck.launcher.gpu.TurnipDriver
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
@@ -317,6 +318,14 @@ object SessionPrefs {
prefs(context).edit().putBoolean("telemetryAuto", on).apply()
}
fun settingsSearches(context: Context): List<String> = runCatching {
JSONArray(prefs(context).getString("settingsSearches", null) ?: "[]").let { a -> List(a.length()) { a.getString(it) } }
}.getOrDefault(emptyList())
fun setSettingsSearches(context: Context, searches: List<String>) {
prefs(context).edit().putString("settingsSearches", JSONArray(searches).toString()).apply()
}
fun telemetryOff(context: Context): Set<String> = prefs(context).getStringSet("telemetryOff", null)?.toSet().orEmpty()
fun setTelemetryOff(context: Context, keys: Set<String>) {
@@ -1181,21 +1190,9 @@ object SessionPrefs {
prefs(context).edit().putBoolean("mountSharedStorage", on).apply()
}
fun prootNoSeccomp(context: Context): Boolean = prefs(context).getBoolean("prootNoSeccomp", false)
fun setProotNoSeccomp(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("prootNoSeccomp", on).apply()
}
fun nativeUserland(context: Context): Boolean = prefs(context).getBoolean("nativeUserland", true)
/** The session's long-lived programs run in worker processes Android does not count (GuestWorkers). */
fun childProcessHandoff(context: Context): Boolean = prefs(context).getBoolean("childProcessHandoff", true)
fun setNativeUserland(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("nativeUserland", on).apply()
}
/** Whether the Plasma desktop, and so its apps and shells, runs as an ordinary user instead of root (native userland only). */
fun desktopAsUser(context: Context): Boolean = prefs(context).getBoolean("desktopAsUser", false)
@@ -1203,12 +1200,6 @@ object SessionPrefs {
prefs(context).edit().putBoolean("desktopAsUser", on).apply()
}
fun prootFastPath(context: Context): Boolean = prefs(context).getBoolean("prootFastPath", true)
fun setProotFastPath(context: Context, on: Boolean) {
prefs(context).edit().putBoolean("prootFastPath", on).apply()
}
fun cursorComposite(context: Context): Boolean = prefs(context).getBoolean("cursorComposite", true)
fun setCursorComposite(context: Context, on: Boolean) {
@@ -47,6 +47,7 @@ import com.droiddeck.launcher.input.SteamControllerBle
import com.droiddeck.launcher.runtime.BwrapSpawner
import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.NativeGuest
import com.droiddeck.launcher.runtime.ProotFastPath
import com.droiddeck.launcher.runtime.UserApps
import com.droiddeck.launcher.wayland.WaylandCompositor
@@ -566,6 +567,7 @@ class SessionService : Service() {
.onFailure { Log.w(TAG, "agent environment skipped", it) }
val agentEnvironment = nextAgentEnvironment.getOrDefault(emptyList())
val customEnvironment = extraEnv()
val lseEmu = (customEnvironment + agentEnvironment).lastOrNull { it.startsWith("LSE_EMU=") }?.substringAfter('=')
try {
if (systemVulkan) {
SystemVulkanDriver.prepare(this)
@@ -575,7 +577,7 @@ class SessionService : Service() {
}
pruneSystemVulkanRuntime()
}
SessionFiles.stage(this, root, startsSession = true)
SessionFiles.stage(this, root, startsSession = true, lseEmu = lseEmu)
} catch (error: Exception) {
Log.e(TAG, "Could not prepare the session graphics runtime", error)
failSession(gen, "GRAPHICS_RUNTIME_FAILED", getString(R.string.session_graphics_runtime_failed), -1)
@@ -783,12 +785,13 @@ class SessionService : Service() {
SessionEvents.step("shm-clear") { FileUtils.clear(File(LinuxRuntime.liveDir(this), "shm")) }
val sharedStorage = LinuxRuntime.sharedStorage(this)
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir, sharedStorage)
val nativeUserland = com.droiddeck.launcher.runtime.NativeGuest.enabled(this)
val nativeUserland = NativeGuest.enabled(this)
val fastPath = ProotFastPath.enabled(this, nativeUserland)
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir, sharedStorage, fastPath)
synchronized(stopLock) {
if (gen == sessionGen && SessionState.running) com.droiddeck.launcher.runtime.NativeGuest.sessionMode = nativeUserland
}
val fastPathKey = if (ProotFastPath.enabled(this)) {
val fastPathKey = if (fastPath) {
val prootBinds = LinuxRuntime.binds(
this, sessionRoot, runtimeDir, sharedStorage, binds,
)
@@ -809,16 +812,14 @@ class SessionService : Service() {
LinuxRuntime.rememberSessionBinds(sessionBindSpecs)
com.droiddeck.launcher.runtime.NativeGuest.command(root, guest.first(), guest.drop(1))
} else {
val reason = if (NativeGuest.loader(root) == null) "missing glibc loader" else "missing native hook"
Log.i(TAG, "guest runtime: using PRoot ($reason)")
LinuxRuntime.command(this, sessionRoot, runtimeDir, sharedStorage, binds, guest)
}
val prootEnv = HostEnvironment()
prootEnv["PROOT_LOADER"] = LinuxRuntime.prootLoader(this).path
prootEnv["PROOT_TMP_DIR"] = LinuxRuntime.prootTempDir(this).path
if (SessionPrefs.prootNoSeccomp(this)) {
prootEnv["PROOT_NO_SECCOMP"] = "1"
if (!nativeUserland) Log.i(TAG, "proot: seccomp acceleration off by request")
}
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (k, v) -> prootEnv[k] = v } }
for (key in listOf("PROOT_PROFILE", "PROOT_PROFILE_SLOW_US")) {
guest.lastOrNull { it.startsWith("$key=") }?.substringAfter('=')?.let { prootEnv[key] = it }
@@ -830,7 +831,7 @@ class SessionService : Service() {
if (drives > 0) Log.i(TAG, "$drives Wine drive links given their guest paths back")
val hostEnv = if (nativeUserland) HostEnvironment().also { env ->
Log.i(TAG, "native userland: no proot (${sessionBindSpecs.size} mounts)")
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, guest.first(), SessionPrefs.guestHostname(this))
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, guest.first(), SessionPrefs.guestHostname(this), lseEmu)
.forEach { (k, v) -> env[k] = v }
} else prootEnv
@@ -1248,6 +1249,7 @@ class SessionService : Service() {
}
private fun addControllerEnvironment(guest: MutableList<String>, fakeInputDir: File, sessionDir: File) {
DirectControllerSwitch.clear(this)
FakeInputWriter.prepareRingSlots(fakeInputDir, 5)
val builtinPad = SessionPrefs.builtinPad(this)
val hiddenPad = SessionState.mode == MODE_STEAM && !builtinPad &&
@@ -1312,6 +1314,7 @@ class SessionService : Service() {
sessionRoot: File,
runtimeDir: File,
sharedStorage: File?,
fastPath: Boolean,
): ArrayList<String> {
val binds = ArrayList<String>()
if (controllersOn) binds.add(fakeInputDir.path + ":/dev/input")
@@ -1445,7 +1448,7 @@ class SessionService : Service() {
if (storageDiagnosticLibrary != null && library != null) libraries.add(SecondaryLibrary.CARD_GUESTS[0] to library.label)
val gamesLibraries = GameStorage.gamesFolderLibraries(this)
if (gamesLibraries.isNotEmpty()) {
var room = if (ProotFastPath.enabled(this)) {
var room = if (fastPath) {
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
} else Int.MAX_VALUE
for (games in gamesLibraries) {
@@ -1487,7 +1490,7 @@ class SessionService : Service() {
continue
}
try {
val room = if (ProotFastPath.enabled(this)) {
val room = if (fastPath) {
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
} else Int.MAX_VALUE
val content = SecondaryLibrary.contentPath(entry.host)
@@ -1516,7 +1519,7 @@ class SessionService : Service() {
if (problem != null) {
Log.w(TAG, "x86-64 steam library: $problem")
} else try {
val room = if (ProotFastPath.enabled(this)) {
val room = if (fastPath) {
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
} else Int.MAX_VALUE
val extra = SecondaryLibrary.binds(filesDir, x64, listOf(GameStorage.X64_CARD_GUEST)).drop(1)
@@ -1538,7 +1541,7 @@ class SessionService : Service() {
continue
}
try {
val room = if (ProotFastPath.enabled(this)) {
val room = if (fastPath) {
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
} else Int.MAX_VALUE
val extra = SecondaryLibrary.binds(filesDir, entry.x64Host, listOf(entry.x64Guest)).drop(1)
@@ -1574,7 +1577,7 @@ class SessionService : Service() {
try {
val listing = File(filesDir, "session/desktop-volumes.json").apply { parentFile?.mkdirs() }
val volumes = org.json.JSONArray()
var room = if (ProotFastPath.enabled(this)) {
var room = if (fastPath) {
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
} else Int.MAX_VALUE
for (root in com.droiddeck.launcher.files.StorageRoots.list(this)) {
@@ -189,7 +189,7 @@ object StoreLaunchRequests {
///
/// The message is the only thing that separates a stale sign-in from a title
/// that is not installed, so it is kept, minus anything that could carry a
/// device path or a token: segments lookng like a path are dropped and the
/// device path or a token: segments looking like a path are dropped and the
/// rest is folded to plain text.
internal fun reasonFor(error: Throwable): String {
val text = error.message.orEmpty()
@@ -8,7 +8,6 @@ import androidx.compose.runtime.setValue
import com.droiddeck.launcher.core.AddonPack
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.SessionEvents
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.AchievementNotifications
@@ -149,7 +148,6 @@ object GogComet {
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
}
}
@@ -5,7 +5,6 @@ import com.droiddeck.launcher.core.AddonPack
import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.runtime.ProotFastPath
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.stores.StoreInstallRoot
import org.json.JSONObject
import java.io.Closeable
@@ -107,7 +106,6 @@ internal object Xodus {
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
put("PROOT_LOADER", LinuxRuntime.prootLoader(app).path)
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(app).path)
if (SessionPrefs.prootNoSeccomp(app)) put("PROOT_NO_SECCOMP", "1")
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (key, value) -> put(key, value) } }
LinuxRuntime.prootLibraryPath(app).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
}
@@ -39,7 +39,8 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
}
if (!a.hudOn) return@SettingsGroup
val size = DroidDeckHudSize.from(cfg["hudSize"])
ChoiceRow(host, "hud-size", stringResource(R.string.hud_size), stringResource(R.string.hud_size_hint),
ChoiceRow(host, "hud-size", stringResource(R.string.hud_size),
stringResource(if (size == DroidDeckHudSize.SIDE_STRIP) R.string.hud_size_side_strip_hint else R.string.hud_size_hint),
listOf(
DroidDeckHudSize.FULL to stringResource(R.string.hud_size_full),
DroidDeckHudSize.TILES to stringResource(R.string.hud_size_tiles),
@@ -47,6 +48,7 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
DroidDeckHudSize.MINIMAL to stringResource(R.string.hud_size_minimal),
DroidDeckHudSize.MEGA to stringResource(R.string.hud_size_mega),
DroidDeckHudSize.STRIP to stringResource(R.string.hud_size_strip),
DroidDeckHudSize.SIDE_STRIP to stringResource(R.string.hud_size_side_strip),
),
size, chipModifier = track("hud-size")) { a.onHudSetting("hudSize", it.token) }
ChoiceRow(host, "hud-hold", stringResource(R.string.hud_hold), null,
@@ -143,7 +143,7 @@ class FrontEndState(
val homeScreenEnabled: Boolean = false,
val defaultHomeLabel: String? = null,
val integration: com.droiddeck.launcher.core.SteamIntegration.State = com.droiddeck.launcher.core.SteamIntegration.State(suggested = false),
val integrationFocus: com.droiddeck.launcher.core.SteamIntegration.Feature? = null,
val integrationFocus: SteamIntegrationFocusRequest? = null,
val androidApps: List<HomeApp.LaunchableApp> = emptyList(),
val secondScreenDisplays: List<SecondScreenDisplay> = emptyList(),
val ownScreen: SecondScreenDisplay? = null,
@@ -257,7 +257,7 @@ class FrontEndActions(
val onAddonDelete: (com.droiddeck.launcher.runtime.WowAddons.Target, String) -> Unit = { _, _ -> },
val onSaveExport: (Library.SteamGame, com.droiddeck.launcher.session.GameSaves.Layout) -> Unit = { _, _ -> },
val onPerformance: () -> Unit,
val performancePanel: @Composable () -> Unit = {},
val performancePanel: @Composable (memory: @Composable () -> Unit) -> Unit = { memory -> memory() },
val onRoms: () -> Unit,
val onFiles: () -> Unit,
val onBrowseFiles: (File) -> Unit = {},
@@ -231,7 +231,10 @@ internal fun SetupPanel(
}
val chipFocus = remember { List(tabs.size) { FocusRequester() } }
var tabTurned by remember { mutableStateOf(false) }
val pick: (Int) -> Unit = { i -> tab = i; tabTurned = true; searching = false; query = ""; if (i == DEVELOPER_TAB) logsRefresh++ }
remember { SettingsSearchHistory.load(ctx) }
var fromHistory by remember { mutableStateOf(false) }
val keepSearch = { if (searching && SettingsIndex.search(ctx, query, frostRow).isNotEmpty()) SettingsSearchHistory.add(ctx, query) }
val pick: (Int) -> Unit = { i -> keepSearch(); tab = i; tabTurned = true; searching = false; query = ""; if (i == DEVELOPER_TAB) logsRefresh++ }
val inputModeManager = LocalInputModeManager.current
LaunchedEffect(Unit) {
while (true) {
@@ -258,8 +261,9 @@ internal fun SetupPanel(
) {
val sectionBar: @Composable (Modifier) -> Unit = { m ->
SettingsPillSearch(
m, searching, query, { query = it },
onOpen = { searching = true }, onClose = { searching = false; query = "" },
m, searching, query, { query = it; fromHistory = false },
onOpen = { searching = true }, onClose = { keepSearch(); searching = false; query = "" },
keepOpen = SettingsSearchHistory.items.isNotEmpty(), onSearch = keepSearch,
) { SheetChips(tabs, tab, chipFocus, onPick = pick) }
}
val portrait = androidx.compose.ui.platform.LocalConfiguration.current.orientation == android.content.res.Configuration.ORIENTATION_PORTRAIT
@@ -268,9 +272,11 @@ internal fun SetupPanel(
Row(Modifier.fillMaxWidth().padding(bottom = 10.dp)) { sectionBar(Modifier.weight(1f)) }
} else PageHeader(stringResource(R.string.setup_title)) { sectionBar(Modifier.weight(1f)) }
val listing = searching && query.isNotBlank()
val fixed = tab == CONTROLLER_TAB && !listing
val history = searching && query.isBlank() && SettingsSearchHistory.items.isNotEmpty()
val fixed = tab == CONTROLLER_TAB && !listing && !history
Column(modifier = Modifier.weight(1f).fillMaxWidth().then(if (fixed) Modifier else Modifier.verticalScroll(rememberScrollState())).padding(bottom = if (fixed) 0.dp else 24.dp)) {
if (listing) SettingsSearchResults(query, frostRow) { section -> pick(section.ordinal) }
if (listing) SettingsSearchResults(query, frostRow, focusFirst = fromHistory, onSearched = keepSearch) { section -> pick(section.ordinal) }
else if (history) SettingsSearchHistoryList(onPick = { fromHistory = true; query = it }) { SettingsSearchHistory.clear(ctx) }
else when (tab) {
OVERVIEW_TAB -> {
OnboardingCard(limitBlocks, a.onShowPhantomGate)
@@ -436,11 +442,10 @@ internal fun SetupPanel(
}
}
SettingsGroup(stringResource(R.string.setup_runtime)) { runtimeCheck(false) }
SteamIntegrationGroup(s.integration, s.integrationFocus, a.onIntegration, a.onIntegrationAppInfo, a.onIntegrationLocation)
SteamIntegrationGroup(s.integration, s.integrationFocus, a.onIntegration, a.onIntegrationAppInfo, a.onIntegrationLocation, collapsible = true)
}
PERFORMANCE_TAB -> {
a.performancePanel()
MemoryGroup(s, a, host, onPairWirelessDebugging)
a.performancePanel { MemoryGroup(s, a, host, onPairWirelessDebugging) }
}
CONTROLLER_TAB -> {
val controller = s.controller
@@ -522,11 +527,11 @@ internal fun SetupPanel(
}
}
val device: @Composable () -> Unit = {
SettingsGroup(stringResource(R.string.setup_group_device)) {
SettingsGroup(stringResource(R.string.setup_group_home_navigation)) {
ToggleRow(
host, "home-screen", stringResource(R.string.setup_home),
if (s.homeScreenEnabled) stringResource(R.string.setup_home_on) else stringResource(R.string.setup_home_off),
s.homeScreenEnabled,
s.homeScreenEnabled, sideBySide = true,
) { a.onHomeScreen(it) }
if (s.homeScreenEnabled) {
ActionRow(stringResource(R.string.setup_default_home), s.defaultHomeLabel ?: stringResource(R.string.setup_choose_home), stringResource(R.string.setup_choose), a.onHomeApp)
@@ -543,10 +548,35 @@ internal fun SetupPanel(
s.homePage, onPick = a.onHomePage,
)
}
ToggleRow(
host, "page-swipe", stringResource(R.string.setup_page_swipe),
stringResource(R.string.setup_page_swipe_hint), PageSwipe.on, sideBySide = true,
) { on ->
PageSwipe.on = on
com.droiddeck.launcher.core.AppUiPrefs.setPageSwipe(ctx, on)
}
}
SettingsGroup(stringResource(R.string.setup_group_display)) {
var sessionDisplay by rememberSaveable { mutableStateOf(false) }
val jump = SettingsJump.target
val sessionLabels = listOf(
stringResource(R.string.setup_session_orientation),
stringResource(R.string.setup_session_fullscreen),
stringResource(R.string.setup_dual_screen_sessions),
)
LaunchedEffect(jump) {
if (jump != null && jump.label in sessionLabels) sessionDisplay = true
}
ChoiceRow(
host, "launcher-orientation", stringResource(R.string.setup_launcher_orientation), null,
com.droiddeck.launcher.core.AppUiPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
s.launcherOrientation, onPick = a.onLauncherOrientation,
s.launcherOrientation, onPick = a.onLauncherOrientation, sideBySide = true,
)
val fullscreenModes = FullscreenMode.entries.map { it to stringResource(it.label) }
ChoiceRow(
host, "launcher-fullscreen", stringResource(R.string.setup_launcher_fullscreen),
stringResource(R.string.setup_fullscreen_on),
fullscreenModes, s.launcherFullscreenMode, onPick = a.onLauncherFullscreenMode, sideBySide = true,
)
s.tpUbwcMode?.let { ubwc ->
ChoiceRow(
@@ -562,74 +592,74 @@ internal fun SetupPanel(
else Note(stringResource(R.string.gpu_ubwc_restart))
}
}
ChoiceRow(
host, "orientation", stringResource(R.string.setup_session_orientation), stringResource(R.string.setup_session_orientation_hint),
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
s.orientation, onPick = { value ->
a.onOrientation(value)
steamOrientation = SessionPrefs.orientation(ctx, "steam")
desktopOrientation = SessionPrefs.orientation(ctx, "desktop")
},
val dualModes = listOf(
com.droiddeck.launcher.input.DualScreen.MODE_AUTO to stringResource(R.string.setup_dual_screen_auto),
com.droiddeck.launcher.input.DualScreen.MODE_ON to stringResource(R.string.setup_dual_screen_on),
com.droiddeck.launcher.input.DualScreen.MODE_OFF to stringResource(R.string.setup_dual_screen_off),
)
ChoiceRow(
host, "orientation-steam", stringResource(R.string.setup_session_orientation) + " (Steam)", stringResource(R.string.setup_session_orientation_hint),
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
steamOrientation, onPick = { value ->
steamOrientation = value
SessionPrefs.setOrientation(ctx, "steam", value)
},
)
ChoiceRow(
host, "orientation-desktop", stringResource(R.string.setup_session_orientation) + " (Desktop)", stringResource(R.string.setup_session_orientation_hint),
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
desktopOrientation, onPick = { value ->
desktopOrientation = value
SessionPrefs.setOrientation(ctx, "desktop", value)
},
)
val fullscreenModes = FullscreenMode.entries.map { it to stringResource(it.label) }
ChoiceRow(
host, "launcher-fullscreen", stringResource(R.string.setup_launcher_fullscreen),
stringResource(R.string.setup_fullscreen_on),
fullscreenModes, s.launcherFullscreenMode, onPick = a.onLauncherFullscreenMode,
)
ChoiceRow(
host, "session-fullscreen", stringResource(R.string.setup_session_fullscreen),
stringResource(R.string.setup_fullscreen_on),
fullscreenModes, s.sessionFullscreenMode, onPick = a.onSessionFullscreenMode,
)
ToggleRow(
host, "page-swipe", stringResource(R.string.setup_page_swipe),
stringResource(R.string.setup_page_swipe_hint), PageSwipe.on,
) { on ->
PageSwipe.on = on
com.droiddeck.launcher.core.AppUiPrefs.setPageSwipe(ctx, on)
}
ToggleRow(
host, "controller-haptics", stringResource(R.string.setup_controller_haptics),
stringResource(R.string.setup_controller_haptics_hint),
s.controllerHaptics,
) { a.onControllerHaptics(it) }
if (s.dualScreenDevice) {
val dualModes = listOf(
com.droiddeck.launcher.input.DualScreen.MODE_AUTO to stringResource(R.string.setup_dual_screen_auto),
com.droiddeck.launcher.input.DualScreen.MODE_ON to stringResource(R.string.setup_dual_screen_on),
com.droiddeck.launcher.input.DualScreen.MODE_OFF to stringResource(R.string.setup_dual_screen_off),
)
ChoiceRow(
host, "dual-screen", stringResource(R.string.setup_dual_screen_launcher), stringResource(R.string.setup_dual_screen_launcher_hint),
dualModes, s.dualScreenMode, onPick = a.onDualScreenMode,
)
}
ActionRow(
stringResource(R.string.setup_session_display), stringResource(R.string.setup_session_display_hint),
stringResource(if (sessionDisplay) R.string.common_close else R.string.setup_expand_open),
onClick = { sessionDisplay = !sessionDisplay }, sideBySide = true,
)
if (sessionDisplay) {
ChoiceRow(
host, "dual-screen-sessions", stringResource(R.string.setup_dual_screen_sessions), stringResource(R.string.setup_dual_screen_sessions_hint),
dualModes.take(2) + (com.droiddeck.launcher.input.DualScreen.MODE_SWAPPED to stringResource(R.string.setup_dual_screen_swapped)) + dualModes.drop(2), s.dualScreenSessions, onPick = a.onDualScreenSessions,
host, "orientation", stringResource(R.string.setup_session_orientation), stringResource(R.string.setup_session_orientation_hint),
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
s.orientation, onPick = { value ->
a.onOrientation(value)
steamOrientation = SessionPrefs.orientation(ctx, "steam")
desktopOrientation = SessionPrefs.orientation(ctx, "desktop")
},
)
if (s.dualScreenSessions != com.droiddeck.launcher.input.DualScreen.MODE_OFF) {
ToggleRow(host, "dual-screen-controls", stringResource(R.string.setup_dual_screen_controls),
stringResource(R.string.setup_dual_screen_controls_hint), s.dualScreenControls) { a.onDualScreenControls(it) }
ChoiceRow(
host, "orientation-steam", stringResource(R.string.setup_session_orientation) + " (Steam)", stringResource(R.string.setup_session_orientation_hint),
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
steamOrientation, onPick = { value ->
steamOrientation = value
SessionPrefs.setOrientation(ctx, "steam", value)
},
)
ChoiceRow(
host, "orientation-desktop", stringResource(R.string.setup_session_orientation) + " (Desktop)", stringResource(R.string.setup_session_orientation_hint),
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
desktopOrientation, onPick = { value ->
desktopOrientation = value
SessionPrefs.setOrientation(ctx, "desktop", value)
},
)
ChoiceRow(
host, "session-fullscreen", stringResource(R.string.setup_session_fullscreen),
stringResource(R.string.setup_fullscreen_on),
fullscreenModes, s.sessionFullscreenMode, onPick = a.onSessionFullscreenMode,
)
if (s.dualScreenDevice) {
ChoiceRow(
host, "dual-screen-sessions", stringResource(R.string.setup_dual_screen_sessions), stringResource(R.string.setup_dual_screen_sessions_hint),
dualModes.take(2) + (com.droiddeck.launcher.input.DualScreen.MODE_SWAPPED to stringResource(R.string.setup_dual_screen_swapped)) + dualModes.drop(2), s.dualScreenSessions, onPick = a.onDualScreenSessions,
)
if (s.dualScreenSessions != com.droiddeck.launcher.input.DualScreen.MODE_OFF) {
ToggleRow(host, "dual-screen-controls", stringResource(R.string.setup_dual_screen_controls),
stringResource(R.string.setup_dual_screen_controls_hint), s.dualScreenControls) { a.onDualScreenControls(it) }
}
}
}
}
SettingsGroup(stringResource(R.string.setup_group_input)) {
ToggleRow(
host, "controller-haptics", stringResource(R.string.setup_controller_haptics),
stringResource(R.string.setup_controller_haptics_hint),
s.controllerHaptics, sideBySide = true,
) { a.onControllerHaptics(it) }
if (s.dualScreenDevice) {
ToggleRow(host, "android-text-field-keyboard", stringResource(R.string.setup_android_text_field_keyboard),
null, s.androidTextFieldKeyboard) { a.onAndroidTextFieldKeyboard(it) }
null, s.androidTextFieldKeyboard, sideBySide = true) { a.onAndroidTextFieldKeyboard(it) }
}
}
}
@@ -679,9 +709,9 @@ internal fun SetupPanel(
}
BoxWithConstraints(Modifier.fillMaxWidth()) {
if (maxWidth >= 840.dp && !LocalNarrowPane.current) Row(horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.Top) {
Column(Modifier.weight(1f)) { look() }
Column(Modifier.weight(1f)) { device(); art(); download() }
} else Column { look(); device(); art(); download() }
Column(Modifier.weight(1f)) { device() }
Column(Modifier.weight(1f)) { look(); art(); download() }
} else Column { device(); look(); art(); download() }
}
}
DEVELOPER_TAB -> {
@@ -806,11 +836,11 @@ internal fun SetupPanel(
@Composable
private fun MemoryGroup(s: FrontEndState, a: FrontEndActions, host: MenuHost, onPairWirelessDebugging: () -> Unit) {
SettingsGroup(stringResource(R.string.setup_group_background_apps)) {
SettingsGroup(stringResource(R.string.setup_group_memory)) {
ToggleRow(
host, "clear-cached-apps", stringResource(R.string.setup_clear_cached),
stringResource(if (s.adbPaired) R.string.setup_clear_cached_hint else R.string.setup_clear_cached_unpaired),
s.clearCachedApps, enabled = s.adbPaired || s.clearCachedApps,
s.clearCachedApps, enabled = s.adbPaired || s.clearCachedApps, sideBySide = true,
) { a.onClearCachedApps(it) }
ChoiceRow(
host, "background-app-limit", stringResource(R.string.setup_bg_limit),
@@ -822,7 +852,7 @@ private fun MemoryGroup(s: FrontEndState, a: FrontEndActions, host: MenuHost, on
0 to stringResource(R.string.setup_bg_limit_0),
),
s.backgroundAppLimit, enabled = s.adbPaired || s.backgroundAppLimit != com.droiddeck.launcher.core.BackgroundAppLimit.OFF,
onPick = a.onBackgroundAppLimit,
onPick = a.onBackgroundAppLimit, sideBySide = true,
)
ChoiceRow(
host, "memory-hud", stringResource(R.string.setup_memory_hud), stringResource(R.string.setup_memory_hud_hint),
@@ -831,7 +861,7 @@ private fun MemoryGroup(s: FrontEndState, a: FrontEndActions, host: MenuHost, on
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_SIMPLE to stringResource(R.string.setup_memory_hud_simple),
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_ADVANCED to stringResource(R.string.setup_memory_hud_advanced),
),
s.memoryHud, onPick = a.onMemoryHud,
s.memoryHud, onPick = a.onMemoryHud, sideBySide = true,
)
if (!s.adbPaired) ActionRow(
stringResource(R.string.setup_adb_pair), stringResource(R.string.setup_adb_pair_hint),
@@ -67,8 +67,18 @@ internal fun InputElementProperties(element: InputSurfaceElement, action: InputA
}
if (element.kind == InputElementKind.STICK) {
val host = rememberMenuHost()
ToggleRow(host, "element-floating", stringResource(R.string.input_floating_stick), null, element.floating) { onChange(element.copy(floating = it)) }
ToggleRow(host, "element-hide-idle", stringResource(R.string.input_hide_idle), null, element.hideWhenIdle) { onChange(element.copy(hideWhenIdle = it)) }
val adaptive = element.adaptiveCapture ?: element.adaptiveStick
ToggleRow(host, "element-floating", stringResource(R.string.input_floating_stick), null, element.floating) {
onChange(element.copy(floating = it, hideWhenIdle = element.hideStickAtRest, adaptiveCapture = adaptive))
}
if (element.floating) {
ToggleRow(host, "element-adaptive-capture", stringResource(R.string.input_adaptive_capture), null, element.adaptiveStick) {
onChange(element.copy(hideWhenIdle = element.hideStickAtRest, adaptiveCapture = it))
}
}
ToggleRow(host, "element-hide-idle", stringResource(R.string.input_hide_idle), null, element.hideStickAtRest) {
onChange(element.copy(hideWhenIdle = it, adaptiveCapture = adaptive))
}
}
val host = rememberMenuHost()
if ((element.kind == InputElementKind.BUTTON || element.kind == InputElementKind.TRIGGER) && element.icon == 0 && element.image.isEmpty() ||
@@ -236,11 +236,11 @@ class InputSurfaceView(
super.dispatchDraw(canvas)
}
}
canvas.clipChildren = customLayout.none { it.kind == InputElementKind.STICK && (classic(it) || adaptive(it)) }
canvas.clipChildren = customLayout.none { it.kind == InputElementKind.STICK && (classic(it) || it.adaptiveStick) }
for (element in customLayout) {
val source = pad?.let { InputSurfaceSource(it, inputRole, element).also { s -> elementSources += s } }
canvas.addView(when (element.kind) {
InputElementKind.STICK -> StickView(context, element, source, element.floating, element.hideWhenIdle && pad != null)
InputElementKind.STICK -> StickView(context, element, source, element.floating, element.hideStickAtRest && pad != null)
InputElementKind.TRACKPAD -> TrackpadView(context, element.control == InputControl.RIGHT_PAD, captioned = element.showLabel,
stock = element.id == "legacy:${element.control.id}", source = source)
InputElementKind.DPAD -> DirectionPad(context, element, source)
@@ -641,7 +641,7 @@ class InputSurfaceView(
private val ring = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.STROKE }
private val knob = Paint(Paint.ANTI_ALIAS_FLAG)
val adaptive get() = adaptive(element)
val adaptive get() = element.adaptiveStick
fun reach() = min(width, height) * if (classic(element)) CLASSIC_REACH else PANEL_REACH
@@ -859,8 +859,6 @@ class InputSurfaceView(
private val TEXT_DIM = Color.rgb(0x7A, 0x80, 0x8A)
private val KNOB = Color.rgb(0x2A, 0x2D, 0x33)
private fun adaptive(element: InputSurfaceElement) = element.kind == InputElementKind.STICK && element.floating && element.hideWhenIdle
private fun classic(element: InputSurfaceElement) = (element.id == "legacy:${element.control.id}" || element.id == "builtin:keyboard") &&
(element.buttonShape == InputButtonShape.CIRCLE || element.buttonShape == InputButtonShape.PILL)
@@ -15,6 +15,8 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -46,9 +48,7 @@ fun PerformancePage(
fsyncFirst: Boolean,
gamescopeRealtime: Boolean,
gpuClockPin: Boolean,
prootNoSeccomp: Boolean,
prootFastPath: Boolean,
nativeUserland: Boolean,
nativeDesktopAvailable: Boolean,
desktopAsUser: Boolean,
cursorComposite: Boolean,
guestHostname: String,
@@ -65,9 +65,6 @@ fun PerformancePage(
onFsyncFirst: (Boolean) -> Unit,
onGamescopeRealtime: (Boolean) -> Unit,
onGpuClockPin: (Boolean) -> Unit,
onProotNoSeccomp: (Boolean) -> Unit,
onProotFastPath: (Boolean) -> Unit,
onNativeUserland: (Boolean) -> Unit,
onDesktopAsUser: (Boolean) -> Unit,
onCursorComposite: (Boolean) -> Unit,
onGuestHostname: (String) -> Unit,
@@ -75,133 +72,138 @@ fun PerformancePage(
onGameCore: (Int, Boolean) -> Unit,
onDismiss: () -> Unit,
embedded: Boolean = false,
memory: @Composable () -> Unit = {},
) {
val host = rememberMenuHost()
val colors = MaterialTheme.colorScheme
val coreItems = cores.map { it.core to it.label }
var showCompatibility by rememberSaveable { mutableStateOf(false) }
var hostnameDraft by remember(guestHostname) { mutableStateOf(guestHostname) }
val jump = SettingsJump.target
val compatibilityLabels = listOf(
R.string.perf_glthread, R.string.perf_zink, R.string.perf_noglerror, R.string.perf_gsrealtime,
R.string.perf_sysmem, R.string.perf_xalia, R.string.perf_esync, R.string.perf_fsync,
R.string.perf_fastsync,
R.string.perf_cursor_composite, R.string.perf_hostname, R.string.perf_desktop_as_user,
).map { stringResource(it) }
LaunchedEffect(jump) {
if (jump != null && jump.label in compatibilityLabels) showCompatibility = true
}
val body: @Composable () -> Unit = {
SettingsGroup(stringResource(R.string.perf_client_cores_group)) {
SettingsGroup(stringResource(R.string.setup_performance_cpu)) {
ToggleRow(
host, "override", stringResource(R.string.perf_override),
stringResource(R.string.perf_override_hint),
clientOverride, onChange = onClientOverride,
clientOverride, sideBySide = true, onChange = onClientOverride,
)
MultiRow(
host, "clientCores", stringResource(R.string.perf_client_cores), if (clientOverride) stringResource(R.string.perf_client_cores_on) else stringResource(R.string.perf_client_cores_off),
coreItems, clientCores, enabled = clientOverride, onToggle = onClientCore,
coreItems, clientCores, enabled = clientOverride, sideBySide = true, onToggle = onClientCore,
)
}
SettingsGroup(stringResource(R.string.perf_game_cores_group)) {
MultiRow(
host, "gameCores", stringResource(R.string.perf_game_cores),
stringResource(R.string.perf_game_cores_hint),
coreItems, gameCores, onToggle = onGameCore,
coreItems, gameCores, sideBySide = true, onToggle = onGameCore,
)
}
SettingsGroup(stringResource(R.string.setup_performance_graphics), key = "performance-gpu") {
ToggleRow(
host, "paceCores", stringResource(R.string.perf_pace_cores),
stringResource(R.string.perf_pace_cores_hint),
paceCores, onChange = onPaceCores,
paceCores, sideBySide = true, onChange = onPaceCores,
)
if (GpuClockPin.supported) ToggleRow(
host, "gpuclock", stringResource(R.string.perf_gpuclock), null,
gpuClockPin, sideBySide = true, onChange = onGpuClockPin,
)
}
SettingsGroup(stringResource(R.string.perf_client_ui)) {
ToggleRow(
host, "glthread", stringResource(R.string.perf_glthread),
stringResource(R.string.perf_glthread_hint),
glThread, onChange = onGlThread,
)
ToggleRow(
host, "zink", stringResource(R.string.perf_zink),
stringResource(R.string.perf_zink_hint),
zinkLazy, onChange = onZinkLazy,
)
ToggleRow(
host, "noglerror", stringResource(R.string.perf_noglerror),
stringResource(R.string.perf_noglerror_hint),
noGlError, onChange = onNoGlError,
)
ToggleRow(
host, "gsrealtime", stringResource(R.string.perf_gsrealtime),
stringResource(R.string.perf_gsrealtime_hint),
gamescopeRealtime, onChange = onGamescopeRealtime,
memory()
if (embedded) SettingsGroup(stringResource(R.string.setup_performance_advanced)) {
ActionRow(
stringResource(R.string.setup_performance_compatibility), stringResource(R.string.setup_performance_compatibility_hint),
stringResource(if (showCompatibility) R.string.common_close else R.string.setup_expand_open),
onClick = { showCompatibility = !showCompatibility }, sideBySide = true,
)
}
if (GpuClockPin.supported) GpuClockGroup(host, gpuClockPin, onChange = onGpuClockPin)
SettingsGroup(stringResource(R.string.perf_fixes)) {
ToggleRow(
host, "sysmem", stringResource(R.string.perf_sysmem),
stringResource(R.string.perf_sysmem_hint),
tuSysmem, onChange = onTuSysmem,
)
ToggleRow(
host, "xalia", stringResource(R.string.perf_xalia),
stringResource(R.string.perf_xalia_hint),
noXalia, onChange = onNoXalia,
)
ToggleRow(
host, "syncfallback", stringResource(R.string.perf_esync),
stringResource(R.string.perf_esync_hint),
syncFallback, onChange = onSyncFallback,
)
ToggleRow(
host, "fsyncfirst", stringResource(R.string.perf_fsync),
stringResource(R.string.perf_fsync_hint),
fsyncFirst, onChange = onFsyncFirst,
)
ToggleRow(
host, "fastsync", stringResource(R.string.perf_fastsync),
stringResource(R.string.perf_fastsync_hint),
fastSync, onChange = onFastSync,
)
ToggleRow(
host, "seccomp", stringResource(R.string.perf_seccomp),
stringResource(R.string.perf_seccomp_hint),
prootNoSeccomp, onChange = onProotNoSeccomp,
)
ToggleRow(
host, "fastpath", stringResource(R.string.perf_fastpath),
when {
nativeUserland -> stringResource(R.string.perf_fastpath_needs_proot)
prootNoSeccomp -> stringResource(R.string.perf_fastpath_needs_seccomp)
else -> stringResource(R.string.perf_fastpath_hint)
},
prootFastPath && !prootNoSeccomp && !nativeUserland, enabled = !prootNoSeccomp && !nativeUserland,
onChange = onProotFastPath,
)
ToggleRow(
host, "nativeuserland", stringResource(R.string.perf_native_userland),
stringResource(R.string.perf_native_userland_hint),
nativeUserland, onChange = onNativeUserland,
)
ToggleRow(
host, "cursorcomposite", stringResource(R.string.perf_cursor_composite),
stringResource(R.string.perf_cursor_composite_hint),
cursorComposite, onChange = onCursorComposite,
)
}
SettingsGroup(stringResource(R.string.perf_identity)) {
var draft by remember(guestHostname) { mutableStateOf(guestHostname) }
val valid = SessionPrefs.validGuestHostname(draft) != null
SettingsRow(
stringResource(R.string.perf_hostname),
if (valid || draft.isBlank()) stringResource(R.string.perf_hostname_hint, SessionPrefs.DEFAULT_GUEST_HOSTNAME)
else stringResource(R.string.perf_hostname_invalid),
) {
OutlinedTextField(
draft, { v ->
draft = v.take(63)
if (draft.isBlank() || SessionPrefs.validGuestHostname(draft) != null) onGuestHostname(draft)
},
singleLine = true, isError = !valid && draft.isNotBlank(),
placeholder = { Text(SessionPrefs.DEFAULT_GUEST_HOSTNAME) },
modifier = Modifier.width(220.dp).focusGlide(),
if (!embedded || showCompatibility) {
SettingsGroup(stringResource(R.string.perf_client_ui)) {
ToggleRow(
host, "glthread", stringResource(R.string.perf_glthread),
stringResource(R.string.perf_glthread_hint),
glThread, onChange = onGlThread,
)
ToggleRow(
host, "zink", stringResource(R.string.perf_zink),
stringResource(R.string.perf_zink_hint),
zinkLazy, onChange = onZinkLazy,
)
ToggleRow(
host, "noglerror", stringResource(R.string.perf_noglerror),
stringResource(R.string.perf_noglerror_hint),
noGlError, onChange = onNoGlError,
)
ToggleRow(
host, "gsrealtime", stringResource(R.string.perf_gsrealtime),
stringResource(R.string.perf_gsrealtime_hint),
gamescopeRealtime, onChange = onGamescopeRealtime,
)
}
SettingsGroup(stringResource(R.string.perf_fixes)) {
ToggleRow(
host, "sysmem", stringResource(R.string.perf_sysmem),
stringResource(R.string.perf_sysmem_hint),
tuSysmem, onChange = onTuSysmem,
)
ToggleRow(
host, "xalia", stringResource(R.string.perf_xalia),
stringResource(R.string.perf_xalia_hint),
noXalia, onChange = onNoXalia,
)
ToggleRow(
host, "syncfallback", stringResource(R.string.perf_esync),
stringResource(R.string.perf_esync_hint),
syncFallback, onChange = onSyncFallback,
)
ToggleRow(
host, "fsyncfirst", stringResource(R.string.perf_fsync),
stringResource(R.string.perf_fsync_hint),
fsyncFirst, onChange = onFsyncFirst,
)
ToggleRow(
host, "fastsync", stringResource(R.string.perf_fastsync),
stringResource(R.string.perf_fastsync_hint),
fastSync, onChange = onFastSync,
)
ToggleRow(
host, "cursorcomposite", stringResource(R.string.perf_cursor_composite),
stringResource(R.string.perf_cursor_composite_hint),
cursorComposite, onChange = onCursorComposite,
)
}
SettingsGroup(stringResource(R.string.perf_identity)) {
val valid = SessionPrefs.validGuestHostname(hostnameDraft) != null
SettingsRow(
stringResource(R.string.perf_hostname),
if (valid || hostnameDraft.isBlank()) stringResource(R.string.perf_hostname_hint, SessionPrefs.DEFAULT_GUEST_HOSTNAME)
else stringResource(R.string.perf_hostname_invalid),
) {
OutlinedTextField(
hostnameDraft, { v ->
hostnameDraft = v.take(63)
if (hostnameDraft.isBlank() || SessionPrefs.validGuestHostname(hostnameDraft) != null) onGuestHostname(hostnameDraft)
},
singleLine = true, isError = !valid && hostnameDraft.isNotBlank(),
placeholder = { Text(SessionPrefs.DEFAULT_GUEST_HOSTNAME) },
modifier = Modifier.width(220.dp).focusGlide(),
)
}
ToggleRow(
host, "desktopasuser", stringResource(R.string.perf_desktop_as_user),
stringResource(R.string.perf_desktop_as_user_hint),
desktopAsUser && nativeDesktopAvailable, enabled = nativeDesktopAvailable,
onChange = onDesktopAsUser,
)
}
ToggleRow(
host, "desktopasuser", stringResource(R.string.perf_desktop_as_user),
stringResource(if (nativeUserland) R.string.perf_desktop_as_user_hint else R.string.perf_desktop_as_user_needs_native),
desktopAsUser && nativeUserland, enabled = nativeUserland,
onChange = onDesktopAsUser,
)
}
if (phantomWarning != null) {
Spacer(Modifier.height(16.dp))
@@ -214,10 +216,7 @@ fun PerformancePage(
}
}
}
if (embedded) Column {
Text(stringResource(R.string.perf_lede), fontSize = 13.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 4.dp, vertical = 6.dp))
body()
} else SettingsPage(
if (embedded) body() else SettingsPage(
host, title = stringResource(R.string.perf_title),
lede = stringResource(R.string.perf_lede),
onBack = onDismiss,
@@ -414,6 +414,9 @@ class DrawerActions(
val unfoldedControls: Boolean? = null,
val adaptiveSticks: Boolean? = null,
val onAdaptiveSticks: (Boolean) -> Unit = {},
/** dd-directcontroller's mode for the running game; null = the game does not use it. */
val directController: Boolean? = null,
val onDirectController: (Boolean) -> Unit = {},
val showFloatingSteamControls: Boolean = false,
val oscRearButtons: Boolean = false,
val oscTrackpads: Boolean = false,
@@ -792,10 +795,12 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
val rumbleLabel = stringResource(R.string.ctrl_rumble)
val airTriggers = a.airTriggers
val airTriggersLabel = stringResource(R.string.air_triggers_title)
if (a.padType != null || c != null || airTriggers != null) SettingsGroup(
val directControllerLabel = stringResource(R.string.ctrl_direct_controller)
if (a.padType != null || c != null || airTriggers != null || a.directController != null) SettingsGroup(
stringResource(R.string.input_device_settings), key = "controller-pad", tag = padTag,
detail = summary(a.padType?.let { padTypes.labelOf(it) }, c?.let { "$rumbleLabel ${if (it.rumble) on else off}" },
airTriggers?.let { "$airTriggersLabel ${if (it.enabled) on else off}" }),
airTriggers?.let { "$airTriggersLabel ${if (it.enabled) on else off}" },
a.directController?.let { "$directControllerLabel ${if (it) on else off}" }),
) {
a.padType?.let { type ->
ChoiceRow(host, "pad-type", stringResource(R.string.input_virtual_controller), stringResource(R.string.input_virtual_controller_hint),
@@ -804,6 +809,9 @@ private fun DrawerControllerPage(host: MenuHost, a: DrawerActions, padConnected:
c?.let {
ToggleRow(host, "rumble", rumbleLabel, null, it.rumble, chipModifier = track("rumble"), onChange = a.onRumble)
}
a.directController?.let {
ToggleRow(host, "direct-controller", directControllerLabel, null, it, chipModifier = track("direct-controller"), onChange = a.onDirectController)
}
airTriggers?.let {
ActionRow(airTriggersLabel, if (it.enabled) on else off, stringResource(R.string.air_triggers_open), onAirTriggers,
modifier = track("air-triggers"))
@@ -85,9 +85,6 @@ internal object SettingsIndex {
s(SettingsSection.PERFORMANCE, R.string.perf_esync, "esync", "sync", "wine"),
s(SettingsSection.PERFORMANCE, R.string.perf_fsync, "fsync", "sync", "wine"),
s(SettingsSection.PERFORMANCE, R.string.perf_fastsync, "ntsync", "sync", "wine"),
s(SettingsSection.PERFORMANCE, R.string.perf_seccomp, "proot"),
s(SettingsSection.PERFORMANCE, R.string.perf_fastpath, "proot"),
s(SettingsSection.PERFORMANCE, R.string.perf_native_userland, "proot"),
s(SettingsSection.PERFORMANCE, R.string.perf_cursor_composite, "mouse", "cursor"),
s(SettingsSection.PERFORMANCE, R.string.perf_hostname, "name"),
s(SettingsSection.PERFORMANCE, R.string.perf_desktop_as_user, "root", "user", "sudo", "fakeroot"),
@@ -16,6 +16,10 @@ import androidx.compose.runtime.setValue
import androidx.compose.runtime.withFrameNanos
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.layout.onPlaced
/** The row a settings search result opens, so the page it lands on can scroll to it and flash it. */
internal object SettingsJump {
@@ -31,12 +35,32 @@ private const val JUMP_WINDOW_MS = 5_000L
/** False in the search results, whose rows carry the same labels as the rows they open. */
internal val LocalSearchTargets = staticCompositionLocalOf { true }
/** How far a page has to be scrolled to show a row in its middle, or as near to it as the page's ends allow. */
internal fun centeredScroll(rowTop: Float, rowHeight: Float, page: Float, content: Float): Float =
(rowTop + rowHeight / 2f - page / 2f).coerceIn(0f, (content - page).coerceAtLeast(0f))
/** The part of the page to show around a row to have it in the middle, relative to the row. Null when nothing around it scrolls. */
private fun pageAround(row: LayoutCoordinates): Rect? {
var content = row
while (true) {
val page = content.parentCoordinates ?: return null
if (content.size.height > page.size.height) {
val top = content.localPositionOf(row, Offset.Zero).y
val height = page.size.height.toFloat()
val from = centeredScroll(top, row.size.height.toFloat(), height, content.size.height.toFloat()) - top
return Rect(0f, from, row.size.width.toFloat(), from + height)
}
content = page
}
}
@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class)
@Composable
internal fun Modifier.searchTarget(label: String): Modifier {
val pal = LocalPalette.current
val flash = remember { Animatable(0f) }
val reveal = remember { BringIntoViewRequester() }
val row = remember { arrayOfNulls<LayoutCoordinates>(1) }
var claimed by remember { mutableStateOf<SettingsJump.Target?>(null) }
val target = SettingsJump.target.takeIf { LocalSearchTargets.current }
if (target != null && target.label == label) SideEffect {
@@ -48,7 +72,7 @@ internal fun Modifier.searchTarget(label: String): Modifier {
claimed?.let { mine ->
LaunchedEffect(mine) {
withFrameNanos { }
reveal.bringIntoView()
reveal.bringIntoView(row[0]?.takeIf { it.isAttached }?.let(::pageAround))
repeat(2) {
flash.animateTo(1f, tween(220))
flash.animateTo(0f, tween(420))
@@ -56,7 +80,7 @@ internal fun Modifier.searchTarget(label: String): Modifier {
claimed = null
}
}
return bringIntoViewRequester(reveal).drawBehind {
return bringIntoViewRequester(reveal).onPlaced { row[0] = it }.drawBehind {
if (flash.value > 0f) drawRect(pal.signal.copy(alpha = 0.28f * flash.value))
}
}
@@ -42,7 +42,7 @@ import androidx.compose.ui.semantics.clearAndSetSemantics
@Composable
internal fun SettingsPillSearch(
modifier: Modifier, searching: Boolean, query: String, onQuery: (String) -> Unit,
onOpen: () -> Unit, onClose: () -> Unit, pills: @Composable () -> Unit,
onOpen: () -> Unit, onClose: () -> Unit, keepOpen: Boolean = false, onSearch: () -> Unit = {}, pills: @Composable () -> Unit,
) {
val colors = MaterialTheme.colorScheme
val open by animateFloatAsState(if (searching) 1f else 0f, Motion.sp(0.75f, 420f), label = "settingsSearch")
@@ -53,10 +53,11 @@ internal fun SettingsPillSearch(
var fieldFocused by remember { mutableStateOf(false) }
CancelPendingFocus(focusOnOpen, focusTap, fieldFocused) {
focusOnOpen = false
if (query.isEmpty()) onClose()
if (query.isEmpty() && !keepOpen) onClose()
}
val close = { toIcon = true; focusOnOpen = false; onClose() }
BackHandler(enabled = searching) { close() }
LaunchedEffect(keepOpen) { if (!keepOpen && searching && !fieldFocused && !focusOnOpen && query.isEmpty()) close() }
LaunchedEffect(toIcon, searching, open <= 0.01f) {
if (searching) toIcon = false
else if (toIcon && open <= 0.01f) { focusSoon { icon }; toIcon = false }
@@ -80,10 +81,13 @@ internal fun SettingsPillSearch(
AdbTextField(
value = query, onValueChange = onQuery, label = "", keyboardType = KeyboardType.Text, imeAction = ImeAction.Search,
placeholder = stringResource(R.string.settings_search), compact = true, showLabel = false, focusOnShow = focusOnOpen, focusAtTap = focusTap,
clearFocus = !searching,
clearFocus = !searching, onDone = onSearch,
onFocusChange = { focused ->
fieldFocused = focused
if (!focused && query.isEmpty() && searching) { focusOnOpen = false; onClose() }
if (!focused && query.isEmpty() && searching) {
focusOnOpen = false
if (!keepOpen) onClose()
}
},
)
}
@@ -96,13 +100,19 @@ internal fun SettingsPillSearch(
}
@Composable
internal fun SettingsSearchResults(query: String, frost: Boolean, onOpen: (SettingsSection) -> Unit) {
internal fun SettingsSearchResults(query: String, frost: Boolean, focusFirst: Boolean = false, onSearched: () -> Unit = {}, onOpen: (SettingsSection) -> Unit) {
val ctx = LocalContext.current
val found = remember(query, frost) { SettingsIndex.search(ctx, query, frost) }
if (found.isEmpty()) {
Note(stringResource(R.string.settings_search_none, query.trim()))
return
}
val first = remember { FocusRequester() }
val firstToOpen = found.groupBy { it.place }.values.flatten().firstOrNull { it.section != null || it.tab != null }
val inputMode = androidx.compose.ui.platform.LocalInputModeManager.current
LaunchedEffect(Unit) {
if (focusFirst && firstToOpen != null && inputMode.inputMode == androidx.compose.ui.input.InputMode.Keyboard) focusSoon { first }
}
androidx.compose.runtime.CompositionLocalProvider(LocalSearchTargets provides false) { Column {
found.groupBy { it.place }.forEach { (place, entries) ->
SettingsGroup(stringResource(place.title)) {
@@ -111,10 +121,12 @@ internal fun SettingsSearchResults(query: String, frost: Boolean, onOpen: (Setti
val title = stringResource(entry.title)
val section = entry.section
val tab = entry.tab
val button = if (entry === firstToOpen) Modifier.focusRequester(first) else Modifier
if (section != null) {
ActionRow(title, within, stringResource(R.string.store_open), onClick = { SettingsJump.to(title); onOpen(section) })
ActionRow(title, within, stringResource(R.string.store_open), modifier = button, onClick = { onSearched(); SettingsJump.to(title); onOpen(section) })
} else if (tab != null) {
ActionRow(title, within, stringResource(R.string.store_open), onClick = {
ActionRow(title, within, stringResource(R.string.store_open), modifier = button, onClick = {
onSearched()
SettingsJump.to(title)
if (tab == NavTabs.MORE) MoreTabs.editing = true
if (tab == "downloads") DownloadsNav.showSettings = true
@@ -0,0 +1,101 @@
package com.droiddeck.launcher.ui
import android.content.Context
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.droiddeck.launcher.R
import com.droiddeck.launcher.session.SessionPrefs
/** What was searched for in Settings, newest first. */
internal object SettingsSearchHistory {
const val MAX = 8
var items by mutableStateOf<List<String>>(emptyList())
private set
fun load(context: Context) { items = SessionPrefs.settingsSearches(context) }
fun add(context: Context, query: String) {
val next = withSearch(items, query)
if (next == items) return
items = next
SessionPrefs.setSettingsSearches(context, next)
}
fun clear(context: Context) {
items = emptyList()
SessionPrefs.setSettingsSearches(context, emptyList())
}
fun withSearch(items: List<String>, query: String): List<String> {
val text = query.trim().replace(Regex("\\s+"), " ")
if (text.isEmpty()) return items
return (listOf(text) + items.filterNot { it.equals(text, ignoreCase = true) }).take(MAX)
}
}
@OptIn(ExperimentalLayoutApi::class)
@Composable
internal fun SettingsSearchHistoryList(onPick: (String) -> Unit, onClear: () -> Unit) {
val colors = MaterialTheme.colorScheme
Column(Modifier.fillMaxWidth()) {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(top = 12.dp, bottom = 8.dp)) {
Text(
stringResource(R.string.settings_search_history), fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = colors.onSurfaceVariant,
modifier = Modifier.weight(1f).padding(start = 4.dp),
)
SmallIconButton(Icons.Outlined.Delete, stringResource(R.string.settings_search_history_clear), tint = colors.onSurfaceVariant, onClick = onClear)
}
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
SettingsSearchHistory.items.forEach { HistoryChip(it) { onPick(it) } }
}
}
}
@Composable
private fun HistoryChip(text: String, onClick: () -> Unit) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
val src = remember { MutableInteractionSource() }
val hot = rememberHot(src)
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.heightIn(min = 40.dp).widthIn(min = 56.dp, max = 260.dp).clip(CircleShape)
.background(colors.surface).glideBorder(hot, CircleShape, pal.signal, pal.line)
.hoverable(src).clickable(interactionSource = src, indication = LocalIndication.current, role = Role.Button, onClick = onClick)
.controllerConfirm(onClick = onClick)
.padding(horizontal = 16.dp, vertical = 8.dp),
) { Text(text, fontSize = 14.sp, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis) }
}
@@ -575,9 +575,10 @@ fun <T> ChoiceRow(
chipModifier: Modifier = Modifier,
hintLines: Int? = null,
stacked: Boolean = false,
sideBySide: Boolean = false,
onPick: (T) -> Unit,
) {
SettingsRow(label, hint, highlighted = host.open == key, hintLines = hintLines, stacked = stacked) {
SettingsRow(label, hint, highlighted = host.open == key, hintLines = hintLines, stacked = stacked, sideBySide = sideBySide) {
ChoiceChip(host, key, label, options, selected, enabled, note, chipModifier, onPick)
}
}
@@ -752,6 +753,7 @@ fun ValueSlider(
fun MultiRow(
host: MenuHost, key: String, label: String, hint: String?,
items: List<Pair<Int, String>>, selected: Set<Int>, enabled: Boolean = true, note: String? = null,
sideBySide: Boolean = false,
onToggle: (Int, Boolean) -> Unit,
) {
val open = host.open == key
@@ -760,7 +762,7 @@ fun MultiRow(
selected.isEmpty() -> stringResource(R.string.widgets_none)
else -> stringResource(R.string.widgets_n_of_m, selected.size, items.size)
}
SettingsRow(label, hint, highlighted = open) {
SettingsRow(label, hint, highlighted = open, sideBySide = sideBySide) {
Box {
ValueChip(summary, open, enabled) { host.open = if (open) null else key }
AnchoredMenu(open, onDismiss = { if (host.open == key) host.open = null }, title = label, note = note) { firstItemFocus ->
@@ -37,6 +37,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
@@ -67,20 +68,48 @@ internal fun SteamIntegration.State.enabled(feature: Feature) = when (feature) {
internal fun SteamIntegration.State.enabledCount() = Feature.entries.count { enabled(it) }
class SteamIntegrationFocusRequest(val feature: Feature?) {
private var pending = true
internal fun consume(): Boolean {
if (!pending) return false
pending = false
return true
}
}
@Composable
internal fun SteamIntegrationGroup(
state: SteamIntegration.State,
focus: Feature? = null,
focus: SteamIntegrationFocusRequest? = null,
onFeature: (Feature) -> Unit,
onAppInfo: () -> Unit,
onLocation: () -> Unit = {},
collapsible: Boolean = false,
) {
var expanded by rememberSaveable { mutableStateOf(false) }
var revealRequest by remember { mutableStateOf<SteamIntegrationFocusRequest?>(null) }
LaunchedEffect(focus) {
revealRequest = focus?.takeIf { it.consume() }
if (revealRequest != null) expanded = true
}
val count = stringResource(R.string.integration_count, state.enabledCount(), Feature.entries.size)
SettingsGroup(
stringResource(R.string.integration_title),
detail = stringResource(R.string.integration_count, state.enabledCount(), Feature.entries.size),
detail = count.takeUnless { collapsible },
) {
Feature.entries.forEachIndexed { i, feature ->
IntegrationRow(state, feature, focus == feature, i < Feature.entries.lastIndex, onFeature, onAppInfo, onLocation)
if (collapsible) ActionRow(
count, stringResource(R.string.integration_manage_hint),
stringResource(if (expanded) R.string.common_close else R.string.setup_manage),
onClick = {
revealRequest = null
expanded = !expanded
}, sideBySide = true,
)
if (!collapsible || expanded) {
Feature.entries.forEachIndexed { i, feature ->
IntegrationRow(state, feature, revealRequest?.takeIf { it.feature == feature }, i < Feature.entries.lastIndex, onFeature, onAppInfo, onLocation)
}
}
}
}
@@ -90,7 +119,7 @@ internal fun SteamIntegrationGroup(
private fun IntegrationRow(
state: SteamIntegration.State,
feature: Feature,
focused: Boolean,
focus: SteamIntegrationFocusRequest?,
divider: Boolean,
onFeature: (Feature) -> Unit,
onAppInfo: () -> Unit,
@@ -101,8 +130,8 @@ private fun IntegrationRow(
val on = state.enabled(feature)
var flash by remember { mutableStateOf(false) }
val reveal = remember { BringIntoViewRequester() }
LaunchedEffect(focused) {
if (focused) try { flash = true; reveal.bringIntoView(); kotlinx.coroutines.delay(1600) } finally { flash = false }
LaunchedEffect(focus) {
if (focus != null) try { flash = true; reveal.bringIntoView(); kotlinx.coroutines.delay(1600) } finally { flash = false }
}
val bg by animateColorAsState(if (flash) pal.signal.copy(alpha = 0.12f) else Color.Transparent, Motion.tw(400), label = "integrationFlash")
val wifiLocationOff = feature == Feature.WIFI && state.wifi && state.locationPermission && !state.locationOn
@@ -14,6 +14,7 @@ import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.key
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.CompositionLocalProvider
@@ -88,7 +89,7 @@ object Themes {
var rgbSpeed by mutableStateOf(DEFAULT_RGB_SPEED)
private set
var rgbHue by mutableStateOf(0f)
@Volatile var rgbHue = 0f
private set
fun moveRgbHue(hue: Float) {
@@ -237,8 +238,36 @@ fun DroidDeckTheme(theme: String? = null, appScale: Int = AppUiPrefs.DEFAULT_SCA
val context = LocalContext.current
remember(context) { Themes.loadGradient(context) }
val id = theme ?: SessionPrefs.theme(context)
if (id == Themes.INNER_GAMER) InnerGamerHue(Themes.rgbSpeed)
val solid = Themes.byId(id)
val solid = if (id == Themes.INNER_GAMER) {
rememberInnerGamerPalette(Themes.rgbSpeed)
} else {
Themes.byId(id)
}
DroidDeckThemePalette(solid, appScale, frost, content)
}
@Composable
private fun rememberInnerGamerPalette(speed: Int): Palette = key(speed) {
val start = remember { Themes.rgbHue }
val animatedHue by rememberInfiniteTransition(label = "innerGamer").animateFloat(
start, start + 360f,
infiniteRepeatable(
tween(Themes.rgbCycleMillis(speed).coerceAtLeast(1), easing = LinearEasing),
RepeatMode.Restart,
),
label = "hue",
)
val steppedHue by remember {
derivedStateOf {
((animatedHue % 360f) / Themes.RGB_HUE_STEP).toInt() * Themes.RGB_HUE_STEP
}
}
SideEffect { Themes.moveRgbHue(steppedHue) }
Themes.innerGamer(steppedHue)
}
@Composable
private fun DroidDeckThemePalette(solid: Palette, appScale: Int, frost: FrostChoice?, content: @Composable () -> Unit) {
val look = frost?.let { frostLook(solid, it) }
val p = if (look == null) solid else solid.frosted(look)
val baseDensity = LocalDensity.current
@@ -286,17 +315,3 @@ private val ContentDirected = Typography().run {
)
}
@Composable
private fun InnerGamerHue(speed: Int) {
key(speed) { InnerGamerCycle(speed) }
}
@Composable
private fun InnerGamerCycle(speed: Int) {
val start = remember { Themes.rgbHue }
val hue by rememberInfiniteTransition(label = "innerGamer").animateFloat(
start, start + 360f, infiniteRepeatable(tween(Themes.rgbCycleMillis(speed).coerceAtLeast(1), easing = LinearEasing), RepeatMode.Restart), label = "hue",
)
val stepped = ((hue % 360f) / Themes.RGB_HUE_STEP).toInt() * Themes.RGB_HUE_STEP
SideEffect { Themes.moveRgbHue(stepped) }
}
+3
View File
@@ -1336,6 +1336,7 @@
<string name="ctrl_size">حجم الأزرار</string>
<string name="ctrl_adaptive">عصي تكيّفية</string>
<string name="ctrl_rumble">اهتزاز اللعبة</string>
<string name="ctrl_direct_controller">وحدة تحكم مباشرة</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">فتح</string>
<string name="air_triggers_use">استخدام Air Triggers</string>
@@ -4356,4 +4357,6 @@
<string name="glasses_show_shortcut_hint">إظهار زر النظارات الذكية العائم فوق اللعبة.</string>
<string name="display_filter_game_profile">استخدام ملف تعريف %1$s: %2$s</string>
<string name="display_filter_default_profile">استخدام الملف التعريفي الافتراضي: %1$s</string>
<string name="settings_search_history">سجل البحث</string>
<string name="settings_search_history_clear">مسح سجل البحث</string>
</resources>
@@ -1342,6 +1342,7 @@
<string name="ctrl_size">Tamaño de botones</string>
<string name="ctrl_adaptive">Sticks adaptables</string>
<string name="ctrl_rumble">Vibración en juegos</string>
<string name="ctrl_direct_controller">Control directo</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Abrir</string>
<string name="air_triggers_use">Usar los Air Triggers</string>
@@ -4234,4 +4235,6 @@
<string name="glasses_show_shortcut_hint">Mostrar el botón flotante de Smart Glasses sobre el juego.</string>
<string name="display_filter_game_profile">Usando el perfil %1$s: %2$s</string>
<string name="display_filter_default_profile">Usando el perfil predeterminado: %1$s</string>
<string name="settings_search_history">Historial de búsqueda</string>
<string name="settings_search_history_clear">Borrar historial de búsqueda</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">Размер на бутоните</string>
<string name="ctrl_adaptive">Адаптивни стикове</string>
<string name="ctrl_rumble">Вибрация от играта</string>
<string name="ctrl_direct_controller">Директен контролер</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Отвори</string>
<string name="air_triggers_use">Използвай Air Triggers</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Показва плаващия бутон за Smart Glasses върху играта.</string>
<string name="display_filter_game_profile">Използва се профил %1$s: %2$s</string>
<string name="display_filter_default_profile">Използва се профилът по подразбиране: %1$s</string>
<string name="settings_search_history">История на търсенето</string>
<string name="settings_search_history_clear">Изчистване на историята на търсенето</string>
</resources>
+3
View File
@@ -1322,6 +1322,7 @@
<string name="ctrl_size">Velikost tlačítek</string>
<string name="ctrl_adaptive">Adaptivní páčky</string>
<string name="ctrl_rumble">Vibrace ve hře</string>
<string name="ctrl_direct_controller">Přímý ovladač</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Otevřít</string>
<string name="air_triggers_use">Používat Air Triggers</string>
@@ -4276,4 +4277,6 @@
<string name="glasses_show_shortcut_hint">Zobrazit plovoucí tlačítko Smart Glasses nad hrou.</string>
<string name="display_filter_game_profile">Používá se profil %1$s: %2$s</string>
<string name="display_filter_default_profile">Používá se výchozí profil: %1$s</string>
<string name="settings_search_history">Historie hledání</string>
<string name="settings_search_history_clear">Vymazat historii hledání</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">Knapstørrelse</string>
<string name="ctrl_adaptive">Adaptive styrepinde</string>
<string name="ctrl_rumble">Spilvibration</string>
<string name="ctrl_direct_controller">Direkte controller</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Åbn</string>
<string name="air_triggers_use">Brug Air Triggers</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Vis den flydende Smart Glasses-knap oven på spillet.</string>
<string name="display_filter_game_profile">Bruger profilen %1$s: %2$s</string>
<string name="display_filter_default_profile">Bruger standardprofilen: %1$s</string>
<string name="settings_search_history">Søgehistorik</string>
<string name="settings_search_history_clear">Ryd søgehistorik</string>
</resources>
+3
View File
@@ -1300,6 +1300,7 @@
<string name="ctrl_size">Tastengröße</string>
<string name="ctrl_adaptive">Adaptive Sticks</string>
<string name="ctrl_rumble">Spielvibration</string>
<string name="ctrl_direct_controller">Direkter Controller</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Öffnen</string>
<string name="air_triggers_use">Air Triggers verwenden</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Die schwebende Smart-Glasses-Schaltfläche über dem Spiel anzeigen.</string>
<string name="display_filter_game_profile">Profil %1$s wird verwendet: %2$s</string>
<string name="display_filter_default_profile">Standardprofil wird verwendet: %1$s</string>
<string name="settings_search_history">Suchverlauf</string>
<string name="settings_search_history_clear">Suchverlauf löschen</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">Μέγεθος κουμπιών</string>
<string name="ctrl_adaptive">Προσαρμοστικοί μοχλοί</string>
<string name="ctrl_rumble">Κραδασμός παιχνιδιού</string>
<string name="ctrl_direct_controller">Άμεσο χειριστήριο</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Άνοιγμα</string>
<string name="air_triggers_use">Χρήση Air Triggers</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Εμφάνιση του αιωρούμενου κουμπιού Smart Glasses πάνω από το παιχνίδι.</string>
<string name="display_filter_game_profile">Χρήση προφίλ %1$s: %2$s</string>
<string name="display_filter_default_profile">Χρήση προεπιλεγμένου προφίλ: %1$s</string>
<string name="settings_search_history">Ιστορικό αναζήτησης</string>
<string name="settings_search_history_clear">Εκκαθάριση ιστορικού αναζήτησης</string>
</resources>
+3
View File
@@ -1315,6 +1315,7 @@
<string name="ctrl_size">Tamaño de botones</string>
<string name="ctrl_adaptive">Sticks adaptables</string>
<string name="ctrl_rumble">Vibración en juegos</string>
<string name="ctrl_direct_controller">Mando directo</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Abrir</string>
<string name="air_triggers_use">Usar los Air Triggers</string>
@@ -4236,4 +4237,6 @@
<string name="glasses_show_shortcut_hint">Mostrar el botón flotante de Smart Glasses sobre el juego.</string>
<string name="display_filter_game_profile">Usando el perfil %1$s: %2$s</string>
<string name="display_filter_default_profile">Usando el perfil predeterminado: %1$s</string>
<string name="settings_search_history">Historial de búsqueda</string>
<string name="settings_search_history_clear">Borrar historial de búsqueda</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">Painikkeiden koko</string>
<string name="ctrl_adaptive">Mukautuvat sauvat</string>
<string name="ctrl_rumble">Pelin tärinä</string>
<string name="ctrl_direct_controller">Suora ohjain</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Avaa</string>
<string name="air_triggers_use">Käytä Air Triggereitä</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Näytä pelin päällä kelluva Smart Glasses -painike.</string>
<string name="display_filter_game_profile">Käytössä profiili %1$s: %2$s</string>
<string name="display_filter_default_profile">Käytössä oletusprofiili: %1$s</string>
<string name="settings_search_history">Hakuhistoria</string>
<string name="settings_search_history_clear">Tyhjennä hakuhistoria</string>
</resources>
+3
View File
@@ -1314,6 +1314,7 @@
<string name="ctrl_size">Taille des boutons</string>
<string name="ctrl_adaptive">Joystick adaptatif</string>
<string name="ctrl_rumble">Vibration du jeu</string>
<string name="ctrl_direct_controller">Manette directe</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Ouvrir</string>
<string name="air_triggers_use">Utiliser les Air Triggers</string>
@@ -4235,4 +4236,6 @@
<string name="glasses_show_shortcut_hint">Afficher le bouton flottant Smart Glasses par-dessus le jeu.</string>
<string name="display_filter_game_profile">Profil %1$s utilisé : %2$s</string>
<string name="display_filter_default_profile">Profil par défaut utilisé : %1$s</string>
<string name="settings_search_history">Historique de recherche</string>
<string name="settings_search_history_clear">Effacer l\'historique de recherche</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">बटन का आकार</string>
<string name="ctrl_adaptive">एडैप्टिव स्टिक</string>
<string name="ctrl_rumble">गेम वाइब्रेशन</string>
<string name="ctrl_direct_controller">डायरेक्ट कंट्रोलर</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">खोलें</string>
<string name="air_triggers_use">Air Triggers इस्तेमाल करें</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">गेम के ऊपर तैरता हुआ Smart Glasses बटन दिखाएँ।</string>
<string name="display_filter_game_profile">%1$s प्रोफ़ाइल का उपयोग: %2$s</string>
<string name="display_filter_default_profile">डिफ़ॉल्ट प्रोफ़ाइल का उपयोग: %1$s</string>
<string name="settings_search_history">खोज इतिहास</string>
<string name="settings_search_history_clear">खोज इतिहास मिटाएं</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">Gombméret</string>
<string name="ctrl_adaptive">Adaptív karok</string>
<string name="ctrl_rumble">Játékvibráció</string>
<string name="ctrl_direct_controller">Közvetlen kontroller</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Megnyitás</string>
<string name="air_triggers_use">Air Triggers használata</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">A játék fölött lebegő Smart Glasses gomb megjelenítése.</string>
<string name="display_filter_game_profile">Használt profil: %1$s – %2$s</string>
<string name="display_filter_default_profile">Alapértelmezett profil használata: %1$s</string>
<string name="settings_search_history">Keresési előzmények</string>
<string name="settings_search_history_clear">Keresési előzmények törlése</string>
</resources>
+3
View File
@@ -1302,6 +1302,7 @@
<string name="ctrl_size">Ukuran tombol</string>
<string name="ctrl_adaptive">Stik adaptif</string>
<string name="ctrl_rumble">Getaran gim</string>
<string name="ctrl_direct_controller">Pengontrol langsung</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Buka</string>
<string name="air_triggers_use">Gunakan Air Triggers</string>
@@ -4166,4 +4167,6 @@
<string name="glasses_show_shortcut_hint">Tampilkan tombol Smart Glasses mengambang di atas game.</string>
<string name="display_filter_game_profile">Menggunakan profil %1$s: %2$s</string>
<string name="display_filter_default_profile">Menggunakan profil default: %1$s</string>
<string name="settings_search_history">Riwayat pencarian</string>
<string name="settings_search_history_clear">Hapus riwayat pencarian</string>
</resources>
+3
View File
@@ -1306,6 +1306,7 @@
<string name="ctrl_size">Dimensione dei tasti</string>
<string name="ctrl_adaptive">Levette adattive</string>
<string name="ctrl_rumble">Vibrazione di gioco</string>
<string name="ctrl_direct_controller">Controller diretto</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Apri</string>
<string name="air_triggers_use">Usa gli Air Triggers</string>
@@ -4235,4 +4236,6 @@
<string name="glasses_show_shortcut_hint">Mostra il pulsante mobile Smart Glasses sopra il gioco.</string>
<string name="display_filter_game_profile">Profilo %1$s in uso: %2$s</string>
<string name="display_filter_default_profile">Profilo predefinito in uso: %1$s</string>
<string name="settings_search_history">Cronologia ricerche</string>
<string name="settings_search_history_clear">Cancella cronologia ricerche</string>
</resources>
+3
View File
@@ -1302,6 +1302,7 @@
<string name="ctrl_size">ボタンのサイズ</string>
<string name="ctrl_adaptive">アダプティブスティック</string>
<string name="ctrl_rumble">ゲームの振動</string>
<string name="ctrl_direct_controller">ダイレクトコントローラー</string>
<string name="air_triggers_title">Redmagic エアトリガー</string>
<string name="air_triggers_open">開く</string>
<string name="air_triggers_use">エアトリガーを使う</string>
@@ -4166,4 +4167,6 @@
<string name="glasses_show_shortcut_hint">ゲーム画面上に Smart Glasses のフローティングボタンを表示します。</string>
<string name="display_filter_game_profile">%1$s プロファイルを使用中: %2$s</string>
<string name="display_filter_default_profile">デフォルトプロファイルを使用中: %1$s</string>
<string name="settings_search_history">検索履歴</string>
<string name="settings_search_history_clear">検索履歴を消去</string>
</resources>
+3
View File
@@ -1302,6 +1302,7 @@
<string name="ctrl_size">버튼 크기</string>
<string name="ctrl_adaptive">적응형 스틱</string>
<string name="ctrl_rumble">게임 진동</string>
<string name="ctrl_direct_controller">다이렉트 컨트롤러</string>
<string name="air_triggers_title">Redmagic 에어 트리거</string>
<string name="air_triggers_open">열기</string>
<string name="air_triggers_use">에어 트리거 사용</string>
@@ -4166,4 +4167,6 @@
<string name="glasses_show_shortcut_hint">게임 위에 떠 있는 Smart Glasses 버튼을 표시합니다.</string>
<string name="display_filter_game_profile">%1$s 프로필 사용 중: %2$s</string>
<string name="display_filter_default_profile">기본 프로필 사용 중: %1$s</string>
<string name="settings_search_history">검색 기록</string>
<string name="settings_search_history_clear">검색 기록 지우기</string>
</resources>
+3
View File
@@ -1302,6 +1302,7 @@
<string name="ctrl_size">Saiz butang</string>
<string name="ctrl_adaptive">Stik adaptif</string>
<string name="ctrl_rumble">Getaran permainan</string>
<string name="ctrl_direct_controller">Pengawal terus</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Buka</string>
<string name="air_triggers_use">Guna Air Triggers</string>
@@ -4166,4 +4167,6 @@
<string name="glasses_show_shortcut_hint">Tunjukkan butang Smart Glasses terapung di atas permainan.</string>
<string name="display_filter_game_profile">Menggunakan profil %1$s: %2$s</string>
<string name="display_filter_default_profile">Menggunakan profil lalai: %1$s</string>
<string name="settings_search_history">Sejarah carian</string>
<string name="settings_search_history_clear">Kosongkan sejarah carian</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">Knappestørrelse</string>
<string name="ctrl_adaptive">Adaptive stikker</string>
<string name="ctrl_rumble">Spillvibrasjon</string>
<string name="ctrl_direct_controller">Direkte kontroller</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Åpne</string>
<string name="air_triggers_use">Bruk Air Triggers</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Vis den flytende Smart Glasses-knappen over spillet.</string>
<string name="display_filter_game_profile">Bruker profilen %1$s: %2$s</string>
<string name="display_filter_default_profile">Bruker standardprofilen: %1$s</string>
<string name="settings_search_history">Søkelogg</string>
<string name="settings_search_history_clear">Tøm søkeloggen</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">Knopgrootte</string>
<string name="ctrl_adaptive">Adaptieve sticks</string>
<string name="ctrl_rumble">Trillen in games</string>
<string name="ctrl_direct_controller">Directe controller</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Openen</string>
<string name="air_triggers_use">Air Triggers gebruiken</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Toon de zwevende Smart Glasses-knop boven het spel.</string>
<string name="display_filter_game_profile">Profiel %1$s in gebruik: %2$s</string>
<string name="display_filter_default_profile">Standaardprofiel in gebruik: %1$s</string>
<string name="settings_search_history">Zoekgeschiedenis</string>
<string name="settings_search_history_clear">Zoekgeschiedenis wissen</string>
</resources>
+3
View File
@@ -1322,6 +1322,7 @@
<string name="ctrl_size">Rozmiar przycisków</string>
<string name="ctrl_adaptive">Adaptacyjne gałki</string>
<string name="ctrl_rumble">Wibracje gry</string>
<string name="ctrl_direct_controller">Bezpośredni kontroler</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Otwórz</string>
<string name="air_triggers_use">Używaj Air Triggers</string>
@@ -4276,4 +4277,6 @@
<string name="glasses_show_shortcut_hint">Pokaż pływający przycisk Smart Glasses nad grą.</string>
<string name="display_filter_game_profile">Używany profil %1$s: %2$s</string>
<string name="display_filter_default_profile">Używany profil domyślny: %1$s</string>
<string name="settings_search_history">Historia wyszukiwania</string>
<string name="settings_search_history_clear">Wyczyść historię wyszukiwania</string>
</resources>
@@ -1306,6 +1306,7 @@
<string name="ctrl_size">Tamanho dos botões</string>
<string name="ctrl_adaptive">Analógicos adaptáveis</string>
<string name="ctrl_rumble">Vibração do jogo</string>
<string name="ctrl_direct_controller">Comando direto</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Abrir</string>
<string name="air_triggers_use">Utilizar os Air Triggers</string>
@@ -4235,4 +4236,6 @@
<string name="glasses_show_shortcut_hint">Mostrar o botão flutuante do Smart Glasses sobre o jogo.</string>
<string name="display_filter_game_profile">Perfil %1$s em utilização: %2$s</string>
<string name="display_filter_default_profile">Perfil predefinido em utilização: %1$s</string>
<string name="settings_search_history">Histórico de pesquisa</string>
<string name="settings_search_history_clear">Limpar histórico de pesquisa</string>
</resources>
+3
View File
@@ -1314,6 +1314,7 @@
<string name="ctrl_size">Tamanho dos botões</string>
<string name="ctrl_adaptive">Analógicos adaptáveis</string>
<string name="ctrl_rumble">Vibração do jogo</string>
<string name="ctrl_direct_controller">Controle direto</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Abrir</string>
<string name="air_triggers_use">Usar os Air Triggers</string>
@@ -4243,4 +4244,6 @@
<string name="glasses_show_shortcut_hint">Mostrar o botão flutuante do Smart Glasses sobre o jogo.</string>
<string name="display_filter_game_profile">Perfil %1$s em uso: %2$s</string>
<string name="display_filter_default_profile">Perfil predefinido em uso: %1$s</string>
<string name="settings_search_history">Histórico de pesquisa</string>
<string name="settings_search_history_clear">Limpar histórico de pesquisa</string>
</resources>
+3
View File
@@ -1315,6 +1315,7 @@
<string name="ctrl_size">Dimensiunea butoanelor</string>
<string name="ctrl_adaptive">Manșe adaptive</string>
<string name="ctrl_rumble">Vibrații de joc</string>
<string name="ctrl_direct_controller">Controller direct</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Deschide</string>
<string name="air_triggers_use">Folosește Air Triggers</string>
@@ -4236,4 +4237,6 @@
<string name="glasses_show_shortcut_hint">Afișează butonul plutitor Smart Glasses peste joc.</string>
<string name="display_filter_game_profile">Se folosește profilul %1$s: %2$s</string>
<string name="display_filter_default_profile">Se folosește profilul implicit: %1$s</string>
<string name="settings_search_history">Istoricul căutărilor</string>
<string name="settings_search_history_clear">Șterge istoricul căutărilor</string>
</resources>
+3
View File
@@ -1322,6 +1322,7 @@
<string name="ctrl_size">Размер кнопок</string>
<string name="ctrl_adaptive">Адаптивные стики</string>
<string name="ctrl_rumble">Вибрация в играх</string>
<string name="ctrl_direct_controller">Прямой контроллер</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Открыть</string>
<string name="air_triggers_use">Использовать Air Triggers</string>
@@ -4277,4 +4278,6 @@
<string name="glasses_show_shortcut_hint">Показывать плавающую кнопку Smart Glasses поверх игры.</string>
<string name="display_filter_game_profile">Используется профиль %1$s: %2$s</string>
<string name="display_filter_default_profile">Используется профиль по умолчанию: %1$s</string>
<string name="settings_search_history">История поиска</string>
<string name="settings_search_history_clear">Очистить историю поиска</string>
</resources>
+3
View File
@@ -1308,6 +1308,7 @@
<string name="ctrl_size">Knappstorlek</string>
<string name="ctrl_adaptive">Adaptiva spakar</string>
<string name="ctrl_rumble">Spelvibration</string>
<string name="ctrl_direct_controller">Direkt handkontroll</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Öppna</string>
<string name="air_triggers_use">Använd Air Triggers</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Visa den flytande Smart Glasses-knappen ovanpå spelet.</string>
<string name="display_filter_game_profile">Använder profilen %1$s: %2$s</string>
<string name="display_filter_default_profile">Använder standardprofilen: %1$s</string>
<string name="settings_search_history">Sökhistorik</string>
<string name="settings_search_history_clear">Rensa sökhistorik</string>
</resources>
+3
View File
@@ -1302,6 +1302,7 @@
<string name="ctrl_size">ขนาดปุ่ม</string>
<string name="ctrl_adaptive">สติ๊กแบบปรับอัตโนมัติ</string>
<string name="ctrl_rumble">การสั่นของเกม</string>
<string name="ctrl_direct_controller">คอนโทรลเลอร์โดยตรง</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">เปิด</string>
<string name="air_triggers_use">ใช้ Air Triggers</string>
@@ -4166,4 +4167,6 @@
<string name="glasses_show_shortcut_hint">แสดงปุ่ม Smart Glasses แบบลอยทับบนเกม</string>
<string name="display_filter_game_profile">ใช้โปรไฟล์ %1$s: %2$s</string>
<string name="display_filter_default_profile">ใช้โปรไฟล์เริ่มต้น: %1$s</string>
<string name="settings_search_history">ประวัติการค้นหา</string>
<string name="settings_search_history_clear">ล้างประวัติการค้นหา</string>
</resources>
+3
View File
@@ -1300,6 +1300,7 @@
<string name="ctrl_size">Düğme boyutu</string>
<string name="ctrl_adaptive">Uyarlanabilir çubuklar</string>
<string name="ctrl_rumble">Oyun titreşimi</string>
<string name="ctrl_direct_controller">Doğrudan kumanda</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Aç</string>
<string name="air_triggers_use">Air Triggers kullan</string>
@@ -4196,4 +4197,6 @@
<string name="glasses_show_shortcut_hint">Oyun üzerinde yüzen Smart Glasses düğmesini göster.</string>
<string name="display_filter_game_profile">%1$s profili kullanılıyor: %2$s</string>
<string name="display_filter_default_profile">Varsayılan profil kullanılıyor: %1$s</string>
<string name="settings_search_history">Arama geçmişi</string>
<string name="settings_search_history_clear">Arama geçmişini temizle</string>
</resources>
+3
View File
@@ -1322,6 +1322,7 @@
<string name="ctrl_size">Розмір кнопок</string>
<string name="ctrl_adaptive">Адаптивні стики</string>
<string name="ctrl_rumble">Вібрація гри</string>
<string name="ctrl_direct_controller">Прямий контролер</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Відкрити</string>
<string name="air_triggers_use">Використовувати Air Triggers</string>
@@ -4276,4 +4277,6 @@
<string name="glasses_show_shortcut_hint">Показувати плаваючу кнопку Smart Glasses поверх гри.</string>
<string name="display_filter_game_profile">Використовується профіль %1$s: %2$s</string>
<string name="display_filter_default_profile">Використовується профіль за замовчуванням: %1$s</string>
<string name="settings_search_history">Історія пошуку</string>
<string name="settings_search_history_clear">Очистити історію пошуку</string>
</resources>
+3
View File
@@ -1302,6 +1302,7 @@
<string name="ctrl_size">Kích thước nút</string>
<string name="ctrl_adaptive">Cần thích ứng</string>
<string name="ctrl_rumble">Rung khi chơi game</string>
<string name="ctrl_direct_controller">Tay cầm trực tiếp</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Mở</string>
<string name="air_triggers_use">Dùng Air Triggers</string>
@@ -4166,4 +4167,6 @@
<string name="glasses_show_shortcut_hint">Hiển thị nút Smart Glasses nổi phía trên trò chơi.</string>
<string name="display_filter_game_profile">Đang dùng hồ sơ %1$s: %2$s</string>
<string name="display_filter_default_profile">Đang dùng hồ sơ mặc định: %1$s</string>
<string name="settings_search_history">Lịch sử tìm kiếm</string>
<string name="settings_search_history_clear">Xóa lịch sử tìm kiếm</string>
</resources>
@@ -1385,6 +1385,7 @@
<string name="ctrl_size">按钮大小</string>
<string name="ctrl_adaptive">自适应摇杆</string>
<string name="ctrl_rumble">游戏震动</string>
<string name="ctrl_direct_controller">直连手柄</string>
<string name="air_triggers_title">红魔肩键</string>
<string name="air_triggers_open">打开</string>
<string name="air_triggers_use">使用肩键</string>
@@ -4164,4 +4165,6 @@
<string name="glasses_show_shortcut_hint">在游戏画面上显示悬浮的 Smart Glasses 按钮。</string>
<string name="display_filter_game_profile">正在使用 %1$s 配置:%2$s</string>
<string name="display_filter_default_profile">正在使用默认配置:%1$s</string>
<string name="settings_search_history">搜索历史</string>
<string name="settings_search_history_clear">清除搜索历史</string>
</resources>
@@ -1301,6 +1301,7 @@
<string name="ctrl_size">按鍵大小</string>
<string name="ctrl_adaptive">自動調整搖桿</string>
<string name="ctrl_rumble">遊戲震動</string>
<string name="ctrl_direct_controller">直連控制器</string>
<string name="air_triggers_title">紅魔肩鍵</string>
<string name="air_triggers_open">開啟</string>
<string name="air_triggers_use">使用肩鍵</string>
@@ -4164,4 +4165,6 @@
<string name="glasses_show_shortcut_hint">在遊戲畫面上顯示浮動的 Smart Glasses 按鈕。</string>
<string name="display_filter_game_profile">正在使用 %1$s 設定檔:%2$s</string>
<string name="display_filter_default_profile">正在使用預設設定檔:%1$s</string>
<string name="settings_search_history">搜尋記錄</string>
<string name="settings_search_history_clear">清除搜尋記錄</string>
</resources>
@@ -1301,6 +1301,7 @@
<string name="ctrl_size">按鍵大小</string>
<string name="ctrl_adaptive">自適應搖桿</string>
<string name="ctrl_rumble">遊戲震動</string>
<string name="ctrl_direct_controller">直連控制器</string>
<string name="air_triggers_title">紅魔肩鍵</string>
<string name="air_triggers_open">開啟</string>
<string name="air_triggers_use">使用肩鍵</string>
@@ -4164,4 +4165,6 @@
<string name="glasses_show_shortcut_hint">在遊戲畫面上顯示浮動的 Smart Glasses 按鈕。</string>
<string name="display_filter_game_profile">正在使用 %1$s 設定檔:%2$s</string>
<string name="display_filter_default_profile">正在使用預設設定檔:%1$s</string>
<string name="settings_search_history">搜尋記錄</string>
<string name="settings_search_history_clear">清除搜尋記錄</string>
</resources>
@@ -74,6 +74,7 @@
<string name="input_keep_shared">Keep shared</string>
<string name="input_independent_copy">Independent copy</string>
<string name="input_floating_stick">Start stick at touch position</string>
<string name="input_adaptive_capture">Adaptive touch area</string>
<string name="input_hide_idle">Hide stick when not in use</string>
<string name="input_tools">Tools</string>
<string name="input_quick_auto">Auto (%1$s)</string>
+17
View File
@@ -737,6 +737,8 @@
<string name="hud_size_minimal">Minimal</string>
<string name="hud_size_mega">Mega</string>
<string name="hud_size_strip">Strip</string>
<string name="hud_size_side_strip">Side strip</string>
<string name="hud_size_side_strip_hint">Drag the column to either side of the game. Tap the HUD to cycle sizes.</string>
<string name="hud_locked">Lock in place</string>
<string name="hud_locked_hint">Drag the HUD to move it. While it is locked, on-screen controls under it still work.</string>
<string name="hud_hold">Long press</string>
@@ -1503,6 +1505,7 @@
<string name="ctrl_size">Button size</string>
<string name="ctrl_adaptive">Adaptive sticks</string>
<string name="ctrl_rumble">Game vibration</string>
<string name="ctrl_direct_controller">Direct controller</string>
<string name="air_triggers_title">Redmagic Air Triggers</string>
<string name="air_triggers_open">Open</string>
<string name="air_triggers_use">Use Air Triggers</string>
@@ -3338,6 +3341,18 @@
<string name="setup_ready_signed_in">signed in as %1$s</string>
<string name="setup_needs_you">When something needs you</string>
<string name="setup_group_look">Look</string>
<string name="setup_group_home_navigation">Home &amp; navigation</string>
<string name="setup_group_display">Display</string>
<string name="setup_group_input">Input</string>
<string name="setup_session_display">Session display</string>
<string name="setup_session_display_hint">Fullscreen and orientation for Steam and Desktop.</string>
<string name="setup_expand_open">Open</string>
<string name="setup_performance_cpu">CPU</string>
<string name="setup_performance_graphics">Graphics</string>
<string name="setup_performance_advanced">Advanced compatibility</string>
<string name="setup_performance_compatibility">Compatibility settings</string>
<string name="setup_performance_compatibility_hint">Wine synchronization and graphics workarounds.</string>
<string name="integration_manage_hint">Wi-Fi names, brightness, Home, system keys, and Bluetooth.</string>
<string name="setup_group_device">This device</string>
<string name="setup_group_art">Library art</string>
<string name="setup_group_download">Downloads</string>
@@ -4457,6 +4472,8 @@
<string name="settings_search">Search settings</string>
<string name="settings_search_none">No setting matches \"%1$s\"</string>
<string name="settings_search_clear">Clear search</string>
<string name="settings_search_history">Search history</string>
<string name="settings_search_history_clear">Clear search history</string>
<string name="settings_place_settings">Settings</string>
<string name="settings_place_drawer">In-game menu</string>
<string name="settings_place_sheet">Steam or Desktop options (swipe up)</string>
+2
View File
@@ -3,6 +3,8 @@
<style name="AppTheme" parent="@android:style/Theme.Material.NoActionBar">
<item name="android:colorBackground">#FF101418</item>
<item name="android:navigationBarColor">@android:color/black</item>
<item name="android:statusBarColor">@android:color/black</item>
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="SessionTheme" parent="@android:style/Theme.Material.NoActionBar.Fullscreen">
<item name="android:windowBackground">@android:color/black</item>
@@ -0,0 +1,48 @@
package com.droiddeck.launcher.core
import com.droiddeck.launcher.session.SessionFiles
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class CpuFeaturesTest {
@Test fun anArmv80CpuLacksAtomics() {
val cpuInfo = """
processor : 0
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
processor : 1
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
""".trimIndent()
assertTrue(CpuFeatures.lacksAtomics(cpuInfo))
}
@Test fun oneCoreWithoutAtomicsIsEnough() {
val cpuInfo = """
processor : 0
Features : fp asimd atomics
processor : 4
Features : fp asimd
""".trimIndent()
assertTrue(CpuFeatures.lacksAtomics(cpuInfo))
}
@Test fun anArmv82CpuHasAtomics() {
val cpuInfo = """
processor : 0
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
""".trimIndent()
assertFalse(CpuFeatures.lacksAtomics(cpuInfo))
}
@Test fun noFeatureLinesMeansNoEmulation() {
assertFalse(CpuFeatures.lacksAtomics("processor : 0\n"))
assertFalse(CpuFeatures.lacksAtomics(""))
}
@Test fun theEmulatorIsPreloadedFirstOnlyWhenNeededAndStaged() {
assertEquals("/usr/local/lib/droiddeck-lse/liblse_emu.so\n", SessionFiles.lsePreload(lacksAtomics = true, staged = true))
assertEquals("", SessionFiles.lsePreload(lacksAtomics = true, staged = false))
assertEquals("", SessionFiles.lsePreload(lacksAtomics = false, staged = true))
}
}
@@ -15,4 +15,29 @@ class DependencyDetectorTest {
File(folder, "_CommonRedist/vcredist/2013/vcredist_x64.exe").writeText("x")
assertEquals(listOf("vcredist2013"), DependencyDetector.detect(folder).map { it.componentName })
}
@Test fun dotNetRuntimeInstallersMapToTheirOwnRuntime() {
assertEquals(listOf("dotnetcoredesktop3"), DependencyDetector.componentsFor("%INSTALLDIR%\\DotNetCore\\windowsdesktop-runtime-3.1.8-win-x64.exe"))
assertEquals(listOf("dotnetcoredesktop3"), DependencyDetector.componentsFor("_CommonRedist/DotNet/dotnet-runtime-3.1.32-win-x64.exe"))
assertEquals(listOf("dotnet50"), DependencyDetector.componentsFor("_CommonRedist/windowsdesktop-runtime-5.0.17-win-x64.exe"))
assertEquals(listOf("dotnetcoredesktop6"), DependencyDetector.componentsFor("_CommonRedist/windowsdesktop-runtime-6.0.16-win-x64.exe"))
assertEquals(listOf("dotnetcoredesktop8"), DependencyDetector.componentsFor("_CommonRedist/windowsdesktop-runtime-8.0.4-win-x64.exe"))
assertEquals(emptyList<String>(), DependencyDetector.componentsFor("_CommonRedist/windowsdesktop-runtime-9.0.0-win-x64.exe"))
}
@Test fun dotNetFrameworkInstallersKeepTheirMapping() {
assertEquals(listOf("dotnet48"), DependencyDetector.componentsFor("_CommonRedist/DotNet/4.8/ndp48-x86-x64-allos-enu.exe"))
assertEquals(listOf("dotnet472"), DependencyDetector.componentsFor("_CommonRedist/DotNet/4.7.2/NDP472-KB4054530-x86-x64-AllOS-ENU.exe"))
assertEquals(listOf("dotnet46"), DependencyDetector.componentsFor("_CommonRedist/DotNet/4.6.2/NDP462-KB3151800-x86-x64-AllOS-ENU.exe"))
assertEquals(listOf("dotnet40"), DependencyDetector.componentsFor("_CommonRedist/DotNet/dotNetFx40_Full_x86_x64.exe"))
assertEquals(listOf("dotnetcoredesktop6"), DependencyDetector.componentsFor("_CommonRedist/DotNet/6.0/setup_dotnet.exe"))
assertEquals(listOf("dotnet48"), DependencyDetector.componentsFor("_CommonRedist/DotNet/setup_dotnet.exe"))
}
@Test fun aBundledDesktopRuntimeFolderIsNotTakenForTheFramework() {
val folder = tmp.newFolder("Game")
File(folder, "DotNetCore").mkdirs()
File(folder, "DotNetCore/windowsdesktop-runtime-3.1.8-win-x64.exe").writeText("x")
assertEquals(listOf("dotnetcoredesktop3"), DependencyDetector.detect(folder).map { it.componentName })
}
}
@@ -205,6 +205,36 @@ class WinCompSourcesTest {
assertEquals("GOG", picks.getValue("vcredist2015_dll").kind)
}
@Test fun nativeD3dxSelectsItsEffectCompilersForEveryAutomaticSource() {
val catalog = listOf(ready("d3dx9"), ready("d3dcompiler_42"), ready("d3dcompiler_43")).associateBy { it.name }
for (origin in WinCompSources.Origin.values()) {
val finding = WinCompSources.Finding("d3dx9", "DirectX", origin, true)
val picks = AutoComponents.autoPicks(listOf(finding), catalog)
assertEquals(setOf("d3dx9", "d3dcompiler_42", "d3dcompiler_43"), picks.keys)
assertEquals(origin.name, picks.getValue("d3dcompiler_43").kind)
assertEquals(picks.getValue("d3dx9").args, picks.getValue("d3dcompiler_43").args)
assertEquals(setOf("d3dx9"), AutoComponents.autoPicks(listOf(finding), catalog, mapOf("d3dx9" to false)).keys)
assertTrue(AutoComponents.autoPicks(listOf(finding.copy(auto = false)), catalog).isEmpty())
}
assertEquals(setOf("d3dcompiler_42", "d3dcompiler_43"),
AutoComponents.autoPicks(emptyList(), catalog, mapOf("d3dx9" to true)).keys)
assertTrue(AutoComponents.autoPicks(emptyList(), catalog, mapOf("xact" to true)).isEmpty())
}
@Test fun effectCompilerSelectionKeepsIndependentFindingsAndSkipsUnavailableComponents() {
val catalog = listOf(ready("d3dx9"), ready("d3dcompiler_43"),
WinComponents.Component("d3dcompiler_42", "", "", "broken", emptyList(), emptyList())).associateBy { it.name }
val findings = listOf(
WinCompSources.Finding("d3dx9", "DirectX", WinCompSources.Origin.GOG, true),
WinCompSources.Finding("d3dcompiler_43", "Compiler", WinCompSources.Origin.STEAM, true),
)
val picks = AutoComponents.autoPicks(findings, catalog)
assertEquals(setOf("d3dx9", "d3dcompiler_43"), picks.keys)
assertEquals("STEAM", picks.getValue("d3dcompiler_43").kind)
assertEquals(picks.keys, AutoComponents.autoPicks(findings, catalog, mapOf("d3dx9" to false)).keys)
assertEquals(setOf("d3dx9"), AutoComponents.autoPicks(findings.take(1), catalog - "d3dcompiler_43").keys)
}
@Test fun theUsersSwitchWinsOverAnAutoPickEitherWay() {
val key = "12345"
WinComponents.setAuto(app, key, mapOf("d3dx9" to WinComponents.AutoReason("GOG", listOf("DirectX")), "xact" to WinComponents.AutoReason("GOG", listOf("XACT"))))
@@ -279,6 +309,42 @@ class WinCompSourcesTest {
}
}
@Test fun installedD3dxGainsCompilersWithoutReplacingUserChoices() = withFakeWorker {
AutoComponents.catalogOf = { _, _ -> catalog3 + ready("d3dcompiler_42") + ready("d3dcompiler_43") }
installedNow.addAll(catalog3.map { it.name })
val game = payback()
WinComponents.setUser(app, "1262580", "d3dcompiler_42", false)
AutoComponents.queueGame(app, game, asked = true)
assertEquals(listOf("d3dcompiler_43"), downloaded)
assertEquals(setOf("d3dx9", "vcredist2013_dll", "vcredist2019_dll", "d3dcompiler_43"), WinComponents.picks(app, "1262580").toSet())
assertEquals(mapOf("d3dcompiler_42" to false), WinComponents.selection(app, "1262580").user)
assertTrue(AutoComponents.Pending.ids(app, "1262580").isEmpty())
AutoComponents.queueGame(app, game, asked = true)
assertEquals(listOf("d3dcompiler_43"), downloaded)
WinComponents.setUser(app, "1262580", "d3dx9", false)
AutoComponents.queueGame(app, game, asked = true)
assertEquals(setOf("vcredist2013_dll", "vcredist2019_dll"), WinComponents.picks(app, "1262580").toSet())
}
@Test fun manuallySelectedD3dxQueuesCompilersBeforeLaunch() = withFakeWorker {
AutoComponents.catalogOf = { _, _ -> catalog3 + ready("d3dcompiler_42") + ready("d3dcompiler_43") }
installedNow.add("d3dx9")
val game = game(tmp.newFolder("ManualEffects"), Library.ADDED)
val key = AutoComponents.appKey(game)!!
WinComponents.setUser(app, key, "d3dx9", true)
WinComponents.setUser(app, key, "d3dcompiler_42", false)
session = true
gameUp = true
assertTrue(AutoComponents.prepareLaunch(app, game))
assertEquals(listOf("d3dcompiler_43"), AutoComponents.Pending.ids(app, key))
assertTrue(downloaded.isEmpty())
gameUp = false
AutoComponents.drain(app)
assertEquals(listOf("d3dcompiler_43"), downloaded)
assertEquals(setOf("d3dx9", "d3dcompiler_43"), WinComponents.picks(app, key).toSet())
assertTrue(AutoComponents.Pending.ids(app, key).isEmpty())
}
@Test fun anExplicitCheckRefreshesTheCatalogAndAnOfflineCheckUsesTheCache() = withFakeWorker {
installedNow.addAll(catalog3.map { it.name })
val requests = ArrayList<Boolean>()
@@ -97,6 +97,32 @@ class WinComponentDetectorsTest {
assertEquals(emptyList<Pair<String, String>>(), SteamRedists.installScript(File(steamapps, "missing")))
}
@Test fun aDesktopRuntimeTheInstallScriptRunsIsInstalledInsteadOfTheFramework() {
val steamapps = tmp.newFolder("steamapps")
val game = File(steamapps, "common/Launcher Game").apply { mkdirs() }
File(steamapps, "appmanifest_435150.acf").writeText("\"AppState\"\n{\n\t\"SharedDepots\"\n\t{\n\t\t\"228988\"\t\t\"228980\"\n\t\t\"228990\"\t\t\"228980\"\n\t}\n}\n")
File(game, "installscript.vdf").writeText(
"""
"InstallScript"
{
"Run Process"
{
"DotNetCore"
{
"HasRunKey" "HKEY_LOCAL_MACHINE\\Software\\Valve\\Steam\\Apps\\435150"
"process 1" "%INSTALLDIR%\\DotNetCore\\windowsdesktop-runtime-3.1.8-win-x64.exe"
"command 1" "/install /quiet /norestart"
}
}
}
""".trimIndent(),
)
val context = androidx.test.core.app.ApplicationProvider.getApplicationContext<android.content.Context>()
val found = WinCompSources.steamList(context, game, 435150, "Launcher Game", auto = true)
assertEquals(listOf("vcredist2019_dll", "d3dx9", "dotnetcoredesktop3"), found.map { it.component })
assertTrue(found.all { it.auto && it.origin == WinCompSources.Origin.STEAM })
}
@Test fun thePrefixCountsOnlyWhatDroidDeckDidNotPutThere() {
val compat = tmp.newFolder("compatdata", "409710")
val pfx = File(compat, "pfx")
@@ -133,6 +133,38 @@ class DroidDeckHudPanelTest {
}
}
@Test fun sideStripOffersOnlyTheOnePercentLow() {
val readings = DroidDeckHudSize.SIDE_STRIP.rows
assertEquals(listOf("showLow1"), readings.filter { it.startsWith("showLow") })
}
@Test fun sideStripFitsOneSideOfAWideScreenAndUsesItsOwnReadingOrder() {
val app = RuntimeEnvironment.getApplication()
val view = DroidDeckHudView(app)
val config = DroidDeckHudConfig.DEFAULTS + mapOf(
"hudSize" to "side_strip",
"hudOrder" to "strip:showCPUUsage|showRAM;side_strip:showRAM|showFPS|showFPSGraph",
"showClock" to "0",
)
view.applyConfig(DroidDeckHudConfig.encode(config))
view.showForTest(SNAPSHOT, "DXVK", 0L)
val density = app.resources.displayMetrics.density
val height = (360 * density).toInt()
val width = height * 21 / 9
val sideMargin = (width - height * 16 / 9) / 2
view.measure(
View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.AT_MOST),
View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.AT_MOST),
)
assertTrue("HUD fits in one side margin", view.measuredWidth <= sideMargin)
assertTrue("HUD is taller than it is wide", view.measuredHeight > view.measuredWidth)
assertTrue("RAM is first", view.linesForTest().first().startsWith("RAM"))
assertTrue("FPS is second", view.linesForTest()[1].startsWith("FPS"))
assertTrue("The graph is inside the column", view.graphForTest()!!.right < view.measuredWidth)
}
@Test fun everySizeDrawsTheDPanelWithEverythingInsideIt() {
val stats = FrameStats()
var now = 1_000_000_000L
@@ -467,6 +467,7 @@ class InputLibraryTest {
val enabled = InputLibraries.read(context)
val changed = enabled.layouts.single { it.id == overlay.id }
assertEquals(true, changed.adaptiveSticks)
assertTrue(changed.elements.filter { it.kind == InputElementKind.STICK }.all { !it.hideStickAtRest && it.adaptiveCapture == true })
assertTrue(ControllerPrefs.read(context).adaptiveSticks)
assertEquals(overlay.elements.filter { it.kind != InputElementKind.STICK }, changed.elements.filter { it.kind != InputElementKind.STICK })
assertEquals(library.layouts.filter { it.id != overlay.id }, enabled.layouts.filter { it.id != overlay.id })
@@ -336,6 +336,20 @@ class OnScreenLayoutTest {
}
}
@Test fun dockedSticksStayVisibleWithoutExpandingTheirTouchArea() {
val custom = InputSurfaceElement(InputControl.LS, .2f, .2f, .2f, .3f,
id = "custom-stick", hideWhenIdle = true, adaptiveCapture = true)
val layout = SavedInputLayout("custom", "Custom", listOf(custom), aspect = 1.5f)
val overlay = OnScreenLayout.elements(context, layout, 1200, 800, Rect()).single()
assertTrue(overlay.adaptiveStick)
assertTrue(overlay.hideStickAtRest)
val docked = OnScreenLayout.elements(context, layout, 1200, 800, Rect(),
dock = OnScreenLayout.Dock(false, false)).single()
assertFalse(docked.adaptiveStick)
assertFalse(docked.hideStickAtRest)
assertTrue(docked.floating)
}
@Test fun dockedControlsStayInsideTheSafeAreaAtTheDefaultSizeWithoutAControllerKit() {
SessionPrefs.setSteamController(context, SessionPrefs.CONTROLLER_NONE)
ControllerPrefs.setSize(context, 100)
@@ -251,6 +251,52 @@ class BwrapSpawnerPlanTest {
}
}
@Test fun sandboxesSwitchOnTheLseEmulatorWhenItIsPreloaded() {
val context = RuntimeEnvironment.getApplication()
val rootfs = LinuxRuntime.rootDir(context)
val emu = File(rootfs, "usr/local/lib/droiddeck-lse/liblse_emu.so").apply { parentFile?.mkdirs(); writeText("") }
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/droiddeck-lse/liblse_emu.so\n") }
try {
val plan = BwrapSpawner.plan(context, request(op("t" to "dir", "dest" to "/tmp")), dir)
assertEquals("/run/droiddeck-preload/liblse_emu.so", plan.env["LD_PRELOAD"])
assertEquals("1", plan.env["LSE_EMU"])
assertFalse(plan.env.containsKey("LSE_EMU_PATCH"))
val chosen = BwrapSpawner.plan(context, request(op("t" to "dir", "dest" to "/tmp"))
.apply { getJSONObject("env").put("LSE_EMU_PATCH", "0") }, dir)
assertEquals("0", chosen.env["LSE_EMU_PATCH"])
assertEquals("1", chosen.env["LSE_EMU"])
for (inherited in listOf(
"/run/droiddeck-preload/liblse_emu.so /custom.so",
"/custom.so:/run/droiddeck-preload/liblse_emu.so",
)) {
val disabled = BwrapSpawner.plan(context, request(op("t" to "dir", "dest" to "/tmp"))
.apply {
getJSONObject("env").put("LSE_EMU", "0")
getJSONObject("env").put("LD_PRELOAD", inherited)
}, dir)
assertEquals("0", disabled.env["LSE_EMU"])
assertEquals("/custom.so", disabled.env["LD_PRELOAD"])
assertFalse(disabled.binds.any { it.guest == "/run/droiddeck-preload/liblse_emu.so" })
}
} finally {
listOf(emu, preload).forEach { it.delete() }
}
}
@Test fun sandboxesLeaveTheLseSwitchesAloneWithoutTheEmulator() {
val context = RuntimeEnvironment.getApplication()
val rootfs = LinuxRuntime.rootDir(context)
val lib = File(rootfs, "usr/local/lib/libddsession.so").apply { parentFile?.mkdirs(); writeText("") }
val preload = File(rootfs, "etc/ld.so.preload").apply { parentFile?.mkdirs(); writeText("/usr/local/lib/libddsession.so\n") }
try {
val plan = BwrapSpawner.plan(context, request(op("t" to "dir", "dest" to "/tmp")), dir)
assertFalse(plan.env.containsKey("LSE_EMU"))
assertFalse(plan.env.containsKey("LSE_EMU_PATCH"))
} finally {
listOf(lib, preload).forEach { it.delete() }
}
}
@Test fun zypakLaunchesTheBrowserWithoutItsSandbox() {
val context = RuntimeEnvironment.getApplication()
val app = File(runtime, "app").apply { File(this, "bin").mkdirs() }
@@ -0,0 +1,38 @@
package com.droiddeck.launcher.runtime
import android.content.Context
import java.io.File
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
@RunWith(RobolectricTestRunner::class)
class NativeGuestDefaultsTest {
@Test fun savedRuntimeOverridesDoNotDisableNativeExecution() {
val context = RuntimeEnvironment.getApplication()
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit()
.putBoolean("nativeUserland", false)
.putBoolean("prootFastPath", false)
.putBoolean("prootNoSeccomp", true)
.apply()
val root = LinuxRuntime.rootDir(context)
val hook = NativeGuest.hook(root)
val loader = File(root, "usr/lib/ld-linux-aarch64.so.1")
hook.parentFile?.mkdirs()
loader.writeText("fixture")
try {
assertTrue(NativeGuest.nextSession(context))
assertFalse(NativeGuest.enabled(context))
hook.writeText("fixture")
assertTrue(NativeGuest.enabled(context))
assertFalse(ProotFastPath.enabled(context, native = true))
} finally {
hook.delete()
loader.delete()
}
}
}
@@ -94,6 +94,27 @@ class NativeGuestTest {
assertTrue(env.getValue("LD_PRELOAD").replace(File.separatorChar, '/').endsWith("usr/lib/libddnatv-hook.so"))
}
@Test
fun disablingLseKeepsItOutOfTheLoaderAndItsDescendants() {
val root = rootWithLoader()
val emulator = "/usr/lib/liblse_emu.so"
val session = "/usr/lib/libddsession.so"
listOf(emulator, session).forEach { File(root, it.removePrefix("/")).writeText("") }
File(root, "etc/droiddeck").mkdirs()
File(root, "etc/droiddeck/native-preload").writeText("$emulator\n$session\n")
val enabled = NativeGuest.sessionEnvironment(root, emptyList(), "/usr/bin/env")
assertEquals("1", enabled["LSE_EMU"])
assertEquals("$emulator:$session", enabled["DDNATV_PRELOAD"])
assertTrue(enabled.getValue("LD_PRELOAD").startsWith(File(root, emulator.removePrefix("/")).path + ":"))
val disabled = NativeGuest.sessionEnvironment(root, emptyList(), "/usr/bin/env", lseEmu = "0")
assertEquals("0", disabled["LSE_EMU"])
assertEquals(session, disabled["DDNATV_PRELOAD"])
assertEquals(listOf(File(root, session.removePrefix("/")).path, NativeGuest.hook(root).path),
disabled.getValue("LD_PRELOAD").split(':'))
}
@Test
fun theProgramTheLoaderRunsIsNamedInItsEnvironment() {
val root = rootWithLoader()
@@ -27,14 +27,12 @@ class ProotFastPathTest {
}
@Test fun fastPathStaysOffForTheRootfsProot() {
assertTrue(ProotFastPath.allows(preference = true, noSeccomp = false, source = LinuxRuntime.PROOT_PACK))
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = false, source = LinuxRuntime.PROOT_ROOTFS))
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = false, source = LinuxRuntime.PROOT_MISSING))
assertFalse(ProotFastPath.allows(preference = false, noSeccomp = false, source = LinuxRuntime.PROOT_PACK))
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = true, source = LinuxRuntime.PROOT_PACK))
assertTrue(ProotFastPath.allows(source = LinuxRuntime.PROOT_PACK, native = false))
assertFalse(ProotFastPath.allows(source = LinuxRuntime.PROOT_ROOTFS, native = false))
assertFalse(ProotFastPath.allows(source = LinuxRuntime.PROOT_MISSING, native = false))
}
@Test fun fastPathStaysOffWithoutProot() {
assertFalse(ProotFastPath.allows(preference = true, noSeccomp = false, source = LinuxRuntime.PROOT_PACK, nativeUserland = true))
assertFalse(ProotFastPath.allows(source = LinuxRuntime.PROOT_PACK, native = true))
}
}
@@ -5,6 +5,8 @@ import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
import java.nio.file.Files
import java.nio.file.Path
class PageCacheTrimTest {
private val meminfo = "MemFree: 1048576 kB\nActive(file): 2097152 kB\nInactive(file): 1048576 kB\n"
@@ -15,4 +17,31 @@ class PageCacheTrimTest {
@Test fun skipsSmallBuildUp() = assertFalse(PageCacheTrim.shouldTrim(PageCacheTrim.Mem(2000 * 1024, 1200 * 1024), 1000 * 1024))
@Test fun skipsWhenPlentyFree() = assertFalse(PageCacheTrim.shouldTrim(PageCacheTrim.Mem(6000 * 1024, 5000 * 1024), 1000 * 1024))
@Test fun lowFreeAcceptsSmallerBuildUp() = assertTrue(PageCacheTrim.shouldTrim(PageCacheTrim.Mem(500 * 1024, 1200 * 1024), 1000 * 1024))
@Test fun bigFilesSkipLinksButEnterALinkedRoot() {
fun big(dir: Path, name: String): Path = Files.createFile(dir.resolve(name)).also {
java.io.RandomAccessFile(it.toFile(), "rw").use { it.setLength(PageCacheTrim.MIN_FILE_BYTES + 1) }
}
val base = Files.createTempDirectory("dd-trim")
try {
val root = Files.createDirectories(base.resolve("root"))
val outside = Files.createDirectories(base.resolve("outside"))
val big = big(root, "big.bin")
big(Files.createDirectories(root.resolve("sub")), "nested.bin")
Files.createFile(root.resolve("small.bin"))
big(outside, "outside.bin")
Files.createSymbolicLink(root.resolve("linked-dir"), outside)
Files.createSymbolicLink(root.resolve("linked-file"), big)
val rootLink = Files.createSymbolicLink(base.resolve("root-link"), root)
val expected = listOf("big.bin", "nested.bin")
assertEquals(expected, PageCacheTrim.bigFiles(root.toFile()).map { it.name }.sorted())
assertEquals(expected, PageCacheTrim.bigFiles(rootLink.toFile()).map { it.name }.sorted())
val dangling = Files.createSymbolicLink(base.resolve("dangling"), base.resolve("gone"))
assertTrue(PageCacheTrim.bigFiles(dangling.toFile()).isEmpty())
} finally {
base.toFile().deleteRecursively()
}
}
}
@@ -1,5 +1,6 @@
package com.droiddeck.launcher.session
import com.droiddeck.launcher.assumeFilePermissionsEnforced
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
import java.text.SimpleDateFormat
@@ -8,6 +9,7 @@ import java.util.Date
import java.util.Locale
import java.util.concurrent.TimeUnit
import java.util.zip.ZipFile
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
@@ -144,6 +146,136 @@ class SessionLogShareZipTest {
}
}
@Test fun theEasyAntiCheatLauncherLogsFromGamePrefixesComeAlong() {
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
val session = File(LinuxRuntime.logDir(app), "2026-12-05-09-steam").apply { mkdirs() }
val out = File(app.getExternalFilesDir(null), "agent-logs/anticheat")
val prefix = File(SessionPrefs.steamRoot(app, SessionPrefs.activeSteamClientArch(app)), "steamapps/compatdata/976730")
val second = File(app.getExternalFilesDir(null), "second-library-${UUID.randomUUID()}").apply { mkdirs() }
val library = SteamLibraries.add(app, second.path) as SteamLibraries.AddResult.Added
try {
File(session, "session.log").writeText("booted\n")
val eac = File(prefix, "pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/4815162342").apply { mkdirs() }
File(eac, "anticheatlauncher.log").writeText("[Error] Launch Error: 261\n")
File(eac, "old.log").apply {
writeText("stale\n")
setLastModified(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30))
}
val secondEac = File(second, "steamapps/compatdata/976730/pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/b1d0a8c3").apply { mkdirs() }
File(secondEac, "anticheatlauncher.log").writeText("[Error] Launch Error: 206\n")
val signedEac = File(prefix.parentFile, "-1768546955/pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/0a1b").apply { mkdirs() }
File(signedEac, "anticheatlauncher.log").writeText("[Error] Launch Error: 30005\n")
val unsignedEac = File(prefix.parentFile, "2526420341/pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/0a1b").apply { mkdirs() }
File(unsignedEac, "anticheatlauncher.log").writeText("[Error] Launch Error: 30007\n")
val zip = EnhancedSessionLogShare.createLegacy(app, session, outputDirectory = out)!!
ZipFile(zip).use { archive ->
val logs = archive.entries().toList().filter { it.name.startsWith("anticheat/976730/") }
assertEquals(2, logs.size)
assertTrue(logs.all { it.name.endsWith("/anticheatlauncher.log") && !it.name.contains("4815162342") })
val texts = logs.map { archive.getInputStream(it).bufferedReader().readText() }
assertTrue(texts.any { it.contains("Launch Error: 261") })
assertTrue(texts.any { it.contains("Launch Error: 206") })
val aliases = archive.entries().toList().filter { it.name.startsWith("anticheat/2526420341/") }
assertEquals(2, aliases.size)
assertEquals(2, aliases.map { it.name.split('/')[2] }.filter { it.startsWith("library1") }.toSet().size)
val aliasTexts = aliases.map { archive.getInputStream(it).bufferedReader().readText() }
assertTrue(aliasTexts.any { it.contains("Launch Error: 30005") })
assertTrue(aliasTexts.any { it.contains("Launch Error: 30007") })
}
} finally {
SteamLibraries.remove(app, library.entry.id)
out.deleteRecursively()
session.deleteRecursively()
prefix.deleteRecursively()
File(prefix.parentFile, "-1768546955").deleteRecursively()
File(prefix.parentFile, "2526420341").deleteRecursively()
second.deleteRecursively()
}
}
@Test fun theSessionsGameLogComesAlongWhenManyAntiCheatLogsAreFound() {
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
val session = File(LinuxRuntime.logDir(app), "2026-12-05-11-steam").apply { mkdirs() }
val out = File(app.getExternalFilesDir(null), "agent-logs/anticheat-flood")
val compatdata = File(SessionPrefs.steamRoot(app, SessionPrefs.activeSteamClientArch(app)), "steamapps/compatdata")
val prefixes = (0 until 300).map { File(compatdata, "${900000 + it}") }
try {
File(session, "session.log").writeText("booted\n")
File(session, "steam-976730.log").writeText("proton: game started\n")
prefixes.forEach { prefix ->
val eac = File(prefix, "pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/0a1b").apply { mkdirs() }
File(eac, "anticheatlauncher.log").writeText("[Error] Launch Error: 206\n" + "x".repeat(64 * 1024))
}
val zip = EnhancedSessionLogShare.createLegacy(app, session, outputDirectory = out)!!
ZipFile(zip).use { archive ->
val game = archive.entries().toList().single { it.name.endsWith("/steam-976730.log") }
assertTrue(archive.getInputStream(game).bufferedReader().readText().contains("game started"))
}
} finally {
out.deleteRecursively()
session.deleteRecursively()
prefixes.forEach { it.deleteRecursively() }
}
}
@Test fun aDiscoveryFailureStaysInTheManifestWhenRecordsPassTheLimit() {
assumeFilePermissionsEnforced()
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
val session = File(LinuxRuntime.logDir(app), "2026-12-05-10-steam").apply { mkdirs() }
val out = File(app.getExternalFilesDir(null), "agent-logs/manifest-limit")
val compatdata = File(SessionPrefs.steamRoot(app, SessionPrefs.activeSteamClientArch(app)), "steamapps/compatdata").apply { mkdirs() }
try {
repeat(300) {
File(session, "part-$it.log").writeText("line $it\n")
File(session, "wayland-$it.log").writeText("line $it\n")
File(session, "proton-$it.log").writeText("line $it\n")
}
assertTrue(compatdata.setReadable(false, false))
val zip = EnhancedSessionLogShare.createLegacy(app, session, outputDirectory = out)!!
ZipFile(zip).use { archive ->
val manifest = JSONObject(archive.getInputStream(archive.getEntry("diagnostics-manifest.json")).bufferedReader().readText())
val entries = manifest.getJSONArray("entries")
val reasons = (0 until entries.length()).map { entries.getJSONObject(it) }
.filter { it.optString("origin") == "discovery" }.map { it.optString("reason") }
assertTrue(entries.length() > 512)
assertTrue(reasons.toString(), "filesystem-error" in reasons)
}
} finally {
compatdata.setReadable(true, false)
out.deleteRecursively()
session.deleteRecursively()
}
}
@Test fun aPrefixThatDeniesTheAntiCheatFolderIsRecordedAsADiscoveryFailure() {
assumeFilePermissionsEnforced()
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
val session = File(LinuxRuntime.logDir(app), "2026-12-05-12-steam").apply { mkdirs() }
val out = File(app.getExternalFilesDir(null), "agent-logs/anticheat-denied")
val compatdata = File(SessionPrefs.steamRoot(app, SessionPrefs.activeSteamClientArch(app)), "steamapps/compatdata")
val prefix = File(compatdata, "976731")
val users = File(prefix, "pfx/drive_c/users").apply { mkdirs() }
try {
File(session, "session.log").writeText("booted\n")
assertTrue(users.setExecutable(false, false))
val zip = EnhancedSessionLogShare.createLegacy(app, session, outputDirectory = out)!!
ZipFile(zip).use { archive ->
val manifest = JSONObject(archive.getInputStream(archive.getEntry("diagnostics-manifest.json")).bufferedReader().readText())
val entries = manifest.getJSONArray("entries")
val reasons = (0 until entries.length()).map { entries.getJSONObject(it) }
.filter { it.optString("origin") == "discovery" }.map { it.optString("reason") }
assertTrue(reasons.toString(), "filesystem-error" in reasons)
}
} finally {
users.setExecutable(true, false)
out.deleteRecursively()
session.deleteRecursively()
prefix.deleteRecursively()
}
}
@Test fun everyTextFileInTheZipIsScrubbedAndTheStoresAndToolsLogsComeAlong() {
val logs = LinuxRuntime.logDir(app)
val session = File(logs, "2026-10-08-01-steam").apply { mkdirs() }
@@ -4,6 +4,7 @@ import android.graphics.Color
import android.view.ContextThemeWrapper
import com.droiddeck.launcher.R
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
@@ -22,4 +23,17 @@ class AppThemeTest {
assertEquals(0xFF, Color.alpha(color))
assertTrue(Color.luminance(color) < 0.1f)
}
@Test fun theStatusBarIsOpaqueAndDarkSoNothingLightShowsThroughIt() {
val themed = ContextThemeWrapper(RuntimeEnvironment.getApplication(), R.style.AppTheme)
val attrs = themed.obtainStyledAttributes(
intArrayOf(android.R.attr.statusBarColor, android.R.attr.windowLightStatusBar),
)
val color = attrs.getColor(0, Color.TRANSPARENT)
val lightIcons = attrs.getBoolean(1, true)
attrs.recycle()
assertEquals(0xFF, Color.alpha(color))
assertTrue(Color.luminance(color) < 0.1f)
assertFalse(lightIcons)
}
}
@@ -1,6 +1,9 @@
package com.droiddeck.launcher.ui
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.view.HapticFeedbackConstants
import android.view.MotionEvent
import android.view.View
@@ -18,6 +21,7 @@ import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.Shadows.shadowOf
import org.robolectric.annotation.Config
import org.robolectric.annotation.GraphicsMode
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [34], manifest = Config.NONE, shadows = [JoyConPadTest.RecordingWriter::class])
@@ -355,6 +359,28 @@ class InputSurfaceTouchTest {
touch(MotionEvent.ACTION_UP, 1 to (490f to 170f))
}
@Test @GraphicsMode(GraphicsMode.Mode.NATIVE)
fun adaptiveSticksDrawAtRestUnlessExplicitlyHidden() {
val legacy = InputSurfaceElement(InputControl.LS, .3f, .3f, .2f, .4f, hideWhenIdle = true)
fun idlePixel(e: InputSurfaceElement): Int {
show(e)
val target = element(view, e.id)
val bitmap = Bitmap.createBitmap(target.width, target.height, Bitmap.Config.ARGB_8888)
return try {
target.draw(Canvas(bitmap))
bitmap.getPixel(target.width / 2, target.height / 2)
} finally {
bitmap.recycle()
}
}
assertTrue(Color.alpha(idlePixel(legacy)) > 0)
val visible = legacy.copy(adaptiveCapture = true, hideWhenIdle = false)
assertTrue(Color.alpha(idlePixel(visible)) > 0)
assertTrue(view.takesTouchAt(10f, 300f))
assertEquals(0, Color.alpha(idlePixel(visible.copy(hideWhenIdle = true))))
assertTrue(view.takesTouchAt(10f, 300f))
}
@Test fun adaptiveSticksCaptureAroundThemAndTheLeftOneToTheEdge() {
val left = InputSurfaceElement(InputControl.LS, .3f, .3f, .2f, .4f, hideWhenIdle = true)
val right = InputSurfaceElement(InputControl.RS, .6f, .3f, .2f, .4f, hideWhenIdle = true)
@@ -0,0 +1,15 @@
package com.droiddeck.launcher.ui
import org.junit.Assert.assertEquals
import org.junit.Test
class SettingsJumpTest {
@Test fun rowInTheMiddleOfThePageIsCentered() = assertEquals(1050f, centeredScroll(1500f, 100f, 1000f, 4000f), 0f)
@Test fun rowsNearTheEndsStopAtTheEnds() {
assertEquals(0f, centeredScroll(200f, 100f, 1000f, 4000f), 0f)
assertEquals(3000f, centeredScroll(3800f, 100f, 1000f, 4000f), 0f)
}
@Test fun pageThatFitsDoesNotScroll() = assertEquals(0f, centeredScroll(700f, 100f, 1000f, 800f), 0f)
}
@@ -0,0 +1,43 @@
package com.droiddeck.launcher.ui
import android.content.Context
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], manifest = Config.NONE)
class SettingsSearchHistoryTest {
private val context: Context get() = RuntimeEnvironment.getApplication()
@Before fun reset() = SettingsSearchHistory.clear(context)
@Test fun newestComesFirstAndARepeatMovesUp() {
listOf("font", "cpu", "Font ").forEach { SettingsSearchHistory.add(context, it) }
assertEquals(listOf("Font", "cpu"), SettingsSearchHistory.items)
}
@Test fun blankSearchesAreNotKept() {
SettingsSearchHistory.add(context, " ")
assertEquals(emptyList<String>(), SettingsSearchHistory.items)
}
@Test fun onlyTheLatestAreKept() {
(1..SettingsSearchHistory.MAX + 2).forEach { SettingsSearchHistory.add(context, "search $it") }
assertEquals(SettingsSearchHistory.MAX, SettingsSearchHistory.items.size)
assertEquals("search ${SettingsSearchHistory.MAX + 2}", SettingsSearchHistory.items.first())
}
@Test fun savedSearchesLoadInOrderUntilCleared() {
listOf("one", "two, \"three\"").forEach { SettingsSearchHistory.add(context, it) }
SettingsSearchHistory.load(context)
assertEquals(listOf("two, \"three\"", "one"), SettingsSearchHistory.items)
SettingsSearchHistory.clear(context)
SettingsSearchHistory.load(context)
assertEquals(emptyList<String>(), SettingsSearchHistory.items)
}
}
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff. Show more