mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adbd117437 | ||
|
|
bf76c6ab50 | ||
|
|
e0e41be40a | ||
|
|
469b354640 | ||
|
|
e6bf86f5b2 | ||
|
|
1d6959a9ec | ||
|
|
babcc271b7 | ||
|
|
46518cf21d | ||
|
|
f65e7a3d43 | ||
|
|
3d0c38c1d3 | ||
|
|
81e238b92e | ||
|
|
a20528c62b | ||
|
|
9b5d7870a3 | ||
|
|
b6391ed8c0 | ||
|
|
c7ff93ec19 | ||
|
|
1cada9ad50 | ||
|
|
9375ed0948 | ||
|
|
946e9c41e0 | ||
|
|
259d5d184b | ||
|
|
9a93f59fbf | ||
|
|
03812bb3b7 |
No files matched your search
@@ -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
@@ -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/
|
||||
@@ -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
@@ -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)
|
||||
}
|
||||
|
||||
Executable
+2
@@ -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()
|
||||
|
||||
@@ -130,6 +130,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
}
|
||||
|
||||
var restartBlocked: () -> Boolean = { SessionState.running }
|
||||
var onRouteChanged: () -> Unit = {}
|
||||
|
||||
fun loadTpUbwcMode() {
|
||||
tpUbwcMode = SessionPrefs.tpUbwcMode(activity)
|
||||
@@ -185,6 +186,7 @@ internal class DriverMenus(private val activity: Activity, private val ui: Handl
|
||||
runtimePending = sessionRunning && SessionState.runtimeDriver.let { it != null && it != linuxSelected }
|
||||
refreshReleaseRows()
|
||||
refreshPairs()
|
||||
onRouteChanged()
|
||||
}
|
||||
|
||||
fun summary(): String {
|
||||
|
||||
@@ -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)
|
||||
@@ -1198,6 +1199,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
drivers.restartBlocked = ::runtimeChangesBlocked
|
||||
drivers.onRouteChanged = { ui.post { refreshSteamGpuDrawing() } }
|
||||
drivers.loadTpUbwcMode()
|
||||
pendingSessionLogExport = savedInstanceState?.getString(KEY_PENDING_SESSION_LOG_EXPORT)?.let(::File)
|
||||
homeChoiceOpen = savedInstanceState?.getBoolean(STATE_HOME_CHOICE_OPEN) == true
|
||||
@@ -1455,15 +1457,20 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onRuntime = { onRuntimeButton() },
|
||||
onVkBridge = { on ->
|
||||
SessionPrefs.setVkBridge(this, on); SessionPrefs.setMaliFallbackByAuto(this, ""); vkBridge = on
|
||||
refreshSteamGpuDrawing()
|
||||
if (!on) com.droiddeck.launcher.session.ComponentsManager.settleAutoDxvk(this)
|
||||
},
|
||||
onVenus = { on ->
|
||||
SessionPrefs.setVenus(this, on)
|
||||
SessionPrefs.setMaliFallbackByAuto(this, "")
|
||||
venus = on
|
||||
refreshSteamGpuDrawing()
|
||||
if (on && !com.droiddeck.launcher.core.DeviceSupport.adreno()) Thread({
|
||||
com.droiddeck.launcher.gpu.VulkanInfo.query()["api"]?.let { SessionPrefs.setHostVulkanApi(this, it) }
|
||||
runOnUiThread { venusHostVulkan = com.droiddeck.launcher.session.VenusComponent.hostVulkanTooOld(this) }
|
||||
runOnUiThread {
|
||||
venusHostVulkan = com.droiddeck.launcher.session.VenusComponent.hostVulkanTooOld(this)
|
||||
refreshSteamGpuDrawing()
|
||||
}
|
||||
}, "venus-host-vulkan").start()
|
||||
},
|
||||
onVkBridgeSafe = { on -> SessionPrefs.setVkBridgeSafe(this, on); vkBridgeSafe = on },
|
||||
@@ -1525,8 +1532,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
gameDebugLogsNeedsRestart = gameDebugLogsNeedsRestart()
|
||||
},
|
||||
onSteamGpuDrawing = {
|
||||
SessionPrefs.setSteamGpuCompositing(this, !SessionPrefs.steamGpuCompositing(this))
|
||||
steamGpuDrawing = SessionPrefs.steamGpuCompositing(this)
|
||||
SessionPrefs.setSteamGpuCompositing(this, !SessionPrefs.steamGpuDrawingShown(this))
|
||||
refreshSteamGpuDrawing()
|
||||
},
|
||||
onGraphicsLogs = {
|
||||
SessionPrefs.setDetailedGraphicsLogs(this, !SessionPrefs.detailedGraphicsLogs(this))
|
||||
@@ -2551,6 +2558,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 +2620,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 +2958,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()
|
||||
@@ -3063,6 +3073,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun refreshSteamGpuDrawing() {
|
||||
steamGpuDrawing = SessionPrefs.steamGpuDrawingShown(this)
|
||||
}
|
||||
|
||||
private fun refresh() {
|
||||
val listX64 = SessionPrefs.activeSteamClientArch(this) == "x86_64"
|
||||
if (listX64 != steamGamesX64) {
|
||||
@@ -3094,7 +3108,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
agentCommands = com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(this)
|
||||
graphicsLogs = SessionPrefs.detailedGraphicsLogs(this)
|
||||
buildWatermark = SessionPrefs.buildWatermarkEnabled(this)
|
||||
steamGpuDrawing = SessionPrefs.steamGpuCompositing(this)
|
||||
refreshSteamGpuDrawing()
|
||||
bridgeFellBack = SessionPrefs.bridgeFellBack(this)
|
||||
bridgeFellBackMemory = SessionPrefs.bridgeFellBackForMemory(this)
|
||||
clearCachedApps = SessionPrefs.clearCachedApps(this)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4860,7 +4858,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
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()
|
||||
@@ -5386,7 +5385,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 +5746,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()
|
||||
@@ -6366,6 +6366,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"))
|
||||
}
|
||||
}
|
||||
@@ -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 }
|
||||
|
||||
@@ -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,9 +946,19 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("steamGpuCompositing", false).apply()
|
||||
return false
|
||||
}
|
||||
return prefs(context).getBoolean("steamGpuCompositing", false)
|
||||
return prefs(context).getBoolean("steamGpuCompositing", true)
|
||||
}
|
||||
|
||||
fun steamGpuDrawingShown(context: Context, systemDriverPath: Boolean = systemDriverSteamPath(context)): Boolean =
|
||||
steamGpuCompositing(context) && (!systemDriverPath || prefs(context).contains("steamGpuCompositing"))
|
||||
|
||||
fun steamGpuCompositingChosen(context: Context, mode: String): Boolean =
|
||||
mode == SessionService.MODE_STEAM && steamGpuDrawingShown(context, true)
|
||||
|
||||
fun systemDriverSteamPath(context: Context): Boolean =
|
||||
!com.droiddeck.launcher.core.DeviceSupport.vkBridge(context) && !VenusComponent.wanted(context) &&
|
||||
com.droiddeck.launcher.gpu.SystemVulkanDriver.usesDefault(linuxDriver(context))
|
||||
|
||||
fun steamGpuCompositingAllowed(): Boolean =
|
||||
!com.droiddeck.launcher.core.DeviceSupport.adreno() && !com.droiddeck.launcher.core.DeviceSupport.mali()
|
||||
|
||||
@@ -1229,6 +1246,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()
|
||||
|
||||
@@ -971,8 +971,9 @@ class SessionService : Service() {
|
||||
linuxDriverId,
|
||||
)
|
||||
val bridge = com.droiddeck.launcher.core.DeviceSupport.vkBridge(this)
|
||||
if (!bridge && !venus && SystemVulkanDriver.usesDefault(linuxDriverId)) {
|
||||
if (SessionPrefs.systemDriverSteamPath(this)) {
|
||||
SystemVulkanDriver.addEnvironment(this, guest)
|
||||
if (SessionPrefs.steamGpuCompositingChosen(this, SessionState.mode)) guest.add("BL_STEAM_GPU_COMPOSITING=1")
|
||||
}
|
||||
(if (bridge || venus) null else LinuxVulkanDriver.resolveIcdPath(this, linuxDriverId))
|
||||
?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) }
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -117,4 +117,52 @@ class DriverMenusAutoTest {
|
||||
menus.refreshDrivers()
|
||||
assertTrue(menus.tpUbwcRestartRequired())
|
||||
}
|
||||
|
||||
private fun menusRecordingRouteChanges(activity: Activity, seen: MutableList<String>) =
|
||||
DriverMenus(activity, Handler(Looper.getMainLooper())).also {
|
||||
it.onRouteChanged = { seen += SessionPrefs.linuxDriver(activity) + "|" + SessionPrefs.androidDriver(activity) }
|
||||
}
|
||||
|
||||
@Test fun selectingALinuxDriverReportsTheRouteAfterItIsSaved() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MIX)
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).selectDriver("chosen-linux", linux = true)
|
||||
assertEquals("chosen-linux", seen.last().substringBefore("|"))
|
||||
}
|
||||
|
||||
@Test fun selectingTheSystemRuntimeReportsTheRouteAfterItIsSaved() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MIX)
|
||||
SessionPrefs.setLinuxDriver(activity, "chosen-linux")
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).selectDriver("", linux = true)
|
||||
assertEquals("", seen.last().substringBefore("|"))
|
||||
}
|
||||
|
||||
@Test fun selectingADisplayDriverReportsTheRouteAfterItIsSaved() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MIX)
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).selectDriver("chosen-display", linux = false)
|
||||
assertEquals("chosen-display", seen.last().substringAfter("|"))
|
||||
}
|
||||
|
||||
@Test fun pickingTheAutoDisplayReportsTheRouteAfterAutoOwnsIt() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MIX)
|
||||
SessionPrefs.setLinuxDriver(activity, "chosen-linux")
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).selectDriver(TurnipDriver.AUTO, linux = false)
|
||||
assertEquals("|${QuestExperimental.DRIVER}", seen.last())
|
||||
}
|
||||
|
||||
@Test fun turningAutoOnReportsTheRouteAutoChose() {
|
||||
val activity = Robolectric.buildActivity(Activity::class.java).setup().get()
|
||||
SessionPrefs.setGpuDriverMode(activity, SessionPrefs.GPU_DRIVERS_MANUAL)
|
||||
SessionPrefs.setLinuxDriver(activity, "chosen-linux")
|
||||
val seen = mutableListOf<String>()
|
||||
menusRecordingRouteChanges(activity, seen).setMode(true)
|
||||
assertEquals("|${QuestExperimental.DRIVER}", seen.last())
|
||||
}
|
||||
}
|
||||
@@ -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))))
|
||||
|
||||
@@ -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))) }
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.droiddeck.launcher.gpu
|
||||
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
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 SteamGpuDrawingRouteTest {
|
||||
private val context get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
@Before fun clear() {
|
||||
context.getSharedPreferences("session", 0).edit().clear().commit()
|
||||
}
|
||||
|
||||
@Test fun selectingTheSystemDriverFlipsTheUntouchedRowToSoftware() {
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "")))
|
||||
}
|
||||
|
||||
@Test fun selectingAnOpenDriverFlipsTheUntouchedRowToGpu() {
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "custom-driver")))
|
||||
}
|
||||
|
||||
@Test fun otherGpusKeepTheGpuRowWhateverDriverIsSelected() {
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(false, "")))
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(false, "custom-driver")))
|
||||
}
|
||||
|
||||
@Test fun savedChoiceSurvivesDriverRouteChanges() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, false)
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "")))
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "custom-driver")))
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "")))
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, SystemVulkanDriver.usesDefault(true, "custom-driver")))
|
||||
}
|
||||
}
|
||||
@@ -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,97 @@
|
||||
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))
|
||||
}
|
||||
|
||||
@Test fun untouchedPreferenceIsNotAChoice() {
|
||||
assertFalse(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_STEAM))
|
||||
}
|
||||
|
||||
@Test fun savedGpuChoiceIsAChoice() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertTrue(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_STEAM))
|
||||
}
|
||||
|
||||
@Test fun savedSoftwareChoiceIsNotChosenGpu() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, false)
|
||||
assertFalse(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_STEAM))
|
||||
}
|
||||
|
||||
@Test fun desktopSessionNeverReceivesChosenGpuCompositing() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertFalse(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_DESKTOP))
|
||||
}
|
||||
|
||||
@Test fun runSessionNeverReceivesChosenGpuCompositing() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertFalse(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_RUN))
|
||||
}
|
||||
|
||||
@Test fun untouchedPreferenceShowsSoftwareOnSystemDriverPath() {
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, true))
|
||||
}
|
||||
|
||||
@Test fun untouchedPreferenceShowsGpuOnOpenDriverPath() {
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, false))
|
||||
}
|
||||
|
||||
@Test fun savedGpuChoiceIsShownOnBothPaths() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, true)
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, true))
|
||||
assertTrue(SessionPrefs.steamGpuDrawingShown(context, false))
|
||||
}
|
||||
|
||||
@Test fun savedSoftwareChoiceIsShownOnBothPaths() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, false)
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, true))
|
||||
assertFalse(SessionPrefs.steamGpuDrawingShown(context, false))
|
||||
}
|
||||
|
||||
@Test fun firstToggleFromUntouchedSystemDriverRowSavesGpu() {
|
||||
SessionPrefs.setSteamGpuCompositing(context, !SessionPrefs.steamGpuDrawingShown(context, true))
|
||||
assertTrue(SessionPrefs.steamGpuCompositingChosen(context, SessionService.MODE_STEAM))
|
||||
}
|
||||
|
||||
@Test fun systemDriverPathIsOffOnDevicesWithoutThePowerVrDriver() {
|
||||
assertFalse(SessionPrefs.systemDriverSteamPath(context))
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,18 @@ and reports every run.
|
||||
works on every display and window. UI Automator, by contrast, dumps whichever window has focus,
|
||||
which on a dual-screen device is often another app's.
|
||||
|
||||
## On the device
|
||||
|
||||
The agent in DroidDeck's Agent tab gets its working rules from `tools/agent/AGENTS.md` and its
|
||||
skills from `tools/agent/skills`. Both ship in the APK; before every turn the app writes the rules
|
||||
as a marked block into each harness's global instructions (`~/.claude/CLAUDE.md`,
|
||||
`~/.codex/AGENTS.md`) and the skills into its skills folder (`~/.claude/skills`, `~/.codex/skills`).
|
||||
Only DroidDeck's own block and skills (folders holding a `.droiddeck` file) are replaced: rules
|
||||
the user writes outside the block, and skills they add, stay. A symlinked instructions file is
|
||||
followed, so the block lands in the file it points to. `droiddeckctl`, `droiddeck-scenario` and this guide are installed in
|
||||
`~/.local/share/droiddeck/ctl` (with `droiddeckctl` and `droiddeck-scenario` on PATH). If any of
|
||||
these cannot be installed, the Agent tab shows which.
|
||||
|
||||
## Access
|
||||
|
||||
Player controls and observations work over authorized ADB on any build: `state`, `start`, `stop`,
|
||||
|
||||
@@ -4,7 +4,9 @@ Settings → Boot movie has four tabs.
|
||||
|
||||
- **Installed**: "Browse" lists every movie Steam can play: DroidDeck's two, plus every `.webm` in Steam's
|
||||
`config/uioverrides/movies` folder (imported, installed from SteamDeckRepo, or put there by Steam). The list is re-read
|
||||
every two seconds, so a movie picked or removed inside Steam shows up, and a movie picked inside Steam becomes the choice.
|
||||
every two seconds, so a movie picked or removed inside Steam shows up, and a movie picked inside Steam becomes the choice. The Shuffle switch is Steam's own `Shuffle` setting (`startup_movie_shuffle` in
|
||||
Steam's client settings, `Shuffle` next to `MovieID` and `LocalPath`): it is written at the next session start, a change made in Steam is
|
||||
taken over, and with it off the selected movie plays as before.
|
||||
- **Import**: the same importer as before (copy, remux or on-device transcode to VP8/Opus). The result is written into
|
||||
Steam's movies folder, so Steam lists it as well.
|
||||
- **SteamDeckRepo**: browses `https://steamdeckrepo.com/api/posts` (`sort`, `device`, `search`, `page`; 12 posts a page).
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
# DroidDeck on-device agent
|
||||
|
||||
You run in DroidDeck's Agent tab, on the user's handheld, in DroidDeck's Linux userland (Ubuntu
|
||||
under proot, aarch64). The user is often on a small screen: keep replies short. These notes come
|
||||
from what tripped agents up on real devices.
|
||||
|
||||
## Where you run
|
||||
|
||||
- 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 it with `droiddeckctl` (guide:
|
||||
`/root/.local/share/droiddeck/ctl/agent-control.md`): `state`, `start steam`, `stop`, `launch`,
|
||||
`quit`, `focus`, `screenshot`, `logs`, `pacing`, `thermal`, and `guest` to run a command in it.
|
||||
- `droiddeckctl stop`, `start steam` and `resume` end or restart only the session. You keep
|
||||
running, so restart it yourself when a change needs a new session.
|
||||
- The session shares your filesystem. Steam is in `/root/.local/share/Steam` (its logs in
|
||||
`logs/`), and the session's live logs are in the folder `state` gives as `session.logDir`.
|
||||
`logs latest` makes a redacted, partial copy: read the live folder yourself. X properties,
|
||||
gamescope and the session's processes are only reachable through `guest`.
|
||||
|
||||
## Commands
|
||||
|
||||
- `guest` runs one program, not a shell line: `droiddeckctl guest -- sh -c '...'` for pipes,
|
||||
`$(...)` or `DISPLAY=:0 xprop ...`. Its answer is JSON; the output is in `stdout.text`.
|
||||
- `screenshot` takes the path as an argument (`screenshot /tmp/top.png --display 0`); on a
|
||||
dual-screen device see `droiddeckctl displays`. `prefs get` takes a file (`prefs get session`).
|
||||
- `input` drives a game session that has drawn a frame. For the launcher's own screens use
|
||||
`adb -s $ADB_SERIAL shell input keyevent KEYCODE_BACK` and similar.
|
||||
- `droiddeck-scenario` replays a scripted test through `droiddeckctl` (`--help` for the format).
|
||||
- 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 after checking what it is
|
||||
(`ps -o pid,args -p <pid>`): a pid near a game can be the Steam client.
|
||||
- `DEVICE_RESOLUTION_FAILED`: run `adb devices` and use the serial it lists.
|
||||
- Do not chain `sleep` before a check. Start long work in the background. In Claude Code, its end
|
||||
starts you again; other harnesses are not woken, so check it before ending your turn or tell the
|
||||
user it is still running.
|
||||
|
||||
## What applies when
|
||||
|
||||
- Many session settings (black frame insertion, environment, Proton) are read when a session or
|
||||
game starts. After changing one, restart the game or the session before judging it.
|
||||
- With "Return after game" on (the default), quitting a game DroidDeck launched ends the whole
|
||||
session; `start steam --wait --reuse` before the next launch. Launching a game that is already
|
||||
running makes Steam show "Game already running" and `launch` time out.
|
||||
- Session scripts are APK assets, copied into the rootfs at every session start over any local
|
||||
edit. A Lab build (`dd-lab-build`, see `docs/lab-builds.md`) carries app code and resources only:
|
||||
session scripts, native code and assets need a new APK, such as the pull request's CI test build
|
||||
(DroidDeck > Updates > Test builds).
|
||||
|
||||
## Changing DroidDeck
|
||||
|
||||
The source is checked out at `/root/DroidDeck` once the Agent tab's build tools are set up.
|
||||
|
||||
- It often holds the user's uncommitted work and a stale local `main`. Branch from `origin/main`
|
||||
in a worktree (`git worktree add -b <branch> ../<dir> origin/main`).
|
||||
- `dd-lab-build` builds the checkout as a Lab build and restarts DroidDeck on it. DroidDeck runs the
|
||||
build in a process of its own and shows its progress; `dd-lab-build` follows its log. Run it in
|
||||
the background and keep checking, so the user can talk to you meanwhile. The restart ends your
|
||||
process, and the conversation continues on the new build.
|
||||
- Python tests run from the repository root: `python3 -m unittest tools.tests.test_x`. Some fail on
|
||||
the device on `origin/main` too; run them on a worktree of `origin/main` before blaming a change.
|
||||
- Gradle unit tests rarely run on the device. Leave them to CI and say so rather than retrying.
|
||||
- If `git push` asks for credentials, run `gh auth setup-git` once.
|
||||
- Commits and pull requests you make are the user's own: no co-author line, AI credit or
|
||||
generated-by note.
|
||||
|
||||
## This file
|
||||
|
||||
DroidDeck writes this block into your global instructions (`~/.claude/CLAUDE.md`,
|
||||
`~/.codex/AGENTS.md`) before every turn, and its skills into `~/.claude/skills` and
|
||||
`~/.codex/skills`. It replaces only its own block and its own skills (folders holding a `.droiddeck` file): the
|
||||
user's rules go outside the block, and their skills stay, even one with the same name. Deleting a
|
||||
skill's `.droiddeck` file keeps local edits to it. To change DroidDeck's, edit `tools/agent/AGENTS.md` and
|
||||
`tools/agent/skills` in the source.
|
||||
@@ -19,6 +19,9 @@ for arg in "$@"; do
|
||||
--no-restart) mode=no-restart ;;
|
||||
--prepare) mode=prepare ;;
|
||||
--explain) explain=(--info -Pkotlin.build.report.output=file) ;;
|
||||
# Anything else used to start a full build and restart the app, --help included.
|
||||
-h|--help) sed -n '2,6s/^# \{0,1\}//p' "$0"; exit 0 ;;
|
||||
*) echo "dd-lab-build: unknown option $arg (see --help)" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
started=$(date +%s)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: diagnose-game
|
||||
description: Find why a game crashed, hung or ran badly in DroidDeck, from session state and logs
|
||||
---
|
||||
|
||||
1. `droiddeckctl state`: `session.phase`, `session.failure`, `session.focus.focusedApp` (769 is
|
||||
Steam's own UI) and `session.logDir`.
|
||||
2. Read that log folder directly; it is on your filesystem. Earlier sessions are its siblings:
|
||||
`ls -t "$(dirname <logDir>)"`; the crash may be in the one before a restart. `logs latest`
|
||||
makes a redacted, partial copy with renamed files: use it only to hand logs to someone.
|
||||
- `games/<time>-<id>-<appid>/`, one folder per launch: `launch.txt` (exe, Proton, environment)
|
||||
and `steam-<appid>.log` (Proton and Wine).
|
||||
- `session.log` (the session script, `== ` lines), `wayland.log` (compositor), `app.log`,
|
||||
`events.jsonl`, `crash.log` (Android's crash buffer at session end), `memory-pressure.log`
|
||||
(low-memory kills), `graphics-report.txt`, `vulkan-summary.txt`, `steam/` (client logs).
|
||||
- The game's own log is in its prefix,
|
||||
`/root/.local/share/Steam/steamapps/compatdata/<appid>/pfx/drive_c/users/steamuser/`:
|
||||
Unity writes `AppData/LocalLow/<company>/<game>/Player.log`, Unreal
|
||||
`AppData/Local/<game>/Saved/Logs/`.
|
||||
3. Find the fatal error, not the first `err:`. Every run logs harmless ones (`err:nsi` bind
|
||||
errno 13, `err:hid`, `winebth`, `tabtip`, `overriding CPU configuration`), and `trace:seh`
|
||||
first-chance exceptions are often handled. Look for the last exception before the process ends:
|
||||
`grep -nE "EXCEPTION_ACCESS_VIOLATION|Unhandled exception|virtual_setup_exception|DEVICE_LOST|VK_ERROR" steam-<appid>.log`.
|
||||
Same address in every launch means a deterministic fault; compare with an older launch that
|
||||
worked before blaming a line.
|
||||
4. For performance, `droiddeckctl pacing --seconds 20` (`fpsOnScreen`, `offCadencePercent`) and
|
||||
`droiddeckctl thermal`: at `SEVERE` or worse the device is throttling, so say that first.
|
||||
5. Explain the cause in plain words with the lines that show it (file and line number). Propose
|
||||
the smallest reversible change and ask before applying it:
|
||||
- Proton for one game: list `/root/.local/share/Steam/compatibilitytools.d` and
|
||||
`steamapps/common/Proton*`, then
|
||||
`droiddeckctl cdp eval 'SteamClient.Apps.SpecifyCompatTool(<appid>, "<tool dir name>")'`;
|
||||
check `CompatToolMapping` in `config/config.vdf`.
|
||||
- Launch options for one game: read them first,
|
||||
`droiddeckctl cdp eval 'appDetailsStore.GetAppDetails(<appid>)?.strLaunchOptions'`, keep
|
||||
them, then `SteamClient.Apps.SetAppLaunchOptions(<appid>, "VAR=1 %command%")`.
|
||||
- For every game: `droiddeckctl env set KEY=VALUE` applies to the next session only
|
||||
(`--persistent` keeps it); restart the session with `droiddeckctl stop` and `start steam`.
|
||||
6. Relaunch and read the new launch folder before saying it is fixed. If Steam stays on
|
||||
"Stopping", `droiddeckctl quit <appid>`, then look for leftover Wine processes with
|
||||
`droiddeckctl guest -- sh -c 'ps -eo pid,args | grep -i wine'`; never kill the Steam client.
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: reproduce-with-input
|
||||
description: Reproduce a reported game problem by launching the game and driving controller input
|
||||
---
|
||||
|
||||
1. `droiddeckctl state` first. If the game already has focus, do not launch it again: Steam shows
|
||||
"Game already running" and `launch` times out. With no session, `droiddeckctl start steam --wait`.
|
||||
Then `droiddeckctl launch <appid> --wait` and `droiddeckctl wait focused <appid> --timeout 180`.
|
||||
Check `droiddeckctl thermal` too: at `SEVERE` or worse, performance results mean little.
|
||||
2. Look before acting: `droiddeckctl screenshot ./shot.png --display 0`, then read the image. On the
|
||||
Retroid Pocket Duo the top screen is display 0 and the bottom is 2 (`droiddeckctl displays`).
|
||||
A game shows black or loading frames for a while after it takes focus; take another shot a few
|
||||
seconds later before calling it a black screen.
|
||||
3. Drive it with `droiddeckctl input`: `pad a` (also `b x y lb rb start select l3 r3 guide qam`
|
||||
and the D-pad `up down left right`; `--hold` in ms), `stick left 0 -1 --hold 800`,
|
||||
`trigger right 1.0`, `key ENTER`, `text 'hello'`. Input goes to the game window that has
|
||||
focus once the session has drawn a frame. The launcher's own screens need
|
||||
`adb -s $ADB_SERIAL shell input keyevent ...` instead. Take a screenshot after each step that
|
||||
should change the screen.
|
||||
4. Measure: `droiddeckctl pacing --seconds 20` (`fpsOnScreen`, `offCadencePercent`). For flicker
|
||||
or stutter a still cannot show, `droiddeckctl record ./clip.mp4 --seconds 8 --display 0`.
|
||||
5. Make it replayable: write the steps as a scenario and run it with `droiddeck-scenario`
|
||||
(installed beside `droiddeckctl`); `--help` documents the format. Give screenshot steps a display:
|
||||
|
||||
```json
|
||||
{"name": "nfs-menu", "vars": {"appId": 47870}, "repeat": 1,
|
||||
"before": [["start", "steam", "--wait", "--reuse", "--timeout", "240"]],
|
||||
"steps": [["launch", "${appId}", "--wait"],
|
||||
["wait", "focused", "${appId}", "--timeout", "180"],
|
||||
{"sleep": 20}, ["input", "pad", "a"], {"sleep": 3},
|
||||
{"screenshot": "after-a", "display": 0},
|
||||
["pacing", "--seconds", "10"], {"assert": "fpsOnScreen", "exists": true}],
|
||||
"after": [["quit", "${appId}"]]}
|
||||
```
|
||||
|
||||
`droiddeck-scenario nfs-menu.json --out ./runs` writes `report.json` and, for a failed
|
||||
run, a screenshot, focus and logs.
|
||||
6. Report the steps that reproduce it and what you saw at each. Quit the game with
|
||||
`droiddeckctl quit <appid>` unless the user is playing it. With "Return after game" on (the
|
||||
default), quitting a game DroidDeck launched also ends the session, so `start steam` again
|
||||
before the next launch.
|
||||
@@ -433,7 +433,7 @@ if [[ "${DROIDDECK_SKIP_RUST:-0}" != 1 ]]; then
|
||||
CARGO_TARGET_DIR="${cache_dir}/ubisoft-target" bash tools/ubisoft-launcher/build.sh "${upc_out}"
|
||||
save_step ubisoft "${upc_key}" "${upc_out}"
|
||||
fi
|
||||
rockstar_out="${repo_root}/app/src/main/resources/rockstar/helpers"
|
||||
rockstar_out="${linuxfs_dir}/usr/local/lib/droiddeck-rockstar"
|
||||
rockstar_key=$(inputs_hash "windows-gnu" tools/rockstar-launcher/src tools/rockstar-launcher/Cargo.toml tools/rockstar-launcher/Cargo.lock tools/rockstar-launcher/build.sh)
|
||||
if ! restore_step rockstar "${rockstar_key}" "${rockstar_out}"; then
|
||||
command -v i686-w64-mingw32-gcc >/dev/null 2>&1 || { echo "i686-w64-mingw32-gcc is required for the Rockstar launcher service." >&2; exit 1; }
|
||||
|
||||
@@ -16,7 +16,7 @@ if grep -qxE '__gxx_personality_v0|__cxa_throw|_Unwind_Resume' <<<"$FAKE"; then
|
||||
echo "::error::libfakeinput.so exports the C++ runtime"; exit 1
|
||||
fi
|
||||
SESSION=$(syms "$D/libblsession.so")
|
||||
for sym in socket bind getsockname setsockopt statfs statvfs syscall shm_open shm_unlink mmap mmap64 munmap drmPrimeFDToHandle drmCloseBufferHandle; do
|
||||
for sym in socket bind getsockname setsockopt statfs statvfs syscall shm_open shm_unlink mmap mmap64 munmap mprotect drmPrimeFDToHandle drmCloseBufferHandle; do
|
||||
grep -qx "$sym" <<<"$SESSION" || { echo "::error::libblsession.so does not export $sym"; exit 1; }
|
||||
done
|
||||
if grep -qx drmIoctl <<<"$SESSION"; then
|
||||
|
||||
@@ -125,9 +125,15 @@ if [ "$(cat /usr/share/droiddeck/kwin-compositor 2>/dev/null)" = opengl ]; then
|
||||
chmod 755 /run/droiddeck/kwin/kwin_wayland
|
||||
export PATH=/run/droiddeck/kwin:$PATH
|
||||
fi
|
||||
if /usr/local/bin/droiddeck-pipewire start; then
|
||||
eval "$(/usr/local/bin/droiddeck-pipewire env)"
|
||||
else
|
||||
echo "== pipewire: not running; screen capture has no picture"
|
||||
fi
|
||||
echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY"
|
||||
dbus-run-session -- startplasma-wayland
|
||||
rc=$?
|
||||
/usr/local/bin/droiddeck-pipewire stop
|
||||
echo "== droiddeck-desktop: Plasma ended ($rc)"
|
||||
if [ "$rc" -eq 0 ] && [ -z "${BL_BOTTOM_DESKTOP:-}" ]; then
|
||||
/usr/local/bin/droiddeck-steam-launch bigpicture
|
||||
|
||||
@@ -20,9 +20,14 @@ unpack() {
|
||||
{ rm -rf "$dir.new"; echo "droiddeck-pipewire: could not unpack $bundle" >&2; return 1; }
|
||||
}
|
||||
|
||||
write_fragment() {
|
||||
tmp=$1.$$
|
||||
cat > "$tmp" && mv -f "$tmp" "$1" || { rm -f "$tmp"; return 1; }
|
||||
}
|
||||
|
||||
access_config() {
|
||||
mkdir -p "$dir/share/pipewire/pipewire.conf.d" "$dir/share/wireplumber/wireplumber.conf.d" || return 1
|
||||
cat > "$dir/share/pipewire/pipewire.conf.d/droiddeck-access.conf" <<'EOF' || return 1
|
||||
write_fragment "$dir/share/pipewire/pipewire.conf.d/droiddeck-access.conf" <<'EOF' || return 1
|
||||
context.properties = {
|
||||
module.access = false
|
||||
}
|
||||
@@ -34,7 +39,7 @@ context.modules = [
|
||||
}
|
||||
]
|
||||
EOF
|
||||
cat > "$dir/share/wireplumber/wireplumber.conf.d/droiddeck-access.conf" <<'EOF' || return 1
|
||||
write_fragment "$dir/share/wireplumber/wireplumber.conf.d/droiddeck-access.conf" <<'EOF' || return 1
|
||||
access.rules = [
|
||||
{
|
||||
matches = [ { pipewire.access = "unrestricted" } ]
|
||||
@@ -54,8 +59,12 @@ env)
|
||||
client_env
|
||||
;;
|
||||
start)
|
||||
unpack || exit 1
|
||||
access_config || { echo "droiddeck-pipewire: could not write the access settings" >&2; exit 1; }
|
||||
mkdir -p "$(dirname "$dir")" 2>/dev/null
|
||||
(
|
||||
flock 9 || exit 1
|
||||
unpack || exit 1
|
||||
access_config || { echo "droiddeck-pipewire: could not write the access settings" >&2; exit 1; }
|
||||
) 9> "$dir.lock" || exit 1
|
||||
stop
|
||||
mkdir -p "$state"
|
||||
eval "$(client_env)"
|
||||
|
||||
@@ -1279,6 +1279,33 @@ case $mode in
|
||||
pv=${pv# }
|
||||
pv=${pv:-$2}
|
||||
}
|
||||
# Steam logs its saved Scaling Mode and Filter at startup but does not
|
||||
# write them to gamescope until they are changed in the QAM, so a saved
|
||||
# Fill shows in the menu while the game stays on Auto. Replay the values
|
||||
# it logged since it last started, once, if gamescope has none yet.
|
||||
scaling_restored=
|
||||
restore_steam_scaling() {
|
||||
local log="$steam_root/logs/systemperfmanager.txt" mode= filter= v
|
||||
[ -n "$scaling_restored" ] && return 0
|
||||
scaling_restored=1
|
||||
xprop -root GAMESCOPE_NEW_SCALING_SCALER 2>/dev/null | grep -q '= ' && return 0
|
||||
[ -f "$log" ] || return 0
|
||||
while read -r v; do
|
||||
case $v in
|
||||
client*) mode= filter= ;;
|
||||
mode\ *) mode=${v#mode } ;;
|
||||
filter\ *) filter=${v#filter } ;;
|
||||
esac
|
||||
done < <(sed -n 's/.*\] Client version:.*/client/p; s/.*\] Set scaling mode: \([0-9]*\).*/mode \1/p; s/.*\] Set scaling filter: \([0-9]*\).*/filter \1/p' "$log")
|
||||
case $mode in [1-5]) bl_xprop_set_all GAMESCOPE_NEW_SCALING_SCALER $((mode - 1)) \
|
||||
&& echo "== scaling: applied the client's saved scaling mode $mode" ;; esac
|
||||
case $filter in
|
||||
1) v=0 ;; 2) v=1 ;; 3) v=2 ;; *) v= ;;
|
||||
esac
|
||||
[ -n "$v" ] && bl_xprop_set_all GAMESCOPE_NEW_SCALING_FILTER "$v" \
|
||||
&& echo "== scaling: applied the client's saved scaling filter $filter"
|
||||
return 0
|
||||
}
|
||||
tmode= app= prev=
|
||||
while read -r line; do
|
||||
case $line in
|
||||
@@ -1297,6 +1324,7 @@ case $mode in
|
||||
printf '%s\n' "$app" > "$BL_LAUNCH_DIR/steam-focused-app.tmp" && mv -f "$BL_LAUNCH_DIR/steam-focused-app.tmp" "$BL_LAUNCH_DIR/steam-focused-app"
|
||||
fi
|
||||
fi
|
||||
case $pv in ''|0|769|*[!0-9]*) ;; *) restore_steam_scaling ;; esac
|
||||
[ "$restore" = 1 ] || continue
|
||||
case $pv in ''|*[!0-9]*) prev=; continue ;; esac
|
||||
if [ "$prev" = 769 ] && [ "$pv" != 769 ]; then
|
||||
@@ -1463,8 +1491,12 @@ case $mode in
|
||||
bl_steam_path="/usr/local/libexec/droiddeck-steam:$PATH"
|
||||
export DISABLE_GAMESCOPE_WSI=1 LIBGL_KOPPER_DISABLE=true
|
||||
bl_steam_angle=gl
|
||||
bl_steam_presentation=(-cef-disable-gpu-compositing)
|
||||
echo "== steam: system PowerVR uses OpenGL/DRI3 through Zink with software CEF compositing"
|
||||
if [ "${BL_STEAM_GPU_COMPOSITING:-0}" = 1 ]; then
|
||||
echo "== steam: system PowerVR uses OpenGL/DRI3 through Zink with GPU CEF compositing"
|
||||
else
|
||||
bl_steam_presentation=(-cef-disable-gpu-compositing)
|
||||
echo "== steam: system PowerVR uses OpenGL/DRI3 through Zink with software CEF compositing"
|
||||
fi
|
||||
elif [ "${BL_STEAM_SOFT_COMPOSITING:-}" = 1 ]; then
|
||||
bl_steam_presentation=(-cef-disable-gpu-compositing)
|
||||
echo "== steam: open driver pair - software CEF compositing, GPU raster"
|
||||
|
||||
@@ -314,6 +314,7 @@ UBISOFT_DIR = "drive_c/Program Files (x86)/Ubisoft/Ubisoft Game Launcher"
|
||||
UBISOFT_WINDOWS_DIR = "C:\\Program Files (x86)\\Ubisoft\\Ubisoft Game Launcher\\"
|
||||
UBISOFT_INSTALLER_URL = "https://static3.cdn.ubi.com/orbit/launcher_installer/UbisoftConnectInstaller.exe"
|
||||
ROCKSTAR_SERVICE = Path("/usr/local/lib/droiddeck-rockstar")
|
||||
SERVICE_WAIT = 300.0
|
||||
ROCKSTAR_FOLDER = "drive_c/Program Files/Rockstar Games/Launcher"
|
||||
ROCKSTAR_TITLES = {"gta3": "Grand Theft Auto III", "gtavc": "Grand Theft Auto: Vice City", "gtasa": "GTA: San Andreas",
|
||||
"gta4": "Grand Theft Auto IV", "lanoire": "LANoireMTL"}
|
||||
@@ -446,6 +447,15 @@ def rockstar_runtime(folder, exe, compat_data, arch):
|
||||
return "installed"
|
||||
|
||||
|
||||
def fetch_service(service, store, launch_dir, ask_app=None):
|
||||
if service.is_file():
|
||||
return True
|
||||
if not launch_dir:
|
||||
return False
|
||||
answer = (ask_app or ask)(Path(launch_dir) / "stores", {"op": "store-service", "store": store}, timeout=SERVICE_WAIT)
|
||||
return isinstance(answer, dict) and bool(answer.get("ok")) and service.is_file()
|
||||
|
||||
|
||||
def prepare_rockstar(folder, sidecar, compat_data, launch_dir, proton="", ask_app=None):
|
||||
if not compat_data:
|
||||
return "no-prefix"
|
||||
@@ -481,7 +491,7 @@ def prepare_rockstar(folder, sidecar, compat_data, launch_dir, proton="", ask_ap
|
||||
if len(signature) != 6 or signature[:4] != b"PE\0\0" or signature[4:] not in (b"\x4c\x01", b"\x64\x86"):
|
||||
return "invalid-game-exe"
|
||||
service = ROCKSTAR_SERVICE / ("Launcher32.exe" if signature[4:] == b"\x4c\x01" else "Launcher64.exe")
|
||||
if not service.is_file():
|
||||
if not fetch_service(service, "rockstar", launch_dir, ask_app):
|
||||
return "no-service"
|
||||
made = "present" if (Path(compat_data) / "pfx/user.reg").is_file() else create_prefix(compat_data, proton)
|
||||
if made not in ("created", "present"):
|
||||
@@ -723,7 +733,7 @@ def prepare_ubisoft(folder, sidecar, compat_data, launch_dir, proton="", ask_app
|
||||
product = ubisoft_product(sidecar)
|
||||
if product is None:
|
||||
return "no-product"
|
||||
if not UBISOFT_SERVICE.is_file():
|
||||
if not fetch_service(UBISOFT_SERVICE, "ubisoft", launch_dir, ask_app):
|
||||
return "no-service"
|
||||
made = create_prefix(compat_data, proton) if not (Path(compat_data) / "pfx/user.reg").is_file() else "present"
|
||||
if made not in ("present", "created"):
|
||||
|
||||
@@ -409,6 +409,10 @@ def launch(command, env):
|
||||
owned_env.pop(name, None)
|
||||
if reply.get('playfab'):
|
||||
owned_env['XODUS_XSTS_PLAYFAB'] = reply['playfab']
|
||||
# The runtime mounts DLC only inside this backend-owned workspace (E_NOTIMPL without it).
|
||||
mount_root = reply.get('mountRoot')
|
||||
if isinstance(mount_root, str) and mount_root.startswith('/'):
|
||||
owned_env['XODUS_MOUNT_ROOT'] = 'Z:' + mount_root.replace('/', '\\')
|
||||
content = folder / '.xbox-content'
|
||||
roots = []
|
||||
if content.is_dir():
|
||||
|
||||
@@ -30,6 +30,10 @@ static int is_lock_command(int cmd) {
|
||||
switch (cmd) {
|
||||
case F_SETLK:
|
||||
case F_SETLKW:
|
||||
#if defined(F_SETLK64) && F_SETLK64 != F_SETLK
|
||||
case F_SETLK64:
|
||||
case F_SETLKW64:
|
||||
#endif
|
||||
#ifdef F_OFD_SETLK
|
||||
case F_OFD_SETLK:
|
||||
#endif
|
||||
@@ -45,6 +49,9 @@ static int is_lock_command(int cmd) {
|
||||
static int is_lock_query(int cmd) {
|
||||
switch (cmd) {
|
||||
case F_GETLK:
|
||||
#if defined(F_GETLK64) && F_GETLK64 != F_GETLK
|
||||
case F_GETLK64:
|
||||
#endif
|
||||
#ifdef F_OFD_GETLK
|
||||
case F_OFD_GETLK:
|
||||
#endif
|
||||
@@ -57,25 +64,18 @@ static int is_lock_query(int cmd) {
|
||||
int bl_nl_before_dup(int fd, void **state) __attribute__((visibility("hidden")));
|
||||
void bl_nl_after_dup(void *state, int fd) __attribute__((visibility("hidden")));
|
||||
|
||||
int fcntl(int fd, int cmd, ...) {
|
||||
static int (*real_fcntl)(int, int, ...);
|
||||
va_list ap;
|
||||
void *arg;
|
||||
static int fcntl_with(int (**real_fcntl)(int, int, ...), const char *name, int fd, int cmd, void *arg) {
|
||||
int result;
|
||||
|
||||
va_start(ap, cmd);
|
||||
arg = va_arg(ap, void *);
|
||||
va_end(ap);
|
||||
|
||||
if (real_fcntl == NULL) real_fcntl = dlsym(RTLD_NEXT, "fcntl");
|
||||
if (real_fcntl == NULL) {
|
||||
if (*real_fcntl == NULL) *real_fcntl = dlsym(RTLD_NEXT, name);
|
||||
if (*real_fcntl == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
void *nl_state = NULL;
|
||||
int duplicate = cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC;
|
||||
if (duplicate && bl_nl_before_dup(fd, &nl_state) != 0) return -1;
|
||||
result = real_fcntl(fd, cmd, arg);
|
||||
result = (*real_fcntl)(fd, cmd, arg);
|
||||
if (duplicate) bl_nl_after_dup(nl_state, result);
|
||||
if (result >= 0 || !unsupported(errno)) return result;
|
||||
if (is_lock_command(cmd)) return 0;
|
||||
@@ -86,6 +86,30 @@ int fcntl(int fd, int cmd, ...) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int fcntl(int fd, int cmd, ...) {
|
||||
static int (*real_fcntl)(int, int, ...);
|
||||
va_list ap;
|
||||
void *arg;
|
||||
|
||||
va_start(ap, cmd);
|
||||
arg = va_arg(ap, void *);
|
||||
va_end(ap);
|
||||
return fcntl_with(&real_fcntl, "fcntl", fd, cmd, arg);
|
||||
}
|
||||
|
||||
#if defined(__GLIBC__) && defined(F_SETLK64)
|
||||
#ifdef __OFF_T_MATCHES_OFF64_T
|
||||
int fcntl64(int fd, int cmd, ...) __attribute__((alias("fcntl")));
|
||||
#else
|
||||
int fcntl64(int fd, int cmd, ...) {
|
||||
static int (*real_fcntl64)(int, int, ...);
|
||||
va_list ap;
|
||||
void *arg;
|
||||
|
||||
va_start(ap, cmd);
|
||||
arg = va_arg(ap, void *);
|
||||
va_end(ap);
|
||||
return fcntl_with(&real_fcntl64, "fcntl64", fd, cmd, arg);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,9 +1,13 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/uio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__aarch64__) || defined(NOEXEC_TEST)
|
||||
@@ -32,6 +36,92 @@ __attribute__((visibility("hidden"))) int bl_noexec_retry(int prot, int flags, i
|
||||
|
||||
static int (*real_mprotect)(void *, size_t, int);
|
||||
|
||||
struct span {
|
||||
uintptr_t lo, hi;
|
||||
int prot;
|
||||
};
|
||||
|
||||
static size_t private_range(uintptr_t start, uintptr_t end, struct span *spans, size_t cap) {
|
||||
char buf[4096];
|
||||
size_t used = 0, count = 0;
|
||||
uintptr_t covered = start;
|
||||
int fd = open("/proc/self/maps", O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) return 0;
|
||||
for (;;) {
|
||||
if (used >= sizeof buf - 1) used = 0;
|
||||
ssize_t n = read(fd, buf + used, sizeof buf - 1 - used);
|
||||
if (n <= 0) break;
|
||||
used += (size_t)n;
|
||||
buf[used] = 0;
|
||||
char *line = buf, *nl;
|
||||
while ((nl = strchr(line, '\n'))) {
|
||||
*nl = 0;
|
||||
char *p = line;
|
||||
uintptr_t lo = strtoull(p, &p, 16), hi = strtoull(p + 1, &p, 16);
|
||||
char perms[5] = {0};
|
||||
if (*p == ' ') memcpy(perms, p + 1, 4);
|
||||
line = nl + 1;
|
||||
if (hi <= covered || lo >= end) continue;
|
||||
if (lo > covered || perms[3] != 'p' || count == cap) {
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
spans[count].lo = covered;
|
||||
spans[count].hi = hi < end ? hi : end;
|
||||
spans[count].prot = (perms[0] == 'r' ? PROT_READ : 0) | (perms[1] == 'w' ? PROT_WRITE : 0) | (perms[2] == 'x' ? PROT_EXEC : 0);
|
||||
covered = spans[count++].hi;
|
||||
if (covered >= end) {
|
||||
close(fd);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
used = strlen(line);
|
||||
memmove(buf, line, used);
|
||||
}
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void restore(const struct span *spans, size_t count) {
|
||||
for (size_t i = 0; i < count; i++)
|
||||
if (!(spans[i].prot & PROT_READ)) real_mprotect((void *)spans[i].lo, spans[i].hi - spans[i].lo, spans[i].prot);
|
||||
}
|
||||
|
||||
static int copy_to_anonymous(void *addr, size_t len, int prot) {
|
||||
uintptr_t page = (uintptr_t)sysconf(_SC_PAGESIZE);
|
||||
uintptr_t start = (uintptr_t)addr, end = (start + len + page - 1) & ~(page - 1);
|
||||
struct span spans[64];
|
||||
size_t count = 0, opened = 0;
|
||||
if (start & (page - 1) || end <= start || !(count = private_range(start, end, spans, sizeof spans / sizeof *spans))) return -1;
|
||||
size_t size = end - start;
|
||||
int fd = memfd_create("noexec-image", MFD_CLOEXEC);
|
||||
if (fd < 0) return -1;
|
||||
if (ftruncate(fd, (off_t)size)) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
void *copy = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (copy == MAP_FAILED) {
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
while (opened < count && ((spans[opened].prot & PROT_READ) ||
|
||||
!real_mprotect((void *)spans[opened].lo, spans[opened].hi - spans[opened].lo, spans[opened].prot | PROT_READ)))
|
||||
opened++;
|
||||
struct iovec local = {copy, size}, remote = {addr, size};
|
||||
if (opened < count || process_vm_readv(getpid(), &local, 1, &remote, 1, 0) != (ssize_t)size || real_mprotect(copy, size, prot)) {
|
||||
restore(spans, opened);
|
||||
munmap(copy, size);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
int result = mmap(addr, size, prot, MAP_PRIVATE | MAP_FIXED, fd, 0) == addr ? 0 : -1;
|
||||
if (result) restore(spans, count);
|
||||
munmap(copy, size);
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
__attribute__((constructor)) static void noexec_init(void) {
|
||||
real_mprotect = (int (*)(void *, size_t, int))dlsym(RTLD_NEXT, "mprotect");
|
||||
}
|
||||
@@ -39,8 +129,8 @@ __attribute__((constructor)) static void noexec_init(void) {
|
||||
int mprotect(void *addr, size_t len, int prot) {
|
||||
if (!real_mprotect) noexec_init();
|
||||
int result = real_mprotect(addr, len, prot);
|
||||
if (result && errno == EACCES && (prot & PROT_EXEC) && in_fex()) {
|
||||
result = real_mprotect(addr, len, prot & ~PROT_EXEC);
|
||||
if (result && errno == EACCES && (prot & PROT_EXEC)) {
|
||||
result = in_fex() ? real_mprotect(addr, len, prot & ~PROT_EXEC) : copy_to_anonymous(addr, len, prot);
|
||||
if (result) errno = EACCES;
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -42,20 +42,15 @@ static int is_trace_marker(const char *path) {
|
||||
|| strcmp(path, "/sys/kernel/debug/tracing/trace_marker") == 0);
|
||||
}
|
||||
|
||||
int open(const char *path, int flags, ...) {
|
||||
va_list ap;
|
||||
mode_t mode;
|
||||
static int open_from(const char *path, int flags, mode_t mode, const void *caller) {
|
||||
int fd;
|
||||
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
if (is_trace_marker(path)) {
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
path = bl_oom_adj_redirect(path, (flags & O_ACCMODE) != O_RDONLY);
|
||||
if ((fd = bl_status_without_tracer(path, flags, __builtin_return_address(0))) >= 0) return fd;
|
||||
if ((fd = bl_status_without_tracer(path, flags, caller)) >= 0) return fd;
|
||||
if ((fd = bl_ntsync_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_venc_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_vdec_open(path, flags)) != -2) return fd;
|
||||
@@ -70,20 +65,15 @@ int open(const char *path, int flags, ...) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
int openat(int dirfd, const char *path, int flags, ...) {
|
||||
va_list ap;
|
||||
mode_t mode;
|
||||
static int openat_from(int dirfd, const char *path, int flags, mode_t mode, const void *caller) {
|
||||
int fd;
|
||||
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
if (is_trace_marker(path)) {
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
path = bl_oom_adj_redirect(path, (flags & O_ACCMODE) != O_RDONLY);
|
||||
if ((fd = bl_status_without_tracer(path, flags, __builtin_return_address(0))) >= 0) return fd;
|
||||
if ((fd = bl_status_without_tracer(path, flags, caller)) >= 0) return fd;
|
||||
if ((fd = bl_ntsync_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_venc_open(path, flags)) != -2) return fd;
|
||||
if ((fd = bl_vdec_open(path, flags)) != -2) return fd;
|
||||
@@ -98,5 +88,47 @@ int openat(int dirfd, const char *path, int flags, ...) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
int open(const char *path, int flags, ...) {
|
||||
va_list ap;
|
||||
mode_t mode;
|
||||
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
return open_from(path, flags, mode, __builtin_return_address(0));
|
||||
}
|
||||
|
||||
int openat(int dirfd, const char *path, int flags, ...) {
|
||||
va_list ap;
|
||||
mode_t mode;
|
||||
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
return openat_from(dirfd, path, flags, mode, __builtin_return_address(0));
|
||||
}
|
||||
|
||||
#ifdef __OFF_T_MATCHES_OFF64_T
|
||||
int open64(const char *path, int flags, ...) __attribute__((alias("open")));
|
||||
int openat64(int dirfd, const char *path, int flags, ...) __attribute__((alias("openat")));
|
||||
#else
|
||||
int open64(const char *path, int flags, ...) {
|
||||
va_list ap;
|
||||
mode_t mode;
|
||||
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
return open_from(path, flags | O_LARGEFILE, mode, __builtin_return_address(0));
|
||||
}
|
||||
|
||||
int openat64(int dirfd, const char *path, int flags, ...) {
|
||||
va_list ap;
|
||||
mode_t mode;
|
||||
|
||||
va_start(ap, flags);
|
||||
mode = va_arg(ap, mode_t);
|
||||
va_end(ap);
|
||||
return openat_from(dirfd, path, flags | O_LARGEFILE, mode, __builtin_return_address(0));
|
||||
}
|
||||
#endif
|
||||
@@ -356,7 +356,8 @@ static void flush_summary(void) {
|
||||
if (n > 0 && (size_t)n < sizeof(line)) append_line(line, (size_t)n);
|
||||
}
|
||||
|
||||
#if defined(__USE_LARGEFILE64)
|
||||
#if defined(__USE_LARGEFILE64) && defined(__OFF_T_MATCHES_OFF64_T)
|
||||
_Static_assert(sizeof(struct stat) == sizeof(struct stat64), "stat64 alias needs one layout");
|
||||
int fallocate64(int fd, int mode, off64_t offset, off64_t length) __attribute__((alias("fallocate")));
|
||||
int posix_fallocate64(int fd, off64_t offset, off64_t length) __attribute__((alias("posix_fallocate")));
|
||||
ssize_t pwrite64(int fd, const void *buffer, size_t count, off64_t offset) __attribute__((alias("pwrite")));
|
||||
|
||||
@@ -78,6 +78,8 @@ pack xbox "$linuxfs/droiddeck-xbox" version xodus-cli xodus-service
|
||||
pack comet "$linuxfs/droiddeck-comet" version comet
|
||||
pack powervr "$repo/app/src/main/assets/hybris" runtime.tzst version.txt
|
||||
[ ! -f "$linuxfs/droiddeck-ubisoft/droiddeck-upc.exe" ] || pack ubisoft "$linuxfs/droiddeck-ubisoft" droiddeck-upc.exe
|
||||
[ ! -f "$linuxfs/droiddeck-rockstar/Launcher64.exe" ] || pack rockstar "$linuxfs/droiddeck-rockstar" Launcher32.exe Launcher64.exe
|
||||
[ ! -f "$linuxfs/droiddeck-dirt/ws2_32.dll" ] || pack dirt "$linuxfs/droiddeck-dirt" ws2_32.dll
|
||||
|
||||
mkdir "$work/butler"
|
||||
fetch "https://broth.itch.zone/butler/linux-arm64/${BUTLER_VERSION}/archive/default" \
|
||||
|
||||
@@ -14,12 +14,13 @@ ROOT = Path(__file__).resolve().parents[2]
|
||||
MANIFEST = Path('app/build/runtime-inputs.json')
|
||||
PACKS = Path('app/build/packs')
|
||||
PACKED = {'assets/linuxfs/usr/local/lib/droiddeck-xbox/': 'xbox', 'assets/linuxfs/usr/local/lib/droiddeck-comet/': 'comet',
|
||||
'assets/linuxfs/usr/local/lib/droiddeck-ubisoft/': 'ubisoft',
|
||||
'assets/linuxfs/usr/local/lib/droiddeck-ubisoft/': 'ubisoft', 'assets/linuxfs/usr/local/lib/droiddeck-rockstar/': 'rockstar',
|
||||
'assets/linuxfs/usr/local/lib/droiddeck-dirt/': 'dirt',
|
||||
'assets/directaudio/': 'directaudio', 'assets/hybris/': 'powervr'}
|
||||
PACKED_FILES = {'lib/arm64-v8a/libproot.so': ('proot', 'libproot.so'),
|
||||
'lib/arm64-v8a/libproot-loader.so': ('proot', 'libproot-loader.so')}
|
||||
PACKED_LIBRARIES = ['lib/arm64-v8a/libopencv_java4.so', 'lib/arm64-v8a/libmediapipe_tasks_jni.so']
|
||||
PACK_NAMES = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft']
|
||||
PACK_NAMES = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft', 'rockstar', 'dirt']
|
||||
SOURCE_PATHS = ['app/build.gradle', 'app/src/main/cpp/fakeinput_steam.cpp', 'app/src/main/assets/pulseaudio.tzst',
|
||||
'tools/linuxfs', 'tools/proot', 'tools/aaudio-sink', 'tools/directaudio', 'tools/packs',
|
||||
'tools/gamescope/release.env', 'tools/droiddeck-esync/release.env',
|
||||
@@ -211,12 +212,27 @@ def pack_digests(root, name):
|
||||
return digests
|
||||
|
||||
|
||||
def windows_binaries(package):
|
||||
found = []
|
||||
for info in package.infolist():
|
||||
if info.is_dir():
|
||||
continue
|
||||
with package.open(info) as entry:
|
||||
if entry.read(2) == b'MZ':
|
||||
found.append(info.filename)
|
||||
return found
|
||||
|
||||
|
||||
def check_apk(apk, root=ROOT):
|
||||
data = verify(root)
|
||||
packs = {name: pack_digests(root, name) for name in PACK_NAMES
|
||||
if name != 'ubisoft' or (root / PACKS / 'ubisoft.tar.zst').is_file()}
|
||||
if name not in ('ubisoft', 'rockstar', 'dirt') or (root / PACKS / (name + '.tar.zst')).is_file()}
|
||||
with ZipFile(apk) as package:
|
||||
names = set(package.namelist())
|
||||
for name in sorted(names):
|
||||
prefix = next((p for p in PACKED if name.startswith(p)), None)
|
||||
if prefix:
|
||||
raise ValueError('APK still carries ' + name + ', which the ' + PACKED[prefix] + ' pack provides')
|
||||
for library in PACKED_LIBRARIES:
|
||||
if library in names:
|
||||
raise ValueError('APK still carries ' + library + ', which the tracking pack provides')
|
||||
@@ -243,6 +259,9 @@ def check_apk(apk, root=ROOT):
|
||||
raise ValueError('APK missing ' + name)
|
||||
if hashlib.sha256(content).hexdigest() != output['sha256']:
|
||||
raise ValueError('APK has stale runtime input: ' + name)
|
||||
found = windows_binaries(package)
|
||||
if found:
|
||||
raise ValueError('APK carries Windows executables, which ship in add-on packs: ' + ', '.join(found))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -12,7 +12,7 @@ GTA III defaults to full x87 precision for FEX before Wine starts, because reduc
|
||||
|
||||
Raw launcher identity requests use `INIT:<nonce>:` with a terminating colon. Framed requests carry their payload length. The reply echoes the complete challenge after `TINI:launcher:`; partial reads do not complete a raw request.
|
||||
|
||||
`build.sh` builds 32-bit and 64-bit executables with the GNU Windows targets and stages them as APK resources. `legacy-cipher.bin` contains the fixed client protocol tables, not account credentials or APK signing keys.
|
||||
`build.sh` builds 32-bit and 64-bit executables with the GNU Windows targets for the `rockstar` add-on pack. The app downloads the pack after Rockstar sign-in, or when a launch finds the service missing, and stages it in the Linux runtime. `legacy-cipher.bin` contains the fixed client protocol tables, not account credentials or APK signing keys.
|
||||
|
||||
Run the protocol tests with:
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
out=${1:-"$here/../../app/src/main/resources/rockstar/helpers"}
|
||||
out=${1:-"$here/../../app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar"}
|
||||
mkdir -p "$out"
|
||||
for target in i686-pc-windows-gnu x86_64-pc-windows-gnu; do
|
||||
rustup target add "$target" >/dev/null 2>&1 || true
|
||||
|
||||
@@ -10,6 +10,30 @@ import unittest
|
||||
SCRIPT = Path(__file__).resolve().parents[1] / 'agent/dd-lab-build'
|
||||
|
||||
|
||||
class LabBuildOptionsTest(unittest.TestCase):
|
||||
def run_script(self, *args):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
inbox = Path(tmp) / 'agent'
|
||||
inbox.mkdir()
|
||||
env = {**os.environ, 'HOME': tmp, 'DD_AGENT': '1', 'DD_AGENT_INBOX': str(inbox)}
|
||||
env.pop('DD_LAB_DETACHED', None)
|
||||
result = subprocess.run(['bash', str(SCRIPT), *args], env=env,
|
||||
capture_output=True, text=True, timeout=10)
|
||||
return result, (inbox / 'lab-request').exists()
|
||||
|
||||
def test_help_prints_usage_without_starting_a_build(self):
|
||||
result, requested = self.run_script('--help')
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
self.assertIn('Usage: dd-lab-build', result.stdout)
|
||||
self.assertFalse(requested)
|
||||
|
||||
def test_unknown_options_are_refused_without_starting_a_build(self):
|
||||
result, requested = self.run_script('--bogus')
|
||||
self.assertEqual(2, result.returncode)
|
||||
self.assertIn('unknown option --bogus', result.stderr)
|
||||
self.assertFalse(requested)
|
||||
|
||||
|
||||
class LabBuildPackageTest(unittest.TestCase):
|
||||
def test_package_override_survives_app_handoff_without_its_environment(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import unittest
|
||||
|
||||
|
||||
LINUXFS = Path(__file__).resolve().parents[1] / 'linuxfs'
|
||||
DESKTOP = (LINUXFS / 'desktop/droiddeck-desktop').read_text()
|
||||
SESSION = (LINUXFS / 'overlay/usr/local/bin/droiddeck-session').read_text()
|
||||
BOTTOM_DESKTOP = (LINUXFS / 'overlay/usr/local/bin/droiddeck-bottom-desktop').read_text()
|
||||
BOTTOM_SESSION = (
|
||||
Path(__file__).resolve().parents[2]
|
||||
/ 'app/src/main/java/com/droiddeck/launcher/session/BottomDesktop.kt'
|
||||
).read_text()
|
||||
HELPER = '/usr/local/bin/droiddeck-pipewire'
|
||||
|
||||
|
||||
class DesktopPipeWireTest(unittest.TestCase):
|
||||
def run_lifecycle_block(self, start, end, bottom, start_status=0, probe_env=False):
|
||||
block = DESKTOP[DESKTOP.index(start):DESKTOP.index(end, DESKTOP.index(start))]
|
||||
block = block.replace(HELPER, 'pipewire')
|
||||
script = '''
|
||||
pipewire() {
|
||||
if [ "$1" = env ]; then
|
||||
printf 'export PW_ENV=set\\n'
|
||||
else
|
||||
printf 'call:%s\\n' "$1"
|
||||
[ "$1" != start ] || return "$PW_START_STATUS"
|
||||
fi
|
||||
}
|
||||
''' + block + ('echo "env:${PW_ENV:-unset}"\n' if probe_env else '')
|
||||
environment = dict(os.environ, BL_BOTTOM_DESKTOP='1' if bottom else '0',
|
||||
PW_START_STATUS=str(start_status))
|
||||
result = subprocess.run(['bash', '-c', script], env=environment, capture_output=True,
|
||||
text=True, timeout=5)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
return result.stdout.splitlines()
|
||||
|
||||
def test_desktop_serves_pipewire_before_plasma_and_stops_it_after(self):
|
||||
start = DESKTOP.index(HELPER + ' start')
|
||||
env = DESKTOP.index(HELPER + ' env')
|
||||
plasma = DESKTOP.index('dbus-run-session -- startplasma-wayland')
|
||||
stop = DESKTOP.index(HELPER + ' stop')
|
||||
self.assertLess(start, env)
|
||||
self.assertLess(env, plasma)
|
||||
self.assertLess(plasma, stop)
|
||||
self.assertLess(stop, DESKTOP.index('droiddeck-steam-launch bigpicture'))
|
||||
|
||||
def test_steam_session_keeps_its_pipewire_startup(self):
|
||||
self.assertEqual(1, SESSION.count(HELPER + ' start'))
|
||||
self.assertIn('if [ "$mode" = steam ]; then\n if ' + HELPER + ' start', SESSION)
|
||||
|
||||
def test_bottom_desktop_starts_and_stops_its_pipewire_service(self):
|
||||
self.assertIn('export BL_BOTTOM_DESKTOP=1', BOTTOM_DESKTOP)
|
||||
self.assertLess(BOTTOM_DESKTOP.index('export BL_BOTTOM_DESKTOP=1'),
|
||||
BOTTOM_DESKTOP.index('exec /usr/local/bin/droiddeck-desktop'))
|
||||
self.assertIn('File(context.filesDir, ".wayland-rt-bottom")', BOTTOM_SESSION)
|
||||
self.assertNotIn('if [ "${BL_BOTTOM_DESKTOP:-0}" != 1 ]; then', DESKTOP)
|
||||
for bottom in (False, True):
|
||||
self.assertEqual(['call:start'], self.run_lifecycle_block(
|
||||
'if ' + HELPER + ' start',
|
||||
'echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY"', bottom))
|
||||
self.assertEqual(['call:stop'], self.run_lifecycle_block(
|
||||
HELPER + ' stop',
|
||||
'echo "== droiddeck-desktop: Plasma ended ($rc)"', bottom))
|
||||
|
||||
def test_successful_start_exports_the_client_environment(self):
|
||||
for bottom in (False, True):
|
||||
self.assertEqual(['call:start', 'env:set'], self.run_lifecycle_block(
|
||||
'if ' + HELPER + ' start',
|
||||
'echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY"', bottom, probe_env=True))
|
||||
|
||||
def test_failed_start_reports_it_and_leaves_the_environment_alone(self):
|
||||
for bottom in (False, True):
|
||||
self.assertEqual(
|
||||
['call:start', '== pipewire: not running; screen capture has no picture', 'env:unset'],
|
||||
self.run_lifecycle_block(
|
||||
'if ' + HELPER + ' start',
|
||||
'echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY"', bottom,
|
||||
start_status=1, probe_env=True))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,160 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
PRELOAD = Path(__file__).resolve().parents[1] / "linuxfs/preload"
|
||||
GIB = 1 << 30
|
||||
|
||||
PROGRAM = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void report(const char *call, int fd, int result) {
|
||||
struct stat st;
|
||||
if (fstat(fd, &st) != 0) { printf("%s fstat-failed\n", call); return; }
|
||||
printf("%s %d %lld\n", call, result, (long long)st.st_size);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *dir = argv[1];
|
||||
long long far = atoll(argv[2]);
|
||||
char path[4096];
|
||||
snprintf(path, sizeof(path), "%s/machine-id", dir);
|
||||
int fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd < 0 || write(fd, "0123456789abcdef0123456789abcdef\n", 33) != 33) return 2;
|
||||
report("fstat", fd, 0);
|
||||
report("ftruncate", fd, ftruncate(fd, far));
|
||||
report("pwrite", fd, pwrite(fd, "x", 1, far) == 1 ? 0 : errno);
|
||||
close(fd);
|
||||
snprintf(path, sizeof(path), "%s/reserved", dir);
|
||||
fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0644);
|
||||
int result = posix_fallocate(fd, 0, 4096);
|
||||
report("posix_fallocate", fd, result == EOPNOTSUPP ? 0 : result);
|
||||
result = fallocate(fd, 0, 0, 8192);
|
||||
report("fallocate", fd, result == 0 || errno == EOPNOTSUPP ? 0 : errno);
|
||||
int other = open(path, O_RDWR);
|
||||
struct flock lock = {.l_type = F_WRLCK, .l_whence = SEEK_SET, .l_start = far, .l_len = 1};
|
||||
result = fcntl(fd, F_OFD_SETLK, &lock);
|
||||
struct flock query = {.l_type = F_WRLCK, .l_whence = SEEK_SET, .l_start = far, .l_len = 1};
|
||||
int queried = fcntl(other, F_OFD_GETLK, &query);
|
||||
printf("lock %d %d %d %lld\n", result, queried, query.l_type == F_WRLCK, (long long)query.l_start);
|
||||
close(other);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
LOCKS = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int fd = open(argv[1], O_RDWR | O_CREAT, 0644);
|
||||
struct flock lock = {.l_type = F_WRLCK, .l_whence = SEEK_SET, .l_start = 0, .l_len = 1};
|
||||
int set = fcntl(fd, F_SETLK, &lock);
|
||||
struct flock query = {.l_type = F_WRLCK, .l_whence = SEEK_SET, .l_start = 0, .l_len = 1};
|
||||
int get = fcntl(fd, F_GETLK, &query);
|
||||
printf("%d %d %s\n", set, get, query.l_type == F_UNLCK ? "unlocked" : "locked");
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
NO_LOCKS = r"""
|
||||
#include <errno.h>
|
||||
int fcntl(int fd, int cmd, void *arg) { (void)fd; (void)cmd; (void)arg; errno = ENOSYS; return -1; }
|
||||
int fcntl64(int fd, int cmd, void *arg) { (void)fd; (void)cmd; (void)arg; errno = ENOSYS; return -1; }
|
||||
"""
|
||||
|
||||
|
||||
def compiles(bits, workdir):
|
||||
source = Path(workdir) / ("probe%s.c" % bits)
|
||||
source.write_text("int main(void) { return 0; }\n")
|
||||
out = Path(workdir) / ("probe%s" % bits)
|
||||
if subprocess.run(["cc", bits, "-o", str(out), str(source)], capture_output=True).returncode != 0:
|
||||
return False
|
||||
return subprocess.run([str(out)], capture_output=True).returncode == 0
|
||||
|
||||
|
||||
@unittest.skipUnless(shutil.which("cc"), "needs a C compiler")
|
||||
class LargeFilePreloadTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.dir = Path(tempfile.mkdtemp())
|
||||
(cls.dir / "program.c").write_text(PROGRAM)
|
||||
(cls.dir / "locks.c").write_text(LOCKS)
|
||||
(cls.dir / "nolocks.c").write_text(NO_LOCKS)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.dir, True)
|
||||
|
||||
def build(self, bits):
|
||||
if not compiles(bits, self.dir):
|
||||
self.skipTest("no %s toolchain" % bits)
|
||||
out = self.dir / bits.lstrip("-")
|
||||
out.mkdir(exist_ok=True)
|
||||
lib, program = out / "libblsession.so", out / "program"
|
||||
if not lib.exists():
|
||||
sources = sorted(str(p) for p in PRELOAD.glob("*.c"))
|
||||
subprocess.run(["cc", bits, "-shared", "-fPIC", "-O2", "-pthread", "-o", str(lib)] + sources + ["-ldl"], check=True)
|
||||
subprocess.run(["cc", bits, "-O2", "-D_FILE_OFFSET_BITS=64", "-o", str(program), str(self.dir / "program.c")], check=True)
|
||||
subprocess.run(["cc", bits, "-O2", "-D_FILE_OFFSET_BITS=64", "-o", str(out / "locks"), str(self.dir / "locks.c")], check=True)
|
||||
subprocess.run(["cc", bits, "-shared", "-fPIC", "-O2", "-o", str(out / "nolocks.so"), str(self.dir / "nolocks.c")], check=True)
|
||||
return lib, program
|
||||
|
||||
def run_program(self, bits, preload):
|
||||
lib, program = self.build(bits)
|
||||
work = Path(tempfile.mkdtemp(dir=self.dir))
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith("BL_")}
|
||||
env.pop("LD_PRELOAD", None)
|
||||
if preload:
|
||||
env["LD_PRELOAD"] = str(lib)
|
||||
result = subprocess.run([str(program), str(work), str(5 * GIB)], env=env, capture_output=True, text=True, timeout=60, check=True)
|
||||
return result.stdout.splitlines()
|
||||
|
||||
def expected(self):
|
||||
return [
|
||||
"fstat 0 33",
|
||||
"ftruncate 0 %d" % (5 * GIB),
|
||||
"pwrite 0 %d" % (5 * GIB + 1),
|
||||
"posix_fallocate 0 4096",
|
||||
"fallocate 0 8192",
|
||||
"lock 0 0 1 %d" % (5 * GIB),
|
||||
]
|
||||
|
||||
def test_32_bit_large_file_calls_see_the_real_size_and_offsets(self):
|
||||
self.assertEqual(self.expected(), self.run_program("-m32", preload=True))
|
||||
|
||||
def test_32_bit_programs_behave_as_without_the_preload(self):
|
||||
self.assertEqual(self.run_program("-m32", preload=False), self.run_program("-m32", preload=True))
|
||||
|
||||
def locks_without_filesystem_support(self, bits):
|
||||
lib, program = self.build(bits)
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith("BL_")}
|
||||
env["LD_PRELOAD"] = "%s:%s" % (lib, program.parent / "nolocks.so")
|
||||
work = Path(tempfile.mkdtemp(dir=self.dir))
|
||||
result = subprocess.run([str(program.parent / "locks"), str(work / "file")], env=env, capture_output=True, text=True, timeout=60, check=True)
|
||||
return result.stdout.strip()
|
||||
|
||||
def test_locks_on_filesystems_without_lock_support_still_succeed(self):
|
||||
self.assertEqual("0 0 unlocked", self.locks_without_filesystem_support("-m64"))
|
||||
self.assertEqual("0 0 unlocked", self.locks_without_filesystem_support("-m32"))
|
||||
|
||||
def test_64_bit_programs_are_unchanged(self):
|
||||
self.assertEqual(self.expected(), self.run_program("-m64", preload=True))
|
||||
self.assertEqual(self.run_program("-m64", preload=False), self.run_program("-m64", preload=True))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
@@ -25,6 +26,134 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
"""
|
||||
|
||||
IMAGE = r"""
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void run(const char *name, void *code, size_t len, int prot) {
|
||||
int error = mprotect(code, len, prot) ? errno : 0;
|
||||
printf("%s %d %d\n", name, error, error ? -1 : ((int (*)(void))code)());
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2) return 2;
|
||||
size_t page = (size_t)sysconf(_SC_PAGESIZE);
|
||||
int fd = open(argv[1], O_RDONLY);
|
||||
run("private", mmap(NULL, page, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0), page, PROT_READ | PROT_EXEC);
|
||||
run("hidden", mmap(NULL, page, PROT_NONE, MAP_PRIVATE, fd, 0), page, PROT_READ | PROT_EXEC);
|
||||
char *mixed = mmap(NULL, 2 * page, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (mixed == MAP_FAILED || mmap(mixed + page, page, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0) != mixed + page)
|
||||
return 3;
|
||||
run("mixed", mixed, page + 1, PROT_READ | PROT_EXEC);
|
||||
char *past = mmap(NULL, 3 * page, PROT_NONE, MAP_PRIVATE, fd, 0);
|
||||
if (past == MAP_FAILED || mmap(past + page, page, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0) != past + page ||
|
||||
mmap(past + 2 * page, page, PROT_READ, MAP_PRIVATE | MAP_FIXED, fd, page) != past + 2 * page)
|
||||
return 3;
|
||||
int error = mprotect(past, 3 * page, PROT_READ | PROT_EXEC) ? errno : 0;
|
||||
past[page] = 7;
|
||||
printf("past %d %d\n", error, past[page]);
|
||||
error = mprotect(mmap(NULL, page, PROT_READ, MAP_SHARED, fd, 0), page, PROT_READ | PROT_EXEC) ? errno : 0;
|
||||
printf("shared %d\n", error);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
FAILURES = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void *destination;
|
||||
static int fixed_calls, remap_calls, protect_calls;
|
||||
void arm(void *addr) { destination = addr; }
|
||||
int counts(int which) { return which == 0 ? fixed_calls : which == 1 ? remap_calls : protect_calls; }
|
||||
int mprotect(void *addr, size_t len, int prot) {
|
||||
int (*next)(void *, size_t, int) = dlsym(RTLD_NEXT, "mprotect");
|
||||
if (addr == destination && (prot & PROT_EXEC)) {
|
||||
protect_calls++;
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
if (destination && (prot & PROT_EXEC) && getenv("FAIL_COPY")) {
|
||||
errno = EACCES;
|
||||
return -1;
|
||||
}
|
||||
return next(addr, len, prot);
|
||||
}
|
||||
void *mremap(void *addr, size_t old, size_t size, int flags, ...) {
|
||||
remap_calls++;
|
||||
errno = ENOMEM;
|
||||
return MAP_FAILED;
|
||||
}
|
||||
void *mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset) {
|
||||
void *(*next)(void *, size_t, int, int, int, off_t) = dlsym(RTLD_NEXT, "mmap");
|
||||
if (addr == destination && (flags & MAP_FIXED)) {
|
||||
fixed_calls++;
|
||||
if (fd >= 0 && !getenv("ALLOW_FIXED")) {
|
||||
errno = ENOMEM;
|
||||
return MAP_FAILED;
|
||||
}
|
||||
}
|
||||
return next(addr, len, prot, flags, fd, offset);
|
||||
}
|
||||
"""
|
||||
|
||||
FAILURE_IMAGE = r"""
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void mapping(void *addr, char *out) {
|
||||
FILE *maps = fopen("/proc/self/maps", "r");
|
||||
char line[1024];
|
||||
unsigned long lo, hi;
|
||||
out[0] = 0;
|
||||
while (fgets(line, sizeof line, maps))
|
||||
if (sscanf(line, "%lx-%lx", &lo, &hi) == 2 && (uintptr_t)addr >= lo && (uintptr_t)addr < hi) {
|
||||
strcpy(out, line);
|
||||
break;
|
||||
}
|
||||
fclose(maps);
|
||||
}
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 2) return 2;
|
||||
size_t page = sysconf(_SC_PAGESIZE);
|
||||
int fd = open(argv[1], O_RDONLY);
|
||||
char *addr = mmap(NULL, page * 2, PROT_NONE, MAP_PRIVATE, fd, 0);
|
||||
if (addr == MAP_FAILED || mmap(addr + page, page, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0) != addr + page) return 3;
|
||||
addr[page] = 73;
|
||||
char before[1024], after[1024], tail_before[1024], tail_after[1024];
|
||||
mapping(addr, before);
|
||||
mapping(addr + page, tail_before);
|
||||
void (*arm)(void *) = dlsym(RTLD_DEFAULT, "arm");
|
||||
int (*counts)(int) = dlsym(RTLD_DEFAULT, "counts");
|
||||
if (!arm || !counts) return 4;
|
||||
arm(addr);
|
||||
int result = mprotect(addr, 2 * page, PROT_READ | PROT_EXEC);
|
||||
int error = errno;
|
||||
mapping(addr, after);
|
||||
mapping(addr + page, tail_after);
|
||||
printf("result %d %d preserved %d %d tail %d calls %d %d %d\n", result, error,
|
||||
!strcmp(before, after), !strcmp(tail_before, tail_after), addr[page], counts(0), counts(1), counts(2));
|
||||
if (!result) printf("execute %d\n", ((int (*)(void))addr)());
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
|
||||
RETURN_42 = {"x86_64": bytes.fromhex("b82a000000c3"), "aarch64": bytes.fromhex("40058052c0035fd6")}
|
||||
|
||||
|
||||
def noexec_folder():
|
||||
for folder in ("/run/lock", "/dev/shm", "/run/user/%d" % os.getuid()):
|
||||
@@ -36,7 +165,7 @@ def noexec_folder():
|
||||
return None
|
||||
|
||||
|
||||
@unittest.skipUnless(shutil.which("cc") and noexec_folder(), "needs cc and a writable noexec mount")
|
||||
@unittest.skipUnless(shutil.which("cc"), "needs cc")
|
||||
class NoexecPreloadTest(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@@ -48,26 +177,72 @@ class NoexecPreloadTest(unittest.TestCase):
|
||||
source.write_text(PROGRAM)
|
||||
for name in ("FEX", "game"):
|
||||
subprocess.run(["cc", "-O2", "-o", str(cls.tmp / name), str(source)], check=True)
|
||||
image = cls.tmp / "image.c"
|
||||
image.write_text(IMAGE)
|
||||
subprocess.run(["cc", "-O2", "-o", str(cls.tmp / "wine"), str(image)], check=True)
|
||||
failures = cls.tmp / "failures.c"
|
||||
failures.write_text(FAILURES)
|
||||
cls.failures = cls.tmp / "failures.so"
|
||||
subprocess.run(["cc", "-Wall", "-Werror", "-shared", "-fPIC", "-o", str(cls.failures), str(failures), "-ldl"], check=True)
|
||||
failure_image = cls.tmp / "failure_image.c"
|
||||
failure_image.write_text(FAILURE_IMAGE)
|
||||
subprocess.run(["cc", "-Wall", "-Werror", "-o", str(cls.tmp / "failure_image"), str(failure_image), "-ldl"], check=True)
|
||||
cls.target = Path(tempfile.mkdtemp(dir=noexec_folder())) / "Game.x86_64"
|
||||
cls.target.write_bytes(b"\x7fELF" + bytes(4092))
|
||||
cls.code = cls.target.parent / "game.exe"
|
||||
cls.code.write_bytes(RETURN_42.get(platform.machine(), b"").ljust(os.sysconf("SC_PAGE_SIZE"), b"\0"))
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
shutil.rmtree(cls.tmp, ignore_errors=True)
|
||||
shutil.rmtree(cls.target.parent, ignore_errors=True)
|
||||
|
||||
def run_as(self, name, preload=True):
|
||||
def run_as(self, name, preload=True, target=None, lines=3):
|
||||
env = dict(os.environ, LD_PRELOAD=str(self.lib)) if preload else {k: v for k, v in os.environ.items() if k != "LD_PRELOAD"}
|
||||
result = subprocess.run([str(self.tmp / name), str(self.target)], env=env, capture_output=True, text=True, check=True)
|
||||
return result.stdout.split("\n")[:3]
|
||||
result = subprocess.run([str(self.tmp / name), str(target or self.target)], env=env, capture_output=True, text=True, check=True)
|
||||
return result.stdout.split("\n")[:lines]
|
||||
|
||||
def test_failed_replacement_preserves_original_mappings_and_permissions(self):
|
||||
env = dict(os.environ, LD_PRELOAD=f"{self.lib}:{self.failures}")
|
||||
result = subprocess.run([str(self.tmp / "failure_image"), str(self.code)], env=env,
|
||||
capture_output=True, text=True, check=True)
|
||||
self.assertEqual(result.stdout.strip(), "result -1 13 preserved 1 1 tail 73 calls 1 0 1")
|
||||
|
||||
def test_failed_copy_protection_preserves_original_mappings(self):
|
||||
env = dict(os.environ, LD_PRELOAD=f"{self.lib}:{self.failures}", FAIL_COPY="1")
|
||||
result = subprocess.run([str(self.tmp / "failure_image"), str(self.code)], env=env,
|
||||
capture_output=True, text=True, check=True)
|
||||
self.assertEqual(result.stdout.strip(), "result -1 13 preserved 1 1 tail 73 calls 0 0 1")
|
||||
|
||||
@unittest.skipUnless(platform.machine() in RETURN_42, "needs a known host instruction set")
|
||||
def test_replacement_installs_executable_pages_without_final_mprotect(self):
|
||||
env = dict(os.environ, LD_PRELOAD=f"{self.lib}:{self.failures}", ALLOW_FIXED="1")
|
||||
result = subprocess.run([str(self.tmp / "failure_image"), str(self.code)], env=env,
|
||||
capture_output=True, text=True, check=True)
|
||||
self.assertIn("preserved 0 0 tail 73 calls 1 0 1", result.stdout)
|
||||
self.assertEqual(result.stdout.splitlines()[-1], "execute 42")
|
||||
|
||||
@unittest.skipUnless(noexec_folder(), "needs a writable noexec mount")
|
||||
def test_fex_maps_a_program_on_noexec_storage(self):
|
||||
self.assertEqual(self.run_as("FEX"), ["map 0", "protect 0", "read \x7f"])
|
||||
|
||||
@unittest.skipUnless(noexec_folder(), "needs a writable noexec mount")
|
||||
def test_the_kernel_still_refuses_everyone_else(self):
|
||||
for refused in (self.run_as("game"), self.run_as("FEX", preload=False)):
|
||||
self.assertIn(refused[0], ("map 1", "map 13"))
|
||||
self.assertEqual(refused[1:], ["protect 13", "read -"])
|
||||
refused = self.run_as("FEX", preload=False)
|
||||
self.assertIn(refused[0], ("map 1", "map 13"))
|
||||
self.assertEqual(refused[1:], ["protect 13", "read -"])
|
||||
self.assertIn(self.run_as("game")[0], ("map 1", "map 13"))
|
||||
|
||||
@unittest.skipUnless(platform.machine() in RETURN_42, "needs a known host instruction set")
|
||||
@unittest.skipUnless(noexec_folder(), "needs a writable noexec mount")
|
||||
def test_private_image_pages_become_executable_copies(self):
|
||||
self.assertEqual(self.run_as("wine", target=self.code, lines=5), ["private 0 42", "hidden 0 42", "mixed 0 42", "past 13 7", "shared 13"])
|
||||
|
||||
@unittest.skipUnless(platform.machine() in RETURN_42, "needs a known host instruction set")
|
||||
@unittest.skipUnless(noexec_folder(), "needs a writable noexec mount")
|
||||
def test_image_pages_stay_refused_without_the_preload(self):
|
||||
self.assertEqual(self.run_as("wine", preload=False, target=self.code, lines=5),
|
||||
["private 13 -1", "hidden 13 -1", "mixed 13 -1", "past 13 7", "shared 13"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -23,6 +23,7 @@ class PipeWireHelperTest(unittest.TestCase):
|
||||
self.helper = self.root / 'droiddeck-pipewire'
|
||||
self.helper.write_text(text)
|
||||
self.environment = dict(os.environ, XDG_RUNTIME_DIR=str(self.runtime))
|
||||
self.started = []
|
||||
|
||||
def pack(self, daemon_body):
|
||||
tree = self.root / 'tree'
|
||||
@@ -36,9 +37,27 @@ class PipeWireHelperTest(unittest.TestCase):
|
||||
archive.add(tree, arcname='.')
|
||||
subprocess.run(['zstd', '-q', '-f', str(tar), '-o', str(self.bundle)], check=True)
|
||||
|
||||
def run_helper(self, *args):
|
||||
def pack_with_stub_zstd(self, delay=''):
|
||||
tree = self.root / 'tree'
|
||||
daemon = tree / 'bin/pipewire'
|
||||
daemon.parent.mkdir(parents=True)
|
||||
daemon.write_text('#!/bin/sh\npython3 -c "import socket,sys; s=socket.socket(socket.AF_UNIX); '
|
||||
's.bind(sys.argv[1]); import time; time.sleep(30)" "$XDG_RUNTIME_DIR/pipewire-0"\n')
|
||||
(tree / 'bin/wireplumber').write_text('#!/bin/sh\nexec sleep 30\n')
|
||||
for script in daemon.parent.iterdir():
|
||||
script.chmod(0o755)
|
||||
with tarfile.open(self.bundle, 'w') as archive:
|
||||
archive.add(tree, arcname='.')
|
||||
stubs = self.root / 'stubs'
|
||||
stubs.mkdir()
|
||||
slow = stubs / 'zstd'
|
||||
slow.write_text('#!/bin/sh\n' + delay + 'exec cat -- "$2"\n')
|
||||
slow.chmod(0o755)
|
||||
self.environment['PATH'] = '%s:%s' % (stubs, os.environ['PATH'])
|
||||
|
||||
def run_helper(self, *args, environment=None):
|
||||
with tempfile.TemporaryFile('w+') as out, tempfile.TemporaryFile('w+') as err:
|
||||
done = subprocess.run(['sh', str(self.helper), *args], env=self.environment, stdout=out, stderr=err,
|
||||
done = subprocess.run(['sh', str(self.helper), *args], env=environment or self.environment, stdout=out, stderr=err,
|
||||
text=True, timeout=15)
|
||||
out.seek(0)
|
||||
err.seek(0)
|
||||
@@ -46,6 +65,8 @@ class PipeWireHelperTest(unittest.TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
self.run_helper('stop')
|
||||
for environment in self.started:
|
||||
self.run_helper('stop', environment=environment)
|
||||
|
||||
def test_env_points_clients_at_the_bundle(self):
|
||||
out = self.run_helper('env').stdout
|
||||
@@ -104,6 +125,39 @@ class PipeWireHelperTest(unittest.TestCase):
|
||||
self.assertIn('could not write the access settings', result.stderr)
|
||||
self.assertFalse((self.runtime / 'droiddeck-pipewire/pids').exists())
|
||||
|
||||
def test_access_settings_are_replaced_atomically_without_leftovers(self):
|
||||
self.pack_with_stub_zstd()
|
||||
self.assertEqual(self.run_helper('start').returncode, 0)
|
||||
fragments = [self.dir / 'share/pipewire/pipewire.conf.d/droiddeck-access.conf',
|
||||
self.dir / 'share/wireplumber/wireplumber.conf.d/droiddeck-access.conf']
|
||||
before = [(f.stat().st_ino, f.read_text()) for f in fragments]
|
||||
held = [f.open() for f in fragments]
|
||||
self.assertEqual(self.run_helper('start').returncode, 0)
|
||||
for handle, (_, text) in zip(held, before):
|
||||
self.assertEqual(handle.read(), text)
|
||||
handle.close()
|
||||
for fragment, (inode, text) in zip(fragments, before):
|
||||
self.assertNotEqual(fragment.stat().st_ino, inode)
|
||||
self.assertEqual(fragment.read_text(), text)
|
||||
self.assertEqual([c.name for c in fragment.parent.iterdir()], [fragment.name])
|
||||
|
||||
def test_concurrent_starts_share_one_unpack(self):
|
||||
self.pack_with_stub_zstd('sleep 1\n')
|
||||
errors = [tempfile.TemporaryFile('w+') for _ in range(3)]
|
||||
for index in range(len(errors)):
|
||||
runtime = self.root / ('run%d' % index)
|
||||
runtime.mkdir()
|
||||
self.started.append(dict(self.environment, XDG_RUNTIME_DIR=str(runtime)))
|
||||
runs = [subprocess.Popen(['sh', str(self.helper), 'start'], env=environment,
|
||||
stdout=subprocess.DEVNULL, stderr=err, text=True)
|
||||
for environment, err in zip(self.started, errors)]
|
||||
for run, err in zip(runs, errors):
|
||||
run.wait(timeout=30)
|
||||
err.seek(0)
|
||||
self.assertEqual(run.returncode, 0, err.read())
|
||||
self.assertTrue((self.dir / 'bin/pipewire').is_file())
|
||||
self.assertFalse((self.lib / 'droiddeck-pipewire.new').exists())
|
||||
|
||||
def test_unchanged_bundle_is_not_unpacked_again(self):
|
||||
self.pack('exec sleep 30')
|
||||
self.run_helper('start')
|
||||
|
||||
Loaded 100 of 117 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user