Compare commits

..
134 changed files with 1098 additions and 3013 deletions

No files matched your search

+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
jq -r --arg n "$2" '.assets // [] | .[] | select(.name == $n) | .digest // empty'
}
commit=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN" --jq .head_sha 2>/dev/null || echo "$GITHUB_SHA")
for name in proot directaudio tracking xbox comet butler powervr ubisoft rockstar dirt; do
for name in proot directaudio tracking xbox comet butler powervr ubisoft; do
file="packs/$name.tar.zst"
[ -f "$file" ] || { echo "::error::$name.tar.zst is missing from Build APK run $BUILD_RUN"; exit 1; }
sha=$(sha256sum "$file" | cut -d' ' -f1)
+1 -1
View File
@@ -36,4 +36,4 @@ __pycache__/
app/src/main/assets/directaudio/
app/src/main/assets/hybris/
/tools/vr/out/
app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar/
app/src/main/resources/rockstar/helpers/
+1 -2
View File
@@ -74,7 +74,6 @@ 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).
@@ -99,7 +98,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.
- 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).
- 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 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.
+3 -5
View File
@@ -93,7 +93,7 @@ def trackingPack = rootProject.file('tools/packs/tracking/release.env').readLine
def prootPackPin = rootProject.file('tools/packs/proot/release.env').readLines()
.findAll { it.contains('=') && !it.startsWith('#') }
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft', 'rockstar', 'dirt'].collectEntries { name ->
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft'].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>droiddeck-rockstar:<dir>droiddeck-dirt:<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>directaudio:<dir>hybris'
}
packagingOptions {
@@ -278,10 +278,8 @@ 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', 'droiddeck-scenario', 'adb_device.py', 'proot_profile.py'; into('agent/ctl') }
from(rootProject.file('tools/agent/AGENTS.md')) { into('agent/ctl') }
from(rootProject.file('tools')) { include 'droiddeckctl', 'adb_device.py', 'proot_profile.py'; 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)
}
@@ -1,2 +0,0 @@
#!/bin/sh
exec python3 /root/.local/share/droiddeck/ctl/droiddeck-scenario "$@"
@@ -416,7 +416,8 @@ 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 = m >= 1.0f ? (float)(int)m : m;
aspect = (float)(int)m;
if (aspect < 1.0f) aspect = 1.0f;
} 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,15 +84,12 @@ class App : Application() {
if (com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).isDirectory) {
com.droiddeck.launcher.core.AddonPack.PROOT.ensure(app)
com.droiddeck.launcher.core.AddonPack.DIRECTAUDIO.ensure(app)
com.droiddeck.launcher.session.SessionFiles.ensureDirtStandIn(app)
}
if (com.droiddeck.launcher.stores.gog.GogComet.enabled(app)) com.droiddeck.launcher.core.AddonPack.COMET.ensure(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.XBOX) != null)
com.droiddeck.launcher.core.AddonPack.XBOX.ensure(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.UBISOFT) != null)
com.droiddeck.launcher.session.SessionFiles.ensureUbisoftService(app)
if (com.droiddeck.launcher.stores.StoreAccounts.signedInAs(app, com.droiddeck.launcher.stores.Store.ROCKSTAR) != null)
com.droiddeck.launcher.session.SessionFiles.ensureRockstarService(app)
com.droiddeck.launcher.handtracking.HandTracking.load(app)
}.onFailure { android.util.Log.w("App", "add-on pack prefetch failed", it) }
}, "addon-packs").start()
@@ -195,7 +195,6 @@ 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)
@@ -2552,7 +2551,6 @@ 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,
@@ -2614,7 +2612,6 @@ 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)
@@ -2952,7 +2949,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
backActionsInverted = SessionPrefs.backActionsInverted(this)
directAudio = SessionPrefs.directAudio(this)
picturePosition = SessionPrefs.picturePosition(this)
integerScaling = SessionPrefs.integerScaling(this)
stretch16x9 = SessionPrefs.stretch16x9(this)
mic = SessionPrefs.micEnabled(this)
refreshWifiDiscovery()
@@ -173,12 +173,11 @@ 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 && !activeCardboard.enabled
!pipUi && !isInPictureInPictureMode && !cardboard.enabled
val alignment = if (!active) ALIGN_CENTER else when (picturePosition) {
"top" -> ALIGN_PICTURE_TOP
"bottom" -> ALIGN_PICTURE_BOTTOM
@@ -186,7 +185,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
"right" -> ALIGN_PICTURE_RIGHT
else -> ALIGN_CENTER
}
WaylandCompositor.nativeSetScaleMode(if (active && integerScaling) SCALE_INTEGER else SCALE_FIT, alignment)
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, alignment)
}
private var unfoldedPanel by mutableStateOf<OnScreenControls?>(null)
private var unfoldedColumn: android.widget.LinearLayout? = null
@@ -296,6 +295,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private lateinit var touchscreenGestures: TouchscreenGestures
private var gestureConfig = com.droiddeck.launcher.input.TouchGestureConfig()
private var gestureGame: String? = null
private var nintendoScope: String? = null
private var gameStarts by mutableIntStateOf(0)
private var gestureSettingsOpen by mutableStateOf(false)
private var steamImportAsk by mutableStateOf<com.droiddeck.launcher.session.SteamImportPrompt.Ask?>(null)
@@ -1086,7 +1086,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
secondScreenPresentation?.closeFieldKeyboard()
}
}
androidx.compose.runtime.LaunchedEffect(picturePosition, integerScaling, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
androidx.compose.runtime.LaunchedEffect(picturePosition, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
DroidDeckTheme {
if (pipUi) {
if (SessionState.suspended) androidx.compose.foundation.layout.Box(
@@ -1196,10 +1196,19 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}
frameGenActiveGameName = target.second?.name
}
if (nextGame != gestureGame) {
if (nextGame != null) gameStarts++
val nextNintendoScope = if (SessionState.mode == SessionService.MODE_RUN) {
kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
com.droiddeck.launcher.session.NoSteamLaunch.scopeOf(SessionState.program, SessionState.programArgs) {
com.droiddeck.launcher.session.NoSteamLaunch.battleNetTitleScope(this@SessionActivity, it)
}
}
} else nextGame
if (nextGame != gestureGame || nextNintendoScope != nintendoScope) {
if (nextGame != null && nextGame != gestureGame) gameStarts++
gestureGame = nextGame
nintendoScope = nextNintendoScope
refreshGestureConfig()
applyNintendoLayout()
}
if (
SessionState.mode == SessionService.MODE_STEAM &&
@@ -2400,7 +2409,6 @@ 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)
@@ -2591,10 +2599,7 @@ 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) {
com.droiddeck.launcher.session.SessionFiles.ensureDirtStandIn(this)
return null
}
if (ok) 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)
}
@@ -2656,7 +2661,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()
applyGameAlignment()
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, ALIGN_CENTER)
val activeProfileId = currentScreenEffectsProfileId()
val activeUpscaler = SessionPrefs.screenEffectsUpscaler(this, activeProfileId)
val activeEffects = SessionPrefs.screenEffects(this, activeProfileId)
@@ -3692,6 +3697,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (desiredRelativeMouseMode != wanted) requestRelativeMouse()
}
private fun applyNintendoLayout() {
padBridge?.setNintendoLayout(ControllerPrefs.nintendoLayout(this, nintendoScope))
}
private fun refreshGestureConfig() {
gestureConfig = com.droiddeck.launcher.input.GesturePrefs.read(this, gestureGame)
directHoldBehavior = gestureConfig.directHoldBehavior
@@ -4638,18 +4647,25 @@ 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
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 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
)
}
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
@@ -4730,10 +4746,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (event.actionMasked == MotionEvent.ACTION_DOWN) gesturePointerReady = false
touchscreenGestures.onTouch(event)
}
com.droiddeck.launcher.input.TouchRouter.Route.SCROLL -> {
if (event.actionMasked == MotionEvent.ACTION_DOWN) scrollTouch.tapClicks = !onScreenMouseButtonShown()
scrollTouch.onTouch(event)
}
com.droiddeck.launcher.input.TouchRouter.Route.SCROLL -> scrollTouch.onTouch(event)
else -> {
if (com.droiddeck.launcher.input.TouchRouter.steamKeyboardZone(snapshot)) {
val wasActive = threeFingerTap.active && event.actionMasked != MotionEvent.ACTION_DOWN
@@ -4756,17 +4769,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}
}
private fun onScreenMouseButtonShown(): Boolean {
if (steamTouchControls?.visibility == View.VISIBLE) return false
val primary = listOfNotNull(unfoldedPanel, bottomInputControls, onScreenControls)
.filter { it.visibility == View.VISIBLE }.map { it.shownElements() } +
listOfNotNull(unfoldedDeckSurface?.takeIf { it.visibility == View.VISIBLE }?.shownElements())
val secondary = secondScreenPresentation?.shownControlElements().orEmpty() +
swappedControls?.takeIf { it.isShown }?.shownElements().orEmpty()
return primary.any { inputProfile.hasMouseButton(InputRole.PRIMARY, it) } ||
inputProfile.hasMouseButton(InputRole.SECONDARY, secondary)
}
private fun uiBlocksTouch(): Boolean =
drawerOpen || achievementsOpen || gestureSettingsOpen || inputSettingsOpen || pipUi || SessionState.suspended
@@ -4787,7 +4789,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
touchpad.desktop = SessionState.mode == SessionService.MODE_DESKTOP
touchpad.tapClicks = !onScreenMouseButtonShown()
placeTouchpadAtGuest(rect)
}
return touchpad.onTouch(event)
@@ -4870,13 +4871,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
showCursor(cx, cy)
}
private var swappedControls: com.droiddeck.launcher.ui.InputSurfaceView? = null
private fun dispatchDirectTouch(event: MotionEvent): Boolean {
val rect = drawnRect() ?: return false
if (event.actionMasked == MotionEvent.ACTION_DOWN)
ignoreGameTouch = topPictureMapped && !glassesOutputActive &&
!rect.contains(event.x, event.y)
ignoreGameTouch = topPictureMapped && !rect.contains(event.x, event.y)
if (ignoreGameTouch) {
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
directTouchHold.cancel()
@@ -4885,11 +4883,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) ignoreGameTouch = false
return true
}
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
val tapClicks = !onScreenMouseButtonShown()
directTouchHold.tapClicks = tapClicks
twoFingerGestures.tapClicks = tapClicks
}
if (SessionState.mode == SessionService.MODE_DESKTOP && twoFingerGestures.onTouch(event)) return true
return forwardTouch(event, rect)
}
@@ -4917,11 +4910,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
return true
}
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
if (!pointerLocked) {
val x = event.x.coerceIn(rect.left, rect.right)
val y = event.y.coerceIn(rect.top, rect.bottom)
if (directTouchHold.tapClicks) showCursor(x, y) else movePointer(x, y)
}
if (!pointerLocked) showCursor(event.x.coerceIn(rect.left, rect.right), event.y.coerceIn(rect.top, rect.bottom))
if (WaylandCompositor.nativeFocusTakesTouch()) {
listOf(PointerGestures.BTN_LEFT, PointerGestures.BTN_RIGHT, PointerGestures.BTN_MIDDLE).forEach {
heldButtons.set(1, it, false)
@@ -5411,7 +5400,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
listOf(PointerGestures.BTN_LEFT, PointerGestures.BTN_RIGHT, PointerGestures.BTN_MIDDLE).forEach {
heldButtons.set(1, it, false)
}
applyGameAlignment()
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, ALIGN_CENTER)
}
} else if (!isFinishing && !isDestroyed) {
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
@@ -5536,6 +5525,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
(getSystemService(INPUT_SERVICE) as? InputManager)
?.registerInputDeviceListener(deviceListener, Handler(Looper.getMainLooper()))
padBridge?.setStickDeadZone(ControllerPrefs.deadZone(this))
applyNintendoLayout()
refreshSecondScreenDisplays()
if (SessionState.guestPid > 1) padBridge?.syncConnectedControllers()
joyConVr?.refresh()
@@ -5772,7 +5762,6 @@ 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()
@@ -6019,9 +6008,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
androidx.compose.runtime.key(profileLayout) {
androidx.compose.ui.viewinterop.AndroidView(
factory = { context -> com.droiddeck.launcher.ui.InputSurfaceView(context, padBridge, profileLayout?.elements.orEmpty(),
surfaceStyle = profileLayout?.style ?: com.droiddeck.launcher.input.InputSurfaceStyle())
.also { swappedControls = it } },
onRelease = { if (swappedControls === it) swappedControls = null },
surfaceStyle = profileLayout?.style ?: com.droiddeck.launcher.input.InputSurfaceStyle()) },
modifier = Modifier.fillMaxWidth().weight(1f),
)
}
@@ -6394,7 +6381,6 @@ 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,7 +84,6 @@ 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)
@@ -120,7 +119,6 @@ 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 (or kept open, see [input]). */
/** One coding agent CLI in the Linux userland, run one process per turn. */
interface AgentHarness {
val id: String
val name: String
@@ -27,18 +27,8 @@ 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. */
@@ -66,13 +56,9 @@ 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 input and output, resumed by session id. */
/** Claude Code: `claude -p` with stream-json output, resumed by session id. */
object ClaudeCode : AgentHarness {
override val id = "claude"
override val name = "Claude Code"
@@ -87,8 +73,6 @@ 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()
@@ -113,7 +97,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", "--input-format", "stream-json", "--output-format", "stream-json", "--verbose", "--include-partial-messages"))
addAll(listOf(binary, "-p", message, "--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)) }
@@ -121,11 +105,6 @@ 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() }
@@ -151,11 +130,7 @@ 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(),
background = input?.optBoolean("run_in_background") == true || block.optString("name") == "Monitor",
)
AgentHost.Entry.Used(block.optString("id"), block.optString("name"), detail(input), fullInput(block.optString("name"), input), parent = parent.orEmpty())
}
else -> null
}
@@ -173,25 +148,17 @@ object ClaudeCode : AgentHarness {
AgentEvent(conversation, results)
}
"rate_limit_event" -> AgentEvent(conversation, limits = limits(o.optJSONObject("rate_limit_info")))
// 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(
// 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(
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) }
}
}
@@ -260,8 +227,6 @@ 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,23 +21,18 @@ import java.nio.file.Files
/**
* The launcher's agent: a coding agent CLI ([AgentHarness]) from the Linux userland, run headless
* 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
* one process per turn, outside any game or desktop session. 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.
* [background]: the call starts work that can wake the CLI after its turn (run_in_background, Monitor).
*/
/** A tool call; [output] stays null until its result arrives. [parent] is the subagent call it was made under, if any. */
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 background: Boolean = false,
val parent: String = "",
) : 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. */
@@ -68,10 +63,18 @@ 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. " +
"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. " +
"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. " +
"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."
@@ -123,24 +126,10 @@ object AgentHost {
var lab by mutableStateOf<LabProgress?>(null)
private set
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 class Turn(val process: Process, val pid: Int)
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
@@ -153,8 +142,6 @@ 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
@@ -210,7 +197,6 @@ object AgentHost {
AgentSetup.forget()
refresh(app)
}
dropSession()
load(app, id)
prefs(app).edit().putString(CHAT_KEY, id).apply()
}
@@ -299,42 +285,11 @@ object AgentHost {
live = ""
liveThinking = ""
turnStarted = SystemClock.elapsedRealtime()
AgentHostService.start(app)?.let { serviceWarning(app, it) }
AgentHostService.start(app)
val current = harness
val prompt = AgentAttachments.prompt(message, attached)
turnPlanned = plan && current.plans
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 command = current.turn(prompt, conversation, AgentHarness.Options(model, turnPlanned, BRIEF, effort))
val workdir = workspace(app)
var threadConversation = conversation
Thread({
@@ -349,100 +304,40 @@ object AgentHost {
main.post { if (generation == gen) finish(app, e.message ?: "could not start") }
return@Thread
}
val started = Turn(child, AgentProcesses.pidOf(child), if (line != null) child.outputStream else null).apply {
if (current === ClaudeCode && line != null) costs = AgentCostTracker()
}
val started = Turn(child, AgentProcesses.pidOf(child))
OrphanReaper.keep(started.pid)
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()
main.post { if (generation == gen && state == State.WORKING && turn == null) turn = started else AgentProcesses.killTree(started.pid) }
child.outputStream.close()
var ended = false
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 { output ->
runCatching { raw?.apply { write(output); newLine(); flush() } }
val parsed = current.parse(output) ?: return@forEachLine
child.inputStream.bufferedReader().forEachLine { line ->
runCatching { raw?.apply { write(line); newLine(); flush() } }
val parsed = current.parse(line) ?: 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 || session === started) handle(app, started, event) }
main.post { if (turn === started) apply(app, event) }
}
}
runCatching { raw?.close() }
val status = runCatching { child.waitFor() }.getOrDefault(-1)
OrphanReaper.release(started.pid)
main.post {
if (started.writingGeneration != null) started.exitStatus = status
else processExited(app, started, current, status)
if (turn === started) {
turn = null
if (state == State.WORKING && !ended) finish(app, app.getString(R.string.agent_exited, current.name, 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
@@ -454,7 +349,6 @@ object AgentHost {
AgentProcesses.killTree(running.pid)
running.process.destroy()
}
dropSession()
if (state == State.WORKING) finish(app, null, stopped = true)
}
@@ -549,25 +443,19 @@ 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
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))
AgentHostService.stop(app)
// 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 && !answeredTask && asked != null && answerless(entries) && !retrying) {
if (!stopped && error == null && asked != null && answerless(entries) && !retrying) {
retrying = true
val retryChat = chat
resend = Runnable {
@@ -605,7 +493,6 @@ 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) }
}
@@ -758,8 +645,6 @@ 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}"
@@ -809,17 +694,3 @@ 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,37 +42,19 @@ 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): Throwable? {
if (started) { update(context); return null }
fun start(context: Context) {
lastText = null
return runCatching { context.startForegroundService(Intent(context, AgentHostService::class.java)) }
.onSuccess { started = true; awaiting++ }
.exceptionOrNull()
started = true
runCatching { context.startForegroundService(Intent(context, AgentHostService::class.java)) }
.onSuccess { awaiting++ }
}
fun stop(context: Context) {
if (setupSteps > 0 || waiting) return
if (setupSteps > 0) 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)
@@ -98,8 +80,7 @@ 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(if (waiting && setupSteps == 0) R.string.agent_waiting_background else R.string.agent_setting_up)
if (AgentHost.state != AgentHost.State.WORKING) return context.getString(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,7 +4,6 @@ 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
@@ -41,9 +40,7 @@ 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", "droiddeck-scenario")
/** DroidDeck's own skills (tools/agent/skills), given to every harness. */
private const val SKILLS = "agent/skills"
private val HELPERS = listOf("android-open", "dd-gh-login", "droiddeckctl")
internal const val CTL = "/root/.local/share/droiddeck/ctl"
private const val PROBE_TIMEOUT_S = 60L
@@ -190,98 +187,11 @@ 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) attempt(name) { copyAsset(app, "agent/$name", File(bin, name)) }
for (name in HELPERS) copyAsset(app, "agent/$name", File(bin, name))
val ctl = File(root, CTL.removePrefix("/")).apply { mkdirs() }
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)
}
for (name in app.assets.list("agent/ctl").orEmpty()) copyAsset(app, "agent/ctl/$name", File(ctl, name))
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. */
@@ -291,24 +201,8 @@ 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 { 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")
}
app.assets.open(asset).use { input -> target.outputStream().use { input.copyTo(it) } }
target.setExecutable(true, false)
}
}
@@ -172,8 +172,5 @@ 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"))
}
}
@@ -1,39 +0,0 @@
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,8 +13,6 @@ 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)
@@ -38,38 +36,13 @@ 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 appValue(text, appId, "LaunchOptions").orEmpty()
return launchOptions(text, appId).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 {
@@ -82,57 +55,36 @@ object SteamLaunchOptions {
true
} catch (e: Exception) {
staged.delete()
Log.w(TAG, "could not write Steam app settings to ${config.path}", e)
Log.w(TAG, "could not write launch options to ${config.path}", e)
false
}
}
internal fun launchOptions(text: String, appId: Int): String? {
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) }
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) }
?.let { unescape(text.substring(it.valueStart + 1, it.end)) }
}
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? {
internal fun withLaunchOptions(text: String, appId: Int, options: String): String? {
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
var updated = text
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
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
}
val app = section(updated, path) ?: return null
val value = "\"" + escape(rawValue) + "\""
entries(updated, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals(key, true) }?.let {
val value = "\"" + escape(options) + "\""
entries(updated, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals("LaunchOptions", 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 + "\"${escape(key)}\"\t\t" + value + newline + updated.substring(lineStart)
return updated.substring(0, lineStart) + indent + "\"LaunchOptions\"\t\t" + value + newline + updated.substring(lineStart)
}
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 class Entry(val key: String, val valueStart: Int, val end: Int, val section: Boolean)
private fun section(text: String, path: List<String>): Entry? {
var found: Entry? = null
@@ -146,27 +98,18 @@ 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))
keyStart = i
} else {
found += Entry(key, keyStart, i, end, false)
key = null
keyStart = -1
}
if (key == null) key = unescape(text.substring(i + 1, end)) else { found += Entry(key, i, end, false); key = null }
i = end + 1
}
text[i] == '{' -> {
val end = sectionEnd(text, i) ?: return found
key?.let { found += Entry(it, keyStart, i, end, true) }
key?.let { found += Entry(it, 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 }
@@ -138,6 +138,15 @@ object ControllerPrefs {
prefs(context).edit().putBoolean("joyConVr", on).apply()
}
fun nintendoLayout(context: Context, game: String?): Boolean =
game != null && prefs(context).getBoolean("nintendo.$game", false)
fun setNintendoLayout(context: Context, game: String, on: Boolean) {
val edit = prefs(context).edit()
if (on) edit.putBoolean("nintendo.$game", true) else edit.remove("nintendo.$game")
edit.apply()
}
fun snap(context: Context): Boolean = prefs(context).getBoolean("snap", true)
fun setSnap(context: Context, on: Boolean) {
@@ -23,7 +23,6 @@ class DirectTouchHold(
private var downId = 0
private var delayMs = 0L
private var holdBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_CLICK
var tapClicks = true
private var forwarded = false
private var held = false
private var pressing = false
@@ -89,8 +88,8 @@ class DirectTouchHold(
downX = event.x
downY = event.y
downId = event.getPointerId(0)
if (holdBehavior != TouchGestureConfig.MOUSE_BEHAVIOR_NONE) handler.postDelayed(hold, delayMs)
else if (tapClicks) forwardDown()
if (holdBehavior == TouchGestureConfig.MOUSE_BEHAVIOR_NONE) forwardDown()
else handler.postDelayed(hold, delayMs)
return true
}
if (held) {
@@ -122,7 +121,6 @@ class DirectTouchHold(
}
MotionEvent.ACTION_UP -> {
handler.removeCallbacks(hold)
if (!forwarded && !tapClicks) return true
if (!forwarded) forwardDown()
upX = event.x
upY = event.y
@@ -94,11 +94,9 @@ data class InputLibrary(
fun panelPart(isDesktop: Boolean, panel: String?): InputPart =
panel?.let { id -> bindings.firstOrNull { it.id == id } }?.let { InputPart(it.id, it.layoutId) } ?: activePart(isDesktop, InputRole.SECONDARY)
fun panelLayout(isDesktop: Boolean, panel: String?) = panelPart(isDesktop, panel).layout?.let { id -> layouts.firstOrNull { it.id == id } }
fun compileActive(isDesktop: Boolean, panel: String? = null): InputProfile = activeId(isDesktop).let { id ->
compileParts(id, InputRole.entries.associateWith {
preset(if (it == InputRole.SECONDARY) panelPart(isDesktop, panel).bindings else activePart(isDesktop, it).bindings)
}, profile(id).base)
}
fun compileActive(isDesktop: Boolean, panel: String? = null): InputProfile = compileParts(activeId(isDesktop), InputRole.entries.associateWith {
preset(if (it == InputRole.SECONDARY) panelPart(isDesktop, panel).bindings else activePart(isDesktop, it).bindings)
})
fun saveSelection(isDesktop: Boolean, name: String, id: String = newInputId()): InputLibrary {
val current = profile(activeId(isDesktop))
@@ -111,14 +109,14 @@ data class InputLibrary(
fun compile(id: String): InputProfile {
val profile = profile(id)
val parts = InputRole.entries.associateWith { preset(profile.binding(it)) }
return compileParts(id, parts, profile.base)
return compileParts(id, parts)
}
private fun compileParts(id: String, parts: Map<InputRole, SavedInputBindings>, base: String): InputProfile {
return InputProfile(id, base = base, bindings = parts.mapValues { it.value.controls }.filterValues { it.isNotEmpty() },
keys = parts.getValue(InputRole.PHYSICAL).keys,
elements = parts.mapValues { it.value.elements }.filterValues { it.isNotEmpty() },
clicks = parts.mapValues { it.value.clicks }.filterValues { it.isNotEmpty() })
private fun compileParts(id: String, parts: Map<InputRole, SavedInputBindings>): InputProfile {
return InputProfile(id, parts.mapValues { it.value.controls }.filterValues { it.isNotEmpty() },
parts.getValue(InputRole.PHYSICAL).keys,
parts.mapValues { it.value.elements }.filterValues { it.isNotEmpty() },
parts.mapValues { it.value.clicks }.filterValues { it.isNotEmpty() })
}
fun usersOfBindings(id: String) = profiles.filter { p -> p.parts.values.any { it.bindings == id } }
@@ -36,7 +36,6 @@ sealed interface InputAction {
data class InputProfile(
val id: String,
val base: String = id,
val bindings: Map<InputRole, Map<InputControl, InputAction>> = emptyMap(),
val keys: List<PhysicalInputBinding> = emptyList(),
val elements: Map<InputRole, Map<String, InputAction>> = emptyMap(),
@@ -51,16 +50,6 @@ data class InputProfile(
fun elementAction(role: InputRole, id: String, control: InputControl): InputAction =
elements[role]?.get(id) ?: if (id == "legacy:${control.id}") action(role, control) else InputAction.Disabled
fun hasMouseButton(role: InputRole, elements: List<InputSurfaceElement>): Boolean {
val stock = defaults(base)
fun chosen(action: InputAction, shipped: InputAction) = action is InputAction.MouseButton && action != shipped
return elements.any {
val pressable = it.kind == InputElementKind.BUTTON || it.kind == InputElementKind.TRIGGER
pressable && chosen(elementAction(role, it.id, it.control), stock.elementAction(role, it.id, it.control)) ||
it.hasClick && chosen(elementClickAction(role, it), stock.elementClickAction(role, it))
}
}
fun elementClickAction(role: InputRole, element: InputSurfaceElement): InputAction = clicks[role]?.get(element.id)
?: defaultElementClick(element, elementAction(role, element.id, element.control)) { action(role, it) }
@@ -83,7 +72,7 @@ data class InputProfile(
InputControl.LEFT_PAD to InputAction.Scroll(), InputControl.RIGHT_PAD to InputAction.Pointer(),
InputControl.LEFT_CLICK to InputAction.MouseButton(273), InputControl.RIGHT_CLICK to InputAction.MouseButton(272),
)
return InputProfile(DESKTOP, bindings = InputRole.entries.associateWith { desktop })
return InputProfile(DESKTOP, InputRole.entries.associateWith { desktop })
}
}
}
@@ -80,8 +80,6 @@ class OnScreenControls(context: Context, pad: PadBridge?, val dock: OnScreenLayo
}
}
fun shownElements() = surface.shownElements()
private fun render() {
val elements = placed()
surface.updateCustomLayout(when {
@@ -21,6 +21,7 @@ public final class PadBridge {
public static final int RIGHT_STICK = 2;
private static final float DEAD_ZONE = 0.12f;
private float stickDeadZone = DEAD_ZONE;
private boolean nintendoLayout;
private static final int[] JOYSTICK_AXES = {
MotionEvent.AXIS_X, MotionEvent.AXIS_Y, MotionEvent.AXIS_Z, MotionEvent.AXIS_RZ,
MotionEvent.AXIS_RX, MotionEvent.AXIS_RY,
@@ -392,10 +393,10 @@ public final class PadBridge {
PadState pad = stateFor(slot);
boolean pressed = event.getAction() == KeyEvent.ACTION_DOWN;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BUTTON_A: pad.press(0, pressed); break;
case KeyEvent.KEYCODE_BUTTON_B: pad.press(1, pressed); break;
case KeyEvent.KEYCODE_BUTTON_X: pad.press(2, pressed); break;
case KeyEvent.KEYCODE_BUTTON_Y: pad.press(3, pressed); break;
case KeyEvent.KEYCODE_BUTTON_A:
case KeyEvent.KEYCODE_BUTTON_B:
case KeyEvent.KEYCODE_BUTTON_X:
case KeyEvent.KEYCODE_BUTTON_Y: pad.press(faceButton(event.getKeyCode(), nintendoLayout), pressed); break;
case KeyEvent.KEYCODE_BUTTON_L1: pad.press(4, pressed); break;
case KeyEvent.KEYCODE_BUTTON_R1: pad.press(5, pressed); break;
case KeyEvent.KEYCODE_BUTTON_SELECT:
@@ -437,6 +438,27 @@ public final class PadBridge {
return true;
}
static int faceButton(int keyCode, boolean nintendo) {
switch (keyCode) {
case KeyEvent.KEYCODE_BUTTON_A: return nintendo ? 1 : 0;
case KeyEvent.KEYCODE_BUTTON_B: return nintendo ? 0 : 1;
case KeyEvent.KEYCODE_BUTTON_X: return nintendo ? 3 : 2;
case KeyEvent.KEYCODE_BUTTON_Y: return nintendo ? 2 : 3;
default: return -1;
}
}
public synchronized void setNintendoLayout(boolean on) {
if (nintendoLayout == on) return;
nintendoLayout = on;
for (int slot = 0; slot < SLOTS; slot++) {
PadState pad = stateFor(slot);
for (int button = 0; button < 4; button++) pad.press(button, false);
}
if (open) publish();
for (int slot = 1; slot < SLOTS; slot++) if (playerWriters[slot] != null) publish(slot);
}
public synchronized void setStickDeadZone(int percent) {
float value = Math.max(0, Math.min(25, percent)) / 100f;
if (stickDeadZone == value) return;
@@ -34,7 +34,6 @@ class ScrollTouchGestures(
private var movedAt = 0L
private var scrolling = false
private var vertical = true
var tapClicks = true
private var held = false
private var dragging = false
private var stoppedFling = false
@@ -113,7 +112,7 @@ class ScrollTouchGestures(
}
dragging -> listener.onButton(PointerGestures.BTN_LEFT, false)
held -> click(PointerGestures.BTN_RIGHT)
!stoppedFling && tapClicks -> click(PointerGestures.BTN_LEFT)
!stoppedFling -> click(PointerGestures.BTN_LEFT)
}
dragging = false
held = false
@@ -17,11 +17,6 @@ class TouchpadGestures(
var bounds: android.graphics.RectF = android.graphics.RectF(0f, 0f, 1f, 1f)
var sensitivity = 1.15f
var desktop = false
var tapClicks = true
set(value) {
field = value
if (!value) lastTapAt = 0L
}
private val handler = Handler(Looper.getMainLooper())
private var lastX = 0f
@@ -60,7 +55,6 @@ class TouchpadGestures(
private val clickUp = Runnable { releaseClick() }
private fun click(button: Int) {
if (!tapClicks) return
releaseClick()
listener.onButton(button, true, x, y)
clicked = button
@@ -114,7 +108,7 @@ class TouchpadGestures(
travelled = 0f; held = false; twoFingers = false; scrolled = false; secondWasTap = false
fingers = 1; pinching = false
anchorId = event.getPointerId(0); moverId = -1; holdDrag = false; scrollLocked = false
if (tapClicks && event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) {
if (event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) {
dragging = true
listener.onButton(PointerGestures.BTN_LEFT, true, x, y)
} else {
@@ -268,7 +262,7 @@ class TouchpadGestures(
}
!cancelled && travelled <= slopPx && event.eventTime - downAt < TouchTiming.TAP_MS -> {
click(PointerGestures.BTN_LEFT)
if (tapClicks) lastTapAt = event.eventTime
lastTapAt = event.eventTime
}
}
dragging = false; held = false; twoFingers = false
@@ -18,8 +18,6 @@ class TwoFingerGestures(private val slopPx: Float, private val listener: Listene
private enum class State { IDLE, PENDING, CANDIDATE, TAPPED, HELD, SCROLLING, PASSING }
var tapClicks = true
private val handler = Handler(Looper.getMainLooper())
private var state = State.IDLE
private var x = 0f
@@ -153,7 +151,7 @@ class TwoFingerGestures(private val slopPx: Float, private val listener: Listene
when (was) {
State.TAPPED -> {
listener.cancelTouch()
if (tapClicks) listener.rightClick(x, y)
listener.rightClick(x, y)
return true
}
State.SCROLLING, State.HELD -> return true
@@ -2,6 +2,7 @@ package com.droiddeck.launcher.session
import android.content.Context
import com.droiddeck.launcher.core.GameEnvironment
import com.droiddeck.launcher.input.ControllerPrefs
object GameProfileManager {
@Synchronized
@@ -22,6 +23,7 @@ object GameProfileManager {
clear("component packages") { ComponentsManager.clearGameComponents(context, scope) }
clear("texture filtering") { SessionPrefs.clearGameTextureFiltering(context, scope) }
clear("Windows components") { WinComponents.setPicks(context, scope, emptyList()) }
clear("Nintendo button layout") { ControllerPrefs.setNintendoLayout(context, scope, false) }
if (failures.isNotEmpty()) {
val names = failures.joinToString { it.first }
@@ -36,60 +36,35 @@ object SessionFiles {
"etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop",
)
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",
)
private const val UBISOFT_SERVICE = "usr/local/lib/droiddeck-ubisoft/droiddeck-upc.exe"
/** Fetches the Ubisoft pack and, once it lands, stages the service so a running session gets it without restarting. */
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 ->
fun ensureUbisoftService(context: Context) {
AddonPack.UBISOFT.ensure(context) { app ->
com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).takeIf { it.isDirectory }
?.let { stageStoreService(app, it, pack, null) }
?.let { stageUbisoftService(app, it, 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 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()
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) }
}
if (installed) ledger?.staged(relative, target) else Log.e(TAG, "$relative NOT staged")
all = all && installed
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()
}
return all
if (installed) ledger?.staged(UBISOFT_SERVICE, target) else Log.e(TAG, "$UBISOFT_SERVICE NOT staged")
}
fun stage(context: Context, root: File, startsSession: Boolean = false) {
@@ -98,6 +73,8 @@ 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",
@@ -257,6 +234,7 @@ 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)
@@ -270,7 +248,7 @@ object SessionFiles {
var installed = false
try {
target.parentFile?.mkdirs()
context.assets.open("linuxfs/$asset").use { input ->
(if (asset.startsWith("rockstar/")) requireNotNull(javaClass.getResourceAsStream("/$asset")) else context.assets.open("linuxfs/$asset")).use { input ->
staged.outputStream().use { output -> FileUtils.copy(input, output) }
}
installed = staged.setExecutable(true, false) && staged.renameTo(target)
@@ -312,7 +290,7 @@ object SessionFiles {
}
if (installed) ledger.staged(key, target) else Log.e(TAG, "DirectAudio $set/$relative NOT staged")
}
for (pack in SERVICE_PACKS.keys) stageStoreService(context, root, pack, ledger)
stageUbisoftService(context, root, ledger)
ledger.save()
for (old in arrayOf("aarch64-unix", "aarch64-windows", "i386-windows")) File(root, "$DIRECTAUDIO_DIR/lib/wine/$old").deleteRecursively()
val preload = StringBuilder("/usr/local/lib/libblsession.so\n")
@@ -641,13 +641,6 @@ 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) {
@@ -946,7 +939,7 @@ object SessionPrefs {
prefs(context).edit().putBoolean("steamGpuCompositing", false).apply()
return false
}
return prefs(context).getBoolean("steamGpuCompositing", true)
return prefs(context).getBoolean("steamGpuCompositing", false)
}
fun steamGpuCompositingAllowed(): Boolean =
@@ -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", "integerScaling", "railLabels", "agentTab", "navTabOrder", "navTabShelved", "navTabHidden", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys",
"stretch16x9", "picturePosition", "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",
@@ -80,11 +80,6 @@ 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,7 +141,6 @@ 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("mountRoot", view.opt("mountRoot"))
.put("exe", view.getString("exe")).put("playfab", view.opt("playfab"))
} catch (e: Exception) { released(token); throw e }
}
@@ -33,7 +33,6 @@ 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
@@ -74,10 +73,8 @@ 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
@@ -339,107 +336,6 @@ 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,7 +82,6 @@ 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,8 +567,7 @@ 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 ||
com.droiddeck.launcher.agent.AgentSetup.problems.isNotEmpty()
private fun hasActivity() = AgentHost.lab != null || AgentHost.queue.isNotEmpty() || currentTodo() != null
/** The todo item in progress and how many are done, while the agent works through a list. */
private fun currentTodo(): String? {
@@ -595,11 +594,6 @@ 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))
@@ -926,6 +926,7 @@ internal fun GameSettingsMenus(host: MenuHost, game: com.droiddeck.launcher.fron
val custom = stringResource(R.string.comp_game_fex_custom)
val customSync = stringResource(R.string.game_sync_custom)
val resetDone = stringResource(R.string.comp_game_reset_done, game.name)
var nintendo by remember(scope, current) { mutableStateOf(com.droiddeck.launcher.input.ControllerPrefs.nintendoLayout(appContext, scope)) }
val resKey = "game-settings-res"
val resolution = current?.let { com.droiddeck.launcher.core.GameEnvironment.gameResolution(it, scope) }
val screen = remember { com.droiddeck.launcher.session.SessionDisplay.screenSize(com.droiddeck.launcher.session.SessionDisplay.panelSize(appContext)) }
@@ -978,11 +979,17 @@ internal fun GameSettingsMenus(host: MenuHost, game: com.droiddeck.launcher.fron
trailing = { Text("›", fontSize = 16.sp, color = colors.onSurfaceVariant) },
) { host.open = syncKey }
}
MenuItem(stringResource(R.string.game_nintendo_layout), checked = nintendo, enabled = !state.saving,
detail = stringResource(R.string.game_nintendo_layout_detail)) {
nintendo = !nintendo
com.droiddeck.launcher.input.ControllerPrefs.setNintendoLayout(appContext, scope, nintendo)
}
MenuItem(stringResource(R.string.game_settings_default), checked = false, enabled = ready,
detail = stringResource(R.string.game_settings_default_detail)) {
save {
val failure = runCatching { com.droiddeck.launcher.session.GameProfileManager.reset(it, scope) }.exceptionOrNull()
com.droiddeck.launcher.stores.StoresState.post {
nintendo = com.droiddeck.launcher.input.ControllerPrefs.nintendoLayout(it, scope)
android.widget.Toast.makeText(
it,
if (failure == null) resetDone else it.getString(R.string.comp_game_reset_failed, failure.message.orEmpty()),
@@ -835,7 +835,6 @@ private fun LaunchTab(game: Library.SteamGame, s: FrontEndState, a: FrontEndActi
LaunchSettings(s, a, host, game, hopRail ?: GameRef.key(game))
if (canEditSteamLaunchOptions(game, s.shortcutPicker)) {
SteamLaunchOptionsPanel(game.appId)
SteamInputOverridePanel(game.appId)
}
val folder = game.gameFiles
if (game.library == Library.ADDED && game.source == Library.ADDED && !s.shortcutPicker && folder != null) ShortcutFields(game, folder)
@@ -158,11 +158,6 @@ class InputSurfaceView(
}
}
fun shownElements(): List<InputSurfaceElement> {
val canvas = customCanvas ?: return customLayout
return customLayout.filterIndexed { index, _ -> (canvas.getChildAt(index) as? StickView)?.drawn != false }
}
fun releaseInputs() {
val now = android.os.SystemClock.uptimeMillis()
val cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)
@@ -519,8 +514,6 @@ class InputSurfaceView(
val adaptive get() = adaptive(element)
val drawn get() = !hideWhenIdle || touching
fun reach() = min(width, height) * if (classic(element)) CLASSIC_REACH else PANEL_REACH
fun captures(x: Float, y: Float): Boolean {
@@ -537,7 +530,7 @@ class InputSurfaceView(
}
override fun onDraw(canvas: Canvas) {
if (!drawn) return
if (hideWhenIdle && !touching) return
val cx = if (touching) originX else centreX()
val cy = if (touching) originY else height / 2f
val color = tint
@@ -83,7 +83,6 @@ 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,
@@ -140,7 +139,6 @@ 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 = {},
@@ -244,18 +242,6 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
}
}
SettingsGroup(stringResource(R.string.display_image_scaling)) {
s.integerScaling?.let { enabled ->
ChoiceRow(
host, "integer-scaling",
stringResource(R.string.display_integer_scaling),
stringResource(R.string.display_integer_scaling_hint),
listOf(
false to stringResource(R.string.display_scaling_fit),
true to stringResource(R.string.display_scaling_auto),
),
enabled, onPick = a.onIntegerScaling,
)
}
ChoiceRow(
host, "upscaler", stringResource(R.string.display_filter), null,
SessionPrefs.upscalerChoices(LocalContext.current), s.upscaler,
@@ -239,8 +239,6 @@ class SecondScreenPresentation(
return super.dispatchGenericMotionEvent(event)
}
fun shownControlElements() = controlsView?.takeIf { isShowing && it.isShown }?.shownElements().orEmpty()
fun refreshControls() {
if (!created || !currentMode.controls) return
val controls = controlsView ?: return
+2 -4
View File
@@ -537,6 +537,8 @@
<string name="game_settings_menu_title">إعدادات %1$s</string>
<string name="game_settings_default">الافتراضي</string>
<string name="game_settings_default_detail">يعيد كل ما تم تغييره لهذه اللعبة إلى إعدادات التطبيق.</string>
<string name="game_nintendo_layout">تخطيط أزرار نينتندو</string>
<string name="game_nintendo_layout_detail">يبدّل A/B وX/Y في وحدات التحكم الفعلية.</string>
<string name="game_sync_custom">متغيرات مزامنة مخصصة</string>
<string name="comp_game_proton_live">تم حفظ اختيار Proton لـ %1$s وهو متاح في Steam الآن.</string>
<string name="comp_game_proton_next">تم حفظ اختيار Proton لـ %1$s. أعد تشغيل Steam قبل تشغيل اللعبة.</string>
@@ -1195,7 +1197,6 @@
<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>
@@ -4267,7 +4268,4 @@
<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>
+2 -4
View File
@@ -531,6 +531,8 @@
<string name="game_settings_menu_title">Ajustes de %1$s</string>
<string name="game_settings_default">Predeterminado</string>
<string name="game_settings_default_detail">Devuelve todo lo cambiado para este juego a los ajustes de la app.</string>
<string name="game_nintendo_layout">Distribución de botones de Nintendo</string>
<string name="game_nintendo_layout_detail">Intercambia A/B y X/Y en los controles físicos.</string>
<string name="game_sync_custom">Variables de sincronización personalizadas</string>
<string name="comp_game_proton_live">La elección de Proton de %1$s se ha guardado y ya está disponible en Steam.</string>
<string name="comp_game_proton_next">La elección de Proton de %1$s se ha guardado. Reinicia Steam antes de iniciar el juego.</string>
@@ -1213,7 +1215,6 @@
<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>
@@ -4118,7 +4119,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">Настройки на %1$s</string>
<string name="game_settings_default">По подразбиране</string>
<string name="game_settings_default_detail">Връща всичко, променено за тази игра, към настройките на приложението.</string>
<string name="game_nintendo_layout">Подредба на бутоните като при Nintendo</string>
<string name="game_nintendo_layout_detail">Разменя A/B и X/Y на физическите контролери.</string>
<string name="game_sync_custom">Персонализирани променливи за синхронизация</string>
<string name="comp_game_proton_live">Изборът на Proton за %1$s е запазен и вече е достъпен в Steam.</string>
<string name="comp_game_proton_next">Изборът на Proton за %1$s е запазен. Рестартирайте Steam, преди да стартирате играта.</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -533,6 +533,8 @@
<string name="game_settings_menu_title">Nastavení %1$s</string>
<string name="game_settings_default">Výchozí</string>
<string name="game_settings_default_detail">Vrátí vše, co se u této hry změnilo, na nastavení aplikace.</string>
<string name="game_nintendo_layout">Rozložení tlačítek Nintendo</string>
<string name="game_nintendo_layout_detail">Prohodí A/B a X/Y na fyzických ovladačích.</string>
<string name="game_sync_custom">Vlastní proměnné synchronizace</string>
<string name="comp_game_proton_live">Výběr Protonu pro %1$s je uložen a hned dostupný ve Steamu.</string>
<string name="comp_game_proton_next">Výběr Protonu pro %1$s je uložen. Před spuštěním hry restartujte Steam.</string>
@@ -1189,7 +1191,6 @@
<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>
@@ -4187,7 +4188,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">Indstillinger for %1$s</string>
<string name="game_settings_default">Standard</string>
<string name="game_settings_default_detail">Sætter alt, der er ændret for dette spil, tilbage til appens indstillinger.</string>
<string name="game_nintendo_layout">Nintendo-knaplayout</string>
<string name="game_nintendo_layout_detail">Bytter om på A/B og X/Y på fysiske controllere.</string>
<string name="game_sync_custom">Brugerdefinerede synkroniseringsvariabler</string>
<string name="comp_game_proton_live">%1$s’s Proton-valg er gemt og tilgængeligt i Steam nu.</string>
<string name="comp_game_proton_next">%1$s’s Proton-valg er gemt. Genstart Steam, inden du starter spillet.</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">Einstellungen für %1$s</string>
<string name="game_settings_default">Standard</string>
<string name="game_settings_default_detail">Setzt alles, was für dieses Spiel geändert wurde, auf die Einstellungen der App zurück.</string>
<string name="game_nintendo_layout">Nintendo-Tastenlayout</string>
<string name="game_nintendo_layout_detail">Vertauscht A/B und X/Y auf physischen Controllern.</string>
<string name="game_sync_custom">Eigene Sync-Variablen</string>
<string name="comp_game_proton_live">Die Proton-Auswahl für %1$s ist gespeichert und jetzt in Steam verfügbar.</string>
<string name="comp_game_proton_next">Die Proton-Auswahl für %1$s ist gespeichert. Starte Steam neu, bevor du das Spiel startest.</string>
@@ -1175,7 +1177,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">Ρυθμίσεις %1$s</string>
<string name="game_settings_default">Προεπιλογή</string>
<string name="game_settings_default_detail">Επαναφέρει ό,τι άλλαξε για αυτό το παιχνίδι στις ρυθμίσεις της εφαρμογής.</string>
<string name="game_nintendo_layout">Διάταξη κουμπιών Nintendo</string>
<string name="game_nintendo_layout_detail">Εναλλάσσει τα A/B και X/Y στα φυσικά χειριστήρια.</string>
<string name="game_sync_custom">Προσαρμοσμένες μεταβλητές συγχρονισμού</string>
<string name="comp_game_proton_live">Η επιλογή Proton του %1$s αποθηκεύτηκε και είναι διαθέσιμη στο Steam τώρα.</string>
<string name="comp_game_proton_next">Η επιλογή Proton του %1$s αποθηκεύτηκε. Κάντε επανεκκίνηση του Steam πριν εκκινήσετε το παιχνίδι.</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -531,6 +531,8 @@
<string name="game_settings_menu_title">Ajustes de %1$s</string>
<string name="game_settings_default">Predeterminado</string>
<string name="game_settings_default_detail">Devuelve todo lo cambiado para este juego a los ajustes de la aplicación.</string>
<string name="game_nintendo_layout">Distribución de botones de Nintendo</string>
<string name="game_nintendo_layout_detail">Intercambia A/B y X/Y en los mandos físicos.</string>
<string name="game_sync_custom">Variables de sincronización personalizadas</string>
<string name="comp_game_proton_live">La elección de Proton de %1$s se ha guardado y ya está disponible en Steam.</string>
<string name="comp_game_proton_next">La elección de Proton de %1$s se ha guardado. Reinicia Steam antes de iniciar el juego.</string>
@@ -1186,7 +1188,6 @@
<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>
@@ -4147,7 +4148,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">%1$s – asetukset</string>
<string name="game_settings_default">Oletus</string>
<string name="game_settings_default_detail">Palauttaa kaiken tälle pelille muutetun sovelluksen asetuksiin.</string>
<string name="game_nintendo_layout">Nintendon painikeasettelu</string>
<string name="game_nintendo_layout_detail">Vaihtaa A/B- ja X/Y-painikkeet keskenään fyysisissä ohjaimissa.</string>
<string name="game_sync_custom">Mukautetut synkronointimuuttujat</string>
<string name="comp_game_proton_live">%1$s:n Proton-valinta on tallennettu ja käytettävissä Steamissa nyt.</string>
<string name="comp_game_proton_next">%1$s:n Proton-valinta on tallennettu. Käynnistä Steam uudelleen ennen pelin käynnistämistä.</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -531,6 +531,8 @@
<string name="game_settings_menu_title">Paramètres de %1$s</string>
<string name="game_settings_default">Par défaut</string>
<string name="game_settings_default_detail">Remet tout ce qui a été modifié pour ce jeu aux paramètres de l\'application.</string>
<string name="game_nintendo_layout">Disposition des boutons Nintendo</string>
<string name="game_nintendo_layout_detail">Inverse A/B et X/Y sur les manettes physiques.</string>
<string name="game_sync_custom">Variables de synchronisation personnalisées</string>
<string name="comp_game_proton_live">Le choix de Proton pour %1$s est enregistré et disponible dès maintenant dans Steam.</string>
<string name="comp_game_proton_next">Le choix de Proton pour %1$s est enregistré. Redémarrez Steam avant de lancer le jeu.</string>
@@ -1186,7 +1188,6 @@
<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>
@@ -4146,7 +4147,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">%1$s सेटिंग</string>
<string name="game_settings_default">डिफ़ॉल्ट</string>
<string name="game_settings_default_detail">इस गेम के लिए बदली गई हर चीज़ को ऐप की सेटिंग पर वापस लाता है।</string>
<string name="game_nintendo_layout">Nintendo बटन लेआउट</string>
<string name="game_nintendo_layout_detail">फ़िज़िकल कंट्रोलर पर A/B और X/Y की अदला-बदली करता है।</string>
<string name="game_sync_custom">कस्टम सिंक वेरिएबल</string>
<string name="comp_game_proton_live">%1$s का Proton चुनाव सेव है और अभी Steam में उपलब्ध है।</string>
<string name="comp_game_proton_next">%1$s का Proton चुनाव सेव है। गेम शुरू करने से पहले Steam रीस्टार्ट करें।</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">%1$s beállításai</string>
<string name="game_settings_default">Alapértelmezett</string>
<string name="game_settings_default_detail">Mindent, amit ennél a játéknál módosítottál, visszaállít az alkalmazás beállításaira.</string>
<string name="game_nintendo_layout">Nintendo gombkiosztás</string>
<string name="game_nintendo_layout_detail">Felcseréli az A/B és X/Y gombokat a fizikai kontrollereken.</string>
<string name="game_sync_custom">Egyéni szinkronizálási változók</string>
<string name="comp_game_proton_live">A %1$s Proton-választása mentve, és már elérhető a Steamben.</string>
<string name="comp_game_proton_next">A %1$s Proton-választása mentve. Indítsa újra a Steamet a játék elindítása előtt.</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">Setelan %1$s</string>
<string name="game_settings_default">Default</string>
<string name="game_settings_default_detail">Mengembalikan semua yang diubah untuk game ini ke setelan aplikasi.</string>
<string name="game_nintendo_layout">Tata letak tombol Nintendo</string>
<string name="game_nintendo_layout_detail">Menukar A/B dan X/Y pada kontroler fisik.</string>
<string name="game_sync_custom">Variabel sinkronisasi kustom</string>
<string name="comp_game_proton_live">Pilihan Proton %1$s tersimpan dan sudah tersedia di Steam sekarang.</string>
<string name="comp_game_proton_next">Pilihan Proton %1$s tersimpan. Mulai ulang Steam sebelum meluncurkan gim.</string>
@@ -1180,7 +1182,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -4
View File
@@ -531,6 +531,8 @@
<string name="game_settings_menu_title">Impostazioni di %1$s</string>
<string name="game_settings_default">Predefinito</string>
<string name="game_settings_default_detail">Riporta tutto ciò che è stato cambiato per questo gioco alle impostazioni dell\'app.</string>
<string name="game_nintendo_layout">Disposizione dei pulsanti Nintendo</string>
<string name="game_nintendo_layout_detail">Scambia A/B e X/Y sui controller fisici.</string>
<string name="game_sync_custom">Variabili di sincronizzazione personalizzate</string>
<string name="comp_game_proton_live">La scelta di Proton per %1$s è salvata e già disponibile in Steam.</string>
<string name="comp_game_proton_next">La scelta di Proton per %1$s è salvata. Riavvia Steam prima di avviare il gioco.</string>
@@ -1178,7 +1180,6 @@
<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>
@@ -4146,7 +4147,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">%1$s の設定</string>
<string name="game_settings_default">デフォルト</string>
<string name="game_settings_default_detail">このゲーム用に変更した内容をすべてアプリの設定に戻します。</string>
<string name="game_nintendo_layout">Nintendoのボタン配置</string>
<string name="game_nintendo_layout_detail">物理コントローラーのA/BとX/Yを入れ替えます。</string>
<string name="game_sync_custom">カスタム同期変数</string>
<string name="comp_game_proton_live">%1$sのProtonの選択を保存しました。Steamですぐに使用できます。</string>
<string name="comp_game_proton_next">%1$sのProtonの選択を保存しました。ゲームを起動する前にSteamを再起動してください。</string>
@@ -1180,7 +1182,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">%1$s 설정</string>
<string name="game_settings_default">기본값</string>
<string name="game_settings_default_detail">이 게임에서 변경한 모든 항목을 앱 설정으로 되돌립니다.</string>
<string name="game_nintendo_layout">Nintendo 버튼 배치</string>
<string name="game_nintendo_layout_detail">실제 컨트롤러의 A/B와 X/Y를 서로 바꿉니다.</string>
<string name="game_sync_custom">사용자 지정 동기화 변수</string>
<string name="comp_game_proton_live">%1$s의 Proton 선택이 저장되었으며 지금 Steam에서 사용할 수 있습니다.</string>
<string name="comp_game_proton_next">%1$s의 Proton 선택이 저장되었습니다. 게임을 실행하기 전에 Steam을 다시 시작하세요.</string>
@@ -1180,7 +1182,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">Tetapan %1$s</string>
<string name="game_settings_default">Lalai</string>
<string name="game_settings_default_detail">Mengembalikan semua yang diubah untuk permainan ini kepada tetapan apl.</string>
<string name="game_nintendo_layout">Susun atur butang Nintendo</string>
<string name="game_nintendo_layout_detail">Menukar A/B dan X/Y pada pengawal fizikal.</string>
<string name="game_sync_custom">Pemboleh ubah segerak tersuai</string>
<string name="comp_game_proton_live">Pilihan Proton %1$s disimpan dan tersedia dalam Steam sekarang.</string>
<string name="comp_game_proton_next">Pilihan Proton %1$s disimpan. Mulakan semula Steam sebelum melancarkan permainan.</string>
@@ -1180,7 +1182,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">Innstillinger for %1$s</string>
<string name="game_settings_default">Standard</string>
<string name="game_settings_default_detail">Setter alt som er endret for dette spillet, tilbake til appens innstillinger.</string>
<string name="game_nintendo_layout">Nintendo-knappeoppsett</string>
<string name="game_nintendo_layout_detail">Bytter om A/B og X/Y på fysiske kontrollere.</string>
<string name="game_sync_custom">Egendefinerte synkroniseringsvariabler</string>
<string name="comp_game_proton_live">Proton-valget til %1$s er lagret og tilgjengelig i Steam nå.</string>
<string name="comp_game_proton_next">Proton-valget til %1$s er lagret. Start Steam på nytt før du starter spillet.</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">Instellingen voor %1$s</string>
<string name="game_settings_default">Standaard</string>
<string name="game_settings_default_detail">Zet alles wat voor deze game is gewijzigd terug naar de instellingen van de app.</string>
<string name="game_nintendo_layout">Nintendo-knopindeling</string>
<string name="game_nintendo_layout_detail">Wisselt A/B en X/Y om op fysieke controllers.</string>
<string name="game_sync_custom">Aangepaste synchronisatievariabelen</string>
<string name="comp_game_proton_live">De Proton-keuze van %1$s is opgeslagen en nu beschikbaar in Steam.</string>
<string name="comp_game_proton_next">De Proton-keuze van %1$s is opgeslagen. Start Steam opnieuw voordat je de game start.</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -533,6 +533,8 @@
<string name="game_settings_menu_title">Ustawienia: %1$s</string>
<string name="game_settings_default">Domyślne</string>
<string name="game_settings_default_detail">Przywraca wszystko, co zmieniono dla tej gry, do ustawień aplikacji.</string>
<string name="game_nintendo_layout">Układ przycisków Nintendo</string>
<string name="game_nintendo_layout_detail">Zamienia A/B i X/Y na fizycznych kontrolerach.</string>
<string name="game_sync_custom">Własne zmienne synchronizacji</string>
<string name="comp_game_proton_live">Wybór Proton dla %1$s zapisano i jest już dostępny w Steam.</string>
<string name="comp_game_proton_next">Wybór Proton dla %1$s zapisano. Uruchom ponownie Steam przed uruchomieniem gry.</string>
@@ -1189,7 +1191,6 @@
<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>
@@ -4187,7 +4188,4 @@
<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>
+2 -4
View File
@@ -531,6 +531,8 @@
<string name="game_settings_menu_title">Definições de %1$s</string>
<string name="game_settings_default">Predefinição</string>
<string name="game_settings_default_detail">Repõe tudo o que foi alterado neste jogo nas definições da aplicação.</string>
<string name="game_nintendo_layout">Disposição dos botões da Nintendo</string>
<string name="game_nintendo_layout_detail">Troca A/B e X/Y nos comandos físicos.</string>
<string name="game_sync_custom">Variáveis de sincronização personalizadas</string>
<string name="comp_game_proton_live">A escolha de Proton de %1$s foi guardada e já está disponível no Steam.</string>
<string name="comp_game_proton_next">A escolha de Proton de %1$s foi guardada. Reinicie o Steam antes de iniciar o jogo.</string>
@@ -1178,7 +1180,6 @@
<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>
@@ -4146,7 +4147,4 @@
<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>
+2 -4
View File
@@ -531,6 +531,8 @@
<string name="game_settings_menu_title">Configurações de %1$s</string>
<string name="game_settings_default">Padrão</string>
<string name="game_settings_default_detail">Volta tudo o que foi alterado neste jogo para as configurações do app.</string>
<string name="game_nintendo_layout">Layout de botões da Nintendo</string>
<string name="game_nintendo_layout_detail">Troca A/B e X/Y nos controles físicos.</string>
<string name="game_sync_custom">Variáveis de sincronização personalizadas</string>
<string name="comp_game_proton_live">A escolha de Proton de %1$s foi salva e já está disponível na Steam.</string>
<string name="comp_game_proton_next">A escolha de Proton de %1$s foi salva. Reinicie a Steam antes de iniciar o jogo.</string>
@@ -1185,7 +1187,6 @@
<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>
@@ -4154,7 +4155,4 @@
<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>
+2 -4
View File
@@ -531,6 +531,8 @@
<string name="game_settings_menu_title">Setări %1$s</string>
<string name="game_settings_default">Implicit</string>
<string name="game_settings_default_detail">Readuce tot ce s-a schimbat pentru acest joc la setările aplicației.</string>
<string name="game_nintendo_layout">Aranjament de butoane Nintendo</string>
<string name="game_nintendo_layout_detail">Inversează A/B și X/Y pe controlerele fizice.</string>
<string name="game_sync_custom">Variabile de sincronizare personalizate</string>
<string name="comp_game_proton_live">Alegerea Proton pentru %1$s este salvată și disponibilă în Steam acum.</string>
<string name="comp_game_proton_next">Alegerea Proton pentru %1$s este salvată. Repornește Steam înainte de a lansa jocul.</string>
@@ -1186,7 +1188,6 @@
<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>
@@ -4147,7 +4148,4 @@
<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>
+2 -4
View File
@@ -533,6 +533,8 @@
<string name="game_settings_menu_title">Настройки %1$s</string>
<string name="game_settings_default">По умолчанию</string>
<string name="game_settings_default_detail">Возвращает всё, что изменено для этой игры, к настройкам приложения.</string>
<string name="game_nintendo_layout">Раскладка кнопок Nintendo</string>
<string name="game_nintendo_layout_detail">Меняет местами A/B и X/Y на физических контроллерах.</string>
<string name="game_sync_custom">Свои переменные синхронизации</string>
<string name="comp_game_proton_live">Выбор Proton для %1$s сохранен и уже доступен в Steam.</string>
<string name="comp_game_proton_next">Выбор Proton для %1$s сохранен. Перезапустите Steam перед запуском игры.</string>
@@ -1189,7 +1191,6 @@
<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>
@@ -4187,7 +4188,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">Inställningar för %1$s</string>
<string name="game_settings_default">Standard</string>
<string name="game_settings_default_detail">Återställer allt som ändrats för det här spelet till appens inställningar.</string>
<string name="game_nintendo_layout">Nintendo-knapplayout</string>
<string name="game_nintendo_layout_detail">Byter plats på A/B och X/Y på fysiska handkontroller.</string>
<string name="game_sync_custom">Anpassade synkvariabler</string>
<string name="comp_game_proton_live">%1$s:s Proton-val är sparat och tillgängligt i Steam nu.</string>
<string name="comp_game_proton_next">%1$s:s Proton-val är sparat. Starta om Steam innan du startar spelet.</string>
@@ -1183,7 +1185,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">การตั้งค่า %1$s</string>
<string name="game_settings_default">ค่าเริ่มต้น</string>
<string name="game_settings_default_detail">คืนทุกอย่างที่เปลี่ยนสำหรับเกมนี้กลับเป็นการตั้งค่าของแอป</string>
<string name="game_nintendo_layout">รูปแบบปุ่มแบบ Nintendo</string>
<string name="game_nintendo_layout_detail">สลับปุ่ม A/B และ X/Y บนคอนโทรลเลอร์จริง</string>
<string name="game_sync_custom">ตัวแปรซิงก์แบบกำหนดเอง</string>
<string name="comp_game_proton_live">บันทึกการเลือก Proton ของ %1$s แล้ว และพร้อมใช้งานใน Steam ตอนนี้</string>
<string name="comp_game_proton_next">บันทึกการเลือก Proton ของ %1$s แล้ว รีสตาร์ท Steam ก่อนเปิดเกม</string>
@@ -1180,7 +1182,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -4
View File
@@ -529,6 +529,8 @@
<string name="game_settings_menu_title">%1$s Ayarları</string>
<string name="game_settings_default">Varsayılan</string>
<string name="game_settings_default_detail">Bu oyun için değiştirilen her şeyi uygulamanın ayarlarına döndürür.</string>
<string name="game_nintendo_layout">Nintendo düğme düzeni</string>
<string name="game_nintendo_layout_detail">Fiziksel kontrolcülerde A ile B\'nin ve X ile Y\'nin yerini değiştirir.</string>
<string name="game_sync_custom">Özel eşitleme değişkenleri</string>
<string name="comp_game_proton_live">%1$s için Proton seçimi kaydedildi ve şimdi Steam\'de kullanılabilir.</string>
<string name="comp_game_proton_next">%1$s için Proton seçimi kaydedildi. Oyunu başlatmadan önce Steam\'i yeniden başlatın.</string>
@@ -1175,7 +1177,6 @@
<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>
@@ -4107,7 +4108,4 @@
<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>
+2 -4
View File
@@ -533,6 +533,8 @@
<string name="game_settings_menu_title">Налаштування %1$s</string>
<string name="game_settings_default">За замовчуванням</string>
<string name="game_settings_default_detail">Повертає все, що змінено для цієї гри, до налаштувань застосунку.</string>
<string name="game_nintendo_layout">Розкладка кнопок Nintendo</string>
<string name="game_nintendo_layout_detail">Міняє місцями A/B і X/Y на фізичних контролерах.</string>
<string name="game_sync_custom">Власні змінні синхронізації</string>
<string name="comp_game_proton_live">Вибір Proton для %1$s збережено, і він уже доступний у Steam.</string>
<string name="comp_game_proton_next">Вибір Proton для %1$s збережено. Перезапустіть Steam перед запуском гри.</string>
@@ -1189,7 +1191,6 @@
<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>
@@ -4187,7 +4188,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">Thiết lập %1$s</string>
<string name="game_settings_default">Mặc định</string>
<string name="game_settings_default_detail">Đưa mọi thứ đã thay đổi cho trò chơi này về thiết lập của ứng dụng.</string>
<string name="game_nintendo_layout">Bố cục nút kiểu Nintendo</string>
<string name="game_nintendo_layout_detail">Hoán đổi A/B và X/Y trên tay cầm vật lý.</string>
<string name="game_sync_custom">Biến đồng bộ tùy chỉnh</string>
<string name="comp_game_proton_live">Lựa chọn Proton của %1$s đã được lưu và khả dụng ngay trong Steam.</string>
<string name="comp_game_proton_next">Lựa chọn Proton của %1$s đã được lưu. Khởi động lại Steam trước khi chạy game.</string>
@@ -1180,7 +1182,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">%1$s 设置</string>
<string name="game_settings_default">默认</string>
<string name="game_settings_default_detail">将为此游戏更改的所有内容恢复为应用的设置。</string>
<string name="game_nintendo_layout">任天堂按键布局</string>
<string name="game_nintendo_layout_detail">交换实体手柄上的 A/B 和 X/Y。</string>
<string name="game_sync_custom">自定义同步变量</string>
<string name="comp_game_proton_live">%1$s 的 Proton 选择已保存,现已在 Steam 中可用。</string>
<string name="comp_game_proton_next">%1$s 的 Proton 选择已保存。启动游戏前请重启 Steam。</string>
@@ -1263,7 +1265,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">%1$s 設定</string>
<string name="game_settings_default">預設</string>
<string name="game_settings_default_detail">將為此遊戲更改的所有內容還原為應用程式的設定。</string>
<string name="game_nintendo_layout">任天堂按鍵佈局</string>
<string name="game_nintendo_layout_detail">對調實體手掣上的 A/B 及 X/Y。</string>
<string name="game_sync_custom">自訂同步變數</string>
<string name="comp_game_proton_live">已儲存 %1$s 的 Proton 選擇,現已可在 Steam 中使用。</string>
<string name="comp_game_proton_next">已儲存 %1$s 的 Proton 選擇。請先重新啟動 Steam,再啟動遊戲。</string>
@@ -1179,7 +1181,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -4
View File
@@ -527,6 +527,8 @@
<string name="game_settings_menu_title">%1$s 設定</string>
<string name="game_settings_default">預設</string>
<string name="game_settings_default_detail">將為此遊戲變更的所有內容還原為應用程式的設定。</string>
<string name="game_nintendo_layout">任天堂按鍵配置</string>
<string name="game_nintendo_layout_detail">交換實體控制器上的 A/B 與 X/Y。</string>
<string name="game_sync_custom">自訂同步變數</string>
<string name="comp_game_proton_live">已儲存 %1$s 的 Proton 選擇,現在即可在 Steam 中使用。</string>
<string name="comp_game_proton_next">已儲存 %1$s 的 Proton 選擇。啟動遊戲前請重新啟動 Steam。</string>
@@ -1179,7 +1181,6 @@
<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>
@@ -4077,7 +4078,4 @@
<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>
+2 -14
View File
@@ -557,6 +557,8 @@
<string name="game_settings_menu_title">%1$s Settings</string>
<string name="game_settings_default">Default</string>
<string name="game_settings_default_detail">Puts everything changed for this game back to the app\'s settings.</string>
<string name="game_nintendo_layout">Nintendo button layout</string>
<string name="game_nintendo_layout_detail">Swaps A/B and X/Y on physical controllers.</string>
<string name="game_sync_custom">Custom sync variables</string>
<string name="comp_game_proton_live">%1$s\'s Proton choice is saved and available in Steam now.</string>
<string name="comp_game_proton_next">%1$s\'s Proton choice is saved. Restart Steam before launching the game.</string>
@@ -1269,7 +1271,6 @@
<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>
@@ -1284,7 +1285,6 @@
<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>
@@ -2660,10 +2660,6 @@
<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>
@@ -2982,14 +2978,6 @@
<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>
@@ -1,117 +0,0 @@
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"))
}
}
@@ -1,51 +0,0 @@
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,52 +80,6 @@ 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)
@@ -225,7 +179,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.Notice("service unavailable"), Entry.Thought("hm"), Entry.Used("t1", "Read", "/root/x", "{}"),
Entry.Asked("hi", listOf("/root/x.png")), Entry.Said("hello"), 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),
)
@@ -235,7 +189,7 @@ class AgentHostTest {
assertEquals("claude", loaded.harness)
assertEquals("abc", loaded.conversation)
assertEquals(listOf(
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.Asked("hi", listOf("/root/x.png")), Entry.Said("hello"), 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)
@@ -244,7 +198,6 @@ 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,36 +100,6 @@ class SteamLaunchOptionsTest {
private fun localConfig(home: File, account: String) = File(home, "userdata/$account/config/localconfig.vdf").apply { parentFile!!.mkdirs() }
private fun withRootApp(text: String, appId: Int, key: String, value: String) = text.replaceFirst(
"{\n\t\"Software\"",
"{\n\t\"apps\"\n\t{\n\t\t\"$appId\"\n\t\t{\n\t\t\t\"$key\"\t\t\"$value\"\n\t\t}\n\t}\n\t\"Software\"",
)
@Test fun steamInputIsReadFromTheRootAppsSection() {
val home = steamHome()
localConfig(home, "60974196").writeText(withRootApp(config(apps(*sparking)), 1790600, "UseSteamControllerConfig", "2"))
assertEquals("2", SteamLaunchOptions.steamAppSetting(home, 1790600, "UseSteamControllerConfig", "1"))
assertEquals("1", SteamLaunchOptions.steamAppSetting(home, 400, "UseSteamControllerConfig", "1"))
}
@Test fun steamInputIsWrittenToTheRootAppsSectionAndAnOldCopyIsDropped() {
val home = steamHome()
val legacy = arrayOf(
"\t\t\t\t\t\"1790600\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"LaunchOptions\"\t\t\"-dx11\"",
"\t\t\t\t\t\t\"UseSteamControllerConfig\"\t\t\"0\"", "\t\t\t\t\t}",
)
val file = localConfig(home, "60974196").apply { writeText(config(apps(*legacy))) }
assertEquals("0", SteamLaunchOptions.steamAppSetting(home, 1790600, "UseSteamControllerConfig", "1"))
assertTrue(SteamLaunchOptions.writeSteamAppSetting(home, 1790600, "UseSteamControllerConfig", "0", "2", "1"))
val written = file.readText()
assertEquals("2", SteamLaunchOptions.steamAppSetting(home, 1790600, "UseSteamControllerConfig", "1"))
assertEquals(1, Regex("UseSteamControllerConfig").findAll(written).count())
assertFalse(written.substring(written.indexOf("\"Software\""), written.indexOf("\"WebStorage\"")).contains("UseSteamControllerConfig"))
assertEquals("-dx11", SteamLaunchOptions.launchOptions(written, 1790600))
assertTrue(SteamLaunchOptions.writeSteamAppSetting(home, 1790600, "UseSteamControllerConfig", "2", null, "1"))
assertFalse(file.readText().contains("UseSteamControllerConfig"))
}
@Test fun aChangeGoesToTheSignedInAccountOnly() {
val home = steamHome()
val signedIn = localConfig(home, "60974196").apply { writeText(config(apps(*sparking))) }
@@ -67,54 +67,6 @@ class DirectTouchHoldTest {
assertEquals("up 0 at 60.0,30.0", touches.last())
}
@Test fun tapForwardsNothingWhileTapClicksAreOff() {
hold.tapClicks = false
touch(MotionEvent.ACTION_DOWN)
advance(100)
touch(MotionEvent.ACTION_UP, 50f)
advance(100)
assertTrue(touches.isEmpty())
assertTrue(buttons.isEmpty())
}
@Test fun holdStillRightClicksWhileTapClicksAreOff() {
hold.tapClicks = false
touch(MotionEvent.ACTION_DOWN)
advance(550)
assertEquals(listOf("true at 40.0,30.0", "false at 40.0,30.0"), buttons)
touch(MotionEvent.ACTION_UP)
advance(100)
assertTrue(touches.isEmpty())
}
@Test fun dragAndSecondFingerStillForwardWhileTapClicksAreOff() {
hold.tapClicks = false
touch(MotionEvent.ACTION_DOWN)
touch(MotionEvent.ACTION_MOVE, 60f)
assertEquals(listOf("down 0 at 40.0,30.0", "move 0 at 60.0,30.0"), touches)
touch(MotionEvent.ACTION_UP, 60f)
advance(50)
touches.clear()
touch(MotionEvent.ACTION_DOWN)
touch(MotionEvent.ACTION_POINTER_DOWN, 60f)
assertEquals(listOf("down 0 at 40.0,30.0", "down 0 at 60.0,30.0"), touches)
touch(MotionEvent.ACTION_UP, 60f)
}
@Test fun noneBehaviorWaitsForMovementWhileTapClicksAreOff() {
hold.configure(TouchGestureConfig(directHoldBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_NONE))
hold.tapClicks = false
touch(MotionEvent.ACTION_DOWN)
assertTrue(touches.isEmpty())
touch(MotionEvent.ACTION_UP)
advance(100)
assertTrue(touches.isEmpty())
touch(MotionEvent.ACTION_DOWN)
touch(MotionEvent.ACTION_MOVE, 60f)
assertEquals(listOf("down 0 at 40.0,30.0", "move 0 at 60.0,30.0"), touches)
touch(MotionEvent.ACTION_UP, 60f)
}
@Test fun dragForwardsTheTouchOnceItMoves() {
touch(MotionEvent.ACTION_DOWN)
touch(MotionEvent.ACTION_MOVE, 60f)
@@ -1,12 +0,0 @@
package com.droiddeck.launcher.input
import android.view.MotionEvent
internal fun inertTwoFingerGestures() = TwoFingerGestures(16f, object : TwoFingerGestures.Listener {
override fun cancelTouch() {}
override fun replay(event: MotionEvent) {}
override fun rightClick(x: Float, y: Float) {}
override fun scrollStart(x: Float, y: Float) {}
override fun scroll(dx: Float, dy: Float) {}
override fun scrollEnd() {}
})
@@ -1,68 +0,0 @@
package com.droiddeck.launcher.input
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class InputProfileMouseButtonTest {
private val a = InputSurfaceElement(InputControl.A, 0f, 0f, .2f, .2f)
private val trackpad = InputSurfaceElement(InputControl.RIGHT_PAD, 0f, 0f, .5f, .5f)
private val trigger = InputSurfaceElement(InputControl.RT, 0f, 0f, .2f, .2f)
@Test fun gameDefaultsHaveNoMouseButton() {
assertFalse(InputProfile.defaults(InputProfile.GAME).hasMouseButton(InputRole.PRIMARY, listOf(a, trigger, trackpad)))
}
@Test fun stockDesktopBindingsDoNotCount() {
val desktop = InputProfile.defaults(InputProfile.DESKTOP)
assertFalse(desktop.hasMouseButton(InputRole.PRIMARY, listOf(a, trigger)))
}
@Test fun reboundDesktopButtonAndGameBaseMouseBindingsCount() {
val desktop = InputProfile.defaults(InputProfile.DESKTOP)
assertTrue(desktop.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274)).hasMouseButton(InputRole.PRIMARY, listOf(a)))
assertFalse(desktop.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.Keys(listOf(28))).hasMouseButton(InputRole.PRIMARY, listOf(a)))
assertTrue(InputProfile.defaults(InputProfile.GAME).withBinding(InputRole.PRIMARY, InputControl.RT, InputAction.MouseButton(272))
.hasMouseButton(InputRole.PRIMARY, listOf(trigger)))
}
@Test fun trackpadsAndKeyBindingsDoNotCount() {
val desktop = InputProfile.defaults(InputProfile.DESKTOP)
assertFalse(desktop.hasMouseButton(InputRole.PRIMARY, listOf(trackpad)))
assertFalse(InputProfile.defaults(InputProfile.GAME).withBinding(InputRole.PRIMARY, InputControl.A, InputAction.Keys(listOf(28)))
.hasMouseButton(InputRole.PRIMARY, listOf(a)))
}
@Test fun customElementCountsOnlyWhenItsOwnActionIsAMouseButton() {
val custom = InputSurfaceElement(InputControl.A, 0f, 0f, .2f, .2f, id = "custom:1")
val game = InputProfile.defaults(InputProfile.GAME)
assertFalse(game.hasMouseButton(InputRole.PRIMARY, listOf(custom)))
val bound = game.copy(elements = mapOf(InputRole.PRIMARY to mapOf("custom:1" to InputAction.MouseButton(272))))
assertTrue(bound.hasMouseButton(InputRole.PRIMARY, listOf(custom)))
assertFalse(bound.hasMouseButton(InputRole.SECONDARY, listOf(custom)))
}
@Test fun savedDesktopProfileComparesAgainstItsDesktopBase() {
val saved = InputProfile.defaults(InputProfile.DESKTOP).copy(id = "saved:1", base = InputProfile.DESKTOP)
assertFalse(saved.hasMouseButton(InputRole.PRIMARY, listOf(a, trigger)))
assertTrue(saved.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274)).hasMouseButton(InputRole.PRIMARY, listOf(a)))
}
@Test fun configuredStickAndTrackpadClickMouseButtonsCount() {
val stick = InputSurfaceElement(InputControl.LS, 0f, 0f, .3f, .3f)
val desktop = InputProfile.defaults(InputProfile.DESKTOP)
assertFalse(desktop.hasMouseButton(InputRole.PRIMARY, listOf(stick, trackpad)))
assertFalse(InputProfile.defaults(InputProfile.GAME).hasMouseButton(InputRole.PRIMARY, listOf(stick, trackpad)))
val stickClick = desktop.copy(clicks = mapOf(InputRole.PRIMARY to mapOf(stick.id to InputAction.MouseButton(274))))
assertTrue(stickClick.hasMouseButton(InputRole.PRIMARY, listOf(stick)))
assertFalse(stickClick.hasMouseButton(InputRole.SECONDARY, listOf(stick)))
val padClick = InputProfile.defaults(InputProfile.GAME).copy(clicks = mapOf(InputRole.PRIMARY to mapOf(trackpad.id to InputAction.MouseButton(272))))
assertTrue(padClick.hasMouseButton(InputRole.PRIMARY, listOf(trackpad)))
}
@Test fun secondaryRoleBindingCountsOnlyForTheSecondaryRole() {
val secondary = InputProfile.defaults(InputProfile.GAME).withBinding(InputRole.SECONDARY, InputControl.A, InputAction.MouseButton(272))
assertTrue(secondary.hasMouseButton(InputRole.SECONDARY, listOf(a)))
assertFalse(secondary.hasMouseButton(InputRole.PRIMARY, listOf(a)))
}
}
@@ -0,0 +1,112 @@
package com.droiddeck.launcher.input
import android.content.Context
import android.view.KeyEvent
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.session.NoSteamLaunch
import com.droiddeck.launcher.stores.epic.EpicClient
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [34], manifest = Config.NONE)
class NintendoLayoutTest {
private lateinit var context: Context
@Before fun setUp() {
context = RuntimeEnvironment.getApplication()
ControllerPrefs.prefs(context).edit().clear().commit()
}
@Test fun faceButtonsKeepTheirPositionsByDefault() {
assertEquals(0, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_A, false))
assertEquals(1, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_B, false))
assertEquals(2, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_X, false))
assertEquals(3, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_Y, false))
}
@Test fun nintendoLayoutSwapsAWithBAndXWithY() {
assertEquals(1, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_A, true))
assertEquals(0, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_B, true))
assertEquals(3, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_X, true))
assertEquals(2, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_Y, true))
}
@Test fun theSwapIsItsOwnInverseSoAnOutsideSwapRestoresTheDevicePositions() {
val keys = listOf(KeyEvent.KEYCODE_BUTTON_A, KeyEvent.KEYCODE_BUTTON_B, KeyEvent.KEYCODE_BUTTON_X, KeyEvent.KEYCODE_BUTTON_Y)
val positional = keys.map { PadBridge.faceButton(it, false) }
val swapped = keys.map { PadBridge.faceButton(it, true) }
assertEquals(listOf(1, 0, 3, 2), swapped)
assertEquals(positional, swapped.map { swapped[it] })
}
@Test fun otherButtonsAreNotFaceButtons() {
for (nintendo in listOf(false, true)) {
for (key in listOf(KeyEvent.KEYCODE_BUTTON_L1, KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_BUTTON_MODE)) {
assertEquals(-1, PadBridge.faceButton(key, nintendo))
}
}
}
@Test fun theLayoutIsKeptPerGameAndOffElsewhere() {
ControllerPrefs.setNintendoLayout(context, "42", true)
assertTrue(ControllerPrefs.nintendoLayout(context, "42"))
assertFalse(ControllerPrefs.nintendoLayout(context, "43"))
assertFalse(ControllerPrefs.nintendoLayout(context, null))
assertFalse(ControllerPrefs.nintendoLayout(context, "program:/usr/bin/foo"))
assertEquals(ControllerPrefs.DEFAULT_DEAD_ZONE_PERCENT, ControllerPrefs.read(context).deadZone)
assertFalse(ControllerPrefs.read(context).customLayout)
}
@Test fun turningTheLayoutOffRemovesTheGameEntry() {
ControllerPrefs.setNintendoLayout(context, "42", true)
ControllerPrefs.setNintendoLayout(context, "42", false)
assertFalse(ControllerPrefs.nintendoLayout(context, "42"))
assertFalse(ControllerPrefs.prefs(context).contains("nintendo.42"))
}
@Test fun aDirectLaunchLooksUpTheKeyTheSettingsScreenWrites() {
val epic = Library.SteamGame(EpicClient.LAUNCHER_APP_ID, Library.EPIC_LAUNCHER_NAME, null, Library.EPIC_LAUNCHER, source = "epic")
val added = Library.SteamGame((2733369024L).toInt(), "Added", null, Library.ADDED, source = "epic")
val proton = Library.SteamGame(413150, "Proton", null, "internal")
val launches = listOf(
epic to NoSteamLaunch.scopeOf(NoSteamLaunch.EPIC, listOf("run")),
added to NoSteamLaunch.scopeOf(NoSteamLaunch.PROTON_RUN, listOf("--app", "2733369024")),
proton to NoSteamLaunch.scopeOf(NoSteamLaunch.PROTON_RUN, listOf("--app", "413150")),
)
for ((game, lookup) in launches) {
val written = NoSteamLaunch.scope(game)!!
assertEquals(written, lookup)
ControllerPrefs.setNintendoLayout(context, written, true)
assertTrue(ControllerPrefs.nintendoLayout(context, lookup))
ControllerPrefs.setNintendoLayout(context, written, false)
}
ControllerPrefs.setNintendoLayout(context, NoSteamLaunch.scope(proton)!!, true)
assertFalse(ControllerPrefs.nintendoLayout(context, NoSteamLaunch.scope(added)))
assertFalse(ControllerPrefs.nintendoLayout(context, NoSteamLaunch.scope(epic)))
assertFalse(ControllerPrefs.nintendoLayout(context, "program:${NoSteamLaunch.PROTON_RUN}"))
}
@Test fun otherControllerPreferencesSurviveEnablingAndResettingTheLayout() {
ControllerPrefs.setDeadZone(context, 25)
ControllerPrefs.setJoyConVr(context, false)
val before = ControllerPrefs.prefs(context).all.toMap()
ControllerPrefs.setNintendoLayout(context, "42", true)
ControllerPrefs.setNintendoLayout(context, "43", true)
assertEquals(25, ControllerPrefs.read(context).deadZone)
assertFalse(ControllerPrefs.joyConVr(context))
ControllerPrefs.setNintendoLayout(context, "42", false)
assertEquals(25, ControllerPrefs.read(context).deadZone)
assertFalse(ControllerPrefs.joyConVr(context))
assertTrue(ControllerPrefs.nintendoLayout(context, "43"))
ControllerPrefs.setNintendoLayout(context, "43", false)
assertEquals(before, ControllerPrefs.prefs(context).all.toMap())
}
}
@@ -227,20 +227,6 @@ class OnScreenControlsTest {
assertFalse(view.hasPinned)
}
@Test fun shownElementsFollowPinnedOnlyAndQuickHide() {
val key = InputSurfaceElement(InputControl.B, .45f, .1f, .1f, .1f, "imported:0", name = "Find", alwaysShown = true)
view.updateLayout(SavedInputLayout("test", "Test", listOf(left, button, key), aspect = ASPECT))
measure(view)
assertEquals(listOf(left, button, key).map { it.id }, view.shownElements().map { it.id })
view.setQuickHidden(true)
assertEquals(listOf("imported:0"), view.shownElements().map { it.id })
view.setQuickHidden(false)
view.setPinnedOnly(true)
assertEquals(listOf("imported:0"), view.shownElements().map { it.id })
view.updateLayout(SavedInputLayout("test", "Test", listOf(left, button), aspect = ASPECT))
assertTrue(view.shownElements().isEmpty())
}
private companion object { const val ASPECT = 1000f / 600f }
private fun touch(action: Int, vararg pointers: Pair<Int, Pair<Float, Float>>, flags: Int = 0): Boolean {
@@ -48,31 +48,6 @@ class ScrollTouchGesturesTest {
assertEquals(listOf("move 400,300", "left down", "left up"), events)
}
@Test fun tapsPressNothingButLongPressStillRightClicksWhileTapClicksAreOff() {
gestures.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(80)
touch(MotionEvent.ACTION_UP, 400f, 300f)
advance(100)
touch(MotionEvent.ACTION_DOWN, 400f, 300f)
advance(700)
touch(MotionEvent.ACTION_UP, 400f, 300f)
advance(100)
assertEquals(listOf("move 400,300", "move 400,300", "long press", "right down", "right up"), events)
}
@Test fun holdThenMoveStillDragsWhileTapClicksAreOff() {
gestures.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 400f, 800f)
advance(700)
touch(MotionEvent.ACTION_MOVE, 403f, 600f)
advance(100)
touch(MotionEvent.ACTION_UP, 403f, 600f)
advance(100)
assertEquals(listOf("move 400,800", "long press", "left down", "move 403,600", "left up"), events)
assertEquals(0f, scrolledY, 0f)
}
@Test fun draggingScrollsWithTheFingerAndNeverClicks() {
touch(MotionEvent.ACTION_DOWN, 400f, 800f)
advance(200)
@@ -35,7 +35,6 @@ class SessionGestureRoutingTest {
private lateinit var directHold: DirectTouchHold
private val keys = mutableListOf<Pair<Int, Boolean>>()
private val directButtons = mutableListOf<Pair<Int, Boolean>>()
private val directTouches = mutableListOf<Int>()
private val scrollPositions = mutableListOf<Pair<Float, Float>>()
private val scrollDeltas = mutableListOf<Pair<Float, Float>>()
private var keyboards = 0
@@ -222,13 +221,12 @@ class SessionGestureRoutingTest {
override fun onWheel(steps: Int) {}
override fun onLongPress() {}
}, object : DirectTouchHold.Touch {
override fun down(pointerId: Int, x: Float, y: Float) { directTouches += 0 }
override fun down(pointerId: Int, x: Float, y: Float) {}
override fun move(pointerId: Int, x: Float, y: Float) {}
override fun up(pointerId: Int, x: Float, y: Float) {}
override fun cancel() {}
}).also { it.configure(config) }
setField("directTouchHold", directHold)
setField("twoFingerGestures", inertTwoFingerGestures())
launcherScroll = ScrollTouchGestures(8f, 50f, object : ScrollTouchGestures.Listener {
override fun onMove(x: Float, y: Float) { scrollPositions += x to y }
override fun onButton(button: Int, pressed: Boolean) {}
@@ -238,74 +236,6 @@ class SessionGestureRoutingTest {
setField("scrollTouch", launcherScroll)
}
@Test fun pointerLockedTapsAreDroppedWhileTapClicksAreOffButHoldAndSwipesStillWork() {
prepare(SessionPrefs.TOUCH_DIRECT)
setField("pointerLocked", true)
SessionState.outputSize = 1000 to 600
val rect = android.graphics.RectF(0f, 0f, 1000f, 600f)
fun forward(action: Int, x: Float, y: Float) {
val now = SystemClock.uptimeMillis()
val event = MotionEvent.obtain(now, now, action, x, y, 0)
try { ReflectionHelpers.callInstanceMethod<Any?>(activity, "forwardTouch",
ReflectionHelpers.ClassParameter.from(MotionEvent::class.java, event),
ReflectionHelpers.ClassParameter.from(android.graphics.RectF::class.java, rect)) } finally { event.recycle() }
}
fun tap() {
forward(MotionEvent.ACTION_DOWN, 300f, 300f)
forward(MotionEvent.ACTION_UP, 300f, 300f)
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(200))
}
directHold.tapClicks = false
tap()
assertTrue(directTouches.isEmpty())
assertTrue(directButtons.isEmpty())
forward(MotionEvent.ACTION_DOWN, 300f, 300f)
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(700))
assertEquals(listOf(PointerGestures.BTN_RIGHT to true, PointerGestures.BTN_RIGHT to false), directButtons)
forward(MotionEvent.ACTION_UP, 300f, 300f)
CompositorShadow.sceneInputs = 0
forward(MotionEvent.ACTION_DOWN, 300f, 300f)
forward(MotionEvent.ACTION_MOVE, 400f, 300f)
assertTrue(CompositorShadow.sceneInputs > 0)
forward(MotionEvent.ACTION_UP, 400f, 300f)
directHold.tapClicks = true
tap()
assertEquals(1, directTouches.size)
}
@Test fun directTouchDownDetectsAShownMouseButtonAndSwitchesSuppressionPerStream() {
prepare(SessionPrefs.TOUCH_DIRECT)
SessionState.outputSize = 1000 to 600
val controls = OnScreenControls(activity, null).apply {
updateLayout(SavedInputLayout("test", "Test", listOf(InputSurfaceElement(InputControl.A, .7f, .3f, .2f, .3f)), aspect = 1000f / 600f))
measure(android.view.View.MeasureSpec.makeMeasureSpec(1000, android.view.View.MeasureSpec.EXACTLY),
android.view.View.MeasureSpec.makeMeasureSpec(600, android.view.View.MeasureSpec.EXACTLY))
layout(0, 0, 1000, 600)
visibility = android.view.View.VISIBLE
}
setField("onScreenControls", controls)
fun tapWith(profile: InputProfile): Int {
setField("inputProfile", profile)
directTouches.clear()
val now = SystemClock.uptimeMillis()
for (action in listOf(MotionEvent.ACTION_DOWN, MotionEvent.ACTION_UP)) {
val event = MotionEvent.obtain(now, now, action, 300f, 300f, 0)
try { ReflectionHelpers.callInstanceMethod<Any?>(activity, "dispatchDirectTouch",
ReflectionHelpers.ClassParameter.from(MotionEvent::class.java, event)) } finally { event.recycle() }
}
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(200))
return directTouches.size
}
CompositorShadow.pointerMoves.clear()
assertEquals(1, tapWith(InputProfile.defaults(InputProfile.DESKTOP)))
assertTrue(CompositorShadow.pointerMoves.isEmpty())
assertEquals(0, tapWith(InputProfile.defaults(InputProfile.DESKTOP)
.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274))))
assertEquals(1, CompositorShadow.pointerMoves.size)
assertEquals(1, tapWith(InputProfile.defaults(InputProfile.DESKTOP)))
assertEquals(1, CompositorShadow.pointerMoves.size)
}
private fun tapThreeFingers(expectSteamGesture: Boolean) {
val down = SystemClock.uptimeMillis()
fun send(action: Int, index: Int, count: Int) {
@@ -333,12 +263,9 @@ class SessionGestureRoutingTest {
@Implements(value = WaylandCompositor::class, isInAndroidSdk = false)
class CompositorShadow {
companion object {
@JvmStatic var sceneInputs = 0
@JvmStatic val pointerMoves = mutableListOf<Pair<Int, Int>>()
@JvmStatic @Implementation fun __staticInitializer__() {}
@JvmStatic @Implementation fun nativeSendPointer(action: Int, x: Int, y: Int) { pointerMoves += x to y }
@JvmStatic @Implementation fun nativeSendTouch(action: Int, id: Int, x: Int, y: Int) {}
@JvmStatic @Implementation fun nativeSendSceneInput(type: Int, code: Int, value: Int) { sceneInputs++ }
@JvmStatic @Implementation fun nativeSendSceneInput(type: Int, code: Int, value: Int) {}
}
}
}
@@ -360,7 +360,6 @@ class SessionPenRoutingTest {
field("routedTouchMode", SessionPrefs.TOUCH_DIRECT)
field("padMouseCheckedAt", android.os.SystemClock.uptimeMillis())
field("threeFingerTap", ThreeFingerTap(8f))
field("twoFingerGestures", inertTwoFingerGestures())
field("directTouchHold", DirectTouchHold(8f, object : PointerGestures.Listener {
override fun onMove(x: Float, y: Float) {}
override fun onButton(button: Int, pressed: Boolean, x: Float, y: Float) {}
@@ -1,17 +1,13 @@
package com.droiddeck.launcher.input
import android.view.View
import androidx.compose.runtime.MutableState
import com.droiddeck.launcher.SessionActivity
import com.droiddeck.launcher.ui.InputSurfaceView
import com.droiddeck.launcher.session.SessionPrefs
import com.droiddeck.launcher.session.SessionService
import com.droiddeck.launcher.session.SessionState
import java.nio.file.Files
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -68,85 +64,6 @@ class SessionTouchRoutingTest {
}
}
@Test fun pinnedMouseButtonSuppressesTapsAfterSteamTouchIsHiddenForTheKeyboard() {
val controls = shownControls(button.copy(alwaysShown = true))
field("inputProfile", userMouseButtonProfile)
ReflectionHelpers.getField<MutableState<Boolean>>(activity, "steamTouchInUse\$delegate").value = true
ReflectionHelpers.getField<MutableState<Boolean>>(activity, "pcKeyboardOpen\$delegate").value = true
invoke("updateOnScreenControls")
assertEquals(View.GONE, steam.visibility)
assertEquals(View.VISIBLE, controls.visibility)
assertTrue(mouseButtonShown())
}
@Test fun visibleSteamTouchKeepsTapClicksAndGameBindingsHaveNoMouseButton() {
shownControls(button)
field("inputProfile", userMouseButtonProfile)
assertFalse(mouseButtonShown())
steam.visibility = View.GONE
assertTrue(mouseButtonShown())
field("inputProfile", InputProfile.defaults(InputProfile.GAME))
assertFalse(mouseButtonShown())
}
@Test fun mouseButtonOnTheDeckSurfaceSuppressesTapsOnlyWhileItIsShown() {
steam.visibility = View.GONE
field("inputProfile", userMouseButtonProfile)
val deck = InputSurfaceView(activity, null, listOf(button), InputRole.PRIMARY)
field("unfoldedDeckSurface", deck)
assertTrue(mouseButtonShown())
deck.visibility = View.GONE
assertFalse(mouseButtonShown())
deck.visibility = View.VISIBLE
field("inputProfile", InputProfile.defaults(InputProfile.GAME))
assertFalse(mouseButtonShown())
}
@Test fun pinnedMouseButtonInButtonsOnlyControlsSuppressesTaps() {
steam.visibility = View.GONE
field("inputProfile", userMouseButtonProfile)
val controls = shownControls(button.copy(alwaysShown = true))
controls.setButtonsOnly(true)
assertTrue(mouseButtonShown())
val plain = shownControls(button)
plain.setButtonsOnly(true)
assertFalse(mouseButtonShown())
}
@Test fun mouseClickOnAStickOrTrackpadSuppressesTaps() {
steam.visibility = View.GONE
val stick = InputSurfaceElement(InputControl.LS, .1f, .3f, .3f, .4f)
shownControls(stick)
field("inputProfile", InputProfile.defaults(InputProfile.DESKTOP))
assertFalse(mouseButtonShown())
field("inputProfile", InputProfile.defaults(InputProfile.DESKTOP)
.copy(clicks = mapOf(InputRole.PRIMARY to mapOf(stick.id to InputAction.MouseButton(274)))))
assertTrue(mouseButtonShown())
}
private val userMouseButtonProfile = InputProfile.defaults(InputProfile.DESKTOP)
.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(274))
@Test fun stockDesktopOverlayKeepsTapClicks() {
steam.visibility = View.GONE
shownControls(button)
field("inputProfile", InputProfile.defaults(InputProfile.DESKTOP))
assertFalse(mouseButtonShown())
field("inputProfile", userMouseButtonProfile)
assertTrue(mouseButtonShown())
}
private val button = InputSurfaceElement(InputControl.A, .7f, .3f, .2f, .3f)
private fun shownControls(vararg elements: InputSurfaceElement) = OnScreenControls(activity, null).apply {
updateLayout(SavedInputLayout("test", "Test", elements.toList(), aspect = 1000f / 600f))
measure(View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(600, View.MeasureSpec.EXACTLY))
layout(0, 0, 1000, 600)
visibility = View.VISIBLE
field("onScreenControls", this)
}
private fun mouseButtonShown() = invoke("onScreenMouseButtonShown") as Boolean
private fun field(name: String, value: Any) = ReflectionHelpers.setField(activity, name, value)
private fun invoke(name: String) = ReflectionHelpers.callInstanceMethod<Any?>(activity, name)
}
@@ -262,58 +262,6 @@ class TouchpadGesturesTest {
assertFalse(events.contains("left down"))
}
@Test fun tapsDoNotClickWhenTapClicksAreOff() {
touchpad.tapClicks = false
tap()
advance(50)
tap()
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(10)
touch(MotionEvent.ACTION_POINTER_DOWN, 1, 1 to (400f to 300f), 2 to (600f to 310f))
advance(60)
touch(MotionEvent.ACTION_POINTER_UP, 1, 1 to (400f to 300f), 2 to (600f to 310f))
advance(10)
touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f))
advance(TouchTiming.CLICK_MS + 100)
assertEquals(emptyList<String>(), events)
}
@Test fun movementAndHoldDragStillWorkWhenTapClicksAreOff() {
touchpad.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(10)
touch(MotionEvent.ACTION_MOVE, 0, 1 to (460f to 300f))
touch(MotionEvent.ACTION_UP, 0, 1 to (460f to 300f))
assertTrue(events.contains("move"))
assertFalse(events.any { it.startsWith("left") })
events.clear()
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(TouchTiming.HOLD_MS + 50)
touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f))
assertEquals(listOf("long press", "left down", "left up"), events)
}
@Test fun tapsClickAgainOnceTapClicksAreBackOn() {
touchpad.tapClicks = false
tap()
touchpad.tapClicks = true
tap()
advance(TouchTiming.CLICK_MS + 100)
assertEquals(listOf("left down", "left up"), events)
}
@Test fun doubleTapDragIsNotStartedAfterTapClicksTurnOff() {
tap()
advance(TouchTiming.CLICK_MS + 10)
events.clear()
touchpad.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(TouchTiming.HOLD_MS - 50)
touch(MotionEvent.ACTION_UP, 0, 1 to (400f to 300f))
advance(TouchTiming.CLICK_MS + 100)
assertEquals(emptyList<String>(), events)
}
private fun tap() {
touch(MotionEvent.ACTION_DOWN, 0, 1 to (400f to 300f))
advance(80)
@@ -39,23 +39,6 @@ class TwoFingerGesturesTest {
assertEquals(listOf("cancel", "right 400.0,300.0"), calls)
}
@Test fun tapClicksOffSwallowsTheTapButKeepsHoldAndScroll() {
gestures.tapClicks = false
touch(MotionEvent.ACTION_DOWN, 0, a)
time += 20
touch(MotionEvent.ACTION_POINTER_DOWN, 1, a, b)
time += 80
assertTrue(touch(MotionEvent.ACTION_POINTER_UP, 1, a, b))
assertTrue(touch(MotionEvent.ACTION_UP, 0, a))
assertEquals(listOf("cancel"), calls)
calls.clear()
touch(MotionEvent.ACTION_DOWN, 0, a)
time += 20
touch(MotionEvent.ACTION_POINTER_DOWN, 1, a, b)
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(TwoFingerGestures.HOLD_MS + 10))
assertEquals(listOf("cancel", "right 400.0,300.0"), calls)
}
@Test fun holdRightClicksOnce() {
touch(MotionEvent.ACTION_DOWN, 0, a)
time += 20
@@ -2,11 +2,13 @@ package com.droiddeck.launcher.session
import android.content.Context
import com.droiddeck.launcher.core.GameEnvironment
import com.droiddeck.launcher.input.ControllerPrefs
import com.droiddeck.launcher.runtime.LinuxRuntime
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Assert.assertThrows
import org.junit.Before
import org.junit.Test
@@ -25,6 +27,7 @@ class GameProfileManagerTest {
fun setUp() {
context = RuntimeEnvironment.getApplication()
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear().commit()
context.getSharedPreferences("controller", Context.MODE_PRIVATE).edit().clear().commit()
File(context.filesDir, "game-environment.json").delete()
File(context.filesDir, "wincomponents.json").delete()
File(context.filesDir, "components").deleteRecursively()
@@ -51,6 +54,10 @@ class GameProfileManagerTest {
SessionPrefs.setGameTextureAnisotropy(context, other, 8)
WinComponents.setPicks(context, game, listOf("vcrun2022"))
WinComponents.setPicks(context, other, listOf("dotnet48"))
ControllerPrefs.setDeadZone(context, 25)
ControllerPrefs.setJoyConVr(context, false)
ControllerPrefs.setNintendoLayout(context, game, true)
ControllerPrefs.setNintendoLayout(context, other, true)
GameProfileManager.reset(context, game)
@@ -65,6 +72,10 @@ class GameProfileManagerTest {
assertEquals(8, SessionPrefs.gameTextureFiltering(context, other).anisotropy)
assertEquals(emptyList<String>(), WinComponents.picks(context, game))
assertEquals(listOf("dotnet48"), WinComponents.picks(context, other))
assertFalse(ControllerPrefs.nintendoLayout(context, game))
assertTrue(ControllerPrefs.nintendoLayout(context, other))
assertEquals(25, ControllerPrefs.deadZone(context))
assertFalse(ControllerPrefs.joyConVr(context))
}
@Test
@@ -1,44 +0,0 @@
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))
}
}
@@ -229,18 +229,6 @@ class InputSurfaceTouchTest {
assertFalse(view.takesTouchAt(815f, 300f))
}
@Test fun shownElementsSkipSticksThatHideWhileIdleUntilTouched() {
val hidden = InputSurfaceElement(InputControl.LS, .3f, .3f, .2f, .4f, hideWhenIdle = true)
show(a, hidden, b)
assertEquals(listOf(a.id, b.id), view.shownElements().map { it.id })
touch(MotionEvent.ACTION_DOWN, 1 to (50f to 300f))
assertEquals(listOf(a.id, hidden.id, b.id), view.shownElements().map { it.id })
touch(MotionEvent.ACTION_UP, 1 to (50f to 300f))
assertEquals(listOf(a.id, b.id), view.shownElements().map { it.id })
show(a, hidden.copy(hideWhenIdle = false), b)
assertEquals(listOf(a.id, hidden.id, b.id), view.shownElements().map { it.id })
}
private fun element(root: View, id: String): View = descendants(root).first { (it.tag as? InputSurfaceElement)?.id == id }
private fun centre(target: View): Pair<Float, Float> {
var x = target.width / 2f
-12
View File
@@ -22,18 +22,6 @@ 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`,
-74
View File
@@ -1,74 +0,0 @@
# 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.
-3
View File
@@ -19,9 +19,6 @@ 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)
-41
View File
@@ -1,41 +0,0 @@
---
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.
@@ -1,41 +0,0 @@
---
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.
+1 -1
View File
@@ -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="${linuxfs_dir}/usr/local/lib/droiddeck-rockstar"
rockstar_out="${repo_root}/app/src/main/resources/rockstar/helpers"
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; }
+1 -1
View File
@@ -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 mprotect drmPrimeFDToHandle drmCloseBufferHandle; do
for sym in socket bind getsockname setsockopt statfs statvfs syscall shm_open shm_unlink mmap mmap64 munmap drmPrimeFDToHandle drmCloseBufferHandle; do
grep -qx "$sym" <<<"$SESSION" || { echo "::error::libblsession.so does not export $sym"; exit 1; }
done
if grep -qx drmIoctl <<<"$SESSION"; then
-6
View File
@@ -125,15 +125,9 @@ 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
Loaded 100 of 134 files, more files were not shown because too many files have changed in this diff. Show more