Compare commits

..
Author SHA1 Message Date
Kurt Himebauch 8f639a08eb Keep recovery for outstanding restores after a loss, keep losses across a rollback, and leave the paused state idle when no attempt is due 2026-12-05 06:22:44 -05:00
Kurt Himebauch 82f806ad84 Stop the owner's worker and hold the helper inside its phase before the mid-I/O kill tests kill it 2026-12-05 06:22:43 -05:00
Kurt Himebauch 7771a87695 Keep lost guests failed, count zombies and adopted spills as lost, check every thread's tracer, and pace automatic resumes 2026-12-05 06:03:00 -05:00
Kurt Himebauch 3419391940 Test that only the kernel's exit kill ends a spilled owner, and that no owner thread runs after its helper dies mid-spill or mid-read-back 2026-12-05 06:03:00 -05:00
Kurt Himebauch c46bb72631 Retry held sessions with paced resumes, settle rollbacks and late answers, and end read-backs without a marker 2026-12-05 05:38:02 -05:00
Kurt Himebauch 0cd42b7217 Kill a spilled owner whose helper exits still tracing it, and check stale spill requests leave no acknowledgement 2026-12-05 05:38:01 -05:00
Kurt Himebauch f68a78c577 Keep the frozen clock, a pending rollback and late spills tracked when a resume cannot finish 2026-12-05 05:16:03 -05:00
Kurt Himebauch 6638a7dac8 Keep intercepted signals, discard checks and owner exit in the spill helper, and answer a cancelled spill 2026-12-05 05:16:03 -05:00
Kurt Himebauch c6333350ae Drop a spill request that reaches the handler after the resume it was asked before 2026-12-05 04:34:25 -05:00
Kurt Himebauch fbf1788647 Keep a spill without an acknowledgement asked, so a failed resume count still fails 2026-12-05 04:21:28 -05:00
Kurt Himebauch 48f587bb41 Wait only on spills whose handler started, and read back a late zram fallback 2026-12-05 04:15:28 -05:00
Kurt Himebauch 088e9994a0 Merge remote-tracking branch 'origin/main' into frozen-session-disk-spill 2026-12-05 04:08:34 -05:00
Kurt Himebauch 29350f1bd5 Fail the spill test when its readers do not go quiet before the measurement 2026-12-05 03:53:09 -05:00
Kurt Himebauch 498a3a653a Wait on resume for a spill that had not answered when the spill wait ended 2026-12-05 03:52:32 -05:00
Kurt Himebauch 644f8e655f Release zram fallbacks on resume and count late restores before another spill 2026-12-05 03:33:08 -05:00
Kurt Himebauch 7ad52166a2 Keep unanswered spills and unfinished restores tracked until a resume can release them 2026-12-05 03:02:57 -05:00
MaxsTechReview 872c5e1834 fix(native): reopen refused memfds and answer links in the form they are named (#3734)
* fix(native): reopen refused memfds and answer links in the form they are named

Android's app policy refuses the open permission on memory files, so a
read-only reopen of an own memfd through /proc/self/fd/N,
/proc/thread-self/fd/N, /proc/<own pid or thread>/fd/N or /dev/fd/N
failed with EACCES while read, write and mmap of the descriptor still
worked. The hook now answers such a refused read-only open with a new
memfd holding the same bytes, name, mode and seals. Writable opens,
other processes' descriptors and regular files stay refused. FEX routes
guest openat through libc syscall(), so x86 guests get the same answer.

readlink() stripped the rootfs prefix from every target, so a link
stored with a real target (Proton's s: drive) read as /root/... while
getcwd(), /proc/self/fd and /proc/self/maps give the real path, and a
path resolved through the link no longer matched the working directory.
A link named by its real rootfs path, and /proc/<pid>/cwd, now keep the
real target, as realpath() of a real path does; guest and relative names
keep the guest form.

* fix(native): keep the memfd copy read-only, leave openat2 errors native, keep guest form for remapped link names

The copy that answers a refused read-only memfd reopen is now sealed
against writes and resizing, so it cannot be written through as a
read-only descriptor could not. openat2 reads its open_how only after
the kernel refused the open with EACCES, so an unreadable pointer gets
the kernel's EFAULT. readlinkat and fstatat keep the guest form for a
relative name the hook remapped to a real path; only a name the caller
supplied in real form keeps the real target.

* fix(native): pin the memfd being copied and refuse copies that cannot match it

* Copy a refused memfd only when the path and the descriptor name one file
2026-12-05 02:54:50 -05:00
2d25fb91c5 Run Easy Anti-Cheat and BattlEye games on x86-64 DroidDeck-Proton under FEX (#3641)
* FEX: emulate x86-64 ptrace, seccomp and /proc for anti-cheat launchers

* Guest hook: route raw execve/execveat through the exec wrapper and pass self-sent SIGSYS to the program

A program that execs with syscall(SYS_execveat, ...) bypassed the environment the
guest needs, so re-executing /proc/self/exe died in the loader. /proc/self/exe now
maps to the real program on exec as it already does on open.

A SIGSYS the program queues itself, or one from a filter for another architecture,
went to the Android-filter emulation instead of the program's handler.

* FEX: list only guest mappings in /proc/<pid>/maps on hosts below 47 address bits

Credit the anti-cheat emulation source in the patch header.

* Preloads: leave poll, ppoll and select buffers untouched when no emulated device is open

A bad user pointer now reaches the kernel and returns EFAULT instead of crashing the caller inside the wrapper.

* Emulate only host-architecture seccomp traps in the guest hook; report the calling thread's seccomp mode in FEX's /proc/self/status

A SIGSYS carrying another architecture's seccomp siginfo now takes its default action when the program has no handler, so a process whose emulated filter traps a syscall while SIGSYS is blocked or ignored dies as on Linux.

* FEX: read the host status file through the raw openat syscall

* README: credit StonkGuy's FEX anti-cheat emulation

* FEX: open the host status file with a direct system call so preloads cannot rewrite it

* FEX: hand a traced program's ptrace state across exec

* Credit StonkGuy in the FEX anti-cheat patches and README

Co-authored-by: StonkGuy <68372320+StonkGuy@users.noreply.github.com>

* FEX: open guest paths with the raw openat system call so host preloads cannot replace the file

* FEX: serve emulated proc files by the requested path when the host returns a memfd

* FEX: map fixed guest memory above a small host address space

Co-authored-by: StonkGuy <StonkGuy@users.noreply.github.com>

* FEX: serve decoder reads from fixed guest memory above the host limit

* Run games with anti-cheat files on an x86-64 DroidDeck-Proton under FEX

The Proton launchers look for Easy Anti-Cheat or BattlEye bridge files in
the game folder and, when an x86-64 DroidDeck-Proton and the matching Proton
runtime are installed, hand the launch to that Proton under FEX with the
game's own prefix. Picking the x86-64 tool directly also runs it under FEX.
DROIDDECK_ANTICHEAT=off keeps a game on ARM64.

* Keep x86-64 DroidDeck-Proton builds out of the ARM64 tool list

* droiddeck-fex: take the runtime from an adopted tool's original manifest

* FEX: show the guest command line when the argument area cannot be remapped

* FEX: describe the container's procfs in emulated mount tables

* FEX: order the anti-cheat series after the guest stack patch from main

* Test the container procfs view of FEX's emulated mount tables

* Docs: describe the anti-cheat signal mask fix and the container procfs view

* README: match the StonkGuy credit to the renumbered FEX patches

* Keep anti-cheat games on a tool the user chose instead of moving them to x86-64

* test(game-env): build the adopted-tool wrapper through extra_wrapper_sh

* Check anti-cheat runtime bridges, apply component choices under FEX and honour MAP_FIXED_NOREPLACE above the host limit

* Check the driver query is answered before each wrapper's call sites

* Keep x86-64 Proton builds out of the automatic default tool

* Keep high guest mappings intact when a fixed map or unmap fails

Check room in the region table, splits included, before a fixed map or
unmap removes anything, return the host munmap error without touching
the table entry, and keep write-protecting low shared aliases of
executable ranges that sit above the host address limit.

* Keep a requested x86-64 default and accept linked anti-cheat runtimes

A request for the current automatic x86-64 default now marks it as the
app's choice, so the next settle no longer moves it back to ARM64.
Anti-cheat runtime discovery follows a symlinked runtime directory.

* Route anti-cheat games to x86-64 Proton only on a capable FEX

The FEX build now lists its patches in share/fex-emu/.droiddeck-patches.
Anti-cheat routing needs the fixed guest memory patch in that list and
otherwise keeps the launch on ARM64, as an older FEX cannot map the
anti-cheat helper buffer above the host address limit. Installing a FEX
build without the list removes a list left by an earlier build.

* Update FEX before deciding anti-cheat routing

A device on an older FEX build never went through droiddeck-fex on the
ARM64 path, so the catalog FEX was never installed and the gate kept
anti-cheat games on ARM64 forever. dd_anticheat now runs the new
droiddeck-fex update action first, which installs the catalog build
under the same lock and retry window as other FEX launches.

* Leave MAP_FIXED_NOREPLACE above the host limit to the host

Wine finds the top of the address space with MAP_FIXED_NOREPLACE probes.
Claiming those probes above a 39-bit host limit made Wine place its stacks
in relocated memory, and every wineserver request then failed with EFAULT
because the iovec buffers it passes to writev are nested pointers that are
not translated. Only MAP_FIXED requests are relocated again, so the probes
see the real host limit while fixed mappings above it keep working.

* Translate only pointer syscall arguments into high guest memory

Pointer arguments are now picked from a per-syscall layout table, so
scalar values such as a truncate length are never rewritten. Sized
buffers must map to one contiguous host range or the call fails with
EFAULT, and new host backings are placed next to their guest
neighbours so adjacent mappings stay contiguous. readv, writev and the
preadv/pwritev family, sendmsg and recvmsg get a host-side copy of
their iovec and msghdr with translated bases, leaving the guest copies
untouched. Code invalidation for kernel writes maps the host buffer
back to its guest address, and an unmap checks the table before it
changes any host mapping.

* Claim high guest memory only with LSE atomics and invalidate every code alias

High guest mappings are claimed only when the JIT emits LSE atomics, and
exclusive load/store instructions are never single-stepped, so an atomic
on high memory cannot spin. A store into high code invalidates every
mirror of the written page through the tracked mapping. madvise and
mprotect on high memory apply to each region at its own host address.

* Reject wrapping lengths and drop stale code on discarded high memory

A nonzero length that wraps when page-aligned now fails madvise with
EINVAL and mprotect with ENOMEM, as on Linux. Discarding advice on
high memory invalidates translated code for the range whenever advice
reached any region.

* Add an end-to-end probe for guest memory above the host address limit

* Emulate exclusive pairs on high guest memory and release failed host unmaps later

* Size counted guest buffers by element and keep exclusive access within guest protection

poll, ppoll, epoll waits, mmsg calls and select bitmaps now translate the whole array their count describes, so a buffer that crosses into an unrelated host range fails with EFAULT and oversized counts cannot wrap. High regions remember their protection through mprotect, splitting at the range edges, and exclusive stores to read-only pages or loads from inaccessible pages reach the guest as a fault instead of being emulated.

* Refuse a high unmap when failed host unmaps could not all be retained

UnmapLocked counts the overlapping regions before it changes anything and returns ENOMEM when the retired list could not hold all of them, so a host range is never dropped from tracking while still mapped.

* Serve memory trim requests while syscall user dispatch blocks

A thread that runs with syscall user dispatch on and its selector set to
block (as x86-64 Wine does while in Windows code) took the trim signal
with the selector still blocking. Every raw syscall the handler made was
then dispatched to the program's SIGSYS handler, which either deadlocked
the thread or killed the process when SIGSYS was blocked, so the session
saw it as a deaf process and the game stalled during loading.

Track the selector each thread registers through prctl, allow syscalls
for the length of the handler and restore the selector before returning.

* Allow syscalls for a forwarded prctl while dispatch blocks

The prctl wrapper issues its syscall from the preload's own text, so a
thread whose selector blocks got SIGSYS where the plain libc call would
have been dispatched the same way by the caller's own rules. Allow
syscalls for the forwarded call and restore the selector afterwards.

The dispatch test now waits until the selector blocks before it sends
the trim request, and checks a prctl call made while it blocks.

* Merge high regions after protection changes and translate message batches

Protect now merges neighbouring high regions whose guest and host
ranges touch and whose protection and code state match, so toggling
page protections no longer fills the region table.

Exclusive loads on high memory accept write-only pages and exclusive
stores need only PROT_WRITE, matching x86-64 where writable pages are
readable.

sendmmsg and recvmmsg translate the name, control and io vectors of
every message in the batch, return msg_len for each processed message
and the received header fields for recvmmsg.

Counted arrays passed to getgroups, setgroups, semop, semtimedop,
io_submit, io_getevents, io_pgetevents, move_pages, futex_waitv and
listmount are now checked to stay within one host range. The unused
ToHost helper is removed.

* Translate fixed-size, string and in-array guest pointers in high memory

Give every syscall pointer without a length a fixed x86-64 size, a
length read through another argument, or a terminator scan for strings,
so spans crossing separately backed regions are refused before the
kernel sees them. Size message queue buffers as the type word plus
msgsz. Translate io_submit control blocks and their buffers, including
vectored reads and writes, through bounded host copies, restore the
guest words afterwards, and report guest iocb addresses back from
io_getevents. Translate move_pages page lists for the calling process
and futex_waitv addresses. Merge new mappings with matching neighbours.

* Size high-memory syscall spans by kernel widths and embedded sizes

Read counts with the width the kernel uses for each argument, so int
and unsigned int counts ignore the upper register bits and negative
counts reach the handler. Size capability data by its header version,
perf and scheduler attributes, file handles and mount requests by their
own size fields, and landlock rules by rule type. Keep the translated
prefix of a message batch, read headers that span separate backings one
by one, write results back through the current guest mapping, and stop
counting messages whose length cannot be stored. Revisit an entry moved
into an earlier slot while merging regions. Give newer syscalls
fallback numbers in the test harness.

* Send translated message batches one message at a time

Submit sendmmsg batches that need scratch headers one message per call,
storing each length before the next message goes out, so a length that
cannot be stored stops the batch where Linux would. Skip the name length
when no name was given and store flags before the control length. Check
the whole fixed file-handle header even when its size is invalid. Hand
capget and capset a private header so the checked data size matches the
version the kernel reads, and return a rewritten version to the guest.
Patch and restore AIO control blocks under the mapping lock and restore
only the block that was patched.

* Harden high-memory aio, capability and message batch write-backs

Restore patched aio buffers through /proc/self/mem when the control block
became read-only and keep the scratch vectors alive if that fails too,
fault capability calls whose header write-back fails, stop send batches
after a short message, and pin the batch socket with a private dup.

* Pin batch sockets, fall back to whole batches and reconcile pending aio restores

Follow-up message sends and the first dispatch share one duplicated
socket. When it cannot be duplicated, the whole translated batch goes
to the kernel in one call and lengths are written back up to the first
one that cannot be stored. Short sends compare against the iovec
lengths given to the kernel. Unrestorable aio_buf edits, including
unreadable control blocks, keep their storage in a bounded list that
later submissions reconcile.

* Stop message batches at unreadable vectors, send singly without a spare descriptor and reserve aio restore slots

A message whose iovec snapshot cannot be taken ends the prepared batch
instead of being sent with an unknown length; when it is the first
message the kernel handles the original array natively. When the
batch socket cannot be duplicated, messages still go one at a time on
the original descriptor with each length written before the next send.
Pending aio restore slots are reserved under the pending mutex before
the first guest edit and released or handed to the pending record, so
concurrent submissions cannot exceed the bound. Tests use a real
socket pair, injected descriptor exhaustion and concurrent
reservations.

* Send only the first message of a batch when the socket cannot be pinned

* Replay high-memory faults over the whole access and reconcile aio restores on unmap

* Keep high-memory traps ordered, fault-exact and locked against unmap

Protect, Map and low mmap/munmap/mremap/mprotect reconcile pending aio
restores at once, and io_submit reconciles them even when no high region
is mapped. Ordered loads and stores split across backings are emulated
between full fences instead of being byte-copied through the trampoline;
atomics and exclusives are still refused. Gather and scatter use
fault-safe copies, and a failing piece is re-faulted at the guest
instruction through a probe load, with SIGBUS redelivered the same way.
The VMA lock is held from planning until the scatter finishes, so unmap
and protect cannot race a resumed access. Sign-extending loads are no
longer classified as writes.

* Defer user signals while guest high memory mappings are held

Only the trampoline breakpoint completes a replay, user-sent SIGSEGV,
SIGBUS and SIGTRAP raised while the mapping lock is held are requeued
after it is released, and stranded control block words are restored
when their page turns readable again. The harness now runs under a
timeout.

* Rebase the FEX patch series onto FEX-2612

* FEX: restore stranded aio words before readable protection, report failures

Restore every pending aio word in the range before a readable guest
protection is applied, on both the high and low paths, and fail the guest
mprotect with the old protection kept when a word cannot be restored or its
window cannot be closed. Ignore user-sent SIGSEGV/SIGBUS after deferral,
read the cleared syscall info when resuming with guest GPRs and on restore,
and check exclusive acquisition from a separate thread in the harness.

* FEX: submit aio control blocks through private host copies

Stop editing guest IOCBs in place when aio_buf needs translation. io_submit
now hands the kernel a host copy of each such control block, maps
io_event.obj back to the guest pointer when the completion is reaped,
redirects io_cancel by guest pointer and context to the copy, and frees
copies on reap, on io_destroy, or when the kernel did not accept them.
The guest control block is never patched and its protection is never
touched, so the pending restore records, the protection windows and the
restore hooks in mmap, munmap, mremap and mprotect are removed with their
tests.

* fex: keep aio keys, cancels and reaped events native for copied control blocks

Guest aio_key is no longer cleared before dispatch: the slot is probed with a
same-value write and only the first n accepted copies get key 0 after the host
io_submit returns n. io_cancel redirects to a copy only when the guest block is
readable and its key is 0, so unreadable blocks fault in the kernel as before.
io_getevents and io_pgetevents reap into emulator storage, translate and
release copies there, then copy the events out, returning -EFAULT if that
fails. A successful io_setup clears the ring header magic so userspace ring
reapers fall back to io_getevents, where copies are translated and released.

* fex: leave aio rejections, keys and unwritable event buffers to the kernel

A copied control block whose key slot is read-only is now passed to the
kernel as the guest's own block at the end of the list, so the kernel reports
its native fd, eventfd or key error. After io_submit, guest keys follow the
private copies through the first rejected position, and they are stored
through a fresh translation of the guest address, skipped when it no longer
maps. io_getevents and io_pgetevents probe the guest event buffer and reap at
most its writable prefix, handing an unwritable buffer to the kernel so
completions are not consumed.

* Kept AIO completions and key stores stable against sibling remaps

Wrapped event buffers go to the kernel unchanged. Direct reaps report guest
control blocks and release copies only after the store lands. Guest stores and
reads hold the mapping lock across translation and copy. Completions whose
copy-out fails are stashed per context and delivered first on the next reap,
and dropped on io_destroy.

* fex: stage every AIO reap and keep stashed completions recoverable

Hold the guest mapping for every high address, restore the caller's
signal mask after thread-context holds, replace the fixed event stash
with a per-context table that reserves space before dispatch, stage
all reaps so control block identities are translated before copy-out,
keep collecting ready completions once the stash meets min_nr, and
restash events on every error except an interrupted delivery or a
destroyed context.

* fex: own AIO recovery storage before dispatch and bind it to the context lifetime

Allocate the recovery node with the event buffer before the kernel
consumes completions and hand the buffer itself to the stash when
copy-out fails, so settling never allocates. Track each context by a
generation that io_setup advances, so a destroy that finishes after a
replacement context reuses the ring address only releases the old
context's copies and stash. Drop the reservation cap so blocking reaps
keep their min_nr.

* fex: publish AIO contexts from private storage, keep their generation, wake blocked reapers for stashed completions

* fex: wait for AIO events in bounded slices instead of wake markers, roll back setup by its own generation, fault unreadable io_setup output

Blocked reapers wait in the kernel for at most 20 ms at a time and take stashed completions between waits until the guest minimum or timeout is met, so no eventfd or io_submit notification is needed. Deferred signals end the wait like EINTR. io_setup rollback uses the generation BeginContext installed, and an unreadable context output returns -EFAULT before dispatch.

---------

Co-authored-by: StonkGuy <68372320+StonkGuy@users.noreply.github.com>
Co-authored-by: StonkGuy <StonkGuy@users.noreply.github.com>
2026-12-05 02:26:42 -05:00
MaxsTechReview 56213d74b3 fix(ubuntu): drop the Mesa patches Ubuntu's Mesa 26.2 now ships and rebase the rest (#3736) 2026-12-05 01:59:21 -05:00
The412Bannerandmaxjivi05 9c6fafec4c fix(hook): end readlink answers so Steam's install scripts run without proot (#3386)
Co-authored-by: maxjivi05 <maxjividen@gmail.com>
2026-12-05 00:52:52 -05:00
LunaDL f06c37e279 Feat: Add per-game scaling filter (#3726) 2026-12-05 00:47:58 -05:00
Kurt Himebauch f17406effc Bind a spill to the resume count it was asked under and report a resume only once memory is back 2026-12-04 22:49:06 -05:00
Kurt Himebauch b072cedd16 Fix black bottom-screen Mirror with HDR enabled (#3710)
* Keep Mirror frames readable with HDR enabled

* Exercise mirror capture messages in the native host queue test

* Preserve the HDR display fallback while Mirror is open
2026-12-04 14:01:37 -05:00
Kurt Himebauch 77fffa7592 Show recent photos in place of the keyboard when attaching to the agent (#3702)
* Show recent photos in place of the keyboard in the agent composer

The attach button opens a tray, at the keyboard's height, of the device's
recent pictures; a tap attaches or detaches one. The tray also opens the
system file picker and asks for photo access when the app has none.

* Agent instructions: manifest needs an APK; the agent resumes after a Lab build restart

* Skip the tray's back handler where the host has no back dispatcher

* Offer the photo tray in windows that cannot open pickers, such as the floating pet

* Fix the tray's permission request for windows without a registry

* Move the game screenshot button into the photo tray

* Name only the model in the agent's compact chip

* Keep the session drawer open while the tray's picker or photo permission prompt is up

* Address review: tray height on short screens, denied photo access, kept photo marks, tile labels, Lab build refusals

* Keep tray photos being copied across the tray closing

* Let a tray photo copy clear only its own in-progress marker

* Review: one attachment file per copy, photo tile labels, superseded copies attach nothing

* Drop tray photo copies still running when the message is sent
2026-12-04 13:42:17 -05:00
Kurt Himebauch de3ed8b986 Keep the followed channel's offer off the Tests list while browsing it (#3707)
* Show the followed channel's update offer above the test list only when following a test

* Keep install progress and errors on the Tests list while following Stable or Preview
2026-12-04 13:25:24 -05:00
JRAlmonte 86b8ae3c99 fix(nativeguest): do not apply a realtime limit of zero (#3704)
Flatpak emulators that use SDL (Flycast, Rosalie's Mupen GUI, xemu) were
killed with status 137 a second or two after a game started. Without a
RealtimeKit, xdg-desktop-portal reports RTTimeUSecMax 0, and SDL sets that
as RLIMIT_RTTIME before asking for a realtime thread. The kernel checks the
limit on a thread that is realtime or has a CPU-time timer armed, and a
limit of 0 is reached at once: SIGKILL at the hard limit.

Fixes #3672
2026-12-04 13:02:07 -05:00
Kurt Himebauch ad6bb159d3 Write a sleeping session's memory to storage instead of zram 2026-12-04 12:53:14 -05:00
Kurt Himebauch fe6f8638c6 Lay wide session drawer pages out in two columns (#3694)
Keep drawer content composed when changing width, and keep component notes within their groups so columns stay balanced.
2026-12-04 12:15:50 -05:00
Kurt Himebauch 26b11c6838 Keep the session drawer open while the agent's file picker is up (#3696)
Preserve the Agent page and its result handler while the system picker covers the session, including on a docked second screen.
2026-12-04 11:00:09 -05:00
Kurt Himebauch a9f2017aa3 Draw the outline of enabled secondary buttons under the agent's latest reply (#3697)
* Draw the outline of enabled secondary buttons under the agent's latest reply

* Count only the index fetch's own connections in DesktopLanguageIndexSourceTest
2026-12-04 10:25:37 -05:00
Kurt Himebauch bc8a970520 Stop re-arming frame generation after repeated GPU loss (#3659)
Disable frame generation after repeated startup device losses, while preserving recovery for engines that had been working. Keep the current ZeroFG-compatible submission path.
2026-12-04 09:41:39 -05:00
Kurt Himebauch eefd8088dc Merge original Snapdragon X detection contribution (#524)
Retain the implementation and tests already merged in #3671. This merge preserves the original contribution history without changing the current source tree.
2026-12-04 09:38:53 -05:00
Kurt Himebauch 442f1f83bf Resolve Snapdragon X conflicts against main
Keep the implementation and tests from #3671 while retaining the original contributor branch history.
2026-12-04 09:38:36 -05:00
Kurt Himebauch 1d1c29517a Revert "Feat:Add Snapdragon X Elite and Adreno X1 GPU detection" (#3695)
Revert "Feat:Add Snapdragon X Elite and Adreno X1 GPU detection (#3671)"

This reverts commit be98982cfc.
2026-12-04 09:30:22 -05:00
LunaDL be98982cfc Feat:Add Snapdragon X Elite and Adreno X1 GPU detection (#3671)
* feat(gpu): add Snapdragon X and Adreno X1 detection

* fix: resolve Snapdragon X PR conflicts and review findings

* fix: resolve Snapdragon X PR conflicts and review findings

* fix: resolve Snapdragon X PR conflicts and review findings

* fix: resolve Snapdragon X PR conflicts and review findings

* fix: resolve Snapdragon X PR conflicts and review findings

* fix: resolve Snapdragon X PR conflicts and review findings

* test: preserve current SoC mappings and cover QTI X1 fallback

* test: preserve current SoC mappings and cover QTI X1 fallback

* test: preserve current SoC mappings and cover QTI X1 fallback

* fix: keep session TU_DEBUG policy authoritative

* test: preserve explicit TU_DEBUG environment overrides

* chore: remove unused GPU detection import

* test: verify TU_DEBUG defaults stay session-owned

* chore: restart PR CI

* fix: remove duplicate game environment resolver

* fix: preserve session TU_DEBUG defaults for Flatpak and Snap

* fix: only export explicit game TU_DEBUG overrides

* test: correct SoC platform fallback assertions

* test: cover inherited session TU_DEBUG defaults

* test: remove redundant GameEnvironment comment

* fix: preserve Venus game sysmem setting

* test: cover persisted Venus sysmem setting
2026-12-04 09:29:44 -05:00
Kurt Himebauch ed763ecb9b Let the session drawer expand to the screen's left edge (#3691)
Keep the resize grip usable at full width and reserve its touch area from Android Back gestures.
2026-12-04 09:22:27 -05:00
Kurt Himebauch ecbda604e2 ci: save the Robolectric jar cache from main only (#3604)
A pull request's cache entry is visible only to that pull request, so each
PR stored its own ~830 MB copy that no other PR could restore, while new
PRs started from main's incomplete set and downloaded the rest from Maven
Central, where the 429s come from. The copies also kept the repository at
its 10 GB cache limit and pushed out other caches.
2026-12-04 08:56:53 -05:00
Kurt Himebauch c514c59018 Settings search: open the result's row, scroll to it and flash it (#3657)
* Settings search: open the result's row, scroll to it and flash it

* Opt in to the foundation API the search target uses
2026-12-04 08:56:05 -05:00
Kurt Himebauch b6efc4d44a Updates: Lab builds under the installed build, two panes in landscape (#3667)
* feat(updates): Lab builds under the installed build, two panes in landscape

Lab builds sit under the installed build instead of below the test list,
with kept builds folded behind a toggle while one runs. In landscape the
page splits into two panes that scroll on their own: the installed build,
checks, Lab builds and tester options on the left, the channel picker and
its status on the right. The selected test build expands in place with its
status, notes and install button.

* fix(updates): stack the fallback status above the test list
2026-12-04 08:55:44 -05:00
Kurt Himebauch b61f766b66 fix(session): sleep freezes the programs that run in worker processes (#3665)
With the native session, gamescope, Xwayland, wineserver and the game each run
in a worker process of their own: none descends from the session root, so the
freeze on sleep left them running. On wake the resume still added the frozen
time to the guest clock shift, and every one of them saw its monotonic clock
jump back by the length of the sleep. Unreal games abort on that:
KINGDOM HEARTS III failed with "Detected negative delta time" (DeltaTime
-10.05 s after a 13 s sleep).

The freeze now treats the session's worker programs as helper roots, as the
teardown already does.
2026-12-04 08:54:51 -05:00
Ben Pfeiffer 2f16ea63aa fix(gpu): distinguish Adreno X1-45 and remove generic renderD128 check
- Distinguish Adreno X1-45 (Snapdragon X Plus / purwa) from Adreno X1-85
  (Snapdragon X Elite / hamoa) in GpuInfo, falling back to neutral 'Adreno X1'
  when the exact variant is unspecified.
- Remove generic /sys/class/drm/renderD128 check from DeviceSupport.adreno()
  so non-Qualcomm DRM GPUs are not erroneously marked as Adreno.
- Add unit tests verifying X1 variant name resolution.
2026-10-24 00:31:49 +00:00
Kurt Himebauch 151b2c304f Merge current main into PR #524 2026-10-22 13:11:01 -04:00
Kurt Himebauch b3e9ea5620 Merge current main into PR #524 2026-10-22 12:13:45 -04:00
Kurt Himebauch a4a5a88ab2 Merge remote-tracking branch 'origin/main' into fix/pr-524-authorship-conflict 2026-10-22 11:36:38 -04:00
Kurt Himebauch 839a00a8aa Merge remote-tracking branch 'origin/main' into fix/pr-524-authorship-conflict
# Conflicts:
#	app/src/main/java/com/droiddeck/launcher/gpu/GpuInfo.kt
2026-10-22 11:36:01 -04:00
xXJsonDeruloXx a7f7a17a69 Merge main into Adreno X1 detection PR 2026-10-22 10:04:51 -04:00
xXJsonDeruloXx 74a77c1402 fix: keep the GPU hardware fallback non-null when Build.HARDWARE is unset 2026-10-18 17:49:52 -04:00
xXJsonDeruloXx 673c9869f8 chore: merge main to catch up with 0.5.0 2026-10-18 16:49:16 -04:00
BenPfeiffer-TX 215ed5aaed Merge branch 'main' into feat/adreno-x185-detection 2026-10-11 15:11:04 -05:00
BenPfeiffer-TX 7b91aea0fc Merge branch 'main' into feat/adreno-x185-detection 2026-10-11 09:22:07 -05:00
Ben Pfeiffer 2b424bdfe7 feat(gpu): default to nolrz and nolrzfc on Adreno X1-85 to prevent depth dithering
Turnip's Low-Resolution Z (LRZ / early-Z) depth tile cache can desynchronize
on Adreno 741 (X1-85 / X1-45), leading to checkerboard or dithering depth
artifacts in 3D titles and Vulkan presentation.

Default TU_DEBUG to 'nolrz,nolrzfc' on GPU model 741 in both GameEnvironment
defaults (Proton games) and SessionService (Gamescope/Steam session), while
preserving user overrides.
2026-10-10 17:22:07 +00:00
Ben Pfeiffer a4e6279a8d feat(gpu): add Snapdragon X Elite and Adreno X1-85 detection 2026-10-09 02:51:29 +00:00
211 changed files with 17736 additions and 25378 deletions

No files matched your search

-3
View File
@@ -325,9 +325,6 @@ jobs:
- name: Build the DiRT 3 / DiRT Showdown ws2_32 stand-in
run: python3 tools/components/prepare.py dirt-ws2
- name: Build the DLSS / FSR / XeSS upscale bridges
run: python3 tools/components/prepare.py upscale-bridges
- name: Cache graphics driver inputs
uses: actions/cache@v4
with:
+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 epic upscale; do
for name in proot directaudio tracking xbox comet butler powervr ubisoft rockstar dirt epic; 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)
+3 -1
View File
@@ -178,8 +178,10 @@ jobs:
PY
after=$(find "$GITHUB_WORKSPACE/../robolectric-jars" -name '*.jar' | wc -l)
[ "$after" -gt "${ROBOLECTRIC_JARS_BEFORE:-0}" ] && echo "save=true" >> "$GITHUB_OUTPUT" || true
# A pull request's cache is visible only to that pull request, and each copy is hundreds of megabytes against the
# repository's 10 GB cache limit. Only main saves, so every pull request restores main's set.
- name: Store Robolectric's Android jars
if: always() && steps.robolectric-jars-final.outputs.save == 'true'
if: always() && github.event_name != 'pull_request' && steps.robolectric-jars-final.outputs.save == 'true'
uses: actions/cache/save@v4
with:
path: ${{ steps.robolectric-jars.outputs.path }}
+1
View File
@@ -68,6 +68,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
- Runtime, shim, input and controller work build on WinNative and Bannerlator by maxjivi05.
- mmap ring buffer controller input by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)).
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT), and its GL thunk hands X errors to the program's own error handler. FEX's code disk cache was checked in its source. The fix for host stack left behind when a program leaves a signal handler without returning follows the approach suggested in [FEX-Emu/FEX#2487](https://github.com/FEX-Emu/FEX/issues/2487). The host stack fix for system calls that end a block is a backport of Ryan Houdek's [FEX-Emu/FEX#6122](https://github.com/FEX-Emu/FEX/pull/6122).
- Anti-cheat support under FEX is the work of [StonkGuy](https://github.com/StonkGuy): the x86-64 ptrace, seccomp and `/proc` emulation from his [FEX fork](https://github.com/StonkGuy/FEX) (`eac-2611` branch, MIT) is carried as build patch 0021 with his authorship, patches 0022 to 0029 build on it, and his `eac-tests` regression suite verifies them.
- x86-64 programs on Wayland reach the GPU through FEX's Wayland client, wayland-egl and EGL thunks. The guest `wl_list` and `wl_array` helpers follow [libwayland](https://gitlab.freedesktop.org/wayland/wayland)'s `src/wayland-util.c` (MIT). The EGL extension table comes from the [Khronos EGL registry](https://github.com/KhronosGroup/EGL-Registry) (Apache-2.0) and Mesa's `egl_other.xml` (MIT).
- 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.
- DwarFS AppImages are unpacked without proot by `dwarfsextract` from [DwarFS](https://github.com/mhx/dwarfs) by Marcus Holland-Moritz (MIT), the release binary uruntime embeds, taken out of its self-extracting wrapper and shipped with its licence.
+2 -2
View File
@@ -95,7 +95,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', 'epic', 'upscale'].collectEntries { name ->
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft', 'rockstar', 'dirt', 'epic'].collectEntries { name ->
def pack = file("build/packs/${name}.tar.zst")
if (!pack.isFile()) {
if (ciBuild && !unitTestsOnly) throw new GradleException("Add-on pack ${pack} is missing: run tools/packs/build.sh app/build/packs")
@@ -207,7 +207,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>droiddeck-epic:<dir>droiddeck-upscale:<dir>directaudio:<dir>hybris'
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>droiddeck-rockstar:<dir>droiddeck-dirt:<dir>droiddeck-epic:<dir>directaudio:<dir>hybris'
}
packagingOptions {
+2
View File
@@ -40,6 +40,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
-1
View File
@@ -41,7 +41,6 @@ message(STATUS "dd-fg chain: win-fg ${DDFG_UPSTREAM} (src ${DDFG_CHAIN_HASH})")
add_subdirectory(waylandcomp)
add_subdirectory(questxr)
add_subdirectory(../../../../tools/upscale/layer upscale_layer)
add_library(sdnative SHARED sdnative/sdnative.c)
target_link_libraries(sdnative log)
+24 -10
View File
@@ -329,16 +329,28 @@ static constexpr int kWatchedFds = 1 << 16;
static constexpr int kWatchedBits = sizeof(unsigned long) * 8;
static std::atomic<unsigned long> watched_fds[kWatchedFds / kWatchedBits];
static std::atomic<bool> watched_beyond{false};
static std::atomic<int> watched_count{0};
static void watch_fd(int fd) {
if (fd < 0) return;
if (fd >= kWatchedFds) watched_beyond.store(true, std::memory_order_release);
else watched_fds[fd / kWatchedBits].fetch_or(1UL << (fd % kWatchedBits), std::memory_order_release);
if (fd >= kWatchedFds) {
watched_beyond.store(true, std::memory_order_release);
return;
}
const unsigned long bit = 1UL << (fd % kWatchedBits);
if (!(watched_fds[fd / kWatchedBits].fetch_or(bit, std::memory_order_acq_rel) & bit))
watched_count.fetch_add(1, std::memory_order_acq_rel);
}
static void unwatch_fd(int fd) {
if (fd >= 0 && fd < kWatchedFds)
watched_fds[fd / kWatchedBits].fetch_and(~(1UL << (fd % kWatchedBits)), std::memory_order_release);
if (fd < 0 || fd >= kWatchedFds) return;
const unsigned long bit = 1UL << (fd % kWatchedBits);
if (watched_fds[fd / kWatchedBits].fetch_and(~bit, std::memory_order_acq_rel) & bit)
watched_count.fetch_sub(1, std::memory_order_acq_rel);
}
static bool any_watched() {
return watched_count.load(std::memory_order_acquire) > 0 || watched_beyond.load(std::memory_order_acquire);
}
static bool watched(int fd) {
@@ -4269,7 +4281,7 @@ static int poll_fake(struct pollfd *fds, nfds_t nfds, int timeout,
const auto my_poll = next_symbol<decltype(&::poll)>(Next::poll);
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
nfds_t first = 0;
nfds_t first = any_watched() ? 0 : nfds;
while (first < nfds && !watched(fds[first].fd)) first++;
bool has_fake_fds = false;
std::vector<struct pollfd> real_fds;
@@ -4372,12 +4384,12 @@ EXPORT int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
const struct timespec *timeout, const sigset_t *sigmask) {
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
if (timeout && (timeout->tv_sec < 0 || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000L)) {
errno = EINVAL;
return -1;
}
for (nfds_t i = 0; i < nfds; ++i) {
for (nfds_t i = 0; any_watched() && i < nfds; ++i) {
if (!is_fake_input_fd(fds[i].fd)) continue;
if (timeout && (timeout->tv_sec < 0 || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000L)) {
errno = EINVAL;
return -1;
}
if (!sigmask)
return poll_fake(fds, nfds, static_cast<int>(timespec_to_ms(timeout)), nullptr);
sigset_t all_signals, original_mask;
@@ -4410,6 +4422,8 @@ EXPORT int __ppoll_chk(struct pollfd *fds, nfds_t nfds, const struct timespec *t
EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout) {
const auto my_select = next_symbol<decltype(&::select)>(Next::select);
if (!any_watched())
return my_select ? my_select(nfds, readfds, writefds, exceptfds, timeout) : -1;
fd_set original_readfds;
fd_set original_writefds;
+20 -4
View File
@@ -343,6 +343,7 @@ volatile int g_hide_shell;
volatile int g_zero_copy;
static int g_zero_copy_paused;
static int g_mirror_capture;
extern volatile int g_display_buffer_driver;
extern void droiddeck_on_overlay_planes(int planes);
static int g_overlay_planes_told = -1;
@@ -2961,7 +2962,7 @@ static void hdr_note_route(int route, const struct hdr_scene *hs) {
static int said = -1, said_tm = -1;
static const char *said_why;
const int tm = route != 0 && !droiddeck_color_output();
if (route == said && tm == said_tm && (route != 1 || hs->why == said_why)) return;
if (route == said && tm == said_tm && (route < 1 || route > 2 || hs->why == said_why)) return;
int was = said;
said = route; said_why = hs->why; said_tm = tm;
char name[160] = "the HDR game";
@@ -2978,6 +2979,10 @@ static void hdr_note_route(int route, const struct hdr_scene *hs) {
"BT2020_PQ", name, hs->why ? hs->why : "?", droiddeck_color_sdr_white());
break;
case 2:
if (g_mirror_capture) {
droiddeck_log("color", "Mirror: %s is composed through the screen swapchain", name);
break;
}
if (tm)
droiddeck_log("color", "HDR with frame generation for %s, HDR output switched off: the scene is tone-mapped to "
"SDR and presented through an SDR screen swapchain", name);
@@ -3198,6 +3203,11 @@ static void render_scene(void) {
const int cardboard = vkp_cardboard_active();
struct hdr_scene hs;
int hdr_route = hdr_plan(&dl, w, h, fx_on, framegen, &hs);
/* Mirror's PixelCopy cannot see the separate game layer. Keep unimportable frames visible on top. */
if (g_mirror_capture && hdr_route != 3 && hs.n_hdr > 0) {
hdr_route = 2;
hs.why = "Mirror needs the screen swapchain";
}
const char *hdr_copy = NULL;
if (droiddeck_color_hdr_open()) {
hdr_note_route(hdr_route, &hs);
@@ -3263,16 +3273,16 @@ static void render_scene(void) {
else if (rendered && how == 2) droiddeck_color_frame_shown(hs.color, DROIDDECK_HDR_TONEMAPPED, 0);
else if (rendered) hdr_copy = "the HDR composition pass is unavailable on this driver";
}
if (hdr_route == 0 && vkp_quest_layer_presentation() && !framegen && !cardboard && !cursor_on &&
if (hdr_route == 0 && !g_mirror_capture && vkp_quest_layer_presentation() && !framegen && !cardboard && !cursor_on &&
!ahb_only) {
settle_unwaited();
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
} else if (hdr_route == 0 || hdr_route == 3) {
const int pass_on = fx_on || framegen;
tell_overlay_planes();
const int fg_layer = framegen && hdr_route == 0 && framegen_fits_layer();
const int fg_layer = framegen && !g_mirror_capture && hdr_route == 0 && framegen_fits_layer();
g_framegen_layer = fg_layer;
int li = (g_zero_copy && (!framegen || fg_layer) && !bfi && !cardboard && !cursor_on) ? layer_candidate(&dl, w, h) : -1;
int li = (g_zero_copy && !g_mirror_capture && (!framegen || fg_layer) && !bfi && !cardboard && !cursor_on) ? layer_candidate(&dl, w, h) : -1;
int over = li >= 0 ? dl.n - 1 - li : 0;
const int fx_blocks = (li >= 0 && fx_on && over > 0);
if (fx_blocks) { li = -1; over = 0; }
@@ -5002,6 +5012,12 @@ const char *droiddeck_client_name(struct wl_client *client) { return client_name
struct wl_display *droiddeck_get_display(void) { return g_display; }
void droiddeck_request_redraw(void) { schedule_render(); }
void droiddeck_set_mirror_capture(int on) {
if (g_mirror_capture == on) return;
g_mirror_capture = on;
schedule_render();
}
struct wl_resource *droiddeck_ime_target(void) {
struct surface *s;
if (g_ime_click && g_ime_click->mapped) return g_ime_click->resource;
@@ -11,7 +11,7 @@
#include "ahb_swapchain.h"
#include "droiddeck_color.h"
enum host_kind { HOST_CLIPBOARD = 1, HOST_TEXT_COMMIT, HOST_TEXT_PREEDIT, HOST_TEXT_DELETE, HOST_ZERO_COPY, HOST_HDR_OUTPUT, HOST_KEY, HOST_SELECT_GAME_FIELD };
enum host_kind { HOST_CLIPBOARD = 1, HOST_TEXT_COMMIT, HOST_TEXT_PREEDIT, HOST_TEXT_DELETE, HOST_ZERO_COPY, HOST_HDR_OUTPUT, HOST_KEY, HOST_SELECT_GAME_FIELD, HOST_MIRROR_CAPTURE };
struct host_msg {
enum host_kind kind;
@@ -91,6 +91,9 @@ void droiddeck_host_text_delete(int before, int after) {
void droiddeck_host_zero_copy(int on, int live) {
host_post(HOST_ZERO_COPY, NULL, 0, on, live);
}
void droiddeck_host_mirror_capture(int on) {
host_post(HOST_MIRROR_CAPTURE, NULL, 0, on, 0);
}
void droiddeck_host_hdr_output(int on) {
host_post(HOST_HDR_OUTPUT, NULL, 0, on, 0);
}
@@ -271,6 +274,9 @@ static int on_wake(int fd, uint32_t mask, void *data) {
case HOST_ZERO_COPY:
ahb_swapchain_set_mode(m->a, m->b);
break;
case HOST_MIRROR_CAPTURE:
droiddeck_set_mirror_capture(m->a);
break;
case HOST_HDR_OUTPUT:
droiddeck_color_set_output(m->a);
break;
@@ -29,6 +29,8 @@ void droiddeck_host_text_commit_and_submit(const char *utf8, int len);
void droiddeck_host_text_preedit(const char *utf8, int len, int cursor_begin, int cursor_end);
void droiddeck_host_text_delete(int before, int after);
void droiddeck_host_zero_copy(int on, int live);
void droiddeck_host_mirror_capture(int on);
void droiddeck_set_mirror_capture(int on);
void droiddeck_host_hdr_output(int on);
void droiddeck_host_key(int evdev, int state);
void droiddeck_host_select_game_field(int copy);
@@ -79,6 +79,24 @@ static int format_refused(VkFormat f) {
static _Atomic unsigned g_stat_generated;
static uint64_t g_total_generated;
#define FG_PROVEN_FRAMES 120
#define FG_HANG_STRIKES 2
static _Atomic int g_hang_strikes;
static int g_submitted_since_ready;
static uint64_t g_generated_at_ready;
// A driver that hangs on the engine's shaders loses the device on its first generated frame after every
// recovery, so the compositor would recover and hang again for as long as frame generation stays armed.
static int framegen_loss_strike(int submitted, uint64_t completed_since_ready) {
if (!submitted || completed_since_ready >= FG_PROVEN_FRAMES) {
atomic_store(&g_hang_strikes, 0);
return 0;
}
if (atomic_fetch_add(&g_hang_strikes, 1) + 1 < FG_HANG_STRIKES) return 0;
atomic_store(&g_hang_strikes, 0);
return 1;
}
static float g_presented_rate, g_source_rate;
static uint32_t g_present_accum, g_source_accum;
static int64_t g_window_start_ns;
@@ -129,6 +147,7 @@ void vkp_framegen_set_engine(int kind) {
atomic_store(&g_kind, kind);
atomic_store(&g_failed_kind, -1);
atomic_store(&g_cfg_dirty, 1);
atomic_store(&g_hang_strikes, 0);
}
void vkp_framegen_set_armed(int armed, int multiplier, int target_fps) {
@@ -230,6 +249,8 @@ void vkp_framegen_device_ready(VkDevice dev, VkQueue queue, uint32_t qfam, int f
atomic_store(&g_caps_ddfg_ok, fge_caps_ok(VKP_FG_ENGINE_DDFG));
atomic_store(&g_caps_zero_ok, fge_caps_ok(VKP_FG_ENGINE_ZEROFG));
atomic_store(&g_dev_lost, 0);
g_submitted_since_ready = 0;
g_generated_at_ready = g_total_generated;
atomic_store(&g_dev_ready,
vk.CreateImage && vk.CreateImageView && vk.CmdPipelineBarrier);
FGLOG("engines ready on compositor device: LSFG %s, DD-FG %s, ZeroFG %s",
@@ -238,8 +259,21 @@ void vkp_framegen_device_ready(VkDevice dev, VkQueue queue, uint32_t qfam, int f
fge_caps_ok(VKP_FG_ENGINE_ZEROFG) ? "available" : "unavailable");
}
// The compositor reports one loss twice: when it happens and again while releasing the lost device.
static int framegen_count_loss(void) {
if (atomic_exchange(&g_dev_lost, 1)) return 0;
int failed = framegen_loss_strike(g_submitted_since_ready, g_total_generated - g_generated_at_ready);
g_submitted_since_ready = 0;
return failed;
}
void vkp_framegen_device_lost(void) {
atomic_store(&g_dev_lost, 1);
if (framegen_count_loss()) {
int kind = atomic_load(&g_kind);
mark_failed(kind);
FGLOG("%s lost the GPU %d times in a row before its frames completed; frame generation stays off "
"until it is set again", fge_engine_name(kind), FG_HANG_STRIKES);
}
atomic_store(&g_dev_ready, 0);
fge_device_lost();
if (g_dev) {
@@ -523,6 +557,7 @@ int vkp_framegen_run(VkCommandBuffer cmd, VkImage scene, VkImageView scene_view,
VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
0, 0, NULL, 0, NULL, nb, bars);
if (n_gen) g_submitted_since_ready = 1;
fge_process(cmd, scene, scene_view, (uint32_t)w, (uint32_t)h, fmt, planning_sequence, n_gen);
for (uint32_t g = 0; g < n_gen; g++) {
fge_generate(cmd, g, n_gen, g_ring[g].img, g_ring[g].view, (uint32_t)w, (uint32_t)h);
@@ -461,6 +461,11 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetZeroCopy(JNIEnv *
__android_log_print(ANDROID_LOG_INFO, TAG, "zero-copy layer mode %s%s", on ? "on" : "off", live ? " (live)" : "");
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetMirrorCapture(JNIEnv *env, jclass clazz, jboolean on) {
droiddeck_host_mirror_capture(on ? 1 : 0);
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetDisplayBufferDriver(JNIEnv *env, jclass clazz, jboolean on) {
g_display_buffer_driver = on ? 1 : 0;
@@ -661,6 +661,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private var effects by mutableStateOf(ScreenEffects.OFF)
private var observedScreenEffectsProfileId by mutableStateOf<String?>(null)
private var screenEffectsTarget by mutableStateOf(SCREEN_EFFECTS_TARGET_AUTO)
private var screenEffectsProfileRevision by mutableIntStateOf(0)
private var cardboard by mutableStateOf(Cardboard.OFF)
private var headTracker: HeadTracker? = null
private var steamVrStatus by mutableStateOf<SteamVr.Status?>(null)
@@ -1641,8 +1642,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
effects = effects,
screenEffectsTarget = screenEffectsTarget,
screenEffectsTargets = screenEffectsTargetOptions(),
screenEffectsCanDelete = screenEffectsProfileIdForTarget(screenEffectsTarget)?.let {
SessionPrefs.hasScreenEffectsOverride(this@SessionActivity, it)
screenEffectsCanDelete = screenEffectsProfileRevision.let {
screenEffectsProfileIdForTarget(screenEffectsTarget)?.let {
SessionPrefs.hasScreenEffectsOverride(this@SessionActivity, it) ||
SessionPrefs.hasScreenEffectsUpscalerOverride(this@SessionActivity, it)
}
} == true,
cardboard = cardboard,
cardboardSensor = hasRotationSensor,
@@ -1748,6 +1752,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
} else {
val profileId = screenEffectsProfileIdForTarget(target)
SessionPrefs.setScreenEffectsUpscaler(this@SessionActivity, profileId, m)
screenEffectsProfileRevision++
if (target == screenEffectsTarget) {
upscaler = m
@@ -1783,6 +1788,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
} else {
val profileId = screenEffectsProfileIdForTarget(target)
SessionPrefs.setScreenEffectsUpscaler(this@SessionActivity, profileId, m)
screenEffectsProfileRevision++
if (target == screenEffectsTarget) {
upscaler = m
if (screenEffectsUpscalerTargetAppliesToLiveOutput(target)) {
@@ -1829,7 +1835,22 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
val profileId = screenEffectsProfileIdForTarget(editorTarget)
SessionPrefs.setScreenEffects(this@SessionActivity, profileId, e)
effects = e
if (screenEffectsTargetAppliesToLiveOutput(editorTarget)) e.push(upscaler)
if (screenEffectsTargetAppliesToLiveOutput(editorTarget)) {
val upscalerAppliesToLiveOutput =
screenEffectsUpscalerTargetAppliesToLiveOutput(editorTarget)
val liveUpscaler = if (upscalerAppliesToLiveOutput) {
SessionPrefs.screenEffectsUpscaler(
this@SessionActivity,
screenEffectsProfileIdForTarget(editorTarget)
)
} else {
SessionPrefs.screenEffectsUpscaler(
this@SessionActivity,
currentScreenEffectsProfileId()
)
}
e.push(liveUpscaler)
}
}
}
},
@@ -2648,10 +2669,21 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
val targetUpscaler = SessionPrefs.screenEffectsUpscaler(this, profileId)
effects = targetEffects
upscaler = targetUpscaler
val upscalerAppliesToLiveOutput = screenEffectsUpscalerTargetAppliesToLiveOutput(target)
val liveUpscaler = if (upscalerAppliesToLiveOutput) {
targetUpscaler
} else {
SessionPrefs.screenEffectsUpscaler(this, currentScreenEffectsProfileId())
}
if (upscalerAppliesToLiveOutput) {
WaylandCompositor.nativeSetUpscaler(liveUpscaler)
}
if (screenEffectsTargetAppliesToLiveOutput(target)) {
WaylandCompositor.nativeSetUpscaler(targetUpscaler)
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(targetEffects, targetUpscaler)?.name)
targetEffects.push(targetUpscaler)
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(targetEffects, liveUpscaler)?.name)
targetEffects.push(liveUpscaler)
} else if (upscalerAppliesToLiveOutput) {
val liveEffects = SessionPrefs.screenEffects(this, currentScreenEffectsProfileId())
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(liveEffects, liveUpscaler)?.name)
}
}
@@ -2664,6 +2696,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
private fun resetScreenEffectsTarget(target: String) {
if (target != screenEffectsTarget) return
SessionPrefs.resetScreenEffectsProfile(this, screenEffectsProfileIdForTarget(target))
screenEffectsProfileRevision++
syncScreenEffectsTarget(target)
}
@@ -2671,6 +2704,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
if (target != screenEffectsTarget) return
val profileId = screenEffectsProfileIdForTarget(target) ?: return
SessionPrefs.deleteScreenEffectsProfile(this, profileId)
screenEffectsProfileRevision++
syncScreenEffectsTarget(target)
}
@@ -6348,7 +6382,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
}
private fun holdComposedOutput(hold: Boolean) {
val wasHeld = composedHolds > 0
composedHolds = (composedHolds + if (hold) 1 else -1).coerceAtLeast(0)
val held = composedHolds > 0
if (held == wasHeld) return
WaylandCompositor.nativeSetMirrorCapture(held)
// Importable HDR is redirected by the compositor hold. Keep its layer-only fallback available.
if (zeroCopyActive()) WaylandCompositor.nativeSetZeroCopy(composedOutputFree())
}
@@ -6495,7 +6534,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
displayManager.unregisterDisplayListener(displayListener)
com.droiddeck.launcher.input.DualScreen.unwatchTaken(bottomScreenListener)
contentResolver.unregisterContentObserver(refreshSettingObserver)
if (!screenIsOff()) closeSecondScreen(reset = false)
// Closing the presentation removes the docked Agent page and unregisters its picker.
if (com.droiddeck.launcher.session.SessionVisibilityPolicy.shouldCloseSecondScreenOnStop(
screenOff = screenIsOff(),
dockedDrawerOpen = menuShownOnBottom(),
attachmentPickerOpen = com.droiddeck.launcher.agent.AgentAttachments.picking,
)
) closeSecondScreen(reset = false)
sessionTextInput.stop()
startedScreens = (startedScreens - 1).coerceAtLeast(0)
updateGlassesScreen()
@@ -6532,6 +6577,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
override fun onResume() {
super.onResume()
com.droiddeck.launcher.agent.AgentAttachments.picking = false
drawerGameInventoryRevision++
com.droiddeck.launcher.input.SystemKeyCapture.attach(this, { hasWindowFocus() && !appUiOwnsPointer() && CompositorHost.isStarted }) { event ->
com.droiddeck.launcher.input.GuestKeys.send(event) { code, down -> sendGuestKey(code, down, 8) }
@@ -6645,7 +6691,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
heldButtons.clear()
if (!screenOff) {
val menuUp = menuShownOnBottom()
drawerOpen = false
if (!com.droiddeck.launcher.agent.AgentAttachments.picking) drawerOpen = false
if (menuUp) SessionState.bottomMenu = true
pcKeyboardOpen = false
achievementsOpen = false
@@ -19,6 +19,15 @@ object AgentAttachments {
/** Guest paths waiting to go with the next message. */
val pending = mutableStateListOf<String>()
/** True while the file picker is open over a session: it answers the drawer's agent page, so the drawer must stay. */
@Volatile var picking = false
/** Launches a system screen that answers the agent page, keeping the drawer for it; the result callback clears [picking]. */
fun pick(launch: () -> Unit) {
picking = true
if (runCatching(launch).isFailure) picking = false
}
private const val NEW = "new"
private const val GUEST_DIR = "/root/.cache/droiddeck/attachments"
private val IMAGE = setOf("png", "jpg", "jpeg", "webp", "gif", "bmp")
@@ -35,14 +44,17 @@ object AgentAttachments {
val folder = chat ?: NEW
val dir = File(hostDir(app), folder).apply { mkdirs() }
return uris.mapNotNull { uri ->
var target: File? = null
runCatching {
val name = displayName(app, uri).replace(Regex("[^A-Za-z0-9._-]"), "_").ifEmpty { "file" }
var target = File(dir, name)
var candidate = File(dir, name)
var n = 1
while (target.exists()) target = File(dir, "${name.substringBeforeLast('.')}-${n++}${name.substringAfterLast('.', "").let { if (it.isEmpty()) "" else ".$it" }}")
app.contentResolver.openInputStream(uri)!!.use { input -> target.outputStream().use { input.copyTo(it) } }
"$GUEST_DIR/$folder/${target.name}"
}.getOrNull()
// Created atomically, so copies running side by side never pick the same name.
while (!candidate.createNewFile()) candidate = File(dir, "${name.substringBeforeLast('.')}-${n++}${name.substringAfterLast('.', "").let { if (it.isEmpty()) "" else ".$it" }}")
target = candidate
app.contentResolver.openInputStream(uri)!!.use { input -> candidate.outputStream().use { input.copyTo(it) } }
"$GUEST_DIR/$folder/${candidate.name}"
}.onFailure { target?.delete() }.getOrNull()
}
}
@@ -175,9 +175,6 @@ internal class AddonPack(
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"))
/** The in-game upscaler's bridge DLLs (tools/upscale/bridges), staged by UpscaleComponent. */
val UPSCALE = AddonPack("upscale", BuildConfig.PACK_UPSCALE_SHA256, BuildConfig.PACK_UPSCALE_SIZE,
listOf("bridges/x86_64-windows/libxess.dll", "bridges/x86_64-windows/nvngx.dll"))
val EPIC = AddonPack("epic", BuildConfig.PACK_EPIC_SHA256, BuildConfig.PACK_EPIC_SIZE, listOf("EpicGamesLauncher.exe"))
}
}
@@ -1,140 +0,0 @@
package com.droiddeck.launcher.core
/**
* The in-game upscaler (tools/upscale): bridge DLLs stand in for a game's own DLSS / FidelityFX / FSR 2/3 /
* XeSS DLLs and hand each frame to the VK_LAYER_DROIDDECK_upscale layer, which runs FSR 4 (GPU or Hexagon NPU),
* XeSS 3 DP4a or a basic temporal upscaler in its place. Ported from Winlator-NeuralScale
* (michaelisomer-cyber, GPL-3.0, a fork of StevenMXZ/Winlator-Ludashi).
*
* Per game it is a few entries of the game environment; droiddeck-game-env turns them into the DLL overrides,
* the bridge folder, the layer switch and the files the layer reads.
*/
object GameUpscaler {
const val MODE = "DROIDDECK_UPSCALE_MODE"
const val ENGINE = "DROIDDECK_UPSCALE_ENGINE"
const val SHARPNESS = "DROIDDECK_UPSCALE_SHARPNESS"
const val NPU_SYNC = "DROIDDECK_UPSCALE_NPU_SYNC"
const val SIGFIX = "DROIDDECK_UPSCALE_SIGFIX"
val keys = listOf(MODE, ENGINE, SHARPNESS, NPU_SYNC, SIGFIX)
/** Which of the game's upscalers are replaced, and what GPU the game is shown. */
enum class Mode(val id: String) {
/** FidelityFX (FSR 4 API), FSR 2/3 and XeSS games; the real GPU is reported. */
FSR_XESS("fsr"),
/** DLSS games: also nvngx + nvapi64, and the game sees an RTX 2060. */
DLSS("dlss"),
/** Games whose FSR 4 path wants an RDNA 4 card: the game sees a Radeon RX 9070 XT, shader model 6.8. */
NATIVE_FSR4("native");
companion object {
fun byId(id: String?): Mode? = entries.firstOrNull { it.id == id?.trim()?.lowercase() }
}
}
/** What runs in the game's upscaler's place. Ids are the layer's backend names (fsr4_layer.c parse_backend_str). */
enum class Engine(val id: String, val npu: Boolean) {
FSR4_LITE_GPU("fsr4_1_lite_gpu", false),
FSR4_FULL_GPU("fsr4_1_full_gpu", false),
XESS("xess3_gpu", false),
BASIC("fsr3_gpu", false),
SGSR2("sgsr2_gpu", false),
FSR4_NPU("fsr4_1_full_npu", true),
FSR4_LITE_NPU("fsr4_1_lite_npu", true);
companion object {
/** Saved before full FSR 4.1 replaced FSR 4.0 on the NPU (NeuralScale r5). */
private const val LEGACY_FSR4_NPU = "fsr4_0_npu"
fun byId(id: String?): Engine? {
val key = id?.trim()?.lowercase()
return if (key == LEGACY_FSR4_NPU) FSR4_NPU else entries.firstOrNull { it.id == key }
}
}
}
val DEFAULT_ENGINE = Engine.FSR4_LITE_GPU
const val DEFAULT_SHARPNESS = 55
val sharpnessSteps = listOf(0, 25, 40, 55, 70, 85, 100)
data class Choice(
val mode: Mode,
val engine: Engine = DEFAULT_ENGINE,
val sharpness: Int = DEFAULT_SHARPNESS,
val npuSync: Boolean = false,
val signatureFix: Boolean = true,
)
fun choice(config: GameEnvironment.Config, scope: String): Choice? {
if (scope.isEmpty()) return null
val entries = config.games[scope].orEmpty()
val mode = Mode.byId(entries[MODE]) ?: return null
return Choice(
mode = mode,
engine = Engine.byId(entries[ENGINE]) ?: DEFAULT_ENGINE,
sharpness = entries[SHARPNESS]?.toIntOrNull()?.coerceIn(0, 100) ?: DEFAULT_SHARPNESS,
npuSync = entries[NPU_SYNC] == "1",
signatureFix = entries[SIGFIX] != "0",
)
}
fun entries(choice: Choice?): Map<String, String> = if (choice == null) emptyMap() else buildMap {
put(MODE, choice.mode.id)
put(ENGINE, choice.engine.id)
put(SHARPNESS, choice.sharpness.coerceIn(0, 100).toString())
if (choice.npuSync) put(NPU_SYNC, "1")
// DLSS games need NGX to accept the bridge DLLs; on unless the player switched it off (stored as "0").
if (choice.mode == Mode.DLSS) put(SIGFIX, if (choice.signatureFix) "1" else "0")
}
fun withChoice(config: GameEnvironment.Config, scope: String, choice: Choice?): GameEnvironment.Config {
require(scope.isNotEmpty() && GameEnvironment.validScope(scope))
val kept = config.entries(scope).filterKeys { it !in keys }
return config.withEntries(scope, kept + entries(choice))
}
/** NPU engines on a device without a usable Hexagon NPU run the matching GPU engine instead. */
fun effectiveEngine(engine: Engine, npuAvailable: Boolean): Engine = when {
!engine.npu || npuAvailable -> engine
engine == Engine.FSR4_NPU -> Engine.FSR4_FULL_GPU
else -> Engine.FSR4_LITE_GPU
}
/** The control file the layer polls (fsr4_layer.c read_live_ctrl): backend, sharpness 0..1, NPU sync, on/off. */
fun controlText(engine: Engine, sharpness: Int, npuSync: Boolean, enabled: Boolean): String =
"enabled=${if (enabled) 1 else 0}\nbackend=${engine.id}\nsharpness=" +
String.format(java.util.Locale.ROOT, "%.2f", sharpness.coerceIn(0, 100) / 100f) +
"\nnpu_sync=${if (npuSync) 1 else 0}\n"
/** One status file the layer writes (fsr4_layer.c write_live_status): key=value lines. */
data class Status(
val active: Boolean,
val npu: Boolean,
val backendTag: String,
val render: String,
val output: String,
val gpuMs: Float,
val npuMs: Float,
val reason: String,
val timestampMs: Long,
)
fun parseStatus(text: String): Status? {
val values = text.lineSequence().mapNotNull { line ->
val eq = line.indexOf('=')
if (eq <= 0) null else line.substring(0, eq).trim() to line.substring(eq + 1).trim()
}.toMap()
if (values["layer"] != "1") return null
return Status(
active = values["active"] == "1",
npu = values["npu"] == "1",
backendTag = values["backend_tag"].orEmpty().ifEmpty { values["backend"].orEmpty() },
render = values["render"].orEmpty(),
output = values["output"].orEmpty(),
gpuMs = (values["gpu_us"]?.toLongOrNull() ?: 0L) / 1000f,
npuMs = (values["htp_us"]?.toLongOrNull() ?: 0L) / 1000f,
reason = values["reason"].orEmpty(),
timestampMs = values["ts_ms"]?.toLongOrNull() ?: 0L,
)
}
}
@@ -14,7 +14,7 @@ internal object DroidDeckHudConfig {
"showLatency" to "1", "showAvg" to "1", "showLow1" to "1", "showLow01" to "0", "showLow001" to "0",
"showEngine" to "1", "showRenderer" to "1",
"showDisplay" to "1", "showHdr" to "1", "showNet" to "1", "showResolution" to "1",
"showProton" to "1", "showUpscale" to "1", "showSession" to "1", "showClock" to "1", "hudOrder" to "",
"showProton" to "1", "showSession" to "1", "showClock" to "1", "hudOrder" to "",
"tempUnit" to "c", "tempBands" to "1", "tempAuto" to "1", "tempRedCpu" to "90", "tempRedGpu" to "90", "tempRedBat" to "48",
)
@@ -287,9 +287,6 @@ class DroidDeckHudHost(context: Context) {
proton = protonName(pid) ?: proton
}
hud.setWineVersion(proton)
hud.setUpscale(com.droiddeck.launcher.session.UpscaleComponent.status(context)?.takeIf { it.active }?.let {
it.backendTag + " " + String.format(java.util.Locale.ROOT, "%.1fms", if (it.npu) it.npuMs else it.gpuMs)
})
hud.setPresentedFps(presentedFps())
}
@@ -74,13 +74,12 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
FULL to listOf(
"showFPS", "showFPSGraph", "showGpuModel", "showDisplay", "showHdr", "showGPULoad", "showGpuTemp",
"showCPUUsage", "showTemp", "showVram", "showRAM", "showBattery", "showBatteryTemp", "showBatteryTime",
"showPower", "showLatency", "showAvg", "showLow1", "showLow01", "showLow001", "showUpscale",
"showPower", "showLatency", "showAvg", "showLow1", "showLow01", "showLow001",
),
TILES to listOf(
"showFPS", "showFPSGraph", "showLatency", "showGPULoad", "showGpuTemp", "showCPUUsage", "showTemp",
"showVram", "showRAM", "showEngine", "showDisplay", "showHdr", "showAvg", "showLow1",
"showLow01", "showLow001", "showGpuModel", "showBattery", "showBatteryTemp", "showBatteryTime", "showPower",
"showUpscale",
),
PILL to listOf(
"showFPS", "showFPSGraph", "showGpuModel", "showGPULoad", "showGpuTemp", "showCPUUsage", "showTemp",
@@ -114,7 +114,6 @@ class DroidDeckHudView(context: Context) : View(context) {
private var gpuModel = ""
private var gpuSpoofName = ""
private var wineVersion = ""
private var upscaleText = ""
private var graphicsWrapper = ""
private var dxvkVersion = ""
private var vkd3dVersion = ""
@@ -284,8 +283,6 @@ class DroidDeckHudView(context: Context) : View(context) {
fun setEngineLabel(s: String?) { if ((s ?: "") != engineLabel) { engineLabel = s ?: ""; post { rebuildAndInvalidate() } } }
fun setGpuModel(s: String?) { if ((s ?: "") != gpuModel) { gpuModel = s ?: ""; post { rebuildAndInvalidate() } } }
fun setWineVersion(s: String?) { if ((s ?: "") != wineVersion) { wineVersion = s ?: ""; post { rebuildAndInvalidate() } } }
/** The in-game upscaler's backend and its time per frame (empty: not running). */
fun setUpscale(s: String?) { if ((s ?: "") != upscaleText) { upscaleText = s ?: ""; post { rebuildAndInvalidate() } } }
fun setResolution(s: String?) { resolution = s ?: "" }
@@ -781,7 +778,6 @@ class DroidDeckHudView(context: Context) : View(context) {
"showHdr" -> "HDR" to colHdr
"showResolution" -> "RES" to colDim
"showProton" -> "PROTON" to colVram
"showUpscale" -> "UPSCALE" to colFps
"showSession" -> "TIME" to colDim
else -> key.removePrefix("show") to colDim
}
@@ -819,7 +815,6 @@ class DroidDeckHudView(context: Context) : View(context) {
"showHdr" -> if (showHdrLine()) hdrValue(valuePx) else listOf(Span("off", colDim, valuePx))
"showResolution" -> listOf(Span(resolutionString(), colValue, valuePx))
"showProton" -> listOf(Span(wineVersion.ifBlank { "—" }, colVram, valuePx))
"showUpscale" -> listOf(Span(upscaleText.ifBlank { "—" }, colValue, valuePx))
"showSession" -> listOf(Span(elapsedString(), colValue, valuePx))
else -> listOf(Span("—", colDim, valuePx))
}
@@ -98,13 +98,6 @@ object GameEnvironmentStore {
return config
}
@Synchronized
fun setGameUpscaler(context: Context, scope: String, choice: com.droiddeck.launcher.core.GameUpscaler.Choice?): GameEnvironment.Config {
val config = com.droiddeck.launcher.core.GameUpscaler.withChoice(read(context), scope, choice)
save(context, config)
return config
}
@Synchronized
fun setDefault(context: Context, scope: String, name: String, value: String): Boolean {
val config = read(context)
@@ -66,11 +66,14 @@ object ProtonExtras {
internal fun installedIn(dir: File, tool: Tool): List<String> =
dir.listFiles()
?.filter { it.isDirectory && it.name.startsWith(tool.prefix) && usable(it) }
?.filter { it.isDirectory && it.name.startsWith(tool.prefix) && !x86_64Build(it) && usable(it) }
?.map { it.name }
?.sortedWith { a, b -> compareVersions(a, b) }
?: emptyList()
internal fun x86_64Build(dir: File): Boolean =
File(dir, "files/lib/wine/x86_64-unix").isDirectory && !File(dir, "files/bin-arm64").isDirectory
private fun usable(dir: File): Boolean {
val manifest = runCatching { File(dir, "toolmanifest.vdf").readText() }.getOrNull() ?: return false
val command = Regex("\\\"commandline\\\"\\s+\\\"/?([^\\\" ]+)").find(manifest)?.groupValues?.getOrNull(1) ?: return false
@@ -259,11 +259,6 @@ object SessionFiles {
"usr/local/lib/droiddeck-gpuload/libVkLayer_droiddeck_gpuload.so" to "usr/local/lib/droiddeck-gpuload/libVkLayer_droiddeck_gpuload.so",
"usr/local/lib/droiddeck-gpuload/VK_LAYER_DROIDDECK_gpu_load.json" to "usr/share/vulkan/implicit_layer.d/droiddeck_gpu_load.json",
)
// The in-game upscaler's layer for PRoot games (UpscaleComponent; off unless DROIDDECK_UPSCALE=1).
val upscaleLayer = listOf(
"usr/local/lib/droiddeck-upscale-layer/libVkLayer_droiddeck_upscale.so" to "usr/local/lib/droiddeck-upscale-layer/libVkLayer_droiddeck_upscale.so",
"usr/local/lib/droiddeck-upscale-layer/VK_LAYER_DROIDDECK_upscale.json" to "usr/share/vulkan/implicit_layer.d/droiddeck_upscale.json",
)
val fexPreloads = listOf("x86_64", "i386").flatMap { arch ->
listOf("libddsession.so", "libfakeinput.so", "libfaultreport.so").map { "$arch/$it" to "usr/local/lib/droiddeck-fex/$arch/$it" }
} + listOf("libvulkan-thunk.so", "libwebkitinput.so").map { "x86_64/$it" to "usr/local/lib/droiddeck-fex/x86_64/$it" }
@@ -286,7 +281,7 @@ object SessionFiles {
"usr/local/lib/droiddeck-pipewire.tzst" to "usr/local/lib/droiddeck-pipewire.tzst",
"usr/local/share/licenses/dwarfs/LICENSE" to "usr/local/share/licenses/dwarfs/LICENSE",
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
) + mangoapp + xclipse.map { it to it } + maliCompat + msitools.map { it to it } + vr + gpuLoad + upscaleLayer + fexPreloads).filter { (asset, _) ->
) + 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)
}
@@ -972,6 +972,9 @@ object SessionPrefs {
fun returnAfterGame(context: Context): Boolean = prefs(context).getBoolean("returnAfterGame", true)
/** A sleeping session writes its memory to storage instead of zram. */
fun diskSpill(context: Context): Boolean = prefs(context).getBoolean("diskSpill", false)
fun valveProtonOnDemand(context: Context): Boolean = prefs(context).getBoolean("valveProtonOnDemand", true)
fun setValveProtonOnDemand(context: Context, on: Boolean) {
@@ -2011,24 +2014,84 @@ object SessionPrefs {
sessionPrefs.edit().putString(SCREEN_EFFECTS_PROFILES_KEY, profiles.toString()).apply()
}
private const val GAME_UPSCALER_OVERRIDES_KEY = "upscaler.gameOverrides"
private fun gameUpscalerOverrides(context: Context): JSONObject = runCatching {
JSONObject(prefs(context).getString(GAME_UPSCALER_OVERRIDES_KEY, null) ?: "{}")
}.getOrDefault(JSONObject())
private fun legacyScreenEffectsUpscaler(context: Context, profileId: String): Int? =
runCatching {
val profiles = JSONObject(prefs(context).getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
val profile = profiles.optJSONObject(profileId)
if (profile?.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY) == true) {
profile.optInt(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY, -1).takeIf { it >= 0 }
} else null
}.getOrNull()?.let(::canonicalUpscaler)
private fun clearLegacyScreenEffectsUpscaler(context: Context, profileId: String) {
val sessionPrefs = prefs(context)
val profiles = runCatching {
JSONObject(sessionPrefs.getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
}.getOrNull() ?: return
val profile = profiles.optJSONObject(profileId) ?: return
if (!profile.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY)) return
profile.remove(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY)
if (profile.length() == 0) profiles.remove(profileId)
sessionPrefs.edit().apply {
if (profiles.length() == 0) remove(SCREEN_EFFECTS_PROFILES_KEY)
else putString(SCREEN_EFFECTS_PROFILES_KEY, profiles.toString())
}.apply()
}
fun hasGameUpscalerOverride(context: Context, gameId: String): Boolean {
if (gameId.isBlank()) return false
val stored = gameUpscalerOverrides(context)
return (stored.has(gameId) && stored.optInt(gameId, -1) >= 0) ||
legacyScreenEffectsUpscaler(context, "game:$gameId") != null
}
fun setGameUpscaler(context: Context, gameId: String, mode: Int) {
if (gameId.isBlank()) return
val overrides = gameUpscalerOverrides(context)
overrides.put(gameId, canonicalUpscaler(mode))
prefs(context).edit().putString(GAME_UPSCALER_OVERRIDES_KEY, overrides.toString()).apply()
clearLegacyScreenEffectsUpscaler(context, "game:$gameId")
}
fun clearGameUpscaler(context: Context, gameId: String) {
if (gameId.isBlank()) return
val sessionPrefs = prefs(context)
val overrides = gameUpscalerOverrides(context)
if (overrides.has(gameId)) {
overrides.remove(gameId)
sessionPrefs.edit().apply {
if (overrides.length() == 0) remove(GAME_UPSCALER_OVERRIDES_KEY)
else putString(GAME_UPSCALER_OVERRIDES_KEY, overrides.toString())
}.apply()
}
clearLegacyScreenEffectsUpscaler(context, "game:$gameId")
}
fun hasScreenEffectsUpscalerOverride(context: Context, profileId: String?): Boolean {
if (profileId.isNullOrBlank()) return false
return runCatching {
val profiles = JSONObject(prefs(context).getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
profiles.optJSONObject(profileId)?.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY) == true
}.getOrDefault(false)
if (profileId.startsWith("game:")) {
return hasGameUpscalerOverride(context, profileId.removePrefix("game:"))
}
return legacyScreenEffectsUpscaler(context, profileId) != null
}
fun screenEffectsUpscaler(context: Context, profileId: String?): Int {
if (profileId.isNullOrBlank()) return upscaler(context)
val stored = runCatching {
val profiles = JSONObject(prefs(context).getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
val profile = profiles.optJSONObject(profileId)
if (profile?.has(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY) == true) {
profile.optInt(SCREEN_EFFECTS_PROFILE_UPSCALER_KEY, -1)
} else -1
}.getOrDefault(-1)
return if (stored >= 0) canonicalUpscaler(stored) else upscaler(context)
if (profileId.startsWith("game:")) {
val gameId = profileId.removePrefix("game:")
val overrides = gameUpscalerOverrides(context)
if (overrides.has(gameId)) {
val stored = overrides.optInt(gameId, -1)
if (stored >= 0) return canonicalUpscaler(stored)
}
}
return legacyScreenEffectsUpscaler(context, profileId) ?: upscaler(context)
}
fun setScreenEffectsUpscaler(context: Context, profileId: String?, mode: Int) {
@@ -2036,6 +2099,10 @@ object SessionPrefs {
setUpscaler(context, mode)
return
}
if (profileId.startsWith("game:")) {
setGameUpscaler(context, profileId.removePrefix("game:"), mode)
return
}
val sessionPrefs = prefs(context)
val profiles = runCatching {
JSONObject(sessionPrefs.getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
@@ -2072,6 +2139,7 @@ object SessionPrefs {
val profiles = runCatching {
JSONObject(sessionPrefs.getString(SCREEN_EFFECTS_PROFILES_KEY, null) ?: "{}")
}.getOrElse { JSONObject() }
if (profileId.startsWith("game:")) clearGameUpscaler(context, profileId.removePrefix("game:"))
if (!profiles.has(profileId)) return
profiles.remove(profileId)
sessionPrefs.edit().apply {
@@ -111,6 +111,8 @@ class SessionService : Service() {
private var suspendOperationPending = false
private var pipTask = false
private var suspendAttemptFailed = false
private val resumeRecovery = SuspendRecovery()
private val retryResume = Runnable { updateSuspendPolicy() }
private var freezePending = false
private var freezeCancelled = false
private var pendingSteamGameId: String? = null
@@ -276,7 +278,7 @@ class SessionService : Service() {
}
ACTION_XR_ACTIVITY_VISIBLE -> {
xrActivityVisible = true
resumeSession(panelVisible = false)
resumeSession(panelVisible = false, restartRecovery = false)
return START_NOT_STICKY
}
ACTION_XR_ACTIVITY_HIDDEN -> {
@@ -380,6 +382,8 @@ class SessionService : Service() {
suspendOperationPending = false
freezePending = false
suspendAttemptFailed = false
resumeRecovery.reset()
mainHandler.removeCallbacks(retryResume)
suspendController = null
SessionState.micAvailable = false
SessionState.micEnabled = false
@@ -945,11 +949,15 @@ class SessionService : Service() {
return
}
if (gen == sessionGen && SessionState.running) {
val workers = ownWorkers
suspendController = SessionSuspendController(
sessionRoot = { sessionPid },
// Programs handed off to worker processes are not descendants of the session root, and
// the clock shift applied at resume would move their monotonic time backwards.
helperRoots = {
components.mapNotNull { it.suspendPid().takeIf { pid -> pid > 1 } } +
listOfNotNull(BottomDesktop.suspendPid.takeIf { it > 1 })
listOfNotNull(BottomDesktop.suspendPid.takeIf { it > 1 }) +
(if (workers > 0) com.droiddeck.launcher.runtime.GuestWorkers.guestPids(workers) else emptyList())
},
suspendAudio = {
if (!pulse.setSinkSuspended(true)) Log.w(TAG, "could not suspend audio sink")
@@ -973,7 +981,7 @@ class SessionService : Service() {
SessionEvents.record("session.paged_out", mapOf(
"processes" to processes, "unacknowledged" to unacknowledged, "residentMb" to residentKb / 1024,
"swapMb" to swapKb / 1024, "swapBeforeMb" to swapBeforeKb / 1024, "ms" to millis,
))
), sessionDir)
}
},
pagedIn = { processes, swapKb, swapBeforeKb, availableKb, millis ->
@@ -986,7 +994,27 @@ class SessionService : Service() {
SessionEvents.record("session.paged_in", mapOf(
"processes" to processes, "swapMb" to swapKb / 1024, "swapBeforeMb" to swapBeforeKb / 1024,
"availableMb" to availableKb / 1024, "ms" to millis,
))
), sessionDir)
}
},
spilled = { processes, spilledKb, residentKb, millis ->
Log.i(TAG, "wrote $processes processes to storage in $millis ms: ${spilledKb / 1024} MB, " +
"resident ${residentKb / 1024} MB")
mainHandler.post {
SessionEvents.record("session.spilled", mapOf(
"processes" to processes, "spilledMb" to spilledKb / 1024, "residentMb" to residentKb / 1024,
"ms" to millis,
), sessionDir)
}
},
restored = { processes, unacknowledged, residentKb, millis ->
Log.i(TAG, "restored $processes processes ($unacknowledged unacknowledged) from storage in $millis ms: " +
"resident ${residentKb / 1024} MB")
mainHandler.post {
SessionEvents.record("session.restored", mapOf(
"processes" to processes, "unacknowledged" to unacknowledged,
"residentMb" to residentKb / 1024, "ms" to millis,
), sessionDir)
}
},
)
@@ -1133,8 +1161,6 @@ class SessionService : Service() {
if (SessionPrefs.noGlError(this)) guest.add("MESA_NO_ERROR=1")
guest.add("MESA_DISK_CACHE_DATABASE=1")
guest.addAll(GpuStatsComponent.guestEnv(LinuxRuntime.rootDir(this)))
guest.addAll(UpscaleComponent.guestEnv(this))
UpscaleComponent.prepare(this)
guest.add("GLIBC_TUNABLES=glibc.pthread.rseq=0:glibc.malloc.top_pad=16777216")
if (SessionState.mode == MODE_STEAM) guest.add("DD_MANGOAPP=" + (if (SessionPrefs.mangoapp(this)) "1" else "0"))
SessionPaths.current()?.let { SessionArtifacts.markRpcs3Log(it, LinuxRuntime.rootDir(this)) }
@@ -1759,7 +1785,7 @@ class SessionService : Service() {
return
}
if (SessionState.suspended) {
resumeSession()
resumeSession(restartRecovery = false)
mainHandler.postDelayed(flushSteamGame, GAME_LAUNCH_RETRY_MS)
return
}
@@ -1928,8 +1954,10 @@ class SessionService : Service() {
private fun steamGameRunning(gameId: String): Boolean =
SteamGameProcess.running(gameId)
private fun resumeSession(panelVisible: Boolean = true) {
if (SessionState.suspended) SessionState.resumeRequested = true
private fun resumeSession(panelVisible: Boolean = true, restartRecovery: Boolean = true) {
if (SessionState.suspended && (restartRecovery || resumeRecovery.due(SystemClock.elapsedRealtime()))) {
SessionState.resumeRequested = true
}
if (panelVisible) activityVisible = true
screenOn = readScreenOn()
manualPauseRequested = false
@@ -1940,6 +1968,7 @@ class SessionService : Service() {
completeNativeSleep()
completeSteamSleep()
suspendAttemptFailed = false
if (restartRecovery) resumeRecovery.reset()
updateSuspendPolicy()
}
@@ -2158,7 +2187,12 @@ class SessionService : Service() {
controller.cancelFreeze()
}
if (shouldSuspend && SessionState.suspended && !suspendOperationPending) SessionState.resumeRequested = false
if (suspendOperationPending || suspendAttemptFailed || shouldSuspend == SessionState.suspended) return
// A session still held after a failed suspend or resume is released by paced resumes, whatever clears or
// sets the latch; only an explicit resume (resumeSession) restarts the pacing.
val held = SessionState.suspended && SessionState.resumeFailed && !shouldSuspend
if (!suspendOperationPending && resumeRecovery.holds(held, SystemClock.elapsedRealtime())) return
val recovering = suspendAttemptFailed && held
if (suspendOperationPending || (suspendAttemptFailed && !recovering) || shouldSuspend == SessionState.suspended) return
val gen = sessionGen
suspendOperationPending = true
SessionEvents.record(if (shouldSuspend) "session.suspend_requested" else "session.resume_requested", mapOf(
@@ -2173,9 +2207,9 @@ class SessionService : Service() {
freezeCancelled = false
val freezeSteamToken = steamSleepToken
val freezeNativeToken = nativeSleepToken
controller.freeze(
pageOut = steamSleepToken != null || nativeSleepToken != null || !activityVisible || !screenOn,
) { success ->
val pageOut = steamSleepToken != null || nativeSleepToken != null || !activityVisible || !screenOn
controller.freeze(pageOut = pageOut, spill = pageOut && SessionPrefs.diskSpill(this)) { success ->
val rollbackPending = !success && controller.rollbackPending
mainHandler.post {
if (gen != sessionGen || !SessionState.running) return@post
SessionState.suspending = false
@@ -2184,6 +2218,7 @@ class SessionService : Service() {
if (success) {
SessionState.suspended = true
SessionState.resumeFailed = false
resumeRecovery.reset()
SessionEvents.transition(SessionPhase.SUSPENDED, "session.suspended")
releaseLocks()
refreshNotification()
@@ -2198,6 +2233,12 @@ class SessionService : Service() {
SessionState.manualPause = false
Log.w(TAG, "could not confirm that the session stopped")
}
// Some processes are still held: only a resume can release them.
if (rollbackPending) {
SessionState.suspended = true
SessionState.resumeFailed = true
Log.w(TAG, "could not return the session to running after the suspend failed")
}
}
updateSuspendPolicy()
}
@@ -2206,6 +2247,8 @@ class SessionService : Service() {
acquireLocks()
SessionState.resuming = true
controller.resume { success ->
// A loss with another spill still reading back is retried for that one; the loss is kept.
val lost = !success && controller.guestLost && !controller.restoreOutstanding
mainHandler.post {
if (gen != sessionGen || !SessionState.running) return@post
suspendOperationPending = false
@@ -2214,13 +2257,28 @@ class SessionService : Service() {
if (success) {
SessionState.suspended = false
SessionState.resumeFailed = false
suspendAttemptFailed = false
resumeRecovery.reset()
mainHandler.removeCallbacks(retryResume)
SessionEvents.transition(SessionEvents.resumePhase(), "session.resumed")
refreshNotification()
} else if (lost) {
// Everything was continued, but a game ended without its memory back: no retry restores
// it, and the failure stays reported.
SessionState.suspended = false
SessionState.resumeFailures++
SessionState.resumeFailed = true
resumeRecovery.reset()
mainHandler.removeCallbacks(retryResume)
SessionEvents.transition(SessionEvents.resumePhase(), "session.resume_lost_guest")
Log.w(TAG, "a game ended before its memory was read back from storage")
refreshNotification()
} else {
suspendAttemptFailed = true
SessionState.resumeFailures++
SessionState.resumeFailed = true
Log.w(TAG, "could not confirm that the session resumed")
resumeRecovery.failed(SystemClock.elapsedRealtime())?.let { mainHandler.postDelayed(retryResume, it) }
}
updateSuspendPolicy()
}
@@ -29,6 +29,8 @@ internal class SessionSuspendController(
{ _, _, _, _, _, _ -> },
private val pagedIn: (processes: Int, swapKb: Long, swapBeforeKb: Long, availableKb: Long, millis: Long) -> Unit =
{ _, _, _, _, _ -> },
private val spilled: (processes: Int, spilledKb: Long, residentKb: Long, millis: Long) -> Unit = { _, _, _, _ -> },
private val restored: (processes: Int, unacknowledged: Int, residentKb: Long, millis: Long) -> Unit = { _, _, _, _ -> },
) {
private enum class Role { SESSION_ROOT, SESSION_CHILD, HELPER_ROOT, HELPER_CHILD }
@@ -53,10 +55,34 @@ internal class SessionSuspendController(
private var frozen = emptyList<ProcessRecord>()
private var frozenSince: Long? = null
private var pagedOutTargets = emptyList<ProcessRecord>()
private var spilledTargets = emptyList<ProcessRecord>()
// Asked to spill and not yet released by a resume count they saw: acknowledged or not, each may park its process.
private var spillAsked = emptyList<ProcessRecord>()
private var counterUnpublished = false
// Spilled targets whose positive answer was taken (and its acknowledgement removed).
private var spillWritten = emptyList<ProcessRecord>()
// Taken into the restore wait by this resume: alive then, so one that ends without its memory back is lost.
private var adopted = emptyList<ProcessRecord>()
// Released by this attempt on a late answer of 0 or a cancellation: not lost if they end afterwards.
private var answeredLate = emptyList<ProcessRecord>()
fun freeze(pageOut: Boolean = false, completion: (Boolean) -> Unit) {
// A spilled process ended without its memory back since the last suspend began: retrying cannot bring it
// back, so no later resume of this suspension reports success.
@Volatile var guestLost = false
private set
// Spilled processes still reading back, which a later resume waits for again.
@Volatile var restoreOutstanding = false
private set
// A failed freeze that could not return every process to running: only a resume releases them.
@Volatile var rollbackPending = false
private set
fun freeze(pageOut: Boolean = false, spill: Boolean = false, completion: (Boolean) -> Unit) {
cancelled = false
submit({
guestLost = false
val records = frozen.associateByTo(LinkedHashMap()) { it.pid to it.started }
var complete = false
var interrupted = false
@@ -74,7 +100,7 @@ internal class SessionSuspendController(
records[it.pid to it.started] = ProcessRecord(it.pid, it.started, Role.HELPER_ROOT)
}
}
if (pageOut) pageOut(records, root.pid, helpers)
if (pageOut) pageOut(records, root.pid, helpers, spill)
val deadline = nowMillis() + FREEZE_TIMEOUT_MS
var previous: Map<TaskIdentity, Long>? = null
for (pass in 0 until FREEZE_MAX_PASSES) {
@@ -105,9 +131,14 @@ internal class SessionSuspendController(
frozen = records.values.toList()
if (complete && frozenSince == null) frozenSince = nowNanos()
if (!complete) {
if (restoreSafely(frozen)) frozen = emptyList()
// A spilled process is back only once its helper has read it back: until then a resume retries.
adopted = emptyList()
answeredLate = emptyList()
val running = startedAlive()
if (restoreSafely(frozen) && awaitRestored(running)) frozen = emptyList()
runAudio(resumeAudio)
}
rollbackPending = !complete && frozen.isNotEmpty()
if (interrupted) Thread.currentThread().interrupt()
}
completion(complete)
@@ -122,12 +153,23 @@ internal class SessionSuspendController(
fun resume(completion: (Boolean) -> Unit) {
submit({
val records = frozen
advanceClock()
val advancedTo = advanceClock()
adopted = emptyList()
answeredLate = emptyList()
val running = startedAlive()
runAudio(resumeAudio)
val resumed = restoreSafely(records)
if (resumed) frozen = emptyList()
completion(resumed)
if (resumed) readBack()
if (resumed) {
frozen = emptyList()
rollbackPending = false
}
// nothing was continued: the guest clock owes the time from here to the next attempt
if (!resumed && counterUnpublished && advancedTo != null) frozenSince = advancedTo
// a spilled process runs again only once its helper has read its memory back
val restoredAll = resumed && awaitRestored(running)
restoreOutstanding = frozen.isNotEmpty() || spilledTargets.isNotEmpty()
completion(restoredAll && !guestLost)
if (resumed) readBack(waitForRestore = false)
}, { completion(false) })
}
@@ -135,7 +177,10 @@ internal class SessionSuspendController(
closing = true
submit({
advanceClock()
val running = startedAlive()
if (restoreSafely(frozen)) frozen = emptyList()
// the teardown asks the guests to exit, which a process still reading back cannot answer
if (frozen.isEmpty()) awaitRestored(running, whileClosing = true)
completion()
executor.shutdown()
}, completion)
@@ -149,22 +194,25 @@ internal class SessionSuspendController(
}
}
private fun advanceClock() {
val since = frozenSince ?: return
// Returns the moment the guest clock now accounts for, or null when no frozen interval was open.
private fun advanceClock(): Long? {
val since = frozenSince ?: return null
frozenSince = null
val control = clockControl?.takeIf { it.isFile && it.length() >= Long.SIZE_BYTES } ?: return
val now = nowNanos()
val control = clockControl?.takeIf { it.isFile && it.length() >= Long.SIZE_BYTES } ?: return now
try {
mapClockControl(control)
RandomAccessFile(control, "rw").use { file ->
val bytes = ByteArray(Long.SIZE_BYTES)
file.readFully(bytes)
val shift = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).long.coerceAtLeast(0L) +
(nowNanos() - since).coerceAtLeast(0L)
(now - since).coerceAtLeast(0L)
file.seek(0L)
file.write(ByteBuffer.allocate(Long.SIZE_BYTES).order(ByteOrder.LITTLE_ENDIAN).putLong(shift).array())
}
} catch (_: IOException) {
}
return now
}
private fun runAudio(action: () -> Unit) {
@@ -275,13 +323,15 @@ internal class SessionSuspendController(
return tasks.takeIf { stopped && it.isNotEmpty() }
}
private fun pageOut(records: MutableMap<Pair<Int, Long>, ProcessRecord>, root: Int, helpers: List<Int>) {
private fun pageOut(records: MutableMap<Pair<Int, Long>, ProcessRecord>, root: Int, helpers: List<Int>, spill: Boolean) {
val control = zramControl?.takeIf { it.isFile } ?: return
val hold = holdFile(control)
try {
hold.writeText(PAGE_OUT_REQUEST)
// A spill names the resume count it was asked under: any later count releases the helper, however
// late it starts reading.
hold.writeText(if (spill) "$SPILL_REQUEST ${resumeCount(control)}" else PAGE_OUT_REQUEST)
sleep(PAGE_OUT_POLL_MS)
pageOut(control, records, root, helpers)
if (spill) spill(control, records, root, helpers) else pageOut(control, records, root, helpers)
} catch (_: IOException) {
} finally {
hold.delete()
@@ -290,15 +340,208 @@ internal class SessionSuspendController(
private fun holdFile(control: File) = File(control.parentFile, "${control.name}.hold")
private fun pageOut(control: File, records: MutableMap<Pair<Int, Long>, ProcessRecord>, root: Int, helpers: List<Int>) {
private fun ackFile(control: File, kind: String, record: ProcessRecord) =
File(control.parentFile, "${control.name}.$kind.${record.pid}")
private fun preloaded(records: Collection<ProcessRecord>) = records.filter { record ->
try {
File(procRoot, "${record.pid}/maps").useLines { lines -> lines.any { it.endsWith("/libddsession.so") } }
} catch (_: IOException) {
false
}
}
private fun readAck(ack: File): Long? = try {
ack.readText().trim().toLongOrNull()
} catch (_: IOException) {
null
}
// Each process parks its threads, writes its private memory to an unlinked file and stays parked until
// the resume counter changes; its acknowledgement is the kB it wrote, 0 when it paged out to zram instead.
private fun spill(control: File, records: MutableMap<Pair<Int, Long>, ProcessRecord>, root: Int, helpers: List<Int>) {
addSnapshot(records, root, helpers)
val targets = records.values.filter { record ->
try {
File(procRoot, "${record.pid}/maps").useLines { lines -> lines.any { it.endsWith("/libddsession.so") } }
// A restore that finished after the last resume stopped waiting is counted before its marker goes; one
// still reading is not asked to spill again.
val (done, still) = spilledTargets.partition { settled(control, it) }
release(control, done)
spilledTargets = still
val targets = preloaded(records.values).filterNot { it in spilledTargets }
if (targets.isEmpty()) return
targets.forEach { ackFile(control, "ack", it).delete(); ackFile(control, "restored", it).delete() }
val start = nowMillis()
spillAsked = (spillAsked + targets).distinct()
for (record in targets) send(record, SIGURG)
val waiting = targets.toMutableList()
while (!closing && !cancelled && nowMillis() - start < SPILL_TIMEOUT_MS) {
val started = nowMillis() - start >= PAGE_OUT_START_MS
waiting.removeAll { val ack = ackFile(control, "ack", it); readAck(ack) != null || (started && !ack.exists()) || isGone(it) }
if (waiting.isEmpty()) break
sleep(PAGE_OUT_POLL_MS)
}
var total = 0L
val acks = targets.associateWith { readAck(ackFile(control, "ack", it)) }
val written = targets.filter { record ->
val kb = acks[record]?.coerceAtLeast(0L) ?: 0L
total += kb
kb > 0L
}
// A process that answered 0 paged out to zram instead and has no spill to release. One whose handler
// started (its acknowledgement is there, still empty) may still be writing: it is waited for like a
// spilled one, its acknowledgement kept. One with no acknowledgement may have no handler, or one that has
// not got that far: it is not waited for, but stays asked, so a resume count that cannot be written still
// fails (a late spill waits for any count other than the one it was asked with).
val unanswered = targets.filter { acks[it] == null && ackFile(control, "ack", it).exists() && !isGone(it) }
spillAsked = spillAsked.filterNot { acks[it] == 0L || acks[it] == SPILL_CANCELLED }
spilledTargets = (spilledTargets + written + unanswered).distinct()
spillWritten = (spillWritten + written).distinct()
pagedOutTargets = (pagedOutTargets + targets.filter { acks[it] == 0L }).distinct()
targets.filterNot { it in unanswered }.forEach { ackFile(control, "ack", it).delete() }
spilled(written.size, total, memoryKb(targets).first, nowMillis() - start)
}
// Its memory is back, it paged out to zram after all (an answer of 0 that came late), a resume cancelled
// it before it wrote anything, or it is gone.
private fun settled(control: File, record: ProcessRecord): Boolean {
val ack = readAck(ackFile(control, "ack", record))
return readAck(ackFile(control, "restored", record)) != null || ack == 0L || ack == SPILL_CANCELLED ||
ended(record)
}
// Gone, or every thread has exited and only an unreaped zombie is left.
private fun ended(record: ProcessRecord): Boolean {
if (isGone(record)) return true
val tasks = File(procRoot, "${record.pid}/task").listFiles()?.filter { it.name.toIntOrNull() != null } ?: return false
return tasks.all { entry ->
try { readStat(File(entry, "stat"))[0].first().let { it == 'Z' || it == 'X' } } catch (_: IOException) { false }
}
}
// Settled targets stop being tracked; one that fell back to zram late is read back like any paged-out one.
private fun release(control: File, settledTargets: List<ProcessRecord>) {
val lateZram = settledTargets.filter { readAck(ackFile(control, "ack", it)) == 0L && !isGone(it) }
pagedOutTargets = (pagedOutTargets + lateZram).distinct()
spillAsked = spillAsked.filterNot { it in settledTargets }
spillWritten = spillWritten.filterNot { it in settledTargets }
settledTargets.forEach {
ackFile(control, "restored", it).delete()
ackFile(control, "ack", it).delete()
}
}
private fun resumeFile(control: File) = File(control.parentFile, "${control.name}.resume")
private fun resumeCount(control: File): Long = try {
resumeFile(control).takeIf { it.isFile }?.readText()?.trim()?.toLongOrNull() ?: 0L
} catch (_: IOException) {
0L
}
// False when a process asked to spill may not have seen the new count: it would stay stopped. The count is
// put in place whole, so a failed write leaves the one before.
private fun bumpResume(): Boolean {
val control = zramControl?.takeIf { it.isFile } ?: return spillAsked.isEmpty()
// A late answer of 0 or a cancellation already let its process go: it needs no count.
val answered = spillAsked.filter {
val ack = readAck(ackFile(control, "ack", it))
ack == 0L || ack == SPILL_CANCELLED
}
if (answered.isNotEmpty()) {
answeredLate = (answeredLate + answered).distinct()
spilledTargets = spilledTargets.filterNot { it in answered }
release(control, answered)
}
val counter = resumeFile(control)
val ok = try {
val next = resumeCount(control) + 1
val fresh = File(counter.parentFile, "${counter.name}.new")
fresh.writeText(next.toString())
java.nio.file.Files.move(fresh.toPath(), counter.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING,
java.nio.file.StandardCopyOption.ATOMIC_MOVE)
resumeCount(control) == next
} catch (_: IOException) {
false
}
if (ok) spillAsked = emptyList()
return ok || spillAsked.isEmpty()
}
// True when every spilled process has its memory back (or was gone already). Ones still reading stay
// tracked, so a later resume waits for them again. One of [running] that ends without its memory back fails
// this resume.
private fun awaitRestored(running: Collection<ProcessRecord> = emptyList(), whileClosing: Boolean = false): Boolean {
val control = zramControl ?: return true
val targets = spilledTargets
val start = nowMillis()
val waiting = targets.toMutableList()
val untraced = HashMap<ProcessRecord, Long>()
val releasedWithoutMarker = HashSet<ProcessRecord>()
try {
while (targets.isNotEmpty() && (whileClosing || !closing) && nowMillis() - start < RESTORE_TIMEOUT_MS) {
waiting.removeAll {
settled(control, it) || detached(control, it, untraced).also { done -> if (done) releasedWithoutMarker += it }
}
if (waiting.isEmpty()) break
sleep(PAGE_OUT_POLL_MS)
}
} catch (_: InterruptedException) {
Thread.currentThread().interrupt()
}
val lost = (running + adopted).distinct().filterNot { it in answeredLate || it in releasedWithoutMarker }.filter { record ->
val ack = readAck(ackFile(control, "ack", record))
ended(record) && readAck(ackFile(control, "restored", record)) == null && ack != 0L && ack != SPILL_CANCELLED
}
adopted = emptyList()
answeredLate = emptyList()
if (lost.isNotEmpty()) guestLost = true
if (targets.isNotEmpty()) {
release(control, targets.filterNot { it in waiting })
spilledTargets = waiting.toList()
restored(targets.size, waiting.size, memoryKb(targets).first, nowMillis() - start)
}
return waiting.isEmpty() && lost.isEmpty()
}
// A process that wrote its spill is traced by its helper until the read-back ends; one that stays untraced
// and alive for a while has its memory back even if the helper could not write its marker (a helper that
// dies first has its owner killed).
private fun detached(control: File, record: ProcessRecord, untraced: MutableMap<ProcessRecord, Long>): Boolean {
if (record !in spillWritten && (readAck(ackFile(control, "ack", record)) ?: 0L) <= 0L) return false
// The helper detaches thread by thread, so every live thread must be out of its trace.
val current = try { readProcess(record.pid) } catch (_: IOException) { null }
if (current == null || current.started != record.started || ended(record) || anyThreadTraced(record)) {
untraced.remove(record)
return false
}
return nowMillis() - untraced.getOrPut(record) { nowMillis() } >= MARKER_GRACE_MS
}
private fun anyThreadTraced(record: ProcessRecord): Boolean {
val tasks = File(procRoot, "${record.pid}/task").listFiles() ?: return true
return tasks.any { entry ->
entry.name.toIntOrNull() != null && try {
File(entry, "status").useLines { lines ->
lines.firstOrNull { it.startsWith("TracerPid:") }?.substringAfter(':')?.trim()?.toIntOrNull() != 0
}
} catch (_: IOException) {
false
File(entry, "stat").exists()
}
}
}
// Asked, started or written spills of processes alive now: one that ends without its memory back (or a 0 or
// cancelled answer) is lost.
private fun startedAlive(): List<ProcessRecord> {
val control = zramControl ?: return emptyList()
return (spilledTargets + spillAsked).distinct().filter {
val ack = readAck(ackFile(control, "ack", it))
ack != 0L && ack != SPILL_CANCELLED && !ended(it)
}
}
private fun pageOut(control: File, records: MutableMap<Pair<Int, Long>, ProcessRecord>, root: Int, helpers: List<Int>) {
addSnapshot(records, root, helpers)
val targets = preloaded(records.values)
if (targets.isEmpty()) return
pagedOutTargets = (pagedOutTargets + targets).distinct()
val acks = targets.associateWith { File(control.parentFile, "${control.name}.ack.${it.pid}") }
@@ -325,7 +568,8 @@ internal class SessionSuspendController(
false
}
private fun readBack() {
private fun readBack(waitForRestore: Boolean = true) {
if (waitForRestore) awaitRestored()
val targets = pagedOutTargets.filterNot { isGone(it) }
pagedOutTargets = emptyList()
val control = zramControl?.takeIf { it.isFile } ?: return
@@ -411,10 +655,12 @@ internal class SessionSuspendController(
private fun stopThreads(record: ProcessRecord) {
val current = try { readProcess(record.pid) } catch (_: Exception) { return }
if (current == null || current.started != record.started) return
// A spill helper's tracing stop ends when it detaches after reading back: the pending SIGSTOP holds then.
val helperHeld = record in spilledTargets
for (entry in File(procRoot, "${record.pid}/task").listFiles().orEmpty()) {
val tid = entry.name.toIntOrNull() ?: continue
val state = try { readStat(File(entry, "stat"))[0].first() } catch (_: IOException) { continue }
if (state == 'T' || state == 't' || state == 'Z' || state == 'X') continue
if (state == 'T' || (state == 't' && !helperHeld) || state == 'Z' || state == 'X') continue
try {
threadSignal(record.pid, tid, SIGSTOP)
} catch (_: Throwable) {
@@ -431,6 +677,10 @@ internal class SessionSuspendController(
Role.HELPER_CHILD -> 3
}
}
val asked = spillAsked
counterUnpublished = !bumpResume()
if (counterUnpublished) return false
adoptStartedSpills(asked)
for (record in ordered) send(record, SIGCONT)
val waiting = ordered.toMutableList()
repeat(RESTORE_CHECKS) { check ->
@@ -442,6 +692,15 @@ internal class SessionSuspendController(
return false
}
// A handler that started after the spill wait ended parks its process until it has read back, like one
// that answered in time.
private fun adoptStartedSpills(asked: List<ProcessRecord>) {
val control = zramControl ?: return
val started = asked.filter { it !in spilledTargets && ackFile(control, "ack", it).exists() && !ended(it) }
if (started.isNotEmpty()) spilledTargets = spilledTargets + started
adopted = started
}
private fun restoreSafely(records: List<ProcessRecord>): Boolean = try {
restore(records)
} catch (_: InterruptedException) {
@@ -460,10 +719,12 @@ internal class SessionSuspendController(
}
}
// A spilled process's threads stay in a tracing stop until its helper has read its memory back.
private fun isRunningOrGone(record: ProcessRecord): Boolean {
val current = try { readProcess(record.pid) } catch (_: Exception) { return false }
if (current == null || current.started != record.started) return true
if (current.state == 'T' || current.state == 't') return false
val spilled = record in spilledTargets
if (current.state == 'T' || (current.state == 't' && !spilled)) return false
return File(procRoot, "${record.pid}/task").listFiles().orEmpty().none { entry ->
entry.name.toIntOrNull() != null &&
try { readStat(File(entry, "stat"))[0].first() == 'T' } catch (_: IOException) { false }
@@ -477,6 +738,11 @@ internal class SessionSuspendController(
const val PAGE_OUT_ACK = "1"
const val PAGE_OUT_REQUEST = "1"
const val READ_BACK_REQUEST = "0"
const val SPILL_REQUEST = "4"
const val SPILL_CANCELLED = -2L
const val SPILL_TIMEOUT_MS = 30_000L
const val RESTORE_TIMEOUT_MS = 30_000L
const val MARKER_GRACE_MS = 1_000L
const val PAGE_OUT_POLL_MS = 100L
const val PAGE_OUT_START_MS = 2_000L
const val PAGE_OUT_TIMEOUT_MS = 12_000L
@@ -1,6 +1,12 @@
package com.droiddeck.launcher.session
internal object SessionVisibilityPolicy {
fun shouldCloseSecondScreenOnStop(
screenOff: Boolean,
dockedDrawerOpen: Boolean,
attachmentPickerOpen: Boolean,
): Boolean = !screenOff && !(dockedDrawerOpen && attachmentPickerOpen)
fun isHidden(
activityStarted: Boolean,
defaultDisplayOn: Boolean,
@@ -0,0 +1,29 @@
package com.droiddeck.launcher.session
// Paced resume retries for a session that is still held after a failed suspend or resume.
internal class SuspendRecovery(
private val maxAttempts: Int = 5,
private val firstDelayMs: Long = 5_000L,
) {
private var attempts = 0
private var nextAt = 0L
fun due(now: Long): Boolean = attempts < maxAttempts && now >= nextAt
// Whether a session that is still held must wait instead of starting another resume now.
fun holds(held: Boolean, now: Long): Boolean = held && !due(now)
// The delay before the next attempt is due, or null when no attempt is left.
fun failed(now: Long): Long? {
attempts++
if (attempts >= maxAttempts) return null
val delay = firstDelayMs shl (attempts - 1)
nextAt = now + delay
return delay
}
fun reset() {
attempts = 0
nextAt = 0L
}
}
@@ -1,444 +0,0 @@
package com.droiddeck.launcher.session
import android.content.Context
import android.os.Environment
import android.util.Log
import com.droiddeck.launcher.core.AddonPack
import com.droiddeck.launcher.core.Downloader
import com.droiddeck.launcher.core.GameEnvironment
import com.droiddeck.launcher.core.GameUpscaler
import com.droiddeck.launcher.gpu.SocNames
import com.droiddeck.launcher.runtime.LinuxRuntime
import java.io.File
import java.security.MessageDigest
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
/**
* The in-game upscaler's files on the device (see [GameUpscaler]):
* - the bridge DLLs, built from tools/upscale/bridges, come in the "upscale" add-on pack;
* - the Vulkan layer is in the APK (bionic games) and in the Linux runtime (PRoot games);
* - the parts with no source to build from (AMD's FSR 4 SPIR-V and weights, Intel's XeSS 3 runtime, Qualcomm's
* QNN libraries for the Hexagon NPU) are fetched from Winlator-NeuralScale at a pinned commit and checked against
* the SHA-256 listed here, or copied from a folder of the same files under Download.
* Everything lands under [GUEST_ROOT] in the rootfs, where both PRoot and bionic games read it.
*/
object UpscaleComponent {
private const val TAG = "UpscaleComponent"
const val UPSTREAM = "michaelisomer-cyber/Winlator-NeuralScale"
const val UPSTREAM_COMMIT = "71c140d9e5586f659251c3ebc602f2d21923655c"
const val XESS_COMMIT = "a0ab6b0f770e1a6786b4e68def46b4edb8baafd0"
const val GUEST_ROOT = "/usr/local/lib/droiddeck-upscale"
const val GUEST_RUN = "/run/droiddeck-hud/upscale"
private const val LOCAL_COPY = "droiddeck-upscale"
private const val LAYER_LIBRARY = "libVkLayer_droiddeck_upscale.so"
private const val BRIDGES_STAMP = ".pack"
enum class Group { CORE, XESS, NPU }
data class DataFile(
val group: Group, val relative: String, val upstreamPath: String, val sha256: String, val size: Long,
val commit: String = UPSTREAM_COMMIT,
) {
val url get() = "https://raw.githubusercontent.com/$UPSTREAM/$commit/$upstreamPath"
}
val FILES = listOf(
DataFile(Group.CORE, "fsr4/fsr3_accumulate.spv", "app/src/main/assets/fsr4/fsr3_accumulate.spv", "98054410f4d3b6fad3020b174982a5e68d2fc5a4d546a90f9e13ea646b32c180", 23840L),
DataFile(Group.CORE, "fsr4/fsr3_prepare.spv", "app/src/main/assets/fsr4/fsr3_prepare.spv", "86e99b0e7e83e74729b016c3089deafdc9c2dc09b27305d009a8942dd0fe19da", 15036L),
DataFile(Group.CORE, "fsr4/fsr3_rcas.spv", "app/src/main/assets/fsr4/fsr3_rcas.spv", "13e276049ecc18eb7b53f6de1f76f58eb1a60c6f4251870f3647b20478b05710", 11644L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/fsr411_full_zc_i8.wpack", "app/src/main/assets/fsr4/fsr411_full/performance/fsr411_full_zc_i8.wpack", "8d36bb959d23ede5bb409959736c0d0b718bae58b363779126c0235b0fd10f7c", 137424L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/fsr411_full_zc_s8.wpack", "app/src/main/assets/fsr4/fsr411_full/performance/fsr411_full_zc_s8.wpack", "ef445437e3d48c64f993a60407183f675d05aadd82c7c29b93e61c53308ab28e", 137256L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/initializers.bin", "app/src/main/assets/fsr4/fsr411_full/performance/initializers.bin", "a54e552ff69a3f7199861417f7ae461d1f67f636ab532c6ec9d8ea5d2963735a", 131072L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-00.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-00.spv", "d6a01100a56327713d2f7c1a768e41f8a31f2cadce5f37b7dac81630722ff5a2", 33116L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-01.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-01.spv", "759396dc2eccd731bebac13e8818568c8cc410150d24ed4cc01aa8b5ea873fbb", 58172L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-02.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-02.spv", "bdabc7c28f18c31ac8574856a386a268ae4d866f68a65e72b59bf3bad2235132", 3208L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-03.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-03.spv", "bcb4d1d01e33114c68bb13059577c280bb05b5a3af7218fdbc38e99883e0632d", 108840L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-04.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-04.spv", "d85b605d066d89178994ba835b6c3b267ed771de530117a5b9e6103d49e866e7", 3244L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-05.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-05.spv", "e44f0ccd272e4a85ad38894a38db7adae019d18660b166e6c28e82b328d7cc84", 109048L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-06.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-06.spv", "df469b6481234bf7b964a7c0ecf8a5829d84d1bc34fdb7c72e87014f82e31326", 3208L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-07.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-07.spv", "a873b766b2b8923aeb7d325a61cbea251cbac6450e708a23a7714c553ce577ff", 132572L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-08.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-08.spv", "c4aba5b9cd11100308aa2e3d8a4d39e66713c46c35edbe6496552764459a2228", 3580L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-09.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-09.spv", "d757fd28efbd09259f82918de5d3765784933d5b26eea56babe45fd6fefc5cfa", 190032L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-10.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-10.spv", "295873b3ecbd9db40cc4c50ecf15a72964d5846b96642d2e4743a9333382b557", 3580L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-11.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-11.spv", "73e05c6727408d5b1f472112c5d68060e9db9aaf918e892055e6619d5f0e4edc", 190032L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-12.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-12.spv", "007315c42072370919ac393b63a04a0ac025a802f927b490a6749bd6034c15fd", 3596L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-13.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-13.spv", "020929f63d8a70f90bd628a92c50b4049db89155d5e062bf03eb1e8cb8ee7c60", 497604L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-14.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-14.spv", "f26dc72bbe9ccc70e2cc2dc1f4b2a868baf3c2e470b4e76994f98c50674ec3d8", 4268L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-15.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-15.spv", "9487c52cec7e259f4cb212335e84db43c52902b4e3243afcd34305b95ad1b83b", 79128L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-16.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-16.spv", "55c48a8b7627343d996f7818ee6055e143d3b956b8f65911d6b6c337bd8f72ca", 4268L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-17.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-17.spv", "810636645f52d5b8c019206deb046e954af730fc13edaa6a00ebf66e686c3ac0", 79128L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-18.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-18.spv", "a3d130ad8fc6438766f3cdeb7e062d03291a25f6a5e439f71b905795cfc856ec", 4268L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-19.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-19.spv", "e1b576f7e8cedc46615a90f5d2026a43a525a2e43cfc66b62def8e700f55688a", 84476L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-20.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-20.spv", "70c2b7b4e55d665591b2dca3efddb6e99e6d393020722cec635fb8df3bd81bf1", 3596L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-21.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-21.spv", "bb1798794d6c8b0ad3760059bf36e2c396594226c0835202040a4a515a8beb01", 189952L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-22.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-22.spv", "b0545fc4c1886fa0a6252029eb6e3a2f999974bc0bc89539c8d6005c184d8a6f", 3580L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-23.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-23.spv", "e9aee05cec78f0659fa570bfc0f495a51d00d2bc80c4e99cde4106a3df51c35e", 61308L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-24.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-24.spv", "1e93b681a9264afc07f0ab41086474b3afaa2ff8d37b5b75c9ceae005e21e558", 3260L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-25.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-25.spv", "6292dd68a4da9370c7dabb3b192fe6958b1a12daffd92b7fa80ed6fe231e1e5d", 109064L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-26.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-26.spv", "abc2426ff739d25cba4d271cad08ec9f25056ae197a9727b7b7e72467ba49d28", 3224L),
DataFile(Group.CORE, "fsr4/fsr411_full/performance/pass-27.spv", "app/src/main/assets/fsr4/fsr411_full/performance/pass-27.spv", "fa5fc1de4625915c25a637b091f26f32c398f4985a14392a48505cfac111aaea", 125196L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/initializers.bin", "app/src/main/assets/fsr4/fsr411_full/quality/initializers.bin", "a54e552ff69a3f7199861417f7ae461d1f67f636ab532c6ec9d8ea5d2963735a", 131072L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-00.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-00.spv", "d6a01100a56327713d2f7c1a768e41f8a31f2cadce5f37b7dac81630722ff5a2", 33116L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-01.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-01.spv", "759396dc2eccd731bebac13e8818568c8cc410150d24ed4cc01aa8b5ea873fbb", 58172L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-02.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-02.spv", "bdabc7c28f18c31ac8574856a386a268ae4d866f68a65e72b59bf3bad2235132", 3208L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-03.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-03.spv", "bcb4d1d01e33114c68bb13059577c280bb05b5a3af7218fdbc38e99883e0632d", 108840L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-04.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-04.spv", "d85b605d066d89178994ba835b6c3b267ed771de530117a5b9e6103d49e866e7", 3244L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-05.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-05.spv", "e44f0ccd272e4a85ad38894a38db7adae019d18660b166e6c28e82b328d7cc84", 109048L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-06.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-06.spv", "df469b6481234bf7b964a7c0ecf8a5829d84d1bc34fdb7c72e87014f82e31326", 3208L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-07.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-07.spv", "a873b766b2b8923aeb7d325a61cbea251cbac6450e708a23a7714c553ce577ff", 132572L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-08.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-08.spv", "c4aba5b9cd11100308aa2e3d8a4d39e66713c46c35edbe6496552764459a2228", 3580L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-09.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-09.spv", "d757fd28efbd09259f82918de5d3765784933d5b26eea56babe45fd6fefc5cfa", 190032L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-10.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-10.spv", "295873b3ecbd9db40cc4c50ecf15a72964d5846b96642d2e4743a9333382b557", 3580L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-11.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-11.spv", "73e05c6727408d5b1f472112c5d68060e9db9aaf918e892055e6619d5f0e4edc", 190032L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-12.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-12.spv", "007315c42072370919ac393b63a04a0ac025a802f927b490a6749bd6034c15fd", 3596L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-13.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-13.spv", "020929f63d8a70f90bd628a92c50b4049db89155d5e062bf03eb1e8cb8ee7c60", 497604L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-14.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-14.spv", "f26dc72bbe9ccc70e2cc2dc1f4b2a868baf3c2e470b4e76994f98c50674ec3d8", 4268L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-15.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-15.spv", "9487c52cec7e259f4cb212335e84db43c52902b4e3243afcd34305b95ad1b83b", 79128L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-16.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-16.spv", "55c48a8b7627343d996f7818ee6055e143d3b956b8f65911d6b6c337bd8f72ca", 4268L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-17.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-17.spv", "810636645f52d5b8c019206deb046e954af730fc13edaa6a00ebf66e686c3ac0", 79128L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-18.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-18.spv", "a3d130ad8fc6438766f3cdeb7e062d03291a25f6a5e439f71b905795cfc856ec", 4268L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-19.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-19.spv", "e1b576f7e8cedc46615a90f5d2026a43a525a2e43cfc66b62def8e700f55688a", 84476L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-20.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-20.spv", "70c2b7b4e55d665591b2dca3efddb6e99e6d393020722cec635fb8df3bd81bf1", 3596L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-21.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-21.spv", "bb1798794d6c8b0ad3760059bf36e2c396594226c0835202040a4a515a8beb01", 189952L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-22.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-22.spv", "b0545fc4c1886fa0a6252029eb6e3a2f999974bc0bc89539c8d6005c184d8a6f", 3580L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-23.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-23.spv", "e9aee05cec78f0659fa570bfc0f495a51d00d2bc80c4e99cde4106a3df51c35e", 61308L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-24.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-24.spv", "1e93b681a9264afc07f0ab41086474b3afaa2ff8d37b5b75c9ceae005e21e558", 3260L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-25.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-25.spv", "6292dd68a4da9370c7dabb3b192fe6958b1a12daffd92b7fa80ed6fe231e1e5d", 109064L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-26.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-26.spv", "abc2426ff739d25cba4d271cad08ec9f25056ae197a9727b7b7e72467ba49d28", 3224L),
DataFile(Group.CORE, "fsr4/fsr411_full/quality/pass-27.spv", "app/src/main/assets/fsr4/fsr411_full/quality/pass-27.spv", "fa5fc1de4625915c25a637b091f26f32c398f4985a14392a48505cfac111aaea", 125196L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0000.spv", "app/src/main/assets/fsr4/fsr412_lite/0000.spv", "2ec08c00ba47d5812078073c68622101158762b2e885ae965afee39596243840", 97808L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0001.spv", "app/src/main/assets/fsr4/fsr412_lite/0001.spv", "ff1270ab046cd190e9edf0d76cc5d5fda34a27a2de719e8352b4dcaeeed3e3bb", 3456L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0002.spv", "app/src/main/assets/fsr4/fsr412_lite/0002.spv", "c47c6282830916e9314f0153c4abd782736b6cee3992e8db301937b42ec44141", 120964L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0003.spv", "app/src/main/assets/fsr4/fsr412_lite/0003.spv", "0797d2053df579930c2907a3f1e91c8a39c44cae4e471eca4c243075a787d572", 3492L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0004.spv", "app/src/main/assets/fsr4/fsr412_lite/0004.spv", "e7d3651fb730c8b543aaae332f760d352d555e3f8e5899c055b46fc007c80bbc", 3928L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0005.spv", "app/src/main/assets/fsr4/fsr412_lite/0005.spv", "0bacdbf39bead28f5012ca09a6d8243e501b3328065e29c2b5bdfc93f5ae3ffa", 201880L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0006.spv", "app/src/main/assets/fsr4/fsr412_lite/0006.spv", "f58da749701f226994560878cad3b98f01db0557feea4d9445ae84ed6b2049a2", 3892L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0007.spv", "app/src/main/assets/fsr4/fsr412_lite/0007.spv", "c8088556c624f601cb9adf280ba0a4b6fa54068c1f60a0ebc26c11dad81a44c3", 279304L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0008.spv", "app/src/main/assets/fsr4/fsr412_lite/0008.spv", "9e5f48d397020f1fd8706f554adce0adb88641cd06dd054252f1f2f58f1566e5", 3508L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0009.spv", "app/src/main/assets/fsr4/fsr412_lite/0009.spv", "23cc6f3c09546cbca7c70130de931324f9262d13a5f894ebedac78d0e94ef43f", 104052L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0010.spv", "app/src/main/assets/fsr4/fsr412_lite/0010.spv", "a60c0492e22ae608ba9b7e9d479db03ad198a8d9523edb7b65cc0eaef5829a29", 28988L),
DataFile(Group.CORE, "fsr4/fsr412_lite/0013.spv", "app/src/main/assets/fsr4/fsr412_lite/0013.spv", "05bbe60c6a0310044df99f2e7fe6af0b6644780305c98bc6fd6287de7b954cf0", 57232L),
DataFile(Group.CORE, "fsr4/fsr412_lite/fsr412_lite_zc_i8.wpack", "app/src/main/assets/fsr4/fsr412_lite/fsr412_lite_zc_i8.wpack", "5a00ff5e9a444708ce66b17a12fa8ffc2a3bdbd798399a0d26807de121ab2140", 27440L),
DataFile(Group.CORE, "fsr4/fsr412_lite/fsr412_lite_zc_s8.wpack", "app/src/main/assets/fsr4/fsr412_lite/fsr412_lite_zc_s8.wpack", "f45ab49039ad27041ebc6edd76de54d14246693445e53362d94b4a9514ae65a7", 27272L),
DataFile(Group.CORE, "fsr4/fsr412_lite/weights.bin", "app/src/main/assets/fsr4/fsr412_lite/weights.bin", "4b9898da719dc2dca5dc45fd71dec5f80bdb9886a580fe3038af59efe637d55e", 27392L),
DataFile(Group.CORE, "fsr4/sgsr2_activate.spv", "app/src/main/assets/fsr4/sgsr2_activate.spv", "45aabce377d4cc9522ea9d954d9f069e1618ac0c9656ef2be6fd317369ae3140", 13456L),
DataFile(Group.CORE, "fsr4/sgsr2_convert.spv", "app/src/main/assets/fsr4/sgsr2_convert.spv", "71afffb95978f0dc61d3f39f266eb61e5c803b17574a3595726e4c55bb581872", 14600L),
DataFile(Group.CORE, "fsr4/sgsr2_upscale.spv", "app/src/main/assets/fsr4/sgsr2_upscale.spv", "bf7fe1247894919349fef91f8fa41ee256cb58dd7cf87f682db43108f9dcd1ec", 29748L),
// Upstream dropped Intel's XeSS runtime in cb3ae04e (v5.0-r2); DroidDeck keeps fetching it from a0ab6b0f.
DataFile(Group.XESS, "xess/wl_xess_official.dll", "app/src/main/assets/fsr4_bridge/wl_xess_official.dll", "251659dd84a3e84de67c886a4186e01f3eca49b00641906fe38bb6b807e5d5b7", 77795704L, XESS_COMMIT),
DataFile(Group.NPU, "fsr4/adsp/libQnnHtpV79Skel.so", "app/src/main/assets/fsr4/adsp/libQnnHtpV79Skel.so", "974583f0cdc3d42de7a0633c9b987b160ad033a4cd53be30f9b5480b7e5a3213", 11702104L),
DataFile(Group.NPU, "fsr4/adsp/libQnnHtpV81Skel.so", "app/src/main/assets/fsr4/adsp/libQnnHtpV81Skel.so", "a0b9750d900a0afbba240e3506ba63ba91ec0e7f1b3a44de9afbb6818a665a32", 12606648L),
DataFile(Group.NPU, "jni/libQnnHtp.so", "app/src/main/jniLibs/arm64-v8a/libQnnHtp.so", "6e6da5284060ca4369bb6fd3c6f2b661a9cebabb2cf4cf695cd77f558082265f", 3760136L),
DataFile(Group.NPU, "jni/libQnnHtpNetRunExtensions.so", "app/src/main/jniLibs/arm64-v8a/libQnnHtpNetRunExtensions.so", "9776e906cff859504e9e5fd5f9cbb0ec592d9ae6be312ef0650cb95eb8e3aef6", 1383928L),
DataFile(Group.NPU, "jni/libQnnHtpPrepare.so", "app/src/main/jniLibs/arm64-v8a/libQnnHtpPrepare.so", "cd31f94ae79ad402312e75262297d1e1073f85927d95f7905357a10b1d32a263", 87913152L),
DataFile(Group.NPU, "jni/libQnnHtpV79Stub.so", "app/src/main/jniLibs/arm64-v8a/libQnnHtpV79Stub.so", "b3b4cca02e1f2cb5778ef9f18850814358d62a0b90123b25bb2806731a6af8b3", 754480L),
DataFile(Group.NPU, "jni/libQnnHtpV81Stub.so", "app/src/main/jniLibs/arm64-v8a/libQnnHtpV81Stub.so", "16188365d86ef09a9067e8e04b7fa1c604729d1870219b1bbf04ee904e6c3ffa", 777848L),
DataFile(Group.NPU, "jni/libQnnSystem.so", "app/src/main/jniLibs/arm64-v8a/libQnnSystem.so", "4cd077547a939b131c4733391545d64bdc4f9d0c86de78793335ddd18348789e", 4052904L),
)
sealed interface State {
data object Missing : State
data class Downloading(val progress: Float) : State
data object Ready : State
data class Failed(val message: String) : State
}
private val mutableState = MutableStateFlow<State>(State.Missing)
val state: StateFlow<State> = mutableState.asStateFlow()
private val lock = Any()
@Volatile private var busy = false
fun root(context: Context) = File(LinuxRuntime.rootDir(context), GUEST_ROOT.removePrefix("/"))
fun dataDir(context: Context) = File(root(context), "data")
fun bridgesDir(context: Context) = File(root(context), "bridges")
fun runDir(context: Context) = File(LinuxRuntime.rootDir(context), GUEST_RUN.removePrefix("/"))
/** The NPU this phone has: its Hexagon HTP generation and whether its own QNN libraries run it. */
data class Npu(val arch: String, val systemLibs: Boolean)
private val SYSTEM_QNN = listOf("libQnnHtp.so", "libQnnHtpPrepare.so", "libQnnSystem.so")
private val SYSTEM_STUB = Regex("libQnnHtpV(\\d{2,3})Stub\\.so")
/**
* The HTP generation of the phone's own QNN runtime, when the vendor offers it to apps (listed in
* public.libraries.txt): named by its one libQnnHtpV<NN>Stub.so. Null when absent or ambiguous.
*/
internal fun systemNpuArch(libDir: File = File("/vendor/lib64"), publicList: File = File("/vendor/etc/public.libraries.txt")): String? {
val listed = runCatching {
publicList.readLines().map { it.trim() }.filter { it.isNotEmpty() && !it.startsWith("#") }.map { it.substringBefore(' ') }.toSet()
}.getOrNull() ?: return null
if (!SYSTEM_QNN.all { it in listed && File(libDir, it).isFile }) return null
val archs = libDir.list().orEmpty().filter { it in listed }.mapNotNull { SYSTEM_STUB.matchEntire(it)?.groupValues?.get(1) }.distinct()
return archs.singleOrNull()?.let { "v$it" }
}
private val systemNpu: String? by lazy { runCatching { systemNpuArch() }.getOrNull() }
/**
* This phone's NPU, or null. The phone's own QNN runtime first (any HTP generation, nothing to download);
* else the bundled QNN files: v79 on the Snapdragon 8 Elite, v81 on the 8 Elite Gen 5.
*/
fun npu(model: String = SocNames.model()): Npu? {
systemNpu?.let { return Npu(it, systemLibs = true) }
val soc = SocNames.normalizedModel(model)
val arch = when {
soc.startsWith("SM8750") -> "v79"
soc.startsWith("SM8850") || soc.startsWith("SM8845") -> "v81"
else -> null
} ?: return null
val fastrpc = listOf("/dev/fastrpc-cdsp", "/dev/fastrpc-cdsp-secure", "/dev/adsprpc-smd").any { File(it).exists() }
return Npu(arch, systemLibs = false).takeIf { fastrpc }
}
fun npuArch(model: String = SocNames.model()): String? = npu(model)?.arch
fun groups(engine: GameUpscaler.Engine, npu: Boolean = npuArch() != null): Set<Group> = buildSet {
add(Group.CORE)
if (engine == GameUpscaler.Engine.XESS) add(Group.XESS)
if (engine.npu && npu && UpscaleComponent.npu()?.systemLibs != true) add(Group.NPU)
}
/** The bridge DLLs (tools/upscale/bridges/build.sh), each in both Wine PE folders. */
private val BRIDGE_NAMES = listOf(
"_nvngx.dll", "amd_fidelityfx_dx12.dll", "amd_fidelityfx_loader_dx12.dll", "amd_fidelityfx_upscaler_dx12.dll",
"amd_fidelityfx_upscaler_vk.dll", "amd_fidelityfx_vk.dll", "ffx_fsr2_api_x64.dll", "ffx_fsr3upscaler_x64.dll",
"libxess.dll", "nvapi64.dll", "nvngx.dll", "nvngx_dlss.dll",
)
internal val BRIDGE_FILES = listOf("x86_64-windows", "aarch64-windows").flatMap { arch -> BRIDGE_NAMES.map { "$arch/$it" } }
fun filesReady(context: Context, groups: Set<Group>): Boolean =
FILES.filter { it.group in groups }.all { f -> File(dataDir(context), f.relative).let { it.isFile && it.length() == f.size } }
fun bridgesReady(context: Context): Boolean =
BRIDGE_FILES.all { File(bridgesDir(context), it).let { f -> f.isFile && f.length() > 0 } }
/** Everything a game with [groups] needs: the data files and the bridge DLLs. */
fun ready(context: Context, groups: Set<Group>): Boolean = filesReady(context, groups) && bridgesReady(context)
/** Fetches what [groups] still lack (data files, then the bridge DLLs) in the background. */
fun ensure(context: Context, groups: Set<Group>, onDone: (Boolean) -> Unit = {}) {
val app = context.applicationContext
if (ready(app, groups)) {
mutableState.value = State.Ready
onDone(true)
return
}
synchronized(lock) {
if (busy) return
busy = true
}
Thread({
val ok = try {
val files = filesReady(app, groups) || download(app, groups)
// Staged DLLs are refreshed when the pack or local copy changed; a download only when none are staged.
val bridges = files && (if (bridgesReady(app)) stageBridges(app) else fetchBridges(app))
when {
bridges -> mutableState.value = State.Ready
files -> mutableState.value = State.Failed("upscaler DLLs not installed")
}
bridges
} catch (e: Exception) {
Log.w(TAG, "upscaler files not fetched", e)
mutableState.value = State.Failed(e.message ?: e.javaClass.simpleName)
false
} finally {
synchronized(lock) { busy = false }
}
onDone(ok)
}, "upscale-files").start()
}
private fun download(context: Context, groups: Set<Group>): Boolean {
val wanted = FILES.filter { it.group in groups }
val missing = wanted.filter { f -> File(dataDir(context), f.relative).let { !it.isFile || it.length() != f.size } }
val total = missing.sumOf { it.size }.coerceAtLeast(1L)
var done = 0L
mutableState.value = State.Downloading(0f)
for (f in missing) {
val target = File(dataDir(context), f.relative)
target.parentFile?.mkdirs()
val part = File(target.path + ".part")
val ok = copyLocal(context, f, part) || Downloader.downloadFile(f.url, part, true, f.sha256) { p ->
mutableState.value = State.Downloading(((done + p * f.size) / total).coerceIn(0f, 1f))
}
if (!ok || !part.renameTo(target)) {
part.delete()
val reason = Downloader.lastFailure() ?: "could not fetch ${f.relative}"
mutableState.value = State.Failed(reason)
Log.w(TAG, "upscaler file ${f.relative} not fetched: $reason")
return false
}
if (f.group == Group.NPU) {
target.setReadable(true, false)
target.setExecutable(true, false)
}
done += f.size
mutableState.value = State.Downloading((done.toFloat() / total).coerceIn(0f, 1f))
}
Log.i(TAG, "upscaler files ready (${wanted.size} files, groups $groups)")
return true
}
/**
* Folders that may hold a local copy (same layout as the upstream tree): the app's own external
* files folders, readable without any storage permission, then Download/droiddeck-upscale.
*/
@Suppress("DEPRECATION")
private fun localRoots(context: Context): List<File> =
context.getExternalFilesDirs(null).orEmpty().filterNotNull().map { File(it, LOCAL_COPY) } +
File(Environment.getExternalStorageDirectory(), "Download/$LOCAL_COPY")
/** A local copy of [f] (see [localRoots]), used when its SHA-256 matches. */
private fun copyLocal(context: Context, f: DataFile, part: File): Boolean = localRoots(context).any { root ->
runCatching {
val local = File(root, f.relative)
if (!local.isFile || !local.canRead() || local.length() != f.size || sha256(local) != f.sha256) return@runCatching false
local.inputStream().use { input -> part.outputStream().use { output -> input.copyTo(output, 1 shl 20) } }
sha256(part) == f.sha256
}.getOrDefault(false)
}
private fun sha256(file: File): String {
val digest = MessageDigest.getInstance("SHA-256")
file.inputStream().use { input ->
val buffer = ByteArray(1 shl 20)
while (true) {
val n = input.read(buffer)
if (n < 0) break
digest.update(buffer, 0, n)
}
}
return digest.digest().joinToString("") { "%02x".format(it) }
}
/** The add-on pack's bridges/ (fetched now when there is no local copy), staged into the rootfs. */
private fun fetchBridges(context: Context): Boolean {
val pack = AddonPack.UPSCALE
if (!pack.installed(context) && localBridges(context) == null && pack.available) pack.await(context)
return stageBridges(context)
}
/** Content hash of a local bridges/ tree: CI builds every DLL with the same date, and sizes often stay the same. */
internal fun localVersion(source: File): String {
val digest = MessageDigest.getInstance("SHA-256")
for (name in BRIDGE_FILES) {
digest.update(name.toByteArray())
digest.update(sha256(File(source, name)).toByteArray())
}
return digest.digest().take(8).joinToString("") { "%02x".format(it) }
}
/** A complete, readable bridges/ tree in one of [localRoots]: builds without a published pack. */
private fun localBridges(context: Context): File? = localRoots(context).map { File(it, "bridges") }.firstOrNull { dir ->
runCatching { BRIDGE_FILES.all { File(dir, it).let { f -> f.isFile && f.canRead() && f.length() > 0 } } }.getOrDefault(false)
}
/**
* Copies the bridge DLLs from the add-on pack (or the local tree) into the rootfs, once per version. True only
* when every one of [BRIDGE_FILES] is in place afterwards.
*/
@Synchronized
fun stageBridges(context: Context): Boolean {
val packDir = AddonPack.UPSCALE.takeIf { it.installed(context) }?.dir(context)
val pack = packDir?.let { File(it, "bridges") }
val source = pack?.takeIf { dir -> BRIDGE_FILES.all { File(dir, it).isFile } } ?: localBridges(context)
if (source == null) {
val ready = bridgesReady(context)
if (!ready) Log.w(TAG, "upscaler bridges: no add-on pack and no readable local copy")
return ready
}
val version = if (packDir != null && source == pack) packDir.name else "local-" + localVersion(source)
val target = bridgesDir(context)
val stamp = File(target, BRIDGES_STAMP)
if (bridgesReady(context) && runCatching { stamp.readText() }.getOrNull() == version) return true
var copied = 0
for (name in BRIDGE_FILES) {
val from = File(source, name)
val out = File(target, name)
out.parentFile?.mkdirs()
val staged = File(out.path + ".staged")
val ok = runCatching {
from.inputStream().use { input -> staged.outputStream().use { output -> input.copyTo(output) } }
staged.length() == from.length() && staged.renameTo(out)
}.getOrDefault(false)
staged.delete()
if (ok) copied++ else Log.w(TAG, "upscaler bridge $name not staged from $source")
}
val ok = copied == BRIDGE_FILES.size && bridgesReady(context)
if (ok) runCatching { stamp.writeText(version) }
Log.i(TAG, "upscaler bridges staged from $version: $copied/${BRIDGE_FILES.size} files")
return ok
}
/** The bionic layer's manifest (the layer itself is the APK's native library). */
fun bionicLayerDir(context: Context): File {
val dir = File(context.filesDir, "upscale/layer")
val library = File(context.applicationInfo.nativeLibraryDir, LAYER_LIBRARY)
val manifest = """{
"file_format_version": "1.0.0",
"layer": {
"name": "VK_LAYER_DROIDDECK_upscale",
"type": "GLOBAL",
"library_path": "${library.absolutePath}",
"api_version": "1.3.275",
"implementation_version": "1",
"description": "DroidDeck in-game upscaler (FSR 4, XeSS 3, Hexagon NPU)",
"enable_environment": { "DROIDDECK_UPSCALE": "1" },
"disable_environment": { "DROIDDECK_UPSCALE_DISABLE": "1" }
}
}
"""
runCatching {
dir.mkdirs()
val file = File(dir, "VK_LAYER_DROIDDECK_upscale.json")
if (!file.isFile || file.readText() != manifest) file.writeText(manifest)
}.onFailure { Log.w(TAG, "could not write the upscaler layer manifest", it) }
return dir
}
/** Session-wide guest variables: whether NPU engines can run here (and its HTP generation), and the bionic layer's manifest folder. */
fun guestEnv(context: Context): List<String> {
runCatching { runDir(context).mkdirs() }
val here = npu()
return listOfNotNull(
"DROIDDECK_UPSCALE_NPU=" + (if (here != null) "1" else "0"),
here?.let { "DROIDDECK_UPSCALE_HTP_ARCH=${it.arch}" },
"DROIDDECK_UPSCALE_LAYER=" + bionicLayerDir(context).absolutePath,
)
}
/** Fetches what the games set to use the upscaler need, at session start. */
fun prepare(context: Context) {
val config = runCatching { GameEnvironmentStore.read(context) }.getOrNull() ?: return
val choices = config.games.keys.mapNotNull { GameUpscaler.choice(config, it) }
if (choices.isEmpty()) return
// Runs on the session-start thread, before the game copies the DLLs: ensure() returns at once when DLLs are
// staged, so a newer pack or local copy is staged here.
if (bridgesReady(context)) runCatching { stageBridges(context) }.onFailure { Log.w(TAG, "upscaler DLLs not refreshed", it) }
val npu = npuArch() != null
ensure(context, choices.flatMap { groups(it.engine, npu) }.toSet())
}
/** Live switch while a game runs: the layer polls this file (fsr4_layer.c read_live_ctrl). */
fun writeControl(context: Context, engine: GameUpscaler.Engine, sharpness: Int, npuSync: Boolean, enabled: Boolean = true) {
runCatching {
val dir = runDir(context).apply { mkdirs() }
val ctrl = File(dir, "ctrl")
val staged = File(dir, "ctrl.tmp")
val effective = GameUpscaler.effectiveEngine(engine, npuArch() != null)
staged.writeText(GameUpscaler.controlText(effective, sharpness, npuSync, enabled))
staged.renameTo(ctrl)
}.onFailure { Log.w(TAG, "could not write the upscaler control file", it) }
}
/** What the layer reports, if it wrote in the last few seconds. */
fun status(context: Context, nowMs: Long = System.currentTimeMillis()): GameUpscaler.Status? {
val file = File(runDir(context), "status")
if (!file.isFile || nowMs - file.lastModified() > 5000) return null
return runCatching { GameUpscaler.parseStatus(file.readText()) }.getOrNull()
}
fun anyGame(config: GameEnvironment.Config): Boolean = config.games.keys.any { GameUpscaler.choice(config, it) != null }
}
@@ -5,7 +5,9 @@ import android.content.ContextWrapper
import android.os.Build
import android.view.KeyEvent
import android.view.WindowManager
import androidx.activity.compose.BackHandler
import androidx.activity.compose.LocalActivityResultRegistryOwner
import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.expandVertically
@@ -50,12 +52,12 @@ import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Send
import androidx.compose.material.icons.outlined.Extension
import androidx.compose.material.icons.outlined.PhotoCamera
import androidx.compose.material.icons.outlined.MicOff
import androidx.compose.material.icons.outlined.Mic
import androidx.compose.material.icons.outlined.Add
import androidx.compose.material.icons.outlined.ArrowDownward
import androidx.compose.material.icons.outlined.AttachFile
import androidx.compose.material.icons.outlined.Keyboard
import androidx.compose.material.icons.outlined.Terminal
import androidx.compose.material.icons.outlined.Build
import androidx.compose.material.icons.outlined.Close
@@ -79,6 +81,7 @@ import androidx.compose.runtime.MutableState
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateMapOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -108,6 +111,7 @@ import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.platform.testTag
@@ -301,7 +305,7 @@ private fun AgentPageContent(
readingBack = false
scope.launch { list.scrollToItem(maxOf(0, list.layoutInfo.totalItemsCount - 1), Int.MAX_VALUE / 2) }
}
val hidden = !composer.focused && !composer.hasUnconsumedFocusRequest() && readingBack && AgentHost.entries.isNotEmpty() &&
val hidden = !composer.focused && !composer.tray && !composer.hasUnconsumedFocusRequest() && readingBack && AgentHost.entries.isNotEmpty() &&
AgentHost.approvals.isEmpty()
var listHeight by remember { mutableIntStateOf(0) }
Box(
@@ -319,6 +323,7 @@ private fun AgentPageContent(
awaitEachGesture {
awaitFirstDown(requireUnconsumed = false, pass = PointerEventPass.Initial)
if (panel == AgentPanel.MODEL || panel == AgentPanel.USAGE) panel = AgentPanel.NONE
composer.tray = false
// Forced: the unforced path walks the focus chain and throws ("ActiveParent with no focused child") when a tap lands while focus is moving.
if (composer.focused) focusManager.clearFocus(force = true)
}
@@ -344,6 +349,12 @@ private fun AgentPageContent(
@Stable
private class ComposerState {
var focused by mutableStateOf(false)
/** The photo tray stands in for the keyboard, at the height the keyboard last had. */
var tray by mutableStateOf(false)
var keyboardHeight by mutableStateOf(0.dp)
/** Tray photos copied, or being copied, for this conversation, so reopening the tray keeps their marks and copies nothing twice. */
val photoCopies = mutableStateMapOf<android.net.Uri, String>()
val photosCopying = mutableStateMapOf<android.net.Uri, Any>()
var focusRequests by mutableIntStateOf(0)
private set
private var consumedFocusRequests by mutableIntStateOf(0)
@@ -390,7 +401,7 @@ private fun ModelChip(panel: AgentPanel, onPanel: (AgentPanel) -> Unit, firstCon
.clickable { onPanel(AgentPanel.MODEL) }.padding(horizontal = 8.dp).testTag("agent-model"),
) {
val mode = AgentHost.harness.permissions.drop(1).firstOrNull { it.id == AgentHost.permission }?.let { stringResource(it.label) }
val parts = if (compact) listOfNotNull(mode ?: model)
val parts = if (compact) listOf(model)
else listOfNotNull(
AgentHost.harness.name, model, AgentHost.effort, mode,
stringResource(R.string.agent_plan_short).takeIf { AgentHost.plan && AgentHost.harness.plans },
@@ -748,6 +759,8 @@ private fun AgentComposer(
if (text.isEmpty() && AgentAttachments.pending.isEmpty()) return@send
AgentHost.send(context, text, AgentAttachments.pending.toList())
AgentAttachments.pending.clear()
composer.photosCopying.clear()
composer.tray = false
onSent()
}
}
@@ -813,7 +826,34 @@ private fun AgentEditor(composer: ComposerState, draftState: MutableState<String
var focused by remember { mutableStateOf(false) }
val field = remember { FocusRequester() }
LaunchedEffect(composer.focusRequests) { if (composer.hasUnconsumedFocusRequest()) runCatching { field.requestFocus() } }
val attach = LocalActivityResultRegistryOwner.current != null
val picks = LocalActivityResultRegistryOwner.current != null
val density = LocalDensity.current
val imeHeight = WindowInsets.ime.getBottom(density)
LaunchedEffect(imeHeight) {
val height = with(density) { imeHeight.toDp() }
if (height > composer.keyboardHeight) composer.keyboardHeight = height
}
LaunchedEffect(hideAttach) { if (hideAttach) composer.tray = false }
LaunchedEffect(AgentHost.chat) {
composer.photoCopies.clear()
composer.photosCopying.clear()
}
// BackHandler throws where the host provides no back dispatcher: the front end and the floating pet.
if (LocalOnBackPressedDispatcherOwner.current != null) BackHandler(composer.tray) { composer.tray = false }
val focusManager = LocalFocusManager.current
val files = if (picks) rememberLauncherForActivityResult(ActivityResultContracts.OpenMultipleDocuments()) {
AgentAttachments.picking = false
attachUris(context, it)
} else null
val toggleTray = {
if (composer.tray) {
composer.tray = false
composer.open()
} else {
focusManager.clearFocus(force = true)
composer.tray = true
}
}
BoxWithConstraints(
Modifier.fillMaxWidth().padding(top = 8.dp).clip(Shape16).background(colors.surface)
.border(if (focused) 2.dp else 1.dp, if (focused) pal.primary else pal.line, Shape16).padding(6.dp),
@@ -841,6 +881,7 @@ private fun AgentEditor(composer: ComposerState, draftState: MutableState<String
Modifier.fillMaxWidth().focusRequester(field).onFocusChanged {
focused = it.isFocused
composer.focused = it.isFocused
if (it.isFocused) composer.tray = false
if (it.isFocused) composer.consumeFocusRequest()
}.testTag("agent-input"),
textStyle = TextStyle(fontSize = 16.sp, color = colors.onSurface),
@@ -866,19 +907,22 @@ private fun AgentEditor(composer: ComposerState, draftState: MutableState<String
if (stacked) Column {
text(Modifier.fillMaxWidth())
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
AnimatedVisibility(attach && !hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { AttachButton() }
AnimatedVisibility(AgentAttachments.gameFrame != null && !hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { GameFrameButton() }
AnimatedVisibility(!hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { AttachButton(composer.tray, toggleTray) }
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.weight(1f).height(42.dp).horizontalScroll(rememberScrollState(), reverseScrolling = true)) { if (controls != null && !focused) controls() }
actions()
}
} else Row(verticalAlignment = Alignment.Bottom) {
AnimatedVisibility(attach && !hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { AttachButton() }
AnimatedVisibility(AgentAttachments.gameFrame != null && !hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { GameFrameButton() }
AnimatedVisibility(!hideAttach, enter = expandHorizontally() + fadeIn(), exit = shrinkHorizontally() + fadeOut()) { AttachButton(composer.tray, toggleTray) }
text(Modifier.weight(1f))
if (controls != null && !focused) Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.height(42.dp)) { controls() }
actions()
}
}
AnimatedVisibility(composer.tray, enter = expandVertically() + fadeIn(), exit = shrinkVertically() + fadeOut()) {
val most = LocalConfiguration.current.screenHeightDp.dp * 0.45f
val height = (if (composer.keyboardHeight > 0.dp) composer.keyboardHeight else 280.dp).coerceAtLeast(160.dp).coerceAtMost(most)
AgentPhotoTray(height, composer.photoCopies, composer.photosCopying, files?.let { { AgentAttachments.pick { it.launch(arrayOf("*/*")) } } })
}
}
/**
@@ -974,51 +1018,15 @@ private fun VoiceButton(voice: AgentVoice, onStart: () -> Unit, onSend: () -> Un
}
}
/** Attaches what the running game shows, taken from its own surface so nothing drawn over it is in the picture. */
/** Opens the photo tray in place of the keyboard; while it is open, brings the keyboard back. */
@Composable
private fun GameFrameButton() {
val context = LocalContext.current
private fun AttachButton(trayOpen: Boolean, onClick: () -> Unit) {
val pal = LocalPalette.current
RoundButton(Icons.Outlined.PhotoCamera, stringResource(R.string.agent_attach_game), pal.surfaceVariant, pal.onBackground, "agent-game-frame") {
val grab = AgentAttachments.gameFrame ?: return@RoundButton
val chat = AgentHost.chat
grab frame@{ frame ->
if (frame == null) {
android.widget.Toast.makeText(context, R.string.agent_attach_game_failed, android.widget.Toast.LENGTH_SHORT).show()
return@frame
}
Thread({
val path = AgentAttachments.saveFrame(context, chat, frame)
frame.recycle()
android.os.Handler(android.os.Looper.getMainLooper()).post {
when {
path == null -> android.widget.Toast.makeText(context, R.string.agent_attach_game_failed, android.widget.Toast.LENGTH_SHORT).show()
AgentHost.chat == chat -> AgentAttachments.pending.add(path)
else -> AgentAttachments.discard(context, listOf(path))
}
}
}, "agent-game-frame").start()
}
}
}
@Composable
private fun AttachButton() {
val context = LocalContext.current
val pal = LocalPalette.current
val picker = rememberLauncherForActivityResult(ActivityResultContracts.OpenMultipleDocuments()) { uris ->
if (uris.isEmpty()) return@rememberLauncherForActivityResult
val chat = AgentHost.chat
Thread({
val paths = AgentAttachments.copy(context, chat, uris)
android.os.Handler(android.os.Looper.getMainLooper()).post {
if (AgentHost.chat == chat) AgentAttachments.pending.addAll(paths) else AgentAttachments.discard(context, paths)
}
}, "agent-attach").start()
}
RoundButton(Icons.Outlined.AttachFile, stringResource(R.string.agent_attach), pal.surfaceVariant, pal.onBackground, "agent-attach") {
runCatching { picker.launch(arrayOf("*/*")) }
}
RoundButton(
if (trayOpen) Icons.Outlined.Keyboard else Icons.Outlined.AttachFile,
stringResource(if (trayOpen) R.string.agent_keyboard else R.string.agent_attach),
if (trayOpen) pal.primary else pal.surfaceVariant, if (trayOpen) pal.onPrimary else pal.onBackground, "agent-attach", onClick = onClick,
)
}
@Composable
@@ -0,0 +1,280 @@
package com.droiddeck.launcher.ui
import android.Manifest
import android.content.ContentUris
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.provider.MediaStore
import android.provider.Settings
import android.widget.Toast
import androidx.activity.compose.LocalActivityResultRegistryOwner
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Check
import androidx.compose.material.icons.outlined.FolderOpen
import androidx.compose.material.icons.outlined.PhotoCamera
import androidx.compose.material.icons.outlined.PhotoLibrary
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshots.SnapshotStateMap
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.selected
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.droiddeck.launcher.R
import com.droiddeck.launcher.agent.AgentAttachments
import com.droiddeck.launcher.agent.AgentHost
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
/** The device's photos, newest first, as MediaStore lets the app see them. */
internal object AgentPhotos {
enum class Access { NONE, SELECTED, ALL }
/** Android stops showing the request after repeated denials and answers it at once, so a denied request sends later ones to Settings. */
var refused = false
fun permissions(sdk: Int = Build.VERSION.SDK_INT): Array<String> = when {
sdk >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> arrayOf(Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED)
sdk >= Build.VERSION_CODES.TIRAMISU -> arrayOf(Manifest.permission.READ_MEDIA_IMAGES)
else -> arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE)
}
fun access(context: Context): Access {
fun granted(permission: String) = context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED
val all = permissions().first()
return when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && Environment.isExternalStorageManager() -> Access.ALL
granted(all) -> Access.ALL
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && granted(Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED) -> Access.SELECTED
else -> Access.NONE
}
}
class Photo(val uri: Uri, val name: String)
fun recent(context: Context, limit: Int = 300): List<Photo> = runCatching {
val images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
context.contentResolver.query(
images, arrayOf(MediaStore.Images.Media._ID, MediaStore.Images.Media.DISPLAY_NAME), null, null, "${MediaStore.Images.Media.DATE_ADDED} DESC",
)?.use { c ->
buildList {
while (size < limit && c.moveToNext()) add(Photo(ContentUris.withAppendedId(images, c.getLong(0)), c.getString(1).orEmpty()))
}
}.orEmpty()
}.getOrDefault(emptyList())
}
/**
* Copies [uris] into the conversation's attachments off the main thread, then hands [onCopied] what was attached: nothing if the
* conversation changed meanwhile or [current] says the copy was superseded.
*/
internal fun attachUris(context: Context, uris: List<Uri>, current: () -> Boolean = { true }, onCopied: (List<Pair<Uri, String>>) -> Unit = {}) {
if (uris.isEmpty()) return
val chat = AgentHost.chat
Thread({
val copied = uris.mapNotNull { uri -> AgentAttachments.copy(context, chat, listOf(uri)).firstOrNull()?.let { uri to it } }
android.os.Handler(android.os.Looper.getMainLooper()).post {
val paths = copied.map { it.second }
if (AgentHost.chat == chat && current()) {
AgentAttachments.pending.addAll(paths)
onCopied(copied)
} else {
AgentAttachments.discard(context, paths)
onCopied(emptyList())
}
}
}, "agent-attach").start()
}
/** Attaches what the running game shows, taken from its own surface so nothing drawn over it is in the picture. */
private fun attachGameFrame(context: Context) {
val grab = AgentAttachments.gameFrame ?: return
val chat = AgentHost.chat
grab frame@{ frame ->
if (frame == null) {
Toast.makeText(context, R.string.agent_attach_game_failed, Toast.LENGTH_SHORT).show()
return@frame
}
Thread({
val path = AgentAttachments.saveFrame(context, chat, frame)
frame.recycle()
android.os.Handler(android.os.Looper.getMainLooper()).post {
when {
path == null -> Toast.makeText(context, R.string.agent_attach_game_failed, Toast.LENGTH_SHORT).show()
AgentHost.chat == chat -> AgentAttachments.pending.add(path)
else -> AgentAttachments.discard(context, listOf(path))
}
}
}, "agent-game-frame").start()
}
}
/** Shown in place of the keyboard: recent photos to tap onto the message, and the system picker for anything else. */
@Composable
internal fun AgentPhotoTray(height: Dp, copies: SnapshotStateMap<Uri, String>, copying: SnapshotStateMap<Uri, Any>, onFiles: (() -> Unit)?) {
val context = LocalContext.current
val pal = LocalPalette.current
var access by remember { mutableStateOf(AgentPhotos.access(context)) }
var photos by remember { mutableStateOf<List<AgentPhotos.Photo>?>(null) }
var reloads by remember { mutableStateOf(0) }
// A window no activity owns (the floating pet's chat) cannot ask for a permission, so it sends the user to the app's settings.
val launcher = if (LocalActivityResultRegistryOwner.current != null) {
rememberLauncherForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) {
AgentAttachments.picking = false
access = AgentPhotos.access(context)
if (access == AgentPhotos.Access.NONE) AgentPhotos.refused = true
reloads++
}
} else null
val request = {
if (launcher != null && !AgentPhotos.refused) {
AgentAttachments.pick { launcher.launch(AgentPhotos.permissions()) }
} else {
val details = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + context.packageName)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
runCatching { context.startActivity(details) }
}
Unit
}
// Access can change in Settings, and new pictures arrive, while the app is in the background.
val lifecycle = LocalLifecycleOwner.current.lifecycle
DisposableEffect(lifecycle) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_RESUME) {
access = AgentPhotos.access(context)
reloads++
}
}
lifecycle.addObserver(observer)
onDispose { lifecycle.removeObserver(observer) }
}
LaunchedEffect(access, reloads) {
photos = if (access == AgentPhotos.Access.NONE) emptyList() else withContext(Dispatchers.IO) { AgentPhotos.recent(context) }
}
LazyVerticalGrid(
GridCells.Adaptive(96.dp),
Modifier.fillMaxWidth().height(height).padding(top = 8.dp).testTag("agent-photo-tray"),
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
) {
if (AgentAttachments.gameFrame != null) item {
TrayTile(Icons.Outlined.PhotoCamera, stringResource(R.string.agent_attach_game), "agent-game-frame") { attachGameFrame(context) }
}
if (onFiles != null) item { TrayTile(Icons.Outlined.FolderOpen, stringResource(R.string.agent_attach_files), "agent-attach-files", onFiles) }
if (access != AgentPhotos.Access.ALL) item {
TrayTile(
Icons.Outlined.PhotoLibrary,
stringResource(if (access == AgentPhotos.Access.NONE) R.string.agent_photos_allow else R.string.agent_photos_more),
"agent-photos-allow",
onClick = request,
)
}
val list = photos
if (list != null && list.isEmpty() && access != AgentPhotos.Access.NONE) item(span = { GridItemSpan(maxLineSpan) }) {
Text(
stringResource(R.string.agent_photos_empty), fontSize = 13.sp, color = pal.onSurfaceVariant, textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth().padding(16.dp),
)
}
items(list.orEmpty(), key = { it.uri.toString() }) { photo ->
val uri = photo.uri
val path = copies[uri]
val selected = path != null && path in AgentAttachments.pending
Box(
Modifier.aspectRatio(1f).clip(Shape12).background(pal.surfaceVariant)
.then(if (selected) Modifier.border(3.dp, pal.primary, Shape12) else Modifier)
.clickable {
when {
selected -> AgentAttachments.pending.remove(path)
path != null && AgentAttachments.host(context, path).exists() -> AgentAttachments.pending.add(path)
uri in copying -> Unit
else -> {
// Leaving the conversation clears the markers, so a copy started before that is no longer current even back in it.
val copy = Any()
copying[uri] = copy
attachUris(context, listOf(uri), current = { copying[uri] === copy }) { copied ->
copied.forEach { (u, p) -> copies[u] = p }
if (copying[uri] === copy) copying.remove(uri)
}
}
}
}.semantics {
contentDescription = photo.name
this.selected = selected
}.testTag("agent-photo"),
) {
AsyncImage(
model = ImageRequest.Builder(context).data(uri).size(320).build(), contentDescription = null,
contentScale = ContentScale.Crop, modifier = Modifier.fillMaxSize(),
)
if (selected) Box(
contentAlignment = Alignment.Center,
modifier = Modifier.align(Alignment.TopEnd).padding(6.dp).size(22.dp).clip(CircleShape).background(pal.primary),
) {
Icon(Icons.Outlined.Check, null, tint = pal.onPrimary, modifier = Modifier.size(16.dp))
}
}
}
}
}
@Composable
private fun TrayTile(icon: ImageVector, label: String, tag: String, onClick: () -> Unit) {
val pal = LocalPalette.current
Column(
horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center,
modifier = Modifier.aspectRatio(1f).clip(Shape12).background(pal.surfaceVariant).clickable(onClick = onClick).padding(8.dp).testTag(tag),
) {
Icon(icon, null, tint = pal.onBackground, modifier = Modifier.size(26.dp))
Text(
label, fontSize = 12.sp, color = pal.onBackground, textAlign = TextAlign.Center, maxLines = 3, overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(top = 6.dp),
)
}
}
@@ -211,7 +211,6 @@ private val METRICS = listOf(
HudMetric("showNet", R.string.hud_metric_network),
HudMetric("showResolution", R.string.hud_metric_resolution),
HudMetric("showProton", R.string.hud_metric_proton),
HudMetric("showUpscale", R.string.hud_metric_upscale),
HudMetric("showSession", R.string.hud_metric_session),
HudMetric("showClock", R.string.hud_metric_clock),
)
@@ -881,6 +881,28 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
com.droiddeck.launcher.gpu.FrameGen.hasGameOverride(context, it)
} ?: false)
}
val scalingFilterChoices = SessionPrefs.upscalerChoices(context)
var gameUpscaler by remember(frameGenProfileKey) {
mutableStateOf(frameGenProfileKey?.let {
SessionPrefs.screenEffectsUpscaler(context, "game:$it")
} ?: SessionPrefs.upscaler(context))
}
var gameUpscalerOverride by remember(frameGenProfileKey) {
mutableStateOf(frameGenProfileKey?.let { SessionPrefs.hasGameUpscalerOverride(context, it) } ?: false)
}
val lifecycleOwner = LocalLifecycleOwner.current
DisposableEffect(lifecycleOwner, frameGenProfileKey) {
val observer = LifecycleEventObserver { _, event ->
if (event == Lifecycle.Event.ON_RESUME) {
frameGenProfileKey?.let { key ->
gameUpscaler = SessionPrefs.screenEffectsUpscaler(context, "game:$key")
gameUpscalerOverride = SessionPrefs.hasGameUpscalerOverride(context, key)
}
}
}
lifecycleOwner.lifecycle.addObserver(observer)
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
}
var wincompOpen by remember(wincompKey) { mutableStateOf<Boolean?>(null) }
val wincompPicks = remember(wincompKey, wincompOpen) { wincompKey?.let { com.droiddeck.launcher.session.WinComponents.picks(context, it) }.orEmpty() }
val steamScope = game?.let { com.droiddeck.launcher.session.NoSteamLaunch.scope(it) }
@@ -914,6 +936,25 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
},
)
}
val scalingFilterMenuContent: @Composable () -> Unit = {
val key = frameGenProfileKey
if (key != null) ScalingFilterMenu(
mode = gameUpscaler,
options = scalingFilterChoices,
hasGameOverride = gameUpscalerOverride,
onPick = { mode ->
SessionPrefs.setGameUpscaler(context, key, mode)
gameUpscaler = SessionPrefs.screenEffectsUpscaler(context, "game:$key")
gameUpscalerOverride = SessionPrefs.hasGameUpscalerOverride(context, key)
},
onResetGame = {
SessionPrefs.clearGameUpscaler(context, key)
gameUpscaler = SessionPrefs.upscaler(context)
gameUpscalerOverride = false
},
gameName = game?.name,
)
}
val cards = if (game?.library == com.droiddeck.launcher.frontend.Library.EPIC_LAUNCHER) listOfNotNull(steamCard) else buildList<@Composable (Modifier) -> Unit> {
add { m ->
val back = stringResource(R.string.hop_from_games)
@@ -938,6 +979,17 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
}
}
if (frameGenProfileKey != null) add { m ->
Box(m) {
SettingCard(
stringResource(R.string.display_filter),
scalingFilterChoices.firstOrNull { it.first == gameUpscaler }?.second ?: scalingFilterChoices.first().second,
"card:scaling-filter", Modifier.fillMaxSize(),
) {
host.open = if (host.open == "scaling-filter") null else "scaling-filter"
}
}
}
if (controller != null) add { m -> SettingCard(stringResource(R.string.setup_card_controls), stringResource(R.string.setup_card_controls_hint), "card:controls", m, controller.onMapping) }
if (steamCard != null) add(steamCard)
val cardStore = com.droiddeck.launcher.stores.Store.byId(game?.source.orEmpty())?.takeIf { it == com.droiddeck.launcher.stores.Store.EPIC || it == com.droiddeck.launcher.stores.Store.GOG }
@@ -972,6 +1024,11 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
frameGenMenuContent()
}
}
if (host.open == "scaling-filter") {
Box(Modifier.fillMaxWidth().padding(top = 4.dp)) {
scalingFilterMenuContent()
}
}
}
}
@@ -1057,39 +1114,6 @@ internal fun GameSettingsMenus(host: MenuHost, game: com.droiddeck.launcher.fron
save { com.droiddeck.launcher.session.GameEnvironmentStore.setGameResolution(it, scope, choice) }
}
var editResolution by remember(scope) { mutableStateOf(false) }
val upKey = "game-settings-upscale"
val upEngineKey = "game-settings-upscale-engine"
val upSharpKey = "game-settings-upscale-sharp"
val upscale = current?.let { com.droiddeck.launcher.core.GameUpscaler.choice(it, scope) }
val npuHere = remember { com.droiddeck.launcher.session.UpscaleComponent.npuArch() != null }
val upFiles by com.droiddeck.launcher.session.UpscaleComponent.state.collectAsState()
val modeLabels = mapOf(
com.droiddeck.launcher.core.GameUpscaler.Mode.FSR_XESS to stringResource(R.string.game_upscaler_mode_fsr),
com.droiddeck.launcher.core.GameUpscaler.Mode.DLSS to stringResource(R.string.game_upscaler_mode_dlss),
com.droiddeck.launcher.core.GameUpscaler.Mode.NATIVE_FSR4 to stringResource(R.string.game_upscaler_mode_native),
)
val engineLabels = mapOf(
com.droiddeck.launcher.core.GameUpscaler.Engine.FSR4_LITE_GPU to stringResource(R.string.game_upscaler_engine_fsr4_lite),
com.droiddeck.launcher.core.GameUpscaler.Engine.FSR4_FULL_GPU to stringResource(R.string.game_upscaler_engine_fsr4_full),
com.droiddeck.launcher.core.GameUpscaler.Engine.XESS to stringResource(R.string.game_upscaler_engine_xess),
com.droiddeck.launcher.core.GameUpscaler.Engine.BASIC to stringResource(R.string.game_upscaler_engine_basic),
com.droiddeck.launcher.core.GameUpscaler.Engine.SGSR2 to stringResource(R.string.game_upscaler_engine_sgsr2),
com.droiddeck.launcher.core.GameUpscaler.Engine.FSR4_NPU to stringResource(R.string.game_upscaler_engine_fsr4_npu),
com.droiddeck.launcher.core.GameUpscaler.Engine.FSR4_LITE_NPU to stringResource(R.string.game_upscaler_engine_fsr4_lite_npu),
)
val upOff = stringResource(R.string.game_upscaler_off)
val filesLabel = when (val f = upFiles) {
is com.droiddeck.launcher.session.UpscaleComponent.State.Downloading -> stringResource(R.string.game_upscaler_files_downloading, (f.progress * 100).toInt())
is com.droiddeck.launcher.session.UpscaleComponent.State.Failed -> stringResource(R.string.game_upscaler_files_failed, f.message)
else -> if (upscale != null && com.droiddeck.launcher.session.UpscaleComponent.ready(appContext,
com.droiddeck.launcher.session.UpscaleComponent.groups(upscale.engine, npuHere)))
stringResource(R.string.game_upscaler_files_ready) else stringResource(R.string.game_upscaler_files_missing)
}
fun pickUpscale(choice: com.droiddeck.launcher.core.GameUpscaler.Choice?) {
save { com.droiddeck.launcher.session.GameEnvironmentStore.setGameUpscaler(it, scope, choice) }
if (choice != null) com.droiddeck.launcher.session.UpscaleComponent.ensure(appContext,
com.droiddeck.launcher.session.UpscaleComponent.groups(choice.engine, npuHere))
}
AnchoredMenu(host.open == key, onDismiss = { if (host.open == key) host.open = null }, title = stringResource(R.string.game_settings_menu_title, game.name)) { first ->
MenuItem(stringResource(R.string.game_no_steam_title), checked = noSteam, enabled = ready,
detail = stringResource(R.string.game_no_steam_detail), focusRequester = first) {
@@ -1121,37 +1145,6 @@ 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_upscaler_title), checked = false, enabled = ready,
detail = upscale?.let { modeLabels[it.mode] } ?: upOff,
trailing = { Text("›", fontSize = 16.sp, color = colors.onSurfaceVariant) },
) { host.open = upKey }
if (upscale != null) {
MenuItem(
stringResource(R.string.game_upscaler_engine), checked = false, enabled = ready,
detail = engineLabels[com.droiddeck.launcher.core.GameUpscaler.effectiveEngine(upscale.engine, npuHere)],
trailing = { Text("›", fontSize = 16.sp, color = colors.onSurfaceVariant) },
) { host.open = upEngineKey }
MenuItem(
stringResource(R.string.game_upscaler_sharpness), checked = false, enabled = ready,
detail = stringResource(R.string.game_upscaler_sharpness_value, upscale.sharpness),
trailing = { Text("›", fontSize = 16.sp, color = colors.onSurfaceVariant) },
) { host.open = upSharpKey }
if (upscale.mode == com.droiddeck.launcher.core.GameUpscaler.Mode.DLSS) {
MenuItem(stringResource(R.string.game_upscaler_sigfix), checked = upscale.signatureFix, enabled = ready) {
pickUpscale(upscale.copy(signatureFix = !upscale.signatureFix))
}
}
if (upscale.engine.npu && npuHere) {
MenuItem(stringResource(R.string.game_upscaler_npu_sync), checked = upscale.npuSync, enabled = ready) {
pickUpscale(upscale.copy(npuSync = !upscale.npuSync))
}
}
MenuItem(stringResource(R.string.game_upscaler_files), checked = false, enabled = ready, detail = filesLabel) {
com.droiddeck.launcher.session.UpscaleComponent.ensure(appContext,
com.droiddeck.launcher.session.UpscaleComponent.groups(upscale.engine, npuHere))
}
}
}
MenuItem(stringResource(R.string.game_settings_default), checked = false, enabled = ready,
detail = stringResource(R.string.game_settings_default_detail)) {
@@ -1168,36 +1161,6 @@ internal fun GameSettingsMenus(host: MenuHost, game: com.droiddeck.launcher.fron
}
}
}
AnchoredMenu(host.open == upKey, onDismiss = { if (host.open == upKey) host.open = null }, title = stringResource(R.string.game_upscaler_title)) { first ->
MenuItem(upOff, checked = upscale == null, enabled = ready, focusRequester = first) {
host.open = key
pickUpscale(null)
}
com.droiddeck.launcher.core.GameUpscaler.Mode.entries.forEach { mode ->
MenuItem(modeLabels.getValue(mode), checked = upscale?.mode == mode, enabled = ready) {
host.open = key
pickUpscale((upscale ?: com.droiddeck.launcher.core.GameUpscaler.Choice(mode)).copy(mode = mode))
}
}
}
AnchoredMenu(host.open == upEngineKey, onDismiss = { if (host.open == upEngineKey) host.open = null }, title = stringResource(R.string.game_upscaler_engine)) { first ->
com.droiddeck.launcher.core.GameUpscaler.Engine.entries.filter { !it.npu || npuHere }.forEachIndexed { index, engine ->
MenuItem(engineLabels.getValue(engine), checked = upscale?.engine == engine, enabled = ready && upscale != null,
focusRequester = if (index == 0) first else null) {
host.open = key
upscale?.let { pickUpscale(it.copy(engine = engine)) }
}
}
}
AnchoredMenu(host.open == upSharpKey, onDismiss = { if (host.open == upSharpKey) host.open = null }, title = stringResource(R.string.game_upscaler_sharpness)) { first ->
com.droiddeck.launcher.core.GameUpscaler.sharpnessSteps.forEachIndexed { index, value ->
MenuItem(stringResource(R.string.game_upscaler_sharpness_value, value), checked = upscale?.sharpness == value,
enabled = ready && upscale != null, focusRequester = if (index == 0) first else null) {
host.open = key
upscale?.let { pickUpscale(it.copy(sharpness = value)) }
}
}
}
AnchoredMenu(host.open == resKey, onDismiss = { if (host.open == resKey) host.open = null }, title = stringResource(R.string.game_res_title)) { first ->
MenuItem(matchScreen, checked = resolution == null, enabled = ready, focusRequester = first) { pickResolution(null) }
com.droiddeck.launcher.core.GameResolution.scales.forEach { scale ->
@@ -308,7 +308,8 @@ internal fun SecondaryButton(text: String, enabled: Boolean = true, compact: Boo
Box(
contentAlignment = Alignment.Center,
modifier = modifier.paneItem("btn:$text").downToFirstTile().heightIn(min = if (pill) 40.dp else if (compact) 44.dp else 48.dp).graphicsLayer { scaleX = scale; scaleY = scale }.clip(shape).background(fill).glideBorder(hot, shape, pal.signal, if (pill) Color.White.copy(alpha = 0.14f) else pal.line2)
.alpha(if (enabled) 1f else 0.5f)
// The label always gets a layer of its own: sharing one with the fill and outline, they did not draw under the agent's latest reply.
.graphicsLayer { alpha = if (enabled) 1f else 0.5f }
.hoverable(src).clickable(role = androidx.compose.ui.semantics.Role.Button, interactionSource = src, indication = LocalIndication.current, enabled = enabled, onClick = onClick)
.controllerConfirm(enabled = enabled, onClick = onClick)
.padding(horizontal = if (pill) 16.dp else if (compact) 10.dp else 16.dp, vertical = if (pill) 8.dp else if (compact) 7.dp else 11.dp),
@@ -3,6 +3,9 @@ package com.droiddeck.launcher.ui
import android.text.format.DateUtils
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -26,8 +29,11 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@@ -41,7 +47,7 @@ import com.droiddeck.launcher.lab.LabOverlay
* [onRebuild] offers to build a kept one again for this install, when something can.
*/
@Composable
internal fun LabBuilds(sessionRunning: Boolean = false, onRebuild: ((LabOverlay.Info) -> Unit)? = null) {
internal fun LabBuilds(sessionRunning: Boolean = false, header: (@Composable () -> Unit)? = null, onRebuild: ((LabOverlay.Info) -> Unit)? = null) {
val context = LocalContext.current
var version by remember { mutableIntStateOf(0) }
var busy by remember { mutableStateOf(false) }
@@ -54,6 +60,7 @@ internal fun LabBuilds(sessionRunning: Boolean = false, onRebuild: ((LabOverlay.
val paused = active == null && current != null && LabOverlay.skipped == LabOverlay.SKIPPED_APP_IMAGE
val restartFailed = stringResource(R.string.lab_restart_failed)
val canRestart = !busy && !sessionRunning
var showKept by androidx.compose.runtime.saveable.rememberSaveable { mutableStateOf(false) }
/** Android may have given the APK an app image again, which a Lab build cannot load over. */
fun restart() {
@@ -73,8 +80,8 @@ internal fun LabBuilds(sessionRunning: Boolean = false, onRebuild: ((LabOverlay.
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
Column(Modifier.fillMaxWidth().padding(top = 18.dp)) {
Text(
Column(Modifier.fillMaxWidth().padding(top = if (header == null) 18.dp else 0.dp)) {
if (header != null) header() else Text(
stringResource(R.string.lab_builds).uppercase(), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.5.sp,
color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 2.dp, top = 2.dp, bottom = 10.dp),
)
@@ -99,7 +106,29 @@ internal fun LabBuilds(sessionRunning: Boolean = false, onRebuild: ((LabOverlay.
PrimaryButton(stringResource(R.string.lab_restart), compact = true, enabled = canRestart) { restart() }
}
}
for (build in saved) rows += {
val foldKept = (current != null || pending != null) && saved.isNotEmpty()
if (foldKept) rows += {
val src = remember { MutableInteractionSource() }
val toggle = { showKept = !showKept }
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth().paneItem("lab:kept")
.background(if (rememberHot(src)) pal.signal.copy(alpha = 0.14f) else Color.Transparent)
.hoverable(src).clickable(interactionSource = src, indication = null, role = Role.Button, onClick = toggle)
.controllerConfirm(onClick = toggle)
.padding(horizontal = 14.dp, vertical = 12.dp),
) {
Text(
pluralStringResource(R.plurals.lab_kept_count, saved.size, saved.size), fontSize = 14.sp,
color = colors.onSurfaceVariant, modifier = Modifier.weight(1f),
)
Text(
stringResource(if (showKept) R.string.common_hide else R.string.common_show), fontSize = 13.5.sp,
fontWeight = FontWeight.SemiBold, color = pal.signal,
)
}
}
if (!foldKept || showKept) for (build in saved) rows += {
var armed by remember(build.dir) { mutableStateOf(false) }
val info = build.info
BuildRow(
@@ -0,0 +1,69 @@
package com.droiddeck.launcher.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.droiddeck.launcher.R
@Composable
internal fun ScalingFilterMenu(
mode: Int,
options: List<Pair<Int, String>>,
hasGameOverride: Boolean,
onPick: (Int) -> Unit,
onResetGame: () -> Unit,
gameName: String? = null,
) {
val colors = MaterialTheme.colorScheme
Column(Modifier.fillMaxWidth().padding(start = 10.dp, end = 10.dp, bottom = 8.dp)) {
val selectedLabel = options.firstOrNull { it.first == mode }?.second ?: mode.toString()
Text(
stringResource(
if (hasGameOverride) R.string.display_filter_game_profile else R.string.display_filter_default_profile,
if (hasGameOverride) gameName.orEmpty() else selectedLabel,
selectedLabel,
),
color = colors.onSurfaceVariant,
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.padding(bottom = 6.dp),
)
options.forEachIndexed { index, (option, label) ->
val selected = mode == option
val pick = { onPick(option) }
OutlinedButton(
onClick = pick,
modifier = Modifier.fillMaxWidth()
.padding(top = if (index == 0) 0.dp else 6.dp)
.controllerConfirm(onClick = pick),
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
colors = ButtonDefaults.outlinedButtonColors(
containerColor = if (selected) colors.primary.copy(alpha = 0.16f) else colors.surface,
contentColor = if (selected) colors.primary else colors.onSurface,
),
) { Text(label) }
}
Text(
stringResource(R.string.display_filter_note),
color = colors.onSurfaceVariant,
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.padding(top = 6.dp),
)
OutlinedButton(
onClick = onResetGame,
modifier = Modifier.fillMaxWidth().padding(top = 6.dp)
.controllerConfirm(onClick = onResetGame),
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
) {
Text(stringResource(R.string.comp_game_use_general) + if (hasGameOverride) "" else " ✓")
}
}
}
@@ -16,6 +16,8 @@ import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.input.key.type
import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
@@ -75,6 +77,7 @@ import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
@@ -84,6 +87,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.systemGestureExclusion
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.rememberScrollState
@@ -548,8 +552,8 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
}
androidx.compose.foundation.layout.BoxWithConstraints(modifier = Modifier.fillMaxSize().exposeTestTags(), contentAlignment = Alignment.CenterEnd) {
val short = maxHeight < 440.dp
// The handle keeps a strip on the left free, so a sheet dragged wide can always be dragged back.
val maxSheet = (maxWidth - DRAWER_EDGE_GAP).coerceAtLeast(0.dp)
// At full width the handle's strip sits on the screen's left edge, so the sheet can still be dragged back.
val maxSheet = (maxWidth - DRAWER_HANDLE_STRIP).coerceAtLeast(0.dp)
val minSheet = minOf(DRAWER_MIN_WIDTH, maxSheet)
val defaultSheet = minOf(420.dp, maxWidth * 0.92f)
val sheetWidth = if (docked) maxWidth else (savedWidth?.dp ?: defaultSheet).coerceIn(minSheet, maxSheet)
@@ -665,6 +669,7 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
val track: (String) -> Modifier = { key -> focus.track(page, key) }
val sections = remember(page) { DrawerSections(drawerContext, track) }
CompositionLocalProvider(LocalChipMinWidth provides 96.dp, LocalCompactSettings provides true, LocalDrawerSections provides sections) {
DrawerColumns(two = sheetWidth >= DRAWER_TWO_COLUMN_WIDTH && page.inColumns) {
when (page) {
SessionDrawerPage.CONTROLLER -> DrawerControllerPage(host, a, a.controllerConnected || controllerActive, track)
SessionDrawerPage.HUD -> DrawerPerformancePage(host, a, track)
@@ -681,6 +686,7 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
SessionDrawerPage.ACHIEVEMENTS -> a.achievementsGame?.let { DrawerAchievementsPage(it, a.achievementsTitle, track) }
SessionDrawerPage.AGENT -> Unit
}
}
} }
}
}
@@ -1052,7 +1058,6 @@ private fun DrawerGamePage(host: MenuHost, a: DrawerActions, track: (String) ->
color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 10.dp, vertical = 8.dp))
}
TextureFilteringGroup(host, a, track)
if (a.steam || a.direct) DrawerUpscalerGroup(host, a, track)
ComponentsDrawerPage(host, a, track)
ComponentDownloadsDrawerGroup(
host = host,
@@ -1557,7 +1562,44 @@ internal fun secondScreenModes(none: Boolean, deckPad: Boolean, dashboard: Boole
private val DRAWER_MIN_WIDTH = 300.dp
private val DRAWER_HANDLE_STRIP = 24.dp
private val DRAWER_EDGE_GAP = 80.dp
private val DRAWER_COLUMN_GAP = 10.dp
// Two columns once each would be as wide as the narrowest single-column sheet.
private val DRAWER_TWO_COLUMN_WIDTH = DRAWER_MIN_WIDTH * 2 + DRAWER_COLUMN_GAP
private val SessionDrawerPage.inColumns: Boolean
get() = this != SessionDrawerPage.MORE && this != SessionDrawerPage.ACHIEVEMENTS
/**
* On a wide sheet, lays a page's groups out in two columns, the first half on the left. The split is by count, not
* height, so a group keeps its column while others fold and unfold.
*/
@Composable
internal fun DrawerColumns(two: Boolean, content: @Composable () -> Unit) {
// Keep a single composition so resizing only remeasures existing children.
Layout(content, Modifier.fillMaxWidth()) { measurables, constraints ->
val width = constraints.maxWidth
if (!two || measurables.size < 2) {
val placeables = measurables.map { it.measure(constraints.copy(minWidth = 0, minHeight = 0)) }
return@Layout layout(width, placeables.sumOf { it.height }) {
var y = 0
placeables.forEach { it.placeRelative(0, y); y += it.height }
}
}
val gap = DRAWER_COLUMN_GAP.roundToPx()
val column = ((width - gap) / 2).coerceAtLeast(0)
val child = Constraints(maxWidth = column)
val placeables = measurables.map { it.measure(child) }
val half = (placeables.size + 1) / 2
val left = placeables.take(half)
val right = placeables.drop(half)
layout(width, maxOf(left.sumOf { it.height }, right.sumOf { it.height })) {
var y = 0
left.forEach { it.placeRelative(0, y); y += it.height }
y = 0
right.forEach { it.placeRelative(column + gap, y); y += it.height }
}
}
}
/** A grip on the sheet's left edge: dragging it, or pressing left and right on a controller, resizes the sheet. */
@Composable
@@ -1579,6 +1621,8 @@ private fun DrawerResizeHandle(width: Dp, min: Dp, max: Dp, onWidth: (Dp) -> Uni
contentAlignment = Alignment.Center,
modifier = modifier.width(24.dp).height(96.dp)
.onGloballyPositioned { coords = it }
// On the screen's edge, Android's back swipe would take the drag.
.systemGestureExclusion()
.focusable(true, source)
.onPreviewKeyEvent { event ->
val key = event.nativeKeyEvent
@@ -1725,52 +1769,6 @@ private fun TextureFilteringGroup(host: MenuHost, a: DrawerActions, track: (Stri
}
}
/** The selected game's in-game upscaler: engine and sharpness switch live (the layer polls its control file). */
@Composable
private fun DrawerUpscalerGroup(host: MenuHost, a: DrawerActions, track: (String) -> Modifier) {
val appId = a.selectedGameProfileId ?: return
val context = LocalContext.current.applicationContext
val scope = appId.toString()
var choice by remember(scope) {
mutableStateOf(runCatching { com.droiddeck.launcher.core.GameUpscaler.choice(com.droiddeck.launcher.session.GameEnvironmentStore.read(context), scope) }.getOrNull())
}
val current = choice ?: return
val npuHere = remember { com.droiddeck.launcher.session.UpscaleComponent.npuArch() != null }
var status by remember { mutableStateOf<com.droiddeck.launcher.core.GameUpscaler.Status?>(null) }
LaunchedEffect(scope) {
while (true) {
status = kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) { com.droiddeck.launcher.session.UpscaleComponent.status(context) }
delay(1000)
}
}
val engines = com.droiddeck.launcher.core.GameUpscaler.Engine.entries.filter { !it.npu || npuHere }.map { engine ->
engine to stringResource(when (engine) {
com.droiddeck.launcher.core.GameUpscaler.Engine.FSR4_LITE_GPU -> R.string.game_upscaler_engine_fsr4_lite
com.droiddeck.launcher.core.GameUpscaler.Engine.FSR4_FULL_GPU -> R.string.game_upscaler_engine_fsr4_full
com.droiddeck.launcher.core.GameUpscaler.Engine.XESS -> R.string.game_upscaler_engine_xess
com.droiddeck.launcher.core.GameUpscaler.Engine.BASIC -> R.string.game_upscaler_engine_basic
com.droiddeck.launcher.core.GameUpscaler.Engine.SGSR2 -> R.string.game_upscaler_engine_sgsr2
com.droiddeck.launcher.core.GameUpscaler.Engine.FSR4_NPU -> R.string.game_upscaler_engine_fsr4_npu
com.droiddeck.launcher.core.GameUpscaler.Engine.FSR4_LITE_NPU -> R.string.game_upscaler_engine_fsr4_lite_npu
})
}
val sharpness = com.droiddeck.launcher.core.GameUpscaler.sharpnessSteps.map { it to stringResource(R.string.game_upscaler_sharpness_value, it) }
fun applyChoice(next: com.droiddeck.launcher.core.GameUpscaler.Choice) {
choice = next
Thread({
com.droiddeck.launcher.session.UpscaleComponent.writeControl(context, next.engine, next.sharpness, next.npuSync)
runCatching { com.droiddeck.launcher.session.GameEnvironmentStore.setGameUpscaler(context, scope, next) }
}, "upscale-live").start()
}
SettingsGroup(stringResource(R.string.game_upscaler_title)) {
ChoiceRow(host, "upscale-engine", stringResource(R.string.game_upscaler_engine),
status?.let { "${it.backendTag} · ${it.render} → ${it.output} · " + String.format(java.util.Locale.ROOT, "%.1f ms", if (it.npu) it.npuMs else it.gpuMs) },
engines, current.engine, chipModifier = track("upscale-engine")) { engine -> applyChoice(current.copy(engine = engine)) }
ChoiceRow(host, "upscale-sharpness", stringResource(R.string.game_upscaler_sharpness), null,
sharpness, current.sharpness, chipModifier = track("upscale-sharpness")) { value -> applyChoice(current.copy(sharpness = value)) }
}
}
private fun signed(v: Int) = if (v > 0) "+$v" else "$v"
@Composable
@@ -1938,7 +1936,7 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
}
return
}
SettingsGroup(stringResource(R.string.drawer_page_components), key = "game-components") {
DrawerComponentSettingsGroup(stringResource(R.string.drawer_game_components_note, gameProfile.name)) {
DrawerStackedChoice(
host = host,
key = "game-cmp-proton",
@@ -1981,12 +1979,6 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
)
}
}
Text(
stringResource(R.string.drawer_game_components_note, gameProfile.name),
fontSize = 12.sp,
color = colors.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 4.dp, vertical = 12.dp),
)
return
}
val running = snap.protons.filter { it.inUseByGame }
@@ -2027,7 +2019,7 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
return
}
val p = view.proton
SettingsGroup(stringResource(R.string.drawer_page_components), key = "game-components") {
DrawerComponentSettingsGroup(stringResource(R.string.drawer_components_note)) {
DrawerStackedChoice(
host, "cmp-proton", stringResource(R.string.comp_proton),
listOfNotNull(
@@ -2063,10 +2055,16 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
)
}
}
Text(
stringResource(R.string.drawer_components_note),
fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 4.dp, vertical = 12.dp),
)
}
@Composable
internal fun DrawerComponentSettingsGroup(note: String, content: @Composable ColumnScope.() -> Unit) {
// The note stays visible when collapsed, but both belong to one drawer column item.
Column(Modifier.fillMaxWidth()) {
SettingsGroup(stringResource(R.string.drawer_page_components), key = "game-components", content = content)
Text(note, fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(horizontal = 4.dp, vertical = 12.dp))
}
}
@Composable
@@ -0,0 +1,62 @@
package com.droiddeck.launcher.ui
import android.os.SystemClock
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.relocation.BringIntoViewRequester
import androidx.compose.foundation.relocation.bringIntoViewRequester
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.withFrameNanos
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
/** The row a settings search result opens, so the page it lands on can scroll to it and flash it. */
internal object SettingsJump {
class Target(val label: String, val at: Long = SystemClock.uptimeMillis())
var target: Target? by mutableStateOf(null)
fun to(label: String) { target = Target(label) }
}
private const val JUMP_WINDOW_MS = 5_000L
/** False in the search results, whose rows carry the same labels as the rows they open. */
internal val LocalSearchTargets = staticCompositionLocalOf { true }
@OptIn(androidx.compose.foundation.ExperimentalFoundationApi::class)
@Composable
internal fun Modifier.searchTarget(label: String): Modifier {
val pal = LocalPalette.current
val flash = remember { Animatable(0f) }
val reveal = remember { BringIntoViewRequester() }
var claimed by remember { mutableStateOf<SettingsJump.Target?>(null) }
val target = SettingsJump.target.takeIf { LocalSearchTargets.current }
if (target != null && target.label == label) SideEffect {
if (SettingsJump.target === target) {
SettingsJump.target = null
if (SystemClock.uptimeMillis() - target.at <= JUMP_WINDOW_MS) claimed = target
}
}
claimed?.let { mine ->
LaunchedEffect(mine) {
withFrameNanos { }
reveal.bringIntoView()
repeat(2) {
flash.animateTo(1f, tween(220))
flash.animateTo(0f, tween(420))
}
claimed = null
}
}
return bringIntoViewRequester(reveal).drawBehind {
if (flash.value > 0f) drawRect(pal.signal.copy(alpha = 0.28f * flash.value))
}
}
@@ -103,7 +103,7 @@ internal fun SettingsSearchResults(query: String, frost: Boolean, onOpen: (Setti
Note(stringResource(R.string.settings_search_none, query.trim()))
return
}
Column {
androidx.compose.runtime.CompositionLocalProvider(LocalSearchTargets provides false) { Column {
found.groupBy { it.place }.forEach { (place, entries) ->
SettingsGroup(stringResource(place.title)) {
entries.forEach { entry ->
@@ -112,9 +112,10 @@ internal fun SettingsSearchResults(query: String, frost: Boolean, onOpen: (Setti
val section = entry.section
val tab = entry.tab
if (section != null) {
ActionRow(title, within, stringResource(R.string.store_open), onClick = { onOpen(section) })
ActionRow(title, within, stringResource(R.string.store_open), onClick = { SettingsJump.to(title); onOpen(section) })
} else if (tab != null) {
ActionRow(title, within, stringResource(R.string.store_open), onClick = {
SettingsJump.to(title)
if (tab == NavTabs.MORE) MoreTabs.editing = true
if (tab == "downloads") DownloadsNav.showSettings = true
RailRequest.key = tab
@@ -125,5 +126,5 @@ internal fun SettingsSearchResults(query: String, frost: Boolean, onOpen: (Setti
}
}
}
}
} }
}
@@ -536,7 +536,7 @@ fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hint
minLines = hintLines ?: 1, maxLines = hintLines ?: Int.MAX_VALUE, overflow = TextOverflow.Ellipsis)
}
if (compact && !stacked) Column(
modifier = Modifier.fillMaxWidth().background(bg).padding(horizontal = 10.dp, vertical = 6.dp),
modifier = Modifier.searchTarget(label).fillMaxWidth().background(bg).padding(horizontal = 10.dp, vertical = 6.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Text(label, fontSize = 13.sp, lineHeight = 16.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground,
@@ -545,7 +545,7 @@ fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hint
}
if (hint != null || hintLines != null) hintText(11.sp)
} else if (stacked || LocalNarrowPane.current) Column(
modifier = Modifier.fillMaxWidth().background(bg).padding(
modifier = Modifier.searchTarget(label).fillMaxWidth().background(bg).padding(
horizontal = if (compact) 10.dp else 14.dp,
vertical = if (tightControlSpacing) 2.dp else if (compact) 6.dp else 12.dp),
) {
@@ -556,7 +556,7 @@ fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hint
Box(Modifier.padding(top = if (tightControlSpacing) 2.dp else if (compact) 6.dp else 8.dp)) { control() }
} else Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth().background(bg).padding(horizontal = 14.dp, vertical = 11.dp),
modifier = Modifier.searchTarget(label).fillMaxWidth().background(bg).padding(horizontal = 14.dp, vertical = 11.dp),
) {
Column(modifier = Modifier.weight(1f).padding(end = 12.dp)) {
Text(label, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground)
@@ -660,7 +660,7 @@ fun SliderRow(
) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
Column(Modifier.fillMaxWidth()) {
Column(Modifier.searchTarget(label).fillMaxWidth()) {
ValueSlider(value, range, step, enabled, label, format,
modifier = modifier.padding(horizontal = 6.dp, vertical = 3.dp), onChange = onChange)
if (hint != null) Text(hint, fontSize = 12.5.sp, color = colors.onSurfaceVariant,
@@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
@@ -114,36 +115,49 @@ internal fun UpdatesPage(s: FrontEndState, a: FrontEndActions, modifier: Modifie
Column(modifier = modifier) {
BoxWithConstraints(Modifier.weight(1f).fillMaxWidth()) {
val stacked = LocalNarrowPane.current || maxWidth < 600.dp
Column(modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(bottom = 16.dp)) {
val context = LocalContext.current
val agentReady = com.droiddeck.launcher.agent.AgentHost.installed &&
(com.droiddeck.launcher.agent.AgentSetup.ready || com.droiddeck.launcher.agent.AgentSetup.completed(context))
val installed: @Composable () -> Unit = {
SectionLabel(stringResource(R.string.upd_installed_label))
InstalledCard(s, u, me)
CheckRow(u, ua)
SectionLabel(stringResource(R.string.upd_channel))
if (stacked) {
ChannelPicker(u, ua)
Box(Modifier.height(14.dp))
StatusPanel(s, u, ua, me)
} else {
Row(horizontalArrangement = Arrangement.spacedBy(18.dp)) {
Box(Modifier.weight(1f)) { ChannelPicker(u, ua) }
Box(Modifier.weight(1.15f)) { StatusPanel(s, u, ua, me) }
}
}
SectionLabel(stringResource(R.string.upd_testers), top = 22.dp)
ToggleRow(
host, "build-watermark", stringResource(R.string.setup_build_watermark),
stringResource(R.string.setup_build_watermark_hint), s.buildWatermark,
) { a.onBuildWatermark() }
val context = LocalContext.current
val agentReady = com.droiddeck.launcher.agent.AgentHost.installed &&
(com.droiddeck.launcher.agent.AgentSetup.ready || com.droiddeck.launcher.agent.AgentSetup.completed(context))
LabBuilds(s.sessionRunning, onRebuild = if (agentReady) { info ->
LabBuilds(s.sessionRunning, header = { SectionLabel(stringResource(R.string.lab_builds)) }, onRebuild = if (agentReady) { info ->
com.droiddeck.launcher.agent.AgentHost.send(context, context.getString(R.string.agent_rebuild_lab, info.label))
context.startActivity(android.content.Intent(context, com.droiddeck.launcher.FrontEndActivity::class.java)
.putExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV, "agent")
.addFlags(android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP or android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT))
} else null)
}
val channel: @Composable () -> Unit = {
SectionLabel(stringResource(R.string.upd_channel))
ChannelPicker(u, ua) { StatusPanel(s, u, ua, me, embedded = it) }
}
val testers: @Composable () -> Unit = {
SectionLabel(stringResource(R.string.upd_testers), top = 22.dp)
ToggleRow(
host, "build-watermark", stringResource(R.string.setup_build_watermark),
stringResource(R.string.setup_build_watermark_hint), s.buildWatermark,
) { a.onBuildWatermark() }
}
if (stacked) {
Column(modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(bottom = 16.dp)) {
installed()
Box(Modifier.height(18.dp))
channel()
testers()
}
} else {
Row(Modifier.fillMaxSize(), horizontalArrangement = Arrangement.spacedBy(24.dp)) {
Column(Modifier.weight(1f).fillMaxHeight().verticalScroll(rememberScrollState()).padding(bottom = 16.dp)) {
installed()
testers()
}
Column(Modifier.weight(1.15f).fillMaxHeight().verticalScroll(rememberScrollState()).padding(bottom = 16.dp)) {
channel()
}
}
}
}
}
if (u.askPermission) AlertDialog(
@@ -266,7 +280,7 @@ private fun CheckRow(u: UpdatesState, ua: UpdatesActions) {
}
@Composable
private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, me: AppUpdates.Installed) {
private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, me: AppUpdates.Installed, embedded: Boolean = false) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
val catalog = u.catalog
@@ -292,13 +306,14 @@ private fun StatusPanel(s: FrontEndState, u: UpdatesState, ua: UpdatesActions, m
else -> Look(pal.good, stringResource(R.string.upd_current_status), stringResource(R.string.upd_current_headline, name), null)
}
Column(
modifier = Modifier.fillMaxWidth().clip(Shape16).background(colors.surface).border(1.dp, pal.line, Shape16).padding(18.dp),
modifier = if (embedded) Modifier.fillMaxWidth().padding(start = 12.dp, end = 12.dp, bottom = 14.dp)
else Modifier.fillMaxWidth().clip(Shape16).background(colors.surface).border(1.dp, pal.line, Shape16).padding(18.dp),
) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(7.dp)) {
Box(Modifier.size(7.dp).clip(CircleShape).background(look.tint))
Text(look.status, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = look.tint)
}
Text(look.headline, fontSize = 22.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, modifier = Modifier.padding(top = 4.dp))
if (!embedded) Text(look.headline, fontSize = 22.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, modifier = Modifier.padding(top = 4.dp))
if (offered) {
val size = release!!.apk?.size?.takeIf { it > 0 }?.let { megabytes(it) }
Text(
@@ -419,7 +434,7 @@ private fun changeTitle(t: String): String =
private fun megabytes(bytes: Long) = stringResource(R.string.upd_mb, ((bytes + 524_288) / 1_048_576).toInt())
@Composable
private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions) {
private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions, status: @Composable (embedded: Boolean) -> Unit) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
val catalog = u.catalog
@@ -455,8 +470,9 @@ private fun ChannelPicker(u: UpdatesState, ua: UpdatesActions) {
}
Text(hint, fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 4.dp))
if (tests.isEmpty() && catalog != null && showTests) Text(stringResource(R.string.upd_tests_none), fontSize = 12.5.sp, color = colors.onSurfaceVariant)
if (!listing) status(false)
AnimatedVisibility(listing, enter = expandVertically(Motion.sp(1f)) + fadeIn(Motion.sp(1f)), exit = shrinkVertically(Motion.sp(1f)) + fadeOut(Motion.sp(1f))) {
TestList(tests, me, u, ua)
TestList(tests, me, u, ua, status)
}
}
}
@@ -675,7 +691,7 @@ private fun LinkPill(label: String, url: String) {
}
@Composable
private fun TestList(tests: List<Release>, me: AppUpdates.Installed, u: UpdatesState, ua: UpdatesActions) {
private fun TestList(tests: List<Release>, me: AppUpdates.Installed, u: UpdatesState, ua: UpdatesActions, status: @Composable (embedded: Boolean) -> Unit) {
val colors = MaterialTheme.colorScheme
var query by rememberSaveable { mutableStateOf("") }
val needle = query.trim().removePrefix("#").removePrefix("@")
@@ -686,18 +702,25 @@ private fun TestList(tests: List<Release>, me: AppUpdates.Installed, u: UpdatesS
val (ready, old) = matches.partition { it.versionCode >= me.versionCode }
val followedOld = u.follow.channel == Channel.TEST && old.any { it.pr == u.follow.pr }
var showOld by rememberSaveable { mutableStateOf(false) }
Column(Modifier.padding(start = 18.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
if (tests.size > 5 || query.isNotEmpty()) AdbTextField(
value = query, onValueChange = { query = it }, label = stringResource(R.string.upd_tests_find),
keyboardType = KeyboardType.Text, imeAction = ImeAction.Search, compact = true, showLabel = false,
placeholder = stringResource(R.string.upd_tests_find), modifier = Modifier.fillMaxWidth(),
)
if (matches.isEmpty()) Text(stringResource(R.string.upd_tests_no_match), fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(4.dp))
ready.forEach { t -> TestRow(t, u.follow.pr == t.pr && u.follow.channel == Channel.TEST) { ua.onFollow(Follow(Channel.TEST, t.pr)) } }
if (old.isNotEmpty()) {
MoreLink(stringResource(R.string.upd_tests_old, old.size, me.versionCode), "tests:old") { showOld = !showOld }
if (showOld || followedOld || needle.isNotEmpty()) old.forEach { t ->
TestRow(t, u.follow.pr == t.pr && u.follow.channel == Channel.TEST, tooOld = true) { ua.onFollow(Follow(Channel.TEST, t.pr)) }
val oldShown = showOld || followedOld || needle.isNotEmpty()
val followed = u.follow.pr.takeIf { u.follow.channel == Channel.TEST }
val rowShown = followed != null && (ready.any { it.pr == followed } || (oldShown && old.any { it.pr == followed }))
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
// A followed test's row carries the status; browsing Tests while following Stable or Preview shows it only for an install running or failed.
if (if (followed != null) !rowShown else u.stage != null || u.error != null) status(false)
Column(Modifier.padding(start = 18.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
if (tests.size > 5 || query.isNotEmpty()) AdbTextField(
value = query, onValueChange = { query = it }, label = stringResource(R.string.upd_tests_find),
keyboardType = KeyboardType.Text, imeAction = ImeAction.Search, compact = true, showLabel = false,
placeholder = stringResource(R.string.upd_tests_find), modifier = Modifier.fillMaxWidth(),
)
if (matches.isEmpty()) Text(stringResource(R.string.upd_tests_no_match), fontSize = 12.5.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(4.dp))
ready.forEach { t -> TestRow(t, followed == t.pr, status = status) { ua.onFollow(Follow(Channel.TEST, t.pr)) } }
if (old.isNotEmpty()) {
MoreLink(stringResource(R.string.upd_tests_old, old.size, me.versionCode), "tests:old") { showOld = !showOld }
if (oldShown) old.forEach { t ->
TestRow(t, followed == t.pr, tooOld = true, status = status) { ua.onFollow(Follow(Channel.TEST, t.pr)) }
}
}
}
}
@@ -712,40 +735,46 @@ private fun RadioDot(selected: Boolean, size: androidx.compose.ui.unit.Dp = 22.d
}
@Composable
private fun TestRow(t: Release, selected: Boolean, tooOld: Boolean = false, onClick: () -> Unit) {
private fun TestRow(t: Release, selected: Boolean, tooOld: Boolean = false, status: @Composable (embedded: Boolean) -> Unit, onClick: () -> Unit) {
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
val src = remember { MutableInteractionSource() }
val hot = rememberHot(src)
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier.fillMaxWidth().paneItem("test:${t.pr}")
.heightIn(min = 52.dp)
.clip(Shape12)
.background(colors.surface).background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent)
.glideBorder(hot, Shape12, pal.signal, pal.line)
.alpha(if (tooOld && !selected) 0.6f else 1f)
.hoverable(src)
.clickable(interactionSource = src, indication = null, role = Role.RadioButton, onClick = onClick)
.controllerConfirm(onClick = onClick)
.padding(horizontal = 12.dp, vertical = 8.dp),
Column(
Modifier.fillMaxWidth().clip(Shape12).background(colors.surface)
.glideBorder(hot, Shape12, pal.signal, if (selected) pal.signal.copy(alpha = 0.5f) else pal.line),
) {
Text("#${t.pr}", fontSize = 13.sp, fontWeight = FontWeight.Bold, color = if (selected) pal.signal else colors.onSurfaceVariant)
Column(Modifier.weight(1f)) {
Text(changeTitle(t.title.ifBlank { stringResource(R.string.upd_pr, t.pr) }), fontSize = 13.5.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
val detail = when {
t.apk == null -> stringResource(R.string.upd_not_built)
tooOld -> stringResource(R.string.upd_tests_old_row, t.versionCode)
else -> stringResource(R.string.upd_updated, ago(t.builtAt.takeIf { it > 0 } ?: t.publishedAt))
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier.fillMaxWidth().paneItem("test:${t.pr}")
.heightIn(min = 52.dp)
.background(if (hot) pal.signal.copy(alpha = 0.14f) else Color.Transparent)
.alpha(if (tooOld && !selected) 0.6f else 1f)
.hoverable(src)
.clickable(interactionSource = src, indication = null, role = Role.RadioButton, onClick = onClick)
.controllerConfirm(onClick = onClick)
.padding(horizontal = 12.dp, vertical = 8.dp),
) {
Text("#${t.pr}", fontSize = 13.sp, fontWeight = FontWeight.Bold, color = if (selected) pal.signal else colors.onSurfaceVariant)
Column(Modifier.weight(1f)) {
Text(changeTitle(t.title.ifBlank { stringResource(R.string.upd_pr, t.pr) }), fontSize = 13.5.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
val detail = when {
t.apk == null -> stringResource(R.string.upd_not_built)
tooOld -> stringResource(R.string.upd_tests_old_row, t.versionCode)
else -> stringResource(R.string.upd_updated, ago(t.builtAt.takeIf { it > 0 } ?: t.publishedAt))
}
Text(
listOfNotNull(detail, t.author.takeIf { it.isNotEmpty() }?.let { "@$it" }, t.shortCommit).joinToString(" · "),
fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis,
)
if (t.newerCommitPushed) Text(stringResource(R.string.upd_newer_commit_short), fontSize = 12.sp, color = AttentionAmber, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
Text(
listOfNotNull(detail, t.author.takeIf { it.isNotEmpty() }?.let { "@$it" }, t.shortCommit).joinToString(" · "),
fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis,
)
if (t.newerCommitPushed) Text(stringResource(R.string.upd_newer_commit_short), fontSize = 12.sp, color = AttentionAmber, maxLines = 1, overflow = TextOverflow.Ellipsis)
RadioDot(selected, 20.dp)
}
AnimatedVisibility(selected, enter = expandVertically(Motion.sp(1f)) + fadeIn(Motion.sp(1f)), exit = shrinkVertically(Motion.sp(1f)) + fadeOut(Motion.sp(1f))) {
status(true)
}
RadioDot(selected, 20.dp)
}
}
@@ -333,6 +333,8 @@ public final class WaylandCompositor {
public static native void nativeSetZeroCopy(boolean on);
public static native void nativeSetMirrorCapture(boolean on);
public static native void nativeSetDisplayBufferDriver(boolean on);
public static native int nativeZeroCopyFrames();
+7
View File
@@ -1180,6 +1180,11 @@
<string name="agent_tools_missing">أدوات الوكيل غير مثبتة: %1$s</string>
<string name="agent_unqueue">لا تُرسل</string>
<string name="agent_attach">إرفاق</string>
<string name="agent_attach_files">الملفات</string>
<string name="agent_photos_allow">السماح بالوصول إلى الصور</string>
<string name="agent_photos_more">اختيار المزيد من الصور</string>
<string name="agent_photos_empty">لا توجد صور بعد</string>
<string name="agent_keyboard">لوحة المفاتيح</string>
<string name="agent_remove_attachment">إزالة</string>
<string name="agent_model_default">الافتراضي</string>
<string name="agent_effort">جهد الاستدلال</string>
@@ -4325,4 +4330,6 @@
<string name="glasses_shortcut_group">اختصار داخل اللعبة</string>
<string name="glasses_show_shortcut">إظهار اختصار النظارات الذكية</string>
<string name="glasses_show_shortcut_hint">إظهار زر النظارات الذكية العائم فوق اللعبة.</string>
<string name="display_filter_game_profile">استخدام ملف تعريف %1$s: %2$s</string>
<string name="display_filter_default_profile">استخدام الملف التعريفي الافتراضي: %1$s</string>
</resources>
@@ -1198,6 +1198,11 @@
<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_attach_files">Archivos</string>
<string name="agent_photos_allow">Permitir acceso a fotos</string>
<string name="agent_photos_more">Elegir más fotos</string>
<string name="agent_photos_empty">Aún no hay fotos</string>
<string name="agent_keyboard">Teclado</string>
<string name="agent_remove_attachment">Quitar</string>
<string name="agent_model_default">Predeterminado</string>
<string name="agent_effort">Esfuerzo de razonamiento</string>
@@ -4203,4 +4208,6 @@
<string name="glasses_shortcut_group">Acceso directo en el juego</string>
<string name="glasses_show_shortcut">Mostrar acceso directo de Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Mostrar el botón flotante de Smart Glasses sobre el juego.</string>
<string name="display_filter_game_profile">Usando el perfil %1$s: %2$s</string>
<string name="display_filter_default_profile">Usando el perfil predeterminado: %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<string name="agent_tools_missing">Инструментите на агента не са инсталирани: %1$s</string>
<string name="agent_unqueue">Не изпращай</string>
<string name="agent_attach">Прикачи</string>
<string name="agent_attach_files">Файлове</string>
<string name="agent_photos_allow">Разрешаване на достъп до снимки</string>
<string name="agent_photos_more">Избор на още снимки</string>
<string name="agent_photos_empty">Все още няма снимки</string>
<string name="agent_keyboard">Клавиатура</string>
<string name="agent_remove_attachment">Премахни</string>
<string name="agent_model_default">По подразбиране</string>
<string name="agent_effort">Усилие за разсъждение</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Пряк път в играта</string>
<string name="glasses_show_shortcut">Показване на прекия път за Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Показва плаващия бутон за Smart Glasses върху играта.</string>
<string name="display_filter_game_profile">Използва се профил %1$s: %2$s</string>
<string name="display_filter_default_profile">Използва се профилът по подразбиране: %1$s</string>
</resources>
+7
View File
@@ -1174,6 +1174,11 @@
<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_attach_files">Soubory</string>
<string name="agent_photos_allow">Povolit přístup k fotkám</string>
<string name="agent_photos_more">Vybrat další fotky</string>
<string name="agent_photos_empty">Zatím žádné fotky</string>
<string name="agent_keyboard">Klávesnice</string>
<string name="agent_remove_attachment">Odebrat</string>
<string name="agent_model_default">Výchozí</string>
<string name="agent_effort">Náročnost uvažování</string>
@@ -4245,4 +4250,6 @@
<string name="glasses_shortcut_group">Zkratka ve hře</string>
<string name="glasses_show_shortcut">Zobrazit zkratku Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Zobrazit plovoucí tlačítko Smart Glasses nad hrou.</string>
<string name="display_filter_game_profile">Používá se profil %1$s: %2$s</string>
<string name="display_filter_default_profile">Používá se výchozí profil: %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<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_attach_files">Filer</string>
<string name="agent_photos_allow">Tillad adgang til billeder</string>
<string name="agent_photos_more">Vælg flere billeder</string>
<string name="agent_photos_empty">Ingen billeder endnu</string>
<string name="agent_keyboard">Tastatur</string>
<string name="agent_remove_attachment">Fjern</string>
<string name="agent_model_default">Standard</string>
<string name="agent_effort">Ræsonneringsindsats</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Genvej i spillet</string>
<string name="glasses_show_shortcut">Vis Smart Glasses-genvej</string>
<string name="glasses_show_shortcut_hint">Vis den flydende Smart Glasses-knap oven på spillet.</string>
<string name="display_filter_game_profile">Bruger profilen %1$s: %2$s</string>
<string name="display_filter_default_profile">Bruger standardprofilen: %1$s</string>
</resources>
+7
View File
@@ -1160,6 +1160,11 @@
<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_attach_files">Dateien</string>
<string name="agent_photos_allow">Zugriff auf Fotos erlauben</string>
<string name="agent_photos_more">Weitere Fotos auswählen</string>
<string name="agent_photos_empty">Noch keine Fotos</string>
<string name="agent_keyboard">Tastatur</string>
<string name="agent_remove_attachment">Entfernen</string>
<string name="agent_model_default">Standard</string>
<string name="agent_effort">Denkaufwand</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Ingame-Verknüpfung</string>
<string name="glasses_show_shortcut">Smart-Glasses-Verknüpfung anzeigen</string>
<string name="glasses_show_shortcut_hint">Die schwebende Smart-Glasses-Schaltfläche über dem Spiel anzeigen.</string>
<string name="display_filter_game_profile">Profil %1$s wird verwendet: %2$s</string>
<string name="display_filter_default_profile">Standardprofil wird verwendet: %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<string name="agent_tools_missing">Τα εργαλεία του πράκτορα δεν εγκαταστάθηκαν: %1$s</string>
<string name="agent_unqueue">Να μην σταλεί</string>
<string name="agent_attach">Επισύναψη</string>
<string name="agent_attach_files">Αρχεία</string>
<string name="agent_photos_allow">Να επιτρέπεται η πρόσβαση στις φωτογραφίες</string>
<string name="agent_photos_more">Επιλογή περισσότερων φωτογραφιών</string>
<string name="agent_photos_empty">Δεν υπάρχουν φωτογραφίες ακόμα</string>
<string name="agent_keyboard">Πληκτρολόγιο</string>
<string name="agent_remove_attachment">Αφαίρεση</string>
<string name="agent_model_default">Προεπιλογή</string>
<string name="agent_effort">Προσπάθεια συλλογισμού</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Συντόμευση μέσα στο παιχνίδι</string>
<string name="glasses_show_shortcut">Εμφάνιση συντόμευσης Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Εμφάνιση του αιωρούμενου κουμπιού Smart Glasses πάνω από το παιχνίδι.</string>
<string name="display_filter_game_profile">Χρήση προφίλ %1$s: %2$s</string>
<string name="display_filter_default_profile">Χρήση προεπιλεγμένου προφίλ: %1$s</string>
</resources>
+7
View File
@@ -1171,6 +1171,11 @@
<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_attach_files">Archivos</string>
<string name="agent_photos_allow">Permitir acceso a las fotos</string>
<string name="agent_photos_more">Elegir más fotos</string>
<string name="agent_photos_empty">Aún no hay fotos</string>
<string name="agent_keyboard">Teclado</string>
<string name="agent_remove_attachment">Quitar</string>
<string name="agent_model_default">Predeterminado</string>
<string name="agent_effort">Esfuerzo de razonamiento</string>
@@ -4205,4 +4210,6 @@
<string name="glasses_shortcut_group">Acceso directo en el juego</string>
<string name="glasses_show_shortcut">Mostrar acceso directo de Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Mostrar el botón flotante de Smart Glasses sobre el juego.</string>
<string name="display_filter_game_profile">Usando el perfil %1$s: %2$s</string>
<string name="display_filter_default_profile">Usando el perfil predeterminado: %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<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_attach_files">Tiedostot</string>
<string name="agent_photos_allow">Salli kuvien käyttö</string>
<string name="agent_photos_more">Valitse lisää kuvia</string>
<string name="agent_photos_empty">Ei vielä kuvia</string>
<string name="agent_keyboard">Näppäimistö</string>
<string name="agent_remove_attachment">Poista</string>
<string name="agent_model_default">Oletus</string>
<string name="agent_effort">Päättelyteho</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Pelin aikainen pikakuvake</string>
<string name="glasses_show_shortcut">Näytä Smart Glasses -pikakuvake</string>
<string name="glasses_show_shortcut_hint">Näytä pelin päällä kelluva Smart Glasses -painike.</string>
<string name="display_filter_game_profile">Käytössä profiili %1$s: %2$s</string>
<string name="display_filter_default_profile">Käytössä oletusprofiili: %1$s</string>
</resources>
+7
View File
@@ -1171,6 +1171,11 @@
<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_attach_files">Fichiers</string>
<string name="agent_photos_allow">Autoriser l\'accès aux photos</string>
<string name="agent_photos_more">Choisir d\'autres photos</string>
<string name="agent_photos_empty">Aucune photo pour l\'instant</string>
<string name="agent_keyboard">Clavier</string>
<string name="agent_remove_attachment">Supprimer</string>
<string name="agent_model_default">Par défaut</string>
<string name="agent_effort">Effort de raisonnement</string>
@@ -4204,4 +4209,6 @@
<string name="glasses_shortcut_group">Raccourci en jeu</string>
<string name="glasses_show_shortcut">Afficher le raccourci Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Afficher le bouton flottant Smart Glasses par-dessus le jeu.</string>
<string name="display_filter_game_profile">Profil %1$s utilisé : %2$s</string>
<string name="display_filter_default_profile">Profil par défaut utilisé : %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<string name="agent_tools_missing">एजेंट टूल इंस्टॉल नहीं हुए: %1$s</string>
<string name="agent_unqueue">न भेजें</string>
<string name="agent_attach">संलग्न करें</string>
<string name="agent_attach_files">फ़ाइलें</string>
<string name="agent_photos_allow">फ़ोटो की अनुमति दें</string>
<string name="agent_photos_more">और फ़ोटो चुनें</string>
<string name="agent_photos_empty">अभी कोई फ़ोटो नहीं</string>
<string name="agent_keyboard">कीबोर्ड</string>
<string name="agent_remove_attachment">हटाएँ</string>
<string name="agent_model_default">डिफ़ॉल्ट</string>
<string name="agent_effort">सोचने का स्तर</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">गेम में शॉर्टकट</string>
<string name="glasses_show_shortcut">Smart Glasses शॉर्टकट दिखाएँ</string>
<string name="glasses_show_shortcut_hint">गेम के ऊपर तैरता हुआ Smart Glasses बटन दिखाएँ।</string>
<string name="display_filter_game_profile">%1$s प्रोफ़ाइल का उपयोग: %2$s</string>
<string name="display_filter_default_profile">डिफ़ॉल्ट प्रोफ़ाइल का उपयोग: %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<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_attach_files">Fájlok</string>
<string name="agent_photos_allow">Fotókhoz való hozzáférés engedélyezése</string>
<string name="agent_photos_more">További fotók kiválasztása</string>
<string name="agent_photos_empty">Még nincsenek fotók</string>
<string name="agent_keyboard">Billentyűzet</string>
<string name="agent_remove_attachment">Eltávolítás</string>
<string name="agent_model_default">Alapértelmezett</string>
<string name="agent_effort">Gondolkodási erőfeszítés</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Játékon belüli parancsikon</string>
<string name="glasses_show_shortcut">Smart Glasses parancsikon megjelenítése</string>
<string name="glasses_show_shortcut_hint">A játék fölött lebegő Smart Glasses gomb megjelenítése.</string>
<string name="display_filter_game_profile">Használt profil: %1$s – %2$s</string>
<string name="display_filter_default_profile">Alapértelmezett profil használata: %1$s</string>
</resources>
+7
View File
@@ -1165,6 +1165,11 @@
<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_attach_files">File</string>
<string name="agent_photos_allow">Izinkan akses foto</string>
<string name="agent_photos_more">Pilih foto lainnya</string>
<string name="agent_photos_empty">Belum ada foto</string>
<string name="agent_keyboard">Keyboard</string>
<string name="agent_remove_attachment">Hapus</string>
<string name="agent_model_default">Default</string>
<string name="agent_effort">Upaya penalaran</string>
@@ -4135,4 +4140,6 @@
<string name="glasses_shortcut_group">Pintasan dalam game</string>
<string name="glasses_show_shortcut">Tampilkan pintasan Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Tampilkan tombol Smart Glasses mengambang di atas game.</string>
<string name="display_filter_game_profile">Menggunakan profil %1$s: %2$s</string>
<string name="display_filter_default_profile">Menggunakan profil default: %1$s</string>
</resources>
+7
View File
@@ -1163,6 +1163,11 @@
<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_attach_files">File</string>
<string name="agent_photos_allow">Consenti accesso alle foto</string>
<string name="agent_photos_more">Scegli altre foto</string>
<string name="agent_photos_empty">Ancora nessuna foto</string>
<string name="agent_keyboard">Tastiera</string>
<string name="agent_remove_attachment">Rimuovi</string>
<string name="agent_model_default">Predefinito</string>
<string name="agent_effort">Livello di ragionamento</string>
@@ -4204,4 +4209,6 @@
<string name="glasses_shortcut_group">Scorciatoia nel gioco</string>
<string name="glasses_show_shortcut">Mostra scorciatoia Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Mostra il pulsante mobile Smart Glasses sopra il gioco.</string>
<string name="display_filter_game_profile">Profilo %1$s in uso: %2$s</string>
<string name="display_filter_default_profile">Profilo predefinito in uso: %1$s</string>
</resources>
+7
View File
@@ -1165,6 +1165,11 @@
<string name="agent_tools_missing">エージェントのツールが未インストール: %1$s</string>
<string name="agent_unqueue">送信しない</string>
<string name="agent_attach">添付</string>
<string name="agent_attach_files">ファイル</string>
<string name="agent_photos_allow">写真へのアクセスを許可</string>
<string name="agent_photos_more">写真をさらに選択</string>
<string name="agent_photos_empty">まだ写真がありません</string>
<string name="agent_keyboard">キーボード</string>
<string name="agent_remove_attachment">削除</string>
<string name="agent_model_default">デフォルト</string>
<string name="agent_effort">推論レベル</string>
@@ -4135,4 +4140,6 @@
<string name="glasses_shortcut_group">ゲーム内ショートカット</string>
<string name="glasses_show_shortcut">Smart Glasses のショートカットを表示</string>
<string name="glasses_show_shortcut_hint">ゲーム画面上に Smart Glasses のフローティングボタンを表示します。</string>
<string name="display_filter_game_profile">%1$s プロファイルを使用中: %2$s</string>
<string name="display_filter_default_profile">デフォルトプロファイルを使用中: %1$s</string>
</resources>
+7
View File
@@ -1165,6 +1165,11 @@
<string name="agent_tools_missing">에이전트 도구가 설치되지 않음: %1$s</string>
<string name="agent_unqueue">보내지 않기</string>
<string name="agent_attach">첨부</string>
<string name="agent_attach_files">파일</string>
<string name="agent_photos_allow">사진 접근 허용</string>
<string name="agent_photos_more">사진 더 선택</string>
<string name="agent_photos_empty">아직 사진이 없습니다</string>
<string name="agent_keyboard">키보드</string>
<string name="agent_remove_attachment">제거</string>
<string name="agent_model_default">기본</string>
<string name="agent_effort">추론 수준</string>
@@ -4135,4 +4140,6 @@
<string name="glasses_shortcut_group">게임 내 바로가기</string>
<string name="glasses_show_shortcut">Smart Glasses 바로가기 표시</string>
<string name="glasses_show_shortcut_hint">게임 위에 떠 있는 Smart Glasses 버튼을 표시합니다.</string>
<string name="display_filter_game_profile">%1$s 프로필 사용 중: %2$s</string>
<string name="display_filter_default_profile">기본 프로필 사용 중: %1$s</string>
</resources>
+7
View File
@@ -1165,6 +1165,11 @@
<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_attach_files">Fail</string>
<string name="agent_photos_allow">Benarkan akses foto</string>
<string name="agent_photos_more">Pilih lebih banyak foto</string>
<string name="agent_photos_empty">Belum ada foto</string>
<string name="agent_keyboard">Papan kekunci</string>
<string name="agent_remove_attachment">Alih keluar</string>
<string name="agent_model_default">Lalai</string>
<string name="agent_effort">Usaha penaakulan</string>
@@ -4135,4 +4140,6 @@
<string name="glasses_shortcut_group">Pintasan dalam permainan</string>
<string name="glasses_show_shortcut">Tunjukkan pintasan Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Tunjukkan butang Smart Glasses terapung di atas permainan.</string>
<string name="display_filter_game_profile">Menggunakan profil %1$s: %2$s</string>
<string name="display_filter_default_profile">Menggunakan profil lalai: %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<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_attach_files">Filer</string>
<string name="agent_photos_allow">Tillat tilgang til bilder</string>
<string name="agent_photos_more">Velg flere bilder</string>
<string name="agent_photos_empty">Ingen bilder ennå</string>
<string name="agent_keyboard">Tastatur</string>
<string name="agent_remove_attachment">Fjern</string>
<string name="agent_model_default">Standard</string>
<string name="agent_effort">Resonneringsinnsats</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Snarvei i spillet</string>
<string name="glasses_show_shortcut">Vis Smart Glasses-snarvei</string>
<string name="glasses_show_shortcut_hint">Vis den flytende Smart Glasses-knappen over spillet.</string>
<string name="display_filter_game_profile">Bruker profilen %1$s: %2$s</string>
<string name="display_filter_default_profile">Bruker standardprofilen: %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<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_attach_files">Bestanden</string>
<string name="agent_photos_allow">Toegang tot foto\'s toestaan</string>
<string name="agent_photos_more">Meer foto\'s kiezen</string>
<string name="agent_photos_empty">Nog geen foto\'s</string>
<string name="agent_keyboard">Toetsenbord</string>
<string name="agent_remove_attachment">Verwijderen</string>
<string name="agent_model_default">Standaard</string>
<string name="agent_effort">Redeneerinspanning</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Snelkoppeling in game</string>
<string name="glasses_show_shortcut">Smart Glasses-snelkoppeling tonen</string>
<string name="glasses_show_shortcut_hint">Toon de zwevende Smart Glasses-knop boven het spel.</string>
<string name="display_filter_game_profile">Profiel %1$s in gebruik: %2$s</string>
<string name="display_filter_default_profile">Standaardprofiel in gebruik: %1$s</string>
</resources>
+7
View File
@@ -1174,6 +1174,11 @@
<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_attach_files">Pliki</string>
<string name="agent_photos_allow">Zezwól na dostęp do zdjęć</string>
<string name="agent_photos_more">Wybierz więcej zdjęć</string>
<string name="agent_photos_empty">Brak zdjęć</string>
<string name="agent_keyboard">Klawiatura</string>
<string name="agent_remove_attachment">Usuń</string>
<string name="agent_model_default">Domyślny</string>
<string name="agent_effort">Poziom rozumowania</string>
@@ -4245,4 +4250,6 @@
<string name="glasses_shortcut_group">Skrót w grze</string>
<string name="glasses_show_shortcut">Pokaż skrót Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Pokaż pływający przycisk Smart Glasses nad grą.</string>
<string name="display_filter_game_profile">Używany profil %1$s: %2$s</string>
<string name="display_filter_default_profile">Używany profil domyślny: %1$s</string>
</resources>
@@ -1163,6 +1163,11 @@
<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_attach_files">Ficheiros</string>
<string name="agent_photos_allow">Permitir acesso às fotos</string>
<string name="agent_photos_more">Escolher mais fotos</string>
<string name="agent_photos_empty">Ainda não há fotos</string>
<string name="agent_keyboard">Teclado</string>
<string name="agent_remove_attachment">Remover</string>
<string name="agent_model_default">Predefinido</string>
<string name="agent_effort">Esforço de raciocínio</string>
@@ -4204,4 +4209,6 @@
<string name="glasses_shortcut_group">Atalho no jogo</string>
<string name="glasses_show_shortcut">Mostrar atalho do Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Mostrar o botão flutuante do Smart Glasses sobre o jogo.</string>
<string name="display_filter_game_profile">Perfil %1$s em utilização: %2$s</string>
<string name="display_filter_default_profile">Perfil predefinido em utilização: %1$s</string>
</resources>
+7
View File
@@ -1170,6 +1170,11 @@
<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_attach_files">Arquivos</string>
<string name="agent_photos_allow">Permitir acesso às fotos</string>
<string name="agent_photos_more">Escolher mais fotos</string>
<string name="agent_photos_empty">Ainda não há fotos</string>
<string name="agent_keyboard">Teclado</string>
<string name="agent_remove_attachment">Remover</string>
<string name="agent_model_default">Padrão</string>
<string name="agent_effort">Esforço de raciocínio</string>
@@ -4212,4 +4217,6 @@
<string name="glasses_shortcut_group">Atalho durante o jogo</string>
<string name="glasses_show_shortcut">Mostrar atalho do Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Mostrar o botão flutuante do Smart Glasses sobre o jogo.</string>
<string name="display_filter_game_profile">Perfil %1$s em uso: %2$s</string>
<string name="display_filter_default_profile">Perfil predefinido em uso: %1$s</string>
</resources>
+7
View File
@@ -1171,6 +1171,11 @@
<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_attach_files">Fișiere</string>
<string name="agent_photos_allow">Permite accesul la fotografii</string>
<string name="agent_photos_more">Alege mai multe fotografii</string>
<string name="agent_photos_empty">Încă nu există fotografii</string>
<string name="agent_keyboard">Tastatură</string>
<string name="agent_remove_attachment">Elimină</string>
<string name="agent_model_default">Implicit</string>
<string name="agent_effort">Efort de raționament</string>
@@ -4205,4 +4210,6 @@
<string name="glasses_shortcut_group">Comandă rapidă în joc</string>
<string name="glasses_show_shortcut">Afișează comanda rapidă Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Afișează butonul plutitor Smart Glasses peste joc.</string>
<string name="display_filter_game_profile">Se folosește profilul %1$s: %2$s</string>
<string name="display_filter_default_profile">Se folosește profilul implicit: %1$s</string>
</resources>
+7
View File
@@ -1174,6 +1174,11 @@
<string name="agent_tools_missing">Инструменты агента не установлены: %1$s</string>
<string name="agent_unqueue">Не отправлять</string>
<string name="agent_attach">Прикрепить</string>
<string name="agent_attach_files">Файлы</string>
<string name="agent_photos_allow">Разрешить доступ к фото</string>
<string name="agent_photos_more">Выбрать ещё фото</string>
<string name="agent_photos_empty">Пока нет фото</string>
<string name="agent_keyboard">Клавиатура</string>
<string name="agent_remove_attachment">Удалить</string>
<string name="agent_model_default">По умолчанию</string>
<string name="agent_effort">Уровень рассуждений</string>
@@ -4246,4 +4251,6 @@
<string name="glasses_shortcut_group">Ярлык в игре</string>
<string name="glasses_show_shortcut">Показывать ярлык Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Показывать плавающую кнопку Smart Glasses поверх игры.</string>
<string name="display_filter_game_profile">Используется профиль %1$s: %2$s</string>
<string name="display_filter_default_profile">Используется профиль по умолчанию: %1$s</string>
</resources>
+7
View File
@@ -1168,6 +1168,11 @@
<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_attach_files">Filer</string>
<string name="agent_photos_allow">Tillåt åtkomst till bilder</string>
<string name="agent_photos_more">Välj fler bilder</string>
<string name="agent_photos_empty">Inga bilder än</string>
<string name="agent_keyboard">Tangentbord</string>
<string name="agent_remove_attachment">Ta bort</string>
<string name="agent_model_default">Standard</string>
<string name="agent_effort">Resonemangsnivå</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Genväg i spelet</string>
<string name="glasses_show_shortcut">Visa Smart Glasses-genväg</string>
<string name="glasses_show_shortcut_hint">Visa den flytande Smart Glasses-knappen ovanpå spelet.</string>
<string name="display_filter_game_profile">Använder profilen %1$s: %2$s</string>
<string name="display_filter_default_profile">Använder standardprofilen: %1$s</string>
</resources>
+7
View File
@@ -1165,6 +1165,11 @@
<string name="agent_tools_missing">ยังไม่ได้ติดตั้งเครื่องมือของเอเจนต์: %1$s</string>
<string name="agent_unqueue">ไม่ต้องส่ง</string>
<string name="agent_attach">แนบ</string>
<string name="agent_attach_files">ไฟล์</string>
<string name="agent_photos_allow">อนุญาตให้เข้าถึงรูปภาพ</string>
<string name="agent_photos_more">เลือกรูปภาพเพิ่ม</string>
<string name="agent_photos_empty">ยังไม่มีรูปภาพ</string>
<string name="agent_keyboard">แป้นพิมพ์</string>
<string name="agent_remove_attachment">นำออก</string>
<string name="agent_model_default">ค่าเริ่มต้น</string>
<string name="agent_effort">ระดับการใช้เหตุผล</string>
@@ -4135,4 +4140,6 @@
<string name="glasses_shortcut_group">ทางลัดในเกม</string>
<string name="glasses_show_shortcut">แสดงทางลัด Smart Glasses</string>
<string name="glasses_show_shortcut_hint">แสดงปุ่ม Smart Glasses แบบลอยทับบนเกม</string>
<string name="display_filter_game_profile">ใช้โปรไฟล์ %1$s: %2$s</string>
<string name="display_filter_default_profile">ใช้โปรไฟล์เริ่มต้น: %1$s</string>
</resources>
+7
View File
@@ -1160,6 +1160,11 @@
<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_attach_files">Dosyalar</string>
<string name="agent_photos_allow">Fotoğraflara erişime izin ver</string>
<string name="agent_photos_more">Daha fazla fotoğraf seç</string>
<string name="agent_photos_empty">Henüz fotoğraf yok</string>
<string name="agent_keyboard">Klavye</string>
<string name="agent_remove_attachment">Kaldır</string>
<string name="agent_model_default">Varsayılan</string>
<string name="agent_effort">Akıl yürütme çabası</string>
@@ -4165,4 +4170,6 @@
<string name="glasses_shortcut_group">Oyun içi kısayol</string>
<string name="glasses_show_shortcut">Smart Glasses kısayolunu göster</string>
<string name="glasses_show_shortcut_hint">Oyun üzerinde yüzen Smart Glasses düğmesini göster.</string>
<string name="display_filter_game_profile">%1$s profili kullanılıyor: %2$s</string>
<string name="display_filter_default_profile">Varsayılan profil kullanılıyor: %1$s</string>
</resources>
+7
View File
@@ -1174,6 +1174,11 @@
<string name="agent_tools_missing">Інструменти агента не встановлено: %1$s</string>
<string name="agent_unqueue">Не надсилати</string>
<string name="agent_attach">Прикріпити</string>
<string name="agent_attach_files">Файли</string>
<string name="agent_photos_allow">Дозволити доступ до фото</string>
<string name="agent_photos_more">Вибрати ще фото</string>
<string name="agent_photos_empty">Поки немає фото</string>
<string name="agent_keyboard">Клавіатура</string>
<string name="agent_remove_attachment">Видалити</string>
<string name="agent_model_default">За замовчуванням</string>
<string name="agent_effort">Рівень міркувань</string>
@@ -4245,4 +4250,6 @@
<string name="glasses_shortcut_group">Ярлик у грі</string>
<string name="glasses_show_shortcut">Показувати ярлик Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Показувати плаваючу кнопку Smart Glasses поверх гри.</string>
<string name="display_filter_game_profile">Використовується профіль %1$s: %2$s</string>
<string name="display_filter_default_profile">Використовується профіль за замовчуванням: %1$s</string>
</resources>
+7
View File
@@ -1165,6 +1165,11 @@
<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_attach_files">Tệp</string>
<string name="agent_photos_allow">Cho phép truy cập ảnh</string>
<string name="agent_photos_more">Chọn thêm ảnh</string>
<string name="agent_photos_empty">Chưa có ảnh</string>
<string name="agent_keyboard">Bàn phím</string>
<string name="agent_remove_attachment">Xóa</string>
<string name="agent_model_default">Mặc định</string>
<string name="agent_effort">Mức độ lập luận</string>
@@ -4135,4 +4140,6 @@
<string name="glasses_shortcut_group">Lối tắt trong trò chơi</string>
<string name="glasses_show_shortcut">Hiển thị lối tắt Smart Glasses</string>
<string name="glasses_show_shortcut_hint">Hiển thị nút Smart Glasses nổi phía trên trò chơi.</string>
<string name="display_filter_game_profile">Đang dùng hồ sơ %1$s: %2$s</string>
<string name="display_filter_default_profile">Đang dùng hồ sơ mặc định: %1$s</string>
</resources>
@@ -1248,6 +1248,11 @@
<string name="agent_tools_missing">智能体工具未安装:%1$s</string>
<string name="agent_unqueue">不发送</string>
<string name="agent_attach">添加附件</string>
<string name="agent_attach_files">文件</string>
<string name="agent_photos_allow">允许访问照片</string>
<string name="agent_photos_more">选择更多照片</string>
<string name="agent_photos_empty">还没有照片</string>
<string name="agent_keyboard">键盘</string>
<string name="agent_remove_attachment">移除</string>
<string name="agent_model_default">默认</string>
<string name="agent_effort">推理强度</string>
@@ -4133,4 +4138,6 @@
<string name="glasses_shortcut_group">游戏内快捷方式</string>
<string name="glasses_show_shortcut">显示 Smart Glasses 快捷方式</string>
<string name="glasses_show_shortcut_hint">在游戏画面上显示悬浮的 Smart Glasses 按钮。</string>
<string name="display_filter_game_profile">正在使用 %1$s 配置:%2$s</string>
<string name="display_filter_default_profile">正在使用默认配置:%1$s</string>
</resources>
@@ -1164,6 +1164,11 @@
<string name="agent_tools_missing">智能體工具未安裝:%1$s</string>
<string name="agent_unqueue">不要傳送</string>
<string name="agent_attach">附加</string>
<string name="agent_attach_files">檔案</string>
<string name="agent_photos_allow">允許存取相片</string>
<string name="agent_photos_more">選擇更多相片</string>
<string name="agent_photos_empty">尚未有相片</string>
<string name="agent_keyboard">鍵盤</string>
<string name="agent_remove_attachment">移除</string>
<string name="agent_model_default">預設</string>
<string name="agent_effort">推理強度</string>
@@ -4133,4 +4138,6 @@
<string name="glasses_shortcut_group">遊戲內捷徑</string>
<string name="glasses_show_shortcut">顯示 Smart Glasses 捷徑</string>
<string name="glasses_show_shortcut_hint">在遊戲畫面上顯示浮動的 Smart Glasses 按鈕。</string>
<string name="display_filter_game_profile">正在使用 %1$s 設定檔:%2$s</string>
<string name="display_filter_default_profile">正在使用預設設定檔:%1$s</string>
</resources>
@@ -1164,6 +1164,11 @@
<string name="agent_tools_missing">智慧代理工具未安裝:%1$s</string>
<string name="agent_unqueue">不要傳送</string>
<string name="agent_attach">附加</string>
<string name="agent_attach_files">檔案</string>
<string name="agent_photos_allow">允許存取相片</string>
<string name="agent_photos_more">選擇更多相片</string>
<string name="agent_photos_empty">還沒有相片</string>
<string name="agent_keyboard">鍵盤</string>
<string name="agent_remove_attachment">移除</string>
<string name="agent_model_default">預設</string>
<string name="agent_effort">推理強度</string>
@@ -4133,4 +4138,6 @@
<string name="glasses_shortcut_group">遊戲內捷徑</string>
<string name="glasses_show_shortcut">顯示 Smart Glasses 捷徑</string>
<string name="glasses_show_shortcut_hint">在遊戲畫面上顯示浮動的 Smart Glasses 按鈕。</string>
<string name="display_filter_game_profile">正在使用 %1$s 設定檔:%2$s</string>
<string name="display_filter_default_profile">正在使用預設設定檔:%1$s</string>
</resources>
+11 -23
View File
@@ -541,28 +541,6 @@
<string name="game_steam_with">Starts with Steam</string>
<string name="game_steam_without">Starts without Steam</string>
<string name="game_res_title">Game resolution</string>
<string name="game_upscaler_title">In-game upscaler</string>
<string name="game_upscaler_off">Off</string>
<string name="game_upscaler_mode_fsr">FSR and XeSS games</string>
<string name="game_upscaler_mode_dlss">DLSS games</string>
<string name="game_upscaler_mode_native">Native FSR 4</string>
<string name="game_upscaler_engine">Upscaler</string>
<string name="game_upscaler_engine_fsr4_lite">FSR 4 Lite</string>
<string name="game_upscaler_engine_fsr4_full">FSR 4</string>
<string name="game_upscaler_engine_xess">XeSS 3</string>
<string name="game_upscaler_engine_basic">Basic temporal</string>
<string name="game_upscaler_engine_sgsr2">Snapdragon GSR 2</string>
<string name="game_upscaler_engine_fsr4_npu">FSR 4 on NPU</string>
<string name="game_upscaler_engine_fsr4_lite_npu">FSR 4 Lite on NPU</string>
<string name="game_upscaler_sharpness">Sharpness</string>
<string name="game_upscaler_sharpness_value">%1$d%%</string>
<string name="game_upscaler_sigfix">DLSS signature fix</string>
<string name="game_upscaler_npu_sync">NPU sync</string>
<string name="game_upscaler_files">Upscaler files</string>
<string name="game_upscaler_files_ready">Ready</string>
<string name="game_upscaler_files_missing">Not downloaded</string>
<string name="game_upscaler_files_downloading">Downloading %1$d%%</string>
<string name="game_upscaler_files_failed">Failed: %1$s</string>
<string name="game_settings_card">Settings</string>
<string name="game_settings_menu_title">%1$s Settings</string>
<string name="game_settings_default">Default</string>
@@ -797,7 +775,6 @@
<string name="hud_metric_network">Network</string>
<string name="hud_metric_resolution">Resolution</string>
<string name="hud_metric_proton">Proton version</string>
<string name="hud_metric_upscale">In-game upscaler</string>
<string name="hud_metric_session">Session time</string>
<string name="hud_metric_clock">Clock</string>
<string name="hud_group_temps">Temperatures</string>
@@ -1247,6 +1224,10 @@
<string name="lab_not_loaded">Not loaded: %1$s</string>
<string name="lab_waiting">Waiting for a restart</string>
<string name="lab_kept">Kept</string>
<plurals name="lab_kept_count">
<item quantity="one">%d kept build</item>
<item quantity="other">%d kept builds</item>
</plurals>
<string name="lab_other_install">For another version</string>
<string name="lab_rebuild">Rebuild</string>
<string name="lab_delete_warning">Deletes this build from the device</string>
@@ -1349,6 +1330,11 @@
<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_attach_files">Files</string>
<string name="agent_photos_allow">Allow photo access</string>
<string name="agent_photos_more">Choose more photos</string>
<string name="agent_photos_empty">No photos yet</string>
<string name="agent_keyboard">Keyboard</string>
<string name="agent_remove_attachment">Remove</string>
<string name="agent_model_default">Default</string>
<string name="agent_effort">Reasoning effort</string>
@@ -2871,6 +2857,8 @@
<string name="display_filter_hint">Shared by Steam and Desktop.</string>
<string name="display_filter_live">Applies live. Shared by Steam and Desktop.</string>
<string name="display_filter_note">FSR, GSR and NIS apply when enlarging the session image. Sharpen only also works without enlargement.</string>
<string name="display_filter_game_profile">Using %1$s profile: %2$s</string>
<string name="display_filter_default_profile">Using Default profile: %1$s</string>
<string name="display_sharpness">Filter sharpness</string>
<string name="display_look_filter">%1$s Sets scaling to %2$s.</string>
<string name="display_match_screen">Match screen (%1$d×%2$d)</string>
@@ -1,77 +0,0 @@
package com.droiddeck.launcher.core
import org.junit.Assert.*
import org.junit.Test
class GameUpscalerTest {
@Test fun aChoiceRoundTripsThroughTheGameEnvironment() {
val choice = GameUpscaler.Choice(GameUpscaler.Mode.DLSS, GameUpscaler.Engine.XESS, 70, npuSync = true, signatureFix = true)
val config = GameUpscaler.withChoice(GameEnvironment.Config(), "42", choice)
assertEquals(choice, GameUpscaler.choice(config, "42"))
assertNull(GameUpscaler.choice(config, "43"))
}
@Test fun offRemovesOnlyTheUpscalerEntries() {
val start = GameEnvironment.Config().withEntries("42", mapOf("FEX_MULTIBLOCK" to "0"))
val on = GameUpscaler.withChoice(start, "42", GameUpscaler.Choice(GameUpscaler.Mode.FSR_XESS))
val off = GameUpscaler.withChoice(on, "42", null)
assertEquals(mapOf("FEX_MULTIBLOCK" to "0"), off.games["42"])
}
@Test fun theSignatureFixIsOnlyKeptForDlss() {
val fsr = GameUpscaler.entries(GameUpscaler.Choice(GameUpscaler.Mode.FSR_XESS, signatureFix = true))
assertFalse(fsr.containsKey(GameUpscaler.SIGFIX))
val dlss = GameUpscaler.entries(GameUpscaler.Choice(GameUpscaler.Mode.DLSS, signatureFix = true))
assertEquals("1", dlss[GameUpscaler.SIGFIX])
}
@Test fun unknownValuesFallBackToDefaults() {
val config = GameEnvironment.Config().withEntries("7", mapOf(
GameUpscaler.MODE to "fsr", GameUpscaler.ENGINE to "bogus", GameUpscaler.SHARPNESS to "250"))
val choice = GameUpscaler.choice(config, "7")!!
assertEquals(GameUpscaler.DEFAULT_ENGINE, choice.engine)
assertEquals(100, choice.sharpness)
assertNull(GameUpscaler.choice(GameEnvironment.Config().withEntries("7", mapOf(GameUpscaler.MODE to "x")), "7"))
}
@Test fun npuEnginesRunOnTheGpuWithoutAnNpu() {
assertEquals(GameUpscaler.Engine.FSR4_FULL_GPU, GameUpscaler.effectiveEngine(GameUpscaler.Engine.FSR4_NPU, false))
assertEquals(GameUpscaler.Engine.FSR4_LITE_GPU, GameUpscaler.effectiveEngine(GameUpscaler.Engine.FSR4_LITE_NPU, false))
assertEquals(GameUpscaler.Engine.FSR4_NPU, GameUpscaler.effectiveEngine(GameUpscaler.Engine.FSR4_NPU, true))
assertEquals(GameUpscaler.Engine.XESS, GameUpscaler.effectiveEngine(GameUpscaler.Engine.XESS, false))
}
@Test fun fsr40NpuChoicesSavedEarlierRunFullFsr4OnTheNpu() {
val config = GameEnvironment.Config().withEntries("7", mapOf(
GameUpscaler.MODE to "fsr", GameUpscaler.ENGINE to "fsr4_0_npu"))
assertEquals(GameUpscaler.Engine.FSR4_NPU, GameUpscaler.choice(config, "7")!!.engine)
assertEquals("fsr4_1_full_npu", GameUpscaler.Engine.FSR4_NPU.id)
assertEquals(GameUpscaler.Engine.SGSR2, GameUpscaler.Engine.byId("sgsr2_gpu"))
}
@Test fun dlssGamesHaveTheSignatureFixOnUnlessSwitchedOff() {
val saved = GameEnvironment.Config().withEntries("7", mapOf(GameUpscaler.MODE to "dlss"))
assertTrue(GameUpscaler.choice(saved, "7")!!.signatureFix)
assertEquals("1", GameUpscaler.entries(GameUpscaler.Choice(GameUpscaler.Mode.DLSS))[GameUpscaler.SIGFIX])
val off = GameUpscaler.entries(GameUpscaler.Choice(GameUpscaler.Mode.DLSS, signatureFix = false))
assertEquals("0", off[GameUpscaler.SIGFIX])
val reread = GameUpscaler.choice(GameEnvironment.Config().withEntries("7", off), "7")!!
assertFalse(reread.signatureFix)
}
@Test fun theControlFileUsesTheLayersKeys() {
assertEquals("enabled=1\nbackend=fsr4_1_lite_gpu\nsharpness=0.55\nnpu_sync=0\n",
GameUpscaler.controlText(GameUpscaler.Engine.FSR4_LITE_GPU, 55, npuSync = false, enabled = true))
}
@Test fun theLayersStatusFileParses() {
val status = GameUpscaler.parseStatus(
"layer=1\nengine=fsr4\nbackend=fsr4_1_lite_gpu\nbackend_tag=FSR4.1-Lite-GPU\nactive=1\nnpu=0\n" +
"render=960x540\noutput=1920x1080\ngpu_us=3250\nhtp_us=0\nreason=ok\nts_ms=99\n")!!
assertTrue(status.active)
assertEquals("FSR4.1-Lite-GPU", status.backendTag)
assertEquals(3.25f, status.gpuMs, 0.001f)
assertEquals("1920x1080", status.output)
assertNull(GameUpscaler.parseStatus("active=1\n"))
}
}
@@ -41,7 +41,18 @@ class DesktopLanguageIndexSourceTest {
context = ApplicationProvider.getApplicationContext()
DownloadSource.init(context)
DownloadSource.setMode(context, DownloadSource.MODE_MIRROR)
}
// Downloads other tests leave running also go through this proxy while it is set, so it is set only around [block].
private fun tunnelsDuring(block: () -> Unit): List<String> {
DownloadSource.setProxy(context, "127.0.0.1:${proxy.localPort}")
tunnels.clear()
try {
block()
} finally {
DownloadSource.setProxy(context, "")
}
return tunnels.toList()
}
@After fun tearDown() {
@@ -51,12 +62,12 @@ class DesktopLanguageIndexSourceTest {
}
@Test fun mirrorModeWouldOtherwiseSendTheIndexThroughAMirror() {
Downloader.downloadString(base + "desktop-kde.i18n.txt")
assertTrue(tunnels.toString(), tunnels.any { host -> DownloadSource.MIRRORS.any { it.host == host } })
val seen = tunnelsDuring { Downloader.downloadString(base + "desktop-kde.i18n.txt") }
assertTrue(seen.toString(), seen.any { host -> DownloadSource.MIRRORS.any { it.host == host } })
}
@Test fun indexIsFetchedOnlyFromGithubInMirrorMode() {
assertNull(DesktopLanguage.fetchIndex(base))
assertEquals(listOf("github.com"), tunnels.toList())
val seen = tunnelsDuring { assertNull(DesktopLanguage.fetchIndex(base)) }
assertEquals(listOf("github.com"), seen)
}
}
@@ -181,6 +181,17 @@ class ProtonExtrasTest {
assertEquals(emptyList<String>(), ProtonExtras.installedIn(File(tools, "missing"), tool("ge")))
}
@Test
fun x86_64BuildsAreNotTakenForTheArm64Tool() {
val tools = temp.newFolder("compatibilitytools.d")
for (name in listOf("DroidDeck-Proton 11-7.5", "DroidDeck-Proton-11-14.2-x86_64")) installTool(tools, name)
File(tools, "DroidDeck-Proton-11-14.2-x86_64/files/lib/wine/x86_64-unix").mkdirs()
File(tools, "DroidDeck-Proton 11-7.5/files/lib/wine/x86_64-unix").mkdirs()
File(tools, "DroidDeck-Proton 11-7.5/files/bin-arm64").mkdirs()
assertEquals(listOf("DroidDeck-Proton 11-7.5"), ProtonExtras.installedIn(tools, tool("droiddeck")))
assertTrue(ProtonExtras.x86_64Build(File(tools, "DroidDeck-Proton-11-14.2-x86_64")))
}
@Test
fun interruptedBuildsAreNotReportedAsInstalled() {
val tools = temp.newFolder("compatibilitytools.d")
@@ -0,0 +1,79 @@
package com.droiddeck.launcher.session
import android.content.Context
import org.json.JSONObject
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 = [28], manifest = Config.NONE)
class SessionPrefsUpscalerTest {
private lateinit var context: Context
@Before fun setUp() {
context = RuntimeEnvironment.getApplication()
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit().clear().commit()
}
@Test fun gameOverridesAreIsolatedAndFallBackToTheGlobalFilter() {
SessionPrefs.setUpscaler(context, 4)
SessionPrefs.setGameUpscaler(context, "12345", 7)
assertEquals(4, SessionPrefs.upscaler(context))
assertEquals(7, SessionPrefs.screenEffectsUpscaler(context, "game:12345"))
assertEquals(4, SessionPrefs.screenEffectsUpscaler(context, "game:54321"))
assertTrue(SessionPrefs.hasGameUpscalerOverride(context, "12345"))
assertFalse(SessionPrefs.hasGameUpscalerOverride(context, "54321"))
assertFalse(SessionPrefs.hasScreenEffectsOverride(context, "game:12345"))
}
@Test fun resettingGameOverrideRestoresTheGlobalFilter() {
SessionPrefs.setUpscaler(context, 3)
SessionPrefs.setGameUpscaler(context, "12345", 6)
SessionPrefs.clearGameUpscaler(context, "12345")
assertFalse(SessionPrefs.hasGameUpscalerOverride(context, "12345"))
assertEquals(3, SessionPrefs.screenEffectsUpscaler(context, "game:12345"))
}
@Test fun screenEffectsUpscalerApiKeepsGameFiltersSeparateFromScreenEffects() {
SessionPrefs.setUpscaler(context, 4)
SessionPrefs.setScreenEffectsUpscaler(context, "game:12345", 8)
assertEquals(8, SessionPrefs.screenEffectsUpscaler(context, "game:12345"))
assertFalse(SessionPrefs.hasScreenEffectsOverride(context, "game:12345"))
}
@Test fun legacyGameFilterOverridesRemainReadableAndCanBeReset() {
val profile = JSONObject().put("upscaler", 6)
val profiles = JSONObject().put("game:12345", profile)
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit()
.putString("screenEffects.profiles", profiles.toString()).commit()
assertTrue(SessionPrefs.hasGameUpscalerOverride(context, "12345"))
assertEquals(6, SessionPrefs.screenEffectsUpscaler(context, "game:12345"))
SessionPrefs.clearGameUpscaler(context, "12345")
assertFalse(SessionPrefs.hasGameUpscalerOverride(context, "12345"))
assertEquals(2, SessionPrefs.screenEffectsUpscaler(context, "game:12345"))
assertFalse(SessionPrefs.hasScreenEffectsOverride(context, "game:12345"))
}
@Test fun deletingGameScreenEffectsProfileClearsUpscalerOverrideEvenWithoutEffectsProfile() {
SessionPrefs.setGameUpscaler(context, "12345", 6)
SessionPrefs.deleteScreenEffectsProfile(context, "game:12345")
assertFalse(SessionPrefs.hasGameUpscalerOverride(context, "12345"))
assertEquals(SessionPrefs.upscaler(context), SessionPrefs.screenEffectsUpscaler(context, "game:12345"))
}
}
@@ -124,6 +124,450 @@ class SessionSuspendControllerTest {
assertEquals(1, fixture.pagedIn.size)
}
@Test fun aSpillWritesThePreloadedGuestsToStorageBeforeTheyStop() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
assertEquals(listOf<String?>("4 0"), fixture.held)
assertTrue(fixture.signals.indexOfFirst { it.signal == URG } < fixture.signals.indexOfFirst { it.signal == STOP })
assertEquals(listOf(1 to 4_000_000L), fixture.spills)
assertTrue(fixture.pagedOut.isEmpty())
assertTrue(fixture.game.threads.all { it.state == 't' })
assertFalse(File(fixture.control.parentFile, ".dd-zram.ack.$GAME").exists())
assertFalse(File(fixture.control.parentFile, ".dd-zram.hold").exists())
}
@Test fun resumeMovesTheCounterBeforeContinuingAndWaitsForTheRestore() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
val before = fixture.signals.size
var called = false
fixture.controller.resume {
// success is reported once the guest has its memory back and has left its tracing stop
assertTrue(it)
assertEquals(listOf(1 to 0), fixture.restores)
assertTrue(fixture.game.threads.none { thread -> thread.state == 't' })
called = true
}
assertTrue(called)
assertEquals(listOf<String?>("1"), fixture.resumeAtContinue)
assertFalse(fixture.signals.drop(before).any { it.signal == URG })
assertEquals(listOf(1 to 0), fixture.restores)
assertTrue(fixture.pagedIn.isEmpty())
assertFalse(File(fixture.control.parentFile, ".dd-zram.restored.$GAME").exists())
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.controller.resume { assertTrue(it) }
assertEquals(listOf<String?>("1", "2"), fixture.resumeAtContinue)
assertEquals(2, fixture.restores.size)
}
@Test fun aRestoreThatOutlastsTheWaitIsWaitedForAgainByTheNextResume() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.restoreDelayMs = 60_000L
fixture.controller.resume { assertFalse(it) }
assertEquals(listOf(1 to 1), fixture.restores)
assertTrue(fixture.game.threads.all { it.state == 't' })
fixture.restoreDelayMs = 0L
var called = false
fixture.controller.resume {
assertTrue(it)
assertTrue(fixture.game.threads.none { thread -> thread.state == 't' })
called = true
}
assertTrue(called)
assertEquals(listOf(1 to 1, 1 to 0), fixture.restores)
}
@Test fun aResumeCountThatCannotBeWrittenFailsWhileASpillHasNotAnswered() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.spillSilent = true
fixture.controller.freeze(pageOut = true, spill = true) { }
File(fixture.control.parentFile, ".dd-zram.resume.new").mkdirs()
fixture.controller.resume { assertFalse(it) }
assertFalse(File(fixture.control.parentFile, ".dd-zram.resume").isFile)
}
@Test fun aSpillThatAnswersAfterTheWaitIsStillRestoredOnResume() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.spillSilent = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.spillSilent = false
fixture.advance(1_000L)
assertTrue(File(fixture.control.parentFile, ".dd-zram.ack.$GAME").isFile)
fixture.controller.resume { assertTrue(it) }
assertEquals(listOf(1 to 0), fixture.restores)
assertTrue(fixture.pagedIn.isEmpty())
assertTrue(fixture.game.threads.none { it.state == 't' || it.state == 'T' })
}
@Test fun aGuestWithoutTheSpillHandlerIsNotWaitedForOnResume() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.handlerReplaced = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.controller.resume { assertTrue(it) }
assertTrue(fixture.restores.isEmpty())
}
@Test fun aSpillThatStartsAfterTheWaitFailsAResumeCountThatCannotBeWritten() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.handlerReplaced = true
fixture.controller.freeze(pageOut = true, spill = true) { }
File(fixture.control.parentFile, ".dd-zram.resume.new").mkdirs()
fixture.controller.resume { assertFalse(it) }
}
@Test fun aSpillThatStartsAfterTheWaitIsReleasedByTheNextCount() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.handlerReplaced = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.startLateSpill()
var called = false
fixture.controller.resume {
assertTrue(it)
assertEquals(listOf(1 to 0), fixture.restores)
assertEquals(4_000_000L, fixture.gameResident)
assertEquals(1, fixture.readBacks)
assertTrue(fixture.game.threads.none { thread -> thread.state == 't' || thread.state == 'T' })
called = true
}
assertTrue(called)
}
@Test fun aLateSpillThatSeesTheNewCountIsCancelledWithoutAReadBack() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.handlerReplaced = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.lateSpillSeesTheCount = true
fixture.startLateSpill()
fixture.controller.resume { assertTrue(it) }
assertEquals(listOf(1 to 0), fixture.restores)
assertEquals(0, fixture.readBacks)
assertEquals(4_000_000L, fixture.gameResident)
assertTrue(fixture.pagedIn.isEmpty())
assertFalse(File(fixture.control.parentFile, ".dd-zram.ack.$GAME").exists())
assertTrue(fixture.game.threads.none { it.state == 't' || it.state == 'T' })
}
@Test fun aHelperThatReadsBackBeforeTheContinueStillResumes() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.restoreDelayMs = 0L
fixture.controller.resume { assertTrue(it) }
assertTrue(fixture.releasedBeforeContinue)
assertEquals(listOf(1 to 0), fixture.restores)
assertTrue(fixture.game.threads.none { it.state == 't' || it.state == 'T' })
}
@Test fun aLateSpillWithoutAnAcknowledgementFailsTheResumeUntilItsHelperLetsGo() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.handlerReplaced = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.ackFails = true
fixture.startLateSpill()
fixture.restoreDelayMs = 5_000L
fixture.controller.resume { assertFalse(it) }
assertTrue(fixture.game.threads.all { it.state == 't' })
fixture.advance(5_000L)
fixture.controller.resume { assertTrue(it) }
assertEquals(1, fixture.readBacks)
assertTrue(fixture.game.threads.none { it.state == 't' || it.state == 'T' })
}
@Test fun aReadBackWhoseMarkerCouldNotBeWrittenEndsWhenTheHelperLetsGo() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.game.tracer = HELPER
fixture.sync()
fixture.markerFails = true
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
val start = fixture.now
fixture.controller.resume { assertTrue(it) }
assertTrue(fixture.now - start < 5_000L)
fixture.controller.freeze { assertTrue(it) }
fixture.controller.resume { assertTrue(it) }
}
@Test fun aLateFallbackDoesNotNeedTheCountWritten() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.spillSilent = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.spillSilent = false
fixture.spillFallsBack = true
fixture.advance(1_000L)
File(fixture.control.parentFile, ".dd-zram.resume.new").mkdirs()
fixture.controller.resume { assertTrue(it) }
assertEquals(1, fixture.pagedIn.size)
assertTrue(fixture.game.threads.none { it.state == 't' || it.state == 'T' })
}
@Test fun aCancelledFreezeWhoseRestoreDoesNotFinishLeavesTheRollbackPending() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.restoreDelayMs = 60_000L
fixture.afterSleep = { if (fixture.spills.isNotEmpty()) fixture.controller.cancelFreeze() }
fixture.controller.freeze(pageOut = true, spill = true) { assertFalse(it) }
assertTrue(fixture.controller.rollbackPending)
assertEquals(listOf(1 to 1), fixture.restores)
fixture.afterSleep = null
fixture.restoreDelayMs = 0L
fixture.controller.resume { assertTrue(it) }
assertFalse(fixture.controller.rollbackPending)
}
@Test fun aSpilledGuestThatEndsWhileReadingBackFailsTheResume() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.restoreDelayMs = 60_000L
fixture.afterSleep = {
if (fixture.signals.any { it.signal == CONT } && fixture.game.threads.first().started == 2000L) {
fixture.game.threads.first().started++
}
}
fixture.controller.resume { assertFalse(it) }
assertTrue(fixture.controller.guestLost)
}
@Test fun aLossWithAnotherSpillStillReadingBackKeepsBothTheRetryAndTheFailure() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.addSecondSpiller()
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.readBackKills = true
fixture.controller.resume { assertFalse(it) }
assertTrue(fixture.controller.guestLost)
assertTrue(fixture.controller.restoreOutstanding)
assertTrue(fixture.other.threads.all { it.state == 't' })
fixture.releaseSecondSpiller()
fixture.controller.resume { assertFalse(it) }
assertTrue(fixture.controller.guestLost)
assertFalse(fixture.controller.restoreOutstanding)
fixture.controller.freeze { assertTrue(it) }
assertFalse(fixture.controller.guestLost)
}
@Test fun aGuestReleasedWithoutItsMarkerThatEndsLaterIsNotLost() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.addSecondSpiller()
fixture.game.tracer = HELPER
fixture.sync()
fixture.markerFails = true
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
val start = fixture.now
fixture.afterSleep = {
if (fixture.now - start >= 3_000L && fixture.game.threads.first().started == 2000L) {
fixture.game.threads.first().started++
}
if (fixture.now - start >= 4_000L && fixture.otherHeld) fixture.releaseSecondSpiller()
}
fixture.controller.resume { assertTrue(it) }
assertFalse(fixture.controller.guestLost)
}
@Test fun anAskedGuestThatStartsAndEndsBeforeItIsTakenIsLost() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.handlerReplaced = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.onAudioResume = {
File(fixture.control.parentFile, ".dd-zram.ack.$GAME").writeText("")
fixture.game.threads.first().started++
fixture.sync()
}
fixture.controller.resume { assertFalse(it) }
assertTrue(fixture.controller.guestLost)
}
@Test fun aGuestLostInACancelledFreezesRollbackStaysLost() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.readBackKills = true
fixture.afterSleep = { if (fixture.spills.isNotEmpty()) fixture.controller.cancelFreeze() }
fixture.controller.freeze(pageOut = true, spill = true) { assertFalse(it) }
assertTrue(fixture.controller.guestLost)
fixture.afterSleep = null
fixture.controller.resume { assertFalse(it) }
assertTrue(fixture.controller.guestLost)
assertFalse(fixture.controller.restoreOutstanding)
}
@Test fun aSpillThatStartsDuringTheResumeAndIsLostFailsIt() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.handlerReplaced = true
fixture.controller.freeze(pageOut = true, spill = true) { }
// after the resume took its snapshot, before it publishes the count
fixture.onAudioResume = {
fixture.startLateSpill()
fixture.readBackKills = true
}
fixture.controller.resume { assertFalse(it) }
assertTrue(fixture.controller.guestLost)
}
@Test fun aGuestThatFellBackLateAndEndedIsNotLost() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.spillSilent = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.onAudioResume = {
File(fixture.control.parentFile, ".dd-zram.ack.$GAME").writeText("0")
fixture.game.threads.forEach { it.state = 'Z' }
fixture.sync()
}
fixture.controller.resume { assertTrue(it) }
assertFalse(fixture.controller.guestLost)
}
@Test fun aSpilledGuestKilledByAFailedReadBackIsLostWhileStillAZombie() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.game.tracer = HELPER
fixture.sync()
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.readBackKills = true
fixture.controller.resume { assertFalse(it) }
assertTrue(fixture.controller.guestLost)
assertTrue(fixture.game.threads.all { it.state == 'Z' })
}
@Test fun theMarkerlessFallbackWaitsForEveryThreadToLeaveTheTrace() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.game.tracer = HELPER
fixture.sync()
fixture.markerFails = true
fixture.workerStaysTraced = true
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
var called = false
fixture.controller.resume {
assertTrue(it)
assertTrue(fixture.workerReleaseAt < 0)
called = true
}
assertTrue(called)
}
@Test fun aRefreezeStopsAGuestThatOnlyItsHelperStillHolds() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.restoreDelayMs = 60_000L
fixture.controller.resume { assertFalse(it) }
val before = fixture.signals.size
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
assertTrue(fixture.signals.drop(before).count { it.pid == GAME && it.signal == STOP } >= 17)
fixture.restoreDelayMs = 0L
fixture.advance(1_000L)
assertTrue(fixture.game.threads.all { it.state == 'T' })
fixture.controller.resume { assertTrue(it) }
assertTrue(fixture.game.threads.none { it.state == 't' || it.state == 'T' })
}
@Test fun aResumeThatCannotPublishItsCountKeepsTheFrozenTimeOwed() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.clock.writeBytes(shift(0L))
fixture.handlerReplaced = true
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
val frozenAt = fixture.now
val blocked = File(fixture.control.parentFile, ".dd-zram.resume.new").apply { mkdirs() }
fixture.now += 90_000L
fixture.controller.resume { assertFalse(it) }
blocked.delete()
fixture.now += 10_000L
val resumedAt = fixture.now
fixture.controller.resume { assertTrue(it) }
assertEquals((resumedAt - frozenAt) * 1_000_000L, shift(fixture.clock))
}
@Test fun aRollbackThatCannotPublishItsCountStaysPendingUntilAResume() {
val fixture = fixture(17)
fixture.control.writeText("0")
val blocked = File(fixture.control.parentFile, ".dd-zram.resume.new").apply { mkdirs() }
fixture.afterSleep = { if (fixture.spills.isNotEmpty()) fixture.controller.cancelFreeze() }
fixture.controller.freeze(pageOut = true, spill = true) { assertFalse(it) }
assertTrue(fixture.controller.rollbackPending)
assertTrue(fixture.resumeAtContinue.isEmpty())
blocked.delete()
fixture.afterSleep = null
fixture.controller.resume { assertTrue(it) }
assertFalse(fixture.controller.rollbackPending)
assertEquals(listOf(1 to 0), fixture.restores)
}
@Test fun aLateFallbackToZramIsReadBack() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.spillSilent = true
fixture.controller.freeze(pageOut = true, spill = true) { }
fixture.spillSilent = false
fixture.spillFallsBack = true
fixture.advance(1_000L)
fixture.controller.resume { assertTrue(it) }
assertEquals(1, fixture.pagedIn.size)
}
@Test fun aGuestThatFellBackToZramResumesWhenTheCountCannotBeWritten() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.spillFallsBack = true
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
File(fixture.control.parentFile, ".dd-zram.resume.new").mkdirs()
fixture.controller.resume { assertTrue(it) }
assertTrue(fixture.game.threads.none { it.state == 't' || it.state == 'T' })
}
@Test fun aRestoreThatFinishedLateDoesNotHoldBackTheNextResume() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.restoreDelayMs = 60_000L
fixture.controller.resume { assertFalse(it) }
fixture.restoreDelayMs = 0L
fixture.advance(1_000L)
fixture.advance(100L)
assertTrue(File(fixture.control.parentFile, ".dd-zram.restored.$GAME").isFile)
fixture.spillFallsBack = true
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
fixture.controller.resume { assertTrue(it) }
}
@Test fun aGuestThatCouldNotSpillIsReadBackFromZram() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.spillFallsBack = true
fixture.controller.freeze(pageOut = true, spill = true) { assertTrue(it) }
assertEquals(listOf(0 to 0L), fixture.spills)
val before = fixture.signals.size
fixture.controller.resume { assertTrue(it) }
assertEquals(listOf(GAME), fixture.signals.drop(before).filter { it.signal == URG }.map { it.pid })
assertTrue(fixture.restores.isEmpty())
assertEquals(1, fixture.pagedIn.size)
}
@Test fun aSpillCutShortByACancelledFreezeIsStillRestored() {
val fixture = fixture(17)
fixture.control.writeText("0")
fixture.afterSleep = { if (fixture.spills.isNotEmpty()) fixture.controller.cancelFreeze() }
fixture.controller.freeze(pageOut = true, spill = true) { assertFalse(it) }
assertEquals(listOf<String?>("1"), fixture.resumeAtContinue)
assertEquals(listOf(1 to 0), fixture.restores)
}
@Test fun theMonitorIsHeldOffWhilePagingOutAndReadingBack() {
val fixture = fixture(17)
fixture.control.writeText("0")
@@ -485,7 +929,7 @@ class SessionSuspendControllerTest {
private fun fixture(count: Int, executor: QueueExecutor = InlineExecutor()) =
Fixture(temporary.newFolder(), temporary.newFolder(), count, executor)
private data class Task(val tid: Int, var started: Long, var state: Char, var cpu: Long = 0)
private data class Task(val tid: Int, var started: Long, var state: Char, var cpu: Long = 0, var tracer: Int? = null)
private data class Group(val pid: Int, var parent: Int, var tracer: Int, val threads: MutableList<Task>)
private data class SentSignal(val pid: Int, val signal: Int)
@@ -493,6 +937,20 @@ class SessionSuspendControllerTest {
val root = Group(ROOT, 9000, 0, mutableListOf(Task(ROOT, 1000, 'S')))
val game = Group(GAME, ROOT, ROOT, MutableList(count) { Task(GAME + it, 2000L + it, 'S') })
val groups = mutableListOf(root, game)
val other = Group(OTHER, ROOT, ROOT, mutableListOf(Task(OTHER, 4000, 'S')))
var otherHeld = false
fun addSecondSpiller() {
groups += other
sync()
}
fun releaseSecondSpiller() {
otherHeld = false
other.threads.forEach { it.state = 'S' }
File(control.parentFile, "${control.name}.restored.$OTHER").writeText("50")
sync()
}
val helpers = mutableListOf<Int>()
val signals = mutableListOf<SentSignal>()
val held = mutableListOf<String?>()
@@ -507,6 +965,7 @@ class SessionSuspendControllerTest {
var emptyGameTasks = false
var rootGone = false
var afterSleep: (() -> Unit)? = null
var onAudioResume: (() -> Unit)? = null
val control = File(tmp, ".dd-zram")
val clock = File(tmp, ".dd-clock")
var clockAtContinue: Long? = null
@@ -522,9 +981,32 @@ class SessionSuspendControllerTest {
var unacknowledged = -1
var handlerStalls = false
var handlerReplaced = false
var spillFallsBack = false
var spillSilent = false
var restoreDelayMs = RESTORE_DELAY_MS
val spills = mutableListOf<Pair<Int, Long>>()
val restores = mutableListOf<Pair<Int, Int>>()
val resumeAtContinue = mutableListOf<String?>()
var lateSpillSeesTheCount = false
var markerFails = false
var workerStaysTraced = false
var workerReleaseAt = -1L
var readBackKills = false
var readBacks = 0
val gameResident get() = gameResidentKb
private var spilling = false
private var spilledBase: String? = null
private var restoring = false
private var restoredPending = false
private var gameStopPending = false
private var countSeenAt = -1L
private var gameContinued = false
var releasedBeforeContinue = false
var ackFails = false
private val resume = File(tmp, ".dd-zram.resume")
private var continuing = false
val controller = SessionSuspendController(
{ rootPid }, { helpers }, { audioSuspends++ }, { audioResumes++ },
{ rootPid }, { helpers }, { audioSuspends++ }, { audioResumes++; onAudioResume?.invoke() },
proc, ::signal, ::threadSignal, ::sleep, { now }, executor,
zramControl = control,
clockControl = clock,
@@ -535,12 +1017,15 @@ class SessionSuspendControllerTest {
this.unacknowledged = unacknowledged
},
pagedIn = { processes, swap, swapBefore, _, _ -> pagedIn += Triple(processes, swap, swapBefore) },
spilled = { processes, spilledKb, _, _ -> spills += processes to spilledKb },
restored = { processes, unacknowledged, _, _ -> restores += processes to unacknowledged },
)
init { sync() }
private fun signal(pid: Int, signal: Int) {
signals += SentSignal(pid, signal)
helperStep()
val request = if (signal == URG) File(control.parentFile, "${control.name}.hold").takeIf { it.isFile }?.readText() else null
if (signal == URG) held += request
val group = groups.first { it.pid == pid }
@@ -550,14 +1035,34 @@ class SessionSuspendControllerTest {
else group.threads.firstOrNull {
it.state !in listOf('T', 't', 'Z', 'X') && !(neverStop && it == game.threads.last())
}?.state = 't'
} else if (signal == URG && pid == OTHER) {
// a second guest that spills at once and whose helper reads back only when the test lets it
if (request?.startsWith("4") == true) {
File(control.parentFile, "${control.name}.ack.$OTHER").writeText("1000")
otherHeld = true
other.threads.forEach { it.state = 't' }
}
} else if (signal == URG) {
if (request == "0") { pagingOut = false; pagingIn = true } else pagingOut = true
if (request?.startsWith("4") == true) {
if (!handlerReplaced) {
spilling = true
File(control.parentFile, "${control.name}.ack.$GAME").writeText("")
}
spilledBase = request.substringAfter(' ', "0").trim()
}
else if (request == "0") { pagingOut = false; pagingIn = true } else pagingOut = true
} else if (signal == CONT) {
if (pid == GAME) resumeAtContinue += resume.takeIf { it.isFile }?.readText()
if (clockAtContinue == null && clock.isFile) {
clockAtContinue = ByteBuffer.wrap(clock.readBytes()).order(ByteOrder.LITTLE_ENDIAN).long
}
continuing = true
if (!(pid == GAME && blockGameContinue)) group.threads.forEach { if (it.state != 'Z') it.state = 'S' }
if (pid == GAME) gameStopPending = false
if (pid == GAME) gameContinued = true
// a spilled guest stays in its tracing stop until its helper has read the memory back
if (!(pid == GAME && (blockGameContinue || parked)) && !(pid == OTHER && otherHeld)) {
group.threads.forEach { if (it.state != 'Z') it.state = 'S' }
}
}
sync()
}
@@ -565,14 +1070,88 @@ class SessionSuspendControllerTest {
private fun threadSignal(pid: Int, tid: Int, signal: Int) {
signals += SentSignal(pid, signal)
val task = groups.first { it.pid == pid }.threads.first { it.tid == tid }
// held by the helper's trace: the stop stays pending until the helper detaches
if (signal == STOP && pid == GAME && parked && task.state == 't') gameStopPending = true
if (signal == STOP && task.state !in listOf('T', 't', 'Z', 'X') && !(neverStop && task == game.threads.last())) {
task.state = 't'
}
sync()
}
private val parked get() = spilling || restoring
private fun releaseGame() {
countSeenAt = -1L
game.threads.forEach { if (it.state != 'Z') it.state = if (gameStopPending) 'T' else 'S' }
}
fun advance(millis: Long) = sleep(millis)
// the handler takes the spill request only now, after the controller stopped waiting for it
fun startLateSpill() {
handlerReplaced = false
spilling = true
if (!ackFails) File(control.parentFile, "${control.name}.ack.$GAME").writeText("")
}
// The helper reads back as soon as it sees a new count, SIGCONT or not; it detaches first and publishes
// its marker on a later step.
private fun helperStep() {
val count = resume.takeIf { it.isFile }?.readText()?.trim() ?: "0"
if (restoredPending) {
restoredPending = false
if (!markerFails) File(control.parentFile, "${control.name}.restored.$GAME").writeText("120")
}
if (workerReleaseAt in 0..now) {
game.threads.last().tracer = null
workerReleaseAt = -1L
}
if (!restoring || count == spilledBase) return
if (countSeenAt < 0) {
countSeenAt = now
gameContinued = false
}
if (now - countSeenAt < restoreDelayMs) return
restoring = false
if (readBackKills) {
// the helper kills its owner on a failed read-back; nobody has reaped it yet
game.tracer = 0
game.threads.forEach { it.state = 'Z' }
countSeenAt = -1L
return
}
readBacks++
gameResidentKb = 4_000_000L
if (markerFails) game.tracer = 0
if (markerFails && workerStaysTraced) {
game.threads.last().tracer = HELPER
workerReleaseAt = now + 3_000L
}
if (!gameContinued) releasedBeforeContinue = true
releaseGame()
restoredPending = true
}
private fun sleep(millis: Long) {
now += millis
val count = resume.takeIf { it.isFile }?.readText()?.trim() ?: "0"
if (spilling && !spillSilent) {
spilling = false
val ack = File(control.parentFile, "${control.name}.ack.$GAME")
if (lateSpillSeesTheCount && count != spilledBase) {
ack.writeText("-2")
releaseGame()
} else if (spillFallsBack) {
gameSwapKb += gameResidentKb
gameResidentKb = 0L
ack.writeText("0")
} else {
if (!ackFails) ack.writeText(gameResidentKb.toString())
gameResidentKb = 0L
restoring = true
}
}
helperStep()
if (pagingOut && !handlerReplaced) {
File(control.parentFile, "${control.name}.ack.$GAME").apply { if (!exists()) writeText("") }
}
@@ -591,7 +1170,7 @@ class SessionSuspendControllerTest {
gameResidentKb += moved
if (gameSwapKb == 0L) pagingIn = false
}
if (root.threads.first().state != 'T' && !continuing) game.threads.forEach {
if (root.threads.first().state != 'T' && !continuing && !parked) game.threads.forEach {
if (it.state != 'Z') { it.state = 'S'; it.cpu++ }
}
afterSleep?.invoke()
@@ -611,7 +1190,7 @@ class SessionSuspendControllerTest {
"TracerPid: ${group.tracer}\n" +
if (group == game) "VmRSS:\t$gameResidentKb kB\nVmSwap:\t$gameSwapKb kB\n" else "",
)
if (group == game) File(dir, "maps").writeText("7f00000000-7f00001000 r-xp 00000000 fe:05 42 /usr/local/lib/libddsession.so\n")
if (group == game || group == other) File(dir, "maps").writeText("7f00000000-7f00001000 r-xp 00000000 fe:05 42 /usr/local/lib/libddsession.so\n")
val taskDir = File(dir, "task")
if (group == game && missingGameTasks) { taskDir.deleteRecursively(); continue }
taskDir.mkdirs()
@@ -619,6 +1198,7 @@ class SessionSuspendControllerTest {
for (task in group.threads) {
val entry = File(taskDir, task.tid.toString()).apply { mkdirs() }
File(entry, "stat").writeText(stat(group, task))
File(entry, "status").writeText("TracerPid: ${task.tracer ?: group.tracer}\n")
}
}
}
@@ -661,5 +1241,8 @@ class SessionSuspendControllerTest {
const val STOP = 19
const val CONT = 18
const val URG = 23
const val RESTORE_DELAY_MS = 300L
const val HELPER = 300
const val OTHER = 400
}
}
@@ -5,6 +5,21 @@ import org.junit.Assert.assertTrue
import org.junit.Test
class SessionVisibilityPolicyTest {
@Test fun attachmentPickerKeepsTheDockedDrawerAliveDuringActivityStop() {
assertFalse(SessionVisibilityPolicy.shouldCloseSecondScreenOnStop(
screenOff = false, dockedDrawerOpen = true, attachmentPickerOpen = true,
))
assertTrue(SessionVisibilityPolicy.shouldCloseSecondScreenOnStop(
screenOff = false, dockedDrawerOpen = true, attachmentPickerOpen = false,
))
assertTrue(SessionVisibilityPolicy.shouldCloseSecondScreenOnStop(
screenOff = false, dockedDrawerOpen = false, attachmentPickerOpen = true,
))
assertFalse(SessionVisibilityPolicy.shouldCloseSecondScreenOnStop(
screenOff = true, dockedDrawerOpen = false, attachmentPickerOpen = false,
))
}
@Test fun handsetScreenStateControlsActivityOnDefaultDisplay() {
assertFalse(SessionVisibilityPolicy.isHidden(true, true, true, false))
assertTrue(SessionVisibilityPolicy.isHidden(true, false, true, true))
@@ -0,0 +1,95 @@
package com.droiddeck.launcher.session
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class SuspendRecoveryTest {
@Test fun theFirstAttemptIsDueAtOnceAndLaterOnesBackOff() {
val recovery = SuspendRecovery(maxAttempts = 3, firstDelayMs = 1_000L)
assertTrue(recovery.due(0L))
assertEquals(1_000L, recovery.failed(0L))
assertFalse(recovery.due(999L))
assertTrue(recovery.due(1_000L))
assertEquals(2_000L, recovery.failed(1_000L))
assertFalse(recovery.due(2_999L))
assertTrue(recovery.due(3_000L))
}
// The service's loop: every policy pass (a 250 ms queued-launch poll, a display event or a scheduled retry)
// starts a resume unless the recovery holds it; a failed resume schedules the next pass.
private class Service(val recovery: SuspendRecovery = SuspendRecovery()) {
var now = 0L
var suspended = true
var counterWritable = false
var resumes = 0
val scheduled = sortedSetOf<Long>()
fun pass() {
if (!suspended || recovery.holds(true, now)) return
resumes++
if (counterWritable) {
suspended = false
recovery.reset()
scheduled.clear()
} else {
recovery.failed(now)?.let { scheduled += now + it }
}
}
// Only a scheduled retry or a poll runs a pass; time with neither runs nothing.
fun runUntil(end: Long, pollMs: Long? = null) {
while (true) {
val nextPoll = pollMs?.let { now - now % it + it } ?: Long.MAX_VALUE
val next = minOf(nextPoll, scheduled.firstOrNull() ?: Long.MAX_VALUE)
if (next > end) break
now = next
scheduled.remove(next)
pass()
}
now = end
}
}
@Test fun queuedLaunchPollsCannotExceedTheRetryBudget() {
val service = Service()
service.pass()
service.runUntil(600_000L, pollMs = 250L)
assertEquals(5, service.resumes)
assertTrue(service.suspended)
}
@Test fun aScheduledRetryResumesOnceTheCountCanBeWrittenWithoutAnotherEvent() {
val service = Service()
service.pass()
assertEquals(1, service.resumes)
assertEquals(listOf(5_000L), service.scheduled.toList())
service.counterWritable = true
service.runUntil(4_999L)
assertTrue(service.suspended)
service.runUntil(5_000L)
assertFalse(service.suspended)
assertEquals(2, service.resumes)
}
@Test fun nothingResumesWithoutAScheduledRetryOrAnEvent() {
val service = Service(SuspendRecovery(maxAttempts = 1))
service.pass()
assertTrue(service.scheduled.isEmpty())
service.counterWritable = true
service.runUntil(600_000L)
assertTrue(service.suspended)
assertEquals(1, service.resumes)
}
@Test fun attemptsAreBoundedUntilAResumeSucceeds() {
val recovery = SuspendRecovery(maxAttempts = 2, firstDelayMs = 1_000L)
recovery.failed(0L)
assertNull(recovery.failed(1_000L))
assertFalse(recovery.due(1_000_000L))
recovery.reset()
assertTrue(recovery.due(0L))
}
}
@@ -1,37 +0,0 @@
package com.droiddeck.launcher.session
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
class UpscaleBridgeVersionTest {
@get:Rule val tmp = TemporaryFolder()
private fun tree(name: String, nvngx: String): File {
val dir = tmp.newFolder(name)
for (file in UpscaleComponent.BRIDGE_FILES) {
File(dir, file).apply { parentFile?.mkdirs() }.writeText(if (file.endsWith("/nvngx.dll")) nvngx else file)
}
return dir
}
@Test fun aChangedDllWithTheSameSizeAndDateIsANewVersion() {
val old = tree("old", "aaaa")
val new = tree("new", "bbbb")
for (file in UpscaleComponent.BRIDGE_FILES) {
File(old, file).setLastModified(0)
File(new, file).setLastModified(0)
}
assertNotEquals(UpscaleComponent.localVersion(old), UpscaleComponent.localVersion(new))
}
@Test fun theSameFilesWithOtherDatesAreTheSameVersion() {
val a = tree("a", "same")
val b = tree("b", "same")
File(b, UpscaleComponent.BRIDGE_FILES.first()).setLastModified(1_000_000)
assertEquals(UpscaleComponent.localVersion(a), UpscaleComponent.localVersion(b))
}
}
@@ -1,42 +0,0 @@
package com.droiddeck.launcher.session
import java.io.File
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
class UpscaleComponentNpuTest {
@get:Rule val tmp = TemporaryFolder()
private val runtime = listOf("libQnnHtp.so", "libQnnHtpPrepare.so", "libQnnSystem.so")
private fun vendor(libs: List<String>, listed: List<String> = libs): Pair<File, File> {
val dir = tmp.newFolder("lib64")
libs.forEach { File(dir, it).writeText("") }
val list = tmp.newFile("public.libraries.txt")
list.writeText("# vendor libraries apps may load\n" + listed.joinToString("\n") { "$it 64" } + "\n")
return dir to list
}
@Test fun thePhonesOwnRuntimeNamesItsHtpGeneration() {
val (dir, list) = vendor(runtime + listOf("libQnnHtpV85Stub.so", "libcdsprpc.so"))
assertEquals("v85", UpscaleComponent.systemNpuArch(dir, list))
}
@Test fun librariesTheVendorDoesNotOfferToAppsDoNotCount() {
val libs = runtime + "libQnnHtpV85Stub.so"
val (dir, list) = vendor(libs, listed = libs - "libQnnHtpPrepare.so")
assertNull(UpscaleComponent.systemNpuArch(dir, list))
}
@Test fun twoStubGenerationsAreAmbiguous() {
val (dir, list) = vendor(runtime + listOf("libQnnHtpV79Stub.so", "libQnnHtpV81Stub.so"))
assertNull(UpscaleComponent.systemNpuArch(dir, list))
}
@Test fun noPublicLibraryListMeansNoSystemRuntime() {
assertNull(UpscaleComponent.systemNpuArch(tmp.newFolder("empty"), File(tmp.root, "missing.txt")))
}
}
@@ -3,24 +3,31 @@ package com.droiddeck.launcher.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.InputMode
import androidx.compose.ui.input.InputModeManager
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.platform.LocalInputModeManager
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.semantics.SemanticsActions
import androidx.compose.ui.test.assertIsFocused
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.getUnclippedBoundsInRoot
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performKeyInput
import androidx.compose.ui.test.performSemanticsAction
import androidx.compose.ui.test.pressKey
import androidx.compose.ui.test.requestFocus
import com.droiddeck.launcher.R
import com.droiddeck.launcher.session.ComponentsManager
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -67,6 +74,29 @@ class ComponentDownloadsDrawerTest {
assertEquals(listOf(nightly), requested)
}
@Config(qualifiers = "w800dp-h800dp")
@Test fun nightlySelectionSurvivesCrossingTheColumnThreshold() {
val stable = ComponentsManager.CatalogItem("dxvk-3.1.1-linux.wcp", "dxvk", "Dxvk-Linux", "https://github.com/example/s", 100, "sha256:test")
val nightly = ComponentsManager.CatalogItem("DD-dxvk-3.1.1+153-nightly.wcp", "dxvk", ComponentsManager.DD_NIGHTLY, "https://github.com/example/n", 100, "sha256:test")
val twoColumns = mutableStateOf(false)
lateinit var menu: MenuHost
show(catalog = listOf(stable, nightly), twoColumns = twoColumns, captureHost = { menu = it })
val chooser = compose.onNodeWithTag("cmp-download-dxvk")
val nightlyRow = compose.onNodeWithText(nightly.file.removeSuffix(".wcp"))
val narrowLeft = chooser.getUnclippedBoundsInRoot().left
chooser.performSemanticsAction(SemanticsActions.OnClick)
compose.onNodeWithText(RuntimeEnvironment.getApplication().getString(R.string.comp_channel_nightly)).performClick()
nightlyRow.assertExists()
compose.runOnIdle { menu.open = null; twoColumns.value = true }
assertTrue(chooser.getUnclippedBoundsInRoot().left > narrowLeft)
chooser.performSemanticsAction(SemanticsActions.OnClick)
nightlyRow.assertExists()
compose.runOnIdle { menu.open = null; twoColumns.value = false }
assertEquals(narrowLeft, chooser.getUnclippedBoundsInRoot().left)
chooser.performSemanticsAction(SemanticsActions.OnClick)
nightlyRow.assertExists()
}
@Test fun controllerPicksNightlyOnItsTabThenDownloadsItFromTheRow() {
val stable = ComponentsManager.CatalogItem("dxvk-3.1.1-linux.wcp", "dxvk", "Dxvk-Linux", "https://github.com/example/s", 100, "sha256:test")
val nightly = ComponentsManager.CatalogItem("DD-dxvk-3.1.1+153-nightly.wcp", "dxvk", ComponentsManager.DD_NIGHTLY, "https://github.com/example/n", 100, "sha256:test")
@@ -107,18 +137,28 @@ class ComponentDownloadsDrawerTest {
checking: Boolean = false,
onRefresh: () -> Unit = {},
onDownload: (ComponentsManager.CatalogItem) -> Unit = {},
twoColumns: State<Boolean>? = null,
captureHost: (MenuHost) -> Unit = {},
) {
compose.setContent {
inputMode = LocalInputModeManager.current
DroidDeckTheme {
Column(Modifier.verticalScroll(rememberScrollState())) {
ComponentDownloadsDrawerGroup(
host = rememberMenuHost(), catalog = catalog, catalogAt = 0,
checking = checking,
packages = listOf(ComponentsManager.Package(stored.file, "dxvk", "2.3", "", 100)),
downloads = downloads, onRefresh = onRefresh, onDownload = onDownload,
track = { Modifier.testTag(it) },
)
val host = rememberMenuHost()
captureHost(host)
val content: @androidx.compose.runtime.Composable () -> Unit = {
ComponentDownloadsDrawerGroup(
host = host, catalog = catalog, catalogAt = 0,
checking = checking,
packages = listOf(ComponentsManager.Package(stored.file, "dxvk", "2.3", "", 100)),
downloads = downloads, onRefresh = onRefresh, onDownload = onDownload,
track = { Modifier.testTag(it) },
)
}
if (twoColumns == null) content() else DrawerColumns(twoColumns.value) {
SettingsGroup("Profile") { Text("Profile settings") }
content()
}
}
}
}
@@ -0,0 +1,48 @@
package com.droiddeck.launcher.ui
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.height
import androidx.compose.material3.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.getUnclippedBoundsInRoot
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.unit.dp
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
@Config(sdk = [28], qualifiers = "w800dp-h600dp")
class DrawerColumnsTest {
@get:Rule val compose = createRobolectricComposeRule()
@Test fun theComponentNoteStaysInItsGroupAndSixGroupsSplitEvenly() {
val note = "Component note"
val componentRow = "Component row"
compose.setContent {
DroidDeckTheme {
DrawerColumns(two = true) {
repeat(3) { index -> Box(Modifier.height(32.dp).testTag("left-$index")) }
DrawerComponentSettingsGroup(note) { Text(componentRow) }
repeat(2) { index -> Box(Modifier.height(32.dp).testTag("right-$index")) }
}
}
}
val left = (0..2).map { compose.onNodeWithTag("left-$it").getUnclippedBoundsInRoot() }
val right = (0..1).map { compose.onNodeWithTag("right-$it").getUnclippedBoundsInRoot() }
val group = compose.onNodeWithText(componentRow).getUnclippedBoundsInRoot()
val footer = compose.onNodeWithText(note).getUnclippedBoundsInRoot()
assertTrue(left.all { it.left == left.first().left })
assertTrue(right.all { it.left == right.first().left && it.left > left.first().left })
assertTrue(group.left >= right.first().left)
assertTrue(footer.left >= right.first().left)
assertTrue(footer.top >= group.bottom)
assertTrue(right.first().top >= footer.bottom)
assertTrue(left.zipWithNext().all { (first, next) -> first.bottom <= next.top })
}
}
+54
View File
@@ -0,0 +1,54 @@
# Easy Anti-Cheat and BattlEye
On a Steam Deck, Proton loads Valve's anti-cheat runtimes (Proton EasyAntiCheat Runtime, app 1826330, and
Proton BattlEye Runtime, app 1161040). Their bridge libraries are x86 only, so the ARM64 DroidDeck-Proton
cannot load them. Games that need them run an x86-64 DroidDeck-Proton under FEX instead.
## Routing
The Proton launchers (`steam-compatibility`: the built-in DroidDeck-Proton launcher and the wrapper put around
every tool in `compatibilitytools.d`) check each `run` and `waitforexitandrun` before any ARM64 setup:
- **Condition.** The game folder (`STEAM_COMPAT_INSTALL_PATH`, three levels deep) holds one of
`EasyAntiCheat/Settings.json`, `easyanticheat_x64.so`, `BEClient_x64.so` or `BEService_x64.exe`. No
title, app ID or device list is involved.
- **Chosen tool.** Only launches through DroidDeck's own Proton (the built-in launcher or a `DroidDeck-Proton*`
folder) are moved. A game set to any other tool, such as GE-Proton, Bionic or Valve's Proton, in DroidDeck or
in Steam's Properties, runs on that tool and the launcher logs that it was chosen.
- **Tool.** The newest `compatibilitytools.d/DroidDeck-Proton*` whose layout is x86-64
(`files/lib/wine/x86_64-unix`, no `files/bin-arm64`).
- **Runtime.** `PROTON_EAC_RUNTIME` or `PROTON_BATTLEYE_RUNTIME` when it already points at a folder with the
bridge libraries, otherwise the runtime's folder in any Steam library.
- **Launch.** `droiddeck-fex proton <tool>/proton <verb> <args>`: FEX with the Steam Linux Runtime rootfs,
keeping the game's own `STEAM_COMPAT_DATA_PATH` prefix.
Without the x86-64 tool or the runtime files the launch stays on ARM64 and the launcher logs why.
`DROIDDECK_ANTICHEAT=off` in the game's launch options keeps it on ARM64. Picking the x86-64 tool for a
game in Steam always runs it under FEX.
## Why the x86-64 build needs its own Wine patches
Android kernels use 39-bit user address spaces. Easy Anti-Cheat's launcher maps fixed memory at
`0x7001_0000_0000`, which FEX serves from emulated guest pages (`tools/fex/patches/0027`). Exclusive load and store pairs on that
memory are emulated as a compare-and-swap, so hosts without LSE atomics work too. `tools/fex/probes/guest-high-memory.c`
checks loads, stores, atomics, iovec system calls, `madvise` and code written through a high alias. The x86-64 Wine
in DroidDeck-Proton carries `ntdll-fixed-allocations-above-host-address-limit.patch` (fixed mappings above
the host limit go to the emulator) and `ntdll-keep-libc-in-native-syscall-dispatch-range.patch` (the
re-armed syscall user dispatch range keeps libc native). Stock x86-64 Proton stops after "Hack native
syscalls" on the same game.
Easy Anti-Cheat's launcher attaches to the game with ptrace, stops it on a `rt_sigprocmask` call, runs its
own loader and restores the registers it saved at the stop. The call then returns `ENOSYS` without writing
the old mask, as it does on a desktop kernel. `ntdll-retry-blocking-signals-dropped-by-a-tracer.patch`
retries the block once when it fails, so Wine never restores an uninitialised mask that blocks `SIGSYS`.
## The container's procfs
Android mounts `/proc` with `hidepid=invisible,gid=3009`, and Easy Anti-Cheat refuses that mount with
launch error 261. Without root, user namespaces or PID namespaces, no procfs instance without those options
can be mounted. Every program in the container runs as the app's user and already sees all of the
container's processes, as it would in a PID-namespaced sandbox on a desktop, so FEX's emulated
`/proc/<pid>/mounts` and `/proc/<pid>/mountinfo` show the proc mount without `hidepid=`, `gid=` and
`subset=` (`tools/fex/patches/0029`). Only x86 programs under FEX see this view; every other line of the
table is the host's. Processes of other Android users stay hidden, as host processes do from a desktop
sandbox.
+16
View File
@@ -97,6 +97,22 @@ out, and resuming reads it back when available memory is at least twice what tho
have in swap at that moment and, after it, 1 GiB or a tenth of RAM, whichever is larger, stays
available.
## Writing a sleeping session to storage
With the `diskSpill` session pref on, the suspend for sleep writes each preloaded process's
private memory to storage instead of zram (request `4`). The preload's worker starts a helper
process that shares the process's memory, stops every other thread with ptrace (which also holds
threads that block every signal, as Mesa's queue threads do, and which `SIGCONT` does not undo),
writes readable private anonymous memory to an unlinked file next to the control file, drops it,
and answers the kB it wrote in `/tmp/.dd-zram.ack.<pid>`. Regions registered with userfaultfd,
locked or I/O memory and the preload's own memory stay. The app adds one to
`/tmp/.dd-zram.resume` before it continues any process; the helper then reads everything back
(through `/proc/<pid>/mem` where the pages are not writable), answers `/tmp/.dd-zram.restored.<pid>`
and lets the threads go. A process that cannot be traced answers `0` and pages out to zram instead.
On an AYN Thor with Bully at its menu, 30 processes wrote 1,227 MB in 2.1 seconds and read it
back in 1.3 seconds; system anonymous memory fell from 2.53 to 1.21 GB while asleep.
## Threads
When a worker can be started, page-out runs outside the game's threads. The preload's signal
+4 -3
View File
@@ -216,9 +216,10 @@ alone would then read as an installed client.
NullReferenceException, internal CLR errors). A writable mapping or mprotect now write-protects the
overlapping part of any alias that is already executable, so the first write faults and invalidates.
`FEX_SMCCHECKS=full` was the only workaround; no setting is needed with the patch.
- `0007-cmake-install-code-without-depends`: CMake 4.5 rejects the `DEPENDS` argument FEX passes to
`install(CODE ...)` for the guest thunk libraries, so builds with host thunks stopped at configure.
The guest libraries are external projects in the default build, which `install` already follows.
- `0007-cmake-install-code-without-depends` (`Fixed-upstream: FEX-2612`): CMake 4.5 rejects the
`DEPENDS` argument FEX passes to `install(CODE ...)` for the guest thunk libraries, so builds with
host thunks stopped at configure. The guest libraries are external projects in the default build,
which `install` already follows.
- `0008-signal-return-restores-syscall-state`: a guest `rt_sigreturn` is a system call, so FEX's
syscall stub marks every static register as spilled (`InSyscallInfo = 0xFFFF`). When the handler
left RIP alone, the return resumed the interrupted JIT code without passing the stub's reset, and
-132
View File
@@ -7,133 +7,6 @@ the timeline, then lessons and backlog. Companion to the README (what the app *d
---
## 2026-12-04 - `feat/neural-upscaler`: Winlator-NeuralScale r5 ported, non-root parts only (CI running)
- **Why:** upstream r5 (`71c140d9`) adds full FSR 4.1 on the NPU, a ghosting fix, S8/U8 Lite graphs, Snapdragon GSR 2
and D3D11 DLSS. The user asked for those five and nothing that needs root.
- **Built:** `74ece6c8` = three-way merge of layer + bridges (base `a0ab6b0f`), new `sgsr2_gpu.c` + shaders,
`wl_dxvk_interop.h`; data files re-pinned to `71c140d9` (89 files, sha256); new engine `sgsr2_gpu`, NPU engine id
`fsr4_1_full_npu` (saved `fsr4_0_npu` maps to it: FSR 4.0 is gone upstream); XeSS 3 kept (upstream maps `xess` to
FSR 3 and dropped Intel's runtime in `cb3ae04e`; we still fetch it from `a0ab6b0f`); NPU detection stays ours
(`DROIDDECK_UPSCALE_NPU`), upstream's SoC list removed; full-FSR-4-on-Turnip guard now opt-in
(`DROIDDECK_UPSCALE_FULL_OFF_ON_TURNIP=1`). Not ported: RootPerfManager, RootThermal*, GPU clock floor, bypass charging.
- **Checked locally:** all 8 layer files compile and link for Android (clang, Khronos headers, -Wall clean); the
glibc stub variant compiles; `tools/tests/test_game_environment.py` 231 OK (isolated HOME). Bridge DLLs: CI only.
- **CI:** Build APK 47450218949 (`d6f8736e`) FAILED in "Prepare verified components": the glibc layer build has no
`sys/system_properties.h` (upstream r5 include; my local check compiled with Android headers, so it missed it).
Fix `1a621bcf` (include dropped, heartbeat write checked); `build-glibc.sh` now run locally with the container's gcc
= builds, 0 warnings. Rerun Build APK 47450693166 (`23621838`) FAILED at the bridges: `nvngx.dll` did not link
(merge kept our old D3D11 `PopulateParameters` line calling the removed "DLSS unavailable" helper). I had wrongly
read a cache-hash line in run 1 as "bridges built". Fix in the next commit; all six DLLs now built locally with
mingw-w64 13.2 (`tools/upscale/bridges/build.sh`), exports match.
- **CI run 3:** Build APK 47451847785 GREEN on `e67bd76e` (= `379198e4` code + the debuggable-only commit): layer glibc
built, 6 bridges match their exports, APK compiled. App unit tests (separate workflow) 47452868772 on `379198e4`:
5512 tests, 0 failures (GameUpscalerTest 8, UpscaleComponentNpuTest 4).
- **Installed (user yes, 19:23 EST):** Red Magic 12 Pro, pubg variant signed b241ea7d, installed sha256 `65e09d96`;
the 24 new bridge DLLs copied to the app's external `droiddeck-upscale/bridges`.
- **Bug found while staging:** the local-copy bridge stamp is `local-<libxess size>-<mtime>`; CI DLLs have mtime 0 and
libxess.dll kept its size (31232), so the app would keep the old DLLs. Test worked around by removing the staged
`.pack` (backup `.pack.bak-r5`); fix = stamp from the files' contents.
- **First run (XeSS DX12 demo, 19:27 EST):** menu lists Snapdragon GSR 2 and FSR 4 on NPU; Full FSR 4.1 S8 graph compiled
on the phone's V85 NPU in 2.65 s and ran zero-copy (GPU 6.5 ms + NPU 5.4 ms, 960x540 to 1080p); the depth stand-in
for depth-less games logged. Most status rows were junk: the game still loaded the OLD bridge DLLs, because
`ensure()` staged only when no DLLs were staged. Fix `aabacc10` (re-stage when present, content-hash stamp, test).
For this test the 24 new DLLs were copied into the rootfs by hand (run-as), hashes == CI.
- **CI:** Build APK 47455548997 (`50864970` = `aabacc10` + debuggable commit), unit tests 47455552638.
- **Device results (19:37-19:58 EST, new DLLs):** XeSS DX12 round: every engine runs (Full NPU sync 4.6+3.3 ms,
Full GPU 27.1 ms, Lite NPU 5.0+4.9, Lite GPU 7.2, SGSR 2 1.8, FSR 3 3.3, XeSS 11.6), BUT Full FSR 4.1 shows a black
picture in DX12: 0 coloured pixels in 9/9 shots (`/root/src/npu-rm/tools/pngstat.py`), others 28-32k. XeSS Vulkan
sample: Full shows the picture (GPU and NPU). DLSS sample with `-d3d11`: same NGX GetFeatureRequirements
PlatformError as D3D12, raised before our bridge (D3D11 DLSS untested).
- **Fixes:** `83de9e38` guard at dispatch: D3D12 frames on Turnip -> Lite (`FULL_ON_TURNIP=1` forces Full);
`2446d48e` test switches `FULL_DIRECT_OUT=0` / `FULL_AUTO_EXPOSURE=0`. Prime suspect: the Tier 1.1 direct write
into the game's output, which only D3D12 frames take (exactly 1920x1080 output). Upstream validated DX12 only with
Cyberpunk 2077 (README).
- **CI:** 47457143185 failed (flaky test_dircache_preload + IME download reset), cancelled; 47459802031 (`2446d48e`)
green after a rerun of the IME download step. Staged APK sha256 `6f267e61`; user said "device is yours".
- **Picture tests on `2446d48e` (installed 20:36 EST, `/root/src/npu-rm/fulltest.sh`):** A direct write off -> black
0/6; C direct write + exposure pass off -> black 0/6 (hdr=1); E `VKD3D_DISABLE_EXTENSIONS=VK_EXT_descriptor_buffer`
with the direct write on -> picture 5/6. Root cause: vkd3d-proton's own descriptor buffers in the command buffers
the upscaler records into break Full's descriptor-buffer passes on Turnip.
- **Fix `7aa54ab9`:** the layer hides `VK_EXT_descriptor_buffer` from games (still uses it itself;
`APP_DESCRIPTOR_BUFFER=1` shows it); Lite fallback only when a game enables it anyway; test switches removed.
CI Build APK 47463181144 (`26811a77`).
- **12-05 device results (builds `26811a77`, then `3bd1d6f9`):** fix device-proven: XeSS DX12 sample Full GPU/NPU show the
picture; measured all-engine rounds (4 shots each) DX12 + Vulkan: every engine shows the picture. Staging fix
`0750f2d0` proven ("upscaler bridges staged from local-<hash>: 24/24", and again after a real DLL change).
- **Cyberpunk 2077 (DX12, XeSS route):** Full FSR 4.1 NPU runs on the title scene, 795x360 -> 1590x720, GPU 6.0 ms +
NPU 5.8 ms, picture correct. Gotcha: UserSettings.json options are read by `index`, not `value`.
- **vkd3d descriptor buffers hidden vs shown (Cyberpunk title, Lite NPU):** ~135 vs ~126 fps (noise) -> the fix costs
nothing.
- **DLSS:** the NGX "PlatformError" was NGX's signature check; with `DROIDDECK_UPSCALE_SIGFIX=1` the DLSS sample passes it.
D3D11 then failed in EvaluateFeature: upstream's `extract_ngx_dx11_res` zeroed VkImageCreateInfo, DXVK returns
E_INVALIDARG unless sType is IMAGE_CREATE_INFO. Fix `ffe46fe5`. DLSS sample now runs Full FSR 4.1 NPU in D3D11
(1280x720 -> 2560x1440, GPU 5.1 + NPU 4.6 ms, ~52 fps) and in D3D12 (GPU 5.1 + NPU 4.4-6.0 ms, ~49 fps).
SIGFIX stays opt-in (default = user decision).
- **CI:** Build APK 47488918399 (`5546b35e` = `ffe46fe5` + the debuggable-only commit), green; installed on the phone
12-05 02:1x EST (sha256 `cfbc4be0`) with its CI-built bridge DLLs. Final device check with exactly these files is
still owed (phone screen locked at 02:03 EST).
- **Real-game DLSS still open:** Bright Memory: Infinite (UE4, D3D12) never loads the bridge's nvapi64.dll ("Failed to
initialize NVAPI", no bridge log), so the signature-fix hooks do not run and NGX's own loader rejects the core
("failed to load C:\windows\system32\_nvngx.dll", D3D12_Init FeatureNotSupported). Putting the DLLs into system32
did not help (`73442ad3`, reverted in `bb5c53a7`). The game also picks its upscaler from its own menu.
- **Not used:** a Deep Rock Galactic copy that carries a DRM-bypass DLL.
- **Real-game DLSS (Bright Memory: Infinite), 12-05 02:2x-03:0x EST:** with nvapi64.dll + NGX DLLs in its system32
(`04a67aa7` now does this in DLSS mode) the signature-fix hooks install and NGX reports "DLSS supported 1"; the game
creates DLSS features (795x360 -> 1590x720, title 5 -> 20 fps). The bridge's new log shows attach ok, seam ready,
images found, dispatch 1, yet the layer upscaled nothing (status reason ok, api None, 0x0). `e5d7bddf` guessed a
full buffer table (not confirmed); cause found after: the layer read doorbells from the last mailbox (the XeSS
bridge's), fixed by pairing markers with their mailbox (`e422ab68`).
- **Device-proven 12-05 03:09-03:31 EST, Red Magic 12 Pro, signed test build 97188d37 (= feat 0cb6afbf + test
marker, CI 47496699289 green; unit tests 47495215764: 5515 tests, 0 failures):**
- Bright Memory: Infinite (D3D12, Unreal, Streamline): status `api=DLSS (DX12) 640x360 -> 1280x720`,
FSR 4.1 Full on the NPU, GPU 4.7 ms + NPU 4-6 ms, HUD "FSR4.1-Full-NPU 4.4ms", picture correct, no crash.
Its system32 holds the CI copies of nvapi64/_nvngx (placed by game-env `04a67aa7`).
- DLSS demo with NO signature-fix entry in its settings (default on, `d47ed325`): bridge log shows the hooks
(WinVerifyTrust/CryptQueryObject/nvngx redirect); D3D12 46.8-48.7 fps, D3D11 38.5-50.0 fps,
1280x720 -> 2560x1440, no crash.
- All-engine rounds (XeSS samples DX12 + Vulkan, 9 engine/sync specs each): every engine active with its own
tag, picture present, same flicker pattern as the rounds before this change, no crash.
- Open: Deep Rock Galactic not tested (the installed copy is a cracked build; not worked around).
- **Cyberpunk A/B on the phone (12-05 04:33-05:06 EST, unplugged, build 97188d37):** game's own benchmark via launch
option `-benchmark -skipStartScreen` (writes summary.json + frames.csv, exits); window 1590x720, upscaler runs on the
game's XeSS Performance (795x360). One run each, native repeated last (same 11.41 avg = no heat drift).
| setup | avg | 1% low | W (battery, benchmark only) | fps/W | GPU load (HUD) |
|---|---|---|---|---|---|
| native | 11.41 | 7.9 | 10.09 (repeat 9.67) | 1.13 | 99 % |
| FSR 4.1 Full NPU | 12.25 | 8.5 | 9.71 | 1.26 | 92-93 % |
| SGSR 2 | 15.89 | 10.0 | 12.79 | 1.24 | 99 % |
| plain stretch (upscaler off live) | 15.67 | 9.6 | 10.39 | 1.51 | 99 % |
Findings: (1) FSR 4.1 Full NPU costs ~18 ms per frame vs the plain stretch (81.6 vs 63.8 ms) while the status reports
GPU 8.2 + NPU 6.2 ms and the GPU sits partly idle: the async NPU path still stalls each frame (same pattern as Bright
Memory: 15 vs 20 fps). Open, not investigated. (2) With FSR 4.1 Full NPU on, Cyberpunk hangs on exit after the
benchmark (black, GPU 0 %, process alive 6+ min); SGSR 2, stretch, native exit normally. Open. (3) Picture (zoomed
crops at the same spot): FSR 4.1 close to native; SGSR 2 looks nearly as blocky as the plain stretch.
The benchmark moves its camera at most 66 ms per frame: every run = 64.2 s of path (used to match screenshots).
Report: /sdcard/Download/Cyberpunk-upscaler-test-RM12-20261205.html (phone).
- **User decisions 12-05:** (1) signature fix ON by default in DLSS mode (switch stays, off is stored as `0`);
(2) no PR yet: keep testing and fixing on the branch.
---
## 2026-12-04 - `feat/neural-upscaler`: NPU engines on the phone's own QNN runtime (Red Magic 12 Pro, no root)
- **Why:** the upscaler's NPU engines only knew the bundled QNN files for HTP v79/v81. The Red Magic 12 Pro (SM8975,
HTP V85) ships Qualcomm's QNN runtime and lists it for apps in `/vendor/etc/public.libraries.txt`.
- **Built:** main merged in (`94bcfca5`); `c18aa23a` + `94754fea`: the app takes the HTP generation from the vendor's
`libQnnHtpV<NN>Stub.so` and passes `DROIDDECK_UPSCALE_HTP_ARCH`; the layer uses the bundled QNN files only for an
arch whose skel came with them, else the vendor libraries by name; no NPU download group on such phones.
- **CI:** Build APK 47341155158 green (test branch `test/neural-upscaler-rm12` = this + a debuggable-only commit,
never merged; 47338667435 failed on a Maven 429 and on my `this.npu()` inside `buildSet`).
- **Device test (Red Magic 12 Pro, DroidDeck-Bionic r104 with this branch's tool lines):** the NPU engines are offered
in the game menu; XeSS SDK demos (DX12, Vulkan), 960x540 to 1080p: FSR 4 Lite on the NPU = NPU 1.3-1.6 ms per frame
and 2-2.5 ms less GPU time than FSR 4 Lite on the GPU, picture correct; FSR 4.0 on the NPU (3.5-3.7 ms), XeSS 3
(10 ms) and the basic upscaler run; the NPU graph compiles on the phone in about 2 s and loads from cache after.
- **Open:** XeSS runtime missing on a game's first launch (staged before the prefix exists); DLSS demo stops at NGX
GetFeatureRequirements (PlatformError) after the VC++ 14 component; FSR 4.1.2 log text names v81 on every arch.
---
## 2026-10-16/17 - `feat/x86-64-steam-client`: web helper on the GPU, org main, review rounds
- **x86-64 web helper on the GPU** (`f603a085`): the client's own steamwebhelper runs ANGLE's GL backend
@@ -1571,11 +1444,6 @@ State: **main = `90c7574`** (PR #14 merge), main build run 35895701784. No tag,
- `app/src/main/cpp/waylandcomp/` - the compositor (shared lineage with Bannerlator).
## Lessons learned (don't repeat these)
- Check the PRoot layer with `tools/upscale/layer/build-glibc.sh` and a real glibc gcc (`CC=/usr/bin/gcc` in the
container), not clang with an Android target: Android headers hide glibc-only breaks (2026-12-04, r5 port).
- Build the bridge DLLs locally (`apt install gcc-mingw-w64-x86-64`, `tools/upscale/bridges/build.sh <dir>`) before CI
after any merge touching them; read the CI step's own output lines, not a hash line, before saying a step passed.
- Nothing in teardown may do bulk filesystem work on the main thread (0.1.1's ANR).
- A CI closure check on a multi-line variable must flatten it first (`libaaudio.so` refusal).
- A runtime script must be named `bannerlator-*` or CI never packages it.
+10 -3
View File
@@ -44,8 +44,10 @@ from what tripped agents up on real devices.
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).
session scripts, native code, assets and `AndroidManifest.xml` need a new APK, such as the pull
request's CI test build (DroidDeck > Updates > Test builds). `dd-lab-build` refuses changes to the
manifest, native code, Gradle files and a few startup classes, but builds session script and asset
changes without them. To try the rest of a branch, build a copy without those changes.
## Changing DroidDeck
@@ -56,7 +58,12 @@ The source is checked out at `/root/DroidDeck` once the Agent tab's build tools
- `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.
process; DroidDeck starts you again on the new build, in the same conversation, so tell the user
what you will check then instead of asking them to message you.
- To try a change, commit it and go straight to `dd-lab-build`: it compiles the app, so a Gradle
compile first only adds time. It refuses changes since the installed build (`apkCommit` in
`droiddeckctl state`) that need a new APK. For a branch from a newer `origin/main`, cherry-pick
its commits onto a branch from `apkCommit` and build that.
- 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 runs on the device once the build tools are set up, but slowly: run the test classes that cover
+1 -5
View File
@@ -51,7 +51,6 @@ for v in $(env | sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p'); do
DXVK_LOG_PATH|VKD3D_LOG_FILE|MESA_LOG_FILE) ;;
DROIDDECK_GPU_LOAD|DROIDDECK_GPU_LOAD_DIR|DROIDDECK_VRAM_CAP|DROIDDECK_VRAM_CAP_MB|DROIDDECK_DISPLAY_DRIVER) ;;
DROIDDECK_GUEST_ROOT) ;;
DROIDDECK_UPSCALE|DROIDDECK_UPSCALE_*|WINEDLLPATH|ADSP_LIBRARY_PATH|PROTON_ENABLE_NVAPI|DXVK_ENABLE_NVAPI|WINE_HIDE_NVIDIA_GPU) ;;
VKD3D_FEATURE_LEVEL|VKD3D_SHADER_MODEL|vk_x11_strict_image_count) ;;
# droiddeck-game-env's original Xbox switches for this layer's Wine and the Xbox VKD3D-Proton build
WINE_SPECIAL_APC_INTERRUPT|WINE_MF_DISPLAY_APERTURE|WINE_PRECISE_SLEEP) ;;
@@ -93,10 +92,7 @@ echo "driver $DRVDIR"
RTD=$APP/.wayland-rt
export VK_ICD_FILENAMES=$PACK/adapter/icd.json ADRENOTOOLS_DRIVER_PATH=$DRVDIR/ ADRENOTOOLS_HOOKS_PATH=$PACK/lib
export ADRENOTOOLS_DRIVER_NAME=$(drvlib "$DRVDIR")
# The in-game upscaler's layer is in the APK; DroidDeck writes its manifest to DROIDDECK_UPSCALE_LAYER.
UPSCALE_LAYER=""
[ -n "${DROIDDECK_UPSCALE:-}" ] && [ -n "${DROIDDECK_UPSCALE_LAYER:-}" ] && [ -d "$DROIDDECK_UPSCALE_LAYER" ] && UPSCALE_LAYER=":$DROIDDECK_UPSCALE_LAYER"
export VK_ADD_IMPLICIT_LAYER_PATH=$PACK/layer$UPSCALE_LAYER ENABLE_GAMESCOPE_WSI=1 GAMESCOPE_WAYLAND_DISPLAY=${GAMESCOPE_WAYLAND_DISPLAY:-gamescope-0}
export VK_ADD_IMPLICIT_LAYER_PATH=$PACK/layer ENABLE_GAMESCOPE_WSI=1 GAMESCOPE_WAYLAND_DISPLAY=${GAMESCOPE_WAYLAND_DISPLAY:-gamescope-0}
export XDG_RUNTIME_DIR=$RTD DROIDDECK_WSI_BYPASS_CHECK_MS=100 GAMESCOPE_WSI_FORCE_BYPASS=0
echo "WSI forced XWayland bypass disabled (GAMESCOPE_WSI_FORCE_BYPASS=$GAMESCOPE_WSI_FORCE_BYPASS)"
[ -e "$RTD/droiddeck-gamescope-limiter" ] && export GAMESCOPE_LIMITER_FILE=$RTD/droiddeck-gamescope-limiter
-15
View File
@@ -103,21 +103,6 @@ case "$verb" in
done
# The HUD's GPU-load folder is a guest path; the bionic game writes to it by its Android path.
[ -n "${DROIDDECK_GPU_LOAD_DIR:-}" ] && { DROIDDECK_GPU_LOAD_DIR=$(real "$DROIDDECK_GPU_LOAD_DIR"); export DROIDDECK_GPU_LOAD_DIR; }
# The in-game upscaler's folders and files (droiddeck-game-env sets them as guest paths); the bridge folder on
# WINEDLLPATH and the NPU skeleton folder at the head of ADSP_LIBRARY_PATH as well.
for v in DROIDDECK_UPSCALE_DIR DROIDDECK_UPSCALE_CTRL_FILE DROIDDECK_UPSCALE_STATUS_FILE DROIDDECK_UPSCALE_NATIVELIB_DIR; do
[ -n "${!v:-}" ] && { printf -v "$v" '%s' "$(real "${!v}")"; export "${v?}"; }
done
if [ -n "${DROIDDECK_UPSCALE:-}" ] && [ -n "${WINEDLLPATH:-}" ]; then
out=""
IFS=: read -r -a parts <<< "$WINEDLLPATH"
for part in "${parts[@]}"; do [ -n "$part" ] && out="${out:+$out:}$(real "$part")"; done
WINEDLLPATH=$out; export WINEDLLPATH
fi
if [ -n "${DROIDDECK_UPSCALE:-}" ] && [ -n "${ADSP_LIBRARY_PATH:-}" ]; then
head=${ADSP_LIBRARY_PATH%%;*}
ADSP_LIBRARY_PATH="$(real "$head")${ADSP_LIBRARY_PATH#"$head"}"; export ADSP_LIBRARY_PATH
fi
# So are the graphics log locations Detailed graphics logs or game debugging set for this launch.
for v in DXVK_LOG_PATH VKD3D_LOG_FILE MESA_LOG_FILE; do
[ -n "${!v:-}" ] && { printf -v "$v" '%s' "$(real "${!v}")"; export "${v?}"; }
+1 -40
View File
@@ -17,7 +17,6 @@
"tools/vr",
"tools/ime",
"tools/gpuload",
"tools/upscale/layer",
"app/src/main/cpp/waylandcomp/generated",
"app/src/main/cpp/waylandcomp/src/headpose_shm.h",
"app/src/main/cpp/waylandcomp/src/spatialpose_shm.h",
@@ -30,9 +29,7 @@
"app/src/main/assets/linuxfs/usr/local/share/droiddeck/ibus.profile",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-ime/ibus-engine-pinyin",
"app/src/main/assets/linuxfs/usr/share/pyzy/db/android.db",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-gpuload/libVkLayer_droiddeck_gpuload.so",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale-layer/libVkLayer_droiddeck_upscale.so",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale-layer/VK_LAYER_DROIDDECK_upscale.json"
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-gpuload/libVkLayer_droiddeck_gpuload.so"
],
"ndk": true,
"packages": [
@@ -276,41 +273,5 @@
"lld",
"llvm"
]
},
"upscale-bridges": {
"script": "tools/components/recipes/upscale-bridges.sh",
"inputs": [
"tools/upscale/bridges",
"tools/components/recipes/upscale-bridges.sh"
],
"outputs": [
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/_nvngx.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/amd_fidelityfx_dx12.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/amd_fidelityfx_loader_dx12.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/amd_fidelityfx_upscaler_dx12.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/amd_fidelityfx_upscaler_vk.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/amd_fidelityfx_vk.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/ffx_fsr2_api_x64.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/ffx_fsr3upscaler_x64.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/libxess.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/nvapi64.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/nvngx.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/x86_64-windows/nvngx_dlss.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/_nvngx.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/amd_fidelityfx_dx12.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/amd_fidelityfx_loader_dx12.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/amd_fidelityfx_upscaler_dx12.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/amd_fidelityfx_upscaler_vk.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/amd_fidelityfx_vk.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/ffx_fsr2_api_x64.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/ffx_fsr3upscaler_x64.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/libxess.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/nvapi64.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/nvngx.dll",
"app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges/aarch64-windows/nvngx_dlss.dll"
],
"packages": [
"gcc-mingw-w64-x86-64"
]
}
}
-2
View File
@@ -6,8 +6,6 @@ VK_INCLUDE=$(ls -d "${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_
tools/vr/build.sh --native "$D/usr/local/lib/droiddeck-vr"
VK_INCLUDE=$(ls -d "${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"/toolchains/llvm/prebuilt/*/sysroot/usr/include | head -1) \
tools/gpuload/build.sh --native "$D/usr/local/lib/droiddeck-gpuload"
VK_INCLUDE=$(ls -d "${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"/toolchains/llvm/prebuilt/*/sysroot/usr/include | head -1) \
tools/upscale/layer/build-glibc.sh "$D/usr/local/lib/droiddeck-upscale-layer"
for script in tools/linuxfs/overlay/usr/local/bin/droiddeck-* tools/linuxfs/overlay/usr/local/bin/steam-compatibility; do
install -Dm644 "$script" "$D/usr/local/bin/$(basename "$script")"
done
@@ -1,3 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
bash tools/upscale/bridges/build.sh app/src/main/assets/linuxfs/usr/local/lib/droiddeck-upscale/bridges
+5
View File
@@ -63,6 +63,11 @@ cmake -S fex-src -B fex-build -G Ninja \
${FEX_EXTRA_CXXFLAGS:+-DCMAKE_CXX_FLAGS="$FEX_EXTRA_CXXFLAGS"}
ninja -C fex-build
DESTDIR="$WORK/out" ninja -C fex-build install
mkdir -p out/usr/local/share/fex-emu
for p in tools/fex/patches/*.patch; do
p=$(basename "$p" .patch)
echo "${p#*-}"
done > out/usr/local/share/fex-emu/.droiddeck-patches
install -Dm755 /usr/bin/unsquashfs out/usr/local/bin/unsquashfs
install -Dm644 "$(readlink -f /usr/lib/libxxhash.so.0)" out/usr/local/lib/libxxhash.so.0
bundled=$(cd out/usr/local/lib && ls -- *.so* | sort -u)
@@ -1,3 +1,4 @@
Fixed-upstream: FEX-2612
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8976588..3ae54f4 100644
--- a/CMakeLists.txt
@@ -1,8 +1,8 @@
diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp
index b4c7b24..643185d 100644
index 345f4d834..085ff00a2 100644
--- a/Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp
+++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/SignalDelegator.cpp
@@ -264,12 +264,13 @@ void SignalDelegator::RestoreThreadState(FEXCore::Core::InternalThreadState* Thr
@@ -283,12 +283,13 @@ void SignalDelegator::RestoreThreadState(FEXCore::Core::InternalThreadState* Thr
auto Frame = Thread->CurrentFrame;
if (Context->Flags & ArchHelpers::Context::ContextFlags::CONTEXT_FLAG_INJIT) {
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff. Show more