Compare commits

..
Author SHA1 Message Date
Kurt Himebauch 00a11444d1 test(input): inject two-finger gestures in the pen routing setup through a shared helper 2026-11-16 06:48:43 +00:00
Kurt Himebauch 6f04166dbd fix(input): move the guest pointer on a suppressed direct tap 2026-11-16 05:36:36 +00:00
Kurt Himebauch 7394f69b81 Merge branch 'main' into fix/suppress-touch-click-when-buttons-present 2026-11-16 00:28:18 -05:00
Kurt Himebauch 6415661bc1 fix(input): keep direct-touch hold, two-finger forwarding and long-press right click while taps are suppressed 2026-11-16 05:01:06 +00:00
Kurt Himebauch 9e719bdfa4 merge: bring main into fix/suppress-touch-click-when-buttons-present
The touchpad block moved into touchpadTouch on main; tap suppression is now set there.
2026-11-16 04:29:04 +00:00
MaxsTechReview f65e7a3d43 fix(preload): Windows games run from noexec shared storage under every Proton (#2594)
* fix(preload): Windows games run from noexec shared storage under every Proton

When mprotect(PROT_EXEC) on a private mapping is refused, libblsession
moves the pages into anonymous memory and retries, so Wine can make an
image's code sections executable on noexec mounts. FEX keeps its
existing handling.

* fix(preload): copy noexec image pages without faulting or dropping access

* fix(preload): install copied image pages with final permissions
2026-11-15 23:17:44 -05:00
Kurt Himebauch 865c54ee08 fix(input): anchor the locked swipe to the remaining finger when pointer 0 lifts during suppressed direct touch 2026-11-16 03:43:26 +00:00
MaxsTechReview 3d0c38c1d3 fix(session): default eligible Steam interfaces to GPU compositing (#2660) 2026-11-15 21:10:37 -05:00
The412Banner 81e238b92e feat(xbox): Nexus backend 0.2.15, Nexus runtime 11.0-20261102 and DLC mounting (#2696)
Nexus moved its Xodus changes from patch files in xodus-nexus into a backend
fork (domsvoboda/nexus-backend, GPL-3.0). prepare.py now fetches that fork at
backend-v0.2.15 (e7884a27, same Xodus base 53ea781d, same Rust 1.99.0) and
applies the DroidDeck patches, rebased onto it:
- droiddeck-credentials, -launch-view, -library-subscriptions: same rebase as
  Bannerlator's 0.2.15 update (identical patches before and after).
- droiddeck-credential-fallback, -credential-diagnostics: applied unchanged.
- droiddeck-cloud-token: session::prepare now also returns the account
  snapshot; the ticket checks it like upstream's profile/social commands.
- droiddeck-licensing-device-ticket: upstream 0.2.15 already formats
  delegation-compact device tickets for Store license tokens (27c335e), so only
  the content licensing path is patched. Upstream now writes compact JWE
  delegation tickets as t=, so the d= prefix check is replaced by the token
  type, the same rule as upstream's store_license.rs.
droiddeck-xbox-ticket.patch is dropped: upstream sends compact JWE delegation
tickets to Xbox Live sign-in in a form it accepts, with tests.

Runtime: domsvoboda/nexus-runtime runtime-11.0-20261102-g76c6dd13 (was
xodus-nexus runtime-11.0-20261018). Same six modules at the same path;
xgameruntime.dll is the C++ implementation (nexus-xgameruntime 455b1ba9).
Archive sha512 from the release's .sha512sum, source sha256 from its
candidate.json, module sha256 from the extracted files. The PlayFab Game Saves
proxy is a newer build at the same path and still passes droiddeck-xbox's
export checks; its license moved to share/doc/nexus-runtime/.

DLC mounting: the C++ runtime mounts downloadable content only inside a
host-managed workspace named by XODUS_MOUNT_ROOT (src/System/Package/Mount.h
returns E_NOTIMPL without it). DroidDeck starts Wine itself
(droiddeck:prepare), so droiddeck-dlc-mount.patch (ported from Bannerlator)
creates the workspace in the launch directory for the prepare session and
reports it as mountRoot; XboxRuntime passes it in the xbox-prepare reply and
droiddeck-xbox sets XODUS_MOUNT_ROOT to its Z: path. XODUS_CONTENT_ROOTS is
unchanged and still read by the runtime.

Upstream fixes since the old pins include sign-in for some accounts, offline
play, cloud-save conflict handling, DLC mounting, duplicate token requests and
per-game fixes (Ori, AoE, MSFS, Forza Motorsport).
2026-11-15 20:55:42 -05:00
MaxsTechReview a20528c62b fix(preload): 32-bit x86 programs get correct large-file stat, open, write and lock results (#2592)
The session preload is also built for i386 and preloaded into every 32-bit
x86 program under FEX. There it aliased fstat64, ftruncate64, pwrite64,
fallocate64, posix_fallocate64, open64, openat64 and fcntl64 to their 32-bit
hooks, which on i386 take a different struct layout or argument size. fstat64
returned a size with garbage high bits, so libdbus rejected a valid 33-byte
/etc/machine-id as too large and aborted the program. The aliases now exist
only where off_t is off64_t; on i386 the 64-bit calls reach their own glibc
functions, keeping the open and lock hooks.
2026-11-15 17:20:59 -05:00
Kurt Himebauch 9b5d7870a3 fix(steam): re-apply saved QAM scaling mode and filter at game start (#2681) 2026-11-15 16:41:16 -05:00
Kurt Himebauch b6391ed8c0 feat(agent): shipped rules and skills for every harness, with a user layer and tool health (#2682) 2026-11-15 16:40:45 -05:00
LunaDL c7ff93ec19 Feat: adds a interger scalling (another option) (#2620)
* Add integer scaling mode

* Add Fit and Auto options for integer scaling

* Update vk_present.c ( removed comentarios)

* Fix integer scaling view-space input bounds

* Fix integer scaling view coordinate ratios

* Fix glasses touch and effective Cardboard alignment

* Translate integer scaling settings

* Fix glasses picture bounds scaling
2026-11-15 14:51:24 -05:00
Kurt Himebauch 1cada9ad50 fix(agent): protect retained Claude background work (#2678)
* fix(agent): protect retained Claude background work

* fix(agent): address retained session review findings

* fix(agent): reset Claude cost tracking on clear
2026-11-15 13:29:38 -05:00
Kurt Himebauch 9375ed0948 fix: ship Windows executables as add-on packs and keep them out of the APK (#2676)
* fix(rockstar): ship the launcher service as an add-on pack, not inside the APK

* fix: ship the DiRT ws2_32 stand-in as an add-on pack and reject Windows executables in the APK

* fix(release): reject APK entries under a packed path even when the manifest omits them

* fix(dirt): fetch the ws2_32 stand-in pack once the Linux runtime is installed
2026-11-15 13:28:38 -05:00
Kurt Himebauch 946e9c41e0 Add per-game Steam Input overrides (#2407)
* feat: add per-game Steam Input override

* fix(steam-input): keep overrides in Steam's root apps section and keep the panel in step with the session

* fix(steam-input): reload the override after every session
2026-11-15 12:40:21 -05:00
Kurt Himebauch 259d5d184b feat(agent): keep Claude Code open between turns so background tasks can wake it (#2652) 2026-11-15 12:27:17 -05:00
Kurt Himebauch 9a93f59fbf fix(desktop): serve PipeWire in Desktop mode so screen capture works (#2446)
* fix(desktop): serve PipeWire in Desktop mode so screen capture works

* fix(desktop): preserve shared PipeWire lifecycle

* test(desktop): exercise shared PipeWire lifecycle

* fix(desktop): start PipeWire for bottom sessions

* fix(desktop): serialize shared PipeWire bundle preparation

Concurrent Steam and bottom Desktop starts unpacked the bundle into the
same staging directory and rewrote the access settings together. Hold an
exclusive lock around unpacking and access configuration, and cover the
race plus start success and failure environment handling in tests.

* fix(desktop): replace PipeWire access fragments atomically

Write each fragment to a temporary file and rename it so running daemons and clients never read a truncated file.

* fix(desktop): isolate runtime directories in concurrent PipeWire start test
2026-11-15 12:00:27 -05:00
Kurt Himebauch 03812bb3b7 feat(boot-movie): add a Shuffle switch backed by Steam's startup movie shuffle setting (#2462)
* feat(boot-movie): add a Shuffle switch backed by Steam's startup movie shuffle setting

* test(boot-movie): keep unrelated settings unchanged

* fix(boot-movie): keep the Shuffle choice across reset, unreadable configs and running sessions

* fix(boot-movie): track the Shuffle baseline per Steam home and only for values staging wrote

* fix(boot-movie): adopt a Shuffle change made in the inactive Steam home before staging overwrites it

* fix(boot-movie): keep the 60 fps note under the Installed movies row
2026-11-15 11:05:39 -05:00
Kurt Himebauch ba50192bfe fix(input): suppress two-finger tap clicks, count swapped-screen controls and re-anchor locked swipes 2026-11-11 20:17:03 +00:00
Kurt Himebauch 5c971344d1 fix(input): keep hold-drag, drop pointer-locked taps and count click actions and second-screen buttons for tap suppression 2026-11-11 19:57:22 +00:00
Kurt Himebauch a2a7adc83d fix(input): compare saved desktop profiles to their base and keep two-finger scroll with tap suppression 2026-11-11 19:09:49 +00:00
Kurt Himebauch f6e109ef61 fix(input): keep stock Desktop tap-to-click and cover direct and scroll touch routes
Only mouse buttons that differ from the shipped bindings count as user-picked.
Direct touch moves the pointer instead of tapping and the scroll layer stops
clicking while such a button is shown.
2026-11-11 18:52:16 +00:00
Kurt Himebauch 8c3d6cfaad fix(input): count the deck surface and check Steam Touch by visibility for tap suppression 2026-11-11 15:37:59 +00:00
Kurt Himebauch 9cb876e1e4 fix(input): base tap suppression on the mouse buttons actually drawn
Use the elements each visible control view renders (pinned-only, quick-hide, style, unfolded panel) and drop a stale double-tap when tap clicks turn off.
2026-11-11 15:14:33 +00:00
Kurt Himebauch 0d06d3d1d6 fix(input): ignore touchpad taps while an on-screen mouse button is shown 2026-11-11 13:20:20 +00:00
143 changed files with 3403 additions and 1269 deletions

No files matched your search

+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
jq -r --arg n "$2" '.assets // [] | .[] | select(.name == $n) | .digest // empty'
}
commit=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN" --jq .head_sha 2>/dev/null || echo "$GITHUB_SHA")
for name in proot directaudio tracking xbox comet butler powervr ubisoft; do
for name in proot directaudio tracking xbox comet butler powervr ubisoft rockstar dirt; do
file="packs/$name.tar.zst"
[ -f "$file" ] || { echo "::error::$name.tar.zst is missing from Build APK run $BUILD_RUN"; exit 1; }
sha=$(sha256sum "$file" | cut -d' ' -f1)
+1 -1
View File
@@ -36,4 +36,4 @@ __pycache__/
app/src/main/assets/directaudio/
app/src/main/assets/hybris/
/tools/vr/out/
app/src/main/resources/rockstar/helpers/
app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar/
+2 -1
View File
@@ -74,6 +74,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
- x86 AppImages, and arm64 ones whose runtime can't unpack on Android, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence.
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
- Windows programs on noexec storage get executable copies of their image pages, following [@yujikaido](https://github.com/yujikaido)'s finding in [droiddeck-rp4pro](https://github.com/yujikaido/droiddeck-rp4pro) that Wine's own processes need the noexec shim.
- Wine write watches use userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later). libblsession supplies the arm64 syscall number and answers `PAGEMAP_SCAN` from `/proc/self/pagemap`.
- libblsession runs Wine's arm64 `SIGUSR2` context handler (`dlls/ntdll/unix/signal_arm64.c`, LGPL-2.1-or-later) in place on a frame laid out like [Linux](https://github.com/torvalds/linux)'s `arch/arm64/kernel/signal.c`, and serves `fill_vm_counters` in `dlls/ntdll/unix/process.c` the kernel's own `/proc/<pid>/status`.
- droiddeck-ntsync follows the [Linux](https://github.com/torvalds/linux) ntsync semantics in `Documentation/userspace-api/ntsync.rst` (GPL-2.0).
@@ -98,7 +99,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
- Battle.net installs drive Blizzard's Agent the way [@barncastle](https://github.com/barncastle)'s [Battle.Net-Installer](https://github.com/barncastle/Battle.Net-Installer) does, with requests from [wowdev.wiki](https://wowdev.wiki/Agent). Read without taking code: [@mubaraknumann](https://github.com/mubaraknumann)'s [unifideck](https://github.com/mubaraknumann/unifideck), [@djmittens](https://github.com/djmittens)'s [neo-mittens](https://github.com/djmittens/neo-mittens) `bnetswitch`, [@BCD1210](https://github.com/BCD1210)'s [soju](https://github.com/BCD1210/soju) and [Lutris](https://github.com/lutris/lutris)'s `product.db` reader.
- World of Warcraft addon imports replace an addon's folder from a temporary copy, as [WowUp](https://github.com/WowUp/WowUp) does, and read flavour folders the way [WoWDeck](https://github.com/sigboe/wowdeck) does. No code from either is used.
- The World of Warcraft addon Download window searches [WoWInterface](https://www.wowinterface.com) through its MMOUI API. [CurseForge](https://www.curseforge.com/wow) opens in the user's browser, with no API and no key.
- Xbox games load [@domsvoboda](https://github.com/domsvoboda)'s [xodus-nexus](https://github.com/domsvoboda/xodus-nexus) modules (LGPL-2.1-or-later), including `wintypes.dll`. Content licensing sends delegation-compact device tickets in the licensing wire form, following the [nexus-backend](https://github.com/domsvoboda/nexus-backend) commit `27c335e`. Minecraft's GameInput setup was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinux](https://github.com/Wyze3306/BedrockOnLinux) (MIT).
- The Xbox store runs [@domsvoboda](https://github.com/domsvoboda)'s [nexus-backend](https://github.com/domsvoboda/nexus-backend) 0.2.15 (GPL-3.0, a fork of [Xodus](https://github.com/xodus-gaming/xodus)), and Xbox games load the Windows modules of his [nexus-runtime](https://github.com/domsvoboda/nexus-runtime) (LGPL-2.1-or-later), including the C++ [nexus-xgameruntime](https://github.com/domsvoboda/nexus-xgameruntime) and `wintypes.dll`. Content licensing sends delegation-compact device tickets in the licensing wire form, as nexus-backend's Store license path (commit `27c335e`) does. Minecraft's GameInput setup was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinux](https://github.com/Wyze3306/BedrockOnLinux) (MIT).
- The Xbox Cloud Gaming player uses the WebRTC client of [@unknownskl](https://github.com/unknownskl)'s [Greenlight](https://github.com/unknownskl/greenlight) (MIT), and its offer tweaks and sharpening follow [@redphx](https://github.com/redphx)'s [Better xCloud](https://github.com/redphx/better-xcloud) (MIT). See `tools/xcloud-player/NOTICE.md`.
- The itch.io butler pack ships butler's `7z.so`, itch.io's build of [7-Zip](https://www.7-zip.org) by Igor Pavlov (LGPL-2.1, unRAR restriction on RAR code), unmodified. Other archives use Apache Commons Compress and the runtime's bsdtar (libarchive).
- The Store uses [Flatpak](https://github.com/flatpak/flatpak) (LGPL-2.1) through DroidDeck's own bubblewrap shim. Chromium and Electron apps start directly, since [zypak](https://github.com/refi64/zypak) by [@refi64](https://github.com/refi64) (BSD-3-Clause) always uses Flatpak's spawn portal.
+5 -3
View File
@@ -93,7 +93,7 @@ def trackingPack = rootProject.file('tools/packs/tracking/release.env').readLine
def prootPackPin = rootProject.file('tools/packs/proot/release.env').readLines()
.findAll { it.contains('=') && !it.startsWith('#') }
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft'].collectEntries { name ->
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft', 'rockstar', 'dirt'].collectEntries { name ->
def pack = file("build/packs/${name}.tar.zst")
if (!pack.isFile()) {
if (ciBuild) throw new GradleException("Add-on pack ${pack} is missing: run tools/packs/build.sh app/build/packs")
@@ -206,7 +206,7 @@ android {
}
androidResources {
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>directaudio:<dir>hybris'
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>droiddeck-rockstar:<dir>droiddeck-dirt:<dir>directaudio:<dir>hybris'
}
packagingOptions {
@@ -278,8 +278,10 @@ def stageRuntimeAssets = tasks.register('stageRuntimeAssets', Sync) {
dependsOn(stageSessionScripts)
from(layout.projectDirectory.dir('src/main/assets')) { exclude 'pulseaudio.tzst' }
from(rootProject.file('tools/linuxfs/innoextract'))
from(rootProject.file('tools')) { include 'droiddeckctl', 'adb_device.py', 'proot_profile.py'; into('agent/ctl') }
from(rootProject.file('tools')) { include 'droiddeckctl', 'droiddeck-scenario', 'adb_device.py', 'proot_profile.py'; into('agent/ctl') }
from(rootProject.file('tools/agent/AGENTS.md')) { into('agent/ctl') }
from(rootProject.file('docs/agent-control.md')) { into('agent/ctl') }
from(rootProject.file('tools/agent/skills')) { into('agent/skills') }
from(layout.buildDirectory.dir('prepared-assets'))
into(runtimeAssetsDir)
}
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
exec python3 /root/.local/share/droiddeck/ctl/droiddeck-scenario "$@"
@@ -416,8 +416,7 @@ static void update_map(int scene_w, int scene_h) {
if (mode == VKP_MODE_FILL) aspect = sx > sy ? sx : sy;
else if (mode == VKP_MODE_INTEGER) {
float m = sx < sy ? sx : sy;
aspect = (float)(int)m;
if (aspect < 1.0f) aspect = 1.0f;
aspect = m >= 1.0f ? (float)(int)m : m;
} else aspect = sx < sy ? sx : sy;
g_map.kx = g_map.ky = aspect;
g_map.off_x = (float)(g_map.rx + (int)((g_map.rw - scene_w * aspect) * 0.5f));
@@ -84,12 +84,15 @@ class App : Application() {
if (com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).isDirectory) {
com.droiddeck.launcher.core.AddonPack.PROOT.ensure(app)
com.droiddeck.launcher.core.AddonPack.DIRECTAUDIO.ensure(app)
com.droiddeck.launcher.session.SessionFiles.ensureDirtStandIn(app)
}
if (com.droiddeck.launcher.stores.gog.GogComet.enabled(app)) com.droiddeck.launcher.core.AddonPack.COMET.ensure(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.XBOX) != null)
com.droiddeck.launcher.core.AddonPack.XBOX.ensure(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.UBISOFT) != null)
com.droiddeck.launcher.session.SessionFiles.ensureUbisoftService(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.ROCKSTAR) != null)
com.droiddeck.launcher.session.SessionFiles.ensureRockstarService(app)
com.droiddeck.launcher.handtracking.HandTracking.load(app)
}.onFailure { android.util.Log.w("App", "add-on pack prefetch failed", it) }
}, "addon-packs").start()
@@ -195,6 +195,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
private var showPhantomGate by mutableStateOf(false)
private var directAudio by mutableStateOf(false)
private var picturePosition by mutableStateOf("center")
private var integerScaling by mutableStateOf(false)
private var stretch16x9 by mutableStateOf(false)
private var orientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)
private var launcherOrientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER)
@@ -2551,6 +2552,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
backActionsInverted = backActionsInverted,
directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null,
picturePosition = if (mode == SessionService.MODE_STEAM) picturePosition else null,
integerScaling = if (mode == SessionService.MODE_STEAM) integerScaling else null,
stretch16x9 = if (mode == SessionService.MODE_STEAM) stretch16x9 else null,
mic = if (mode == SessionService.MODE_STEAM) mic else null,
gameStorage = if (mode == SessionService.MODE_STEAM) gameStorage else null,
@@ -2612,6 +2614,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
},
onDirectAudio = { on -> SessionPrefs.setDirectAudio(this, on); directAudio = on },
onPicturePosition = { value -> SessionPrefs.setPicturePosition(this, value); picturePosition = value },
onIntegerScaling = { on -> SessionPrefs.setIntegerScaling(this, on); integerScaling = on },
onStretch16x9 = { on -> SessionPrefs.setStretch16x9(this, on); stretch16x9 = on },
onMic = { on ->
SessionPrefs.setMicEnabled(this, on)
@@ -2949,6 +2952,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
backActionsInverted = SessionPrefs.backActionsInverted(this)
directAudio = SessionPrefs.directAudio(this)
picturePosition = SessionPrefs.picturePosition(this)
integerScaling = SessionPrefs.integerScaling(this)
stretch16x9 = SessionPrefs.stretch16x9(this)
mic = SessionPrefs.micEnabled(this)
refreshWifiDiscovery()
@@ -173,11 +173,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private var adaptiveSticks by mutableStateOf<Boolean?>(null)
private var quickButtons by mutableStateOf<Map<InputCommand, Boolean>>(emptyMap())
private var picturePosition by mutableStateOf("center")
private var integerScaling by mutableStateOf(false)
private fun applyGameAlignment() {
if (!CompositorHost.isStarted) return
val active = SessionState.mode == SessionService.MODE_STEAM &&
!pipUi && !isInPictureInPictureMode && !cardboard.enabled
!pipUi && !isInPictureInPictureMode && !activeCardboard.enabled
val alignment = if (!active) ALIGN_CENTER else when (picturePosition) {
"top" -> ALIGN_PICTURE_TOP
"bottom" -> ALIGN_PICTURE_BOTTOM
@@ -185,7 +186,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
"right" -> ALIGN_PICTURE_RIGHT
else -> ALIGN_CENTER
}
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, alignment)
WaylandCompositor.nativeSetScaleMode(if (active && integerScaling) SCALE_INTEGER else SCALE_FIT, alignment)
}
private var unfoldedPanel by mutableStateOf<OnScreenControls?>(null)
private var unfoldedColumn: android.widget.LinearLayout? = null
@@ -1085,7 +1086,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
secondScreenPresentation?.closeFieldKeyboard()
}
}
androidx.compose.runtime.LaunchedEffect(picturePosition, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
androidx.compose.runtime.LaunchedEffect(picturePosition, integerScaling, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
DroidDeckTheme {
if (pipUi) {
if (SessionState.suspended) androidx.compose.foundation.layout.Box(
@@ -2399,6 +2400,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
unfoldedControls = SessionPrefs.unfoldedControls(this)
unfoldedControlsWithController = SessionPrefs.unfoldedControlsWithController(this)
picturePosition = SessionPrefs.picturePosition(this)
integerScaling = SessionPrefs.integerScaling(this)
hudOn = SessionPrefs.hudEnabled(this)
hudConfig = DroidDeckHudConfig.load(this)
hudColor = SessionPrefs.hudColor(this)
@@ -2589,7 +2591,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
runCatching { com.droiddeck.launcher.runtime.RuntimeInstallService.start(this, release) }
val ok = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.install(this, release,
progressFor(RUNTIME_LINES, release.size / 1_000_000))
if (ok) return null
if (ok) {
com.droiddeck.launcher.session.SessionFiles.ensureDirtStandIn(this)
return null
}
SessionEvents.record("runtime.failed", mapOf("step" to "install", "reason" to com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.installError()))
return getString(R.string.session_runtime_install_failed)
}
@@ -2651,7 +2656,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
runCatching { GameEnvironmentStore.publish(this) }
.onFailure { Log.e(TAG, "Could not update game environment", it) }
}, "game-env-publish").start()
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, ALIGN_CENTER)
applyGameAlignment()
val activeProfileId = currentScreenEffectsProfileId()
val activeUpscaler = SessionPrefs.screenEffectsUpscaler(this, activeProfileId)
val activeEffects = SessionPrefs.screenEffects(this, activeProfileId)
@@ -4633,25 +4638,18 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
gamePictureBounds[2], gamePictureBounds[3]
)
val nativeWidth: Int
val nativeHeight: Int
if (glassesOutputActive) {
val mode = glassesScreen?.display?.mode ?: return null
val outputWidth = mode.physicalWidth.takeIf { it > 0 } ?: return null
val outputHeight = mode.physicalHeight.takeIf { it > 0 } ?: return null
val scaleX = width.toFloat() / outputWidth
val scaleY = height.toFloat() / outputHeight
return android.graphics.RectF(
rect.left * scaleX,
rect.top * scaleY,
rect.right * scaleX,
rect.bottom * scaleY
)
nativeWidth = mode.physicalWidth.takeIf { it > 0 } ?: return null
nativeHeight = mode.physicalHeight.takeIf { it > 0 } ?: return null
} else {
val nativeSize = IntArray(2)
if (!WaylandCompositor.nativeOutputSize(nativeSize)) return null
nativeWidth = nativeSize[0].takeIf { it > 0 } ?: return null
nativeHeight = nativeSize[1].takeIf { it > 0 } ?: return null
}
val nativeSize = IntArray(2)
if (!WaylandCompositor.nativeOutputSize(nativeSize)) return null
val nativeWidth = nativeSize[0].takeIf { it > 0 } ?: return null
val nativeHeight = nativeSize[1].takeIf { it > 0 } ?: return null
val scaleX = width.toFloat() / nativeWidth
val scaleY = height.toFloat() / nativeHeight
@@ -4732,7 +4730,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (event.actionMasked == MotionEvent.ACTION_DOWN) gesturePointerReady = false
touchscreenGestures.onTouch(event)
}
com.droiddeck.launcher.input.TouchRouter.Route.SCROLL -> scrollTouch.onTouch(event)
com.droiddeck.launcher.input.TouchRouter.Route.SCROLL -> {
if (event.actionMasked == MotionEvent.ACTION_DOWN) scrollTouch.tapClicks = !onScreenMouseButtonShown()
scrollTouch.onTouch(event)
}
else -> {
if (com.droiddeck.launcher.input.TouchRouter.steamKeyboardZone(snapshot)) {
val wasActive = threeFingerTap.active && event.actionMasked != MotionEvent.ACTION_DOWN
@@ -4755,6 +4756,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}
}
private fun onScreenMouseButtonShown(): Boolean {
if (steamTouchControls?.visibility == View.VISIBLE) return false
val primary = listOfNotNull(unfoldedPanel, bottomInputControls, onScreenControls)
.filter { it.visibility == View.VISIBLE }.map { it.shownElements() } +
listOfNotNull(unfoldedDeckSurface?.takeIf { it.visibility == View.VISIBLE }?.shownElements())
val secondary = secondScreenPresentation?.shownControlElements().orEmpty() +
swappedControls?.takeIf { it.isShown }?.shownElements().orEmpty()
return primary.any { inputProfile.hasMouseButton(InputRole.PRIMARY, it) } ||
inputProfile.hasMouseButton(InputRole.SECONDARY, secondary)
}
private fun uiBlocksTouch(): Boolean =
drawerOpen || achievementsOpen || gestureSettingsOpen || inputSettingsOpen || pipUi || SessionState.suspended
@@ -4775,6 +4787,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
touchpad.desktop = SessionState.mode == SessionService.MODE_DESKTOP
touchpad.tapClicks = !onScreenMouseButtonShown()
placeTouchpadAtGuest(rect)
}
return touchpad.onTouch(event)
@@ -4857,10 +4870,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
showCursor(cx, cy)
}
private var swappedControls: com.droiddeck.launcher.ui.InputSurfaceView? = null
private fun dispatchDirectTouch(event: MotionEvent): Boolean {
val rect = drawnRect() ?: return false
if (event.actionMasked == MotionEvent.ACTION_DOWN)
ignoreGameTouch = topPictureMapped && !rect.contains(event.x, event.y)
ignoreGameTouch = topPictureMapped && !glassesOutputActive &&
!rect.contains(event.x, event.y)
if (ignoreGameTouch) {
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
directTouchHold.cancel()
@@ -4869,6 +4885,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) ignoreGameTouch = false
return true
}
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
val tapClicks = !onScreenMouseButtonShown()
directTouchHold.tapClicks = tapClicks
twoFingerGestures.tapClicks = tapClicks
}
if (SessionState.mode == SessionService.MODE_DESKTOP && twoFingerGestures.onTouch(event)) return true
return forwardTouch(event, rect)
}
@@ -4896,7 +4917,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
return true
}
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
if (!pointerLocked) showCursor(event.x.coerceIn(rect.left, rect.right), event.y.coerceIn(rect.top, rect.bottom))
if (!pointerLocked) {
val x = event.x.coerceIn(rect.left, rect.right)
val y = event.y.coerceIn(rect.top, rect.bottom)
if (directTouchHold.tapClicks) showCursor(x, y) else movePointer(x, y)
}
if (WaylandCompositor.nativeFocusTakesTouch()) {
listOf(PointerGestures.BTN_LEFT, PointerGestures.BTN_RIGHT, PointerGestures.BTN_MIDDLE).forEach {
heldButtons.set(1, it, false)
@@ -5386,7 +5411,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
listOf(PointerGestures.BTN_LEFT, PointerGestures.BTN_RIGHT, PointerGestures.BTN_MIDDLE).forEach {
heldButtons.set(1, it, false)
}
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, ALIGN_CENTER)
applyGameAlignment()
}
} else if (!isFinishing && !isDestroyed) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
@@ -5747,6 +5772,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
cardboard = c
val e = effectiveCardboard(c)
activeCardboard = e
applyGameAlignment()
if (CompositorHost.isStarted) pushCardboard(e)
if (e.enabled && !was.enabled) headTracker?.recenter()
updateHeadTracker()
@@ -5993,7 +6019,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
androidx.compose.runtime.key(profileLayout) {
androidx.compose.ui.viewinterop.AndroidView(
factory = { context -> com.droiddeck.launcher.ui.InputSurfaceView(context, padBridge, profileLayout?.elements.orEmpty(),
surfaceStyle = profileLayout?.style ?: com.droiddeck.launcher.input.InputSurfaceStyle()) },
surfaceStyle = profileLayout?.style ?: com.droiddeck.launcher.input.InputSurfaceStyle())
.also { swappedControls = it } },
onRelease = { if (swappedControls === it) swappedControls = null },
modifier = Modifier.fillMaxWidth().weight(1f),
)
}
@@ -6366,6 +6394,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private val steamVrWorker = java.util.concurrent.ThreadPoolExecutor(0, 1, 30, java.util.concurrent.TimeUnit.SECONDS,
java.util.concurrent.LinkedBlockingQueue()) { Thread(it, "steamvr") }
private const val SCALE_FIT = 1
private const val SCALE_INTEGER = 4
private const val ALIGN_CENTER = 0
private const val ALIGN_PICTURE_TOP = 3
private const val ALIGN_PICTURE_BOTTOM = 4
@@ -84,6 +84,7 @@ object AgentChats {
internal fun encode(entry: Entry): String = when (entry) {
is Entry.Asked -> JSONObject().put("asked", entry.text).apply { if (entry.files.isNotEmpty()) put("files", JSONArray(entry.files)) }
is Entry.Said -> JSONObject().put("said", entry.text)
is Entry.Notice -> JSONObject().put("notice", entry.text)
is Entry.Thought -> JSONObject().put("thought", entry.text)
is Entry.Result -> JSONObject().put("result", entry.id).put("output", entry.output).put("failed", entry.failed)
is Entry.Used -> JSONObject().put("used", entry.tool).put("detail", entry.detail).put("id", entry.id).put("input", entry.input)
@@ -119,6 +120,7 @@ object AgentChats {
private fun decode(o: JSONObject): Entry? = when {
o.has("asked") -> Entry.Asked(o.getString("asked"), o.optJSONArray("files")?.let { a -> (0 until a.length()).map { a.getString(it) } }.orEmpty())
o.has("said") -> Entry.Said(o.getString("said"))
o.has("notice") -> Entry.Notice(o.getString("notice"))
o.has("thought") -> Entry.Thought(o.getString("thought"))
o.has("used") -> Entry.Used(o.optString("id"), o.getString("used"), o.optString("detail"), o.optString("input"),
if (o.has("output")) o.optString("output") else null, o.optBoolean("failed"), o.optString("parent"))
@@ -5,7 +5,7 @@ import org.json.JSONArray
import org.json.JSONObject
import java.io.File
/** One coding agent CLI in the Linux userland, run one process per turn. */
/** One coding agent CLI in the Linux userland, run one process per turn (or kept open, see [input]). */
interface AgentHarness {
val id: String
val name: String
@@ -27,8 +27,18 @@ interface AgentHarness {
fun models(rootfs: File): List<Model>
/** The guest command for one turn; [conversation] is null for the first one. */
fun turn(message: String, conversation: String?, options: Options): List<String>
/**
* The line that hands [message] to a [turn] process over stdin, or null when the message is already in the
* command. A process that takes its messages this way stays open between turns, so work it started in the
* background can wake it, as it does in the CLI's own terminal.
*/
fun input(message: String): String? = null
/** One line of the CLI's output, or null when it carries nothing to show. */
fun parse(line: String): AgentEvent?
/** The folder, under the userland's root, where the CLI loads user skills (`<name>/SKILL.md`). */
val skills: String
/** The CLI's global instructions file under the userland's root, where DroidDeck keeps its rules in a marked block. */
val instructions: String
/** Sets the CLI's own defaults in the userland before it runs; [rootfs] is the userland's root. */
fun prepare(rootfs: File) {}
/** Context and plan limits the CLI keeps on disk rather than printing, read once a turn of [conversation] is done. */
@@ -56,9 +66,13 @@ data class AgentEvent(
val window: Long? = null,
val limits: List<AgentHost.Limit>? = null,
val usage: AgentHost.Usage? = null,
/** This ends a turn the CLI started itself, such as the answer to a finished background task. */
val background: Boolean = false,
/** The error a background turn ended with, if it failed. */
val backgroundError: String? = null,
)
/** Claude Code: `claude -p` with stream-json output, resumed by session id. */
/** Claude Code: `claude -p` with stream-json input and output, resumed by session id. */
object ClaudeCode : AgentHarness {
override val id = "claude"
override val name = "Claude Code"
@@ -73,6 +87,8 @@ object ClaudeCode : AgentHarness {
* Commits and pull requests the agent makes carry no Claude Code credit or co-author line by
* default. Only keys the user has not set are written, so their own choice stays.
*/
override val skills = "root/.claude/skills"
override val instructions = "root/.claude/CLAUDE.md"
override fun prepare(rootfs: File) {
val file = File(rootfs, "root/.claude/settings.json")
val settings = if (file.exists()) runCatching { JSONObject(file.readText()) }.getOrNull() ?: return else JSONObject()
@@ -97,7 +113,7 @@ object ClaudeCode : AgentHarness {
// DroidDeck runs the agent unattended on the user's own device; permission prompts have no one to answer them.
override fun turn(message: String, conversation: String?, options: AgentHarness.Options) = buildList {
addAll(listOf(binary, "-p", message, "--output-format", "stream-json", "--verbose", "--include-partial-messages"))
addAll(listOf(binary, "-p", "--input-format", "stream-json", "--output-format", "stream-json", "--verbose", "--include-partial-messages"))
addAll(listOf("--permission-mode", if (options.plan) "plan" else "bypassPermissions"))
options.model?.let { addAll(listOf("--model", it)) }
options.effort?.let { addAll(listOf("--effort", it)) }
@@ -105,6 +121,11 @@ object ClaudeCode : AgentHarness {
if (conversation != null) addAll(listOf("--resume", conversation))
}
override fun input(message: String): String? = JSONObject()
.put("type", "user")
.put("message", JSONObject().put("role", "user").put("content", JSONArray().put(JSONObject().put("type", "text").put("text", message))))
.toString()
override fun parse(line: String): AgentEvent? {
val o = runCatching { JSONObject(line) }.getOrNull() ?: return null
val conversation = o.optString("session_id").takeIf { it.isNotEmpty() }
@@ -130,7 +151,11 @@ object ClaudeCode : AgentHarness {
"thinking" -> if (parent != null) null else block.optString("thinking").trim().takeIf { it.isNotEmpty() }?.let { AgentHost.Entry.Thought(it) }
"tool_use" -> {
val input = block.optJSONObject("input")
AgentHost.Entry.Used(block.optString("id"), block.optString("name"), detail(input), fullInput(block.optString("name"), input), parent = parent.orEmpty())
AgentHost.Entry.Used(
block.optString("id"), block.optString("name"), detail(input), fullInput(block.optString("name"), input),
parent = parent.orEmpty(),
background = input?.optBoolean("run_in_background") == true || block.optString("name") == "Monitor",
)
}
else -> null
}
@@ -148,17 +173,25 @@ object ClaudeCode : AgentHarness {
AgentEvent(conversation, results)
}
"rate_limit_event" -> AgentEvent(conversation, limits = limits(o.optJSONObject("rate_limit_info")))
// A resumed session first answers background tasks the last run left behind; that result is not the turn's.
"result" -> if (o.optJSONObject("origin")?.optString("kind") == "task-notification") conversation?.let { AgentEvent(it) } else AgentEvent(
conversation,
listOf(AgentHost.Entry.Finished(if (o.optBoolean("is_error")) o.optString("result").ifEmpty { o.optString("subtype") } else null)),
window = window(o.optJSONObject("modelUsage")),
usage = AgentHost.Usage(
// The CLI starts turns of its own for background tasks (a resumed session first answers the ones the last
// run left behind). Such a result is not the end of the user's turn; the host decides what it ends.
"result" -> {
val usage = AgentHost.Usage(
o.optLong("duration_ms"), o.optDouble("total_cost_usd", 0.0),
o.optJSONObject("usage")?.let { it.optLong("input_tokens") + it.optLong("cache_read_input_tokens") + it.optLong("cache_creation_input_tokens") } ?: 0,
o.optJSONObject("usage")?.optLong("output_tokens") ?: 0,
),
)
)
if (o.optJSONObject("origin")?.optString("kind") == "task-notification") AgentEvent(
conversation, usage = usage, background = true,
backgroundError = if (o.optBoolean("is_error")) o.optString("result").ifEmpty { o.optString("subtype") } else null,
)
else AgentEvent(
conversation,
listOf(AgentHost.Entry.Finished(if (o.optBoolean("is_error")) o.optString("result").ifEmpty { o.optString("subtype") } else null)),
window = window(o.optJSONObject("modelUsage")),
usage = usage,
)
}
else -> conversation?.let { AgentEvent(it) }
}
}
@@ -227,6 +260,8 @@ object Codex : AgentHarness {
override val id = "codex"
override val name = "Codex"
override val binary = "/root/.local/bin/codex"
override val skills = "root/.codex/skills"
override val instructions = "root/.codex/AGENTS.md"
// Code mode runs in a helper that each release ships as its own download.
private const val HOST = "/root/.local/bin/codex-code-mode-host"
override val files get() = listOf(binary, HOST)
@@ -21,18 +21,23 @@ import java.nio.file.Files
/**
* The launcher's agent: a coding agent CLI ([AgentHarness]) from the Linux userland, run headless
* one process per turn, outside any game or desktop session. Conversations are kept on disk
* outside any game or desktop session: one process per turn, or for a CLI that takes its messages over
* stdin one process kept open between turns, so background work can start a turn of its own. Conversations are kept on disk
* ([AgentChats]), so a restart (a Lab build, a crash) continues the same one.
*/
object AgentHost {
sealed interface Entry {
data class Asked(val text: String, val files: List<String> = emptyList()) : Entry
data class Said(val text: String) : Entry
data class Notice(val text: String) : Entry
data class Thought(val text: String) : Entry
/** A tool call; [output] stays null until its result arrives. [parent] is the subagent call it was made under, if any. */
/**
* A tool call; [output] stays null until its result arrives. [parent] is the subagent call it was made under, if any.
* [background]: the call starts work that can wake the CLI after its turn (run_in_background, Monitor).
*/
data class Used(
val id: String, val tool: String, val detail: String, val input: String = "", val output: String? = null, val failed: Boolean = false,
val parent: String = "",
val parent: String = "", val background: Boolean = false,
) : Entry
data class Result(val id: String, val output: String, val failed: Boolean) : Entry
/** [planned]: the turn ran in plan mode, so it ends on a plan that nothing has carried out yet. */
@@ -63,18 +68,10 @@ object AgentHost {
@VisibleForTesting
internal const val BRIEF = "You run inside DroidDeck on the user's handheld, in its Linux userland (Ubuntu under proot, aarch64), " +
"and the user talks to you from DroidDeck's Agent tab, often on a small screen, so keep replies short. " +
"droiddeckctl inspects and drives the app over loopback adb (\$ADB_SERIAL); its guide is ${AgentSetup.CTL}/agent-control.md. " +
"Steam, the desktop and games run in DroidDeck's session, a separate guest from yours: a program you start here is not in it and has no screen. " +
"Reach the session through droiddeckctl: state, start steam, stop, launch, quit, focus, screenshot, logs, and guest to run a command inside it. " +
"Starting, stopping or restarting a session leaves you running. " +
"DroidDeck's rules for working here are in your global instructions file (~/.claude/CLAUDE.md or ~/.codex/AGENTS.md); " +
"if they are not loaded, read ${AgentSetup.CTL}/AGENTS.md before acting on the device. " +
"Never kill by a command-line pattern (pkill -f, pgrep -f piped to kill): your own command line holds the user's message, so the pattern matches you. " +
"End a game with droiddeckctl quit, the session with droiddeckctl stop, anything else by its pid. " +
"dd-lab-build builds the checkout as a Lab build and restarts DroidDeck on it (docs/lab-builds.md). DroidDeck runs the build in a " +
"process of its own and shows the user its progress and time left; dd-lab-build follows that build's log until it is done. " +
"Run it with run_in_background and keep checking its output, so the user can talk to you meanwhile. " +
"The restart ends this process, and this conversation continues on the new build. " +
"Files the user attaches are listed at the end of their message, under /root/.cache/droiddeck/attachments. " +
"Commits and pull requests you make are the user's own: add no co-author line, AI credit or generated-by note. " +
"To have the user pick between options, end your reply with a fenced code block whose language is choices, one short option per line, " +
"and end your turn: DroidDeck shows them as buttons and sends the one picked as the next message."
@@ -126,10 +123,24 @@ object AgentHost {
var lab by mutableStateOf<LabProgress?>(null)
private set
private class Turn(val process: Process, val pid: Int)
private class Turn(val process: Process, val pid: Int, val stdin: java.io.OutputStream? = null) {
var writingGeneration: Int? = null
var exitStatus: Int? = null
var costs: AgentCostTracker? = null
var clearingCosts = false
}
private val main = Handler(Looper.getMainLooper())
private var turn: Turn? = null
/**
* The CLI process when it takes its messages over stdin. It outlives a turn, so work it started in the
* background can wake it: the answer to a finished task then arrives without a message from the user.
*/
private var session: Turn? = null
private var sessionKey: String? = null
/** The running turn is one the CLI started itself, not an answer to the user. */
private var background = false
private val reap = Runnable { if (state != State.WORKING) dropSession() }
/** Counts turns, so a process that starts after its turn was stopped is not adopted by the next one. */
private var generation = 0
private var labProcess: Process? = null
@@ -142,6 +153,8 @@ object AgentHost {
private var turnPlanned = false
private var loaded = false
private var appContext: Context? = null
/** A tool call in this CLI process started work that can wake it after its turn (run_in_background). */
private var launchedBackground = false
val turnPid: Int get() = turn?.pid ?: 0
@@ -197,6 +210,7 @@ object AgentHost {
AgentSetup.forget()
refresh(app)
}
dropSession()
load(app, id)
prefs(app).edit().putString(CHAT_KEY, id).apply()
}
@@ -285,11 +299,42 @@ object AgentHost {
live = ""
liveThinking = ""
turnStarted = SystemClock.elapsedRealtime()
AgentHostService.start(app)
AgentHostService.start(app)?.let { serviceWarning(app, it) }
val current = harness
val prompt = AgentAttachments.prompt(message, attached)
turnPlanned = plan && current.plans
val command = current.turn(prompt, conversation, AgentHarness.Options(model, turnPlanned, BRIEF, effort))
val options = AgentHarness.Options(model, turnPlanned, BRIEF, effort)
val command = current.turn(prompt, conversation, options)
val line = current.input(prompt)
val key = "${current.id}|$id|$model|$turnPlanned|$effort"
background = false
val kept = session
if (kept != null && line != null && sessionKey == key && kept.process.isAlive) {
main.removeCallbacks(reap)
turn = kept
kept.writingGeneration = gen
kept.clearingCosts = prompt == "/clear"
Thread({
val written = runCatching { synchronized(kept) { kept.stdin?.apply { write((line + "\n").toByteArray()); flush() } != null } }.getOrDefault(false)
// The process died between turns: the same message goes to a new one, which resumes the conversation.
main.post {
if (kept.writingGeneration == gen) kept.writingGeneration = null
if (generation == gen && session === kept) {
if (!written) {
dropSession()
turn = null
spawn(app, gen, current, current.turn(prompt, conversation, options), line, key)
} else kept.exitStatus?.let { processExited(app, kept, current, it) }
}
}
}, "agent-input").start()
return
}
dropSession()
spawn(app, gen, current, command, line, key)
}
private fun spawn(app: Context, gen: Int, current: AgentHarness, command: List<String>, line: String?, key: String) {
val workdir = workspace(app)
var threadConversation = conversation
Thread({
@@ -304,40 +349,100 @@ object AgentHost {
main.post { if (generation == gen) finish(app, e.message ?: "could not start") }
return@Thread
}
val started = Turn(child, AgentProcesses.pidOf(child))
val started = Turn(child, AgentProcesses.pidOf(child), if (line != null) child.outputStream else null).apply {
if (current === ClaudeCode && line != null) costs = AgentCostTracker()
}
OrphanReaper.keep(started.pid)
main.post { if (generation == gen && state == State.WORKING && turn == null) turn = started else AgentProcesses.killTree(started.pid) }
child.outputStream.close()
var ended = false
main.post {
if (generation == gen && state == State.WORKING && turn == null) {
turn = started
if (line != null) { session = started; sessionKey = key }
} else AgentProcesses.killTree(started.pid)
}
if (line != null) runCatching { child.outputStream.apply { write((line + "\n").toByteArray()); flush() } } else child.outputStream.close()
val raw = runCatching {
val log = File(app.filesDir, TURN_LOG).apply { parentFile?.mkdirs() }
log.renameTo(File(app.filesDir, "$TURN_LOG.1"))
log.bufferedWriter()
}.getOrNull()
runCatching {
child.inputStream.bufferedReader().forEachLine { line ->
runCatching { raw?.apply { write(line); newLine(); flush() } }
val parsed = current.parse(line) ?: return@forEachLine
child.inputStream.bufferedReader().forEachLine { output ->
runCatching { raw?.apply { write(output); newLine(); flush() } }
val parsed = current.parse(output) ?: return@forEachLine
parsed.conversation?.let { threadConversation = it }
val done = parsed.entries.any { it is Entry.Finished }
if (done) ended = true
val event = if (!done) parsed else runCatching { current.usage(LinuxRuntime.rootDir(app), threadConversation) }.getOrNull()
?.let { parsed.copy(context = it.context ?: parsed.context, window = it.window ?: parsed.window, limits = it.limits ?: parsed.limits) } ?: parsed
main.post { if (turn === started) apply(app, event) }
main.post { if (turn === started || session === started) handle(app, started, event) }
}
}
runCatching { raw?.close() }
val status = runCatching { child.waitFor() }.getOrDefault(-1)
OrphanReaper.release(started.pid)
main.post {
if (turn === started) {
turn = null
if (state == State.WORKING && !ended) finish(app, app.getString(R.string.agent_exited, current.name, status))
}
if (started.writingGeneration != null) started.exitStatus = status
else processExited(app, started, current, status)
}
}, "agent-output").start()
}
private fun processExited(app: Context, exited: Turn, current: AgentHarness, status: Int) {
if (session === exited) {
session = null
launchedBackground = false
main.removeCallbacks(reap)
AgentHostService.backgroundDone(app)
}
if (turn === exited) {
turn = null
if (state == State.WORKING) finish(app, app.getString(R.string.agent_exited, current.name, status))
}
}
private fun serviceWarning(app: Context, error: Throwable) {
record(app, Entry.Notice("Unable to keep the agent running in the background: ${error.message ?: error.javaClass.simpleName}"))
}
/** One event from the CLI, which may belong to a turn it started on its own once the user's has ended. */
private fun handle(app: Context, from: Turn, event: AgentEvent) {
if (event.background) {
// A leftover task answered before the user's message is not the user's turn; one the CLI started is its own.
if (background && state == State.WORKING) finish(app, event.backgroundError, usage = event.usage?.let { from.costs?.perTurn(it) ?: it })
return
}
val content = event.text != null || event.thinking != null || event.entries.any { it !is Entry.Finished }
if (content && state == State.IDLE && session === from) {
main.removeCallbacks(reap)
background = true
turn = from
turnPlanned = false
state = State.WORKING
live = ""
liveThinking = ""
turnStarted = SystemClock.elapsedRealtime()
AgentHostService.start(app)?.let { serviceWarning(app, it) }
}
val finished = event.entries.filterIsInstance<Entry.Finished>().firstOrNull()
if (finished != null && state == State.WORKING && from.clearingCosts) {
if (finished.error == null) from.costs?.reset()
from.clearingCosts = false
}
val applied = if (finished != null && state == State.WORKING && event.usage != null)
event.copy(usage = from.costs?.perTurn(event.usage) ?: event.usage) else event
apply(app, applied)
}
/** Ends the CLI process kept between turns, and with it whatever it still runs in the background. */
private fun dropSession() {
main.removeCallbacks(reap)
launchedBackground = false
appContext?.let { AgentHostService.backgroundDone(it) }
val kept = session ?: return
session = null
AgentProcesses.killTree(kept.pid)
kept.process.destroy()
}
/** Ends the turn now: its process and everything it started, a build included. */
fun stop(context: Context) {
val app = context.applicationContext
@@ -349,6 +454,7 @@ object AgentHost {
AgentProcesses.killTree(running.pid)
running.process.destroy()
}
dropSession()
if (state == State.WORKING) finish(app, null, stopped = true)
}
@@ -443,19 +549,25 @@ object AgentHost {
private fun finish(app: Context, error: String?, stopped: Boolean = false, usage: Usage? = null) {
if (state != State.WORKING) return
turn = null
val answeredTask = background
background = false
main.removeCallbacks(reap)
if (session != null) main.postDelayed(reap, LINGER_MS)
if (!stopped) labFromTurn = false
live = ""
liveThinking = ""
val held = if (context > 0) (usage ?: Usage(0, 0.0, 0, 0)).copy(context = context, window = window) else usage
record(app, Entry.Finished(error, stopped, held, planned = turnPlanned && !stopped && error == null))
state = State.IDLE
unseen = true
failed = error != null
AgentHostService.stop(app)
if (session != null && launchedBackground) {
AgentHostService.waitForBackground(app)?.let { serviceWarning(app, it) }
} else AgentHostService.stop(app)
record(app, Entry.Finished(error, stopped, held, planned = turnPlanned && !stopped && error == null))
// Claude Code now and then ends a resumed turn at once without reading the message; nothing
// happened, so the message is sent once more.
val asked = entries.lastOrNull { it is Entry.Asked } as? Entry.Asked
if (!stopped && error == null && asked != null && answerless(entries) && !retrying) {
if (!stopped && error == null && !answeredTask && asked != null && answerless(entries) && !retrying) {
retrying = true
val retryChat = chat
resend = Runnable {
@@ -493,6 +605,7 @@ object AgentHost {
private fun record(app: Context, entry: Entry) {
if (!AgentChats.merge(entries, entry)) return
if (entry is Entry.Used && entry.background) launchedBackground = true
chat?.let { AgentChats.append(AgentChats.file(app, it), entry) }
}
@@ -645,6 +758,8 @@ object AgentHost {
/** The raw output of the latest turn, for working out what a CLI did when the chat shows nothing. */
private const val TURN_LOG = "agent/turn.log"
private const val RETRY_MS = 3_000L
/** How long the CLI process stays open after a turn, waiting for background work to wake it. */
private const val LINGER_MS = 20 * 60_000L
private fun modelKey(harness: AgentHarness) = "model_${harness.id}"
private fun limitsKey(harness: AgentHarness) = "limits_${harness.id}"
@@ -694,3 +809,17 @@ internal fun choices(reply: String): Choices {
val options = lines.subList(found.first + 1, found.last).map { it.trim().removePrefix("- ").removePrefix("* ").trim() }.filter { it.isNotEmpty() }
return Choices(lines.subList(0, found.first).joinToString("\n").trimEnd(), options)
}
internal class AgentCostTracker {
private var previous = 0.0
fun reset() { previous = 0.0 }
fun perTurn(usage: AgentHost.Usage): AgentHost.Usage {
val total = usage.costUsd
if (total == 0.0 && previous > 0.0) return usage
val delta = if (total >= previous) total - previous else total
previous = total
return usage.copy(costUsd = delta)
}
}
@@ -42,19 +42,37 @@ class AgentHostService : Service() {
/** Setup steps that keep the app alive while they run, besides the agent's turn. */
private var setupSteps = 0
fun start(context: Context) {
fun start(context: Context): Throwable? {
if (started) { update(context); return null }
lastText = null
started = true
runCatching { context.startForegroundService(Intent(context, AgentHostService::class.java)) }
.onSuccess { awaiting++ }
return runCatching { context.startForegroundService(Intent(context, AgentHostService::class.java)) }
.onSuccess { started = true; awaiting++ }
.exceptionOrNull()
}
fun stop(context: Context) {
if (setupSteps > 0) return
if (setupSteps > 0 || waiting) return
started = false
if (awaiting == 0) context.stopService(Intent(context, AgentHostService::class.java))
}
/**
* The turn has ended but its CLI process stays open with background work that can wake it; the app must stay
* alive to read that answer, so the service keeps running until the process is dropped.
*/
@Volatile private var waiting = false
fun waitForBackground(context: Context): Throwable? {
waiting = true
return if (started) { update(context); null } else start(context)
}
fun backgroundDone(context: Context) {
if (!waiting) return
waiting = false
if (AgentHost.state != AgentHost.State.WORKING) stop(context)
}
fun setupStarted(context: Context) {
setupSteps++
start(context)
@@ -80,7 +98,8 @@ class AgentHostService : Service() {
AgentSetup.detail[AgentSetup.Step.GITHUB]?.takeIf {
AgentSetup.status[AgentSetup.Step.GITHUB] == AgentSetup.Status.WORKING && it.startsWith("GitHub device code:")
}?.let { return it }
if (AgentHost.state != AgentHost.State.WORKING) return context.getString(R.string.agent_setting_up)
if (AgentHost.state != AgentHost.State.WORKING)
return context.getString(if (waiting && setupSteps == 0) R.string.agent_waiting_background else R.string.agent_setting_up)
val tool = AgentHost.running()
val elapsed = minutes((SystemClock.elapsedRealtime() - AgentHost.turnStarted) / 1000)
return if (tool != null) "${tool.tool} · ${tool.detail}".take(120) + " · $elapsed" else context.getString(R.string.agent_thinking_for, elapsed)
@@ -4,6 +4,7 @@ import android.content.Context
import android.os.Handler
import android.os.Looper
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateMapOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
@@ -40,7 +41,9 @@ object AgentSetup {
private val main = Handler(Looper.getMainLooper())
private const val REPO = "https://github.com/Droid-Deck/DroidDeck.git"
private const val CHECKOUT = "/root/DroidDeck"
private val HELPERS = listOf("android-open", "dd-gh-login", "droiddeckctl")
private val HELPERS = listOf("android-open", "dd-gh-login", "droiddeckctl", "droiddeck-scenario")
/** DroidDeck's own skills (tools/agent/skills), given to every harness. */
private const val SKILLS = "agent/skills"
internal const val CTL = "/root/.local/share/droiddeck/ctl"
private const val PROBE_TIMEOUT_S = 60L
@@ -187,11 +190,98 @@ object AgentSetup {
/** Written before every step, so the helpers a step relies on are there and match this DroidDeck version. */
internal fun installHelpers(app: Context) {
val root = LinuxRuntime.rootDir(app)
val failed = mutableListOf<String>()
fun attempt(what: String, block: () -> Unit) = runCatching(block).onFailure {
android.util.Log.w("AgentSetup", "could not install $what", it)
failed += what
}
val bin = File(root, "root/.local/bin").apply { mkdirs() }
for (name in HELPERS) copyAsset(app, "agent/$name", File(bin, name))
for (name in HELPERS) attempt(name) { copyAsset(app, "agent/$name", File(bin, name)) }
val ctl = File(root, CTL.removePrefix("/")).apply { mkdirs() }
for (name in app.assets.list("agent/ctl").orEmpty()) copyAsset(app, "agent/ctl/$name", File(ctl, name))
for (name in app.assets.list("agent/ctl").orEmpty()) attempt("ctl/$name") { copyAsset(app, "agent/ctl/$name", File(ctl, name)) }
val skills = app.assets.list(SKILLS).orEmpty().associateWith { app.assets.list("$SKILLS/$it").orEmpty().toList() }
failed += installSkills(root, skills) { app.assets.open("$SKILLS/$it") }
attempt("AGENTS.md") {
val rules = app.assets.open("agent/ctl/AGENTS.md").use { it.readBytes().decodeToString() }
failed += installInstructions(root, rules)
}
unpinAdbSerial(File(root, "root/.bashrc"))
main.post { problems.clear(); problems.addAll(failed.distinct()) }
}
/** What [installHelpers] could not install last time, shown in the Agent tab; empty when all is in place. */
val problems = mutableStateListOf<String>()
/**
* Writes each of DroidDeck's [skills] (name to its files) into every harness's skills folder, so
* Claude Code, Codex and any later harness load the same ones, as of this DroidDeck version.
* Skills the user added there are left alone. Returns the skills that could not be written.
*/
internal fun installSkills(root: File, skills: Map<String, List<String>>, open: (String) -> java.io.InputStream): List<String> {
val failed = mutableListOf<String>()
for (harness in AgentHarness.all) for ((name, files) in skills) runCatching {
val dir = File(root, "${harness.skills}/$name")
// A folder of that name without DroidDeck's mark is the user's own skill: keep it.
if (dir.exists() && !File(dir, SKILL_MARK).exists()) return@runCatching
dir.mkdirs()
// Marked before copying, so a copy that fails part way is retried next turn, not taken for the user's.
File(dir, SKILL_MARK).writeText("Installed by DroidDeck and replaced on every turn. Delete this file to keep your own edits.\n")
for (file in files) open("$name/$file").use { replaceFile(it, File(dir, file), executable = false) }
}.onFailure {
android.util.Log.w("AgentSetup", "could not install skill $name for ${harness.name}", it)
failed += "skill $name"
}
return failed
}
/** Marks a skill folder as DroidDeck's, so it may be replaced; one without it belongs to the user. */
internal const val SKILL_MARK = ".droiddeck"
/**
* Where [file] really is when it is a symlink, as the guest sees it: an absolute target is a
* userland path, so it is looked up under [root]. A dotfiles link keeps working that way.
*/
internal fun guestTarget(root: File, file: File): File {
var current = file
repeat(8) {
val path = current.toPath()
if (!java.nio.file.Files.isSymbolicLink(path)) return current
val target = java.nio.file.Files.readSymbolicLink(path).toString()
current = if (target.startsWith("/")) File(root, target.removePrefix("/")) else File(current.parentFile, target)
}
return current
}
internal const val BLOCK_BEGIN = "<!-- BEGIN DroidDeck: replaced on every turn. Write your own rules outside this block. -->"
internal const val BLOCK_END = "<!-- END DroidDeck -->"
/**
* Puts DroidDeck's [rules] in a marked block of every harness's global instructions file,
* keeping whatever the user wrote around it. Returns the files that could not be written.
*/
internal fun installInstructions(root: File, rules: String): List<String> {
val failed = mutableListOf<String>()
for (harness in AgentHarness.all) runCatching {
val file = guestTarget(root, File(root, harness.instructions)).apply { parentFile?.mkdirs() }
val existing = if (file.exists()) file.readText() else null
val merged = withBlock(existing, rules)
if (merged != existing) replaceFile(merged.byteInputStream(), file, executable = false)
}.onFailure {
android.util.Log.w("AgentSetup", "could not write ${harness.instructions}", it)
failed += harness.instructions.substringAfterLast("root/")
}
return failed
}
/** [existing] with DroidDeck's block set to [rules]: replaced in place, or put first when there is none yet. */
internal fun withBlock(existing: String?, rules: String): String {
val block = "$BLOCK_BEGIN\n${rules.trim()}\n$BLOCK_END\n"
if (existing.isNullOrBlank()) return block
val start = existing.indexOf(BLOCK_BEGIN)
val end = existing.indexOf(BLOCK_END, start.coerceAtLeast(0))
if (start < 0 || end < 0) return "$block\n$existing"
val after = existing.substring(end + BLOCK_END.length).removePrefix("\n")
return existing.substring(0, start) + block + after
}
/** Older tools/agent/setup pinned the adb port in .bashrc, which overrides the live port DroidDeck passes. */
@@ -201,8 +291,24 @@ object AgentSetup {
if (fixed != text) runCatching { bashrc.writeText(fixed) }
}
/**
* Written beside [target] and renamed over it, so a symlink left there by a hand-made setup is
* replaced rather than followed: its absolute target is a userland path the app cannot reach,
* and the failed write stopped every helper after it, the droiddeckctl guide included.
*/
private fun copyAsset(app: Context, asset: String, target: File) {
app.assets.open(asset).use { input -> target.outputStream().use { input.copyTo(it) } }
target.setExecutable(true, false)
app.assets.open(asset).use { replaceFile(it, target) }
}
/** Replaces [target], or the symlink at it, with [input]. */
internal fun replaceFile(input: java.io.InputStream, target: File, executable: Boolean = true) {
// A unique name, since an agent turn and a setup step can install at the same time.
val staged = File.createTempFile(".${target.name}.", ".part", target.parentFile)
staged.outputStream().use { input.copyTo(it) }
if (executable) staged.setExecutable(true, false)
if (!staged.renameTo(target)) {
staged.delete()
throw java.io.IOException("could not replace $target")
}
}
}
@@ -172,5 +172,8 @@ internal class AddonPack(
listOf("runtime.tzst", "version.txt"))
val UBISOFT = AddonPack("ubisoft", BuildConfig.PACK_UBISOFT_SHA256, BuildConfig.PACK_UBISOFT_SIZE,
listOf("droiddeck-upc.exe"))
val ROCKSTAR = AddonPack("rockstar", BuildConfig.PACK_ROCKSTAR_SHA256, BuildConfig.PACK_ROCKSTAR_SIZE,
listOf("Launcher32.exe", "Launcher64.exe"))
val DIRT = AddonPack("dirt", BuildConfig.PACK_DIRT_SHA256, BuildConfig.PACK_DIRT_SIZE, listOf("ws2_32.dll"))
}
}
@@ -13,7 +13,6 @@ object GamesFolderMigration {
@Synchronized
fun run(context: Context) {
repathInternalGuest(context)
val dirs = SessionPrefs.addedGamesDirs(context)
if (dirs.isEmpty()) return
val roots = legacyRoots(SessionPrefs.gameFolderBinds(context).map { it.first } + dirs)
@@ -59,30 +58,12 @@ object GamesFolderMigration {
SessionPrefs.setGamesFoldersMigrated(context)
}
private fun repathInternalGuest(context: Context) {
val binds = SessionPrefs.gameFolderBinds(context)
if (binds.none { it.second == StoreInstallRoot.INTERNAL_GUEST }) return
val hosts = binds.map { it.first }
val roots = legacyRoots(hosts).associateBy { it.host.path }
val taken = binds.map { it.second }.filter { it != StoreInstallRoot.INTERNAL_GUEST }.toMutableSet()
SessionPrefs.setGameFolderBinds(context, binds.map { (host, guest) ->
if (guest != StoreInstallRoot.INTERNAL_GUEST) return@map host to guest
val base = roots.getValue(host).guest
var next = base
var n = 2
while (next in taken) next = "$base-${n++}"
taken.add(next)
host to next
})
}
internal fun legacyRoots(paths: List<String>): List<AddedGames.Root> {
val hosts = paths.distinct().map { File(it) }
val names = hosts.groupingBy { it.name.lowercase() }.eachCount()
return hosts.map { host ->
val name = host.name.ifEmpty { "games" }
val clash = (names[name.lowercase()] ?: 0) > 1 || "${AddedGames.GUEST_DIR}/$name" == StoreInstallRoot.INTERNAL_GUEST
val guestName = if (clash) name + "-" + "%08x".format(CRC32().apply { update(host.path.toByteArray()) }.value).take(4) else name
val guestName = if ((names[name.lowercase()] ?: 0) > 1) name + "-" + "%08x".format(CRC32().apply { update(host.path.toByteArray()) }.value).take(4) else name
AddedGames.Root(host, "${AddedGames.GUEST_DIR}/$guestName")
}
}
@@ -0,0 +1,39 @@
package com.droiddeck.launcher.frontend
import android.content.Context
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionState
object SteamInputOverride {
private const val CONFIG_KEY = "UseSteamControllerConfig"
private const val DEFAULT_VALUE = "1"
enum class Mode(val value: String?) {
DEFAULT(null), ENABLED("2"), DISABLED("0");
companion object {
fun from(value: String): Mode? = when (value) {
DEFAULT_VALUE -> DEFAULT
"2" -> ENABLED
"0" -> DISABLED
else -> null
}
}
}
enum class Saved { YES, NO, RUNNING }
fun current(context: Context, appId: Int): Mode? =
SteamLaunchOptions.steamAppSetting(
SessionPrefs.activeSteamRoot(context), appId, CONFIG_KEY, DEFAULT_VALUE,
)?.let(Mode::from)
fun set(context: Context, appId: Int, mode: Mode, shown: Mode): Saved {
if (SessionState.running) return Saved.RUNNING
val saved = SteamLaunchOptions.writeSteamAppSetting(
SessionPrefs.activeSteamRoot(context), appId, CONFIG_KEY,
shown.value ?: DEFAULT_VALUE, mode.value, DEFAULT_VALUE,
)
return if (saved) Saved.YES else Saved.NO
}
}
@@ -13,6 +13,8 @@ import java.nio.file.StandardCopyOption
object SteamLaunchOptions {
private const val TAG = "SteamLaunchOptions"
private val STEAM = listOf("UserLocalConfigStore", "Software", "Valve", "Steam")
// Steam keeps per-game settings such as UseSteamControllerConfig in the root apps section, and launch options under Software/Valve/Steam.
private val ROOT = listOf("UserLocalConfigStore")
fun current(context: Context, appId: Int): String? =
SteamLiveShortcuts.launchOptions(context, appId.toLong()) ?: steam(SessionPrefs.activeSteamRoot(context), appId)
@@ -36,13 +38,38 @@ object SteamLaunchOptions {
val config = AddedGames.accountConfig(steamHome) ?: return null
val text = runCatching { File(config, "localconfig.vdf").readText() }.getOrNull() ?: return null
if (section(text, STEAM) == null) return null
return launchOptions(text, appId).orEmpty()
return appValue(text, appId, "LaunchOptions").orEmpty()
}
internal fun write(steamHome: File, appId: Int, options: String): Boolean {
val config = AddedGames.accountConfig(steamHome)?.let { File(it, "localconfig.vdf") } ?: return false
val text = runCatching { config.readText() }.getOrNull() ?: return false
val updated = withLaunchOptions(text, appId, options) ?: return false
return writeConfig(config, text, updated)
}
internal fun steamAppSetting(steamHome: File, appId: Int, key: String, default: String): String? {
val config = AddedGames.accountConfig(steamHome) ?: return null
val text = runCatching { File(config, "localconfig.vdf").readText() }.getOrNull() ?: return null
if (section(text, ROOT) == null) return null
return settingValue(text, appId, key) ?: default
}
private fun settingValue(text: String, appId: Int, key: String): String? =
appValue(text, appId, key, ROOT) ?: appValue(text, appId, key, STEAM)
internal fun writeSteamAppSetting(
steamHome: File, appId: Int, key: String, expected: String, value: String?, default: String,
): Boolean {
val config = AddedGames.accountConfig(steamHome)?.let { File(it, "localconfig.vdf") } ?: return false
val text = runCatching { config.readText() }.getOrNull() ?: return false
if (section(text, ROOT) == null || (settingValue(text, appId, key) ?: default) != expected) return false
val updated = (if (value == null) withoutAppValue(text, appId, key, ROOT) else withAppValue(text, appId, key, value, ROOT))
?.let { withoutAppValue(it, appId, key, STEAM) } ?: return false
return writeConfig(config, text, updated)
}
private fun writeConfig(config: File, text: String, updated: String): Boolean {
if (updated == text) return true
val staged = File(config.parentFile, config.name + ".staged")
return try {
@@ -55,36 +82,57 @@ object SteamLaunchOptions {
true
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not write launch options to ${config.path}", e)
Log.w(TAG, "could not write Steam app settings to ${config.path}", e)
false
}
}
internal fun launchOptions(text: String, appId: Int): String? {
val app = section(text, STEAM + "apps" + appId.toString()) ?: return null
return entries(text, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals("LaunchOptions", true) }
return appValue(text, appId, "LaunchOptions")
}
private fun appValue(text: String, appId: Int, key: String, base: List<String> = STEAM): String? {
val app = section(text, base + "apps" + appId.toString()) ?: return null
return entries(text, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals(key, true) }
?.let { unescape(text.substring(it.valueStart + 1, it.end)) }
}
internal fun withLaunchOptions(text: String, appId: Int, options: String): String? {
internal fun withLaunchOptions(text: String, appId: Int, options: String): String? =
withAppValue(text, appId, "LaunchOptions", options)
private fun withAppValue(text: String, appId: Int, key: String, rawValue: String, base: List<String> = STEAM): String? {
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
var updated = text
var path = STEAM
for (key in listOf("apps", appId.toString())) {
updated = withSection(updated, section(updated, path) ?: return null, key, newline) ?: return null
path = path + key
var path = base
for (pathPart in listOf("apps", appId.toString())) {
updated = withSection(updated, section(updated, path) ?: return null, pathPart, newline) ?: return null
path = path + pathPart
}
val app = section(updated, path) ?: return null
val value = "\"" + escape(options) + "\""
entries(updated, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals("LaunchOptions", true) }?.let {
val value = "\"" + escape(rawValue) + "\""
entries(updated, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals(key, true) }?.let {
return updated.replaceRange(it.valueStart, it.end + 1, value)
}
val lineStart = closingLine(updated, app) ?: return null
val indent = updated.substring(lineStart, app.end) + "\t"
return updated.substring(0, lineStart) + indent + "\"LaunchOptions\"\t\t" + value + newline + updated.substring(lineStart)
return updated.substring(0, lineStart) + indent + "\"${escape(key)}\"\t\t" + value + newline + updated.substring(lineStart)
}
private class Entry(val key: String, val valueStart: Int, val end: Int, val section: Boolean)
private fun withoutAppValue(text: String, appId: Int, key: String, base: List<String> = STEAM): String {
val app = section(text, base + "apps" + appId.toString()) ?: return text
val entry = entries(text, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals(key, true) } ?: return text
val lineStart = text.lastIndexOf('\n', entry.start - 1) + 1
val lineEnd = text.indexOf('\n', entry.end + 1).let { if (it < 0) text.length else it }
val onlyEntryOnLine = text.substring(lineStart, entry.start).all(Char::isWhitespace) &&
text.substring(entry.end + 1, lineEnd).all(Char::isWhitespace)
return if (onlyEntryOnLine) {
text.removeRange(lineStart, if (lineEnd < text.length) lineEnd + 1 else lineEnd)
} else {
text.removeRange(entry.start, entry.end + 1)
}
}
private class Entry(val key: String, val start: Int, val valueStart: Int, val end: Int, val section: Boolean)
private fun section(text: String, path: List<String>): Entry? {
var found: Entry? = null
@@ -98,18 +146,27 @@ object SteamLaunchOptions {
private fun entries(text: String, open: Int, close: Int): List<Entry> {
val found = ArrayList<Entry>()
var key: String? = null
var keyStart = -1
var i = open + 1
while (i < close) {
when {
text[i] == '"' -> {
val end = stringEnd(text, i) ?: return found
if (key == null) key = unescape(text.substring(i + 1, end)) else { found += Entry(key, i, end, false); key = null }
if (key == null) {
key = unescape(text.substring(i + 1, end))
keyStart = i
} else {
found += Entry(key, keyStart, i, end, false)
key = null
keyStart = -1
}
i = end + 1
}
text[i] == '{' -> {
val end = sectionEnd(text, i) ?: return found
key?.let { found += Entry(it, i, end, true) }
key?.let { found += Entry(it, keyStart, i, end, true) }
key = null
keyStart = -1
i = end + 1
}
text.startsWith("//", i) -> i = text.indexOf('\n', i).let { if (it < 0) close else it }
@@ -23,6 +23,7 @@ class DirectTouchHold(
private var downId = 0
private var delayMs = 0L
private var holdBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_CLICK
var tapClicks = true
private var forwarded = false
private var held = false
private var pressing = false
@@ -88,8 +89,8 @@ class DirectTouchHold(
downX = event.x
downY = event.y
downId = event.getPointerId(0)
if (holdBehavior == TouchGestureConfig.MOUSE_BEHAVIOR_NONE) forwardDown()
else handler.postDelayed(hold, delayMs)
if (holdBehavior != TouchGestureConfig.MOUSE_BEHAVIOR_NONE) handler.postDelayed(hold, delayMs)
else if (tapClicks) forwardDown()
return true
}
if (held) {
@@ -121,6 +122,7 @@ class DirectTouchHold(
}
MotionEvent.ACTION_UP -> {
handler.removeCallbacks(hold)
if (!forwarded && !tapClicks) return true
if (!forwarded) forwardDown()
upX = event.x
upY = event.y
@@ -94,9 +94,11 @@ data class InputLibrary(
fun panelPart(isDesktop: Boolean, panel: String?): InputPart =
panel?.let { id -> bindings.firstOrNull { it.id == id } }?.let { InputPart(it.id, it.layoutId) } ?: activePart(isDesktop, InputRole.SECONDARY)
fun panelLayout(isDesktop: Boolean, panel: String?) = panelPart(isDesktop, panel).layout?.let { id -> layouts.firstOrNull { it.id == id } }
fun compileActive(isDesktop: Boolean, panel: String? = null): InputProfile = compileParts(activeId(isDesktop), InputRole.entries.associateWith {
preset(if (it == InputRole.SECONDARY) panelPart(isDesktop, panel).bindings else activePart(isDesktop, it).bindings)
})
fun compileActive(isDesktop: Boolean, panel: String? = null): InputProfile = activeId(isDesktop).let { id ->
compileParts(id, InputRole.entries.associateWith {
preset(if (it == InputRole.SECONDARY) panelPart(isDesktop, panel).bindings else activePart(isDesktop, it).bindings)
}, profile(id).base)
}
fun saveSelection(isDesktop: Boolean, name: String, id: String = newInputId()): InputLibrary {
val current = profile(activeId(isDesktop))
@@ -109,14 +111,14 @@ data class InputLibrary(
fun compile(id: String): InputProfile {
val profile = profile(id)
val parts = InputRole.entries.associateWith { preset(profile.binding(it)) }
return compileParts(id, parts)
return compileParts(id, parts, profile.base)
}
private fun compileParts(id: String, parts: Map<InputRole, SavedInputBindings>): InputProfile {
return InputProfile(id, parts.mapValues { it.value.controls }.filterValues { it.isNotEmpty() },
parts.getValue(InputRole.PHYSICAL).keys,
parts.mapValues { it.value.elements }.filterValues { it.isNotEmpty() },
parts.mapValues { it.value.clicks }.filterValues { it.isNotEmpty() })
private fun compileParts(id: String, parts: Map<InputRole, SavedInputBindings>, base: String): InputProfile {
return InputProfile(id, base = base, bindings = parts.mapValues { it.value.controls }.filterValues { it.isNotEmpty() },
keys = parts.getValue(InputRole.PHYSICAL).keys,
elements = parts.mapValues { it.value.elements }.filterValues { it.isNotEmpty() },
clicks = parts.mapValues { it.value.clicks }.filterValues { it.isNotEmpty() })
}
fun usersOfBindings(id: String) = profiles.filter { p -> p.parts.values.any { it.bindings == id } }
@@ -36,6 +36,7 @@ sealed interface InputAction {
data class InputProfile(
val id: String,
val base: String = id,
val bindings: Map<InputRole, Map<InputControl, InputAction>> = emptyMap(),
val keys: List<PhysicalInputBinding> = emptyList(),
val elements: Map<InputRole, Map<String, InputAction>> = emptyMap(),
@@ -50,6 +51,16 @@ data class InputProfile(
fun elementAction(role: InputRole, id: String, control: InputControl): InputAction =
elements[role]?.get(id) ?: if (id == "legacy:${control.id}") action(role, control) else InputAction.Disabled
fun hasMouseButton(role: InputRole, elements: List<InputSurfaceElement>): Boolean {
val stock = defaults(base)
fun chosen(action: InputAction, shipped: InputAction) = action is InputAction.MouseButton && action != shipped
return elements.any {
val pressable = it.kind == InputElementKind.BUTTON || it.kind == InputElementKind.TRIGGER
pressable && chosen(elementAction(role, it.id, it.control), stock.elementAction(role, it.id, it.control)) ||
it.hasClick && chosen(elementClickAction(role, it), stock.elementClickAction(role, it))
}
}
fun elementClickAction(role: InputRole, element: InputSurfaceElement): InputAction = clicks[role]?.get(element.id)
?: defaultElementClick(element, elementAction(role, element.id, element.control)) { action(role, it) }
@@ -72,7 +83,7 @@ data class InputProfile(
InputControl.LEFT_PAD to InputAction.Scroll(), InputControl.RIGHT_PAD to InputAction.Pointer(),
InputControl.LEFT_CLICK to InputAction.MouseButton(273), InputControl.RIGHT_CLICK to InputAction.MouseButton(272),
)
return InputProfile(DESKTOP, InputRole.entries.associateWith { desktop })
return InputProfile(DESKTOP, bindings = InputRole.entries.associateWith { desktop })
}
}
}
@@ -80,6 +80,8 @@ class OnScreenControls(context: Context, pad: PadBridge?, val dock: OnScreenLayo
}
}
fun shownElements() = surface.shownElements()
private fun render() {
val elements = placed()
surface.updateCustomLayout(when {
@@ -34,6 +34,7 @@ class ScrollTouchGestures(
private var movedAt = 0L
private var scrolling = false
private var vertical = true
var tapClicks = true
private var held = false
private var dragging = false
private var stoppedFling = false
@@ -112,7 +113,7 @@ class ScrollTouchGestures(
}
dragging -> listener.onButton(PointerGestures.BTN_LEFT, false)
held -> click(PointerGestures.BTN_RIGHT)
!stoppedFling -> click(PointerGestures.BTN_LEFT)
!stoppedFling && tapClicks -> click(PointerGestures.BTN_LEFT)
}
dragging = false
held = false
@@ -17,6 +17,11 @@ class TouchpadGestures(
var bounds: android.graphics.RectF = android.graphics.RectF(0f, 0f, 1f, 1f)
var sensitivity = 1.15f
var desktop = false
var tapClicks = true
set(value) {
field = value
if (!value) lastTapAt = 0L
}
private val handler = Handler(Looper.getMainLooper())
private var lastX = 0f
@@ -55,6 +60,7 @@ class TouchpadGestures(
private val clickUp = Runnable { releaseClick() }
private fun click(button: Int) {
if (!tapClicks) return
releaseClick()
listener.onButton(button, true, x, y)
clicked = button
@@ -108,7 +114,7 @@ class TouchpadGestures(
travelled = 0f; held = false; twoFingers = false; scrolled = false; secondWasTap = false
fingers = 1; pinching = false
anchorId = event.getPointerId(0); moverId = -1; holdDrag = false; scrollLocked = false
if (event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) {
if (tapClicks && event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) {
dragging = true
listener.onButton(PointerGestures.BTN_LEFT, true, x, y)
} else {
@@ -262,7 +268,7 @@ class TouchpadGestures(
}
!cancelled && travelled <= slopPx && event.eventTime - downAt < TouchTiming.TAP_MS -> {
click(PointerGestures.BTN_LEFT)
lastTapAt = event.eventTime
if (tapClicks) lastTapAt = event.eventTime
}
}
dragging = false; held = false; twoFingers = false
@@ -18,6 +18,8 @@ class TwoFingerGestures(private val slopPx: Float, private val listener: Listene
private enum class State { IDLE, PENDING, CANDIDATE, TAPPED, HELD, SCROLLING, PASSING }
var tapClicks = true
private val handler = Handler(Looper.getMainLooper())
private var state = State.IDLE
private var x = 0f
@@ -151,7 +153,7 @@ class TwoFingerGestures(private val slopPx: Float, private val listener: Listene
when (was) {
State.TAPPED -> {
listener.cancelTouch()
listener.rightClick(x, y)
if (tapClicks) listener.rightClick(x, y)
return true
}
State.SCROLLING, State.HELD -> return true
@@ -150,8 +150,37 @@ object BootMovie {
folder.listFiles()?.forEach { if (it.name != keep) it.delete() }
}
internal fun syncShuffleFromSteam(context: Context, config: File) = syncShuffleFromSteam(context, listOf(config))
// Staging writes Shuffle and its baseline under the same lock, so a poll never reads a half-staged value as Steam's.
internal fun syncShuffleFromSteam(context: Context, configs: List<File>) = synchronized(SessionFiles.STEAM_CONFIG) {
val read = configs.mapNotNull { config -> SessionFiles.startupMovieShuffle(config)?.let { config to it } }
val (known, unseen) = read.partition { (config, _) -> SessionPrefs.bootMovieShuffleSeen(context, config) != null }
var changed = false
known.forEach { (config, steam) ->
if (SessionPrefs.bootMovieShuffleSeen(context, config) != steam) {
SessionPrefs.setBootMovieShuffle(context, steam)
changed = true
}
SessionPrefs.setBootMovieShuffleSeen(context, config, steam)
}
// A config read for the first time only sets the choice when no known config changed, so it cannot undo a change.
unseen.forEach { (config, steam) ->
if (!changed && SessionPrefs.bootMovieShuffle(context) != steam) {
SessionPrefs.setBootMovieShuffle(context, steam)
changed = true
}
SessionPrefs.setBootMovieShuffleSeen(context, config, steam)
}
}
fun syncFromSteam(context: Context): Boolean {
val named = SessionFiles.startupMovieLocalPath(BootMovieLibrary.steamConfig(context)) ?: return false
val active = BootMovieLibrary.steamConfig(context)
syncShuffleFromSteam(
context,
BootMovieLibrary.steamRoots(context).map { File(it, "config/config.vdf") }.filter { it != active } + active,
)
val named = SessionFiles.startupMovieLocalPath(active) ?: return false
val seen = SessionPrefs.bootMovieSteamSeen(context)
if (named == seen) return false
SessionPrefs.setBootMovieSteamSeen(context, named)
@@ -14,6 +14,9 @@ import com.droiddeck.launcher.runtime.ProotFastPath
import java.io.File
object SessionFiles {
// Session start and Flatpak staging can both rewrite Steam's config.vdf; one writer at a time.
internal val STEAM_CONFIG = Any()
private const val TAG = "SessionFiles"
private const val NO_PAD_SWITCH = "Download/droiddeck-no-pad"
const val DIRECTAUDIO_DIR = "usr/local/lib/directaudio"
@@ -33,35 +36,60 @@ object SessionFiles {
"etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop",
)
private const val UBISOFT_SERVICE = "usr/local/lib/droiddeck-ubisoft/droiddeck-upc.exe"
private val SERVICE_PACKS = mapOf(
AddonPack.UBISOFT to "usr/local/lib/droiddeck-ubisoft",
AddonPack.ROCKSTAR to "usr/local/lib/droiddeck-rockstar",
AddonPack.DIRT to "usr/local/lib/droiddeck-dirt",
)
/** Fetches the Ubisoft pack and, once it lands, stages the service so a running session gets it without restarting. */
fun ensureUbisoftService(context: Context) {
AddonPack.UBISOFT.ensure(context) { app ->
fun ensureUbisoftService(context: Context) = ensureStoreService(context, AddonPack.UBISOFT)
fun ensureRockstarService(context: Context) = ensureStoreService(context, AddonPack.ROCKSTAR)
/** The DiRT 3 / DiRT Showdown ws2_32 stand-in; droiddeck-game-env applies it only when it is staged. */
fun ensureDirtStandIn(context: Context) = ensureStoreService(context, AddonPack.DIRT)
private fun ensureStoreService(context: Context, pack: AddonPack) {
pack.ensure(context) { app ->
com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).takeIf { it.isDirectory }
?.let { stageUbisoftService(app, it, null) }
?.let { stageStoreService(app, it, pack, null) }
}
}
/** Blocks until the store's service pack is installed and staged in [root]; false when it could not be fetched. */
fun awaitStoreService(context: Context, store: String, root: File): Boolean {
val pack = SERVICE_PACKS.keys.firstOrNull { it.name == store } ?: return false
if (!pack.await(context)) return false
return stageStoreService(context, root, pack, null)
}
@Synchronized
private fun stageUbisoftService(context: Context, root: File, ledger: StageLedger?) {
val pack = AddonPack.UBISOFT.takeIf { it.installed(context) }?.dir(context) ?: return
val target = File(root, UBISOFT_SERVICE)
if (ledger?.current(UBISOFT_SERVICE, target) == true) return
val staged = File(target.parentFile, target.name + ".staged")
var installed = false
try {
target.parentFile?.mkdirs()
File(pack, "droiddeck-upc.exe").inputStream().use { input ->
staged.outputStream().use { output -> FileUtils.copy(input, output) }
private fun stageStoreService(context: Context, root: File, pack: AddonPack, ledger: StageLedger?): Boolean {
val dir = pack.takeIf { it.installed(context) }?.dir(context) ?: return false
val base = SERVICE_PACKS.getValue(pack)
var all = true
for (file in dir.listFiles().orEmpty().filter { it.isFile && it.name != AddonPack.COMPLETE }.sortedBy { it.name }) {
val relative = "$base/${file.name}"
val target = File(root, relative)
if (ledger?.current(relative, target) == true) continue
val staged = File(target.parentFile, target.name + ".staged")
var installed = false
try {
target.parentFile?.mkdirs()
file.inputStream().use { input ->
staged.outputStream().use { output -> FileUtils.copy(input, output) }
}
installed = staged.setExecutable(true, false) && staged.renameTo(target)
} catch (e: Exception) {
Log.w(TAG, "could not stage the ${pack.name} pack", e)
} finally {
if (!installed) staged.delete()
}
installed = staged.setExecutable(true, false) && staged.renameTo(target)
} catch (e: Exception) {
Log.w(TAG, "could not stage the Ubisoft launcher service", e)
} finally {
if (!installed) staged.delete()
if (installed) ledger?.staged(relative, target) else Log.e(TAG, "$relative NOT staged")
all = all && installed
}
if (installed) ledger?.staged(UBISOFT_SERVICE, target) else Log.e(TAG, "$UBISOFT_SERVICE NOT staged")
return all
}
fun stage(context: Context, root: File, startsSession: Boolean = false) {
@@ -70,8 +98,6 @@ object SessionFiles {
GameEnvironmentStore.publish(context)
WinComponents.publish(context)
val files = arrayOf(
"rockstar/helpers/Launcher32.exe" to "usr/local/lib/droiddeck-rockstar/Launcher32.exe",
"rockstar/helpers/Launcher64.exe" to "usr/local/lib/droiddeck-rockstar/Launcher64.exe",
"usr/local/bin/droiddeck-game-env" to "usr/local/bin/droiddeck-game-env",
"usr/local/bin/droiddeck-game-debug" to "usr/local/bin/droiddeck-game-debug",
"usr/local/bin/droiddeck-game-gpu" to "usr/local/bin/droiddeck-game-gpu",
@@ -231,7 +257,6 @@ object SessionFiles {
"usr/local/lib/droiddeck/uruntime" to "usr/local/lib/droiddeck/uruntime",
"usr/local/lib/droiddeck-pipewire.tzst" to "usr/local/lib/droiddeck-pipewire.tzst",
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
"usr/local/lib/droiddeck-dirt/ws2_32.dll" to "usr/local/lib/droiddeck-dirt/ws2_32.dll",
) + 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)
@@ -245,7 +270,7 @@ object SessionFiles {
var installed = false
try {
target.parentFile?.mkdirs()
(if (asset.startsWith("rockstar/")) requireNotNull(javaClass.getResourceAsStream("/$asset")) else context.assets.open("linuxfs/$asset")).use { input ->
context.assets.open("linuxfs/$asset").use { input ->
staged.outputStream().use { output -> FileUtils.copy(input, output) }
}
installed = staged.setExecutable(true, false) && staged.renameTo(target)
@@ -287,7 +312,7 @@ object SessionFiles {
}
if (installed) ledger.staged(key, target) else Log.e(TAG, "DirectAudio $set/$relative NOT staged")
}
stageUbisoftService(context, root, ledger)
for (pack in SERVICE_PACKS.keys) stageStoreService(context, root, pack, 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/libblsession.so\n")
@@ -357,6 +382,11 @@ object SessionFiles {
"staged=$bigPictureMovieInstalled done=$done steam=${home.path} config: $before -> ${startupMoviePath(config)}",
)
if (startsSession) {
synchronized(STEAM_CONFIG) {
val shuffle = SessionPrefs.bootMovieShuffle(context)
setStartupMovieShuffle(config, shuffle)
if (startupMovieShuffle(config) == shuffle) SessionPrefs.setBootMovieShuffleSeen(context, config, shuffle)
}
disableIdleSleep(home)
seedUserDefaults(home)
}
@@ -369,28 +399,30 @@ object SessionFiles {
}
internal fun resetMissingStartupMovie(config: File, force: Boolean): Boolean {
if (!config.isFile) return true
val text = runCatching { config.readText() }.getOrElse {
Log.w(TAG, "could not read Steam config to reset the startup movie", it)
return false
}
val movie = activeStartupMovie(text) ?: return true
val block = text.substring(movie.keyStart, movie.close + 1)
val path = scalar(block, "LocalPath").orEmpty()
if (path.isEmpty()) return true
val missing = File(config.parentFile, "uioverrides/movies/" + path.removePrefix(BOOT_MOVIES_DIR))
val gone = path.startsWith(BOOT_MOVIES_DIR) && !missing.isFile && (force || path == BOOT_MOVIE_PATH)
if (!gone) return false
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
val updated = setScalar(setScalar(block, "MovieID", "0", newline), "LocalPath", "", newline)
val staged = File(config.parentFile, config.name + ".staged")
return try {
staged.writeText(text.replaceRange(movie.keyStart, movie.close + 1, updated))
(staged.renameTo(config)).also { if (!it) staged.delete() }
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not reset Steam startup movie selection", e)
false
synchronized(STEAM_CONFIG) {
if (!config.isFile) return true
val text = runCatching { config.readText() }.getOrElse {
Log.w(TAG, "could not read Steam config to reset the startup movie", it)
return false
}
val movie = activeStartupMovie(text) ?: return true
val block = text.substring(movie.keyStart, movie.close + 1)
val path = scalar(block, "LocalPath").orEmpty()
if (path.isEmpty()) return true
val missing = File(config.parentFile, "uioverrides/movies/" + path.removePrefix(BOOT_MOVIES_DIR))
val gone = path.startsWith(BOOT_MOVIES_DIR) && !missing.isFile && (force || path == BOOT_MOVIE_PATH)
if (!gone) return false
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
val updated = setScalar(setScalar(block, "MovieID", "0", newline), "LocalPath", "", newline)
val staged = File(config.parentFile, config.name + ".staged")
return try {
staged.writeText(text.replaceRange(movie.keyStart, movie.close + 1, updated))
(staged.renameTo(config)).also { if (!it) staged.delete() }
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not reset Steam startup movie selection", e)
false
}
}
}
@@ -491,6 +523,42 @@ object SessionFiles {
return scalar(text.substring(movie.keyStart, movie.close + 1), "LocalPath")
}
internal fun startupMovieShuffle(config: File): Boolean? {
val text = runCatching { config.readText() }.getOrNull() ?: return null
val movie = activeStartupMovie(text) ?: return false
return scalar(text.substring(movie.keyStart, movie.close + 1), "Shuffle") == "1"
}
internal fun withStartupMovieShuffle(text: String, on: Boolean): String {
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
val value = if (on) "1" else "0"
return listOfNotNull(customizationMovie(text), olderMovie(text)).sortedByDescending { it.keyStart }.fold(text) { acc, movie ->
val block = acc.substring(movie.keyStart, movie.close + 1)
if (!on && scalar(block, "Shuffle") == null) acc else acc.replaceRange(movie.keyStart, movie.close + 1, setScalar(block, "Shuffle", value, newline))
}
}
internal fun setStartupMovieShuffle(config: File, on: Boolean): Boolean {
synchronized(STEAM_CONFIG) {
if (!config.isFile) return false
val text = runCatching { config.readText() }.getOrElse {
Log.w(TAG, "could not read Steam config to set the startup movie shuffle", it)
return false
}
val updated = withStartupMovieShuffle(text, on)
if (updated == text) return true
val staged = File(config.parentFile, config.name + ".staged")
return try {
staged.writeText(updated)
staged.renameTo(config).also { if (!it) staged.delete() }
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not set Steam startup movie shuffle", e)
false
}
}
}
internal fun startupMovieBlock(config: File): String? {
val text = runCatching { config.readText() }.getOrNull() ?: return null
val parts = listOfNotNull(
@@ -513,69 +581,71 @@ object SessionFiles {
}
internal fun ensureStartupMovieDefault(config: File, force: Boolean = false): Boolean {
val path = BOOT_MOVIE_PATH
val legacyPath = "/uioverrides/movies/droiddeck-startup.webm"
var text = if (config.isFile) runCatching { config.readText() }.getOrElse {
Log.w(TAG, "could not read Steam config for startup movie", it)
return false
} else ""
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
val custom = customizationMovie(text)
val active = custom ?: olderMovie(text)
if (active != null) {
val block = text.substring(active.keyStart, active.close + 1)
val selectedId = scalar(block, "MovieID")
val selectedPath = scalar(block, "LocalPath")
if (selectedPath == path && custom != null) {
Log.i(TAG, "Steam startup movie is set to DroidDeck")
return true
}
val legacyDefault = selectedId == "0" && selectedPath == legacyPath
val hasExplicitSelection =
(!selectedId.isNullOrEmpty() && selectedId != "0") || !selectedPath.isNullOrEmpty()
if (!force && !legacyDefault && hasExplicitSelection && selectedPath != path) {
Log.i(TAG, "Steam startup movie selection preserved")
synchronized(STEAM_CONFIG) {
val path = BOOT_MOVIE_PATH
val legacyPath = "/uioverrides/movies/droiddeck-startup.webm"
var text = if (config.isFile) runCatching { config.readText() }.getOrElse {
Log.w(TAG, "could not read Steam config for startup movie", it)
return false
}
}
val targets = listOfNotNull(customizationMovie(text), olderMovie(text)).sortedByDescending { it.keyStart }
for (target in targets) text = pointAt(text, target, path, newline)
if (olderMovie(text) == null) {
val steam = findSteamBlock(text)
if (steam == null) {
if (text.isNotBlank() && customizationMovie(text) == null) {
Log.w(TAG, "Steam config has no Steam settings block; startup movie default not set")
} else ""
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
val custom = customizationMovie(text)
val active = custom ?: olderMovie(text)
if (active != null) {
val block = text.substring(active.keyStart, active.close + 1)
val selectedId = scalar(block, "MovieID")
val selectedPath = scalar(block, "LocalPath")
if (selectedPath == path && custom != null) {
Log.i(TAG, "Steam startup movie is set to DroidDeck")
return true
}
val legacyDefault = selectedId == "0" && selectedPath == legacyPath
val hasExplicitSelection =
(!selectedId.isNullOrEmpty() && selectedId != "0") || !selectedPath.isNullOrEmpty()
if (!force && !legacyDefault && hasExplicitSelection && selectedPath != path) {
Log.i(TAG, "Steam startup movie selection preserved")
return false
}
if (text.isBlank()) {
text = "\"InstallConfigStore\"${newline}{${newline}\t\"Software\"${newline}\t{${newline}\t\t\"Valve\"${newline}\t\t{${newline}\t\t\t\"Steam\"${newline}\t\t\t{${newline}"
val section = startupMovieSection("\t\t\t\t", path, newline)
text += section + newline + "\t\t\t}" + newline + "\t\t}" + newline + "\t}" + newline + "}"
}
val targets = listOfNotNull(customizationMovie(text), olderMovie(text)).sortedByDescending { it.keyStart }
for (target in targets) text = pointAt(text, target, path, newline)
if (olderMovie(text) == null) {
val steam = findSteamBlock(text)
if (steam == null) {
if (text.isNotBlank() && customizationMovie(text) == null) {
Log.w(TAG, "Steam config has no Steam settings block; startup movie default not set")
return false
}
if (text.isBlank()) {
text = "\"InstallConfigStore\"${newline}{${newline}\t\"Software\"${newline}\t{${newline}\t\t\"Valve\"${newline}\t\t{${newline}\t\t\t\"Steam\"${newline}\t\t\t{${newline}"
val section = startupMovieSection("\t\t\t\t", path, newline)
text += section + newline + "\t\t\t}" + newline + "\t\t}" + newline + "\t}" + newline + "}"
}
} else {
val lineStart = text.lastIndexOf('\n', steam.close).let { if (it < 0) 0 else it + 1 }
val indent = text.substring(lineStart, steam.close).takeWhile { it == '\t' || it == ' ' }
val section = startupMovieSection(indent + "\t", path, newline)
text = text.substring(0, lineStart) + section + newline + indent + text.substring(lineStart)
}
} else {
val lineStart = text.lastIndexOf('\n', steam.close).let { if (it < 0) 0 else it + 1 }
val indent = text.substring(lineStart, steam.close).takeWhile { it == '\t' || it == ' ' }
val section = startupMovieSection(indent + "\t", path, newline)
text = text.substring(0, lineStart) + section + newline + indent + text.substring(lineStart)
}
}
if (customizationMovie(text) == null) text = withCustomization(text, path, newline)
val staged = File(config.parentFile, config.name + ".staged")
return try {
config.parentFile?.mkdirs()
staged.writeText(text)
if (!staged.renameTo(config)) {
if (customizationMovie(text) == null) text = withCustomization(text, path, newline)
val staged = File(config.parentFile, config.name + ".staged")
return try {
config.parentFile?.mkdirs()
staged.writeText(text)
if (!staged.renameTo(config)) {
staged.delete()
Log.e(TAG, "could not write Steam startup movie selection")
false
} else {
Log.i(TAG, "Steam startup movie default selected")
true
}
} catch (e: Exception) {
staged.delete()
Log.e(TAG, "could not write Steam startup movie selection")
Log.w(TAG, "could not write Steam startup movie selection", e)
false
} else {
Log.i(TAG, "Steam startup movie default selected")
true
}
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not write Steam startup movie selection", e)
false
}
}
@@ -661,32 +731,34 @@ object SessionFiles {
private val IDLE_SLEEP_TIMERS = listOf("IdleSuspendBatterySeconds", "IdleSuspendACSeconds")
internal fun disableIdleSleep(steamHome: File): Boolean {
val config = File(steamHome, "config/config.vdf")
val text = runCatching { config.readText() }.getOrNull() ?: return false
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
val steam = findSteamBlock(text) ?: return false
val system = findObject(text, "system", steam.open + 1, steam.close)
val updated = if (system != null) {
val block = text.substring(system.keyStart, system.close + 1)
text.replaceRange(system.keyStart, system.close + 1, IDLE_SLEEP_TIMERS.fold(block) { acc, key -> setScalar(acc, key, "0", newline) })
} else {
val lineStart = text.lastIndexOf('\n', steam.close).let { if (it < 0) 0 else it + 1 }
val indent = text.substring(lineStart, steam.close).takeWhile { it == '\t' || it == ' ' } + "\t"
val section = (listOf(indent + "\"system\"", indent + "{") +
IDLE_SLEEP_TIMERS.map { "$indent\t\"$it\"\t\t\"0\"" } + (indent + "}")).joinToString(newline) + newline
text.substring(0, lineStart) + section + text.substring(lineStart)
}
val staged = File(config.parentFile, config.name + ".staged")
return try {
if (updated != text) {
staged.writeText(updated)
if (!staged.renameTo(config)) { staged.delete(); return false }
synchronized(STEAM_CONFIG) {
val config = File(steamHome, "config/config.vdf")
val text = runCatching { config.readText() }.getOrNull() ?: return false
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
val steam = findSteamBlock(text) ?: return false
val system = findObject(text, "system", steam.open + 1, steam.close)
val updated = if (system != null) {
val block = text.substring(system.keyStart, system.close + 1)
text.replaceRange(system.keyStart, system.close + 1, IDLE_SLEEP_TIMERS.fold(block) { acc, key -> setScalar(acc, key, "0", newline) })
} else {
val lineStart = text.lastIndexOf('\n', steam.close).let { if (it < 0) 0 else it + 1 }
val indent = text.substring(lineStart, steam.close).takeWhile { it == '\t' || it == ' ' } + "\t"
val section = (listOf(indent + "\"system\"", indent + "{") +
IDLE_SLEEP_TIMERS.map { "$indent\t\"$it\"\t\t\"0\"" } + (indent + "}")).joinToString(newline) + newline
text.substring(0, lineStart) + section + text.substring(lineStart)
}
val staged = File(config.parentFile, config.name + ".staged")
return try {
if (updated != text) {
staged.writeText(updated)
if (!staged.renameTo(config)) { staged.delete(); return false }
}
true
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not disable Steam's idle sleep", e)
false
}
true
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not disable Steam's idle sleep", e)
false
}
}
@@ -738,7 +810,7 @@ object SessionFiles {
}
private fun setScalar(block: String, key: String, value: String, newline: String): String {
val pattern = Regex("(?m)^([\\t ]*\"${Regex.escape(key)}\"[\\t ]+)\"[^\"\\r\\n]*\"([\\t ]*)$")
val pattern = Regex("(?m)^([\\t ]*\"${Regex.escape(key)}\"[\\t ]+)\"[^\"\\r\\n]*\"([\\t ]*(?://[^\\r\\n]*)?)$")
val match = pattern.find(block)
if (match != null) return block.replaceRange(match.range, match.groupValues[1] + "\"" + value + "\"" + match.groupValues[2])
val close = block.lastIndexOf('}')
@@ -641,6 +641,13 @@ object SessionPrefs {
position.takeIf { it in listOf("top", "bottom", "left", "right", "center") } ?: "center").apply()
}
fun integerScaling(context: Context): Boolean =
prefs(context).getBoolean("integerScaling", false)
fun setIntegerScaling(context: Context, enabled: Boolean) {
prefs(context).edit().putBoolean("integerScaling", enabled).apply()
}
fun returnAfterGame(context: Context): Boolean = prefs(context).getBoolean("returnAfterGame", true)
fun setReturnAfterGame(context: Context, on: Boolean) {
@@ -939,7 +946,7 @@ object SessionPrefs {
prefs(context).edit().putBoolean("steamGpuCompositing", false).apply()
return false
}
return prefs(context).getBoolean("steamGpuCompositing", false)
return prefs(context).getBoolean("steamGpuCompositing", true)
}
fun steamGpuCompositingAllowed(): Boolean =
@@ -1229,6 +1236,13 @@ object SessionPrefs {
fun setBootMovieApplyNext(context: Context, on: Boolean) { prefs(context).edit().putBoolean("bootMovieApplyNext", on).apply() }
fun bootMovieSteamSeen(context: Context): String? = prefs(context).getString("bootMovieSteamSeen", null)
fun setBootMovieSteamSeen(context: Context, path: String) { prefs(context).edit().putString("bootMovieSteamSeen", path).apply() }
fun bootMovieShuffle(context: Context): Boolean = prefs(context).getBoolean("bootMovieShuffle", false)
fun setBootMovieShuffle(context: Context, on: Boolean) { prefs(context).edit().putBoolean("bootMovieShuffle", on).apply() }
fun bootMovieShuffleSeen(context: Context, config: java.io.File): Boolean? {
val key = "bootMovieShuffleSeen:${config.path}"
return prefs(context).takeIf { it.contains(key) }?.getBoolean(key, false)
}
fun setBootMovieShuffleSeen(context: Context, config: java.io.File, on: Boolean) { prefs(context).edit().putBoolean("bootMovieShuffleSeen:${config.path}", on).apply() }
fun bootMovieCustomName(context: Context): String? = prefs(context).getString("bootMovieCustomName", null)
fun setBootMovieCustomName(context: Context, name: String?) {
prefs(context).edit().apply { if (name == null) remove("bootMovieCustomName") else putString("bootMovieCustomName", name) }.apply()
@@ -18,7 +18,7 @@ object SettingsReset {
"storesInstallLanguage",
"hud", "hudDeck", "hudFps", "hudBattery", "hudGraph", "hudColor", "hudOpacity", "__KEEP_droidDeckHud__", "__KEEP_droidDeckHudPos__", "backHold", "backActionsInverted", "backDoubleTapMs", "touch", "pen", "penButton", "osc", "shape", "steamController",
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "unfoldedControlsWithController",
"stretch16x9", "picturePosition", "railLabels", "agentTab", "navTabOrder", "navTabShelved", "navTabHidden", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys",
"stretch16x9", "picturePosition", "integerScaling", "railLabels", "agentTab", "navTabOrder", "navTabShelved", "navTabHidden", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys",
"gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop",
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "paceCores", "ramCapMb", "vramCapMb", "zramClient", "zramIdle",
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
@@ -26,7 +26,7 @@ object SettingsReset {
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
"bootMovieApplyNext", "bootMovieSteamSeen",
"bootMovieApplyNext", "bootMovieSteamSeen", "bootMovieShuffle",
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsHud", "bottomHud", "bottomStripMetrics", "bottomStripTabs", "statsDash", "statsSpeedUnit",
)
@@ -3,10 +3,8 @@ package com.droiddeck.launcher.stores
import android.content.Context
import android.os.StatFs
import android.os.storage.StorageManager
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SecondaryLibrary
import com.droiddeck.launcher.session.SessionPrefs
import java.io.File
import java.util.zip.CRC32
@@ -14,7 +12,6 @@ import java.util.zip.CRC32
object StoreInstallRoot {
const val SPACE_UNKNOWN = -1L
private const val INTERNAL = "root/Games/Stores"
const val INTERNAL_GUEST = "/$INTERNAL"
private const val ON_VOLUME = "Games"
const val GUEST_EXTERNAL = "/mnt/droiddeck-stores"
@@ -182,24 +179,6 @@ object StoreInstallRoot {
fun externalBindSpecsForXodus(context: Context): List<String> =
externalBindSpecs(externalRootsForXodus(context), LinuxRuntime.rootDir(context))
fun guestBinds(context: Context): List<String> {
val out = ArrayList<String>(externalBindSpecs(context))
val root = LinuxRuntime.rootDir(context)
GameStorage.effective(context)?.takeIf { File(it.path).isDirectory }?.let { library ->
val content = SecondaryLibrary.contentPath(File(library.path)).path
for (guest in SecondaryLibrary.CARD_GUESTS) {
File(root, guest.removePrefix("/")).mkdirs()
out += "$content:$guest"
}
}
for (folder in AddedGames.roots(context)) {
if (!folder.host.isDirectory || !folder.host.canRead()) continue
File(root, folder.guest.removePrefix("/")).mkdirs()
out += folder.host.path + ":" + folder.guest
}
return out
}
internal fun externalBindSpecs(roots: List<Pair<File, String>>, guestRoot: File): List<String> =
roots.mapNotNull { (host, guest) ->
if (!host.isDirectory || !host.canRead()) return@mapNotNull null
@@ -80,6 +80,11 @@ object StoreLaunchRequests {
lastLaunched = Store.ROCKSTAR to request.optString("id")
com.droiddeck.launcher.stores.rockstar.RockstarLaunch.prepare(app, request.optString("id"))
}.getOrElse { JSONObject().put("ok", false).put("reason", "error-" + it.javaClass.simpleName) }
"store-service" -> runCatching {
val root = com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app)
if (com.droiddeck.launcher.session.SessionFiles.awaitStoreService(app, request.optString("store"), root)) JSONObject().put("ok", true)
else JSONObject().put("ok", false).put("reason", "service-unavailable")
}.getOrElse { JSONObject().put("ok", false).put("reason", "error-" + it.javaClass.simpleName) }
"rockstar-exited" -> {
if (lastLaunched == (Store.ROCKSTAR to request.optString("id"))) lastLaunched = null
JSONObject().put("ok", true)
@@ -7,7 +7,9 @@ import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.runtime.BattleNet
import com.droiddeck.launcher.runtime.GuestCommand
import com.droiddeck.launcher.runtime.LinuxRuntime
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SecondaryLibrary
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.InstalledStoreGame
import com.droiddeck.launcher.stores.Store
@@ -73,10 +75,22 @@ object BattleNetInstall {
}
internal fun binds(context: Context): List<String> {
val out = ArrayList<String>(StoreInstallRoot.externalBindSpecs(context))
val root = LinuxRuntime.rootDir(context)
GameStorage.effective(context)?.let { library ->
if (!File(library.path).isDirectory) throw IllegalStateException(context.getString(R.string.game_sync_err_game_storage))
val content = SecondaryLibrary.contentPath(File(library.path)).path
for (guest in SecondaryLibrary.CARD_GUESTS) {
File(root, guest.removePrefix("/")).mkdirs()
out += "$content:$guest"
}
}
return StoreInstallRoot.guestBinds(context)
for (folder in AddedGames.roots(context)) {
if (!folder.host.isDirectory || !folder.host.canRead()) continue
File(root, folder.guest.removePrefix("/")).mkdirs()
out += folder.host.path + ":" + folder.guest
}
return out
}
internal fun run(context: Context, args: List<String>, cancelled: AtomicBoolean?, onLine: (String) -> Unit): Int =
@@ -4,6 +4,7 @@ import android.content.Context;
import android.util.Log;
import com.droiddeck.launcher.frontend.AddedGames;
import com.droiddeck.launcher.runtime.GuestCommand;
import com.droiddeck.launcher.stores.StoreLanguage;
import com.droiddeck.launcher.stores.StoreLog;
import com.droiddeck.launcher.stores.download.StoreDownloadTier;
@@ -270,10 +271,11 @@ public final class GogDownloadManager {
long planned = 0;
boolean sized = true;
for (InstallerPart part : parts) { planned += part.size; if (part.size <= 0) sized = false; }
long needed = installerBytesNeeded(knownPartBytes(parts), GogLibrary.INSTANCE.sizeOf(ctx, game.gameId));
long usable = com.droiddeck.launcher.stores.StoreInstallRoot.availableBytes(installPath) + reclaimableInstallerBytes(installPath, parts);
if (com.droiddeck.launcher.stores.StoreInstallRoot.insufficientSpace(needed, usable)) {
throw new InstallException("Not enough free space: need " + formatBytes(needed) + ", only " + formatBytes(usable) + " free");
if (sized) {
long usable = com.droiddeck.launcher.stores.StoreInstallRoot.availableBytes(installPath);
if (com.droiddeck.launcher.stores.StoreInstallRoot.insufficientSpace(planned, usable)) {
throw new InstallException("Not enough free space: need " + formatBytes(planned) + ", only " + formatBytes(usable) + " free");
}
}
long total = 0;
for (InstallerPart part : parts) {
@@ -325,7 +327,10 @@ public final class GogDownloadManager {
cb.onProgress("Extracting installer…", 95);
int rc;
try {
rc = GogInnoextract.extract(ctx, guestSetup, guestDir, "gog-innoextract", cancelled,
rc = GuestCommand.INSTANCE.run(ctx, Arrays.asList(
"/usr/local/bin/droiddeck-innoextract", "--gog", "--silent",
"-d", guestDir, guestSetup),
false, "gog-innoextract", null, null, false, cancelled,
line -> { cb.onLog("gog innoextract: " + line); return kotlin.Unit.INSTANCE; });
} catch (Exception e) {
throw new InstallException("The installer could not be extracted: " + e.getClass().getSimpleName());
@@ -334,28 +339,6 @@ public final class GogDownloadManager {
if (rc != 0) throw new InstallException("The installer could not be extracted (innoextract exit " + rc + ")");
}
static long knownPartBytes(List<InstallerPart> parts) {
long known = 0;
for (InstallerPart part : parts) if (part.size > 0) known += part.size;
return known;
}
static long reclaimableInstallerBytes(File installPath, List<InstallerPart> parts) {
long reclaimed = 0;
for (InstallerPart part : parts) {
try {
File existing = installerDestination(installPath, part.filename);
if (existing.isFile()) reclaimed += existing.length();
} catch (IOException ignored) {
}
}
return reclaimed;
}
static long installerBytesNeeded(long downloadBytes, long installedBytes) {
return Math.max(0, downloadBytes) + Math.max(0, installedBytes);
}
static final class InstallerPart {
final String url;
final String filename;
@@ -1,17 +0,0 @@
package com.droiddeck.launcher.stores.gog
import android.content.Context
import com.droiddeck.launcher.runtime.GuestCommand
import com.droiddeck.launcher.stores.StoreInstallRoot
import java.util.concurrent.atomic.AtomicBoolean
internal object GogInnoextract {
private const val PROGRAM = "/usr/local/bin/droiddeck-innoextract"
@JvmStatic
fun extract(context: Context, setup: String, target: String, logName: String, cancelled: AtomicBoolean, onLine: (String) -> Unit): Int =
GuestCommand.run(context, argv(setup, target), logName = logName,
extraBinds = StoreInstallRoot.guestBinds(context), cancelled = cancelled, onLine = onLine)
internal fun argv(setup: String, target: String): List<String> = listOf(PROGRAM, "--gog", "--silent", "-d", target, setup)
}
@@ -3,9 +3,11 @@ package com.droiddeck.launcher.stores.gog
import android.content.Context
import com.droiddeck.launcher.agent.AgentGuest
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.runtime.GuestCommand
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import com.droiddeck.launcher.stores.StoreGameSidecar
import com.droiddeck.launcher.stores.StoreInstallRoot
import com.droiddeck.launcher.stores.download.DownloadQueue
import com.droiddeck.launcher.stores.download.DownloadStage
import org.json.JSONArray
@@ -69,7 +71,8 @@ internal object GogOffline {
val source = AddedGames.guestPath(context, installer) ?: error("The GOG installer is not visible to Linux")
val target = AddedGames.guestPath(context, extracted) ?: error("The GOG staging folder is not visible to Linux")
handle.stage(DownloadStage.INSTALL, "Extracting the full offline installer")
val rc = GogInnoextract.extract(context, source, target, "gog-refresh", stop, handle::log)
val rc = GuestCommand.run(context, listOf("/usr/local/bin/droiddeck-innoextract", "--gog", "--silent", "-d", target, source),
extraBinds = StoreInstallRoot.externalBindSpecs(context), cancelled = stop, logName = "gog-refresh", onLine = handle::log)
if (stop.get()) return
check(rc == 0) { "GOG installer extraction failed (exit $rc)" }
applyRefresh(proposal, extracted, handle, stop)
@@ -141,6 +141,7 @@ object RockstarAuth {
StoreAccounts.clear(context.applicationContext, Store.ROCKSTAR)
return "ticket"
}
com.droiddeck.launcher.session.SessionFiles.ensureRockstarService(context)
return null
}
@@ -61,7 +61,7 @@ internal object XboxRuntime {
val view = result.get(90, java.util.concurrent.TimeUnit.SECONDS)
check(renew(app, id, token) && synchronized(state) { generation == current }) { "Xbox launch was cancelled" }
return JSONObject().put("ok", true).put("socket", socket.path).put("lease", token)
.put("exe", view.getString("exe")).put("playfab", view.opt("playfab"))
.put("exe", view.getString("exe")).put("playfab", view.opt("playfab")).put("mountRoot", view.opt("mountRoot"))
} catch (e: Exception) { released(token); throw e }
}
@@ -33,6 +33,7 @@ import androidx.compose.runtime.key
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.produceState
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -73,8 +74,10 @@ import com.droiddeck.launcher.frontend.LogoPosition
import com.droiddeck.launcher.frontend.SoundtrackCollectionArt
import com.droiddeck.launcher.frontend.SteamGameArt
import com.droiddeck.launcher.frontend.SteamGridDb
import com.droiddeck.launcher.frontend.SteamInputOverride
import com.droiddeck.launcher.frontend.SteamLaunchOptions
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionState
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -336,6 +339,107 @@ internal fun SteamLaunchOptionsPanel(appId: Int) {
}
}
@Composable
internal fun SteamInputOverridePanel(appId: Int) {
val app = LocalContext.current.applicationContext
val colors = MaterialTheme.colorScheme
val scope = rememberCoroutineScope()
var selected by remember(appId) { mutableStateOf<SteamInputOverride.Mode?>(null) }
var version by remember(appId) { mutableIntStateOf(0) }
var saving by remember(appId) { mutableStateOf(false) }
var loading by remember(appId) { mutableStateOf(true) }
var error by remember(appId) { mutableStateOf<Int?>(null) }
var saves by remember(appId) { mutableIntStateOf(0) }
// SessionState.running is not snapshot state, so the panel polls it while shown.
val sessionRunning by produceState(SessionState.running) {
while (true) {
value = SessionState.running
kotlinx.coroutines.delay(1000)
}
}
LaunchedEffect(appId, version) {
val savesAtStart = saves
val read = withContext(Dispatchers.IO) { SteamInputOverride.current(app, appId) }
// A save that finished while this read ran already set the selection; the read may predate it.
if (!saving && saves == savesAtStart) selected = read
loading = false
}
var wasRunning by remember(appId) { mutableStateOf(SessionState.running) }
LaunchedEffect(sessionRunning) {
// Steam may have changed the override while it ran, so every stop reloads it.
if (wasRunning && !sessionRunning) {
if (error == R.string.edit_steam_input_running) error = null
loading = true
version++
}
wasRunning = sessionRunning
}
val lifecycle = LocalLifecycleOwner.current.lifecycle
DisposableEffect(lifecycle, appId) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_RESUME && !saving) {
loading = true
version++
}
}
lifecycle.addObserver(observer)
onDispose { lifecycle.removeObserver(observer) }
}
val choices = listOf(
SteamInputOverride.Mode.DEFAULT to R.string.edit_steam_input_default,
SteamInputOverride.Mode.ENABLED to R.string.edit_steam_input_enable,
SteamInputOverride.Mode.DISABLED to R.string.edit_steam_input_disable,
)
Column(Modifier.fillMaxWidth().tabPanel(), verticalArrangement = Arrangement.spacedBy(2.dp)) {
Text(
stringResource(R.string.edit_steam_input_override),
fontSize = 13.sp,
fontWeight = FontWeight.SemiBold,
color = colors.onSurfaceVariant,
modifier = Modifier.padding(start = 4.dp, bottom = 2.dp),
)
choices.forEach { (mode, label) ->
MenuItem(
stringResource(label),
checked = selected == mode,
enabled = selected != null && !saving && !loading && !sessionRunning && selected != mode,
) {
val before = selected ?: return@MenuItem
saving = true
scope.launch {
try {
val saved = withContext(Dispatchers.IO) { SteamInputOverride.set(app, appId, mode, before) }
error = when (saved) {
SteamInputOverride.Saved.YES -> null
SteamInputOverride.Saved.NO -> R.string.edit_steam_input_not_saved
SteamInputOverride.Saved.RUNNING -> R.string.edit_steam_input_running
}
if (saved == SteamInputOverride.Saved.YES) {
saves++
selected = mode
} else version++
} finally {
saving = false
}
}
}
}
val message = error ?: when {
sessionRunning -> R.string.edit_steam_input_running
selected == null && !loading -> R.string.edit_steam_input_unavailable
else -> R.string.edit_steam_input_hint
}
Text(
stringResource(message),
fontSize = 12.sp,
color = if (error == null) colors.onSurfaceVariant else colors.error,
modifier = Modifier.padding(start = 4.dp),
)
}
}
private class LoadedPosition(val value: LogoPosition.Value?)
@Composable
@@ -82,6 +82,7 @@ internal fun AgentEntry(
if (reply.options.isNotEmpty()) AgentChoices(reply.options, answerable, onSent)
}
}
is Entry.Notice -> Text(entry.text, color = colors.error, modifier = Modifier.padding(horizontal = 4.dp))
is Entry.Thought -> AgentThought(entry.text, live = false)
is Entry.Used -> if (entry.tool == "TodoWrite") AgentTodos(entry.input) else AgentToolCall(entry, running, children)
is Entry.Result -> Unit
@@ -567,7 +567,8 @@ private fun labStage(lab: com.droiddeck.launcher.agent.LabProgress) = when (lab.
else -> stringResource(R.string.agent_lab_stage_starting)
}
private fun hasActivity() = AgentHost.lab != null || AgentHost.queue.isNotEmpty() || currentTodo() != null
private fun hasActivity() = AgentHost.lab != null || AgentHost.queue.isNotEmpty() || currentTodo() != null ||
com.droiddeck.launcher.agent.AgentSetup.problems.isNotEmpty()
/** The todo item in progress and how many are done, while the agent works through a list. */
private fun currentTodo(): String? {
@@ -594,6 +595,11 @@ private fun AgentActivity(labOpen: Boolean, onLab: () -> Unit) {
Text(todo, fontSize = 12.5.sp, color = pal.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 220.dp))
}
}
val problems = com.droiddeck.launcher.agent.AgentSetup.problems
if (problems.isNotEmpty()) AgentChip(warn = true, tag = "agent-tools-missing") {
Text(stringResource(R.string.agent_tools_missing, problems.joinToString(", ")), fontSize = 12.5.sp, color = AttentionAmber,
maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 260.dp))
}
for (queued in AgentHost.queue) AgentChip(warn = true) {
Text(stringResource(R.string.agent_queued, queued.text), fontSize = 12.5.sp, color = AttentionAmber, maxLines = 1,
overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 180.dp))
@@ -160,7 +160,7 @@ internal fun BootMovieGroup(s: ModeSettings, a: ModeSettingsActions, host: MenuH
TabChip(stringResource(R.string.boot_movie_tab_sound), tab == MovieTab.SOUND, Modifier.weight(1f)) { tab = MovieTab.SOUND }
}
when (tab) {
MovieTab.INSTALLED -> InstalledTab(a)
MovieTab.INSTALLED -> InstalledTab(a, host)
MovieTab.IMPORT -> ImportTab(s, a)
MovieTab.REPO -> RepoTab(a)
MovieTab.SOUND -> SoundTab(s, a, host)
@@ -170,7 +170,7 @@ internal fun BootMovieGroup(s: ModeSettings, a: ModeSettingsActions, host: MenuH
}
@Composable
private fun InstalledTab(a: ModeSettingsActions) {
private fun InstalledTab(a: ModeSettingsActions, host: MenuHost) {
var browsing by remember { mutableStateOf(false) }
val snapshot = rememberMovies(0, a.onBootMovieChanged)
val current = snapshot?.let { snap -> snap.entries.firstOrNull { it.id == snap.selected }?.title }
@@ -183,6 +183,12 @@ private fun InstalledTab(a: ModeSettingsActions) {
modifier = Modifier.padding(horizontal = 14.dp).padding(bottom = 12.dp),
)
val app = LocalContext.current.applicationContext
var shuffle by remember { mutableStateOf(SessionPrefs.bootMovieShuffle(app)) }
LaunchedEffect(snapshot) { shuffle = SessionPrefs.bootMovieShuffle(app) }
ToggleRow(
host, "boot-movie-shuffle", stringResource(R.string.boot_movie_shuffle),
stringResource(R.string.common_applies_next_session), shuffle,
) { on -> shuffle = on; SessionPrefs.setBootMovieShuffle(app, on) }
val scope = rememberCoroutineScope()
var saving by remember { mutableStateOf(false) }
val debugging = remember { com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(app) }
@@ -835,6 +835,7 @@ private fun LaunchTab(game: Library.SteamGame, s: FrontEndState, a: FrontEndActi
LaunchSettings(s, a, host, game, hopRail ?: GameRef.key(game))
if (canEditSteamLaunchOptions(game, s.shortcutPicker)) {
SteamLaunchOptionsPanel(game.appId)
SteamInputOverridePanel(game.appId)
}
val folder = game.gameFiles
if (game.library == Library.ADDED && game.source == Library.ADDED && !s.shortcutPicker && folder != null) ShortcutFields(game, folder)
@@ -158,6 +158,11 @@ class InputSurfaceView(
}
}
fun shownElements(): List<InputSurfaceElement> {
val canvas = customCanvas ?: return customLayout
return customLayout.filterIndexed { index, _ -> (canvas.getChildAt(index) as? StickView)?.drawn != false }
}
fun releaseInputs() {
val now = android.os.SystemClock.uptimeMillis()
val cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)
@@ -514,6 +519,8 @@ class InputSurfaceView(
val adaptive get() = adaptive(element)
val drawn get() = !hideWhenIdle || touching
fun reach() = min(width, height) * if (classic(element)) CLASSIC_REACH else PANEL_REACH
fun captures(x: Float, y: Float): Boolean {
@@ -530,7 +537,7 @@ class InputSurfaceView(
}
override fun onDraw(canvas: Canvas) {
if (hideWhenIdle && !touching) return
if (!drawn) return
val cx = if (touching) originX else centreX()
val cy = if (touching) originY else height / 2f
val color = tint
@@ -83,6 +83,7 @@ class ModeSettings(
val forceSsbs: Boolean = false,
val syncBackend: String? = null,
val picturePosition: String? = null,
val integerScaling: Boolean? = null,
val stretch16x9: Boolean? = null,
val steamClientArch: String? = null,
val returnAfterGame: Boolean? = null,
@@ -139,6 +140,7 @@ class ModeSettingsActions(
val onForceSsbs: (Boolean) -> Unit = {},
val onSyncBackend: (String) -> Unit = {},
val onPicturePosition: (String) -> Unit = {},
val onIntegerScaling: (Boolean) -> Unit = {},
val onStretch16x9: (Boolean) -> Unit = {},
val onSteamRepair: () -> Unit = {},
val onSteamClientArch: (String) -> Unit = {},
@@ -242,6 +244,18 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
}
}
SettingsGroup(stringResource(R.string.display_image_scaling)) {
s.integerScaling?.let { enabled ->
ChoiceRow(
host, "integer-scaling",
stringResource(R.string.display_integer_scaling),
stringResource(R.string.display_integer_scaling_hint),
listOf(
false to stringResource(R.string.display_scaling_fit),
true to stringResource(R.string.display_scaling_auto),
),
enabled, onPick = a.onIntegerScaling,
)
}
ChoiceRow(
host, "upscaler", stringResource(R.string.display_filter), null,
SessionPrefs.upscalerChoices(LocalContext.current), s.upscaler,
@@ -239,6 +239,8 @@ class SecondScreenPresentation(
return super.dispatchGenericMotionEvent(event)
}
fun shownControlElements() = controlsView?.takeIf { isShowing && it.isShown }?.shownElements().orEmpty()
fun refreshControls() {
if (!created || !currentMode.controls) return
val controls = controlsView ?: return
+5
View File
@@ -1195,6 +1195,7 @@
<string name="agent_hint_working">اكتب لإضافة الرسالة التالية إلى الانتظار</string>
<string name="agent_queue">إضافة إلى الانتظار</string>
<string name="agent_queued">التالي: %1$s</string>
<string name="agent_tools_missing">أدوات الوكيل غير مثبتة: %1$s</string>
<string name="agent_unqueue">لا تُرسل</string>
<string name="agent_attach">إرفاق</string>
<string name="agent_remove_attachment">إزالة</string>
@@ -3563,6 +3564,7 @@
<string name="boot_movie_sound">الصوت</string>
<string name="boot_movie_skip">تخطي مقطع بدء التشغيل</string>
<string name="boot_movie_skip_hint">استخدم مقطعًا أسود مدته 0.1 ثانية كمقطع بدء تشغيل Steam. يسري في الجلسة التالية.</string>
<string name="boot_movie_shuffle">عشوائي</string>
<string name="boot_movie_custom">فيديو خاص بك</string>
<string name="boot_movie_custom_hint">MP4 أو MOV أو MKV أو WebM. تُحوَّل الصيغ الأخرى والملفات الأكبر من %1$d ميغابايت إلى WebM بدقة 720p على الجهاز، حتى %2$d ثانية.</string>
<string name="boot_movie_import">استيراد</string>
@@ -4265,4 +4267,7 @@
<string name="hud_readings_shown">المعروض</string>
<string name="hud_readings_count">%1$d من %2$d</string>
<string name="exit_hint_back">اضغط زر الرجوع مرة أخرى للخروج</string>
<string name="display_integer_scaling">تحجيم صحيح بالأعداد الصحيحة</string>
<string name="display_integer_scaling_hint">يستخدم أكبر معامل تحجيم صحيح يناسب الشاشة. إذا كان المصدر كبيرًا جدًا، يتم تصغير الصورة كاملة لتجنب الاقتصاص. يتم ضبط الدقة بشكل منفصل.</string>
</resources>
@@ -1213,6 +1213,7 @@
<string name="agent_hint_working">Escribe para encolar el siguiente mensaje</string>
<string name="agent_queue">Encolar</string>
<string name="agent_queued">Siguiente: %1$s</string>
<string name="agent_tools_missing">Herramientas del agente sin instalar: %1$s</string>
<string name="agent_unqueue">No enviar</string>
<string name="agent_attach">Adjuntar</string>
<string name="agent_remove_attachment">Quitar</string>
@@ -3385,6 +3386,7 @@
<string name="boot_movie_sound">Sonido</string>
<string name="boot_movie_skip">Omitir el video de inicio</string>
<string name="boot_movie_skip_hint">Usa un clip negro de 0.1 segundos como video de inicio de Steam. Se aplica en la próxima sesión.</string>
<string name="boot_movie_shuffle">Aleatorio</string>
<string name="boot_movie_custom">Tu propio video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV o WebM. Otros formatos y archivos de más de %1$d MB se convierten a WebM 720p en el dispositivo, hasta %2$d segundos.</string>
<string name="boot_movie_import">Importar</string>
@@ -4116,4 +4118,7 @@
<string name="hud_readings_shown">Mostrados</string>
<string name="hud_readings_count">%1$d de %2$d</string>
<string name="exit_hint_back">Presiona atrás una vez más para salir</string>
<string name="display_integer_scaling">Escalado de píxeles enteros</string>
<string name="display_integer_scaling_hint">Usa el mayor factor de escala entero que quepa. Si la imagen de origen es demasiado grande, ajusta la imagen completa para evitar recortes. La resolución se configura por separado.</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">Въведете, за да наредите следващото съобщение</string>
<string name="agent_queue">В опашката</string>
<string name="agent_queued">Следващо: %1$s</string>
<string name="agent_tools_missing">Инструментите на агента не са инсталирани: %1$s</string>
<string name="agent_unqueue">Не изпращай</string>
<string name="agent_attach">Прикачи</string>
<string name="agent_remove_attachment">Премахни</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Звук</string>
<string name="boot_movie_skip">Пропусни стартовото видео</string>
<string name="boot_movie_skip_hint">Използвай 0,1-секунден черен клип като стартовото видео на Steam. Влиза в сила при следващата сесия.</string>
<string name="boot_movie_shuffle">Разбъркване</string>
<string name="boot_movie_custom">Собствено видео</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV или WebM. Други формати и файлове над %1$d MB се конвертират на устройството до WebM 720p, до %2$d секунди.</string>
<string name="boot_movie_import">Импортиране</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Показани</string>
<string name="hud_readings_count">%1$d от %2$d</string>
<string name="exit_hint_back">Натиснете отново „Назад“, за да излезете</string>
<string name="display_integer_scaling">Целочислено мащабиране</string>
<string name="display_integer_scaling_hint">Използва най-големия цял коефициент на мащабиране, който се побира. Ако източникът е твърде голям, побира цялото изображение, за да избегне изрязване. Разделителната способност се настройва отделно.</string>
</resources>
+5
View File
@@ -1189,6 +1189,7 @@
<string name="agent_hint_working">Psaním zařadíte další zprávu do fronty</string>
<string name="agent_queue">Zařadit do fronty</string>
<string name="agent_queued">Další: %1$s</string>
<string name="agent_tools_missing">Nástroje agenta nejsou nainstalované: %1$s</string>
<string name="agent_unqueue">Neposílat</string>
<string name="agent_attach">Přiložit</string>
<string name="agent_remove_attachment">Odebrat</string>
@@ -3485,6 +3486,7 @@
<string name="boot_movie_sound">Zvuk</string>
<string name="boot_movie_skip">Přeskočit úvodní video</string>
<string name="boot_movie_skip_hint">Použije se 0,1sekundový černý klip jako úvodní video při spuštění aplikace Steam. Projeví se v příští relaci.</string>
<string name="boot_movie_shuffle">Náhodné pořadí</string>
<string name="boot_movie_custom">Vlastní video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV nebo WebM. Jiné formáty a soubory nad %1$d MB se v zařízení převedou na WebM 720p, nejvýše %2$d sekund.</string>
<string name="boot_movie_import">Importovat</string>
@@ -4185,4 +4187,7 @@
<string name="hud_readings_shown">Zobrazeno</string>
<string name="hud_readings_count">%1$d z %2$d</string>
<string name="exit_hint_back">Stiskněte znovu zpět pro ukončení</string>
<string name="display_integer_scaling">Celočíselné škálování</string>
<string name="display_integer_scaling_hint">Použije největší celočíselný násobek měřítka, který se vejde. Pokud je zdroj příliš velký, přizpůsobí celý obraz, aby nedošlo k oříznutí. Rozlišení se nastavuje samostatně.</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">Skriv for at sætte den næste besked i kø</string>
<string name="agent_queue">Sæt i kø</string>
<string name="agent_queued">Næste: %1$s</string>
<string name="agent_tools_missing">Agentens værktøjer er ikke installeret: %1$s</string>
<string name="agent_unqueue">Send ikke</string>
<string name="agent_attach">Vedhæft</string>
<string name="agent_remove_attachment">Fjern</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Lyd</string>
<string name="boot_movie_skip">Spring opstartsfilmen over</string>
<string name="boot_movie_skip_hint">Brug et sort klip på 0,1 sekund som opstartsfilm i Steam. Gælder fra næste session.</string>
<string name="boot_movie_shuffle">Bland</string>
<string name="boot_movie_custom">Din egen video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV eller WebM. Andre formater og filer over %1$d MB konverteres til 720p-WebM på enheden, op til %2$d sekunder.</string>
<string name="boot_movie_import">Importér</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Vist</string>
<string name="hud_readings_count">%1$d af %2$d</string>
<string name="exit_hint_back">Tryk tilbage igen for at afslutte</string>
<string name="display_integer_scaling">Heltalsskalering</string>
<string name="display_integer_scaling_hint">Bruger den største hele skaleringsfaktor, der kan være der. Hvis kilden er for stor, tilpasses hele billedet for at undgå beskæring. Opløsningen indstilles separat.</string>
</resources>
+5
View File
@@ -1175,6 +1175,7 @@
<string name="agent_hint_working">Tippen, um die nächste Nachricht einzureihen</string>
<string name="agent_queue">Einreihen</string>
<string name="agent_queued">Als Nächstes: %1$s</string>
<string name="agent_tools_missing">Agent-Werkzeuge nicht installiert: %1$s</string>
<string name="agent_unqueue">Nicht senden</string>
<string name="agent_attach">Anhängen</string>
<string name="agent_remove_attachment">Entfernen</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Ton</string>
<string name="boot_movie_skip">Startvideo überspringen</string>
<string name="boot_movie_skip_hint">Ein schwarzes Video von 0,1 Sekunden als Steam-Startvideo verwenden. Gilt ab der nächsten Sitzung.</string>
<string name="boot_movie_shuffle">Zufallswiedergabe</string>
<string name="boot_movie_custom">Eigenes Video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV oder WebM. Andere Formate und Dateien über %1$d MB werden auf dem Gerät in 720p-WebM umgewandelt, bis %2$d Sekunden.</string>
<string name="boot_movie_import">Importieren</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Angezeigt</string>
<string name="hud_readings_count">%1$d von %2$d</string>
<string name="exit_hint_back">Noch einmal zurück drücken zum Beenden</string>
<string name="display_integer_scaling">Ganzzahlige Skalierung</string>
<string name="display_integer_scaling_hint">Verwendet den größten ganzzahligen Skalierungsfaktor, der passt. Ist die Quelle zu groß, wird das gesamte Bild eingepasst, um Beschneidung zu vermeiden. Die Auflösung wird separat eingestellt.</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">Γράψτε για να προσθέσετε το επόμενο μήνυμα στην ουρά</string>
<string name="agent_queue">Στην ουρά</string>
<string name="agent_queued">Επόμενο: %1$s</string>
<string name="agent_tools_missing">Τα εργαλεία του πράκτορα δεν εγκαταστάθηκαν: %1$s</string>
<string name="agent_unqueue">Να μην σταλεί</string>
<string name="agent_attach">Επισύναψη</string>
<string name="agent_remove_attachment">Αφαίρεση</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Ήχος</string>
<string name="boot_movie_skip">Παράλειψη ταινίας εκκίνησης</string>
<string name="boot_movie_skip_hint">Χρησιμοποιεί ένα μαύρο κλιπ 0,1 δευτερολέπτου ως ταινία εκκίνησης του Steam. Εφαρμόζεται στην επόμενη συνεδρία.</string>
<string name="boot_movie_shuffle">Τυχαία σειρά</string>
<string name="boot_movie_custom">Δικό σας βίντεο</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV ή WebM. Άλλες μορφές και αρχεία πάνω από %1$d MB μετατρέπονται στη συσκευή σε WebM 720p, έως %2$d δευτερόλεπτα.</string>
<string name="boot_movie_import">Εισαγωγή</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Εμφανίζονται</string>
<string name="hud_readings_count">%1$d από %2$d</string>
<string name="exit_hint_back">Πατήστε ξανά πίσω για έξοδο</string>
<string name="display_integer_scaling">Ακέραια κλιμάκωση</string>
<string name="display_integer_scaling_hint">Χρησιμοποιεί τον μεγαλύτερο ακέραιο συντελεστή κλιμάκωσης που χωράει. Αν η πηγή είναι πολύ μεγάλη, προσαρμόζει ολόκληρη την εικόνα ώστε να αποφευχθεί η περικοπή. Η ανάλυση ρυθμίζεται ξεχωριστά.</string>
</resources>
+5
View File
@@ -1186,6 +1186,7 @@
<string name="agent_hint_working">Escribe para encolar el siguiente mensaje</string>
<string name="agent_queue">Encolar</string>
<string name="agent_queued">Siguiente: %1$s</string>
<string name="agent_tools_missing">Herramientas del agente sin instalar: %1$s</string>
<string name="agent_unqueue">No enviar</string>
<string name="agent_attach">Adjuntar</string>
<string name="agent_remove_attachment">Quitar</string>
@@ -3446,6 +3447,7 @@
<string name="boot_movie_sound">Sonido</string>
<string name="boot_movie_skip">Omitir vídeo de inicio</string>
<string name="boot_movie_skip_hint">Usa un clip negro de 0,1 segundos como vídeo de inicio de Steam. Se aplicará en la próxima sesión.</string>
<string name="boot_movie_shuffle">Aleatorio</string>
<string name="boot_movie_custom">Tu propio vídeo</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV o WebM. Otros formatos y archivos de más de %1$d MB se convierten a WebM 720p en el dispositivo, hasta %2$d segundos.</string>
<string name="boot_movie_import">Importar</string>
@@ -4145,4 +4147,7 @@
<string name="hud_readings_shown">Mostrados</string>
<string name="hud_readings_count">%1$d de %2$d</string>
<string name="exit_hint_back">Pulsa atrás una vez más para salir</string>
<string name="display_integer_scaling">Escalado de píxeles enteros</string>
<string name="display_integer_scaling_hint">Usa el mayor factor de escala entero que quepa. Si la imagen de origen es demasiado grande, ajusta la imagen completa para evitar recortes. La resolución se configura por separado.</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">Kirjoita lisätäksesi seuraavan viestin jonoon</string>
<string name="agent_queue">Jono</string>
<string name="agent_queued">Seuraava: %1$s</string>
<string name="agent_tools_missing">Agentin työkaluja ei ole asennettu: %1$s</string>
<string name="agent_unqueue">Älä lähetä</string>
<string name="agent_attach">Liitä</string>
<string name="agent_remove_attachment">Poista</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Ääni</string>
<string name="boot_movie_skip">Ohita käynnistysvideo</string>
<string name="boot_movie_skip_hint">Käytä 0,1 sekunnin mustaa leikettä Steam-käynnistysvideona. Otetaan käyttöön seuraavassa istunnossa.</string>
<string name="boot_movie_shuffle">Satunnainen</string>
<string name="boot_movie_custom">Oma video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV tai WebM. Muut muodot ja yli %1$d Mt:n tiedostot muunnetaan laitteella 720p-WebM-muotoon, enintään %2$d sekuntia.</string>
<string name="boot_movie_import">Tuo</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Näkyvissä</string>
<string name="hud_readings_count">%1$d / %2$d</string>
<string name="exit_hint_back">Paina takaisin vielä kerran poistuaksesi</string>
<string name="display_integer_scaling">Kokonaislukuskaalaus</string>
<string name="display_integer_scaling_hint">Käyttää suurinta mahtuvaa kokonaislukukerrointa. Jos lähdekuva on liian suuri, koko kuva sovitetaan rajauksen välttämiseksi. Tarkkuus määritetään erikseen.</string>
</resources>
+5
View File
@@ -1186,6 +1186,7 @@
<string name="agent_hint_working">Tapez pour mettre le prochain message en attente</string>
<string name="agent_queue">Mettre en attente</string>
<string name="agent_queued">Suivant : %1$s</string>
<string name="agent_tools_missing">Outils de l’agent non installés : %1$s</string>
<string name="agent_unqueue">Ne pas envoyer</string>
<string name="agent_attach">Joindre</string>
<string name="agent_remove_attachment">Supprimer</string>
@@ -3445,6 +3446,7 @@
<string name="boot_movie_sound">Son</string>
<string name="boot_movie_skip">Ignorer la vidéo de démarrage</string>
<string name="boot_movie_skip_hint">Utilise un clip noir de 0,1 seconde comme vidéo de démarrage de Steam. S’applique à la prochaine session.</string>
<string name="boot_movie_shuffle">Aléatoire</string>
<string name="boot_movie_custom">Votre propre vidéo</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV ou WebM. Les autres formats et les fichiers de plus de %1$d Mo sont convertis en WebM 720p sur l\'appareil, jusqu\'à %2$d secondes.</string>
<string name="boot_movie_import">Importer</string>
@@ -4144,4 +4146,7 @@
<string name="hud_readings_shown">Affichés</string>
<string name="hud_readings_count">%1$d sur %2$d</string>
<string name="exit_hint_back">Appuyez à nouveau sur retour pour quitter</string>
<string name="display_integer_scaling">Mise à l’échelle entière</string>
<string name="display_integer_scaling_hint">Utilise le plus grand facteur d’échelle entier possible. Si la source est trop grande, l’image entière est ajustée pour éviter le recadrage. La résolution se règle séparément.</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">अगला संदेश कतार में जोड़ने के लिए टाइप करें</string>
<string name="agent_queue">कतार में जोड़ें</string>
<string name="agent_queued">अगला: %1$s</string>
<string name="agent_tools_missing">एजेंट टूल इंस्टॉल नहीं हुए: %1$s</string>
<string name="agent_unqueue">न भेजें</string>
<string name="agent_attach">संलग्न करें</string>
<string name="agent_remove_attachment">हटाएँ</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">आवाज़</string>
<string name="boot_movie_skip">बूट मूवी छोड़ें</string>
<string name="boot_movie_skip_hint">Steam की स्टार्टअप मूवी के रूप में 0.1 सेकंड की काली क्लिप इस्तेमाल करें। अगले सत्र से लागू होगा।</string>
<string name="boot_movie_shuffle">शफ़ल</string>
<string name="boot_movie_custom">अपना वीडियो</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV या WebM. दूसरे फ़ॉर्मैट और %1$d MB से बड़ी फ़ाइलें डिवाइस पर 720p WebM में बदली जाती हैं, %2$d सेकंड तक।</string>
<string name="boot_movie_import">इंपोर्ट करें</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">दिखाए गए</string>
<string name="hud_readings_count">%2$d में से %1$d</string>
<string name="exit_hint_back">बाहर निकलने के लिए फिर से बैक दबाएँ</string>
<string name="display_integer_scaling">पूर्णांक स्केलिंग</string>
<string name="display_integer_scaling_hint">फिट होने वाले सबसे बड़े पूर्णांक स्केल का उपयोग करता है। स्रोत बहुत बड़ा होने पर काटने से बचाने के लिए पूरी छवि को फिट करता है। रिज़ॉल्यूशन अलग से सेट किया जाता है।</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">Gépelj a következő üzenet sorba állításához</string>
<string name="agent_queue">Sorba állítás</string>
<string name="agent_queued">Következő: %1$s</string>
<string name="agent_tools_missing">Az ügynök eszközei nincsenek telepítve: %1$s</string>
<string name="agent_unqueue">Ne küldd el</string>
<string name="agent_attach">Csatolás</string>
<string name="agent_remove_attachment">Eltávolítás</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Hang</string>
<string name="boot_movie_skip">Indítási videó kihagyása</string>
<string name="boot_movie_skip_hint">Egy 0,1 másodperces fekete klipet használ a Steam indítási videójaként. A következő munkamenetben lép érvénybe.</string>
<string name="boot_movie_shuffle">Véletlen sorrend</string>
<string name="boot_movie_custom">Saját videó</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV vagy WebM. Más formátumokat és a %1$d MB-nál nagyobb fájlokat az eszköz 720p WebM-re alakítja, legfeljebb %2$d másodpercig.</string>
<string name="boot_movie_import">Importálás</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Megjelenítve</string>
<string name="hud_readings_count">%1$d / %2$d</string>
<string name="exit_hint_back">Nyomd meg még egyszer a visszát a kilépéshez</string>
<string name="display_integer_scaling">Egész számú méretezés</string>
<string name="display_integer_scaling_hint">A legnagyobb elférő egész számú méretezési tényezőt használja. Ha a forrás túl nagy, a teljes képet hozzáigazítja a levágás elkerüléséhez. A felbontás külön állítható.</string>
</resources>
+5
View File
@@ -1180,6 +1180,7 @@
<string name="agent_hint_working">Ketik untuk mengantrekan pesan berikutnya</string>
<string name="agent_queue">Antrekan</string>
<string name="agent_queued">Berikutnya: %1$s</string>
<string name="agent_tools_missing">Alat agen tidak terpasang: %1$s</string>
<string name="agent_unqueue">Jangan kirim</string>
<string name="agent_attach">Lampirkan</string>
<string name="agent_remove_attachment">Hapus</string>
@@ -3378,6 +3379,7 @@
<string name="boot_movie_sound">Suara</string>
<string name="boot_movie_skip">Lewati video pembukaan</string>
<string name="boot_movie_skip_hint">Gunakan klip hitam berdurasi 0,1 detik sebagai video pembukaan Steam. Berlaku pada sesi berikutnya.</string>
<string name="boot_movie_shuffle">Acak</string>
<string name="boot_movie_custom">Video sendiri</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV, atau WebM. Format lain dan file di atas %1$d MB dikonversi ke WebM 720p di perangkat, hingga %2$d detik.</string>
<string name="boot_movie_import">Impor</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">Ditampilkan</string>
<string name="hud_readings_count">%1$d dari %2$d</string>
<string name="exit_hint_back">Tekan kembali sekali lagi untuk keluar</string>
<string name="display_integer_scaling">Penskalaan bilangan bulat</string>
<string name="display_integer_scaling_hint">Menggunakan faktor skala bilangan bulat terbesar yang muat. Jika sumber terlalu besar, seluruh gambar disesuaikan agar tidak terpotong. Resolusi diatur secara terpisah.</string>
</resources>
+5
View File
@@ -1178,6 +1178,7 @@
<string name="agent_hint_working">Digita per mettere in coda il messaggio successivo</string>
<string name="agent_queue">Metti in coda</string>
<string name="agent_queued">Prossimo: %1$s</string>
<string name="agent_tools_missing">Strumenti dell’agente non installati: %1$s</string>
<string name="agent_unqueue">Non inviare</string>
<string name="agent_attach">Allega</string>
<string name="agent_remove_attachment">Rimuovi</string>
@@ -3445,6 +3446,7 @@
<string name="boot_movie_sound">Audio</string>
<string name="boot_movie_skip">Salta il video di avvio</string>
<string name="boot_movie_skip_hint">Usa una clip nera di 0,1 secondi come video di avvio di Steam. Dalla sessione successiva.</string>
<string name="boot_movie_shuffle">Casuale</string>
<string name="boot_movie_custom">Il tuo video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV o WebM. Altri formati e file oltre %1$d MB vengono convertiti in WebM 720p sul dispositivo, fino a %2$d secondi.</string>
<string name="boot_movie_import">Importa</string>
@@ -4144,4 +4146,7 @@
<string name="hud_readings_shown">Mostrati</string>
<string name="hud_readings_count">%1$d di %2$d</string>
<string name="exit_hint_back">Premi di nuovo indietro per uscire</string>
<string name="display_integer_scaling">Ridimensionamento intero</string>
<string name="display_integer_scaling_hint">Usa il più grande fattore di scala intero che entra nello schermo. Se la sorgente è troppo grande, adatta l’intera immagine per evitare ritagli. La risoluzione si configura separatamente.</string>
</resources>
+5
View File
@@ -1180,6 +1180,7 @@
<string name="agent_hint_working">入力すると次のメッセージをキューに追加できます</string>
<string name="agent_queue">キューに追加</string>
<string name="agent_queued">次: %1$s</string>
<string name="agent_tools_missing">エージェントのツールが未インストール: %1$s</string>
<string name="agent_unqueue">送信しない</string>
<string name="agent_attach">添付</string>
<string name="agent_remove_attachment">削除</string>
@@ -3378,6 +3379,7 @@
<string name="boot_movie_sound">サウンド</string>
<string name="boot_movie_skip">起動ムービーをスキップ</string>
<string name="boot_movie_skip_hint">0.1 秒の黒いクリップを Steam の起動ムービーとして使用します。次回セッションから適用されます。</string>
<string name="boot_movie_shuffle">シャッフル</string>
<string name="boot_movie_custom">自分のムービー</string>
<string name="boot_movie_custom_hint">MP4、MOV、MKV、WebM。その他の形式や %1$d MB を超えるファイルは、端末上で 720p の WebM に変換されます(%2$d 秒まで)。</string>
<string name="boot_movie_import">インポート</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">表示中</string>
<string name="hud_readings_count">%2$d 中 %1$d</string>
<string name="exit_hint_back">もう一度戻るを押すと終了します</string>
<string name="display_integer_scaling">整数スケーリング</string>
<string name="display_integer_scaling_hint">収まる最大の整数倍率を使用します。元の画像が大きすぎる場合は、切り抜きを避けるため画像全体を収めます。解像度は別途設定します。</string>
</resources>
+5
View File
@@ -1180,6 +1180,7 @@
<string name="agent_hint_working">입력하면 다음 메시지가 대기열에 추가됩니다</string>
<string name="agent_queue">대기열에 추가</string>
<string name="agent_queued">다음: %1$s</string>
<string name="agent_tools_missing">에이전트 도구가 설치되지 않음: %1$s</string>
<string name="agent_unqueue">보내지 않기</string>
<string name="agent_attach">첨부</string>
<string name="agent_remove_attachment">제거</string>
@@ -3378,6 +3379,7 @@
<string name="boot_movie_sound">소리</string>
<string name="boot_movie_skip">시작 동영상 건너뛰기</string>
<string name="boot_movie_skip_hint">0.1초짜리 검은 화면 클립을 Steam 시작 동영상으로 사용합니다. 다음 세션부터 적용됩니다.</string>
<string name="boot_movie_shuffle">셔플</string>
<string name="boot_movie_custom">내 동영상</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV 또는 WebM. 다른 형식과 %1$d MB를 넘는 파일은 기기에서 720p WebM으로 변환됩니다(최대 %2$d초).</string>
<string name="boot_movie_import">가져오기</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">표시됨</string>
<string name="hud_readings_count">%2$d 중 %1$d</string>
<string name="exit_hint_back">한 번 더 뒤로를 누르면 종료됩니다</string>
<string name="display_integer_scaling">정수 배율 조정</string>
<string name="display_integer_scaling_hint">화면에 맞는 가장 큰 정수 배율을 사용합니다. 원본이 너무 크면 잘림을 방지하기 위해 전체 이미지를 맞춥니다. 해상도는 별도로 설정합니다.</string>
</resources>
+5
View File
@@ -1180,6 +1180,7 @@
<string name="agent_hint_working">Taip untuk membariskan mesej seterusnya</string>
<string name="agent_queue">Baris gilir</string>
<string name="agent_queued">Seterusnya: %1$s</string>
<string name="agent_tools_missing">Alat ejen tidak dipasang: %1$s</string>
<string name="agent_unqueue">Jangan hantar</string>
<string name="agent_attach">Lampirkan</string>
<string name="agent_remove_attachment">Alih keluar</string>
@@ -3378,6 +3379,7 @@
<string name="boot_movie_sound">Bunyi</string>
<string name="boot_movie_skip">Langkau filem permulaan</string>
<string name="boot_movie_skip_hint">Gunakan klip hitam 0.1 saat sebagai filem permulaan Steam. Berkuat kuasa pada sesi seterusnya.</string>
<string name="boot_movie_shuffle">Rawak</string>
<string name="boot_movie_custom">Video anda sendiri</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV atau WebM. Format lain dan fail melebihi %1$d MB ditukar kepada WebM 720p pada peranti, sehingga %2$d saat.</string>
<string name="boot_movie_import">Import</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">Dipaparkan</string>
<string name="hud_readings_count">%1$d daripada %2$d</string>
<string name="exit_hint_back">Tekan kembali sekali lagi untuk keluar</string>
<string name="display_integer_scaling">Penskalaan integer</string>
<string name="display_integer_scaling_hint">Menggunakan faktor skala integer terbesar yang muat. Jika sumber terlalu besar, keseluruhan imej disesuaikan untuk mengelakkan pemotongan. Resolusi ditetapkan secara berasingan.</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">Skriv for å legge neste melding i kø</string>
<string name="agent_queue">Legg i kø</string>
<string name="agent_queued">Neste: %1$s</string>
<string name="agent_tools_missing">Agentverktøy er ikke installert: %1$s</string>
<string name="agent_unqueue">Ikke send</string>
<string name="agent_attach">Legg ved</string>
<string name="agent_remove_attachment">Fjern</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Lyd</string>
<string name="boot_movie_skip">Hopp over oppstartsfilmen</string>
<string name="boot_movie_skip_hint">Bruk et svart klipp på 0,1 sekunder som oppstartsfilmen til Steam. Trer i kraft neste økt.</string>
<string name="boot_movie_shuffle">Tilfeldig rekkefølge</string>
<string name="boot_movie_custom">Din egen video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV eller WebM. Andre formater og filer over %1$d MB konverteres til 720p-WebM på enheten, opptil %2$d sekunder.</string>
<string name="boot_movie_import">Importer</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Vist</string>
<string name="hud_readings_count">%1$d av %2$d</string>
<string name="exit_hint_back">Trykk tilbake én gang til for å avslutte</string>
<string name="display_integer_scaling">Heltallsskalering</string>
<string name="display_integer_scaling_hint">Bruker den største hele skaleringsfaktoren som får plass. Hvis kilden er for stor, tilpasses hele bildet for å unngå beskjæring. Oppløsningen stilles inn separat.</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">Typ om het volgende bericht in de wachtrij te zetten</string>
<string name="agent_queue">In wachtrij</string>
<string name="agent_queued">Volgende: %1$s</string>
<string name="agent_tools_missing">Agenttools niet geïnstalleerd: %1$s</string>
<string name="agent_unqueue">Niet verzenden</string>
<string name="agent_attach">Bijvoegen</string>
<string name="agent_remove_attachment">Verwijderen</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Geluid</string>
<string name="boot_movie_skip">Opstartvideo overslaan</string>
<string name="boot_movie_skip_hint">Gebruik een zwart fragment van 0,1 seconde als opstartvideo van Steam. Wordt toegepast in de volgende sessie.</string>
<string name="boot_movie_shuffle">Willekeurig</string>
<string name="boot_movie_custom">Eigen video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV of WebM. Andere formaten en bestanden boven %1$d MB worden op het apparaat omgezet naar 720p-WebM, tot %2$d seconden.</string>
<string name="boot_movie_import">Importeren</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Getoond</string>
<string name="hud_readings_count">%1$d van %2$d</string>
<string name="exit_hint_back">Druk nog één keer op terug om af te sluiten</string>
<string name="display_integer_scaling">Gehele-getallenschaal</string>
<string name="display_integer_scaling_hint">Gebruikt de grootste gehele schaalfactor die past. Als de bron te groot is, wordt de volledige afbeelding passend gemaakt om bijsnijden te voorkomen. De resolutie wordt apart ingesteld.</string>
</resources>
+5
View File
@@ -1189,6 +1189,7 @@
<string name="agent_hint_working">Wpisz, aby zakolejkować następną wiadomość</string>
<string name="agent_queue">Zakolejkuj</string>
<string name="agent_queued">Następna: %1$s</string>
<string name="agent_tools_missing">Narzędzia agenta nie są zainstalowane: %1$s</string>
<string name="agent_unqueue">Nie wysyłaj</string>
<string name="agent_attach">Załącz</string>
<string name="agent_remove_attachment">Usuń</string>
@@ -3485,6 +3486,7 @@
<string name="boot_movie_sound">Dźwięk</string>
<string name="boot_movie_skip">Pomiń film startowy</string>
<string name="boot_movie_skip_hint">Użyj 0,1-sekundowego czarnego klipu jako filmu startowego Steam. Zacznie obowiązywać w następnej sesji.</string>
<string name="boot_movie_shuffle">Losowo</string>
<string name="boot_movie_custom">Własny film</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV lub WebM. Inne formaty i pliki powyżej %1$d MB są konwertowane na urządzeniu do WebM 720p, do %2$d sekund.</string>
<string name="boot_movie_import">Importuj</string>
@@ -4185,4 +4187,7 @@
<string name="hud_readings_shown">Pokazane</string>
<string name="hud_readings_count">%1$d z %2$d</string>
<string name="exit_hint_back">Naciśnij wstecz jeszcze raz, aby wyjść</string>
<string name="display_integer_scaling">Skalowanie całkowite</string>
<string name="display_integer_scaling_hint">Używa największego całkowitego współczynnika skalowania, który się mieści. Jeśli źródło jest zbyt duże, dopasowuje cały obraz, aby uniknąć przycinania. Rozdzielczość ustawia się osobno.</string>
</resources>
@@ -1178,6 +1178,7 @@
<string name="agent_hint_working">Escreva para pôr a mensagem seguinte na fila</string>
<string name="agent_queue">Pôr na fila</string>
<string name="agent_queued">Seguinte: %1$s</string>
<string name="agent_tools_missing">Ferramentas do agente não instaladas: %1$s</string>
<string name="agent_unqueue">Não enviar</string>
<string name="agent_attach">Anexar</string>
<string name="agent_remove_attachment">Remover</string>
@@ -3445,6 +3446,7 @@
<string name="boot_movie_sound">Som</string>
<string name="boot_movie_skip">Ignorar o vídeo de arranque</string>
<string name="boot_movie_skip_hint">Utilizar um clipe preto de 0,1 segundos como vídeo de arranque do Steam. Aplica-se na próxima sessão.</string>
<string name="boot_movie_shuffle">Aleatório</string>
<string name="boot_movie_custom">O seu próprio vídeo</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV ou WebM. Outros formatos e ficheiros acima de %1$d MB são convertidos para WebM 720p no dispositivo, até %2$d segundos.</string>
<string name="boot_movie_import">Importar</string>
@@ -4144,4 +4146,7 @@
<string name="hud_readings_shown">Mostrados</string>
<string name="hud_readings_count">%1$d de %2$d</string>
<string name="exit_hint_back">Prima novamente o botão Voltar para sair</string>
<string name="display_integer_scaling">Escala por números inteiros</string>
<string name="display_integer_scaling_hint">Utiliza o maior fator de escala inteiro que couber. Se a imagem de origem for demasiado grande, ajusta a imagem completa para evitar cortes. A resolução é configurada separadamente.</string>
</resources>
+5
View File
@@ -1185,6 +1185,7 @@
<string name="agent_hint_working">Digite para enfileirar a próxima mensagem</string>
<string name="agent_queue">Enfileirar</string>
<string name="agent_queued">Próxima: %1$s</string>
<string name="agent_tools_missing">Ferramentas do agente não instaladas: %1$s</string>
<string name="agent_unqueue">Não enviar</string>
<string name="agent_attach">Anexar</string>
<string name="agent_remove_attachment">Remover</string>
@@ -3453,6 +3454,7 @@
<string name="boot_movie_sound">Som</string>
<string name="boot_movie_skip">Pular vídeo de inicialização</string>
<string name="boot_movie_skip_hint">Use um clipe preto de 0,1 segundo como vídeo de inicialização do Steam. Aplica-se na próxima sessão.</string>
<string name="boot_movie_shuffle">Aleatório</string>
<string name="boot_movie_custom">Seu próprio vídeo</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV ou WebM. Outros formatos e arquivos acima de %1$d MB são convertidos para WebM 720p no aparelho, até %2$d segundos.</string>
<string name="boot_movie_import">Importar</string>
@@ -4152,4 +4154,7 @@
<string name="hud_readings_shown">Exibidos</string>
<string name="hud_readings_count">%1$d de %2$d</string>
<string name="exit_hint_back">Pressione o botão Voltar novamente para sair</string>
<string name="display_integer_scaling">Escala por números inteiros</string>
<string name="display_integer_scaling_hint">Usa o maior fator de escala inteiro que couber. Se a imagem de origem for grande demais, ajusta a imagem completa para evitar cortes. A resolução é configurada separadamente.</string>
</resources>
+5
View File
@@ -1186,6 +1186,7 @@
<string name="agent_hint_working">Scrie pentru a pune următorul mesaj în coadă</string>
<string name="agent_queue">Pune în coadă</string>
<string name="agent_queued">Următorul: %1$s</string>
<string name="agent_tools_missing">Instrumentele agentului nu sunt instalate: %1$s</string>
<string name="agent_unqueue">Nu trimite</string>
<string name="agent_attach">Atașează</string>
<string name="agent_remove_attachment">Elimină</string>
@@ -3446,6 +3447,7 @@
<string name="boot_movie_sound">Sunet</string>
<string name="boot_movie_skip">Omite filmul de pornire</string>
<string name="boot_movie_skip_hint">Folosește un clip negru de 0,1 secunde ca film de pornire pentru Steam. Se aplică la următoarea sesiune.</string>
<string name="boot_movie_shuffle">Aleatoriu</string>
<string name="boot_movie_custom">Videoclipul tău</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV sau WebM. Alte formate și fișierele de peste %1$d MB sunt convertite pe dispozitiv în WebM 720p, până la %2$d secunde.</string>
<string name="boot_movie_import">Importă</string>
@@ -4145,4 +4147,7 @@
<string name="hud_readings_shown">Afișate</string>
<string name="hud_readings_count">%1$d din %2$d</string>
<string name="exit_hint_back">Apasă din nou înapoi pentru a ieși</string>
<string name="display_integer_scaling">Scalare cu numere întregi</string>
<string name="display_integer_scaling_hint">Folosește cel mai mare factor întreg de scalare care încape. Dacă sursa este prea mare, adaptează întreaga imagine pentru a evita decuparea. Rezoluția se configurează separat.</string>
</resources>
+5
View File
@@ -1189,6 +1189,7 @@
<string name="agent_hint_working">Введите текст, чтобы поставить следующее сообщение в очередь</string>
<string name="agent_queue">В очередь</string>
<string name="agent_queued">Далее: %1$s</string>
<string name="agent_tools_missing">Инструменты агента не установлены: %1$s</string>
<string name="agent_unqueue">Не отправлять</string>
<string name="agent_attach">Прикрепить</string>
<string name="agent_remove_attachment">Удалить</string>
@@ -3485,6 +3486,7 @@
<string name="boot_movie_sound">Звук</string>
<string name="boot_movie_skip">Пропускать стартовое видео</string>
<string name="boot_movie_skip_hint">Использовать 0,1-секундный чёрный клип в качестве стартового видео Steam. Применится в следующем сеансе.</string>
<string name="boot_movie_shuffle">Случайный порядок</string>
<string name="boot_movie_custom">Своё видео</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV или WebM. Другие форматы и файлы больше %1$d МБ преобразуются на устройстве в WebM 720p, до %2$d секунд.</string>
<string name="boot_movie_import">Импорт</string>
@@ -4185,4 +4187,7 @@
<string name="hud_readings_shown">Показано</string>
<string name="hud_readings_count">%1$d из %2$d</string>
<string name="exit_hint_back">Нажмите «Назад» ещё раз, чтобы выйти</string>
<string name="display_integer_scaling">Целочисленное масштабирование</string>
<string name="display_integer_scaling_hint">Использует наибольший целочисленный коэффициент масштабирования, который помещается. Если исходное изображение слишком велико, оно уменьшается целиком, чтобы избежать обрезки. Разрешение настраивается отдельно.</string>
</resources>
+5
View File
@@ -1183,6 +1183,7 @@
<string name="agent_hint_working">Skriv för att köa nästa meddelande</string>
<string name="agent_queue">Köa</string>
<string name="agent_queued">Nästa: %1$s</string>
<string name="agent_tools_missing">Agentens verktyg är inte installerade: %1$s</string>
<string name="agent_unqueue">Skicka inte</string>
<string name="agent_attach">Bifoga</string>
<string name="agent_remove_attachment">Ta bort</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Ljud</string>
<string name="boot_movie_skip">Hoppa över uppstartsfilmen</string>
<string name="boot_movie_skip_hint">Använd ett svart klipp på 0,1 sekunder som uppstartsfilm för Steam. Tillämpas nästa session.</string>
<string name="boot_movie_shuffle">Blanda</string>
<string name="boot_movie_custom">Egen video</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV eller WebM. Andra format och filer över %1$d MB konverteras till 720p-WebM på enheten, upp till %2$d sekunder.</string>
<string name="boot_movie_import">Importera</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Visade</string>
<string name="hud_readings_count">%1$d av %2$d</string>
<string name="exit_hint_back">Tryck tillbaka igen för att avsluta</string>
<string name="display_integer_scaling">Heltalsskalning</string>
<string name="display_integer_scaling_hint">Använder den största hela skalningsfaktorn som får plats. Om källbilden är för stor anpassas hela bilden för att undvika beskärning. Upplösningen ställs in separat.</string>
</resources>
+5
View File
@@ -1180,6 +1180,7 @@
<string name="agent_hint_working">พิมพ์เพื่อเข้าคิวข้อความถัดไป</string>
<string name="agent_queue">เข้าคิว</string>
<string name="agent_queued">ถัดไป: %1$s</string>
<string name="agent_tools_missing">ยังไม่ได้ติดตั้งเครื่องมือของเอเจนต์: %1$s</string>
<string name="agent_unqueue">ไม่ต้องส่ง</string>
<string name="agent_attach">แนบ</string>
<string name="agent_remove_attachment">นำออก</string>
@@ -3378,6 +3379,7 @@
<string name="boot_movie_sound">เสียง</string>
<string name="boot_movie_skip">ข้ามวิดีโอเริ่มต้น</string>
<string name="boot_movie_skip_hint">ใช้คลิปสีดำความยาว 0.1 วินาทีเป็นวิดีโอเริ่มต้นของ Steam มีผลในเซสชันถัดไป</string>
<string name="boot_movie_shuffle">สุ่ม</string>
<string name="boot_movie_custom">วิดีโอของคุณเอง</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV หรือ WebM รูปแบบอื่นและไฟล์ที่ใหญ่กว่า %1$d MB จะถูกแปลงเป็น WebM 720p บนอุปกรณ์ ความยาวไม่เกิน %2$d วินาที</string>
<string name="boot_movie_import">นำเข้า</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">ที่แสดง</string>
<string name="hud_readings_count">%1$d จาก %2$d</string>
<string name="exit_hint_back">กดกลับอีกครั้งเพื่อออก</string>
<string name="display_integer_scaling">การปรับขนาดจำนวนเต็ม</string>
<string name="display_integer_scaling_hint">ใช้ตัวคูณการปรับขนาดจำนวนเต็มที่ใหญ่ที่สุดที่พอดี หากภาพต้นฉบับใหญ่เกินไป จะปรับภาพทั้งหมดให้พอดีเพื่อหลีกเลี่ยงการตัดภาพ โดยตั้งค่าความละเอียดแยกต่างหาก</string>
</resources>
+5
View File
@@ -1175,6 +1175,7 @@
<string name="agent_hint_working">Sonraki mesajı sıraya almak için yazın</string>
<string name="agent_queue">Sıraya ekle</string>
<string name="agent_queued">Sıradaki: %1$s</string>
<string name="agent_tools_missing">Ajan araçları yüklenmedi: %1$s</string>
<string name="agent_unqueue">Gönderme</string>
<string name="agent_attach">Ekle</string>
<string name="agent_remove_attachment">Kaldır</string>
@@ -3407,6 +3408,7 @@
<string name="boot_movie_sound">Ses</string>
<string name="boot_movie_skip">Açılış videosunu atla</string>
<string name="boot_movie_skip_hint">Steam\'in açılış videosu olarak 0,1 saniyelik siyah bir klip kullanılır. Sonraki oturumda geçerli olur.</string>
<string name="boot_movie_shuffle">Karıştır</string>
<string name="boot_movie_custom">Kendi videon</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV veya WebM. Diğer biçimler ve %1$d MB üzeri dosyalar cihazda 720p WebM\'e dönüştürülür, en fazla %2$d saniye.</string>
<string name="boot_movie_import">İçe aktar</string>
@@ -4105,4 +4107,7 @@
<string name="hud_readings_shown">Gösterilen</string>
<string name="hud_readings_count">%1$d / %2$d</string>
<string name="exit_hint_back">Çıkmak için bir kez daha geri basın</string>
<string name="display_integer_scaling">Tam sayı ölçeklendirme</string>
<string name="display_integer_scaling_hint">Sığan en büyük tam sayı ölçekleme katsayısını kullanır. Kaynak çok büyükse kırpmayı önlemek için görüntünün tamamını sığdırır. Çözünürlük ayrı ayarlanır.</string>
</resources>
+5
View File
@@ -1189,6 +1189,7 @@
<string name="agent_hint_working">Введіть текст, щоб поставити наступне повідомлення в чергу</string>
<string name="agent_queue">Поставити в чергу</string>
<string name="agent_queued">Далі: %1$s</string>
<string name="agent_tools_missing">Інструменти агента не встановлено: %1$s</string>
<string name="agent_unqueue">Не надсилати</string>
<string name="agent_attach">Прикріпити</string>
<string name="agent_remove_attachment">Видалити</string>
@@ -3485,6 +3486,7 @@
<string name="boot_movie_sound">Звук</string>
<string name="boot_movie_skip">Пропускати відео запуску</string>
<string name="boot_movie_skip_hint">Використовувати 0,1-секундний чорний кліп як вступне відео Steam. Застосовується з наступного сеансу.</string>
<string name="boot_movie_shuffle">Випадковий порядок</string>
<string name="boot_movie_custom">Власне відео</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV або WebM. Інші формати й файли понад %1$d МБ перетворюються на пристрої на WebM 720p, до %2$d секунд.</string>
<string name="boot_movie_import">Імпорт</string>
@@ -4185,4 +4187,7 @@
<string name="hud_readings_shown">Показано</string>
<string name="hud_readings_count">%1$d з %2$d</string>
<string name="exit_hint_back">Натисніть «Назад» ще раз, щоб вийти</string>
<string name="display_integer_scaling">Цілочисельне масштабування</string>
<string name="display_integer_scaling_hint">Використовує найбільший цілий коефіцієнт масштабування, який поміщається. Якщо вихідне зображення завелике, воно вміщується повністю без обрізання. Роздільна здатність налаштовується окремо.</string>
</resources>
+5
View File
@@ -1180,6 +1180,7 @@
<string name="agent_hint_working">Nhập để xếp tin nhắn tiếp theo vào hàng đợi</string>
<string name="agent_queue">Xếp hàng</string>
<string name="agent_queued">Tiếp theo: %1$s</string>
<string name="agent_tools_missing">Chưa cài công cụ của tác tử: %1$s</string>
<string name="agent_unqueue">Không gửi</string>
<string name="agent_attach">Đính kèm</string>
<string name="agent_remove_attachment">Xóa</string>
@@ -3378,6 +3379,7 @@
<string name="boot_movie_sound">Âm thanh</string>
<string name="boot_movie_skip">Bỏ qua phim khởi động</string>
<string name="boot_movie_skip_hint">Dùng đoạn clip đen 0,1 giây làm phim khởi động của Steam. Áp dụng trong phiên chạy tiếp theo.</string>
<string name="boot_movie_shuffle">Ngẫu nhiên</string>
<string name="boot_movie_custom">Video của bạn</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV hoặc WebM. Định dạng khác và tệp trên %1$d MB được chuyển sang WebM 720p ngay trên thiết bị, tối đa %2$d giây.</string>
<string name="boot_movie_import">Nhập</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">Đang hiển thị</string>
<string name="hud_readings_count">%1$d trên %2$d</string>
<string name="exit_hint_back">Nhấn lại để thoát</string>
<string name="display_integer_scaling">Tỷ lệ nguyên</string>
<string name="display_integer_scaling_hint">Sử dụng hệ số tỷ lệ nguyên lớn nhất có thể vừa màn hình. Nếu nguồn quá lớn, toàn bộ hình ảnh sẽ được thu vừa để tránh bị cắt. Độ phân giải được thiết lập riêng.</string>
</resources>
@@ -1263,6 +1263,7 @@
<string name="agent_hint_working">输入以排队下一条消息</string>
<string name="agent_queue">排队</string>
<string name="agent_queued">下一条:%1$s</string>
<string name="agent_tools_missing">智能体工具未安装:%1$s</string>
<string name="agent_unqueue">不发送</string>
<string name="agent_attach">添加附件</string>
<string name="agent_remove_attachment">移除</string>
@@ -3378,6 +3379,7 @@
<string name="boot_movie_sound">声音</string>
<string name="boot_movie_skip">跳过启动影片</string>
<string name="boot_movie_skip_hint">用一段 0.1 秒的黑色片段作为 Steam 的启动影片。下次会话生效。</string>
<string name="boot_movie_shuffle">随机播放</string>
<string name="boot_movie_custom">自定义视频</string>
<string name="boot_movie_custom_hint">MP4、MOV、MKV 或 WebM。其他格式及超过 %1$d MB 的文件会在设备上转换为 720p WebM,最长 %2$d 秒。</string>
<string name="boot_movie_import">导入</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">已显示</string>
<string name="hud_readings_count">%1$d / %2$d</string>
<string name="exit_hint_back">再按一次返回键退出</string>
<string name="display_integer_scaling">整数缩放</string>
<string name="display_integer_scaling_hint">使用能够容纳的最大整数缩放倍数。如果源图像过大,则缩放整张图像以避免裁切。分辨率单独设置。</string>
</resources>
@@ -1179,6 +1179,7 @@
<string name="agent_hint_working">輸入即可排入下一則訊息</string>
<string name="agent_queue">排入</string>
<string name="agent_queued">下一則:%1$s</string>
<string name="agent_tools_missing">智能體工具未安裝:%1$s</string>
<string name="agent_unqueue">不要傳送</string>
<string name="agent_attach">附加</string>
<string name="agent_remove_attachment">移除</string>
@@ -3375,6 +3376,7 @@
<string name="boot_movie_sound">聲音</string>
<string name="boot_movie_skip">跳過啟動影片</string>
<string name="boot_movie_skip_hint">以 0.1 秒全黑片段作為 Steam 的啟動影片。下次工作階段生效。</string>
<string name="boot_movie_shuffle">隨機播放</string>
<string name="boot_movie_custom">自訂影片</string>
<string name="boot_movie_custom_hint">MP4、MOV、MKV 或 WebM。其他格式及超過 %1$d MB 的檔案會在裝置上轉換為 720p WebM,最長 %2$d 秒。</string>
<string name="boot_movie_import">匯入</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">已顯示</string>
<string name="hud_readings_count">%1$d / %2$d</string>
<string name="exit_hint_back">再按一次返回鍵退出</string>
<string name="display_integer_scaling">整數縮放</string>
<string name="display_integer_scaling_hint">使用可容納的最大整數縮放倍數。如果來源圖像太大,便縮放整張圖像以避免裁切。解像度會另外設定。</string>
</resources>
@@ -1179,6 +1179,7 @@
<string name="agent_hint_working">輸入以排入下一則訊息</string>
<string name="agent_queue">排入佇列</string>
<string name="agent_queued">下一則:%1$s</string>
<string name="agent_tools_missing">智慧代理工具未安裝:%1$s</string>
<string name="agent_unqueue">不要傳送</string>
<string name="agent_attach">附加</string>
<string name="agent_remove_attachment">移除</string>
@@ -3375,6 +3376,7 @@
<string name="boot_movie_sound">聲音</string>
<string name="boot_movie_skip">跳過啟動影片</string>
<string name="boot_movie_skip_hint">使用 0.1 秒的黑色影片片段作為 Steam 的啟動影片。將於下次工作階段生效。</string>
<string name="boot_movie_shuffle">隨機播放</string>
<string name="boot_movie_custom">自訂影片</string>
<string name="boot_movie_custom_hint">MP4、MOV、MKV 或 WebM。其他格式及超過 %1$d MB 的檔案會在裝置上轉換為 720p WebM,最長 %2$d 秒。</string>
<string name="boot_movie_import">匯入</string>
@@ -4075,4 +4077,7 @@
<string name="hud_readings_shown">已顯示</string>
<string name="hud_readings_count">%1$d / %2$d</string>
<string name="exit_hint_back">再按一次返回鍵退出</string>
<string name="display_integer_scaling">整數縮放</string>
<string name="display_integer_scaling_hint">使用可容納的最大整數縮放倍數。如果來源影像太大,會縮放整張影像以避免裁切。解析度會另外設定。</string>
</resources>
+15
View File
@@ -1269,6 +1269,7 @@
<string name="agent_no_reply">Ended without a reply</string>
<string name="agent_retry">Retry</string>
<string name="agent_setting_up">Setting up the agent</string>
<string name="agent_waiting_background">Waiting for background work</string>
<string name="agent_rebuild_lab">Rebuild my Lab build %1$s for the installed version of DroidDeck and restart on it.</string>
<string name="agent_tokens">%1$s in · %2$s out</string>
<string name="agent_thinking">Thinking</string>
@@ -1283,6 +1284,7 @@
<string name="agent_hint_working">Type to queue the next message</string>
<string name="agent_queue">Queue</string>
<string name="agent_queued">Next: %1$s</string>
<string name="agent_tools_missing">Agent tools not installed: %1$s</string>
<string name="agent_unqueue">Don\'t send</string>
<string name="agent_attach">Attach</string>
<string name="agent_remove_attachment">Remove</string>
@@ -2658,6 +2660,10 @@
<string name="display_preserve">Keep proportions</string>
<string name="display_stretch">Stretch to display</string>
<string name="display_image_scaling">Image scaling</string>
<string name="display_integer_scaling">Integer scaling</string>
<string name="display_integer_scaling_hint">Uses the largest whole-number scale that fits. If the source is too large, fits the full image to avoid cropping. Resolution is configured separately.</string>
<string name="display_scaling_fit">Fit</string>
<string name="display_scaling_auto">Auto</string>
<string name="display_filter">Scaling filter</string>
<string name="display_filter_hint">Shared by Steam and Desktop.</string>
<string name="display_filter_live">Applies live. Shared by Steam and Desktop.</string>
@@ -2976,6 +2982,14 @@
<string name="edit_launch_options_steam_hint">Shared with Steam\'s Properties: a change in either one shows in both.</string>
<string name="edit_launch_options_not_saved">Could not save the launch options to Steam. Try again.</string>
<string name="edit_launch_options_desktop">Steam may be open in the desktop session. Change the launch options in its Properties, or close the session first.</string>
<string name="edit_steam_input_override">Steam Input</string>
<string name="edit_steam_input_default">Use Steam\'s default</string>
<string name="edit_steam_input_enable">Enable Steam Input</string>
<string name="edit_steam_input_disable">Disable Steam Input</string>
<string name="edit_steam_input_hint">Same as the game\'s Controller setting in Steam Properties.</string>
<string name="edit_steam_input_running">Close the Steam or desktop session before changing this setting.</string>
<string name="edit_steam_input_not_saved">Could not save the Steam Input setting. Close Steam and try again.</string>
<string name="edit_steam_input_unavailable">Could not read this game\'s Steam Input setting.</string>
<string name="edit_artwork">Artwork</string>
<string name="edit_other_exe">Other exe…</string>
<string name="edit_remove">Remove</string>
@@ -3621,6 +3635,7 @@
<string name="boot_movie_sound">Sound</string>
<string name="boot_movie_skip">Skip boot movie</string>
<string name="boot_movie_skip_hint">Use a 0.1-second black clip as Steam’s startup movie. Applies next session.</string>
<string name="boot_movie_shuffle">Shuffle</string>
<string name="boot_movie_custom">Your own movie</string>
<string name="boot_movie_custom_hint">MP4, MOV, MKV or WebM. Other formats and files over %1$d MB are converted to 720p WebM on the device, up to %2$d seconds.</string>
<string name="boot_movie_import">Import</string>
@@ -0,0 +1,117 @@
package com.droiddeck.launcher.agent
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import java.io.File
import java.nio.file.Files
class AgentHelpersTest {
@get:Rule val tmp = TemporaryFolder()
@Test fun aSymlinkLeftByAHandMadeSetupIsReplacedNotFollowed() {
val bin = tmp.newFolder("bin")
val old = tmp.newFile("old-droiddeckctl").apply { writeText("old") }
val target = File(bin, "droiddeckctl")
Files.createSymbolicLink(target.toPath(), old.toPath())
AgentSetup.replaceFile("new".byteInputStream(), target)
assertFalse(Files.isSymbolicLink(target.toPath()))
assertEquals("new", target.readText())
assertEquals("old", old.readText())
assertTrue(target.canExecute())
}
@Test fun aDanglingSymlinkIsReplaced() {
val bin = tmp.newFolder("bin")
val target = File(bin, "droiddeckctl")
Files.createSymbolicLink(target.toPath(), File("/no/such/userland/path").toPath())
AgentSetup.replaceFile("new".byteInputStream(), target)
assertEquals("new", target.readText())
assertEquals(listOf("droiddeckctl"), bin.list()!!.toList())
}
@Test fun skillsGoToEveryHarnessAndLeaveTheUsersOwnAlone() {
val root = tmp.newFolder("rootfs")
val mine = File(root, "root/.claude/skills/my-skill/SKILL.md").apply { parentFile!!.mkdirs(); writeText("mine") }
val stale = File(root, "root/.codex/skills/diagnose-game/SKILL.md").apply { parentFile!!.mkdirs(); writeText("old") }
File(stale.parentFile, AgentSetup.SKILL_MARK).writeText("")
val failed = AgentSetup.installSkills(root, mapOf("diagnose-game" to listOf("SKILL.md"))) { "new $it".byteInputStream() }
assertEquals(emptyList<String>(), failed)
for (harness in AgentHarness.all) {
assertEquals("new diagnose-game/SKILL.md", File(root, "${harness.skills}/diagnose-game/SKILL.md").readText())
}
assertEquals("mine", mine.readText())
assertFalse(File(root, "${ClaudeCode.skills}/diagnose-game/SKILL.md").canExecute())
}
@Test fun aSkillTheUserMadeWithTheSameNameIsKept() {
val root = tmp.newFolder("rootfs3")
val own = File(root, "${ClaudeCode.skills}/diagnose-game/SKILL.md").apply { parentFile!!.mkdirs(); writeText("my version") }
AgentSetup.installSkills(root, mapOf("diagnose-game" to listOf("SKILL.md"))) { "new".byteInputStream() }
assertEquals("my version", own.readText())
assertFalse(File(own.parentFile, AgentSetup.SKILL_MARK).exists())
assertEquals("new", File(root, "${Codex.skills}/diagnose-game/SKILL.md").readText())
}
@Test fun aSkillThatFailedPartWayIsRetriedNextTurn() {
val root = tmp.newFolder("rootfs5")
val skills = mapOf("diagnose-game" to listOf("SKILL.md"))
val failed = AgentSetup.installSkills(root, skills) { throw java.io.IOException("asset unreadable") }
assertEquals(AgentHarness.all.size, failed.size)
assertEquals(emptyList<String>(), AgentSetup.installSkills(root, skills) { "new".byteInputStream() })
for (harness in AgentHarness.all) assertEquals("new", File(root, "${harness.skills}/diagnose-game/SKILL.md").readText())
}
@Test fun instructionsBehindAGuestSymlinkAreWrittenWhereItPoints() {
val root = tmp.newFolder("rootfs4")
val dotfile = File(root, "root/dotfiles/CLAUDE.md").apply { parentFile!!.mkdirs(); writeText("my rule\n") }
val link = File(root, ClaudeCode.instructions).apply { parentFile!!.mkdirs() }
Files.createSymbolicLink(link.toPath(), File("/root/dotfiles/CLAUDE.md").toPath())
AgentSetup.installInstructions(root, "rules")
assertTrue(Files.isSymbolicLink(link.toPath()))
assertTrue(dotfile.readText().contains("rules"))
assertTrue(dotfile.readText().endsWith("\nmy rule\n"))
}
@Test fun theRulesGoFirstInAFileThatHasNoBlockYetAndKeepTheUsersOwn() {
val text = AgentSetup.withBlock("# Mine\nAlways answer in French.\n", "rules v1")
assertEquals("${AgentSetup.BLOCK_BEGIN}\nrules v1\n${AgentSetup.BLOCK_END}\n\n# Mine\nAlways answer in French.\n", text)
}
@Test fun onlyTheBlockIsReplacedOnTheNextTurn() {
val first = AgentSetup.withBlock("before\n", "rules v1") + "after\n"
val second = AgentSetup.withBlock(first, "rules v2")
assertEquals(first.replace("rules v1", "rules v2"), second)
assertEquals(second, AgentSetup.withBlock(second, "rules v2"))
}
@Test fun anEmptyOrMissingFileGetsJustTheBlock() {
assertEquals("${AgentSetup.BLOCK_BEGIN}\nrules\n${AgentSetup.BLOCK_END}\n", AgentSetup.withBlock(null, "rules\n"))
assertEquals(AgentSetup.withBlock(null, "rules"), AgentSetup.withBlock(" \n", "rules"))
}
@Test fun everyHarnessGetsTheRules() {
val root = tmp.newFolder("rootfs2")
val claude = File(root, ClaudeCode.instructions).apply { parentFile!!.mkdirs(); writeText("my rule\n") }
assertEquals(emptyList<String>(), AgentSetup.installInstructions(root, "rules"))
for (harness in AgentHarness.all) assertTrue(File(root, harness.instructions).readText().contains("rules"))
assertTrue(claude.readText().endsWith("\nmy rule\n"))
}
}
@@ -0,0 +1,51 @@
package com.droiddeck.launcher.agent
import android.content.ComponentName
import android.content.ContextWrapper
import android.content.Intent
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.Robolectric
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], manifest = Config.NONE)
class AgentHostServiceTest {
private class ServiceContext : ContextWrapper(RuntimeEnvironment.getApplication()) {
var stops = 0
var reject = false
override fun startForegroundService(service: Intent): ComponentName {
if (reject) throw IllegalStateException("start rejected")
return ComponentName(packageName, AgentHostService::class.java.name)
}
override fun stopService(service: Intent): Boolean { stops++; return true }
}
@Test fun setupCompletionKeepsBackgroundWaitUntilItEnds() {
val context = ServiceContext()
AgentHostService.setupStarted(context)
val service = Robolectric.buildService(AgentHostService::class.java).create().get()
service.onStartCommand(Intent(context, AgentHostService::class.java), 0, 1)
assertNull(AgentHostService.waitForBackground(context))
AgentHostService.setupEnded(context)
assertEquals(0, context.stops)
AgentHostService.backgroundDone(context)
assertEquals(1, context.stops)
}
@Test fun rejectedForegroundStartIsReportedAndCanBeRetried() {
val context = ServiceContext()
context.reject = true
assertNotNull(AgentHostService.start(context))
context.reject = false
assertNull(AgentHostService.start(context))
val service = Robolectric.buildService(AgentHostService::class.java).create().get()
service.onStartCommand(Intent(context, AgentHostService::class.java), 0, 1)
AgentHostService.stop(context)
}
}
@@ -80,6 +80,52 @@ class AgentHostTest {
assertTrue(event == null || event.entries.none { it is Entry.Finished })
}
@Test fun claudeTakesItsMessagesOverStdinSoItStaysOpen() {
val command = ClaudeCode.turn("hello there", null, AgentHarness.Options())
assertEquals("stream-json", command[command.indexOf("--input-format") + 1])
assertFalse("hello there" in command)
val line = org.json.JSONObject(ClaudeCode.input("hello there")!!)
assertEquals("user", line.getString("type"))
assertEquals("hello there", line.getJSONObject("message").getJSONArray("content").getJSONObject(0).getString("text"))
assertNull(Codex.input("hi"))
}
@Test fun aTaskNotificationResultIsMarkedBackgroundAndCarriesItsUsage() {
val event = ClaudeCode.parse("""{"type":"result","is_error":false,"session_id":"s","duration_ms":900,"total_cost_usd":0.01,"usage":{"input_tokens":3,"output_tokens":4},"origin":{"kind":"task-notification"}}""")!!
assertTrue(event.background)
assertTrue(event.entries.isEmpty())
assertEquals(4L, event.usage?.outputTokens)
assertNull(event.backgroundError)
}
@Test fun retainedClaudeCostsAreRecordedOncePerProcess() {
val costs = AgentCostTracker()
fun usage(cost: Double) = AgentHost.Usage(1, cost, 1, 1)
assertEquals(0.05, costs.perTurn(usage(0.05)).costUsd, 0.000001)
assertEquals(0.02, costs.perTurn(usage(0.07)).costUsd, 0.000001)
assertEquals(0.0, costs.perTurn(usage(0.07)).costUsd, 0.000001)
costs.reset()
assertEquals(0.0, costs.perTurn(usage(0.0)).costUsd, 0.000001)
assertEquals(0.07, costs.perTurn(usage(0.07)).costUsd, 0.000001)
assertEquals(0.01, costs.perTurn(usage(0.01)).costUsd, 0.000001)
assertEquals(0.07, AgentCostTracker().perTurn(usage(0.07)).costUsd, 0.000001)
}
@Test fun aFailedTaskNotificationResultKeepsItsError() {
val event = ClaudeCode.parse("""{"type":"result","is_error":true,"result":"API Error: overloaded","session_id":"s","usage":{"input_tokens":0,"output_tokens":0},"origin":{"kind":"task-notification"}}""")!!
assertTrue(event.background)
assertEquals("API Error: overloaded", event.backgroundError)
}
@Test fun aToolCallThatRunsInTheBackgroundIsMarked() {
fun used(tool: String, input: String) = ClaudeCode.parse(
"""{"type":"assistant","session_id":"s","message":{"content":[{"type":"tool_use","id":"t","name":"$tool","input":$input}]}}"""
)!!.entries.single() as Entry.Used
assertTrue(used("Bash", """{"command":"./gradlew test","run_in_background":true}""").background)
assertFalse(used("Bash", """{"command":"ls"}""").background)
assertTrue(used("Monitor", """{"command":"tail -f log"}""").background)
}
@Test fun claudeTurnsBypassPermissionsOrPlanAndTakeAModel() {
val first = ClaudeCode.turn("hi", null, AgentHarness.Options())
assertTrue("bypassPermissions" in first && "--resume" !in first && "--model" !in first && "--include-partial-messages" in first)
@@ -179,7 +225,7 @@ class AgentHostTest {
AgentChats.start(file, "claude")
AgentChats.appendConversation(file, "abc")
val written = listOf(
Entry.Asked("hi", listOf("/root/x.png")), Entry.Said("hello"), Entry.Thought("hm"), Entry.Used("t1", "Read", "/root/x", "{}"),
Entry.Asked("hi", listOf("/root/x.png")), Entry.Said("hello"), Entry.Notice("service unavailable"), Entry.Thought("hm"), Entry.Used("t1", "Read", "/root/x", "{}"),
Entry.Result("t1", "contents", false), Entry.Finished(null, usage = AgentHost.Usage(1, 0.5, 2, 3)), Entry.Finished("boom", stopped = true),
Entry.Finished(null, usage = AgentHost.Usage(1, 0.5, 2, 3, context = 40_000, window = 200_000), planned = true),
)
@@ -189,7 +235,7 @@ class AgentHostTest {
assertEquals("claude", loaded.harness)
assertEquals("abc", loaded.conversation)
assertEquals(listOf(
Entry.Asked("hi", listOf("/root/x.png")), Entry.Said("hello"), Entry.Thought("hm"), Entry.Used("t1", "Read", "/root/x", "{}", "contents", false),
Entry.Asked("hi", listOf("/root/x.png")), Entry.Said("hello"), Entry.Notice("service unavailable"), Entry.Thought("hm"), Entry.Used("t1", "Read", "/root/x", "{}", "contents", false),
Entry.Finished(null, usage = AgentHost.Usage(1, 0.5, 2, 3)), Entry.Finished("boom", stopped = true),
Entry.Finished(null, usage = AgentHost.Usage(1, 0.5, 2, 3, context = 40_000, window = 200_000), planned = true),
), loaded.entries)
@@ -198,6 +244,7 @@ class AgentHostTest {
@Test fun aTurnThatEndsWithNothingIsAnswerless() {
assertTrue(AgentHost.answerless(listOf(Entry.Said("x"), Entry.Asked("go on"), Entry.Finished(null))))
assertTrue(AgentHost.answerless(listOf(Entry.Asked("go on"), Entry.Notice("service unavailable"), Entry.Finished(null))))
assertFalse(AgentHost.answerless(listOf(Entry.Asked("go on"), Entry.Said("ok"), Entry.Finished(null))))
assertFalse(AgentHost.answerless(listOf(Entry.Asked("go on"), Entry.Finished("boom"))))
assertFalse(AgentHost.answerless(listOf(Entry.Asked("go on"), Entry.Finished(null, stopped = true))))
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.frontend
import com.droiddeck.launcher.assumeFilePermissionsEnforced
import android.os.Environment
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.stores.StoreInstallRoot
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
@@ -367,15 +366,6 @@ class AddedExesTest {
assertEquals("$clash-2", guests.last())
}
@Test fun aFolderNamedStoresIsNotBoundOverTheInternalStoreRoot() {
noGamesFolders()
val stores = File(tmp.newFolder("card"), "Stores").apply { exe(File(this, "One/One.exe")) }
val result = AddedGames.addFolder(app, stores)
val guest = SessionPrefs.gameFolderBinds(app).single().second
assertTrue(guest != StoreInstallRoot.INTERNAL_GUEST && guest.startsWith("${AddedGames.GUEST_DIR}/Stores-"))
assertEquals("$guest/One/One.exe", result.added.single().guestExe)
}
@Test fun aRemovedSingleExeGameStaysOffUntilPickedAgain() {
noGamesFolders()
val pick = onStorage("Download/Celeste/Celeste.exe")
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.frontend
import com.droiddeck.launcher.session.GameStorage
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.stores.StoreGameSidecar
import com.droiddeck.launcher.stores.StoreInstallRoot
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
@@ -183,41 +182,6 @@ class GamesFolderMigrationTest {
assertEquals(listOf(pc.path to AddedGames.GUEST_DIR + "/PC"), binds)
}
@Test fun aMigratedFolderNamedStoresDoesNotTakeTheInternalStoreGuest() {
val stores = File(tmp.newFolder("card"), "Stores").apply { exe(this, "One/One.exe") }
val pc = tmp.newFolder("PC").apply { exe(this, "Two/Two.exe") }
SessionPrefs.setAddedGamesDirs(app, listOf(stores.path, pc.path))
GamesFolderMigration.run(app)
val binds = SessionPrefs.gameFolderBinds(app).toMap()
assertTrue(binds.getValue(stores.path) != StoreInstallRoot.INTERNAL_GUEST)
assertEquals(AddedGames.GUEST_DIR + "/PC", binds.getValue(pc.path))
val games = AddedGames.scan(app).associateBy { it.name }
assertEquals(binds.getValue(stores.path) + "/One/One.exe", games.getValue("One").guestExe)
}
@Test fun aSavedBindAtTheInternalStoreGuestIsRepathed() {
val stores = File(tmp.newFolder("card"), "Stores").apply { exe(this, "One/One.exe") }
val pc = tmp.newFolder("PC").apply { exe(this, "Two/Two.exe") }
SessionPrefs.setGameFolderBinds(
app,
listOf(stores.path to StoreInstallRoot.INTERNAL_GUEST, pc.path to AddedGames.GUEST_DIR + "/PC"),
)
GamesFolderMigration.run(app)
val binds = SessionPrefs.gameFolderBinds(app).toMap()
assertTrue(binds.getValue(stores.path) != StoreInstallRoot.INTERNAL_GUEST)
assertTrue(binds.getValue(stores.path).startsWith("${AddedGames.GUEST_DIR}/Stores-"))
assertEquals(AddedGames.GUEST_DIR + "/PC", binds.getValue(pc.path))
assertTrue(binds.values.none { it == StoreInstallRoot.INTERNAL_GUEST })
assertEquals(binds.getValue(stores.path) + "/One/One.exe", AddedGames.guestPath(app, File(stores, "One/One.exe")))
val installer = File(stores, "GOG/Game/setup_1.exe").apply { parentFile?.mkdirs(); writeText("MZ") }
val guestInstaller = AddedGames.guestPath(app, installer)!!
val extractorBinds = StoreInstallRoot.guestBinds(app).map { it.substringBeforeLast(':') to it.substringAfterLast(':') }
val covering = extractorBinds.filter { (_, mount) -> guestInstaller.startsWith("$mount/") }.maxByOrNull { it.second.length }!!
assertEquals(installer.canonicalFile, File(covering.first + guestInstaller.removePrefix(covering.second)).canonicalFile)
val internalInstaller = "${StoreInstallRoot.INTERNAL_GUEST}/GOG/Game/setup_1.exe"
assertTrue(extractorBinds.none { (_, mount) -> internalInstaller == mount || internalInstaller.startsWith("$mount/") })
}
@Test fun twoFoldersOfOneNameKeepTheirOwnGuestPaths() {
val a = File(tmp.newFolder("a"), "Games").apply { mkdirs() }
val b = File(tmp.newFolder("b"), "Games").apply { mkdirs() }
@@ -100,6 +100,36 @@ class SteamLaunchOptionsTest {
private fun localConfig(home: File, account: String) = File(home, "userdata/$account/config/localconfig.vdf").apply { parentFile!!.mkdirs() }
private fun withRootApp(text: String, appId: Int, key: String, value: String) = text.replaceFirst(
"{\n\t\"Software\"",
"{\n\t\"apps\"\n\t{\n\t\t\"$appId\"\n\t\t{\n\t\t\t\"$key\"\t\t\"$value\"\n\t\t}\n\t}\n\t\"Software\"",
)
@Test fun steamInputIsReadFromTheRootAppsSection() {
val home = steamHome()
localConfig(home, "60974196").writeText(withRootApp(config(apps(*sparking)), 1790600, "UseSteamControllerConfig", "2"))
assertEquals("2", SteamLaunchOptions.steamAppSetting(home, 1790600, "UseSteamControllerConfig", "1"))
assertEquals("1", SteamLaunchOptions.steamAppSetting(home, 400, "UseSteamControllerConfig", "1"))
}
@Test fun steamInputIsWrittenToTheRootAppsSectionAndAnOldCopyIsDropped() {
val home = steamHome()
val legacy = arrayOf(
"\t\t\t\t\t\"1790600\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"LaunchOptions\"\t\t\"-dx11\"",
"\t\t\t\t\t\t\"UseSteamControllerConfig\"\t\t\"0\"", "\t\t\t\t\t}",
)
val file = localConfig(home, "60974196").apply { writeText(config(apps(*legacy))) }
assertEquals("0", SteamLaunchOptions.steamAppSetting(home, 1790600, "UseSteamControllerConfig", "1"))
assertTrue(SteamLaunchOptions.writeSteamAppSetting(home, 1790600, "UseSteamControllerConfig", "0", "2", "1"))
val written = file.readText()
assertEquals("2", SteamLaunchOptions.steamAppSetting(home, 1790600, "UseSteamControllerConfig", "1"))
assertEquals(1, Regex("UseSteamControllerConfig").findAll(written).count())
assertFalse(written.substring(written.indexOf("\"Software\""), written.indexOf("\"WebStorage\"")).contains("UseSteamControllerConfig"))
assertEquals("-dx11", SteamLaunchOptions.launchOptions(written, 1790600))
assertTrue(SteamLaunchOptions.writeSteamAppSetting(home, 1790600, "UseSteamControllerConfig", "2", null, "1"))
assertFalse(file.readText().contains("UseSteamControllerConfig"))
}
@Test fun aChangeGoesToTheSignedInAccountOnly() {
val home = steamHome()
val signedIn = localConfig(home, "60974196").apply { writeText(config(apps(*sparking))) }
@@ -67,6 +67,54 @@ class DirectTouchHoldTest {
assertEquals("up 0 at 60.0,30.0", touches.last())
}
@Test fun tapForwardsNothingWhileTapClicksAreOff() {
hold.tapClicks = false
touch(MotionEvent.ACTION_DOWN)
advance(100)
touch(MotionEvent.ACTION_UP, 50f)
advance(100)
assertTrue(touches.isEmpty())
assertTrue(buttons.isEmpty())
}
@Test fun holdStillRightClicksWhileTapClicksAreOff() {
hold.tapClicks = false
touch(MotionEvent.ACTION_DOWN)
advance(550)
assertEquals(listOf("true at 40.0,30.0", "false at 40.0,30.0"), buttons)
touch(MotionEvent.ACTION_UP)
advance(100)
assertTrue(touches.isEmpty())
}
@Test fun dragAndSecondFingerStillForwardWhileTapClicksAreOff() {
hold.tapClicks = false
touch(MotionEvent.ACTION_DOWN)
touch(MotionEvent.ACTION_MOVE, 60f)
assertEquals(listOf("down 0 at 40.0,30.0", "move 0 at 60.0,30.0"), touches)
touch(MotionEvent.ACTION_UP, 60f)
advance(50)
touches.clear()
touch(MotionEvent.ACTION_DOWN)
touch(MotionEvent.ACTION_POINTER_DOWN, 60f)
assertEquals(listOf("down 0 at 40.0,30.0", "down 0 at 60.0,30.0"), touches)
touch(MotionEvent.ACTION_UP, 60f)
}
@Test fun noneBehaviorWaitsForMovementWhileTapClicksAreOff() {
hold.configure(TouchGestureConfig(directHoldBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_NONE))
hold.tapClicks = false
touch(MotionEvent.ACTION_DOWN)
assertTrue(touches.isEmpty())
touch(MotionEvent.ACTION_UP)
advance(100)
assertTrue(touches.isEmpty())
touch(MotionEvent.ACTION_DOWN)
touch(MotionEvent.ACTION_MOVE, 60f)
assertEquals(listOf("down 0 at 40.0,30.0", "move 0 at 60.0,30.0"), touches)
touch(MotionEvent.ACTION_UP, 60f)
}
@Test fun dragForwardsTheTouchOnceItMoves() {
touch(MotionEvent.ACTION_DOWN)
touch(MotionEvent.ACTION_MOVE, 60f)
@@ -0,0 +1,12 @@
package com.droiddeck.launcher.input
import android.view.MotionEvent
internal fun inertTwoFingerGestures() = TwoFingerGestures(16f, object : TwoFingerGestures.Listener {
override fun cancelTouch() {}
override fun replay(event: MotionEvent) {}
override fun rightClick(x: Float, y: Float) {}
override fun scrollStart(x: Float, y: Float) {}
override fun scroll(dx: Float, dy: Float) {}
override fun scrollEnd() {}
})
@@ -0,0 +1,68 @@
package com.droiddeck.launcher.input
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class InputProfileMouseButtonTest {
private val a = InputSurfaceElement(InputControl.A, 0f, 0f, .2f, .2f)
private val trackpad = InputSurfaceElement(InputControl.RIGHT_PAD, 0f, 0f, .5f, .5f)
private val trigger = InputSurfaceElement(InputControl.RT, 0f, 0f, .2f, .2f)
@Test fun gameDefaultsHaveNoMouseButton() {
assertFalse(InputProfile.defaults(InputProfile.GAME).hasMouseButton(InputRole.PRIMARY, listOf(a, trigger, trackpad)))
}
@Test fun stockDesktopBindingsDoNotCount() {
val desktop = InputProfile.defaults(InputProfile.DESKTOP)
assertFalse(desktop.hasMouseButton(InputRole.PRIMARY, listOf(a, trigger)))
}
@Test fun reboundDesktopButtonAndGameBaseMouseBindingsCount() {
val desktop = InputProfile.defaults(InputProfile.DESKTOP)
assertTrue(desktop.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274)).hasMouseButton(InputRole.PRIMARY, listOf(a)))
assertFalse(desktop.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.Keys(listOf(28))).hasMouseButton(InputRole.PRIMARY, listOf(a)))
assertTrue(InputProfile.defaults(InputProfile.GAME).withBinding(InputRole.PRIMARY, InputControl.RT, InputAction.MouseButton(272))
.hasMouseButton(InputRole.PRIMARY, listOf(trigger)))
}
@Test fun trackpadsAndKeyBindingsDoNotCount() {
val desktop = InputProfile.defaults(InputProfile.DESKTOP)
assertFalse(desktop.hasMouseButton(InputRole.PRIMARY, listOf(trackpad)))
assertFalse(InputProfile.defaults(InputProfile.GAME).withBinding(InputRole.PRIMARY, InputControl.A, InputAction.Keys(listOf(28)))
.hasMouseButton(InputRole.PRIMARY, listOf(a)))
}
@Test fun customElementCountsOnlyWhenItsOwnActionIsAMouseButton() {
val custom = InputSurfaceElement(InputControl.A, 0f, 0f, .2f, .2f, id = "custom:1")
val game = InputProfile.defaults(InputProfile.GAME)
assertFalse(game.hasMouseButton(InputRole.PRIMARY, listOf(custom)))
val bound = game.copy(elements = mapOf(InputRole.PRIMARY to mapOf("custom:1" to InputAction.MouseButton(272))))
assertTrue(bound.hasMouseButton(InputRole.PRIMARY, listOf(custom)))
assertFalse(bound.hasMouseButton(InputRole.SECONDARY, listOf(custom)))
}
@Test fun savedDesktopProfileComparesAgainstItsDesktopBase() {
val saved = InputProfile.defaults(InputProfile.DESKTOP).copy(id = "saved:1", base = InputProfile.DESKTOP)
assertFalse(saved.hasMouseButton(InputRole.PRIMARY, listOf(a, trigger)))
assertTrue(saved.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274)).hasMouseButton(InputRole.PRIMARY, listOf(a)))
}
@Test fun configuredStickAndTrackpadClickMouseButtonsCount() {
val stick = InputSurfaceElement(InputControl.LS, 0f, 0f, .3f, .3f)
val desktop = InputProfile.defaults(InputProfile.DESKTOP)
assertFalse(desktop.hasMouseButton(InputRole.PRIMARY, listOf(stick, trackpad)))
assertFalse(InputProfile.defaults(InputProfile.GAME).hasMouseButton(InputRole.PRIMARY, listOf(stick, trackpad)))
val stickClick = desktop.copy(clicks = mapOf(InputRole.PRIMARY to mapOf(stick.id to InputAction.MouseButton(274))))
assertTrue(stickClick.hasMouseButton(InputRole.PRIMARY, listOf(stick)))
assertFalse(stickClick.hasMouseButton(InputRole.SECONDARY, listOf(stick)))
val padClick = InputProfile.defaults(InputProfile.GAME).copy(clicks = mapOf(InputRole.PRIMARY to mapOf(trackpad.id to InputAction.MouseButton(272))))
assertTrue(padClick.hasMouseButton(InputRole.PRIMARY, listOf(trackpad)))
}
@Test fun secondaryRoleBindingCountsOnlyForTheSecondaryRole() {
val secondary = InputProfile.defaults(InputProfile.GAME).withBinding(InputRole.SECONDARY, InputControl.A, InputAction.MouseButton(272))
assertTrue(secondary.hasMouseButton(InputRole.SECONDARY, listOf(a)))
assertFalse(secondary.hasMouseButton(InputRole.PRIMARY, listOf(a)))
}
}
@@ -227,6 +227,20 @@ class OnScreenControlsTest {
assertFalse(view.hasPinned)
}
@Test fun shownElementsFollowPinnedOnlyAndQuickHide() {
val key = InputSurfaceElement(InputControl.B, .45f, .1f, .1f, .1f, "imported:0", name = "Find", alwaysShown = true)
view.updateLayout(SavedInputLayout("test", "Test", listOf(left, button, key), aspect = ASPECT))
measure(view)
assertEquals(listOf(left, button, key).map { it.id }, view.shownElements().map { it.id })
view.setQuickHidden(true)
assertEquals(listOf("imported:0"), view.shownElements().map { it.id })
view.setQuickHidden(false)
view.setPinnedOnly(true)
assertEquals(listOf("imported:0"), view.shownElements().map { it.id })
view.updateLayout(SavedInputLayout("test", "Test", listOf(left, button), aspect = ASPECT))
assertTrue(view.shownElements().isEmpty())
}
private companion object { const val ASPECT = 1000f / 600f }
private fun touch(action: Int, vararg pointers: Pair<Int, Pair<Float, Float>>, flags: Int = 0): Boolean {
@@ -48,6 +48,31 @@ class ScrollTouchGesturesTest {
assertEquals(listOf("move 400,300", "left down", "left up"), events)
}
@Test fun tapsPressNothingButLongPressStillRightClicksWhileTapClicksAreOff() {
gestures.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(80)
touch(MotionEvent.ACTION_UP, 400f, 300f)
advance(100)
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(700)
touch(MotionEvent.ACTION_UP, 400f, 300f)
advance(100)
assertEquals(listOf("move 400,300", "move 400,300", "long press", "right down", "right up"), events)
}
@Test fun holdThenMoveStillDragsWhileTapClicksAreOff() {
gestures.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 400f, 800f)
advance(700)
touch(MotionEvent.ACTION_MOVE, 403f, 600f)
advance(100)
touch(MotionEvent.ACTION_UP, 403f, 600f)
advance(100)
assertEquals(listOf("move 400,800", "long press", "left down", "move 403,600", "left up"), events)
assertEquals(0f, scrolledY, 0f)
}
@Test fun draggingScrollsWithTheFingerAndNeverClicks() {
touch(MotionEvent.ACTION_DOWN, 400f, 800f)
advance(200)
@@ -35,6 +35,7 @@ class SessionGestureRoutingTest {
private lateinit var directHold: DirectTouchHold
private val keys = mutableListOf<Pair<Int, Boolean>>()
private val directButtons = mutableListOf<Pair<Int, Boolean>>()
private val directTouches = mutableListOf<Int>()
private val scrollPositions = mutableListOf<Pair<Float, Float>>()
private val scrollDeltas = mutableListOf<Pair<Float, Float>>()
private var keyboards = 0
@@ -221,12 +222,13 @@ class SessionGestureRoutingTest {
override fun onWheel(steps: Int) {}
override fun onLongPress() {}
}, object : DirectTouchHold.Touch {
override fun down(pointerId: Int, x: Float, y: Float) {}
override fun down(pointerId: Int, x: Float, y: Float) { directTouches += 0 }
override fun move(pointerId: Int, x: Float, y: Float) {}
override fun up(pointerId: Int, x: Float, y: Float) {}
override fun cancel() {}
}).also { it.configure(config) }
setField("directTouchHold", directHold)
setField("twoFingerGestures", inertTwoFingerGestures())
launcherScroll = ScrollTouchGestures(8f, 50f, object : ScrollTouchGestures.Listener {
override fun onMove(x: Float, y: Float) { scrollPositions += x to y }
override fun onButton(button: Int, pressed: Boolean) {}
@@ -236,6 +238,74 @@ class SessionGestureRoutingTest {
setField("scrollTouch", launcherScroll)
}
@Test fun pointerLockedTapsAreDroppedWhileTapClicksAreOffButHoldAndSwipesStillWork() {
prepare(SessionPrefs.TOUCH_DIRECT)
setField("pointerLocked", true)
SessionState.outputSize = 1000 to 600
val rect = android.graphics.RectF(0f, 0f, 1000f, 600f)
fun forward(action: Int, x: Float, y: Float) {
val now = SystemClock.uptimeMillis()
val event = MotionEvent.obtain(now, now, action, x, y, 0)
try { ReflectionHelpers.callInstanceMethod<Any?>(activity, "forwardTouch",
ReflectionHelpers.ClassParameter.from(MotionEvent::class.java, event),
ReflectionHelpers.ClassParameter.from(android.graphics.RectF::class.java, rect)) } finally { event.recycle() }
}
fun tap() {
forward(MotionEvent.ACTION_DOWN, 300f, 300f)
forward(MotionEvent.ACTION_UP, 300f, 300f)
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(200))
}
directHold.tapClicks = false
tap()
assertTrue(directTouches.isEmpty())
assertTrue(directButtons.isEmpty())
forward(MotionEvent.ACTION_DOWN, 300f, 300f)
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(700))
assertEquals(listOf(PointerGestures.BTN_RIGHT to true, PointerGestures.BTN_RIGHT to false), directButtons)
forward(MotionEvent.ACTION_UP, 300f, 300f)
CompositorShadow.sceneInputs = 0
forward(MotionEvent.ACTION_DOWN, 300f, 300f)
forward(MotionEvent.ACTION_MOVE, 400f, 300f)
assertTrue(CompositorShadow.sceneInputs > 0)
forward(MotionEvent.ACTION_UP, 400f, 300f)
directHold.tapClicks = true
tap()
assertEquals(1, directTouches.size)
}
@Test fun directTouchDownDetectsAShownMouseButtonAndSwitchesSuppressionPerStream() {
prepare(SessionPrefs.TOUCH_DIRECT)
SessionState.outputSize = 1000 to 600
val controls = OnScreenControls(activity, null).apply {
updateLayout(SavedInputLayout("test", "Test", listOf(InputSurfaceElement(InputControl.A, .7f, .3f, .2f, .3f)), aspect = 1000f / 600f))
measure(android.view.View.MeasureSpec.makeMeasureSpec(1000, android.view.View.MeasureSpec.EXACTLY),
android.view.View.MeasureSpec.makeMeasureSpec(600, android.view.View.MeasureSpec.EXACTLY))
layout(0, 0, 1000, 600)
visibility = android.view.View.VISIBLE
}
setField("onScreenControls", controls)
fun tapWith(profile: InputProfile): Int {
setField("inputProfile", profile)
directTouches.clear()
val now = SystemClock.uptimeMillis()
for (action in listOf(MotionEvent.ACTION_DOWN, MotionEvent.ACTION_UP)) {
val event = MotionEvent.obtain(now, now, action, 300f, 300f, 0)
try { ReflectionHelpers.callInstanceMethod<Any?>(activity, "dispatchDirectTouch",
ReflectionHelpers.ClassParameter.from(MotionEvent::class.java, event)) } finally { event.recycle() }
}
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(200))
return directTouches.size
}
CompositorShadow.pointerMoves.clear()
assertEquals(1, tapWith(InputProfile.defaults(InputProfile.DESKTOP)))
assertTrue(CompositorShadow.pointerMoves.isEmpty())
assertEquals(0, tapWith(InputProfile.defaults(InputProfile.DESKTOP)
.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274))))
assertEquals(1, CompositorShadow.pointerMoves.size)
assertEquals(1, tapWith(InputProfile.defaults(InputProfile.DESKTOP)))
assertEquals(1, CompositorShadow.pointerMoves.size)
}
private fun tapThreeFingers(expectSteamGesture: Boolean) {
val down = SystemClock.uptimeMillis()
fun send(action: Int, index: Int, count: Int) {
@@ -263,9 +333,12 @@ class SessionGestureRoutingTest {
@Implements(value = WaylandCompositor::class, isInAndroidSdk = false)
class CompositorShadow {
companion object {
@JvmStatic var sceneInputs = 0
@JvmStatic val pointerMoves = mutableListOf<Pair<Int, Int>>()
@JvmStatic @Implementation fun __staticInitializer__() {}
@JvmStatic @Implementation fun nativeSendPointer(action: Int, x: Int, y: Int) { pointerMoves += x to y }
@JvmStatic @Implementation fun nativeSendTouch(action: Int, id: Int, x: Int, y: Int) {}
@JvmStatic @Implementation fun nativeSendSceneInput(type: Int, code: Int, value: Int) {}
@JvmStatic @Implementation fun nativeSendSceneInput(type: Int, code: Int, value: Int) { sceneInputs++ }
}
}
}
@@ -360,6 +360,7 @@ class SessionPenRoutingTest {
field("routedTouchMode", SessionPrefs.TOUCH_DIRECT)
field("padMouseCheckedAt", android.os.SystemClock.uptimeMillis())
field("threeFingerTap", ThreeFingerTap(8f))
field("twoFingerGestures", inertTwoFingerGestures())
field("directTouchHold", DirectTouchHold(8f, object : PointerGestures.Listener {
override fun onMove(x: Float, y: Float) {}
override fun onButton(button: Int, pressed: Boolean, x: Float, y: Float) {}
@@ -1,13 +1,17 @@
package com.droiddeck.launcher.input
import android.view.View
import androidx.compose.runtime.MutableState
import com.droiddeck.launcher.SessionActivity
import com.droiddeck.launcher.ui.InputSurfaceView
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import java.nio.file.Files
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -64,6 +68,85 @@ class SessionTouchRoutingTest {
}
}
@Test fun pinnedMouseButtonSuppressesTapsAfterSteamTouchIsHiddenForTheKeyboard() {
val controls = shownControls(button.copy(alwaysShown = true))
field("inputProfile", userMouseButtonProfile)
ReflectionHelpers.getField<MutableState<Boolean>>(activity, "steamTouchInUse\$delegate").value = true
ReflectionHelpers.getField<MutableState<Boolean>>(activity, "pcKeyboardOpen\$delegate").value = true
invoke("updateOnScreenControls")
assertEquals(View.GONE, steam.visibility)
assertEquals(View.VISIBLE, controls.visibility)
assertTrue(mouseButtonShown())
}
@Test fun visibleSteamTouchKeepsTapClicksAndGameBindingsHaveNoMouseButton() {
shownControls(button)
field("inputProfile", userMouseButtonProfile)
assertFalse(mouseButtonShown())
steam.visibility = View.GONE
assertTrue(mouseButtonShown())
field("inputProfile", InputProfile.defaults(InputProfile.GAME))
assertFalse(mouseButtonShown())
}
@Test fun mouseButtonOnTheDeckSurfaceSuppressesTapsOnlyWhileItIsShown() {
steam.visibility = View.GONE
field("inputProfile", userMouseButtonProfile)
val deck = InputSurfaceView(activity, null, listOf(button), InputRole.PRIMARY)
field("unfoldedDeckSurface", deck)
assertTrue(mouseButtonShown())
deck.visibility = View.GONE
assertFalse(mouseButtonShown())
deck.visibility = View.VISIBLE
field("inputProfile", InputProfile.defaults(InputProfile.GAME))
assertFalse(mouseButtonShown())
}
@Test fun pinnedMouseButtonInButtonsOnlyControlsSuppressesTaps() {
steam.visibility = View.GONE
field("inputProfile", userMouseButtonProfile)
val controls = shownControls(button.copy(alwaysShown = true))
controls.setButtonsOnly(true)
assertTrue(mouseButtonShown())
val plain = shownControls(button)
plain.setButtonsOnly(true)
assertFalse(mouseButtonShown())
}
@Test fun mouseClickOnAStickOrTrackpadSuppressesTaps() {
steam.visibility = View.GONE
val stick = InputSurfaceElement(InputControl.LS, .1f, .3f, .3f, .4f)
shownControls(stick)
field("inputProfile", InputProfile.defaults(InputProfile.DESKTOP))
assertFalse(mouseButtonShown())
field("inputProfile", InputProfile.defaults(InputProfile.DESKTOP)
.copy(clicks = mapOf(InputRole.PRIMARY to mapOf(stick.id to InputAction.MouseButton(274)))))
assertTrue(mouseButtonShown())
}
private val userMouseButtonProfile = InputProfile.defaults(InputProfile.DESKTOP)
.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274))
@Test fun stockDesktopOverlayKeepsTapClicks() {
steam.visibility = View.GONE
shownControls(button)
field("inputProfile", InputProfile.defaults(InputProfile.DESKTOP))
assertFalse(mouseButtonShown())
field("inputProfile", userMouseButtonProfile)
assertTrue(mouseButtonShown())
}
private val button = InputSurfaceElement(InputControl.A, .7f, .3f, .2f, .3f)
private fun shownControls(vararg elements: InputSurfaceElement) = OnScreenControls(activity, null).apply {
updateLayout(SavedInputLayout("test", "Test", elements.toList(), aspect = 1000f / 600f))
measure(View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(600, View.MeasureSpec.EXACTLY))
layout(0, 0, 1000, 600)
visibility = View.VISIBLE
field("onScreenControls", this)
}
private fun mouseButtonShown() = invoke("onScreenMouseButtonShown") as Boolean
private fun field(name: String, value: Any) = ReflectionHelpers.setField(activity, name, value)
private fun invoke(name: String) = ReflectionHelpers.callInstanceMethod<Any?>(activity, name)
}
@@ -262,6 +262,58 @@ class TouchpadGesturesTest {
assertFalse(events.contains("left down"))
}
@Test fun tapsDoNotClickWhenTapClicksAreOff() {
touchpad.tapClicks = false
tap()
advance(50)
tap()
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(10)
touch(MotionEvent.ACTION_POINTER_DOWN, 1, 1 to (400f to 300f), 2 to (600f to 310f))
advance(60)
touch(MotionEvent.ACTION_POINTER_UP, 1, 1 to (400f to 300f), 2 to (600f to 310f))
advance(10)
touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f))
advance(TouchTiming.CLICK_MS + 100)
assertEquals(emptyList<String>(), events)
}
@Test fun movementAndHoldDragStillWorkWhenTapClicksAreOff() {
touchpad.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(10)
touch(MotionEvent.ACTION_MOVE, 0, 1 to (460f to 300f))
touch(MotionEvent.ACTION_UP, 0, 1 to (460f to 300f))
assertTrue(events.contains("move"))
assertFalse(events.any { it.startsWith("left") })
events.clear()
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(TouchTiming.HOLD_MS + 50)
touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f))
assertEquals(listOf("long press", "left down", "left up"), events)
}
@Test fun tapsClickAgainOnceTapClicksAreBackOn() {
touchpad.tapClicks = false
tap()
touchpad.tapClicks = true
tap()
advance(TouchTiming.CLICK_MS + 100)
assertEquals(listOf("left down", "left up"), events)
}
@Test fun doubleTapDragIsNotStartedAfterTapClicksTurnOff() {
tap()
advance(TouchTiming.CLICK_MS + 10)
events.clear()
touchpad.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(TouchTiming.HOLD_MS - 50)
touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f))
advance(TouchTiming.CLICK_MS + 100)
assertEquals(emptyList<String>(), events)
}
private fun tap() {
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(80)
@@ -39,6 +39,23 @@ class TwoFingerGesturesTest {
assertEquals(listOf("cancel", "right 400.0,300.0"), calls)
}
@Test fun tapClicksOffSwallowsTheTapButKeepsHoldAndScroll() {
gestures.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 0, a)
time += 20
touch(MotionEvent.ACTION_POINTER_DOWN, 1, a, b)
time += 80
assertTrue(touch(MotionEvent.ACTION_POINTER_UP, 1, a, b))
assertTrue(touch(MotionEvent.ACTION_UP, 0, a))
assertEquals(listOf("cancel"), calls)
calls.clear()
touch(MotionEvent.ACTION_DOWN, 0, a)
time += 20
touch(MotionEvent.ACTION_POINTER_DOWN, 1, a, b)
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(TwoFingerGestures.HOLD_MS + 10))
assertEquals(listOf("cancel", "right 400.0,300.0"), calls)
}
@Test fun holdRightClicksOnce() {
touch(MotionEvent.ACTION_DOWN, 0, a)
time += 20
@@ -94,6 +94,7 @@ class BootMovieTest {
@Test fun resetCoversTheChoiceButNotTheImportedName() {
assertTrue(SettingsReset.isSessionSetting("bootMovie"))
assertTrue(SettingsReset.isSessionSetting("bootMovieSound"))
assertTrue(SettingsReset.isSessionSetting("bootMovieShuffle"))
assertFalse(SettingsReset.isSessionSetting("bootMovieCustomName"))
}
}
@@ -63,4 +63,140 @@ class StartupMovieConfigTest {
assertTrue(SessionFiles.resetMissingStartupMovie(file, false))
assertNull(SessionFiles.startupMoviePath(file))
}
@Test fun shuffleIsWrittenIntoBothMovieSectionsAndReadBack() {
val file = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
assertEquals(false, SessionFiles.startupMovieShuffle(file))
assertTrue(SessionFiles.setStartupMovieShuffle(file, true))
assertEquals(true, SessionFiles.startupMovieShuffle(file))
assertEquals(2, Regex("\"Shuffle\"\\s+\"1\"").findAll(file.readText()).count())
assertEquals(SessionFiles.BOOT_MOVIE_PATH, SessionFiles.startupMoviePath(file))
}
@Test fun turningShuffleOffKeepsTheSelectedMovie() {
val file = config(SessionFiles.BOOT_MOVIE_PATH, "0", "/uioverrides/movies/Undertale.webm")
SessionFiles.setStartupMovieShuffle(file, true)
assertTrue(SessionFiles.setStartupMovieShuffle(file, false))
assertEquals(false, SessionFiles.startupMovieShuffle(file))
assertEquals("/uioverrides/movies/Undertale.webm", SessionFiles.startupMoviePath(file))
}
@Test fun shuffleOffLeavesAConfigWithoutTheKeyUntouched() {
val file = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
val before = file.readText()
assertTrue(SessionFiles.setStartupMovieShuffle(file, false))
assertEquals(before, file.readText())
}
@Test fun shuffleDoesNotChangeOtherProgramSettings() {
val file = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
val text = file.readText().replace(
"\t\t\t}\n\t\t}\n\t}\n",
"\t\t\t}\n\t\t}\n\t\t\"OtherProgram\"\n\t\t{\n\t\t\t\"Shuffle\"\t\t\"0\"\n\t\t}\n\t}\n",
)
file.writeText(text)
assertTrue(SessionFiles.setStartupMovieShuffle(file, true))
val updated = file.readText()
assertEquals(2, Regex("\"Shuffle\"\\s+\"1\"").findAll(updated).count())
assertEquals(1, Regex("\"Shuffle\"\\s+\"0\"").findAll(updated).count())
}
@Test fun shuffleIsNotAddedWhenThereIsNoMovieSection() {
val file = folder.newFile().also { it.writeText("\"InstallConfigStore\"\n{\n}\n") }
val before = file.readText()
assertTrue(SessionFiles.setStartupMovieShuffle(file, true))
assertEquals(before, file.readText())
assertEquals(false, SessionFiles.startupMovieShuffle(file))
}
@Test fun aShuffleChangedInSteamIsTakenOverAndOtherwiseTheChoiceIsKept() {
val app = org.robolectric.RuntimeEnvironment.getApplication()
app.getSharedPreferences("session", android.content.Context.MODE_PRIVATE).edit().clear().commit()
val file = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
BootMovie.syncShuffleFromSteam(app, file)
assertFalse(SessionPrefs.bootMovieShuffle(app))
SessionPrefs.setBootMovieShuffle(app, true)
BootMovie.syncShuffleFromSteam(app, file)
assertTrue(SessionPrefs.bootMovieShuffle(app))
SessionFiles.setStartupMovieShuffle(file, true)
BootMovie.syncShuffleFromSteam(app, file)
SessionFiles.setStartupMovieShuffle(file, false)
BootMovie.syncShuffleFromSteam(app, file)
assertFalse(SessionPrefs.bootMovieShuffle(app))
}
@Test fun anUnreadableConfigKeepsTheSavedShuffleChoice() {
val app = org.robolectric.RuntimeEnvironment.getApplication()
app.getSharedPreferences("session", android.content.Context.MODE_PRIVATE).edit().clear().commit()
val file = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
SessionPrefs.setBootMovieShuffle(app, true)
SessionPrefs.setBootMovieShuffleSeen(app, file, true)
val missing = File(folder.root, "missing.vdf")
assertNull(SessionFiles.startupMovieShuffle(missing))
BootMovie.syncShuffleFromSteam(app, missing)
assertTrue(SessionPrefs.bootMovieShuffle(app))
assertEquals(true, SessionPrefs.bootMovieShuffleSeen(app, file))
}
@Test fun resetLeavesShuffleOffEvenWhenSteamStillHasItOn() {
val app = org.robolectric.RuntimeEnvironment.getApplication()
app.getSharedPreferences("session", android.content.Context.MODE_PRIVATE).edit().clear().commit()
val file = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
SessionFiles.setStartupMovieShuffle(file, true)
SessionPrefs.setBootMovieShuffle(app, true)
BootMovie.syncShuffleFromSteam(app, file)
assertFalse(SettingsReset.isSessionSetting("bootMovieShuffleSeen:${file.path}"))
app.getSharedPreferences("session", android.content.Context.MODE_PRIVATE).edit().remove("bootMovieShuffle").commit()
BootMovie.syncShuffleFromSteam(app, file)
assertFalse(SessionPrefs.bootMovieShuffle(app))
}
@Test fun eachSteamHomeKeepsItsOwnShuffleBaseline() {
val app = org.robolectric.RuntimeEnvironment.getApplication()
app.getSharedPreferences("session", android.content.Context.MODE_PRIVATE).edit().clear().commit()
val arm = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
val x64 = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
BootMovie.syncShuffleFromSteam(app, arm)
BootMovie.syncShuffleFromSteam(app, x64)
SessionFiles.setStartupMovieShuffle(arm, true)
BootMovie.syncShuffleFromSteam(app, arm)
assertTrue(SessionPrefs.bootMovieShuffle(app))
BootMovie.syncShuffleFromSteam(app, x64)
assertTrue(SessionPrefs.bootMovieShuffle(app))
}
@Test fun aShuffleChangedInAnInactiveSteamHomeIsTakenOverBeforeTheActiveHome() {
val app = org.robolectric.RuntimeEnvironment.getApplication()
app.getSharedPreferences("session", android.content.Context.MODE_PRIVATE).edit().clear().commit()
val inactive = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
val active = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
BootMovie.syncShuffleFromSteam(app, listOf(inactive, active))
SessionFiles.setStartupMovieShuffle(inactive, true)
BootMovie.syncShuffleFromSteam(app, listOf(inactive, active))
assertTrue(SessionPrefs.bootMovieShuffle(app))
}
@Test fun aChangeInAnInactiveHomeIsNotUndoneByAnActiveHomeReadForTheFirstTime() {
val app = org.robolectric.RuntimeEnvironment.getApplication()
app.getSharedPreferences("session", android.content.Context.MODE_PRIVATE).edit().clear().commit()
val inactive = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
val active = File(folder.root, "unreadable.vdf")
BootMovie.syncShuffleFromSteam(app, listOf(inactive, active))
SessionFiles.setStartupMovieShuffle(inactive, true)
active.writeText(inactive.readText())
SessionFiles.setStartupMovieShuffle(active, false)
BootMovie.syncShuffleFromSteam(app, listOf(inactive, active))
assertTrue(SessionPrefs.bootMovieShuffle(app))
assertEquals(false, SessionPrefs.bootMovieShuffleSeen(app, active))
}
@Test fun aShuffleLineWithATrailingCommentIsReplacedNotDuplicated() {
val file = config(SessionFiles.BOOT_MOVIE_PATH, "0", SessionFiles.BOOT_MOVIE_PATH)
file.writeText(file.readText().replace("\t\t\t\"LocalPath\"", "\t\t\t\"Shuffle\"\t\t\"1\" // set in Steam\n\t\t\t\"LocalPath\""))
assertEquals(true, SessionFiles.startupMovieShuffle(file))
assertTrue(SessionFiles.setStartupMovieShuffle(file, false))
assertEquals(false, SessionFiles.startupMovieShuffle(file))
assertEquals(1, Regex("\"Shuffle\"").findAll(file.readText().substringAfter("Customization")).count())
assertTrue(file.readText().contains("\"0\" // set in Steam"))
}
}
@@ -0,0 +1,44 @@
package com.droiddeck.launcher.session
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
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 = [34], application = android.app.Application::class)
class SteamGpuCompositingTest {
private val context get() = RuntimeEnvironment.getApplication()
@Before fun clear() {
context.getSharedPreferences("session", 0).edit().clear().commit()
assertTrue(SessionPrefs.steamGpuCompositingAllowed())
}
@Test fun eligibleRendererUsesGpuCompositingByDefault() {
assertTrue(SessionPrefs.steamGpuCompositing(context))
}
@Test fun savedSoftwareChoiceIsPreserved() {
context.getSharedPreferences("session", 0).edit()
.putBoolean("steamGpuCompositing", false).commit()
assertFalse(SessionPrefs.steamGpuCompositing(context))
}
@Test fun savedGpuChoiceIsPreserved() {
context.getSharedPreferences("session", 0).edit()
.putBoolean("steamGpuCompositing", true).commit()
assertTrue(SessionPrefs.steamGpuCompositing(context))
}
@Test fun preferenceCanStillBeToggled() {
SessionPrefs.setSteamGpuCompositing(context, false)
assertFalse(SessionPrefs.steamGpuCompositing(context))
SessionPrefs.setSteamGpuCompositing(context, true)
assertTrue(SessionPrefs.steamGpuCompositing(context))
}
}
@@ -1,93 +0,0 @@
package com.droiddeck.launcher.stores.gog
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.session.SecondaryLibrary
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.stores.StoreInstallRoot
import java.io.File
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
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 = [33])
class GogInnoextractTest {
private val app get() = RuntimeEnvironment.getApplication()
@Before @After fun resetStorage() {
SessionPrefs.setDefaultStorageFolder(app, "", "")
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
}
private fun installer(folder: File, names: List<String>) = names.map { File(folder, it).apply { parentFile?.mkdirs(); writeText("MZ") } }
private fun hostOf(guest: String, binds: List<String>): File? = binds
.map { it.substringBeforeLast(':') to it.substringAfterLast(':') }
.filter { (_, mount) -> guest == mount || guest.startsWith("$mount/") }
.maxByOrNull { it.second.length }
?.let { (host, mount) -> File(host + guest.removePrefix(mount)) }
private fun assertExtractorSeesEveryPart(folder: File, parts: List<String>) {
val files = installer(folder, parts)
val guestDir = AddedGames.guestPath(app, folder)
assertNotNull(guestDir)
val argv = GogInnoextract.argv("$guestDir/${parts.first()}", guestDir!!)
assertEquals("$guestDir/${parts.first()}", argv.last())
assertEquals(guestDir, argv[argv.indexOf("-d") + 1])
assertTrue(argv.contains("--gog"))
val binds = StoreInstallRoot.guestBinds(app)
assertEquals(folder.canonicalFile, hostOf(guestDir, binds)?.canonicalFile)
for (file in files) assertEquals(file.canonicalFile, hostOf("$guestDir/${file.name}", binds)?.canonicalFile)
assertNull(hostOf("$guestDir/${parts.first()}", emptyList()))
}
@Test fun singleFileAndMultiPartInstallersOnAChosenFolderAreVisibleToTheExtractor() {
val drive = File(app.filesDir, "usb/SSD").apply { mkdirs() }
SessionPrefs.setDefaultStorageFolder(app, drive.path, "SSD")
val single = File(drive, "Games/GOG/Single")
assertTrue(AddedGames.guestPath(app, single)!!.startsWith(StoreInstallRoot.GUEST_EXTERNAL + "/"))
assertExtractorSeesEveryPart(single, listOf("setup_1207658930.exe"))
assertExtractorSeesEveryPart(File(drive, "Games/GOG/Multi Part"), listOf("setup_1207658931.exe", "setup_1207658931-1.bin", "setup_1207658931-2.bin"))
}
@Test fun installersOnTheGameStorageCardAreVisibleToTheExtractor() {
val card = File(app.filesDir, "card/steam").apply { mkdirs() }
SessionPrefs.setGameStorage(app, card.path, "Card")
val folder = File(card, "Games/GOG/Multi Part")
assertTrue(SecondaryLibrary.CARD_GUESTS.any { AddedGames.guestPath(app, folder)!!.startsWith("$it/") })
assertExtractorSeesEveryPart(folder, listOf("setup_1207658932.exe", "setup_1207658932-1.bin"))
}
@Test fun anUnpluggedGameStorageCardDoesNotStopAnInternalExtraction() {
SessionPrefs.setGameStorage(app, File(app.filesDir, "unplugged/steam").path, "Card")
val folder = File(StoreInstallRoot.internalRoot(app), "GOG/Internal")
installer(folder, listOf("setup_1207658933.exe"))
val binds = StoreInstallRoot.guestBinds(app)
assertTrue(binds.none { bind -> SecondaryLibrary.CARD_GUESTS.any { bind.endsWith(":$it") } })
assertTrue(AddedGames.guestPath(app, folder)!!.startsWith("/root/Games/Stores/GOG/"))
}
@Test fun anAddedFolderNamedStoresIsMountedWithoutHidingTheInternalInstallRoot() {
val drive = File(app.filesDir, "usb/Stores").apply { mkdirs() }
AddedGames.bindFolder(app, drive)
val guest = AddedGames.guestPath(app, drive)!!
assertTrue(guest != StoreInstallRoot.INTERNAL_GUEST && !guest.startsWith(StoreInstallRoot.INTERNAL_GUEST + "/"))
SessionPrefs.setDefaultStorageFolder(app, drive.path, "Stores")
val chosen = File(drive, "Games/GOG/Chosen")
assertTrue(AddedGames.guestPath(app, chosen)!!.startsWith("$guest/"))
assertExtractorSeesEveryPart(chosen, listOf("setup_1207658934.exe", "setup_1207658934-1.bin"))
val internal = File(StoreInstallRoot.internalRoot(app), "GOG/Internal")
installer(internal, listOf("setup_1207658935.exe"))
val internalGuest = AddedGames.guestPath(app, internal)!!
assertTrue(internalGuest.startsWith(StoreInstallRoot.INTERNAL_GUEST + "/GOG/"))
assertNull(hostOf("$internalGuest/setup_1207658935.exe", StoreInstallRoot.guestBinds(app)))
}
}
@@ -1,12 +1,10 @@
package com.droiddeck.launcher.stores.gog
import com.droiddeck.launcher.stores.StoreInstallRoot
import java.io.File
import java.io.IOException
import java.nio.file.Files
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertThrows
import org.junit.Assert.assertTrue
import org.junit.Test
@@ -85,97 +83,6 @@ class GogInstallerPartsTest {
}
}
private val gib = 1024L * 1024 * 1024
@Test fun anInstallerThatFitsOnlyBeforeExtractionIsRefusedBeforeItDownloads() {
val download = 1_048_576L + 17 * (7 * gib / 2)
val installed = 699 * gib / 10
val free = 944 * gib / 10
assertFalse(StoreInstallRoot.insufficientSpace(download, free))
val needed = GogDownloadManager.installerBytesNeeded(download, installed)
assertEquals(download + installed, needed)
assertTrue(StoreInstallRoot.insufficientSpace(needed, free))
}
@Test fun anInstallerThatFitsWithItsExtractedFilesIsAllowed() {
val download = 1_048_576L + 3_786_407_936L
assertFalse(StoreInstallRoot.insufficientSpace(GogDownloadManager.installerBytesNeeded(download, 6 * gib), 944 * gib / 10))
}
@Test fun anUnknownInstalledSizeKeepsTheDownloadOnlyCheck() {
val download = 1_048_576L + 3_786_407_936L
assertEquals(download, GogDownloadManager.installerBytesNeeded(download, 0L))
assertEquals(download, GogDownloadManager.installerBytesNeeded(download, -1L))
assertEquals(5 * gib, GogDownloadManager.installerBytesNeeded(0L, 5 * gib))
assertEquals(0L, GogDownloadManager.installerBytesNeeded(0L, -1L))
}
@Test fun aPartWithoutASizeStillCountsTheKnownBytesOfTheOthers() {
val parts = listOf(
GogDownloadManager.InstallerPart("u0", "setup.exe", 0L),
GogDownloadManager.InstallerPart("u1", "setup-1.bin", 60 * gib),
)
val needed = GogDownloadManager.installerBytesNeeded(GogDownloadManager.knownPartBytes(parts), 70 * gib)
assertEquals(130 * gib, needed)
assertTrue(StoreInstallRoot.insufficientSpace(needed, 95 * gib))
assertEquals(0L, GogDownloadManager.knownPartBytes(emptyList()))
}
private fun installDir(): File = Files.createTempDirectory("gog-parts").toFile()
@Test fun partsKeptFromACancelledInstallCountAsFreeSpaceOnRetry() {
val dir = installDir()
try {
File(dir, "setup.exe").writeBytes(ByteArray(1000))
File(dir, "setup-1.bin").writeBytes(ByteArray(500))
val parts = listOf(
GogDownloadManager.InstallerPart("u0", "setup.exe", 1000L),
GogDownloadManager.InstallerPart("u1", "setup-1.bin", 1000L),
)
val reclaimed = GogDownloadManager.reclaimableInstallerBytes(dir, parts)
assertEquals(1500L, reclaimed)
val needed = GogDownloadManager.installerBytesNeeded(GogDownloadManager.knownPartBytes(parts), 0L)
val free = 600L
assertTrue(StoreInstallRoot.insufficientSpace(needed, free))
assertFalse(StoreInstallRoot.insufficientSpace(needed, free + reclaimed))
} finally {
dir.deleteRecursively()
}
}
@Test fun aMissingPartOrADirectoryReclaimsNothing() {
val dir = installDir()
try {
File(dir, "folder.bin").mkdir()
val parts = listOf(
GogDownloadManager.InstallerPart("u0", "setup.exe", 1000L),
GogDownloadManager.InstallerPart("u1", "folder.bin", 1000L),
)
assertEquals(0L, GogDownloadManager.reclaimableInstallerBytes(dir, parts))
assertEquals(0L, GogDownloadManager.reclaimableInstallerBytes(dir, emptyList()))
} finally {
dir.deleteRecursively()
}
}
@Test fun aLinkedPartOrAnEscapingNameReclaimsNothing() {
val dir = installDir()
val outside = installDir()
try {
val target = File(outside, "big.bin").apply { writeBytes(ByteArray(4000)) }
Files.createSymbolicLink(File(dir, "setup.exe").toPath(), target.toPath())
File(dir.parentFile, "escape.bin").also { it.writeBytes(ByteArray(4000)); it.deleteOnExit() }
val parts = listOf(
GogDownloadManager.InstallerPart("u0", "setup.exe", 1000L),
GogDownloadManager.InstallerPart("u1", "../escape.bin", 1000L),
)
assertEquals(0L, GogDownloadManager.reclaimableInstallerBytes(dir, parts))
} finally {
dir.deleteRecursively()
outside.deleteRecursively()
}
}
@Test fun anotherPlatformOrNoDownloadsAddsNothing() {
assertEquals(0, GogDownloadManager.installerParts(downloads("""{"installers":[{"os":"linux","manualUrl":"https://example.invalid/x"}]}"""), "1").size)
assertEquals(0, GogDownloadManager.installerParts(downloads("{}"), "1").size)
@@ -229,6 +229,18 @@ class InputSurfaceTouchTest {
assertFalse(view.takesTouchAt(815f, 300f))
}
@Test fun shownElementsSkipSticksThatHideWhileIdleUntilTouched() {
val hidden = InputSurfaceElement(InputControl.LS, .3f, .3f, .2f, .4f, hideWhenIdle = true)
show(a, hidden, b)
assertEquals(listOf(a.id, b.id), view.shownElements().map { it.id })
touch(MotionEvent.ACTION_DOWN, 1 to (50f to 300f))
assertEquals(listOf(a.id, hidden.id, b.id), view.shownElements().map { it.id })
touch(MotionEvent.ACTION_UP, 1 to (50f to 300f))
assertEquals(listOf(a.id, b.id), view.shownElements().map { it.id })
show(a, hidden.copy(hideWhenIdle = false), b)
assertEquals(listOf(a.id, hidden.id, b.id), view.shownElements().map { it.id })
}
private fun element(root: View, id: String): View = descendants(root).first { (it.tag as? InputSurfaceElement)?.id == id }
private fun centre(target: View): Pair<Float, Float> {
var x = target.width / 2f
Loaded 100 of 143 files, more files were not shown because too many files have changed in this diff. Show more