mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-03 03:25:39 +00:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b6f9262ec | ||
|
|
829768f8c0 | ||
|
|
c7cd7c18e6 | ||
|
|
80dbec57d7 | ||
|
|
e04e38b44c | ||
|
|
90c7dece92 | ||
|
|
6d78142a67 | ||
|
|
5cd6fe8864 | ||
|
|
186bae8f3e | ||
|
|
3bb22dc92b | ||
|
|
f3f410059d | ||
|
|
6e7908ed81 | ||
|
|
9ca6fa064e | ||
|
|
aab15f3146 | ||
|
|
11af78340a | ||
|
|
2c95ebd22d | ||
|
|
7ce53ccbed | ||
|
|
1b4aaf8a3b | ||
|
|
4793d1df62 | ||
|
|
9dfbc05933 | ||
|
|
8ec6e646d9 | ||
|
|
41412450fd | ||
|
|
bf772b7c55 | ||
|
|
29b04b66eb | ||
|
|
044c8ee475 | ||
|
|
ca499115ac | ||
|
|
d7898360e3 |
No files matched your search
@@ -221,14 +221,6 @@ jobs:
|
||||
with:
|
||||
path: pa13
|
||||
key: pulseaudio-src-${{ steps.plan.outputs.pulseaudio-source }}
|
||||
- name: Cache proot
|
||||
id: proot
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
app/src/main/jniLibs/arm64-v8a/libproot.so
|
||||
app/src/main/jniLibs/arm64-v8a/libproot-loader.so
|
||||
key: proot-v2-${{ steps.plan.outputs.proot }}
|
||||
- name: Cache GOG Galaxy companion
|
||||
id: comet
|
||||
uses: actions/cache@v4
|
||||
@@ -287,10 +279,6 @@ jobs:
|
||||
- name: Build the AAudio sink into the audio bundle
|
||||
run: python3 tools/components/prepare.py audio
|
||||
|
||||
- name: Build proot
|
||||
if: steps.proot.outputs.cache-hit != 'true'
|
||||
run: python3 tools/components/prepare.py proot
|
||||
|
||||
- name: Build the non-Adreno test additions (Mali bridge client, Venus GL probe, Xclipse layer)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -674,20 +662,6 @@ jobs:
|
||||
export NDK="$ANDROID_HOME/ndk/$NDK_VERSION"
|
||||
tools/syncthing/build.sh app/src/main/jniLibs/arm64-v8a
|
||||
|
||||
- name: Check the proot pack pin against this build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# shellcheck disable=SC1091
|
||||
source tools/packs/proot/release.env
|
||||
sha=$(sha256sum app/build/packs/proot.tar.zst | cut -d' ' -f1)
|
||||
size=$(stat -c %s app/build/packs/proot.tar.zst)
|
||||
if [ "$sha" != "$PROOT_PACK_SHA256" ] || [ "$size" != "$PROOT_PACK_SIZE" ]; then
|
||||
level=warning
|
||||
if [ "$GITHUB_EVENT_NAME" = pull_request ]; then level=error; fi
|
||||
echo "::$level::built proot pack $sha ($size bytes) does not match tools/packs/proot/release.env ($PROOT_PACK_SHA256, $PROOT_PACK_SIZE bytes). Source builds download the pinned pack, so set PROOT_PACK_SHA256=$sha and PROOT_PACK_SIZE=$size in tools/packs/proot/release.env."
|
||||
if [ "$level" = error ]; then exit 1; fi
|
||||
fi
|
||||
|
||||
- name: Check out MaliBridge
|
||||
run: git submodule update --init external/MaliBridge
|
||||
- name: Fetch the Mali (Venus) component (tools/venus/release.env)
|
||||
|
||||
@@ -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; do
|
||||
for name in 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)
|
||||
|
||||
@@ -39,7 +39,8 @@ DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linu
|
||||
1. Android 9 or newer on Adreno 730 or newer, or any 8xx. Adreno 6xx, Mali, Xclipse and PowerVR are experimental. Adreno 710 is currently unsupported. No root needed.
|
||||
2. About 3 GB free for the runtime, plus 1.1 GB for the desktop and emulators.
|
||||
3. Install the [APK](https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk), install the Linux runtime, press **Play** and sign in to Steam.
|
||||
4. On Android 14 and newer, turn on **Disable child process restrictions** in Developer options. On Android 12 and 13, Steam's first launch shows a **Fix it for me** button that walks you through it.
|
||||
|
||||
Current Preview builds handle Android’s child-process limit during launch. The linked 0.7.11 release still uses the setup steps in its release notes.
|
||||
|
||||
Smart glasses setup is in the [support matrix](docs/smart-glasses-support.md). Release notes are in [docs/releases](docs/releases).
|
||||
|
||||
@@ -70,14 +71,13 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
- [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).
|
||||
- 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.
|
||||
- DwarFS AppImages are unpacked 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.
|
||||
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
|
||||
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
|
||||
- Windows programs on noexec storage get executable copies of their image pages, following [@yujikaido](https://github.com/yujikaido)'s finding in [droiddeck-rp4pro](https://github.com/yujikaido/droiddeck-rp4pro) that Wine's own processes need the noexec shim.
|
||||
- Wine write watches use userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later). libddsession supplies the arm64 syscall number and answers `PAGEMAP_SCAN` from `/proc/self/pagemap`.
|
||||
- libddsession runs Wine's arm64 `SIGUSR2` context handler (`dlls/ntdll/unix/signal_arm64.c`, LGPL-2.1-or-later) in place on a frame laid out like [Linux](https://github.com/torvalds/linux)'s `arch/arm64/kernel/signal.c`, and serves `fill_vm_counters` in `dlls/ntdll/unix/process.c` the kernel's own `/proc/<pid>/status`.
|
||||
- droiddeck-ntsync follows the [Linux](https://github.com/torvalds/linux) ntsync semantics in `Documentation/userspace-api/ntsync.rst` (GPL-2.0).
|
||||
- The proot fast path orders bindings like [PRoot](https://github.com/proot-me/proot)'s `path/binding.c` (GPL-2.0-or-later).
|
||||
- DiRT 3 and DiRT Showdown keep their telemetry socket the way RoccoC's DiRTTelemetryErrorFix (MIT) does, based on the fix by Carsten Gottschling.
|
||||
- Zink on PowerVR keeps colour textures in colour with Icenowy Zheng's upstream [Mesa](https://gitlab.freedesktop.org/mesa/mesa) fix d55418dae7 (MIT), carried as a runtime patch.
|
||||
- Games and AppImage, Flatpak and Snap programs such as emulators use `TU_DEBUG=sysmem` by default, as does the Steam client. Turnip sysmem rendering can be turned off in Performance settings, except with the Adreno 710/720 driver, which always uses it.
|
||||
|
||||
+4
-10
@@ -90,16 +90,10 @@ def desktopKde = rootProject.file('tools/desktop-kde/release.env').readLines()
|
||||
def trackingPack = rootProject.file('tools/packs/tracking/release.env').readLines()
|
||||
.findAll { it.contains('=') && !it.startsWith('#') }
|
||||
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
|
||||
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'].collectEntries { name ->
|
||||
def addonPacks = ['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) throw new GradleException("Add-on pack ${pack} is missing: run tools/packs/build.sh app/build/packs")
|
||||
if (name == 'proot' && prootPackPin.PROOT_PACK_SHA256) {
|
||||
return [(name): [sha256: prootPackPin.PROOT_PACK_SHA256, size: (prootPackPin.PROOT_PACK_SIZE ?: '0') as long]]
|
||||
}
|
||||
return [(name): [sha256: '', size: 0L]]
|
||||
}
|
||||
def digest = java.security.MessageDigest.getInstance('SHA-256')
|
||||
@@ -213,7 +207,7 @@ android {
|
||||
jniLibs {
|
||||
useLegacyPackaging = true
|
||||
pickFirsts += ['**/libtermux.so']
|
||||
excludes += ['**/libproot.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
|
||||
excludes += ['**/libproot.so', '**/libproot-loader.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,9 +268,9 @@ tasks.named('preBuild').configure { dependsOn(stageSessionScripts) }
|
||||
def runtimeAssetsDir = layout.buildDirectory.dir('runtimeAssets')
|
||||
def stageRuntimeAssets = tasks.register('stageRuntimeAssets', Sync) {
|
||||
dependsOn(stageSessionScripts)
|
||||
from(layout.projectDirectory.dir('src/main/assets')) { exclude 'pulseaudio.tzst' }
|
||||
from(layout.projectDirectory.dir('src/main/assets')) { exclude 'pulseaudio.tzst', 'linuxfs/libddfastpath.so', 'linuxfs/libddaudit.so' }
|
||||
from(rootProject.file('tools/linuxfs/innoextract'))
|
||||
from(rootProject.file('tools')) { include 'droiddeckctl', 'droiddeck-scenario', 'adb_device.py', 'proot_profile.py'; into('agent/ctl') }
|
||||
from(rootProject.file('tools')) { include 'droiddeckctl', 'droiddeck-scenario', 'adb_device.py'; into('agent/ctl') }
|
||||
from(rootProject.file('tools/agent/AGENTS.md')) { into('agent/ctl') }
|
||||
from(rootProject.file('docs/agent-control.md')) { into('agent/ctl') }
|
||||
from(rootProject.file('tools/agent/skills')) { into('agent/skills') }
|
||||
|
||||
@@ -417,5 +417,69 @@
|
||||
android:name="backend:com.google.android.datatransport.cct.CctBackendFactory"
|
||||
tools:node="remove" />
|
||||
</service>
|
||||
<service android:name=".runtime.GuestWorker0" android:exported="false" android:process=":g0" />
|
||||
<service android:name=".runtime.GuestWorker1" android:exported="false" android:process=":g1" />
|
||||
<service android:name=".runtime.GuestWorker2" android:exported="false" android:process=":g2" />
|
||||
<service android:name=".runtime.GuestWorker3" android:exported="false" android:process=":g3" />
|
||||
<service android:name=".runtime.GuestWorker4" android:exported="false" android:process=":g4" />
|
||||
<service android:name=".runtime.GuestWorker5" android:exported="false" android:process=":g5" />
|
||||
<service android:name=".runtime.GuestWorker6" android:exported="false" android:process=":g6" />
|
||||
<service android:name=".runtime.GuestWorker7" android:exported="false" android:process=":g7" />
|
||||
<service android:name=".runtime.GuestWorker8" android:exported="false" android:process=":g8" />
|
||||
<service android:name=".runtime.GuestWorker9" android:exported="false" android:process=":g9" />
|
||||
<service android:name=".runtime.GuestWorker10" android:exported="false" android:process=":g10" />
|
||||
<service android:name=".runtime.GuestWorker11" android:exported="false" android:process=":g11" />
|
||||
<service android:name=".runtime.GuestWorker12" android:exported="false" android:process=":g12" />
|
||||
<service android:name=".runtime.GuestWorker13" android:exported="false" android:process=":g13" />
|
||||
<service android:name=".runtime.GuestWorker14" android:exported="false" android:process=":g14" />
|
||||
<service android:name=".runtime.GuestWorker15" android:exported="false" android:process=":g15" />
|
||||
<service android:name=".runtime.GuestWorker16" android:exported="false" android:process=":g16" />
|
||||
<service android:name=".runtime.GuestWorker17" android:exported="false" android:process=":g17" />
|
||||
<service android:name=".runtime.GuestWorker18" android:exported="false" android:process=":g18" />
|
||||
<service android:name=".runtime.GuestWorker19" android:exported="false" android:process=":g19" />
|
||||
<service android:name=".runtime.GuestWorker20" android:exported="false" android:process=":g20" />
|
||||
<service android:name=".runtime.GuestWorker21" android:exported="false" android:process=":g21" />
|
||||
<service android:name=".runtime.GuestWorker22" android:exported="false" android:process=":g22" />
|
||||
<service android:name=".runtime.GuestWorker23" android:exported="false" android:process=":g23" />
|
||||
<service android:name=".runtime.GuestWorker24" android:exported="false" android:process=":g24" />
|
||||
<service android:name=".runtime.GuestWorker25" android:exported="false" android:process=":g25" />
|
||||
<service android:name=".runtime.GuestWorker26" android:exported="false" android:process=":g26" />
|
||||
<service android:name=".runtime.GuestWorker27" android:exported="false" android:process=":g27" />
|
||||
<service android:name=".runtime.GuestWorker28" android:exported="false" android:process=":g28" />
|
||||
<service android:name=".runtime.GuestWorker29" android:exported="false" android:process=":g29" />
|
||||
<service android:name=".runtime.GuestWorker30" android:exported="false" android:process=":g30" />
|
||||
<service android:name=".runtime.GuestWorker31" android:exported="false" android:process=":g31" />
|
||||
<service android:name=".runtime.GuestWorker32" android:exported="false" android:process=":g32" />
|
||||
<service android:name=".runtime.GuestWorker33" android:exported="false" android:process=":g33" />
|
||||
<service android:name=".runtime.GuestWorker34" android:exported="false" android:process=":g34" />
|
||||
<service android:name=".runtime.GuestWorker35" android:exported="false" android:process=":g35" />
|
||||
<service android:name=".runtime.GuestWorker36" android:exported="false" android:process=":g36" />
|
||||
<service android:name=".runtime.GuestWorker37" android:exported="false" android:process=":g37" />
|
||||
<service android:name=".runtime.GuestWorker38" android:exported="false" android:process=":g38" />
|
||||
<service android:name=".runtime.GuestWorker39" android:exported="false" android:process=":g39" />
|
||||
<service android:name=".runtime.GuestWorker40" android:exported="false" android:process=":g40" />
|
||||
<service android:name=".runtime.GuestWorker41" android:exported="false" android:process=":g41" />
|
||||
<service android:name=".runtime.GuestWorker42" android:exported="false" android:process=":g42" />
|
||||
<service android:name=".runtime.GuestWorker43" android:exported="false" android:process=":g43" />
|
||||
<service android:name=".runtime.GuestWorker44" android:exported="false" android:process=":g44" />
|
||||
<service android:name=".runtime.GuestWorker45" android:exported="false" android:process=":g45" />
|
||||
<service android:name=".runtime.GuestWorker46" android:exported="false" android:process=":g46" />
|
||||
<service android:name=".runtime.GuestWorker47" android:exported="false" android:process=":g47" />
|
||||
<service android:name=".runtime.GuestWorker48" android:exported="false" android:process=":g48" />
|
||||
<service android:name=".runtime.GuestWorker49" android:exported="false" android:process=":g49" />
|
||||
<service android:name=".runtime.GuestWorker50" android:exported="false" android:process=":g50" />
|
||||
<service android:name=".runtime.GuestWorker51" android:exported="false" android:process=":g51" />
|
||||
<service android:name=".runtime.GuestWorker52" android:exported="false" android:process=":g52" />
|
||||
<service android:name=".runtime.GuestWorker53" android:exported="false" android:process=":g53" />
|
||||
<service android:name=".runtime.GuestWorker54" android:exported="false" android:process=":g54" />
|
||||
<service android:name=".runtime.GuestWorker55" android:exported="false" android:process=":g55" />
|
||||
<service android:name=".runtime.GuestWorker56" android:exported="false" android:process=":g56" />
|
||||
<service android:name=".runtime.GuestWorker57" android:exported="false" android:process=":g57" />
|
||||
<service android:name=".runtime.GuestWorker58" android:exported="false" android:process=":g58" />
|
||||
<service android:name=".runtime.GuestWorker59" android:exported="false" android:process=":g59" />
|
||||
<service android:name=".runtime.GuestWorker60" android:exported="false" android:process=":g60" />
|
||||
<service android:name=".runtime.GuestWorker61" android:exported="false" android:process=":g61" />
|
||||
<service android:name=".runtime.GuestWorker62" android:exported="false" android:process=":g62" />
|
||||
<service android:name=".runtime.GuestWorker63" android:exported="false" android:process=":g63" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -4130,13 +4130,20 @@ EXPORT ssize_t read(int fd, void *buf, size_t count) {
|
||||
return read_input(fd, buf, count);
|
||||
}
|
||||
|
||||
// glibc's fortify failure; bionic (DroidDeck-Bionic preloads this library into its Wine processes) has no
|
||||
// __chk_fail, and a library naming it there cannot be loaded, which stops every Wine program from starting.
|
||||
#if defined(__BIONIC__)
|
||||
[[noreturn]] static void fakeinput_chk_fail(void) { abort(); }
|
||||
#else
|
||||
extern "C" [[noreturn]] void __chk_fail(void);
|
||||
[[noreturn]] static void fakeinput_chk_fail(void) { __chk_fail(); }
|
||||
#endif
|
||||
|
||||
/* Programs built with _FORTIFY_SOURCE (Flatpak runtimes among them) call these instead of read, poll
|
||||
* and ppoll, and glibc's versions go straight to the kernel. */
|
||||
EXPORT ssize_t __read_chk(int fd, void *buf, size_t count, size_t buflen) {
|
||||
static auto next_read_chk = reinterpret_cast<ssize_t (*)(int, void *, size_t, size_t)>(dlsym(RTLD_NEXT, "__read_chk"));
|
||||
if (count > buflen) __chk_fail();
|
||||
if (count > buflen) fakeinput_chk_fail();
|
||||
if (next_read_chk && !is_fake_input_fd(fd)) return next_read_chk(fd, buf, count, buflen);
|
||||
return read_input(fd, buf, count);
|
||||
}
|
||||
@@ -4390,13 +4397,13 @@ EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
}
|
||||
|
||||
EXPORT int __poll_chk(struct pollfd *fds, nfds_t nfds, int timeout, size_t fdslen) {
|
||||
if (fdslen / sizeof(*fds) < nfds) __chk_fail();
|
||||
if (fdslen / sizeof(*fds) < nfds) fakeinput_chk_fail();
|
||||
return poll(fds, nfds, timeout);
|
||||
}
|
||||
|
||||
EXPORT int __ppoll_chk(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
|
||||
const sigset_t *sigmask, size_t fdslen) {
|
||||
if (fdslen / sizeof(*fds) < nfds) __chk_fail();
|
||||
if (fdslen / sizeof(*fds) < nfds) fakeinput_chk_fail();
|
||||
return ppoll(fds, nfds, timeout, sigmask);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
// - Same push constants as cas.frag: ndc, input size, sharpness [0..1].
|
||||
// CasSetup's const1.x = -1 / lerp(8, 5, sharpness) is computed here.
|
||||
// - The input is the effect chain's previous target at the same size, so the
|
||||
// output pixel reads the input pixel 1:1 (texelFetch, edges clamped).
|
||||
// output pixel reads the input pixel 1:1 (texel centres, edges clamped).
|
||||
// =============================================================================
|
||||
|
||||
// DD_HALF is set for the *_half_frag.h build (gen_shaders.sh): colour and
|
||||
@@ -64,8 +64,8 @@ layout(location = 0) in highp vec2 fragTexCoord;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
vec3 CasLoad(ivec2 p) {
|
||||
ivec2 sz = textureSize(InputTexture, 0);
|
||||
return texelFetch(InputTexture, clamp(p, ivec2(0), sz - ivec2(1)), 0).rgb;
|
||||
highp vec2 uv = (vec2(p) + 0.5) / pc.resolution;
|
||||
return textureLod(InputTexture, uv, 0.0).rgb;
|
||||
}
|
||||
|
||||
float AMin3F1(float x, float y, float z) { return min(x, min(y, z)); }
|
||||
|
||||
@@ -1,214 +1,213 @@
|
||||
// 1116.2.0
|
||||
// 1115.1.0
|
||||
#pragma once
|
||||
const uint32_t cas_ffx_half_code[] = {
|
||||
0x07230203,0x00010000,0x0008000b,0x000000d7,0x00000000,0x00020011,0x00000001,0x00020011,
|
||||
0x00000032,0x0006000b,0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,
|
||||
0x00000000,0x00000001,0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000043,
|
||||
0x000000d1,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,
|
||||
0x00000004,0x6e69616d,0x00000000,0x00060005,0x0000000d,0x4c736143,0x2864616f,0x3b326976,
|
||||
0x00000000,0x00030005,0x0000000c,0x00000070,0x00070005,0x00000014,0x6e694d41,0x28314633,
|
||||
0x663b3166,0x31663b31,0x0000003b,0x00030005,0x00000011,0x00000078,0x00030005,0x00000012,
|
||||
0x00000079,0x00030005,0x00000013,0x0000007a,0x00070005,0x00000019,0x78614d41,0x28314633,
|
||||
0x663b3166,0x31663b31,0x0000003b,0x00030005,0x00000016,0x00000078,0x00030005,0x00000017,
|
||||
0x00000079,0x00030005,0x00000018,0x0000007a,0x00030005,0x0000001b,0x00007a73,0x00060005,
|
||||
0x0000001f,0x75706e49,0x78655474,0x65727574,0x00000000,0x00030005,0x00000040,0x00007073,
|
||||
0x00060005,0x00000043,0x67617266,0x43786554,0x64726f6f,0x00000000,0x00030005,0x00000045,
|
||||
0x00004350,0x00040006,0x00000045,0x00000000,0x0063646e,0x00060006,0x00000045,0x00000001,
|
||||
0x6f736572,0x6974756c,0x00006e6f,0x00060006,0x00000045,0x00000002,0x72616873,0x73656e70,
|
||||
0x00000073,0x00030005,0x00000047,0x00006370,0x00040005,0x0000004d,0x6b616570,0x00000000,
|
||||
0x00030005,0x0000005b,0x00000062,0x00040005,0x00000060,0x61726170,0x0000006d,0x00030005,
|
||||
0x00000062,0x00000064,0x00040005,0x00000066,0x61726170,0x0000006d,0x00030005,0x00000068,
|
||||
0x00000065,0x00040005,0x00000069,0x61726170,0x0000006d,0x00030005,0x0000006c,0x00000066,
|
||||
0x00040005,0x00000070,0x61726170,0x0000006d,0x00030005,0x00000072,0x00000068,0x00040005,
|
||||
0x00000076,0x61726170,0x0000006d,0x00030005,0x00000078,0x00476e6d,0x00040005,0x00000079,
|
||||
0x61726170,0x0000006d,0x00040005,0x0000007e,0x61726170,0x0000006d,0x00040005,0x00000081,
|
||||
0x61726170,0x0000006d,0x00040005,0x00000085,0x61726170,0x0000006d,0x00040005,0x00000086,
|
||||
0x61726170,0x0000006d,0x00040005,0x00000089,0x61726170,0x0000006d,0x00030005,0x0000008d,
|
||||
0x0047786d,0x00040005,0x0000008e,0x61726170,0x0000006d,0x00040005,0x00000091,0x61726170,
|
||||
0x0000006d,0x00040005,0x00000094,0x61726170,0x0000006d,0x00040005,0x00000098,0x61726170,
|
||||
0x0000006d,0x00040005,0x00000099,0x61726170,0x0000006d,0x00040005,0x0000009c,0x61726170,
|
||||
0x0000006d,0x00040005,0x000000a0,0x4d706372,0x00000047,0x00040005,0x000000a5,0x47706d61,
|
||||
0x00000000,0x00030005,0x000000af,0x00004777,0x00050005,0x000000b3,0x57706372,0x68676965,
|
||||
0x00000074,0x00030005,0x000000b9,0x00786970,0x00050005,0x000000d1,0x4374756f,0x726f6c6f,
|
||||
0x00000000,0x00030047,0x0000000d,0x00000000,0x00030047,0x00000011,0x00000000,0x00030047,
|
||||
0x00000012,0x00000000,0x00030047,0x00000013,0x00000000,0x00030047,0x00000014,0x00000000,
|
||||
0x00030047,0x00000016,0x00000000,0x00030047,0x00000017,0x00000000,0x00030047,0x00000018,
|
||||
0x00000000,0x00030047,0x00000019,0x00000000,0x00030047,0x0000001f,0x00000000,0x00040047,
|
||||
0x0000001f,0x00000021,0x00000000,0x00040047,0x0000001f,0x00000022,0x00000000,0x00030047,
|
||||
0x00000020,0x00000000,0x00030047,0x00000024,0x00000000,0x00030047,0x0000002e,0x00000000,
|
||||
0x00030047,0x0000002f,0x00000000,0x00030047,0x00000032,0x00000000,0x00030047,0x00000033,
|
||||
0x00000000,0x00030047,0x00000034,0x00000000,0x00030047,0x00000035,0x00000000,0x00030047,
|
||||
0x00000036,0x00000000,0x00030047,0x00000039,0x00000000,0x00030047,0x0000003a,0x00000000,
|
||||
0x00030047,0x0000003b,0x00000000,0x00030047,0x0000003c,0x00000000,0x00030047,0x0000003d,
|
||||
0x00000000,0x00040047,0x00000043,0x0000001e,0x00000000,0x00030047,0x00000045,0x00000002,
|
||||
0x00050048,0x00000045,0x00000000,0x00000023,0x00000000,0x00050048,0x00000045,0x00000001,
|
||||
0x00000023,0x00000010,0x00040048,0x00000045,0x00000002,0x00000000,0x00050048,0x00000045,
|
||||
0x00000002,0x00000023,0x00000018,0x00030047,0x0000004d,0x00000000,0x00030047,0x00000054,
|
||||
0x00000000,0x00030047,0x00000057,0x00000000,0x00030047,0x00000058,0x00000000,0x00030047,
|
||||
0x00000059,0x00000000,0x00030047,0x0000005b,0x00000000,0x00030047,0x00000061,0x00000000,
|
||||
0x00030047,0x00000062,0x00000000,0x00030047,0x00000067,0x00000000,0x00030047,0x00000068,
|
||||
0x00000000,0x00030047,0x0000006b,0x00000000,0x00030047,0x0000006c,0x00000000,0x00030047,
|
||||
0x00000071,0x00000000,0x00030047,0x00000072,0x00000000,0x00030047,0x00000077,0x00000000,
|
||||
0x00030047,0x00000078,0x00000000,0x00030047,0x00000079,0x00000000,0x00030047,0x0000007d,
|
||||
0x00000000,0x00030047,0x0000007e,0x00000000,0x00030047,0x00000080,0x00000000,0x00030047,
|
||||
0x00000081,0x00000000,0x00030047,0x00000083,0x00000000,0x00030047,0x00000084,0x00000000,
|
||||
0x00030047,0x00000085,0x00000000,0x00030047,0x00000086,0x00000000,0x00030047,0x00000088,
|
||||
0x00000000,0x00030047,0x00000089,0x00000000,0x00030047,0x0000008b,0x00000000,0x00030047,
|
||||
0x0000008c,0x00000000,0x00030047,0x0000008d,0x00000000,0x00030047,0x0000008e,0x00000000,
|
||||
0x00030047,0x00000090,0x00000000,0x00030047,0x00000091,0x00000000,0x00030047,0x00000093,
|
||||
0x00000000,0x00030047,0x00000094,0x00000000,0x00030047,0x00000096,0x00000000,0x00030047,
|
||||
0x00000097,0x00000000,0x00030047,0x00000098,0x00000000,0x00030047,0x00000099,0x00000000,
|
||||
0x00030047,0x0000009b,0x00000000,0x00030047,0x0000009c,0x00000000,0x00030047,0x0000009e,
|
||||
0x00000000,0x00030047,0x0000009f,0x00000000,0x00030047,0x000000a0,0x00000000,0x00030047,
|
||||
0x000000a1,0x00000000,0x00030047,0x000000a3,0x00000000,0x00030047,0x000000a4,0x00000000,
|
||||
0x00030047,0x000000a5,0x00000000,0x00030047,0x000000a6,0x00000000,0x00030047,0x000000a7,
|
||||
0x00000000,0x00030047,0x000000a8,0x00000000,0x00030047,0x000000a9,0x00000000,0x00030047,
|
||||
0x000000aa,0x00000000,0x00030047,0x000000ab,0x00000000,0x00030047,0x000000ac,0x00000000,
|
||||
0x00030047,0x000000ad,0x00000000,0x00030047,0x000000ae,0x00000000,0x00030047,0x000000af,
|
||||
0x00000000,0x00030047,0x000000b0,0x00000000,0x00030047,0x000000b1,0x00000000,0x00030047,
|
||||
0x000000b2,0x00000000,0x00030047,0x000000b3,0x00000000,0x00030047,0x000000b5,0x00000000,
|
||||
0x00030047,0x000000b6,0x00000000,0x00030047,0x000000b7,0x00000000,0x00030047,0x000000b8,
|
||||
0x00000000,0x00030047,0x000000b9,0x00000000,0x00030047,0x000000ba,0x00000000,0x00030047,
|
||||
0x000000bb,0x00000000,0x00030047,0x000000bc,0x00000000,0x00030047,0x000000bd,0x00000000,
|
||||
0x00030047,0x000000be,0x00000000,0x00030047,0x000000bf,0x00000000,0x00030047,0x000000c0,
|
||||
0x00000000,0x00030047,0x000000c1,0x00000000,0x00030047,0x000000c2,0x00000000,0x00030047,
|
||||
0x000000c3,0x00000000,0x00030047,0x000000c4,0x00000000,0x00030047,0x000000c5,0x00000000,
|
||||
0x00030047,0x000000c6,0x00000000,0x00030047,0x000000c7,0x00000000,0x00030047,0x000000c8,
|
||||
0x00000000,0x00030047,0x000000c9,0x00000000,0x00030047,0x000000ca,0x00000000,0x00030047,
|
||||
0x000000cb,0x00000000,0x00030047,0x000000cc,0x00000000,0x00030047,0x000000cd,0x00000000,
|
||||
0x00030047,0x000000ce,0x00000000,0x00030047,0x000000cf,0x00000000,0x00030047,0x000000d1,
|
||||
0x00000000,0x00040047,0x000000d1,0x0000001e,0x00000000,0x00030047,0x000000d2,0x00000000,
|
||||
0x00030047,0x000000d3,0x00000000,0x00030047,0x000000d4,0x00000000,0x00030047,0x000000d5,
|
||||
0x00000000,0x00030047,0x000000d6,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,
|
||||
0x00000002,0x00040015,0x00000006,0x00000020,0x00000001,0x00040017,0x00000007,0x00000006,
|
||||
0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00030016,0x00000009,0x00000020,
|
||||
0x00040017,0x0000000a,0x00000009,0x00000003,0x00040021,0x0000000b,0x0000000a,0x00000008,
|
||||
0x00040020,0x0000000f,0x00000007,0x00000009,0x00060021,0x00000010,0x00000009,0x0000000f,
|
||||
0x0000000f,0x0000000f,0x00090019,0x0000001c,0x00000009,0x00000001,0x00000000,0x00000000,
|
||||
0x00000000,0x00000001,0x00000000,0x0003001b,0x0000001d,0x0000001c,0x00040020,0x0000001e,
|
||||
0x00000000,0x0000001d,0x0004003b,0x0000001e,0x0000001f,0x00000000,0x0004002b,0x00000006,
|
||||
0x00000021,0x00000000,0x0005002c,0x00000007,0x00000026,0x00000021,0x00000021,0x0004002b,
|
||||
0x00000006,0x00000028,0x00000001,0x0005002c,0x00000007,0x00000029,0x00000028,0x00000028,
|
||||
0x00040017,0x0000002d,0x00000009,0x00000004,0x00040017,0x00000041,0x00000009,0x00000002,
|
||||
0x00040020,0x00000042,0x00000001,0x00000041,0x0004003b,0x00000042,0x00000043,0x00000001,
|
||||
0x0005001e,0x00000045,0x0000002d,0x00000041,0x00000009,0x00040020,0x00000046,0x00000009,
|
||||
0x00000045,0x0004003b,0x00000046,0x00000047,0x00000009,0x00040020,0x00000048,0x00000009,
|
||||
0x00000041,0x0004002b,0x00000009,0x0000004e,0xbf800000,0x0004002b,0x00000009,0x0000004f,
|
||||
0x41000000,0x0004002b,0x00000009,0x00000050,0x40a00000,0x0004002b,0x00000006,0x00000051,
|
||||
0x00000002,0x00040020,0x00000052,0x00000009,0x00000009,0x0004002b,0x00000009,0x00000055,
|
||||
0x00000000,0x0004002b,0x00000009,0x00000056,0x3f800000,0x00040020,0x0000005a,0x00000007,
|
||||
0x0000000a,0x0004002b,0x00000006,0x0000005d,0xffffffff,0x0005002c,0x00000007,0x0000005e,
|
||||
0x00000021,0x0000005d,0x0005002c,0x00000007,0x00000064,0x0000005d,0x00000021,0x0005002c,
|
||||
0x00000007,0x0000006e,0x00000028,0x00000021,0x0005002c,0x00000007,0x00000074,0x00000021,
|
||||
0x00000028,0x00040015,0x0000007a,0x00000020,0x00000000,0x0004002b,0x0000007a,0x0000007b,
|
||||
0x00000001,0x0004002b,0x00000009,0x000000a2,0x3a800000,0x0004002b,0x00000009,0x000000b4,
|
||||
0x40800000,0x00040020,0x000000d0,0x00000003,0x0000002d,0x0004003b,0x000000d0,0x000000d1,
|
||||
0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,
|
||||
0x0004003b,0x00000008,0x00000040,0x00000007,0x0004003b,0x0000000f,0x0000004d,0x00000007,
|
||||
0x0004003b,0x0000005a,0x0000005b,0x00000007,0x0004003b,0x00000008,0x00000060,0x00000007,
|
||||
0x0004003b,0x0000005a,0x00000062,0x00000007,0x0004003b,0x00000008,0x00000066,0x00000007,
|
||||
0x0004003b,0x0000005a,0x00000068,0x00000007,0x0004003b,0x00000008,0x00000069,0x00000007,
|
||||
0x0004003b,0x0000005a,0x0000006c,0x00000007,0x0004003b,0x00000008,0x00000070,0x00000007,
|
||||
0x0004003b,0x0000005a,0x00000072,0x00000007,0x0004003b,0x00000008,0x00000076,0x00000007,
|
||||
0x0004003b,0x0000000f,0x00000078,0x00000007,0x0004003b,0x0000000f,0x00000079,0x00000007,
|
||||
0x0004003b,0x0000000f,0x0000007e,0x00000007,0x0004003b,0x0000000f,0x00000081,0x00000007,
|
||||
0x0004003b,0x0000000f,0x00000085,0x00000007,0x0004003b,0x0000000f,0x00000086,0x00000007,
|
||||
0x0004003b,0x0000000f,0x00000089,0x00000007,0x0004003b,0x0000000f,0x0000008d,0x00000007,
|
||||
0x0004003b,0x0000000f,0x0000008e,0x00000007,0x0004003b,0x0000000f,0x00000091,0x00000007,
|
||||
0x0004003b,0x0000000f,0x00000094,0x00000007,0x0004003b,0x0000000f,0x00000098,0x00000007,
|
||||
0x0004003b,0x0000000f,0x00000099,0x00000007,0x0004003b,0x0000000f,0x0000009c,0x00000007,
|
||||
0x0004003b,0x0000000f,0x000000a0,0x00000007,0x0004003b,0x0000000f,0x000000a5,0x00000007,
|
||||
0x0004003b,0x0000000f,0x000000af,0x00000007,0x0004003b,0x0000000f,0x000000b3,0x00000007,
|
||||
0x0004003b,0x0000005a,0x000000b9,0x00000007,0x0004003d,0x00000041,0x00000044,0x00000043,
|
||||
0x00050041,0x00000048,0x00000049,0x00000047,0x00000028,0x0004003d,0x00000041,0x0000004a,
|
||||
0x00000049,0x00050085,0x00000041,0x0000004b,0x00000044,0x0000004a,0x0004006e,0x00000007,
|
||||
0x0000004c,0x0000004b,0x0003003e,0x00000040,0x0000004c,0x00050041,0x00000052,0x00000053,
|
||||
0x00000047,0x00000051,0x0004003d,0x00000009,0x00000054,0x00000053,0x0008000c,0x00000009,
|
||||
0x00000057,0x00000001,0x0000002b,0x00000054,0x00000055,0x00000056,0x0008000c,0x00000009,
|
||||
0x00000058,0x00000001,0x0000002e,0x0000004f,0x00000050,0x00000057,0x00050088,0x00000009,
|
||||
0x00000059,0x0000004e,0x00000058,0x0003003e,0x0000004d,0x00000059,0x0004003d,0x00000007,
|
||||
0x0000005c,0x00000040,0x00050080,0x00000007,0x0000005f,0x0000005c,0x0000005e,0x0003003e,
|
||||
0x00000060,0x0000005f,0x00050039,0x0000000a,0x00000061,0x0000000d,0x00000060,0x0003003e,
|
||||
0x0000005b,0x00000061,0x0004003d,0x00000007,0x00000063,0x00000040,0x00050080,0x00000007,
|
||||
0x00000065,0x00000063,0x00000064,0x0003003e,0x00000066,0x00000065,0x00050039,0x0000000a,
|
||||
0x00000067,0x0000000d,0x00000066,0x0003003e,0x00000062,0x00000067,0x0004003d,0x00000007,
|
||||
0x0000006a,0x00000040,0x0003003e,0x00000069,0x0000006a,0x00050039,0x0000000a,0x0000006b,
|
||||
0x0000000d,0x00000069,0x0003003e,0x00000068,0x0000006b,0x0004003d,0x00000007,0x0000006d,
|
||||
0x00000040,0x00050080,0x00000007,0x0000006f,0x0000006d,0x0000006e,0x0003003e,0x00000070,
|
||||
0x0000006f,0x00050039,0x0000000a,0x00000071,0x0000000d,0x00000070,0x0003003e,0x0000006c,
|
||||
0x00000071,0x0004003d,0x00000007,0x00000073,0x00000040,0x00050080,0x00000007,0x00000075,
|
||||
0x00000073,0x00000074,0x0003003e,0x00000076,0x00000075,0x00050039,0x0000000a,0x00000077,
|
||||
0x0000000d,0x00000076,0x0003003e,0x00000072,0x00000077,0x00050041,0x0000000f,0x0000007c,
|
||||
0x00000062,0x0000007b,0x0004003d,0x00000009,0x0000007d,0x0000007c,0x0003003e,0x00000079,
|
||||
0x0000007d,0x00050041,0x0000000f,0x0000007f,0x00000068,0x0000007b,0x0004003d,0x00000009,
|
||||
0x00000080,0x0000007f,0x0003003e,0x0000007e,0x00000080,0x00050041,0x0000000f,0x00000082,
|
||||
0x0000006c,0x0000007b,0x0004003d,0x00000009,0x00000083,0x00000082,0x0003003e,0x00000081,
|
||||
0x00000083,0x00070039,0x00000009,0x00000084,0x00000014,0x00000079,0x0000007e,0x00000081,
|
||||
0x0003003e,0x00000085,0x00000084,0x00050041,0x0000000f,0x00000087,0x0000005b,0x0000007b,
|
||||
0x0004003d,0x00000009,0x00000088,0x00000087,0x0003003e,0x00000086,0x00000088,0x00050041,
|
||||
0x0000000f,0x0000008a,0x00000072,0x0000007b,0x0004003d,0x00000009,0x0000008b,0x0000008a,
|
||||
0x0003003e,0x00000089,0x0000008b,0x00070039,0x00000009,0x0000008c,0x00000014,0x00000085,
|
||||
0x00000086,0x00000089,0x0003003e,0x00000078,0x0000008c,0x00050041,0x0000000f,0x0000008f,
|
||||
0x00000062,0x0000007b,0x0004003d,0x00000009,0x00000090,0x0000008f,0x0003003e,0x0000008e,
|
||||
0x00000090,0x00050041,0x0000000f,0x00000092,0x00000068,0x0000007b,0x0004003d,0x00000009,
|
||||
0x00000093,0x00000092,0x0003003e,0x00000091,0x00000093,0x00050041,0x0000000f,0x00000095,
|
||||
0x0000006c,0x0000007b,0x0004003d,0x00000009,0x00000096,0x00000095,0x0003003e,0x00000094,
|
||||
0x00000096,0x00070039,0x00000009,0x00000097,0x00000019,0x0000008e,0x00000091,0x00000094,
|
||||
0x0003003e,0x00000098,0x00000097,0x00050041,0x0000000f,0x0000009a,0x0000005b,0x0000007b,
|
||||
0x0004003d,0x00000009,0x0000009b,0x0000009a,0x0003003e,0x00000099,0x0000009b,0x00050041,
|
||||
0x0000000f,0x0000009d,0x00000072,0x0000007b,0x0004003d,0x00000009,0x0000009e,0x0000009d,
|
||||
0x0003003e,0x0000009c,0x0000009e,0x00070039,0x00000009,0x0000009f,0x00000019,0x00000098,
|
||||
0x00000099,0x0000009c,0x0003003e,0x0000008d,0x0000009f,0x0004003d,0x00000009,0x000000a1,
|
||||
0x0000008d,0x0007000c,0x00000009,0x000000a3,0x00000001,0x00000028,0x000000a1,0x000000a2,
|
||||
0x00050088,0x00000009,0x000000a4,0x00000056,0x000000a3,0x0003003e,0x000000a0,0x000000a4,
|
||||
0x0004003d,0x00000009,0x000000a6,0x00000078,0x0004003d,0x00000009,0x000000a7,0x0000008d,
|
||||
0x00050083,0x00000009,0x000000a8,0x00000056,0x000000a7,0x0007000c,0x00000009,0x000000a9,
|
||||
0x00000001,0x00000025,0x000000a6,0x000000a8,0x0004003d,0x00000009,0x000000aa,0x000000a0,
|
||||
0x00050085,0x00000009,0x000000ab,0x000000a9,0x000000aa,0x0008000c,0x00000009,0x000000ac,
|
||||
0x00000001,0x0000002b,0x000000ab,0x00000055,0x00000056,0x0003003e,0x000000a5,0x000000ac,
|
||||
0x0004003d,0x00000009,0x000000ad,0x000000a5,0x0006000c,0x00000009,0x000000ae,0x00000001,
|
||||
0x0000001f,0x000000ad,0x0003003e,0x000000a5,0x000000ae,0x0004003d,0x00000009,0x000000b0,
|
||||
0x000000a5,0x0004003d,0x00000009,0x000000b1,0x0000004d,0x00050085,0x00000009,0x000000b2,
|
||||
0x000000b0,0x000000b1,0x0003003e,0x000000af,0x000000b2,0x0004003d,0x00000009,0x000000b5,
|
||||
0x000000af,0x00050085,0x00000009,0x000000b6,0x000000b4,0x000000b5,0x00050081,0x00000009,
|
||||
0x000000b7,0x00000056,0x000000b6,0x00050088,0x00000009,0x000000b8,0x00000056,0x000000b7,
|
||||
0x0003003e,0x000000b3,0x000000b8,0x0004003d,0x0000000a,0x000000ba,0x0000005b,0x0004003d,
|
||||
0x00000009,0x000000bb,0x000000af,0x0005008e,0x0000000a,0x000000bc,0x000000ba,0x000000bb,
|
||||
0x0004003d,0x0000000a,0x000000bd,0x00000062,0x0004003d,0x00000009,0x000000be,0x000000af,
|
||||
0x0005008e,0x0000000a,0x000000bf,0x000000bd,0x000000be,0x00050081,0x0000000a,0x000000c0,
|
||||
0x000000bc,0x000000bf,0x0004003d,0x0000000a,0x000000c1,0x0000006c,0x0004003d,0x00000009,
|
||||
0x000000c2,0x000000af,0x0005008e,0x0000000a,0x000000c3,0x000000c1,0x000000c2,0x00050081,
|
||||
0x0000000a,0x000000c4,0x000000c0,0x000000c3,0x0004003d,0x0000000a,0x000000c5,0x00000072,
|
||||
0x0004003d,0x00000009,0x000000c6,0x000000af,0x0005008e,0x0000000a,0x000000c7,0x000000c5,
|
||||
0x000000c6,0x00050081,0x0000000a,0x000000c8,0x000000c4,0x000000c7,0x0004003d,0x0000000a,
|
||||
0x000000c9,0x00000068,0x00050081,0x0000000a,0x000000ca,0x000000c8,0x000000c9,0x0004003d,
|
||||
0x00000009,0x000000cb,0x000000b3,0x0005008e,0x0000000a,0x000000cc,0x000000ca,0x000000cb,
|
||||
0x00060050,0x0000000a,0x000000cd,0x00000055,0x00000055,0x00000055,0x00060050,0x0000000a,
|
||||
0x000000ce,0x00000056,0x00000056,0x00000056,0x0008000c,0x0000000a,0x000000cf,0x00000001,
|
||||
0x0000002b,0x000000cc,0x000000cd,0x000000ce,0x0003003e,0x000000b9,0x000000cf,0x0004003d,
|
||||
0x0000000a,0x000000d2,0x000000b9,0x00050051,0x00000009,0x000000d3,0x000000d2,0x00000000,
|
||||
0x00050051,0x00000009,0x000000d4,0x000000d2,0x00000001,0x00050051,0x00000009,0x000000d5,
|
||||
0x000000d2,0x00000002,0x00070050,0x0000002d,0x000000d6,0x000000d3,0x000000d4,0x000000d5,
|
||||
0x00000056,0x0003003e,0x000000d1,0x000000d6,0x000100fd,0x00010038,0x00050036,0x0000000a,
|
||||
0x0000000d,0x00000000,0x0000000b,0x00030037,0x00000008,0x0000000c,0x000200f8,0x0000000e,
|
||||
0x0004003b,0x00000008,0x0000001b,0x00000007,0x0004003d,0x0000001d,0x00000020,0x0000001f,
|
||||
0x00040064,0x0000001c,0x00000022,0x00000020,0x00050067,0x00000007,0x00000023,0x00000022,
|
||||
0x00000021,0x0003003e,0x0000001b,0x00000023,0x0004003d,0x0000001d,0x00000024,0x0000001f,
|
||||
0x0004003d,0x00000007,0x00000025,0x0000000c,0x0004003d,0x00000007,0x00000027,0x0000001b,
|
||||
0x00050082,0x00000007,0x0000002a,0x00000027,0x00000029,0x0008000c,0x00000007,0x0000002b,
|
||||
0x00000001,0x0000002d,0x00000025,0x00000026,0x0000002a,0x00040064,0x0000001c,0x0000002c,
|
||||
0x00000024,0x0007005f,0x0000002d,0x0000002e,0x0000002c,0x0000002b,0x00000002,0x00000021,
|
||||
0x0008004f,0x0000000a,0x0000002f,0x0000002e,0x0000002e,0x00000000,0x00000001,0x00000002,
|
||||
0x000200fe,0x0000002f,0x00010038,0x00050036,0x00000009,0x00000014,0x00000000,0x00000010,
|
||||
0x00030037,0x0000000f,0x00000011,0x00030037,0x0000000f,0x00000012,0x00030037,0x0000000f,
|
||||
0x00000013,0x000200f8,0x00000015,0x0004003d,0x00000009,0x00000032,0x00000011,0x0004003d,
|
||||
0x00000009,0x00000033,0x00000012,0x0004003d,0x00000009,0x00000034,0x00000013,0x0007000c,
|
||||
0x00000009,0x00000035,0x00000001,0x00000025,0x00000033,0x00000034,0x0007000c,0x00000009,
|
||||
0x00000036,0x00000001,0x00000025,0x00000032,0x00000035,0x000200fe,0x00000036,0x00010038,
|
||||
0x00050036,0x00000009,0x00000019,0x00000000,0x00000010,0x00030037,0x0000000f,0x00000016,
|
||||
0x00030037,0x0000000f,0x00000017,0x00030037,0x0000000f,0x00000018,0x000200f8,0x0000001a,
|
||||
0x0004003d,0x00000009,0x00000039,0x00000016,0x0004003d,0x00000009,0x0000003a,0x00000017,
|
||||
0x0004003d,0x00000009,0x0000003b,0x00000018,0x0007000c,0x00000009,0x0000003c,0x00000001,
|
||||
0x00000028,0x0000003a,0x0000003b,0x0007000c,0x00000009,0x0000003d,0x00000001,0x00000028,
|
||||
0x00000039,0x0000003c,0x000200fe,0x0000003d,0x00010038
|
||||
0x07230203,0x00010000,0x0008000b,0x000000d7,0x00000000,0x00020011,0x00000001,0x0006000b,
|
||||
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
|
||||
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000047,0x000000d1,0x00030010,
|
||||
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
|
||||
0x00000000,0x00060005,0x0000000d,0x4c736143,0x2864616f,0x3b326976,0x00000000,0x00030005,
|
||||
0x0000000c,0x00000070,0x00070005,0x00000014,0x6e694d41,0x28314633,0x663b3166,0x31663b31,
|
||||
0x0000003b,0x00030005,0x00000011,0x00000078,0x00030005,0x00000012,0x00000079,0x00030005,
|
||||
0x00000013,0x0000007a,0x00070005,0x00000019,0x78614d41,0x28314633,0x663b3166,0x31663b31,
|
||||
0x0000003b,0x00030005,0x00000016,0x00000078,0x00030005,0x00000017,0x00000079,0x00030005,
|
||||
0x00000018,0x0000007a,0x00030005,0x0000001d,0x00007675,0x00030005,0x00000024,0x00004350,
|
||||
0x00040006,0x00000024,0x00000000,0x0063646e,0x00060006,0x00000024,0x00000001,0x6f736572,
|
||||
0x6974756c,0x00006e6f,0x00060006,0x00000024,0x00000002,0x72616873,0x73656e70,0x00000073,
|
||||
0x00030005,0x00000026,0x00006370,0x00060005,0x0000002f,0x75706e49,0x78655474,0x65727574,
|
||||
0x00000000,0x00030005,0x00000045,0x00007073,0x00060005,0x00000047,0x67617266,0x43786554,
|
||||
0x64726f6f,0x00000000,0x00040005,0x0000004d,0x6b616570,0x00000000,0x00030005,0x0000005a,
|
||||
0x00000062,0x00040005,0x00000060,0x61726170,0x0000006d,0x00030005,0x00000062,0x00000064,
|
||||
0x00040005,0x00000066,0x61726170,0x0000006d,0x00030005,0x00000068,0x00000065,0x00040005,
|
||||
0x00000069,0x61726170,0x0000006d,0x00030005,0x0000006c,0x00000066,0x00040005,0x00000070,
|
||||
0x61726170,0x0000006d,0x00030005,0x00000072,0x00000068,0x00040005,0x00000076,0x61726170,
|
||||
0x0000006d,0x00030005,0x00000078,0x00476e6d,0x00040005,0x00000079,0x61726170,0x0000006d,
|
||||
0x00040005,0x0000007e,0x61726170,0x0000006d,0x00040005,0x00000081,0x61726170,0x0000006d,
|
||||
0x00040005,0x00000085,0x61726170,0x0000006d,0x00040005,0x00000086,0x61726170,0x0000006d,
|
||||
0x00040005,0x00000089,0x61726170,0x0000006d,0x00030005,0x0000008d,0x0047786d,0x00040005,
|
||||
0x0000008e,0x61726170,0x0000006d,0x00040005,0x00000091,0x61726170,0x0000006d,0x00040005,
|
||||
0x00000094,0x61726170,0x0000006d,0x00040005,0x00000098,0x61726170,0x0000006d,0x00040005,
|
||||
0x00000099,0x61726170,0x0000006d,0x00040005,0x0000009c,0x61726170,0x0000006d,0x00040005,
|
||||
0x000000a0,0x4d706372,0x00000047,0x00040005,0x000000a5,0x47706d61,0x00000000,0x00030005,
|
||||
0x000000af,0x00004777,0x00050005,0x000000b3,0x57706372,0x68676965,0x00000074,0x00030005,
|
||||
0x000000b9,0x00786970,0x00050005,0x000000d1,0x4374756f,0x726f6c6f,0x00000000,0x00030047,
|
||||
0x0000000d,0x00000000,0x00030047,0x00000011,0x00000000,0x00030047,0x00000012,0x00000000,
|
||||
0x00030047,0x00000013,0x00000000,0x00030047,0x00000014,0x00000000,0x00030047,0x00000016,
|
||||
0x00000000,0x00030047,0x00000017,0x00000000,0x00030047,0x00000018,0x00000000,0x00030047,
|
||||
0x00000019,0x00000000,0x00030047,0x00000024,0x00000002,0x00050048,0x00000024,0x00000000,
|
||||
0x00000023,0x00000000,0x00050048,0x00000024,0x00000001,0x00000023,0x00000010,0x00040048,
|
||||
0x00000024,0x00000002,0x00000000,0x00050048,0x00000024,0x00000002,0x00000023,0x00000018,
|
||||
0x00030047,0x0000002f,0x00000000,0x00040047,0x0000002f,0x00000021,0x00000000,0x00040047,
|
||||
0x0000002f,0x00000022,0x00000000,0x00030047,0x00000030,0x00000000,0x00030047,0x00000033,
|
||||
0x00000000,0x00030047,0x00000034,0x00000000,0x00030047,0x00000037,0x00000000,0x00030047,
|
||||
0x00000038,0x00000000,0x00030047,0x00000039,0x00000000,0x00030047,0x0000003a,0x00000000,
|
||||
0x00030047,0x0000003b,0x00000000,0x00030047,0x0000003e,0x00000000,0x00030047,0x0000003f,
|
||||
0x00000000,0x00030047,0x00000040,0x00000000,0x00030047,0x00000041,0x00000000,0x00030047,
|
||||
0x00000042,0x00000000,0x00040047,0x00000047,0x0000001e,0x00000000,0x00030047,0x0000004d,
|
||||
0x00000000,0x00030047,0x00000054,0x00000000,0x00030047,0x00000056,0x00000000,0x00030047,
|
||||
0x00000057,0x00000000,0x00030047,0x00000058,0x00000000,0x00030047,0x0000005a,0x00000000,
|
||||
0x00030047,0x00000061,0x00000000,0x00030047,0x00000062,0x00000000,0x00030047,0x00000067,
|
||||
0x00000000,0x00030047,0x00000068,0x00000000,0x00030047,0x0000006b,0x00000000,0x00030047,
|
||||
0x0000006c,0x00000000,0x00030047,0x00000071,0x00000000,0x00030047,0x00000072,0x00000000,
|
||||
0x00030047,0x00000077,0x00000000,0x00030047,0x00000078,0x00000000,0x00030047,0x00000079,
|
||||
0x00000000,0x00030047,0x0000007d,0x00000000,0x00030047,0x0000007e,0x00000000,0x00030047,
|
||||
0x00000080,0x00000000,0x00030047,0x00000081,0x00000000,0x00030047,0x00000083,0x00000000,
|
||||
0x00030047,0x00000084,0x00000000,0x00030047,0x00000085,0x00000000,0x00030047,0x00000086,
|
||||
0x00000000,0x00030047,0x00000088,0x00000000,0x00030047,0x00000089,0x00000000,0x00030047,
|
||||
0x0000008b,0x00000000,0x00030047,0x0000008c,0x00000000,0x00030047,0x0000008d,0x00000000,
|
||||
0x00030047,0x0000008e,0x00000000,0x00030047,0x00000090,0x00000000,0x00030047,0x00000091,
|
||||
0x00000000,0x00030047,0x00000093,0x00000000,0x00030047,0x00000094,0x00000000,0x00030047,
|
||||
0x00000096,0x00000000,0x00030047,0x00000097,0x00000000,0x00030047,0x00000098,0x00000000,
|
||||
0x00030047,0x00000099,0x00000000,0x00030047,0x0000009b,0x00000000,0x00030047,0x0000009c,
|
||||
0x00000000,0x00030047,0x0000009e,0x00000000,0x00030047,0x0000009f,0x00000000,0x00030047,
|
||||
0x000000a0,0x00000000,0x00030047,0x000000a1,0x00000000,0x00030047,0x000000a3,0x00000000,
|
||||
0x00030047,0x000000a4,0x00000000,0x00030047,0x000000a5,0x00000000,0x00030047,0x000000a6,
|
||||
0x00000000,0x00030047,0x000000a7,0x00000000,0x00030047,0x000000a8,0x00000000,0x00030047,
|
||||
0x000000a9,0x00000000,0x00030047,0x000000aa,0x00000000,0x00030047,0x000000ab,0x00000000,
|
||||
0x00030047,0x000000ac,0x00000000,0x00030047,0x000000ad,0x00000000,0x00030047,0x000000ae,
|
||||
0x00000000,0x00030047,0x000000af,0x00000000,0x00030047,0x000000b0,0x00000000,0x00030047,
|
||||
0x000000b1,0x00000000,0x00030047,0x000000b2,0x00000000,0x00030047,0x000000b3,0x00000000,
|
||||
0x00030047,0x000000b5,0x00000000,0x00030047,0x000000b6,0x00000000,0x00030047,0x000000b7,
|
||||
0x00000000,0x00030047,0x000000b8,0x00000000,0x00030047,0x000000b9,0x00000000,0x00030047,
|
||||
0x000000ba,0x00000000,0x00030047,0x000000bb,0x00000000,0x00030047,0x000000bc,0x00000000,
|
||||
0x00030047,0x000000bd,0x00000000,0x00030047,0x000000be,0x00000000,0x00030047,0x000000bf,
|
||||
0x00000000,0x00030047,0x000000c0,0x00000000,0x00030047,0x000000c1,0x00000000,0x00030047,
|
||||
0x000000c2,0x00000000,0x00030047,0x000000c3,0x00000000,0x00030047,0x000000c4,0x00000000,
|
||||
0x00030047,0x000000c5,0x00000000,0x00030047,0x000000c6,0x00000000,0x00030047,0x000000c7,
|
||||
0x00000000,0x00030047,0x000000c8,0x00000000,0x00030047,0x000000c9,0x00000000,0x00030047,
|
||||
0x000000ca,0x00000000,0x00030047,0x000000cb,0x00000000,0x00030047,0x000000cc,0x00000000,
|
||||
0x00030047,0x000000cd,0x00000000,0x00030047,0x000000ce,0x00000000,0x00030047,0x000000cf,
|
||||
0x00000000,0x00030047,0x000000d1,0x00000000,0x00040047,0x000000d1,0x0000001e,0x00000000,
|
||||
0x00030047,0x000000d2,0x00000000,0x00030047,0x000000d3,0x00000000,0x00030047,0x000000d4,
|
||||
0x00000000,0x00030047,0x000000d5,0x00000000,0x00030047,0x000000d6,0x00000000,0x00020013,
|
||||
0x00000002,0x00030021,0x00000003,0x00000002,0x00040015,0x00000006,0x00000020,0x00000001,
|
||||
0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,
|
||||
0x00030016,0x00000009,0x00000020,0x00040017,0x0000000a,0x00000009,0x00000003,0x00040021,
|
||||
0x0000000b,0x0000000a,0x00000008,0x00040020,0x0000000f,0x00000007,0x00000009,0x00060021,
|
||||
0x00000010,0x00000009,0x0000000f,0x0000000f,0x0000000f,0x00040017,0x0000001b,0x00000009,
|
||||
0x00000002,0x00040020,0x0000001c,0x00000007,0x0000001b,0x0004002b,0x00000009,0x00000020,
|
||||
0x3f000000,0x00040017,0x00000023,0x00000009,0x00000004,0x0005001e,0x00000024,0x00000023,
|
||||
0x0000001b,0x00000009,0x00040020,0x00000025,0x00000009,0x00000024,0x0004003b,0x00000025,
|
||||
0x00000026,0x00000009,0x0004002b,0x00000006,0x00000027,0x00000001,0x00040020,0x00000028,
|
||||
0x00000009,0x0000001b,0x00090019,0x0000002c,0x00000009,0x00000001,0x00000000,0x00000000,
|
||||
0x00000000,0x00000001,0x00000000,0x0003001b,0x0000002d,0x0000002c,0x00040020,0x0000002e,
|
||||
0x00000000,0x0000002d,0x0004003b,0x0000002e,0x0000002f,0x00000000,0x0004002b,0x00000009,
|
||||
0x00000032,0x00000000,0x00040020,0x00000046,0x00000001,0x0000001b,0x0004003b,0x00000046,
|
||||
0x00000047,0x00000001,0x0004002b,0x00000009,0x0000004e,0xbf800000,0x0004002b,0x00000009,
|
||||
0x0000004f,0x41000000,0x0004002b,0x00000009,0x00000050,0x40a00000,0x0004002b,0x00000006,
|
||||
0x00000051,0x00000002,0x00040020,0x00000052,0x00000009,0x00000009,0x0004002b,0x00000009,
|
||||
0x00000055,0x3f800000,0x00040020,0x00000059,0x00000007,0x0000000a,0x0004002b,0x00000006,
|
||||
0x0000005c,0x00000000,0x0004002b,0x00000006,0x0000005d,0xffffffff,0x0005002c,0x00000007,
|
||||
0x0000005e,0x0000005c,0x0000005d,0x0005002c,0x00000007,0x00000064,0x0000005d,0x0000005c,
|
||||
0x0005002c,0x00000007,0x0000006e,0x00000027,0x0000005c,0x0005002c,0x00000007,0x00000074,
|
||||
0x0000005c,0x00000027,0x00040015,0x0000007a,0x00000020,0x00000000,0x0004002b,0x0000007a,
|
||||
0x0000007b,0x00000001,0x0004002b,0x00000009,0x000000a2,0x3a800000,0x0004002b,0x00000009,
|
||||
0x000000b4,0x40800000,0x00040020,0x000000d0,0x00000003,0x00000023,0x0004003b,0x000000d0,
|
||||
0x000000d1,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
|
||||
0x00000005,0x0004003b,0x00000008,0x00000045,0x00000007,0x0004003b,0x0000000f,0x0000004d,
|
||||
0x00000007,0x0004003b,0x00000059,0x0000005a,0x00000007,0x0004003b,0x00000008,0x00000060,
|
||||
0x00000007,0x0004003b,0x00000059,0x00000062,0x00000007,0x0004003b,0x00000008,0x00000066,
|
||||
0x00000007,0x0004003b,0x00000059,0x00000068,0x00000007,0x0004003b,0x00000008,0x00000069,
|
||||
0x00000007,0x0004003b,0x00000059,0x0000006c,0x00000007,0x0004003b,0x00000008,0x00000070,
|
||||
0x00000007,0x0004003b,0x00000059,0x00000072,0x00000007,0x0004003b,0x00000008,0x00000076,
|
||||
0x00000007,0x0004003b,0x0000000f,0x00000078,0x00000007,0x0004003b,0x0000000f,0x00000079,
|
||||
0x00000007,0x0004003b,0x0000000f,0x0000007e,0x00000007,0x0004003b,0x0000000f,0x00000081,
|
||||
0x00000007,0x0004003b,0x0000000f,0x00000085,0x00000007,0x0004003b,0x0000000f,0x00000086,
|
||||
0x00000007,0x0004003b,0x0000000f,0x00000089,0x00000007,0x0004003b,0x0000000f,0x0000008d,
|
||||
0x00000007,0x0004003b,0x0000000f,0x0000008e,0x00000007,0x0004003b,0x0000000f,0x00000091,
|
||||
0x00000007,0x0004003b,0x0000000f,0x00000094,0x00000007,0x0004003b,0x0000000f,0x00000098,
|
||||
0x00000007,0x0004003b,0x0000000f,0x00000099,0x00000007,0x0004003b,0x0000000f,0x0000009c,
|
||||
0x00000007,0x0004003b,0x0000000f,0x000000a0,0x00000007,0x0004003b,0x0000000f,0x000000a5,
|
||||
0x00000007,0x0004003b,0x0000000f,0x000000af,0x00000007,0x0004003b,0x0000000f,0x000000b3,
|
||||
0x00000007,0x0004003b,0x00000059,0x000000b9,0x00000007,0x0004003d,0x0000001b,0x00000048,
|
||||
0x00000047,0x00050041,0x00000028,0x00000049,0x00000026,0x00000027,0x0004003d,0x0000001b,
|
||||
0x0000004a,0x00000049,0x00050085,0x0000001b,0x0000004b,0x00000048,0x0000004a,0x0004006e,
|
||||
0x00000007,0x0000004c,0x0000004b,0x0003003e,0x00000045,0x0000004c,0x00050041,0x00000052,
|
||||
0x00000053,0x00000026,0x00000051,0x0004003d,0x00000009,0x00000054,0x00000053,0x0008000c,
|
||||
0x00000009,0x00000056,0x00000001,0x0000002b,0x00000054,0x00000032,0x00000055,0x0008000c,
|
||||
0x00000009,0x00000057,0x00000001,0x0000002e,0x0000004f,0x00000050,0x00000056,0x00050088,
|
||||
0x00000009,0x00000058,0x0000004e,0x00000057,0x0003003e,0x0000004d,0x00000058,0x0004003d,
|
||||
0x00000007,0x0000005b,0x00000045,0x00050080,0x00000007,0x0000005f,0x0000005b,0x0000005e,
|
||||
0x0003003e,0x00000060,0x0000005f,0x00050039,0x0000000a,0x00000061,0x0000000d,0x00000060,
|
||||
0x0003003e,0x0000005a,0x00000061,0x0004003d,0x00000007,0x00000063,0x00000045,0x00050080,
|
||||
0x00000007,0x00000065,0x00000063,0x00000064,0x0003003e,0x00000066,0x00000065,0x00050039,
|
||||
0x0000000a,0x00000067,0x0000000d,0x00000066,0x0003003e,0x00000062,0x00000067,0x0004003d,
|
||||
0x00000007,0x0000006a,0x00000045,0x0003003e,0x00000069,0x0000006a,0x00050039,0x0000000a,
|
||||
0x0000006b,0x0000000d,0x00000069,0x0003003e,0x00000068,0x0000006b,0x0004003d,0x00000007,
|
||||
0x0000006d,0x00000045,0x00050080,0x00000007,0x0000006f,0x0000006d,0x0000006e,0x0003003e,
|
||||
0x00000070,0x0000006f,0x00050039,0x0000000a,0x00000071,0x0000000d,0x00000070,0x0003003e,
|
||||
0x0000006c,0x00000071,0x0004003d,0x00000007,0x00000073,0x00000045,0x00050080,0x00000007,
|
||||
0x00000075,0x00000073,0x00000074,0x0003003e,0x00000076,0x00000075,0x00050039,0x0000000a,
|
||||
0x00000077,0x0000000d,0x00000076,0x0003003e,0x00000072,0x00000077,0x00050041,0x0000000f,
|
||||
0x0000007c,0x00000062,0x0000007b,0x0004003d,0x00000009,0x0000007d,0x0000007c,0x0003003e,
|
||||
0x00000079,0x0000007d,0x00050041,0x0000000f,0x0000007f,0x00000068,0x0000007b,0x0004003d,
|
||||
0x00000009,0x00000080,0x0000007f,0x0003003e,0x0000007e,0x00000080,0x00050041,0x0000000f,
|
||||
0x00000082,0x0000006c,0x0000007b,0x0004003d,0x00000009,0x00000083,0x00000082,0x0003003e,
|
||||
0x00000081,0x00000083,0x00070039,0x00000009,0x00000084,0x00000014,0x00000079,0x0000007e,
|
||||
0x00000081,0x0003003e,0x00000085,0x00000084,0x00050041,0x0000000f,0x00000087,0x0000005a,
|
||||
0x0000007b,0x0004003d,0x00000009,0x00000088,0x00000087,0x0003003e,0x00000086,0x00000088,
|
||||
0x00050041,0x0000000f,0x0000008a,0x00000072,0x0000007b,0x0004003d,0x00000009,0x0000008b,
|
||||
0x0000008a,0x0003003e,0x00000089,0x0000008b,0x00070039,0x00000009,0x0000008c,0x00000014,
|
||||
0x00000085,0x00000086,0x00000089,0x0003003e,0x00000078,0x0000008c,0x00050041,0x0000000f,
|
||||
0x0000008f,0x00000062,0x0000007b,0x0004003d,0x00000009,0x00000090,0x0000008f,0x0003003e,
|
||||
0x0000008e,0x00000090,0x00050041,0x0000000f,0x00000092,0x00000068,0x0000007b,0x0004003d,
|
||||
0x00000009,0x00000093,0x00000092,0x0003003e,0x00000091,0x00000093,0x00050041,0x0000000f,
|
||||
0x00000095,0x0000006c,0x0000007b,0x0004003d,0x00000009,0x00000096,0x00000095,0x0003003e,
|
||||
0x00000094,0x00000096,0x00070039,0x00000009,0x00000097,0x00000019,0x0000008e,0x00000091,
|
||||
0x00000094,0x0003003e,0x00000098,0x00000097,0x00050041,0x0000000f,0x0000009a,0x0000005a,
|
||||
0x0000007b,0x0004003d,0x00000009,0x0000009b,0x0000009a,0x0003003e,0x00000099,0x0000009b,
|
||||
0x00050041,0x0000000f,0x0000009d,0x00000072,0x0000007b,0x0004003d,0x00000009,0x0000009e,
|
||||
0x0000009d,0x0003003e,0x0000009c,0x0000009e,0x00070039,0x00000009,0x0000009f,0x00000019,
|
||||
0x00000098,0x00000099,0x0000009c,0x0003003e,0x0000008d,0x0000009f,0x0004003d,0x00000009,
|
||||
0x000000a1,0x0000008d,0x0007000c,0x00000009,0x000000a3,0x00000001,0x00000028,0x000000a1,
|
||||
0x000000a2,0x00050088,0x00000009,0x000000a4,0x00000055,0x000000a3,0x0003003e,0x000000a0,
|
||||
0x000000a4,0x0004003d,0x00000009,0x000000a6,0x00000078,0x0004003d,0x00000009,0x000000a7,
|
||||
0x0000008d,0x00050083,0x00000009,0x000000a8,0x00000055,0x000000a7,0x0007000c,0x00000009,
|
||||
0x000000a9,0x00000001,0x00000025,0x000000a6,0x000000a8,0x0004003d,0x00000009,0x000000aa,
|
||||
0x000000a0,0x00050085,0x00000009,0x000000ab,0x000000a9,0x000000aa,0x0008000c,0x00000009,
|
||||
0x000000ac,0x00000001,0x0000002b,0x000000ab,0x00000032,0x00000055,0x0003003e,0x000000a5,
|
||||
0x000000ac,0x0004003d,0x00000009,0x000000ad,0x000000a5,0x0006000c,0x00000009,0x000000ae,
|
||||
0x00000001,0x0000001f,0x000000ad,0x0003003e,0x000000a5,0x000000ae,0x0004003d,0x00000009,
|
||||
0x000000b0,0x000000a5,0x0004003d,0x00000009,0x000000b1,0x0000004d,0x00050085,0x00000009,
|
||||
0x000000b2,0x000000b0,0x000000b1,0x0003003e,0x000000af,0x000000b2,0x0004003d,0x00000009,
|
||||
0x000000b5,0x000000af,0x00050085,0x00000009,0x000000b6,0x000000b4,0x000000b5,0x00050081,
|
||||
0x00000009,0x000000b7,0x00000055,0x000000b6,0x00050088,0x00000009,0x000000b8,0x00000055,
|
||||
0x000000b7,0x0003003e,0x000000b3,0x000000b8,0x0004003d,0x0000000a,0x000000ba,0x0000005a,
|
||||
0x0004003d,0x00000009,0x000000bb,0x000000af,0x0005008e,0x0000000a,0x000000bc,0x000000ba,
|
||||
0x000000bb,0x0004003d,0x0000000a,0x000000bd,0x00000062,0x0004003d,0x00000009,0x000000be,
|
||||
0x000000af,0x0005008e,0x0000000a,0x000000bf,0x000000bd,0x000000be,0x00050081,0x0000000a,
|
||||
0x000000c0,0x000000bc,0x000000bf,0x0004003d,0x0000000a,0x000000c1,0x0000006c,0x0004003d,
|
||||
0x00000009,0x000000c2,0x000000af,0x0005008e,0x0000000a,0x000000c3,0x000000c1,0x000000c2,
|
||||
0x00050081,0x0000000a,0x000000c4,0x000000c0,0x000000c3,0x0004003d,0x0000000a,0x000000c5,
|
||||
0x00000072,0x0004003d,0x00000009,0x000000c6,0x000000af,0x0005008e,0x0000000a,0x000000c7,
|
||||
0x000000c5,0x000000c6,0x00050081,0x0000000a,0x000000c8,0x000000c4,0x000000c7,0x0004003d,
|
||||
0x0000000a,0x000000c9,0x00000068,0x00050081,0x0000000a,0x000000ca,0x000000c8,0x000000c9,
|
||||
0x0004003d,0x00000009,0x000000cb,0x000000b3,0x0005008e,0x0000000a,0x000000cc,0x000000ca,
|
||||
0x000000cb,0x00060050,0x0000000a,0x000000cd,0x00000032,0x00000032,0x00000032,0x00060050,
|
||||
0x0000000a,0x000000ce,0x00000055,0x00000055,0x00000055,0x0008000c,0x0000000a,0x000000cf,
|
||||
0x00000001,0x0000002b,0x000000cc,0x000000cd,0x000000ce,0x0003003e,0x000000b9,0x000000cf,
|
||||
0x0004003d,0x0000000a,0x000000d2,0x000000b9,0x00050051,0x00000009,0x000000d3,0x000000d2,
|
||||
0x00000000,0x00050051,0x00000009,0x000000d4,0x000000d2,0x00000001,0x00050051,0x00000009,
|
||||
0x000000d5,0x000000d2,0x00000002,0x00070050,0x00000023,0x000000d6,0x000000d3,0x000000d4,
|
||||
0x000000d5,0x00000055,0x0003003e,0x000000d1,0x000000d6,0x000100fd,0x00010038,0x00050036,
|
||||
0x0000000a,0x0000000d,0x00000000,0x0000000b,0x00030037,0x00000008,0x0000000c,0x000200f8,
|
||||
0x0000000e,0x0004003b,0x0000001c,0x0000001d,0x00000007,0x0004003d,0x00000007,0x0000001e,
|
||||
0x0000000c,0x0004006f,0x0000001b,0x0000001f,0x0000001e,0x00050050,0x0000001b,0x00000021,
|
||||
0x00000020,0x00000020,0x00050081,0x0000001b,0x00000022,0x0000001f,0x00000021,0x00050041,
|
||||
0x00000028,0x00000029,0x00000026,0x00000027,0x0004003d,0x0000001b,0x0000002a,0x00000029,
|
||||
0x00050088,0x0000001b,0x0000002b,0x00000022,0x0000002a,0x0003003e,0x0000001d,0x0000002b,
|
||||
0x0004003d,0x0000002d,0x00000030,0x0000002f,0x0004003d,0x0000001b,0x00000031,0x0000001d,
|
||||
0x00070058,0x00000023,0x00000033,0x00000030,0x00000031,0x00000002,0x00000032,0x0008004f,
|
||||
0x0000000a,0x00000034,0x00000033,0x00000033,0x00000000,0x00000001,0x00000002,0x000200fe,
|
||||
0x00000034,0x00010038,0x00050036,0x00000009,0x00000014,0x00000000,0x00000010,0x00030037,
|
||||
0x0000000f,0x00000011,0x00030037,0x0000000f,0x00000012,0x00030037,0x0000000f,0x00000013,
|
||||
0x000200f8,0x00000015,0x0004003d,0x00000009,0x00000037,0x00000011,0x0004003d,0x00000009,
|
||||
0x00000038,0x00000012,0x0004003d,0x00000009,0x00000039,0x00000013,0x0007000c,0x00000009,
|
||||
0x0000003a,0x00000001,0x00000025,0x00000038,0x00000039,0x0007000c,0x00000009,0x0000003b,
|
||||
0x00000001,0x00000025,0x00000037,0x0000003a,0x000200fe,0x0000003b,0x00010038,0x00050036,
|
||||
0x00000009,0x00000019,0x00000000,0x00000010,0x00030037,0x0000000f,0x00000016,0x00030037,
|
||||
0x0000000f,0x00000017,0x00030037,0x0000000f,0x00000018,0x000200f8,0x0000001a,0x0004003d,
|
||||
0x00000009,0x0000003e,0x00000016,0x0004003d,0x00000009,0x0000003f,0x00000017,0x0004003d,
|
||||
0x00000009,0x00000040,0x00000018,0x0007000c,0x00000009,0x00000041,0x00000001,0x00000028,
|
||||
0x0000003f,0x00000040,0x0007000c,0x00000009,0x00000042,0x00000001,0x00000028,0x0000003e,
|
||||
0x00000041,0x000200fe,0x00000042,0x00010038
|
||||
};
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "droiddeck-ahb-v1-server-protocol.h"
|
||||
#include <android/hardware_buffer.h>
|
||||
#include <errno.h>
|
||||
#include <linux/sync_file.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
@@ -145,6 +146,12 @@ static void handle_released(uint64_t id, int fd) {
|
||||
if (poll(&p, 1, 0) > 0) {
|
||||
close(fd);
|
||||
} else {
|
||||
if (ab->fence_src) {
|
||||
struct sync_merge_data m = {.name = "droiddeck-release", .fd2 = fd};
|
||||
if (ioctl(ab->fence_fd, SYNC_IOC_MERGE, &m) == 0) { close(fd); fd = m.fence; }
|
||||
wl_event_source_remove(ab->fence_src);
|
||||
close(ab->fence_fd);
|
||||
}
|
||||
ab->fence_fd = fd;
|
||||
ab->fence_src = wl_event_loop_add_fd(g_loop, fd, WL_EVENT_READABLE, on_fence_readable, ab);
|
||||
if (!ab->fence_src) { close(fd); ab->fence_fd = -1; }
|
||||
@@ -152,6 +159,7 @@ static void handle_released(uint64_t id, int fd) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ab->fence_src) return;
|
||||
send_deferred_release(ab);
|
||||
maybe_free(ab);
|
||||
}
|
||||
@@ -197,15 +205,19 @@ int ahb_swapchain_present(struct dmabuf_buffer *b, struct surface *s, int scene_
|
||||
struct droiddeck_dma_buf_sync_file exp = {.flags = DROIDDECK_DMA_BUF_SYNC_READ, .fd = -1};
|
||||
if (dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_EXPORT_SYNC_FILE, &exp) == 0 && exp.fd >= 0) {
|
||||
acquire = exp.fd;
|
||||
} else if (dmabuf_fd >= 0) {
|
||||
} else {
|
||||
if (!g_export_failed_logged) {
|
||||
g_export_failed_logged = 1;
|
||||
droiddeck_log("layer", "zero-copy: DMA_BUF_IOCTL_EXPORT_SYNC_FILE failed (%s): waiting for each frame on the CPU instead",
|
||||
strerror(errno));
|
||||
droiddeck_log("layer", "zero-copy: no acquire fence from the game's dma-buf (%s): %s",
|
||||
dmabuf_fd >= 0 ? strerror(errno) : "no dma-buf fd",
|
||||
draw ? "its frames are copied instead" : "it cannot be copied, so each frame is waited for on the CPU");
|
||||
}
|
||||
struct pollfd p = {.fd = dmabuf_fd, .events = POLLIN};
|
||||
int r;
|
||||
do { r = poll(&p, 1, 100); } while (r < 0 && errno == EINTR);
|
||||
if (dmabuf_fd >= 0) {
|
||||
struct pollfd p = {.fd = dmabuf_fd, .events = POLLIN};
|
||||
int r;
|
||||
do { r = poll(&p, 1, 100); } while (r < 0 && errno == EINTR);
|
||||
}
|
||||
if (draw) return -1;
|
||||
}
|
||||
int r = sc_layer_present_ahb(ab->ahb, ab->w, ab->h, acquire, (void *)(uintptr_t)ab->id, scene_w, scene_h, draw,
|
||||
s ? droiddeck_surface_color(s) : NULL, ab->format);
|
||||
|
||||
@@ -2272,6 +2272,69 @@ static void bind_output(struct wl_client *c, void *data, uint32_t ver, uint32_t
|
||||
|
||||
struct draw_list { struct vkp_draw *d; int n, cap; };
|
||||
|
||||
#define ZERO_COPY_FALLBACK_SIGNATURES 32u
|
||||
enum zero_copy_fallback_reason {
|
||||
ZERO_COPY_NO_SURFACE_BUFFER = 1,
|
||||
ZERO_COPY_NO_GRALLOC_AHB = 2,
|
||||
ZERO_COPY_AHB_PRESENT_FAILED = 3
|
||||
};
|
||||
struct zero_copy_fallback_signature {
|
||||
uint32_t reason, format, stride, offset;
|
||||
int width, height;
|
||||
uint64_t modifier;
|
||||
};
|
||||
static struct zero_copy_fallback_signature g_zero_copy_fallbacks[ZERO_COPY_FALLBACK_SIGNATURES];
|
||||
static uint32_t g_zero_copy_fallback_count;
|
||||
static int g_zero_copy_fallback_limit_logged;
|
||||
|
||||
static int zero_copy_fallback_should_log(const struct dmabuf_buffer *b, uint32_t reason) {
|
||||
const struct zero_copy_fallback_signature key = {
|
||||
.reason = reason, .format = b ? b->format : 0,
|
||||
.stride = b && b->n_planes ? b->stride[0] : 0,
|
||||
.offset = b && b->n_planes ? b->offset[0] : 0,
|
||||
.width = b ? b->width : 0, .height = b ? b->height : 0,
|
||||
.modifier = b ? b->modifier : 0};
|
||||
for (uint32_t i = 0; i < g_zero_copy_fallback_count; i++) {
|
||||
const struct zero_copy_fallback_signature *seen = &g_zero_copy_fallbacks[i];
|
||||
if (seen->reason == key.reason && seen->format == key.format && seen->stride == key.stride &&
|
||||
seen->offset == key.offset && seen->width == key.width && seen->height == key.height &&
|
||||
seen->modifier == key.modifier)
|
||||
return 0;
|
||||
}
|
||||
if (g_zero_copy_fallback_count >= ZERO_COPY_FALLBACK_SIGNATURES) {
|
||||
if (!g_zero_copy_fallback_limit_logged) {
|
||||
g_zero_copy_fallback_limit_logged = 1;
|
||||
droiddeck_log("layer", "zero-copy: further fallback diagnostics suppressed after %u distinct buffer signatures",
|
||||
ZERO_COPY_FALLBACK_SIGNATURES);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
g_zero_copy_fallbacks[g_zero_copy_fallback_count++] = key;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void note_zero_copy_fallback(struct surface *s, const struct dmabuf_buffer *b, uint32_t reason,
|
||||
int scene_w, int scene_h, int present_result) {
|
||||
if (!zero_copy_fallback_should_log(b, reason)) return;
|
||||
char name[160] = "unknown surface";
|
||||
if (s) describe(s, name, sizeof(name));
|
||||
if (reason == ZERO_COPY_NO_SURFACE_BUFFER) {
|
||||
droiddeck_log("layer", "zero-copy: layer candidate %s has no associated Wayland surface buffer; using the layer-copy path",
|
||||
name);
|
||||
} else {
|
||||
droiddeck_log("layer", "zero-copy: %s buffer %c%c%c%c %dx%d stride %u offset %u modifier 0x%llx %s; "
|
||||
"scene %dx%d will use the layer-copy path (direct-present result %d)",
|
||||
name, b->format & 0xff, (b->format >> 8) & 0xff, (b->format >> 16) & 0xff,
|
||||
(b->format >> 24) & 0xff, b->width, b->height,
|
||||
b->n_planes ? b->stride[0] : 0, b->n_planes ? b->offset[0] : 0,
|
||||
(unsigned long long)b->modifier,
|
||||
reason == ZERO_COPY_NO_GRALLOC_AHB
|
||||
? "has no registered gralloc AHardwareBuffer"
|
||||
: "has a registered gralloc AHardwareBuffer but direct presentation failed",
|
||||
scene_w, scene_h, present_result);
|
||||
}
|
||||
}
|
||||
|
||||
static int add_cursor(struct draw_list *dl, int scene_w);
|
||||
|
||||
static struct vkp_image *surface_image(struct surface *s) {
|
||||
@@ -2391,17 +2454,53 @@ static int black_fill_below(const struct draw_list *dl, int n) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define LAYER_CANDIDATE_DIAGNOSTICS 32u
|
||||
static unsigned g_layer_candidate_diag_count;
|
||||
static int g_layer_candidate_diag_limit;
|
||||
|
||||
static void note_layer_candidate_skip(const struct vkp_draw *d, int index, int reason,
|
||||
int scene_w, int scene_h) {
|
||||
static int seen[LAYER_CANDIDATE_DIAGNOSTICS][8];
|
||||
const int key[8] = {index, reason, scene_w, scene_h, d->dx, d->dy, d->dw, d->dh};
|
||||
for (unsigned i = 0; i < g_layer_candidate_diag_count; i++)
|
||||
if (!memcmp(seen[i], key, sizeof(key))) return;
|
||||
if (g_layer_candidate_diag_count >= LAYER_CANDIDATE_DIAGNOSTICS) {
|
||||
if (!g_layer_candidate_diag_limit++) droiddeck_log("layer", "zero-copy: further candidate-rejection details suppressed after %u signatures",
|
||||
LAYER_CANDIDATE_DIAGNOSTICS);
|
||||
return;
|
||||
}
|
||||
memcpy(seen[g_layer_candidate_diag_count++], key, sizeof(key));
|
||||
const char *why = reason == 1 ? "translucent draw" :
|
||||
reason == 2 ? "image is not DMA-BUF" :
|
||||
reason == 3 ? "source rectangle is outside/invalid" :
|
||||
reason == 4 ? "draw rectangle is outside scene or invalid" :
|
||||
"not fullscreen and no black backing below";
|
||||
droiddeck_log("layer", "zero-copy: candidate draw %d rejected: %s; scene %dx%d, dst %dx%d at %d,%d, src %.2f,%.2f %.2fx%.2f, image %dx%d",
|
||||
index, why, scene_w, scene_h, d->dw, d->dh, d->dx, d->dy,
|
||||
d->sx, d->sy, d->sw, d->sh, vkp_image_width(d->img), vkp_image_height(d->img));
|
||||
}
|
||||
|
||||
static int layer_candidate(const struct draw_list *dl, int scene_w, int scene_h) {
|
||||
for (int i = dl->n - 1; i >= 0 && i >= dl->n - 2; i--) {
|
||||
const struct vkp_draw *d = &dl->d[i];
|
||||
if (d->blend) continue;
|
||||
if (!vkp_image_is_dmabuf(d->img)) continue;
|
||||
if (d->blend) { note_layer_candidate_skip(d, i, 1, scene_w, scene_h); continue; }
|
||||
if (!vkp_image_is_dmabuf(d->img)) { note_layer_candidate_skip(d, i, 2, scene_w, scene_h); continue; }
|
||||
if (d->sx < 0 || d->sy < 0 || d->sw < 1.0f || d->sh < 1.0f ||
|
||||
d->sx + d->sw >= vkp_image_width(d->img) + 1.0f ||
|
||||
d->sy + d->sh >= vkp_image_height(d->img) + 1.0f) continue;
|
||||
d->sy + d->sh >= vkp_image_height(d->img) + 1.0f) {
|
||||
note_layer_candidate_skip(d, i, 3, scene_w, scene_h);
|
||||
continue;
|
||||
}
|
||||
if (d->dx == 0 && d->dy == 0 && d->dw == scene_w && d->dh == scene_h) return i;
|
||||
if (d->dx < 0 || d->dy < 0 || d->dw <= 0 || d->dh <= 0 || d->dx + d->dw > scene_w ||
|
||||
d->dy + d->dh > scene_h || !black_fill_below(dl, i)) continue;
|
||||
d->dy + d->dh > scene_h) {
|
||||
note_layer_candidate_skip(d, i, 4, scene_w, scene_h);
|
||||
continue;
|
||||
}
|
||||
if (!black_fill_below(dl, i)) {
|
||||
note_layer_candidate_skip(d, i, 5, scene_w, scene_h);
|
||||
continue;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
@@ -2422,6 +2521,56 @@ static void note_copy_scene(const struct draw_list *dl, int scene_w, int scene_h
|
||||
vkp_image_is_dmabuf(t->img) ? "GPU" : "memory", t->blend ? ", translucent" : "");
|
||||
}
|
||||
|
||||
static struct surface *surface_for_image(const struct vkp_image *img);
|
||||
|
||||
static void note_layer_candidate_rejected(const struct draw_list *dl, int scene_w, int scene_h) {
|
||||
static int seen[32][14];
|
||||
static unsigned seen_count;
|
||||
static int limit_logged;
|
||||
static time_t window_start;
|
||||
struct timespec now_ts;
|
||||
const struct vkp_draw *a = dl->n > 0 ? &dl->d[dl->n - 1] : NULL;
|
||||
const struct vkp_draw *b = dl->n > 1 ? &dl->d[dl->n - 2] : NULL;
|
||||
struct surface *sa = a ? surface_for_image(a->img) : NULL;
|
||||
struct surface *sb = b ? surface_for_image(b->img) : NULL;
|
||||
const int signature[14] = {
|
||||
dl->n, scene_w, scene_h,
|
||||
a ? a->dw : 0, a ? a->dh : 0,
|
||||
a ? vkp_image_width(a->img) : 0, a ? vkp_image_height(a->img) : 0,
|
||||
a ? vkp_image_is_dmabuf(a->img) : 0, a ? a->blend : 0, sa && sa->dmabuf_buf ? 1 : 0,
|
||||
b ? b->dw : 0, b ? b->dh : 0, b ? vkp_image_is_dmabuf(b->img) : 0, sb && sb->dmabuf_buf ? 1 : 0
|
||||
};
|
||||
clock_gettime(CLOCK_MONOTONIC, &now_ts);
|
||||
if (!window_start || now_ts.tv_sec - window_start >= 30) {
|
||||
seen_count = 0;
|
||||
limit_logged = 0;
|
||||
window_start = now_ts.tv_sec;
|
||||
}
|
||||
for (unsigned i = 0; i < seen_count; i++)
|
||||
if (!memcmp(signature, seen[i], sizeof(signature))) return;
|
||||
if (seen_count >= 32) {
|
||||
if (!limit_logged++) droiddeck_log("layer", "zero-copy: further fullscreen-candidate rejection details suppressed after 32 signatures in 30 seconds");
|
||||
return;
|
||||
}
|
||||
memcpy(seen[seen_count++], signature, sizeof(signature));
|
||||
char below[48];
|
||||
if (b)
|
||||
snprintf(below, sizeof(below), "%s %dx%d",
|
||||
vkp_image_is_dmabuf(b->img) ? "DMA-BUF" : "non-DMA-BUF", b->dw, b->dh);
|
||||
else
|
||||
snprintf(below, sizeof(below), "none");
|
||||
droiddeck_log("layer", "zero-copy: no eligible fullscreen DMA-BUF layer candidate: scene %dx%d, %d draws; "
|
||||
"top draw %dx%d at %d,%d image %dx%d %s%s surface=%s dmabuf=%s; "
|
||||
"draw below %s",
|
||||
scene_w, scene_h, dl->n, a ? a->dw : 0, a ? a->dh : 0, a ? a->dx : 0, a ? a->dy : 0,
|
||||
a ? vkp_image_width(a->img) : 0, a ? vkp_image_height(a->img) : 0,
|
||||
a && vkp_image_is_dmabuf(a->img) ? "DMA-BUF" : "non-DMA-BUF",
|
||||
a && a->blend ? " blended" : "",
|
||||
sa ? "associated" : "unassociated",
|
||||
sa && sa->dmabuf_buf ? "yes" : "no",
|
||||
below);
|
||||
}
|
||||
|
||||
static struct surface *surface_for_image(const struct vkp_image *img) {
|
||||
struct surface *s;
|
||||
wl_list_for_each(s, &g_surfaces, link)
|
||||
@@ -2430,16 +2579,56 @@ static struct surface *surface_for_image(const struct vkp_image *img) {
|
||||
}
|
||||
|
||||
static struct surface *ahb_layer_only_candidate(int scene_w, int scene_h) {
|
||||
static struct {
|
||||
const struct surface *surface;
|
||||
int reason, scene_w, scene_h, w, h, buf_w, buf_h, x, y, src_set, dst_set, children;
|
||||
} seen[32];
|
||||
static unsigned seen_count;
|
||||
static int limit_logged;
|
||||
struct surface *s;
|
||||
int w, h;
|
||||
int w = 0, h = 0, reason = 0;
|
||||
if (wl_list_empty(&g_toplevels)) return NULL;
|
||||
s = wl_container_of(g_toplevels.prev, s, toplevel_link);
|
||||
if (!s->dmabuf_buf || s->dmabuf_buf->img || !ahb_swapchain_has_ahb(s->dmabuf_buf)) return NULL;
|
||||
if ((g_desktop && !s->placed) || s->x != 0 || s->y != 0 || s->src_set || s->dst_set) return NULL;
|
||||
if (!wl_list_empty(&s->children)) return NULL;
|
||||
if (g_hide_shell && !strcmp(client_name(wl_resource_get_client(s->resource)), "explorer.exe")) return NULL;
|
||||
if (!s->dmabuf_buf) reason = 1;
|
||||
else if (s->dmabuf_buf->img) reason = 2;
|
||||
else if (!ahb_swapchain_has_ahb(s->dmabuf_buf)) reason = 3;
|
||||
else if ((g_desktop && !s->placed) || s->x != 0 || s->y != 0 || s->src_set || s->dst_set) reason = 4;
|
||||
else if (!wl_list_empty(&s->children)) reason = 5;
|
||||
else if (g_hide_shell && !strcmp(client_name(wl_resource_get_client(s->resource)), "explorer.exe")) reason = 6;
|
||||
surface_size(s, &w, &h);
|
||||
if (w != scene_w || h != scene_h || s->buf_w != scene_w || s->buf_h != scene_h) return NULL;
|
||||
if (!reason && (w != scene_w || h != scene_h || s->buf_w != scene_w || s->buf_h != scene_h)) reason = 7;
|
||||
if (reason) {
|
||||
int found = 0;
|
||||
for (unsigned i = 0; i < seen_count; i++) {
|
||||
if (seen[i].surface == s && seen[i].reason == reason && seen[i].scene_w == scene_w &&
|
||||
seen[i].scene_h == scene_h && seen[i].w == w && seen[i].h == h &&
|
||||
seen[i].buf_w == s->buf_w && seen[i].buf_h == s->buf_h && seen[i].x == s->x &&
|
||||
seen[i].y == s->y && seen[i].src_set == s->src_set && seen[i].dst_set == s->dst_set &&
|
||||
seen[i].children == !wl_list_empty(&s->children)) { found = 1; break; }
|
||||
}
|
||||
if (!found && seen_count < 32) {
|
||||
seen[seen_count].surface = s; seen[seen_count].reason = reason;
|
||||
seen[seen_count].scene_w = scene_w; seen[seen_count].scene_h = scene_h;
|
||||
seen[seen_count].w = w; seen[seen_count].h = h; seen[seen_count].buf_w = s->buf_w; seen[seen_count].buf_h = s->buf_h;
|
||||
seen[seen_count].x = s->x; seen[seen_count].y = s->y; seen[seen_count].src_set = s->src_set;
|
||||
seen[seen_count].dst_set = s->dst_set; seen[seen_count].children = !wl_list_empty(&s->children);
|
||||
seen_count++;
|
||||
const char *why = reason == 1 ? "no DMA-BUF buffer" :
|
||||
reason == 2 ? "buffer is already importable by Vulkan" :
|
||||
reason == 3 ? "no registered gralloc AHardwareBuffer" :
|
||||
reason == 4 ? "surface is positioned/cropped/scaled" :
|
||||
reason == 5 ? "surface has child surfaces" :
|
||||
reason == 6 ? "hidden shell surface" : "surface or buffer dimensions differ from scene";
|
||||
char name[160]; describe(s, name, sizeof(name));
|
||||
droiddeck_log("layer", "zero-copy: AHardwareBuffer-only candidate rejected: %s; %s, scene %dx%d, surface %dx%d at %d,%d, buffer %dx%d, crop=%d destination=%d children=%d",
|
||||
why, name, scene_w, scene_h, w, h, s->x, s->y, s->buf_w, s->buf_h,
|
||||
s->src_set, s->dst_set, !wl_list_empty(&s->children));
|
||||
} else if (!found && !limit_logged) {
|
||||
limit_logged = 1;
|
||||
droiddeck_log("layer", "zero-copy: further AHardwareBuffer-only candidate diagnostics suppressed after 32 signatures");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -2882,7 +3071,10 @@ static void render_scene(void) {
|
||||
struct surface *ls = li >= 0 ? surface_for_image(dl.d[li].img) : NULL;
|
||||
const struct vkp_draw *ld = li >= 0 ? &dl.d[li] : NULL;
|
||||
if (li < 0) ls = layer_only;
|
||||
if (g_zero_copy && li < 0 && !ls && !blocked && !cardboard) note_copy_scene(&dl, w, h, cursor_on);
|
||||
if (g_zero_copy && li < 0 && !ls && !blocked && !cardboard) {
|
||||
if (!cursor_on && !bfi) note_layer_candidate_rejected(&dl, w, h);
|
||||
note_copy_scene(&dl, w, h, cursor_on);
|
||||
}
|
||||
if (cardboard) ls = NULL;
|
||||
if (cursor_on) ls = NULL;
|
||||
if (bfi) ls = NULL;
|
||||
@@ -2910,15 +3102,30 @@ static void render_scene(void) {
|
||||
r = generated >= 0 ? 0 : -1;
|
||||
else if (generated >= 0 && !(fx_on && li >= 0) && ls && ls->dmabuf_buf && ahb_swapchain_has_ahb(ls->dmabuf_buf))
|
||||
r = ahb_swapchain_present(ls->dmabuf_buf, ls, w, h, ld);
|
||||
if (!fg_pass && generated >= 0 && !fx_on && !framegen && r != 0) {
|
||||
if (!ls || !ls->dmabuf_buf)
|
||||
note_zero_copy_fallback(ls, NULL, ZERO_COPY_NO_SURFACE_BUFFER, w, h, r);
|
||||
else if (!ahb_swapchain_has_ahb(ls->dmabuf_buf))
|
||||
note_zero_copy_fallback(ls, ls->dmabuf_buf, ZERO_COPY_NO_GRALLOC_AHB, w, h, r);
|
||||
else
|
||||
note_zero_copy_fallback(ls, ls->dmabuf_buf, ZERO_COPY_AHB_PRESENT_FAILED, w, h, r);
|
||||
}
|
||||
if (r == 0 && !fg_pass) g_zero_copy_shown = ls;
|
||||
else settle_unwaited();
|
||||
if (!fg_pass && generated >= 0 && r != 0 && li >= 0)
|
||||
r = fx_on ? sc_layer_present_pass(&dl.d[li], 1, w, h)
|
||||
: sc_layer_present(dl.d[li].img, w, h, ld, ls ? droiddeck_surface_color(ls) : NULL);
|
||||
int ov = 0, ov_done = 0;
|
||||
if (!fg_pass && generated >= 0 && r != 0 && li >= 0) {
|
||||
if (fx_on) {
|
||||
r = sc_layer_present_pass(&dl.d[li], 1, w, h);
|
||||
} else {
|
||||
r = sc_layer_present(dl.d[li].img, w, h, ld, ls ? droiddeck_surface_color(ls) : NULL,
|
||||
over == 1 ? &dl.d[li + 1] : NULL, &ov);
|
||||
ov_done = 1;
|
||||
}
|
||||
}
|
||||
if (r == 0) {
|
||||
if (ls) ls->drawn = 1;
|
||||
int go[8], ov = 0;
|
||||
if (over == 1 && li >= 0 && vkp_map_draw(&dl.d[li + 1], go))
|
||||
int go[8];
|
||||
if (!ov_done && over == 1 && li >= 0 && vkp_map_draw(&dl.d[li + 1], go))
|
||||
ov = sc_layer_present_overlay(dl.d[li + 1].img, go, dl.d[li + 1].blend) == 0 ? 1 : -1;
|
||||
if (ov <= 0) sc_layer_hide_overlay();
|
||||
if (ov < 0) {
|
||||
|
||||
@@ -62,8 +62,40 @@ struct entry {
|
||||
static struct wl_list g_entries;
|
||||
static struct wl_event_loop *g_loop;
|
||||
static uint64_t g_next_id = 1;
|
||||
static int g_refused_logged;
|
||||
static int g_ubwc_promised;
|
||||
|
||||
#define DISPLAY_BUFFER_MISMATCH_SIGNATURES 64u
|
||||
struct display_buffer_mismatch_signature {
|
||||
uint32_t kind, format, stride, offset;
|
||||
int width, height;
|
||||
uint64_t modifier;
|
||||
};
|
||||
static struct display_buffer_mismatch_signature g_mismatch_signatures[DISPLAY_BUFFER_MISMATCH_SIGNATURES];
|
||||
static uint32_t g_mismatch_signature_count;
|
||||
static int g_mismatch_limit_logged;
|
||||
|
||||
static int mismatch_should_log(const struct dmabuf_buffer *b, uint32_t kind) {
|
||||
const struct display_buffer_mismatch_signature key = {
|
||||
.kind = kind, .format = b->format, .stride = b->stride[0], .offset = b->offset[0],
|
||||
.width = b->width, .height = b->height, .modifier = b->modifier};
|
||||
for (uint32_t i = 0; i < g_mismatch_signature_count; i++) {
|
||||
const struct display_buffer_mismatch_signature *seen = &g_mismatch_signatures[i];
|
||||
if (seen->kind == key.kind && seen->format == key.format && seen->stride == key.stride &&
|
||||
seen->offset == key.offset && seen->width == key.width && seen->height == key.height &&
|
||||
seen->modifier == key.modifier)
|
||||
return 0;
|
||||
}
|
||||
if (g_mismatch_signature_count >= DISPLAY_BUFFER_MISMATCH_SIGNATURES) {
|
||||
if (!g_mismatch_limit_logged) {
|
||||
g_mismatch_limit_logged = 1;
|
||||
droiddeck_log("layer", "display buffers: further mismatch diagnostics suppressed after %u distinct buffer signatures",
|
||||
DISPLAY_BUFFER_MISMATCH_SIGNATURES);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
g_mismatch_signatures[g_mismatch_signature_count++] = key;
|
||||
return 1;
|
||||
}
|
||||
static int g_ubwc_probed[2];
|
||||
|
||||
static uint32_t ahb_format_of(uint32_t drm, uint64_t modifier) {
|
||||
@@ -238,16 +270,51 @@ static void handle_alloc(struct peer *p, const struct display_buffers_request *q
|
||||
} else {
|
||||
if (ahb) AHardwareBuffer_release(ahb);
|
||||
fd = -1;
|
||||
if (sized && wanted && (compressed || !g_refused_logged)) {
|
||||
g_refused_logged = 1;
|
||||
droiddeck_log(compressed ? "error" : "layer", "display buffers: no gralloc buffer matches pid %d's %ux%u "
|
||||
"%c%c%c%c %s layout (stride %u bytes, pixels at %u, %llu bytes; gralloc's layout has pixels at "
|
||||
"%llu, %llu bytes): %s", (int)p->pid, q->width, q->height,
|
||||
q->format & 0xff, (q->format >> 8) & 0xff, (q->format >> 16) & 0xff, (q->format >> 24) & 0xff,
|
||||
compressed ? "UBWC" : "linear", q->stride, q->offset, (unsigned long long)q->size,
|
||||
(unsigned long long)(compressed ? ubwc_meta_size(q->width, q->height) : 0),
|
||||
(unsigned long long)(compressed ? ubwc_size(q->width, q->height, q->stride) : q->size),
|
||||
compressed ? "its compressed frames cannot be shown" : "its frames keep the copy path");
|
||||
static struct {
|
||||
pid_t pid;
|
||||
uint32_t width, height, format, stride, offset, reason;
|
||||
uint64_t size, modifier;
|
||||
} refused[32];
|
||||
static unsigned refused_count;
|
||||
static int refused_limit_logged;
|
||||
uint32_t reason = !sized ? 1u : !sane ? 2u : !wanted ? 3u :
|
||||
!ahb_swapchain_advertised() ? 4u :
|
||||
p->count >= DISPLAY_BUFFERS_MAX_PER_CLIENT ? 5u : 6u;
|
||||
int seen = 0;
|
||||
for (unsigned i = 0; i < refused_count; i++) {
|
||||
if (refused[i].pid == p->pid && refused[i].width == q->width && refused[i].height == q->height &&
|
||||
refused[i].format == q->format && refused[i].stride == q->stride && refused[i].offset == q->offset &&
|
||||
refused[i].size == q->size && refused[i].modifier == q->modifier && refused[i].reason == reason) {
|
||||
seen = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!seen && refused_count < 32) {
|
||||
refused[refused_count].pid = p->pid;
|
||||
refused[refused_count].width = q->width;
|
||||
refused[refused_count].height = q->height;
|
||||
refused[refused_count].format = q->format;
|
||||
refused[refused_count].stride = q->stride;
|
||||
refused[refused_count].offset = q->offset;
|
||||
refused[refused_count].size = q->size;
|
||||
refused[refused_count].modifier = q->modifier;
|
||||
refused[refused_count].reason = reason;
|
||||
refused_count++;
|
||||
const char *why = reason == 1 ? "invalid dimensions, format, or stride" :
|
||||
reason == 2 ? "size/offset/layout sanity check failed" :
|
||||
reason == 3 ? "zero-copy or UBWC offering is disabled" :
|
||||
reason == 4 ? "AHardwareBuffer swapchain is not advertised" :
|
||||
reason == 5 ? "per-client allocation limit reached" :
|
||||
"gralloc allocation/fd/size validation failed";
|
||||
droiddeck_log(compressed ? "error" : "layer",
|
||||
"display buffers: allocation refused for pid %d: %s; request %ux%u %c%c%c%c %s stride=%u offset=%u size=%llu modifier=0x%llx (client has %d allocations)",
|
||||
(int)p->pid, why, q->width, q->height,
|
||||
q->format & 0xff, (q->format >> 8) & 0xff, (q->format >> 16) & 0xff, (q->format >> 24) & 0xff,
|
||||
compressed ? "UBWC" : "linear", q->stride, q->offset,
|
||||
(unsigned long long)q->size, (unsigned long long)q->modifier, p->count);
|
||||
} else if (!seen && !refused_limit_logged) {
|
||||
refused_limit_logged = 1;
|
||||
droiddeck_log("layer", "display buffers: further allocation-refusal diagnostics suppressed after 32 signatures");
|
||||
}
|
||||
}
|
||||
if (reply(p, &r, fd) != 0 && e) entry_free(e);
|
||||
@@ -299,9 +366,18 @@ static int on_listen(int fd, uint32_t mask, void *data) {
|
||||
}
|
||||
|
||||
void display_buffers_match(struct wl_client *c, struct wl_resource *buffer, struct dmabuf_buffer *b) {
|
||||
static int invalid_logged;
|
||||
struct stat st;
|
||||
struct entry *e;
|
||||
if (!g_loop || wl_list_empty(&g_entries) || b->n_planes != 1 || b->offset[0] != 0 || fstat(b->fd[0], &st) != 0) return;
|
||||
if (!g_loop || wl_list_empty(&g_entries)) return;
|
||||
if (b->n_planes != 1 || b->offset[0] != 0 || fstat(b->fd[0], &st) != 0) {
|
||||
if (!invalid_logged) {
|
||||
invalid_logged = 1;
|
||||
droiddeck_log("layer", "display buffers: cannot associate %s's DMA-BUF with gralloc (plane count %u; expected one plane at offset 0, or fstat failed)",
|
||||
droiddeck_client_name(c), b->n_planes);
|
||||
}
|
||||
return;
|
||||
}
|
||||
wl_list_for_each(e, &g_entries, link) {
|
||||
if (e->dev != st.st_dev || e->ino != st.st_ino) continue;
|
||||
AHardwareBuffer_Desc d;
|
||||
@@ -311,11 +387,27 @@ void display_buffers_match(struct wl_client *c, struct wl_resource *buffer, stru
|
||||
(uint32_t)b->height == e->height
|
||||
: (b->modifier == MOD_LINEAR || b->modifier == MOD_INVALID) &&
|
||||
e->stride == b->stride[0];
|
||||
if (laid_out && e->format == ahb_format_of(b->format, e->modifier) && b->width > 0 && b->height > 0 &&
|
||||
(uint32_t)b->width <= d.width && (uint32_t)b->height <= d.height)
|
||||
const uint32_t expected_format = ahb_format_of(b->format, e->modifier);
|
||||
const int dimensions = b->width > 0 && b->height > 0 &&
|
||||
(uint32_t)b->width <= d.width && (uint32_t)b->height <= d.height;
|
||||
if (laid_out && e->format == expected_format && dimensions) {
|
||||
ahb_swapchain_adopt(c, buffer, b, e->ahb, e->modifier);
|
||||
} else if (mismatch_should_log(b, 2)) {
|
||||
droiddeck_log("layer", "display buffers: gralloc DMA-BUF identity matched but layout was rejected for %s: %c%c%c%c %dx%d stride %u offset %u modifier 0x%llx; gralloc %ux%u stride %u format 0x%x, expected format 0x%x (layout %s, dimensions %s)",
|
||||
droiddeck_client_name(c), b->format & 0xff, (b->format >> 8) & 0xff,
|
||||
(b->format >> 16) & 0xff, (b->format >> 24) & 0xff, b->width, b->height,
|
||||
b->stride[0], b->offset[0], (unsigned long long)b->modifier,
|
||||
e->width, e->height, e->stride, e->format, expected_format,
|
||||
laid_out ? "ok" : "mismatch", dimensions ? "ok" : "mismatch");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mismatch_should_log(b, 1)) {
|
||||
droiddeck_log("layer", "display buffers: no registered gralloc allocation matches %s's DMA-BUF identity: %c%c%c%c %dx%d stride %u offset %u modifier 0x%llx; imported normally, copy path only",
|
||||
droiddeck_client_name(c), b->format & 0xff, (b->format >> 8) & 0xff,
|
||||
(b->format >> 16) & 0xff, (b->format >> 24) & 0xff, b->width, b->height,
|
||||
b->stride[0], b->offset[0], (unsigned long long)b->modifier);
|
||||
}
|
||||
}
|
||||
|
||||
void display_buffers_init(struct wl_display *display) {
|
||||
|
||||
@@ -187,6 +187,8 @@ struct layer {
|
||||
static struct layer g_layers[SC_LAYER_COUNT];
|
||||
static void apply_frame_rate(ASurfaceTransaction *tx, struct layer *l);
|
||||
static void coverage_text(const struct layer *l, char *out, size_t n);
|
||||
static int overlay_slot(struct layer *l, struct vkp_image *src, int *idx, int *wait_fd);
|
||||
static int overlay_shown(struct layer *l, int idx, const int geo[8], int translucent);
|
||||
static int g_layers_ready;
|
||||
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int g_pending_cb;
|
||||
@@ -721,9 +723,15 @@ static int layer_geometry(int w, int h, int scene_w, int scene_h, const struct v
|
||||
static ARect g_game_src, g_game_dst;
|
||||
static int g_game_geo_known;
|
||||
|
||||
static void note_game_geometry(const int r[8]) {
|
||||
g_game_src = (ARect){r[0], r[1], r[2], r[3]};
|
||||
g_game_dst = (ARect){r[4], r[5], r[6], r[7]};
|
||||
g_game_geo_known = 1;
|
||||
}
|
||||
|
||||
static void apply_geometry(ASurfaceTransaction *tx, struct layer *l, const int r[8]) {
|
||||
ARect srcR = {r[0], r[1], r[2], r[3]}, dstR = {r[4], r[5], r[6], r[7]};
|
||||
if (l == &g_layers[SC_LAYER_GAME]) { g_game_src = srcR; g_game_dst = dstR; g_game_geo_known = 1; }
|
||||
if (l == &g_layers[SC_LAYER_GAME]) note_game_geometry(r);
|
||||
if (!l->geo_valid || memcmp(&srcR, &l->geo_src, sizeof(srcR)) || memcmp(&dstR, &l->geo_dst, sizeof(dstR))) {
|
||||
api.setGeometry(tx, l->sc, &srcR, &dstR, 0 );
|
||||
l->geo_src = srcR; l->geo_dst = dstR; l->geo_valid = 1;
|
||||
@@ -998,19 +1006,40 @@ unavailable:
|
||||
}
|
||||
|
||||
int sc_layer_present(struct vkp_image *src, int scene_w, int scene_h, const struct vkp_draw *draw,
|
||||
const struct droiddeck_color *color) {
|
||||
const struct droiddeck_color *color, const struct vkp_draw *over, int *over_shown) {
|
||||
struct layer *l = layer_of(SC_LAYER_GAME);
|
||||
*over_shown = 0;
|
||||
if (!src || ensure_sc(l) != 0) return -1;
|
||||
int sw = vkp_image_width(src), sh = vkp_image_height(src);
|
||||
int r[8];
|
||||
int g = layer_geometry(sw, sh, scene_w, scene_h, draw, r);
|
||||
if (g < 0) return -1;
|
||||
if (g == 0) { sc_layer_hide(); return 0; }
|
||||
int og[8];
|
||||
if (over && !vkp_map_draw(over, og)) over = NULL;
|
||||
if (g == 0) {
|
||||
sc_layer_hide();
|
||||
if (over) *over_shown = sc_layer_present_overlay(over->img, og, over->blend) == 0 ? 1 : -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wait_fd;
|
||||
int idx = take_free_slot(l, sw, sh, AHB_RGBA8, &wait_fd);
|
||||
if (idx < 0) { log_drop(l); return g_alloc_failed ? -1 : 0; }
|
||||
if (vkp_blit_image(src, l->slots[idx].img, wait_fd) != 0) return -1;
|
||||
struct vkp_blit blits[2] = {{.src = src, .wait_fd = -1}, {.src = over ? over->img : NULL, .wait_fd = -1}};
|
||||
int idx = take_free_slot(l, sw, sh, AHB_RGBA8, &blits[0].wait_fd);
|
||||
if (idx < 0) {
|
||||
log_drop(l);
|
||||
if (g_alloc_failed) return -1;
|
||||
if (over) *over_shown = sc_layer_present_overlay(over->img, og, over->blend) == 0 ? 1 : -1;
|
||||
return 0;
|
||||
}
|
||||
blits[0].dst = l->slots[idx].img;
|
||||
struct layer *ol = layer_of(SC_LAYER_OVERLAY);
|
||||
int over_idx = -1;
|
||||
if (over) {
|
||||
note_game_geometry(r);
|
||||
const int taken = overlay_slot(ol, over->img, &over_idx, &blits[1].wait_fd);
|
||||
*over_shown = taken < 0 ? -1 : 1;
|
||||
if (taken > 0) blits[1].dst = ol->slots[over_idx].img;
|
||||
}
|
||||
if (vkp_blit_images(blits, over_idx >= 0 ? 2 : 1) != 0) return -1;
|
||||
if (present_slot(l, idx, r, color, 0) != 0) return -1;
|
||||
if (color && color->dataspace) droiddeck_color_frame_shown(color, DROIDDECK_HDR_LAYER_COPY, AHB_RGBA8);
|
||||
if (!l->first_logged) {
|
||||
@@ -1020,6 +1049,7 @@ int sc_layer_present(struct vkp_image *src, int scene_w, int scene_h, const stru
|
||||
pool_kind(l->pool_modifier), l->pool_n);
|
||||
}
|
||||
vkp_signal_first_frame();
|
||||
if (over_idx >= 0 && overlay_shown(ol, over_idx, og, over->blend) != 0) *over_shown = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1209,17 +1239,19 @@ int sc_layer_overlay_affordable(void) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
int sc_layer_present_overlay(struct vkp_image *src, const int geo[8], int translucent) {
|
||||
struct layer *l = layer_of(SC_LAYER_OVERLAY);
|
||||
if (!src || !geo) return -1;
|
||||
static int overlay_slot(struct layer *l, struct vkp_image *src, int *idx, int *wait_fd) {
|
||||
*wait_fd = -1;
|
||||
if (!src) return -1;
|
||||
if (!sc_layer_overlay_affordable()) return -1;
|
||||
if (ensure_sc(l) != 0) return -1;
|
||||
int sw = vkp_image_width(src), sh = vkp_image_height(src);
|
||||
if (sw <= 0 || sh <= 0) return -1;
|
||||
int wait_fd;
|
||||
int idx = take_free_slot(l, sw, sh, AHB_RGBA8, &wait_fd);
|
||||
if (idx < 0) { log_drop(l); return g_alloc_failed ? -1 : 0; }
|
||||
if (vkp_blit_image(src, l->slots[idx].img, wait_fd) != 0) return -1;
|
||||
*idx = take_free_slot(l, sw, sh, AHB_RGBA8, wait_fd);
|
||||
if (*idx < 0) { log_drop(l); return g_alloc_failed ? -1 : 0; }
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int overlay_shown(struct layer *l, int idx, const int geo[8], int translucent) {
|
||||
if (present_slot(l, idx, geo, NULL, translucent) != 0) return -1;
|
||||
if (!l->first_logged) {
|
||||
l->first_logged = 1;
|
||||
@@ -1228,6 +1260,18 @@ int sc_layer_present_overlay(struct vkp_image *src, const int geo[8], int transl
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sc_layer_present_overlay(struct vkp_image *src, const int geo[8], int translucent) {
|
||||
struct layer *l = layer_of(SC_LAYER_OVERLAY);
|
||||
if (!geo) return -1;
|
||||
int idx;
|
||||
struct vkp_blit blit = {.src = src, .wait_fd = -1};
|
||||
const int taken = overlay_slot(l, src, &idx, &blit.wait_fd);
|
||||
if (taken <= 0) return taken;
|
||||
blit.dst = l->slots[idx].img;
|
||||
if (vkp_blit_images(&blit, 1) != 0) return -1;
|
||||
return overlay_shown(l, idx, geo, translucent);
|
||||
}
|
||||
|
||||
static int hide_layer(struct layer *l) {
|
||||
if (!l->sc || !l->shown || api.state != 1) return 0;
|
||||
ASurfaceTransaction *tx = api.txCreate();
|
||||
|
||||
@@ -22,7 +22,7 @@ void sc_layer_hdr_symbols(char *out, size_t size);
|
||||
|
||||
|
||||
int sc_layer_present(struct vkp_image *src, int scene_w, int scene_h, const struct vkp_draw *draw,
|
||||
const struct droiddeck_color *color);
|
||||
const struct droiddeck_color *color, const struct vkp_draw *over, int *over_shown);
|
||||
|
||||
int sc_layer_present_pass(const struct vkp_draw *draws, int n, int scene_w, int scene_h);
|
||||
int sc_layer_present_generated(const struct vkp_draw *draws, int n_draws, const struct vkp_hdr_frame *hf,
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
#include <linux/sync_file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
#include <stdarg.h>
|
||||
@@ -3162,8 +3164,38 @@ static void blit_to_layer(VkCommandBuffer cmd, VkImage src, VkImageLayout src_la
|
||||
0, 0, NULL, 0, NULL, 1, &release);
|
||||
}
|
||||
|
||||
int vkp_blit_image(struct vkp_image *src, struct vkp_image *dst, int wait_fd) {
|
||||
if (!src || src->blit_dst || !dst || !dst->blit_dst || dev_init() != 0) {
|
||||
static int merge_wait_fds(int a, int b) {
|
||||
if (a < 0) return b;
|
||||
if (b < 0) return a;
|
||||
struct sync_merge_data m = {.name = "droiddeck-layer-copy", .fd2 = b};
|
||||
if (ioctl(a, SYNC_IOC_MERGE, &m) == 0) {
|
||||
close(a);
|
||||
close(b);
|
||||
return m.fence;
|
||||
}
|
||||
struct pollfd p = {.fd = b, .events = POLLIN};
|
||||
int r;
|
||||
do { r = poll(&p, 1, 100); } while (r < 0 && errno == EINTR);
|
||||
close(b);
|
||||
if (r != 0) return a;
|
||||
p.fd = a;
|
||||
do { r = poll(&p, 1, 100); } while (r < 0 && errno == EINTR);
|
||||
close(a);
|
||||
return -2;
|
||||
}
|
||||
|
||||
int vkp_blit_images(const struct vkp_blit *blits, int n) {
|
||||
int wait_fd = -1;
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (wait_fd == -2) { if (blits[i].wait_fd >= 0) close(blits[i].wait_fd); continue; }
|
||||
wait_fd = merge_wait_fds(wait_fd, blits[i].wait_fd);
|
||||
}
|
||||
int valid = n > 0 && wait_fd != -2;
|
||||
for (int i = 0; valid && i < n; i++) {
|
||||
const struct vkp_image *src = blits[i].src, *dst = blits[i].dst;
|
||||
if (!src || src->blit_dst || !dst || !dst->blit_dst) valid = 0;
|
||||
}
|
||||
if (!valid || dev_init() != 0) {
|
||||
if (wait_fd >= 0) close(wait_fd);
|
||||
return -1;
|
||||
}
|
||||
@@ -3176,32 +3208,35 @@ int vkp_blit_image(struct vkp_image *src, struct vkp_image *dst, int wait_fd) {
|
||||
VkCommandBufferBeginInfo bi = {.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
|
||||
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
|
||||
g_vk.BeginCommandBuffer(g_cmd, &bi);
|
||||
stage_linear_dmabuf(g_cmd, src);
|
||||
struct vkp_external_client_barrier_pair src_pair;
|
||||
const int src_external = vkp_external_client_barrier_pair(
|
||||
src->image, g_qfam, foreign_image(src), src->blit_dst, &src_pair);
|
||||
VkImageMemoryBarrier acq = src_external ? src_pair.acquire : (VkImageMemoryBarrier){
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.image = src->image, .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT};
|
||||
if (!src_external) {
|
||||
acq.oldLayout = src->in_general ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_PREINITIALIZED;
|
||||
acq.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
acq.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;
|
||||
src->in_general = 1;
|
||||
for (int i = 0; i < n; i++) {
|
||||
struct vkp_image *src = blits[i].src, *dst = blits[i].dst;
|
||||
stage_linear_dmabuf(g_cmd, src);
|
||||
struct vkp_external_client_barrier_pair src_pair;
|
||||
const int src_external = vkp_external_client_barrier_pair(
|
||||
src->image, g_qfam, foreign_image(src), src->blit_dst, &src_pair);
|
||||
VkImageMemoryBarrier acq = src_external ? src_pair.acquire : (VkImageMemoryBarrier){
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
.image = src->image, .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT};
|
||||
if (!src_external) {
|
||||
acq.oldLayout = src->in_general ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_PREINITIALIZED;
|
||||
acq.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
acq.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;
|
||||
src->in_general = 1;
|
||||
}
|
||||
g_vk.CmdPipelineBarrier(g_cmd, VK_PIPELINE_STAGE_HOST_BIT | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &acq);
|
||||
int bw = src->w < dst->w ? src->w : dst->w, bh = src->h < dst->h ? src->h : dst->h;
|
||||
VkImageBlit blit = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
|
||||
.srcOffsets = {{0, 0, 0}, {bw, bh, 1}},
|
||||
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
|
||||
.dstOffsets = {{0, 0, 0}, {bw, bh, 1}}};
|
||||
blit_to_layer(g_cmd, src->image, src_external ? VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL,
|
||||
dst, &blit, VK_FILTER_NEAREST);
|
||||
release_external_client_image(g_cmd, src);
|
||||
}
|
||||
g_vk.CmdPipelineBarrier(g_cmd, VK_PIPELINE_STAGE_HOST_BIT | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &acq);
|
||||
int bw = src->w < dst->w ? src->w : dst->w, bh = src->h < dst->h ? src->h : dst->h;
|
||||
VkImageBlit blit = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
|
||||
.srcOffsets = {{0, 0, 0}, {bw, bh, 1}},
|
||||
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
|
||||
.dstOffsets = {{0, 0, 0}, {bw, bh, 1}}};
|
||||
blit_to_layer(g_cmd, src->image, src_external ? VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL,
|
||||
dst, &blit, VK_FILTER_NEAREST);
|
||||
release_external_client_image(g_cmd, src);
|
||||
g_vk.EndCommandBuffer(g_cmd);
|
||||
|
||||
VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||
|
||||
@@ -105,7 +105,11 @@ int vkp_render_hdr(int scene_w, int scene_h, const struct vkp_draw *draws, int n
|
||||
int vkp_pass_begin_hdr(int scene_w, int scene_h, const struct vkp_draw *draws, int n,
|
||||
const struct vkp_hdr_frame *hf, int *rw, int *rh);
|
||||
|
||||
int vkp_blit_image(struct vkp_image *src, struct vkp_image *dst, int wait_fd);
|
||||
struct vkp_blit {
|
||||
struct vkp_image *src, *dst;
|
||||
int wait_fd;
|
||||
};
|
||||
int vkp_blit_images(const struct vkp_blit *blits, int n);
|
||||
int vkp_image_readback(struct vkp_image *src, uint32_t *out, int max_px);
|
||||
int vkp_update_map(int scene_w, int scene_h);
|
||||
int vkp_map_draw(const struct vkp_draw *d, int out[8]);
|
||||
|
||||
@@ -20,6 +20,10 @@ class App : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (android.os.Build.VERSION.SDK_INT >= 28 &&
|
||||
com.droiddeck.launcher.runtime.GuestWorker.isWorkerProcess(this, Application.getProcessName())) return
|
||||
if (android.os.Build.VERSION.SDK_INT >= 28 && Application.getProcessName() == packageName)
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.attach(this)
|
||||
com.droiddeck.launcher.runtime.NativeGuest.init(this)
|
||||
com.droiddeck.launcher.session.Onboarding.attach(this)
|
||||
Thread({ runCatching { EnhancedSessionLogShare.cleanupAbandonedStages(this) } }, "diagnostic-stage-cleanup").start()
|
||||
@@ -88,7 +92,6 @@ class App : Application() {
|
||||
Thread({
|
||||
runCatching {
|
||||
if (com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).isDirectory) {
|
||||
if (!com.droiddeck.launcher.runtime.LinuxRuntime.patchedProot(app)) com.droiddeck.launcher.core.AddonPack.PROOT.ensure(app)
|
||||
com.droiddeck.launcher.core.AddonPack.DIRECTAUDIO.ensure(app)
|
||||
com.droiddeck.launcher.session.SessionFiles.ensureDirtStandIn(app)
|
||||
}
|
||||
|
||||
@@ -57,8 +57,6 @@ import com.droiddeck.launcher.session.LaunchCoordinator
|
||||
import com.droiddeck.launcher.session.LaunchTicket
|
||||
import com.droiddeck.launcher.core.CpuCores
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.core.WirelessAdbFix
|
||||
import com.droiddeck.launcher.core.WifiDiscovery
|
||||
import com.droiddeck.launcher.core.SteamIntegration
|
||||
@@ -189,14 +187,9 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var gamescopeRealtime by mutableStateOf(false)
|
||||
private var paceCores by mutableStateOf(true)
|
||||
private var gpuClockPin by mutableStateOf(false)
|
||||
private var prootNoSeccomp by mutableStateOf(false)
|
||||
private var prootFastPath by mutableStateOf(true)
|
||||
private var nativeUserland by mutableStateOf(true)
|
||||
private var desktopAsUser by mutableStateOf(false)
|
||||
private var cursorComposite by mutableStateOf(true)
|
||||
private var guestHostname by mutableStateOf(SessionPrefs.DEFAULT_GUEST_HOSTNAME)
|
||||
private var phantomWarning by mutableStateOf<String?>(null)
|
||||
private var phantomProcessStatus by mutableStateOf(PhantomProcessStatus.NOT_APPLICABLE)
|
||||
private var showPhantomGate by mutableStateOf(false)
|
||||
private var directAudio by mutableStateOf(false)
|
||||
private var picturePosition by mutableStateOf("center")
|
||||
private var integerScaling by mutableStateOf(false)
|
||||
@@ -701,6 +694,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var bridgeFellBackMemory by mutableStateOf(false)
|
||||
private var clearCachedApps by mutableStateOf(false)
|
||||
private var adbPaired by mutableStateOf(false)
|
||||
private var memoryHud by mutableStateOf(SessionPrefs.MEMORY_HUD_OFF)
|
||||
private var backgroundAppLimit by mutableStateOf(com.droiddeck.launcher.core.BackgroundAppLimit.OFF)
|
||||
private var showRoms by mutableStateOf(false)
|
||||
private var homeAppSelected by mutableStateOf(false)
|
||||
@@ -935,7 +929,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
switchPoll?.let { ui.removeCallbacks(it) }
|
||||
switchPoll = null
|
||||
switchingTo = null
|
||||
queuedLaunch.clear()
|
||||
cancelCompatLaunch()
|
||||
startActivity(Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
.setComponent(LauncherIcon.activity(this))
|
||||
@@ -1093,7 +1086,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
com.droiddeck.launcher.frontend.GameLaunchLink.steamUrl(game.gameIdString))
|
||||
}
|
||||
}
|
||||
.playing(game), steamSession = true)
|
||||
.playing(game))
|
||||
}
|
||||
|
||||
private fun Intent.playing(game: Library.SteamGame): Intent =
|
||||
@@ -1251,8 +1244,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
|
||||
private fun startSessionOrWait(next: Intent): Boolean {
|
||||
val started = startSession(next, steamSession = next.hasExtra(SessionService.EXTRA_STEAM_URL) ||
|
||||
next.getStringExtra(SessionService.EXTRA_PROGRAM) in setOf(com.droiddeck.launcher.session.NoSteamLaunch.PROTON_RUN, com.droiddeck.launcher.session.NoSteamLaunch.BATTLENET))
|
||||
val started = startSession(next)
|
||||
if (!started && (busy || LinuxRuntimeInstaller.isBusy())) android.widget.Toast.makeText(this, R.string.main_wait_install_game, android.widget.Toast.LENGTH_SHORT).show()
|
||||
return started
|
||||
}
|
||||
@@ -1338,10 +1330,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
val handoff = if (savedInstanceState == null && intent.getBooleanExtra(EXTRA_RESTARTED, false)) LauncherHandoff.take() else null
|
||||
val saved = savedInstanceState ?: handoff
|
||||
pendingSessionLogExport = saved?.getString(KEY_PENDING_SESSION_LOG_EXPORT)?.let(::File)
|
||||
queuedLaunch.restore(
|
||||
saved?.let { androidx.core.os.BundleCompat.getParcelable(it, STATE_PENDING_GATE_LAUNCH, Intent::class.java) },
|
||||
saved?.getLong(STATE_PENDING_GATE_LAUNCH_AT, 0L) ?: 0L, System.currentTimeMillis(),
|
||||
)
|
||||
homeChoiceOpen = saved?.getBoolean(STATE_HOME_CHOICE_OPEN) == true
|
||||
gameSpaceOffered = saved?.getBoolean(STATE_GAME_SPACE_OFFERED) == true
|
||||
if (savedInstanceState == null) readIntegrationIntent(intent)
|
||||
@@ -1356,7 +1344,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
if (savedInstanceState == null && navRequest == null && com.droiddeck.launcher.lab.LabOverlay.promoted && com.droiddeck.launcher.agent.AgentTab.visible) navRequest = "agent"
|
||||
gameSyncFolder = GameFileSync.folder(this)
|
||||
displayManager = getSystemService(DISPLAY_SERVICE) as DisplayManager
|
||||
refreshPhantomStatus()
|
||||
refreshAdbPairing()
|
||||
if (!SessionState.running) com.droiddeck.launcher.core.BackgroundAppLimit.restoreAsync(this)
|
||||
theme = SessionPrefs.theme(this)
|
||||
frameGenLabel = getString(R.string.frame_gen_off)
|
||||
@@ -1388,10 +1376,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
applyLauncherFullscreen()
|
||||
updates.start()
|
||||
setContent {
|
||||
val prootPack by com.droiddeck.launcher.core.AddonPack.PROOT.state.collectAsState()
|
||||
androidx.compose.runtime.LaunchedEffect(prootPack) {
|
||||
if (prootPack == com.droiddeck.launcher.core.AddonPack.State.Ready && installed == null) refresh()
|
||||
}
|
||||
val appsTabShown = "android-apps" !in com.droiddeck.launcher.ui.NavTabs.hidden
|
||||
androidx.compose.runtime.LaunchedEffect(appsTabShown) { if (appsTabShown && androidApps.isEmpty()) refreshAndroidApps() }
|
||||
DroidDeckTheme(theme, appScale = appScale) {
|
||||
@@ -1430,7 +1414,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
vacDiagnostics = vacDiagnostics, agentCommands = agentCommands,
|
||||
graphicsLogs = graphicsLogs, steamGpuDrawing = steamGpuDrawing, bridgeFellBack = bridgeFellBack, bridgeFellBackMemory = bridgeFellBackMemory,
|
||||
buildWatermark = buildWatermark,
|
||||
clearCachedApps = clearCachedApps, adbPaired = adbPaired, backgroundAppLimit = backgroundAppLimit,
|
||||
clearCachedApps = clearCachedApps, adbPaired = adbPaired, memoryHud = memoryHud, backgroundAppLimit = backgroundAppLimit,
|
||||
tpUbwcMode = drivers.tpUbwcModeForDevice(), tpUbwcRestartRequired = drivers.tpUbwcRestartRequired(), canRestartApp = !runtimeChangesBlocked(),
|
||||
steamGames = steamGames, steamGamesX64 = steamGamesX64, emulators = emulatorList, running = runningLabel,
|
||||
frameGen = FrameGen.mode(this),
|
||||
@@ -1465,8 +1449,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
oscMode = oscMode,
|
||||
controller = controllerSettings,
|
||||
updates = updates.state(),
|
||||
phantomProcessStatus = phantomProcessStatus,
|
||||
showPhantomGate = showPhantomGate,
|
||||
orientation = orientation,
|
||||
launcherOrientation = launcherOrientation,
|
||||
homePage = homePage,
|
||||
@@ -1494,19 +1476,15 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
),
|
||||
FrontEndActions(
|
||||
onPlay = { playSteam() },
|
||||
onQueuePlaySteam = {
|
||||
queuedLaunch.queue(Intent(this, SessionActivity::class.java).putExtra(SessionActivity.EXTRA_STEAMVR, false), System.currentTimeMillis())
|
||||
},
|
||||
onPlaySteamVr = { playSteamVr() },
|
||||
onSteamUrl = { url ->
|
||||
if (!SessionState.running) startSession(
|
||||
Intent(this, SessionActivity::class.java).putExtra(SessionService.EXTRA_STEAM_URL, url), steamSession = true,
|
||||
Intent(this, SessionActivity::class.java).putExtra(SessionService.EXTRA_STEAM_URL, url),
|
||||
)
|
||||
},
|
||||
onPlayDesktopUi = {
|
||||
startSession(Intent(this, SessionActivity::class.java)
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_STEAM)
|
||||
.putExtra(SessionService.EXTRA_STEAM_UI, "desktop"), steamSession = true)
|
||||
.putExtra(SessionService.EXTRA_STEAM_UI, "desktop"))
|
||||
},
|
||||
onSteamGame = { g ->
|
||||
if (shortcutPicker) chooseGameShortcut(g)
|
||||
@@ -1701,6 +1679,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
agentCommands = com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(this)
|
||||
},
|
||||
onClearCachedApps = { on -> SessionPrefs.setClearCachedApps(this, on); clearCachedApps = on },
|
||||
onMemoryHud = { value -> SessionPrefs.setMemoryHud(this, value); memoryHud = value },
|
||||
onTpUbwcMode = { drivers.chooseTpUbwcMode(it) },
|
||||
onRestartApp = { drivers.restartApp() },
|
||||
onBackgroundAppLimit = { limit ->
|
||||
@@ -1874,31 +1853,9 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
SessionPrefs.setBackActionsInverted(this, inverted)
|
||||
backActionsInverted = inverted
|
||||
},
|
||||
onRefreshPhantomStatus = { refreshPhantomStatus() },
|
||||
onOpenDeveloperOptions = { displayId -> openDeveloperOptions(displayId) },
|
||||
onSetPhantomProcessLimit = { enabled, complete ->
|
||||
Thread({
|
||||
val result = runCatching { WirelessAdbFix.setUsingSavedPairing(this@FrontEndActivity, enabled) }
|
||||
val error = result.exceptionOrNull()?.let { it.localizedMessage ?: getString(R.string.main_wadb_unavailable) }
|
||||
ui.post {
|
||||
if (error == null) refreshPhantomStatus()
|
||||
complete(error)
|
||||
}
|
||||
}, "wireless-adb-setting").start()
|
||||
},
|
||||
onCopyPhantomCommand = { enabled ->
|
||||
(getSystemService(CLIPBOARD_SERVICE) as ClipboardManager).setPrimaryClip(
|
||||
ClipData.newPlainText(getString(R.string.main_adb_clip_label), PhantomProcessLimit.adbCommand(enabled)),
|
||||
)
|
||||
android.widget.Toast.makeText(this, R.string.main_adb_copied, android.widget.Toast.LENGTH_SHORT).show()
|
||||
},
|
||||
onDismissPhantomGate = { queuedLaunch.clear(); showPhantomGate = false },
|
||||
onShowPhantomGate = {
|
||||
refreshPhantomStatus()
|
||||
showPhantomGate = true
|
||||
},
|
||||
onStartWirelessAdbPairing = { enabled -> WirelessAdbPairingService.start(this, enabled) },
|
||||
onStartPairingGuide = { displayId, toggleOnly -> PairingGuideActivity.start(this, displayId, toggleOnly) },
|
||||
onStartWirelessAdbPairing = { WirelessAdbPairingService.start(this) },
|
||||
onStartPairingGuide = { displayId -> PairingGuideActivity.start(this, displayId) },
|
||||
onEnsureNotifications = { done -> ensureNotifications(done) },
|
||||
updates = updates.actions(),
|
||||
controller = ControllerActions(
|
||||
@@ -2080,7 +2037,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
|
||||
private fun startSteamSession(steamVr: Boolean = false) {
|
||||
startSession(Intent(this, SessionActivity::class.java).putExtra(SessionActivity.EXTRA_STEAMVR, steamVr), steamSession = true, queueIfBlocked = !steamVr)
|
||||
startSession(Intent(this, SessionActivity::class.java).putExtra(SessionActivity.EXTRA_STEAMVR, steamVr))
|
||||
}
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
@@ -2338,7 +2295,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
com.droiddeck.launcher.ui.QuitFlood.take()?.let { c ->
|
||||
returning = ReturningFlood(c, com.droiddeck.launcher.ui.LaunchOrigin.takeReturn())
|
||||
}
|
||||
refreshPhantomStatus()
|
||||
refreshAdbPairing()
|
||||
syncLossless()
|
||||
updates.onResume()
|
||||
drivers.checkOnOpen()
|
||||
@@ -2412,10 +2369,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
outState.putBoolean(STATE_HOME_CHOICE_OPEN, homeChoiceOpen)
|
||||
outState.putBoolean(STATE_GAME_SPACE_OFFERED, gameSpaceOffered)
|
||||
pendingSessionLogExport?.let { outState.putString(KEY_PENDING_SESSION_LOG_EXPORT, it.absolutePath) }
|
||||
queuedLaunch.launch?.let {
|
||||
outState.putParcelable(STATE_PENDING_GATE_LAUNCH, it)
|
||||
outState.putLong(STATE_PENDING_GATE_LAUNCH_AT, queuedLaunch.queuedAt)
|
||||
}
|
||||
if (slowUsbNever) SessionPrefs.setSlowUsbWarningOff(this)
|
||||
saveCompatLaunch(outState)
|
||||
pendingSwitch?.let { outState.putParcelable(KEY_PENDING_SWITCH, it) }
|
||||
@@ -2453,7 +2406,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
override fun onDestroy() {
|
||||
// The queued launch was saved before this; a restored activity keeps its copy, and this one must not start it too.
|
||||
if (com.droiddeck.launcher.session.Onboarding.onFirstRunReady === firstRunReady) com.droiddeck.launcher.session.Onboarding.onFirstRunReady = null
|
||||
queuedLaunchRunner.destroy()
|
||||
triggerKeys.cancel()
|
||||
launchCoordinator.cancelAll()
|
||||
cancelCompatLaunch()
|
||||
@@ -3047,8 +2999,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
fsyncFirst = fsyncFirst,
|
||||
gamescopeRealtime = gamescopeRealtime,
|
||||
gpuClockPin = gpuClockPin,
|
||||
prootNoSeccomp = prootNoSeccomp, prootFastPath = prootFastPath, nativeUserland = nativeUserland, cursorComposite = cursorComposite,
|
||||
guestHostname = guestHostname, phantomWarning = phantomWarning,
|
||||
desktopAsUser = desktopAsUser, cursorComposite = cursorComposite,
|
||||
guestHostname = guestHostname,
|
||||
onClientOverride = { on -> SessionPrefs.setClientCpusOverride(this, on); clientOverride = on },
|
||||
onPaceCores = { on -> SessionPrefs.setPaceCores(this, on); paceCores = on },
|
||||
onTuSysmem = { on -> SessionPrefs.setTuSysmem(this, on); tuSysmem = on },
|
||||
@@ -3061,9 +3013,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onFsyncFirst = { on -> SessionPrefs.setFsyncFirst(this, on); fsyncFirst = on },
|
||||
onGamescopeRealtime = { on -> SessionPrefs.setGamescopeRealtime(this, on); gamescopeRealtime = on },
|
||||
onGpuClockPin = { on -> SessionPrefs.setGpuClockPin(this, on); gpuClockPin = on },
|
||||
onProotNoSeccomp = { on -> SessionPrefs.setProotNoSeccomp(this, on); prootNoSeccomp = on },
|
||||
onProotFastPath = { on -> SessionPrefs.setProotFastPath(this, on); prootFastPath = on },
|
||||
onNativeUserland = { on -> SessionPrefs.setNativeUserland(this, on); nativeUserland = on },
|
||||
onDesktopAsUser = { on -> SessionPrefs.setDesktopAsUser(this, on); desktopAsUser = on },
|
||||
onCursorComposite = { on -> SessionPrefs.setCursorComposite(this, on); cursorComposite = on },
|
||||
onGuestHostname = { name -> SessionPrefs.setGuestHostname(this, name) },
|
||||
onClientCore = { core, on ->
|
||||
@@ -3379,12 +3329,10 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
gamescopeRealtime = SessionPrefs.gamescopeRealtime(this)
|
||||
paceCores = SessionPrefs.paceCores(this)
|
||||
gpuClockPin = SessionPrefs.gpuClockPin(this)
|
||||
prootNoSeccomp = SessionPrefs.prootNoSeccomp(this)
|
||||
prootFastPath = SessionPrefs.prootFastPath(this)
|
||||
nativeUserland = SessionPrefs.nativeUserland(this)
|
||||
desktopAsUser = SessionPrefs.desktopAsUser(this)
|
||||
cursorComposite = SessionPrefs.cursorComposite(this)
|
||||
guestHostname = SessionPrefs.guestHostname(this)
|
||||
refreshPhantomStatus()
|
||||
refreshAdbPairing()
|
||||
}
|
||||
|
||||
private fun gameDebugLogsNeedsRestart(): Boolean =
|
||||
@@ -3457,6 +3405,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
bridgeFellBackMemory = SessionPrefs.bridgeFellBackForMemory(this)
|
||||
clearCachedApps = SessionPrefs.clearCachedApps(this)
|
||||
adbPaired = WirelessAdbFix.hasSavedPairing(this)
|
||||
memoryHud = SessionPrefs.memoryHud(this)
|
||||
backgroundAppLimit = SessionPrefs.backgroundAppLimit(this)
|
||||
runningLabel = if (SessionState.running) when (SessionState.mode) {
|
||||
SessionService.MODE_DESKTOP -> getString(R.string.rail_desktop)
|
||||
@@ -3566,7 +3515,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
install(release)
|
||||
}
|
||||
|
||||
private fun startSession(intent: Intent, steamSession: Boolean = false, queueIfBlocked: Boolean = false): Boolean {
|
||||
private fun startSession(intent: Intent): Boolean {
|
||||
if (busy || LinuxRuntimeInstaller.isBusy()) return false
|
||||
if (SessionState.installing != null && !SessionState.running) {
|
||||
android.widget.Toast.makeText(this, R.string.main_wait_desktop_install, android.widget.Toast.LENGTH_SHORT).show()
|
||||
@@ -3580,12 +3529,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
android.widget.Toast.makeText(this, R.string.steam_store_session_wait, android.widget.Toast.LENGTH_SHORT).show()
|
||||
return false
|
||||
}
|
||||
refreshPhantomStatus()
|
||||
if (steamSession && PhantomProcessLimit.blocksSteam(phantomProcessStatus)) {
|
||||
if (queueIfBlocked) queuedLaunch.queue(intent, System.currentTimeMillis())
|
||||
showPhantomGate = true
|
||||
return false
|
||||
}
|
||||
val warn = installed == null && !com.droiddeck.launcher.core.DeviceSupport.canDraw(this)
|
||||
if (warn && available != null) { showNonAdreno = available; return false }
|
||||
startActivity(intent)
|
||||
@@ -3630,42 +3573,14 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
done(granted)
|
||||
}
|
||||
|
||||
private val queuedLaunch = com.droiddeck.launcher.session.QueuedLaunch<Intent>(GATE_LAUNCH_MS)
|
||||
private val queuedLaunchRunner = com.droiddeck.launcher.session.QueuedLaunchRunner(
|
||||
queue = queuedLaunch,
|
||||
now = System::currentTimeMillis,
|
||||
blocked = { PhantomProcessLimit.blocksSteam(phantomProcessStatus) },
|
||||
busy = ::steamStartBusy,
|
||||
schedule = { delay, task -> if (delay <= 0L) ui.post(task) else ui.postDelayed(task, delay) },
|
||||
unschedule = ui::removeCallbacks,
|
||||
start = { launch -> startSession(launch, steamSession = true, queueIfBlocked = true) },
|
||||
retryMs = GATE_LAUNCH_RETRY_MS,
|
||||
)
|
||||
|
||||
/** The conditions under which a Steam start waits instead of being refused: setup, a runtime or desktop install, a storage cleanup, or a Steam store download. */
|
||||
private fun steamStartBusy(): Boolean = busy || LinuxRuntimeInstaller.isBusy() || com.droiddeck.launcher.session.Onboarding.settling() ||
|
||||
(SessionState.installing != null && !SessionState.running) || com.droiddeck.launcher.storage.StorageState.cleaning ||
|
||||
(!SessionState.running && com.droiddeck.launcher.stores.steam.SteamStore.downloading())
|
||||
|
||||
private fun refreshPhantomStatus() {
|
||||
phantomProcessStatus = PhantomProcessLimit.read(this)
|
||||
if (queuedLaunch.launch != null && !PhantomProcessLimit.blocksSteam(phantomProcessStatus)) showPhantomGate = false
|
||||
queuedLaunchRunner.poke()
|
||||
private fun refreshAdbPairing() {
|
||||
adbPaired = WirelessAdbFix.hasSavedPairing(this)
|
||||
phantomWarning = if (PhantomProcessLimit.blocksSteam(phantomProcessStatus)) {
|
||||
getString(
|
||||
R.string.phantom_warning, PhantomProcessLimit.title(this, phantomProcessStatus),
|
||||
PhantomProcessLimit.instructions(this, phantomProcessStatus), PhantomProcessLimit.adbCommand(),
|
||||
)
|
||||
} else null
|
||||
}
|
||||
|
||||
private fun openDeveloperOptions(displayId: Int?) {
|
||||
val highlight = if (PhantomProcessLimit.hasDeveloperToggle() &&
|
||||
WirelessAdbPairingService.stage.value == WirelessAdbPairingService.Stage.Idle) "disable_phantom_process_monitor" else "toggle_adb_wireless"
|
||||
val intent = Intent(android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.apply { if (highlight != null) putExtra(":settings:fragment_args_key", highlight) }
|
||||
.putExtra(":settings:fragment_args_key", "toggle_adb_wireless")
|
||||
try {
|
||||
if (displayId == null) startActivity(intent)
|
||||
else startActivity(intent, ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle())
|
||||
@@ -3787,10 +3702,6 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private const val REQUEST_NOTIFICATIONS = 7103
|
||||
private const val EXTRA_RESTARTED = "com.droiddeck.launcher.extra.RESTARTED"
|
||||
private const val STATE_HOME_CHOICE_OPEN = "home_choice_open"
|
||||
private const val STATE_PENDING_GATE_LAUNCH = "pending_gate_launch"
|
||||
private const val STATE_PENDING_GATE_LAUNCH_AT = "pending_gate_launch_at"
|
||||
private const val GATE_LAUNCH_MS = 15 * 60_000L
|
||||
private const val GATE_LAUNCH_RETRY_MS = 2_000L
|
||||
private const val KEY_PENDING_SESSION_LOG_EXPORT = "pending_session_log_export"
|
||||
private const val STATE_GAME_SPACE_OFFERED = "game_space_offered"
|
||||
private const val TAG = "MainActivity"
|
||||
|
||||
@@ -58,7 +58,6 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.core.AppLanguage
|
||||
import com.droiddeck.launcher.core.GlobalSettings
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.WirelessAdbPairingService
|
||||
import com.droiddeck.launcher.core.WirelessAdbPairingService.Stage
|
||||
import com.droiddeck.launcher.ui.DroidDeckTheme
|
||||
@@ -68,10 +67,9 @@ import com.droiddeck.launcher.ui.SecondaryButton
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
class PairingGuideActivity : ComponentActivity() {
|
||||
enum class Step { BUILD_NUMBER, CHILD_PROCESS, WIRELESS_DEBUGGING, PAIR, CODE, WORKING, DONE, FAILED }
|
||||
enum class Step { BUILD_NUMBER, WIRELESS_DEBUGGING, PAIR, CODE, WORKING, DONE, FAILED }
|
||||
|
||||
private var settingsDisplay: Int? = null
|
||||
private var toggleOnly = false
|
||||
private var inPip by mutableStateOf(false)
|
||||
private var launchPending = false
|
||||
|
||||
@@ -80,7 +78,6 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
settingsDisplay = intent.getIntExtra(EXTRA_DISPLAY, -1).takeIf { it >= 0 }
|
||||
toggleOnly = intent.getBooleanExtra(EXTRA_TOGGLE_ONLY, false)
|
||||
setContent { DroidDeckTheme { Guide() } }
|
||||
launchPending = savedInstanceState == null
|
||||
}
|
||||
@@ -89,7 +86,6 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
super.onNewIntent(intent)
|
||||
setIntent(intent)
|
||||
settingsDisplay = intent.getIntExtra(EXTRA_DISPLAY, -1).takeIf { it >= 0 }
|
||||
toggleOnly = intent.getBooleanExtra(EXTRA_TOGGLE_ONLY, false)
|
||||
launchPending = true
|
||||
}
|
||||
|
||||
@@ -120,7 +116,7 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
|
||||
private fun launchSettings() {
|
||||
launchPending = false
|
||||
openSettings(stepFor(SettingsState.read(this), WirelessAdbPairingService.stage.value, toggleOnly))
|
||||
openSettings(stepFor(SettingsState.read(this), WirelessAdbPairingService.stage.value))
|
||||
}
|
||||
|
||||
private fun enterPip() {
|
||||
@@ -134,7 +130,7 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
Intent(Settings.ACTION_DEVICE_INFO_SETTINGS).putExtra(HIGHLIGHT_KEY, "build_number")
|
||||
} else {
|
||||
Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS).apply {
|
||||
if (step != Step.CHILD_PROCESS) putExtra(HIGHLIGHT_KEY, "toggle_adb_wireless")
|
||||
putExtra(HIGHLIGHT_KEY, "toggle_adb_wireless")
|
||||
}
|
||||
}.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
val display = settingsDisplay
|
||||
@@ -161,10 +157,10 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
delay(500)
|
||||
}
|
||||
}
|
||||
val step = stepFor(settingsState, stage, toggleOnly)
|
||||
val step = stepFor(settingsState, stage)
|
||||
var previous by remember { mutableStateOf(step) }
|
||||
LaunchedEffect(step) {
|
||||
if (previous == Step.BUILD_NUMBER && (step == Step.WIRELESS_DEBUGGING || step == Step.CHILD_PROCESS)) openSettings(step)
|
||||
if (previous == Step.BUILD_NUMBER && step == Step.WIRELESS_DEBUGGING) openSettings(step)
|
||||
previous = step
|
||||
when (step) {
|
||||
Step.DONE -> { delay(1_500); returnToApp() }
|
||||
@@ -172,7 +168,7 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
LaunchedEffect(stage) { if (stage == Stage.Idle && !toggleOnly) finish() }
|
||||
LaunchedEffect(stage) { if (stage == Stage.Idle) finish() }
|
||||
BackHandler(enabled = !inPip && settingsDisplay == null) { enterPip() }
|
||||
|
||||
Box(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background), contentAlignment = Alignment.Center) {
|
||||
@@ -199,7 +195,7 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
Modifier.widthIn(max = 520.dp).fillMaxWidth().padding(24.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.gate_title), style = MaterialTheme.typography.headlineSmall,
|
||||
Text(stringResource(R.string.adbpair_title_pair), style = MaterialTheme.typography.headlineSmall,
|
||||
fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.onBackground)
|
||||
Text(instruction(step, stage), style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onBackground)
|
||||
StepVisual(step, compact = false)
|
||||
@@ -213,7 +209,7 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
openSettings(step)
|
||||
})
|
||||
SecondaryButton(stringResource(R.string.common_cancel), onClick = {
|
||||
if (!toggleOnly) WirelessAdbPairingService.cancel(this@PairingGuideActivity)
|
||||
WirelessAdbPairingService.cancel(this@PairingGuideActivity)
|
||||
returnToApp()
|
||||
})
|
||||
}
|
||||
@@ -224,12 +220,11 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
@Composable
|
||||
private fun instruction(step: Step, stage: Stage): String = when (step) {
|
||||
Step.BUILD_NUMBER -> stringResource(R.string.pairguide_build_number)
|
||||
Step.CHILD_PROCESS -> stringResource(R.string.pairguide_child_process)
|
||||
Step.WIRELESS_DEBUGGING -> stringResource(R.string.pairguide_wireless)
|
||||
Step.PAIR -> stringResource(R.string.pairguide_pair)
|
||||
Step.CODE -> (stage as? Stage.CodeNeeded)?.error ?: stringResource(R.string.gate_step3)
|
||||
Step.WORKING -> (stage as? Stage.Working)?.step ?: stringResource(R.string.adbpair_title_working)
|
||||
Step.DONE -> stringResource(R.string.adbpair_title_done)
|
||||
Step.WORKING -> (stage as? Stage.Working)?.step ?: stringResource(R.string.adbpair_title_pair)
|
||||
Step.DONE -> stringResource(R.string.adbpair_paired)
|
||||
Step.FAILED -> (stage as? Stage.Failed)?.error ?: stringResource(R.string.adbpair_title_failed)
|
||||
}
|
||||
|
||||
@@ -241,7 +236,6 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
val beat by pulse.animateFloat(0f, 1f, infiniteRepeatable(tween(900, easing = LinearEasing), RepeatMode.Restart), label = "beat")
|
||||
val label = when (step) {
|
||||
Step.BUILD_NUMBER -> stringResource(R.string.pairguide_row_build_number)
|
||||
Step.CHILD_PROCESS -> stringResource(R.string.pairguide_row_child_process)
|
||||
Step.WIRELESS_DEBUGGING -> stringResource(R.string.pairguide_row_wireless)
|
||||
Step.PAIR -> stringResource(R.string.pairguide_row_pair)
|
||||
Step.CODE -> stringResource(R.string.adbpair_enter_code)
|
||||
@@ -256,7 +250,7 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
Text(label, style = if (compact) MaterialTheme.typography.labelMedium else MaterialTheme.typography.bodyLarge,
|
||||
color = colors.onSurface, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
|
||||
when (step) {
|
||||
Step.WIRELESS_DEBUGGING, Step.CHILD_PROCESS -> Toggle(on = beat > 0.5f, accent = accent, compact = compact)
|
||||
Step.WIRELESS_DEBUGGING -> Toggle(on = beat > 0.5f, accent = accent, compact = compact)
|
||||
else -> Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
if (step == Step.BUILD_NUMBER) Text("×7", style = MaterialTheme.typography.labelLarge, color = accent)
|
||||
Box(contentAlignment = Alignment.Center) {
|
||||
@@ -283,8 +277,7 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
@Composable
|
||||
private fun StepDots(step: Step) {
|
||||
val accent = LocalPalette.current.signal
|
||||
val shown = if (toggleOnly) listOf(Step.BUILD_NUMBER, Step.CHILD_PROCESS)
|
||||
else listOf(Step.BUILD_NUMBER, Step.WIRELESS_DEBUGGING, Step.PAIR, Step.CODE)
|
||||
val shown = listOf(Step.BUILD_NUMBER, Step.WIRELESS_DEBUGGING, Step.PAIR, Step.CODE)
|
||||
val at = shown.indexOf(step).takeIf { it >= 0 } ?: shown.size
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(5.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
shown.forEachIndexed { index, _ ->
|
||||
@@ -298,27 +291,20 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
private data class SettingsState(
|
||||
val developerOptions: Boolean,
|
||||
val wirelessDebugging: Boolean,
|
||||
val childProcessBlocked: Boolean,
|
||||
) {
|
||||
companion object {
|
||||
fun read(context: Context) = SettingsState(
|
||||
GlobalSettings.developerOptionsOn(context),
|
||||
GlobalSettings.wirelessDebuggingOn(context),
|
||||
PhantomProcessLimit.blocksSteam(PhantomProcessLimit.read(context)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val EXTRA_DISPLAY = "settingsDisplay"
|
||||
private const val EXTRA_TOGGLE_ONLY = "toggleOnly"
|
||||
private const val HIGHLIGHT_KEY = ":settings:fragment_args_key"
|
||||
|
||||
private fun stepFor(settings: SettingsState, stage: Stage, toggleOnly: Boolean): Step = if (toggleOnly) when {
|
||||
!settings.developerOptions -> Step.BUILD_NUMBER
|
||||
settings.childProcessBlocked -> Step.CHILD_PROCESS
|
||||
else -> Step.DONE
|
||||
} else when (stage) {
|
||||
private fun stepFor(settings: SettingsState, stage: Stage): Step = when (stage) {
|
||||
is Stage.Working -> Step.WORKING
|
||||
Stage.Done -> Step.DONE
|
||||
is Stage.Failed -> Step.FAILED
|
||||
@@ -342,11 +328,10 @@ class PairingGuideActivity : ComponentActivity() {
|
||||
return mode == AppOpsManager.MODE_ALLOWED
|
||||
}
|
||||
|
||||
fun start(context: Context, settingsDisplay: Int?, toggleOnly: Boolean = false): Boolean {
|
||||
fun start(context: Context, settingsDisplay: Int?): Boolean {
|
||||
if (settingsDisplay == null && !canFloat(context)) return false
|
||||
context.startActivity(Intent(context, PairingGuideActivity::class.java)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.putExtra(EXTRA_TOGGLE_ONLY, toggleOnly)
|
||||
.apply { if (settingsDisplay != null) putExtra(EXTRA_DISPLAY, settingsDisplay) })
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ import com.droiddeck.launcher.session.WinComponents
|
||||
import com.droiddeck.launcher.ui.CursorOverlay
|
||||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import com.droiddeck.launcher.ui.DrawerActions
|
||||
import com.droiddeck.launcher.ui.HudText
|
||||
import com.droiddeck.launcher.ui.LoadingOverlay
|
||||
import com.droiddeck.launcher.ui.SessionDrawer
|
||||
import com.droiddeck.launcher.ui.SessionPausedOverlay
|
||||
@@ -285,6 +286,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private lateinit var sessionOverlay: ComposeView
|
||||
private lateinit var loading: LoadingState
|
||||
private lateinit var hud: DroidDeckHudHost
|
||||
private lateinit var memoryHud: com.droiddeck.launcher.session.MemoryHud
|
||||
private var padBridge: PadBridge? = null
|
||||
private val physicalShortcuts = PhysicalShortcutRouter()
|
||||
private var joyConVr: com.droiddeck.launcher.input.JoyConVr? = null
|
||||
@@ -634,6 +636,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var hudOn by mutableStateOf(true)
|
||||
private var gpuClockPin by mutableStateOf(false)
|
||||
private var hudConfig by mutableStateOf<Map<String, String>>(emptyMap())
|
||||
private var hudColor by mutableStateOf(SessionPrefs.HUD_COLOR_MINT)
|
||||
private var hudOpacity by mutableStateOf(SessionPrefs.HUD_OPACITY_DEFAULT)
|
||||
private var upscaler by mutableStateOf(0)
|
||||
private var upscaleSharpness by mutableStateOf(75)
|
||||
private var effects by mutableStateOf(ScreenEffects.OFF)
|
||||
@@ -803,6 +807,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
private var isHomeApp by mutableStateOf(false)
|
||||
private var androidApps by mutableStateOf<List<HomeApp.LaunchableApp>>(emptyList())
|
||||
private var padConnected by mutableStateOf(false)
|
||||
|
||||
private val deviceListener = object : InputManager.InputDeviceListener {
|
||||
override fun onInputDeviceAdded(deviceId: Int) {
|
||||
@@ -1056,12 +1061,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
hud.onConfigChanged = { hudConfig = DroidDeckHudConfig.load(this) }
|
||||
hud.passesTouchAt = ::controlTakesTouchAt
|
||||
hud.attach(root, root.childCount)
|
||||
memoryHud = com.droiddeck.launcher.session.MemoryHud(this)
|
||||
hud.onPresentingWindowChanged = {
|
||||
CompositorHost.rearmFrameGen { applyFrameGen(force = true) }
|
||||
}
|
||||
if (SessionState.running && SessionState.firstFrameSeen) {
|
||||
loading.visible = false
|
||||
hud.start()
|
||||
memoryHud.start()
|
||||
}
|
||||
readPrefs()
|
||||
|
||||
@@ -1238,6 +1245,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
resources.displayMetrics.density,
|
||||
cursorImage, cursorHotX, cursorHotY, cursorImageScale)
|
||||
|
||||
if (memoryHud.text.isNotEmpty()) HudText(memoryHud.text, hudColor, hudOpacity)
|
||||
if (bottomOutputActive && !loading.visible) SwappedTopPanel()
|
||||
val phonePanel = glassesOutputActive && !loading.visible && !drawerOpen && !pcKeyboardOpen
|
||||
if (phonePanel) GlassesPhonePanel(glasses, steamVrStatus == SteamVr.Status.RUNNING, headTracking)
|
||||
@@ -1255,9 +1263,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
glasses.usesSpatialControllers(glassesSettings) && glassesSettings.joyConTracking)
|
||||
joyConVr?.let { { it.recenter() } } else null,
|
||||
) { headTracker?.recenter() }
|
||||
if (!phonePanel && glasses.present && !drawerOpen && !pcKeyboardOpen && !loading.visible) com.droiddeck.launcher.ui.GlassesCornerButton(glassesSlot,
|
||||
val showGlassesShortcut = com.droiddeck.launcher.ui.rememberShowGlassesShortcut()
|
||||
if (!phonePanel && glasses.present && showGlassesShortcut && !drawerOpen && !pcKeyboardOpen && !loading.visible) com.droiddeck.launcher.ui.GlassesCornerButton(glassesSlot,
|
||||
controllerSettings?.tint ?: android.graphics.Color.rgb(90, 160, 255), controllerSettings?.opacity ?: 100) {
|
||||
drawerPage = com.droiddeck.launcher.ui.SessionDrawerPage.GLASSES
|
||||
drawerPage = com.droiddeck.launcher.ui.SessionDrawerPage.VR
|
||||
drawerOpen = true
|
||||
}
|
||||
if (!drawerOpen && !pcKeyboardOpen && !loading.visible) {
|
||||
@@ -1444,7 +1453,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
LaunchedEffect(drawerOpen, achievementsOpen, AgentGuest.focusRevision, StoreAchievements.revision) {
|
||||
if (!drawerOpen && !achievementsOpen) return@LaunchedEffect
|
||||
if (!drawerOpen && !achievementsOpen) {
|
||||
achievementsInFront = null
|
||||
return@LaunchedEffect
|
||||
}
|
||||
val found = kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
|
||||
runCatching { resolveAchievementsInFront() }
|
||||
.onFailure { Log.w(TAG, "achievements in front: ${it.javaClass.simpleName}") }.getOrNull()
|
||||
@@ -1780,7 +1792,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onBlackFrameInsertion = { on ->
|
||||
SessionPrefs.setBlackFrameInsertion(this@SessionActivity, on)
|
||||
blackFrameInsertion = on
|
||||
CompositorHost.setBlackFrameInsertion(on, refreshHz(), outputFpsLimit())
|
||||
CompositorHost.setBlackFrameInsertion(on, refreshHz(), compositorFpsLimit())
|
||||
},
|
||||
hdr = hdrWanted,
|
||||
hdrAvailable = hdrAvailable,
|
||||
@@ -1817,7 +1829,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onRumble = { on -> updateControllerPrefs { ControllerPrefs.setRumble(this@SessionActivity, on) } },
|
||||
onSteamMenu = if (SessionState.mode == SessionService.MODE_STEAM) ({ sendSteamGuide() }) else null,
|
||||
onQam = if (SessionState.mode == SessionService.MODE_STEAM) ({ triggerSteamQam() }) else null,
|
||||
onAchievements = achievementsInFront?.let { { drawerOpen = false; achievementsOpen = true } },
|
||||
controllerConnected = padConnected,
|
||||
achievementsGame = achievementsInFront?.game,
|
||||
achievementsTitle = achievementsInFront?.title,
|
||||
achievementsProgress = achievementsInFront?.progress,
|
||||
padType = if (SessionState.mode == SessionService.MODE_STEAM && SessionState.deckPad) padType else null,
|
||||
onPadType = { id ->
|
||||
@@ -1938,7 +1952,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onResume = { SessionService.resume(this@SessionActivity) },
|
||||
orientation = sessionOrientation,
|
||||
onOrientation = { value ->
|
||||
SessionPrefs.setOrientation(this@SessionActivity, value)
|
||||
when (SessionState.mode) {
|
||||
SessionService.MODE_STEAM, SessionService.MODE_RUN ->
|
||||
SessionPrefs.setOrientation(this@SessionActivity, "steam", value)
|
||||
SessionService.MODE_DESKTOP ->
|
||||
SessionPrefs.setOrientation(this@SessionActivity, "desktop", value)
|
||||
else -> SessionPrefs.setOrientation(this@SessionActivity, value)
|
||||
}
|
||||
sessionOrientation = value
|
||||
applyFollowOrientation(resources.configuration)
|
||||
},
|
||||
@@ -2671,6 +2691,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
hdrWanted = SessionPrefs.hdr(this, hdrPrefMode())
|
||||
hdrAvailable = HdrSupport.probe(this, glassesScreen?.display).reason == null
|
||||
hudConfig = DroidDeckHudConfig.load(this)
|
||||
hudColor = SessionPrefs.hudColor(this)
|
||||
hudOpacity = SessionPrefs.hudOpacity(this)
|
||||
upscaler = SessionPrefs.screenEffectsUpscaler(this, screenEffectsProfileIdForTarget(screenEffectsTarget))
|
||||
upscaleSharpness = SessionPrefs.upscaleSharpness(this)
|
||||
effects = SessionPrefs.screenEffects(this, screenEffectsProfileIdForTarget(screenEffectsTarget))
|
||||
@@ -2715,7 +2737,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
oscTrackpads = SessionPrefs.oscTrackpads(this)
|
||||
backHold = SessionPrefs.backHold(this)
|
||||
dockedMenuController = SessionPrefs.dockedMenuController(this)
|
||||
sessionOrientation = SessionPrefs.orientation(this)
|
||||
sessionOrientation = SessionPrefs.orientation(this, SessionState.mode)
|
||||
dualScreenSessionMode = SessionPrefs.dualScreenSessionMode(this)
|
||||
backActionsInverted = SessionPrefs.backActionsInverted(this)
|
||||
physicalShortcuts.bindings = PhysicalShortcuts.read(this)
|
||||
@@ -2981,7 +3003,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
CompositorHost.startOrAttach(
|
||||
this, holder.surface, runtimeDir.path,
|
||||
driverId?.let { turnip.driverPath(it) }, driverId?.let { turnip.libraryName(it) },
|
||||
applicationInfo.nativeLibraryDir, size.first, size.second, refreshHz(holder), outputFpsLimit(),
|
||||
applicationInfo.nativeLibraryDir, size.first, size.second, refreshHz(holder), compositorFpsLimit(),
|
||||
)
|
||||
onOutputAttached(holder)
|
||||
if (SessionState.running && size != previous) {
|
||||
@@ -3047,7 +3069,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
WaylandCompositor.nativeResizeOutput(size.first, size.second)
|
||||
}
|
||||
|
||||
private fun followPortrait(): Boolean = glassesScreen == null && SessionPrefs.portrait(this)
|
||||
private fun followPortrait(): Boolean = glassesScreen == null && SessionPrefs.portrait(this, SessionState.mode)
|
||||
|
||||
private fun applyFollowChoice() {
|
||||
val scale = SessionState.followScales.let { if (followPortrait()) it.second else it.first }
|
||||
@@ -3056,7 +3078,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
private fun applyFollowOrientation(config: android.content.res.Configuration) {
|
||||
val wanted = SessionPrefs.windowOrientation(this, SessionState.followScreen, config.smallestScreenWidthDp)
|
||||
val wanted = SessionPrefs.windowOrientation(this, SessionState.followScreen, config.smallestScreenWidthDp, SessionState.mode)
|
||||
if (requestedOrientation != wanted) requestedOrientation = wanted
|
||||
}
|
||||
|
||||
@@ -3119,13 +3141,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private fun displayMode(): String = SessionPrefs.displayMode(this,
|
||||
intent.getStringExtra(SessionService.EXTRA_MODE) ?: SessionService.MODE_STEAM, intent.getStringExtra(SessionService.EXTRA_PROGRAM))
|
||||
|
||||
private fun portraitOutput(): Boolean = SessionPrefs.portrait(this) && !controlsBelowWanted()
|
||||
private fun portraitOutput(): Boolean = SessionPrefs.portrait(this, SessionState.mode) && !controlsBelowWanted()
|
||||
|
||||
private fun outputSize(): Pair<Int, Int> =
|
||||
com.droiddeck.launcher.session.SessionDisplay.resolveChoice(com.droiddeck.launcher.session.SessionDisplay.panelSize(this),
|
||||
resolutionChoice(), portraitOutput())
|
||||
|
||||
private fun resolutionChoice(portrait: Boolean = SessionPrefs.portrait(this)): String {
|
||||
private fun resolutionChoice(portrait: Boolean = SessionPrefs.portrait(this, SessionState.mode)): String {
|
||||
val mode = displayMode()
|
||||
val program = intent.getStringExtra(SessionService.EXTRA_PROGRAM)
|
||||
return if (intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_RUN &&
|
||||
@@ -3172,6 +3194,18 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun outputFpsLimit(): Int = outputFpsLimit(pipUi)
|
||||
|
||||
// Android holds the window to the Game Mode override while the panel runs faster; the guest paces to the panel,
|
||||
// so without this cap every frame past the override is drawn and dropped.
|
||||
private fun hostFrameCap(): Int {
|
||||
if (glassesScreen != null || bottomOutputActive) return 0
|
||||
val display = (if (Build.VERSION.SDK_INT >= 30) display else @Suppress("DEPRECATION") windowManager.defaultDisplay) ?: return 0
|
||||
return SessionPrefs.hostFrameCap(display.refreshRate, display.mode.refreshRate)
|
||||
}
|
||||
|
||||
private fun compositorFpsLimit(): Int = SessionPrefs.compositorFpsLimit(
|
||||
mirrorRefreshLimit(), if (noSteamSession()) SessionState.fpsLimit else 0, pipUi, hostFrameCap(),
|
||||
)
|
||||
|
||||
private fun outputFpsLimit(pip: Boolean): Int =
|
||||
SessionPrefs.compositorFpsLimit(mirrorRefreshLimit(), if (noSteamSession()) SessionState.fpsLimit else 0, pip)
|
||||
|
||||
@@ -3209,7 +3243,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
)
|
||||
val hz = refreshHz()
|
||||
val changed = kotlin.math.abs(SessionState.refreshHz - hz) > 0.1f
|
||||
CompositorHost.updatePacing(hz, outputFpsLimit())
|
||||
CompositorHost.updatePacing(hz, compositorFpsLimit())
|
||||
pushCardboard(activeCardboard)
|
||||
if (changed && ::surfaceView.isInitialized) applyFrameGen()
|
||||
}
|
||||
@@ -3603,7 +3637,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
presentationFaultHint()?.let { return it }
|
||||
if (log == null || !log.isFile) return null
|
||||
return try {
|
||||
var enosys = 0
|
||||
var fexMissing = false
|
||||
val size = log.length()
|
||||
val text = java.io.RandomAccessFile(log, "r").use { f ->
|
||||
@@ -3614,7 +3647,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
String(bytes, Charsets.ISO_8859_1)
|
||||
}
|
||||
text.lineSequence().forEach { line ->
|
||||
if (line.contains("Function not implemented")) enosys++
|
||||
if (line.contains(FEX_MISSING)) fexMissing = true
|
||||
}
|
||||
val steamSetup = com.droiddeck.launcher.session.SteamClientSetupFailure.find(text.lineSequence())
|
||||
@@ -3636,9 +3668,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
} else if (fexMissing) {
|
||||
val what = com.droiddeck.launcher.frontend.Library.nameForProgram(SessionState.program) ?: getString(R.string.session_end_program)
|
||||
EndHint(getString(R.string.session_end_fex_missing, what), evenOnSuccess = true)
|
||||
} else if (enosys >= 8) {
|
||||
EndHint(resources.getQuantityString(R.plurals.session_hint_enosys, enosys, enosys,
|
||||
getString(R.string.perf_title), getString(R.string.perf_seccomp), getString(R.string.perf_xalia)))
|
||||
} else null
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
@@ -3780,7 +3809,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (fromController && (event.keyCode == KeyEvent.KEYCODE_BUTTON_L1 || event.keyCode == KeyEvent.KEYCODE_BUTTON_R1)) {
|
||||
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) {
|
||||
// The bumpers walk the tabs on the strip; a page kept inside More counts as the More tab.
|
||||
val pages = sessionDrawerPages(glasses.present)
|
||||
val pages = sessionDrawerPages(achievementsInFront != null)
|
||||
drawerPage = pages.strip().step(pages.tabFor(drawerPage), if (event.keyCode == KeyEvent.KEYCODE_BUTTON_R1) 1 else -1)
|
||||
releaseDrawerDirection()
|
||||
}
|
||||
@@ -4936,6 +4965,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
private fun refreshControls() {
|
||||
padConnected = controllerConnected()
|
||||
applyUnfoldedControls()
|
||||
updateOnScreenControls()
|
||||
}
|
||||
@@ -6369,12 +6399,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (!SessionState.suspended) pausedFrame = null
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
refreshHomeApp()
|
||||
if (::memoryHud.isInitialized && SessionState.running && SessionState.firstFrameSeen) memoryHud.refresh()
|
||||
if (intent?.action == SessionService.ACTION_RESUME) {
|
||||
intent.action = null
|
||||
SessionService.resume(this)
|
||||
}
|
||||
(getSystemService(INPUT_SERVICE) as? InputManager)
|
||||
?.registerInputDeviceListener(deviceListener, Handler(Looper.getMainLooper()))
|
||||
padConnected = controllerConnected()
|
||||
padBridge?.setStickDeadZone(ControllerPrefs.deadZone(this))
|
||||
refreshSecondScreenDisplays()
|
||||
if (SessionState.guestPid > 1) padBridge?.syncConnectedControllers()
|
||||
@@ -7104,6 +7136,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (isFinishing || isDestroyed) return@runOnUiThread
|
||||
loading.visible = false
|
||||
hud.start()
|
||||
memoryHud.start()
|
||||
if (started) {
|
||||
settleDualScreenControls()
|
||||
openDualScreenControls()
|
||||
@@ -7142,6 +7175,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
bottomGame?.let { screen -> bottomGame = null; runCatching { screen.dismiss() } }
|
||||
headTracker?.stop()
|
||||
if (::hud.isInitialized) hud.stop()
|
||||
if (::memoryHud.isInitialized) memoryHud.stop()
|
||||
joyConVr?.close()
|
||||
joyConVr = null
|
||||
handCamera?.stop()
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.File
|
||||
|
||||
/**
|
||||
* Loopback adb for the agent, so droiddeckctl in the Linux userland reaches the app. It reuses
|
||||
* the Wireless debugging pairing DroidDeck already made (for the phantom process fix): the paired
|
||||
* the Wireless debugging pairing DroidDeck already made: the paired
|
||||
* key goes to the guest as an adb vendor key, and the serial is the paired TLS connect port.
|
||||
* Without a pairing it falls back to adbd on 127.0.0.1:5555, which some devices and `adb tcpip`
|
||||
* leave listening.
|
||||
|
||||
@@ -3,13 +3,9 @@ package com.droiddeck.launcher.agent
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.ProotFastPath
|
||||
import com.droiddeck.launcher.session.SessionPhase
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.LinkOption.NOFOLLOW_LINKS
|
||||
import java.nio.file.StandardOpenOption.READ
|
||||
@@ -58,10 +54,7 @@ object AgentEnv {
|
||||
fun override(context: Context, name: String): JSONObject = synchronized(lock) {
|
||||
AgentAccess.requireCommands(context)
|
||||
if (NAME.matchEntire(name) == null || name in setOf(".", "..")) throw AgentException("INVALID_NAME", "Override names are letters, digits, '.', '_' and '-'")
|
||||
if (name == LEGACY_FAST_PATH) throw AgentException("INVALID_NAME", "The fast-path library is now $FAST_PATH")
|
||||
if (name == "libddfastpath.so" && (SessionState.running || SessionState.guestPid > 0 || SessionState.phase == SessionPhase.STOPPING)) {
|
||||
throw AgentException("SESSION_ACTIVE", "Stop the session before installing a fast-path library")
|
||||
}
|
||||
if (name in retiredOverrides) throw AgentException("INVALID_NAME", "The Fast Path override was retired")
|
||||
val source = File(inbox(context), name)
|
||||
if (Files.isSymbolicLink(source.toPath())) throw AgentException("INVALID_NAME", "The override must be a regular file")
|
||||
if (!source.isFile) throw AgentException("NO_SUCH_FILE", "Push the binary to ${source.path} first")
|
||||
@@ -74,10 +67,6 @@ object AgentEnv {
|
||||
staged.delete()
|
||||
throw AgentException("OVERRIDE_FAILED", "Could not stage the override")
|
||||
}
|
||||
if (name == "libddfastpath.so" && !arm64SharedLibrary(staged)) {
|
||||
staged.delete()
|
||||
throw AgentException("INVALID_LIBRARY", "The fast path must be a 64-bit little-endian ARM64 ELF shared library")
|
||||
}
|
||||
if (!staged.setExecutable(true, false) || !staged.renameTo(target)) {
|
||||
staged.delete()
|
||||
throw AgentException("OVERRIDE_FAILED", "Could not install $name in the rootfs")
|
||||
@@ -87,42 +76,9 @@ object AgentEnv {
|
||||
state.put("pendingOverrides", JSONArray(merge(strings(state.optJSONArray("pendingOverrides")), listOf(name))))
|
||||
save(context, state)
|
||||
state.put("installed", "$GUEST_BIN/$name")
|
||||
if (name == "libddfastpath.so") {
|
||||
val digest = MessageDigest.getInstance("SHA-256")
|
||||
target.inputStream().use { input ->
|
||||
val buffer = ByteArray(65536)
|
||||
while (true) {
|
||||
val count = input.read(buffer)
|
||||
if (count < 0) break
|
||||
digest.update(buffer, 0, count)
|
||||
}
|
||||
}
|
||||
state.put("sha256", digest.digest().joinToString("") { "%02x".format(it) })
|
||||
}
|
||||
state
|
||||
}
|
||||
|
||||
fun fastPathLibrary(context: Context): String = synchronized(lock) {
|
||||
if (!AgentAccess.commandsAllowed(context)) return@synchronized ProotFastPath.LIBRARY
|
||||
if ("libddfastpath.so" !in strings(load(context).optJSONArray("activeOverrides"))) return@synchronized ProotFastPath.LIBRARY
|
||||
val file = File(bin(context), "libddfastpath.so")
|
||||
if (!file.isFile || Files.isSymbolicLink(file.toPath())) return@synchronized ProotFastPath.LIBRARY
|
||||
"$GUEST_BIN/libddfastpath.so"
|
||||
}
|
||||
|
||||
private fun arm64SharedLibrary(file: File): Boolean = file.inputStream().use { input ->
|
||||
val header = ByteArray(20)
|
||||
var count = 0
|
||||
while (count < header.size) {
|
||||
val read = input.read(header, count, header.size - count)
|
||||
if (read < 0) return@use false
|
||||
count += read
|
||||
}
|
||||
header.take(7) == listOf<Byte>(0x7f, 0x45, 0x4c, 0x46, 2, 1, 1) &&
|
||||
header[16] == 3.toByte() && header[17] == 0.toByte() &&
|
||||
header[18] == 183.toByte() && header[19] == 0.toByte()
|
||||
}
|
||||
|
||||
fun beginSession(context: Context): List<String> = synchronized(lock) {
|
||||
if (!AgentAccess.commandsAllowed(context)) {
|
||||
revoke(context)
|
||||
@@ -130,18 +86,12 @@ object AgentEnv {
|
||||
}
|
||||
val state = load(context)
|
||||
val active = strings(state.optJSONArray("pending"))
|
||||
val queued = strings(state.optJSONArray("pendingOverrides"))
|
||||
val legacy = File(bin(context), LEGACY_FAST_PATH)
|
||||
val stranded = FAST_PATH in queued && legacy.isFile && !File(bin(context), FAST_PATH).exists() &&
|
||||
!legacy.renameTo(File(bin(context), FAST_PATH))
|
||||
if (stranded) Log.w(TAG, "could not rename the queued $LEGACY_FAST_PATH; it stays queued for the next session")
|
||||
val overrides = if (stranded) queued - FAST_PATH else queued
|
||||
bin(context).listFiles()
|
||||
?.filter { it.name !in overrides && !(stranded && it.name == LEGACY_FAST_PATH) }?.forEach { it.delete() }
|
||||
val overrides = strings(state.optJSONArray("pendingOverrides"))
|
||||
bin(context).listFiles()?.filter { it.name !in overrides }?.forEach { it.delete() }
|
||||
val lines = strings(state.optJSONArray("persistent")) + active
|
||||
val withPath = if (overrides.none { it != "libddfastpath.so" }) lines else lines + "PATH=$GUEST_BIN:${pathOf(lines)}"
|
||||
val withPath = if (overrides.isEmpty()) lines else lines + "PATH=$GUEST_BIN:${pathOf(lines)}"
|
||||
state.put("active", JSONArray(active)).put("pending", JSONArray())
|
||||
state.put("activeOverrides", JSONArray(overrides)).put("pendingOverrides", JSONArray(if (stranded) listOf(FAST_PATH) else emptyList()))
|
||||
state.put("activeOverrides", JSONArray(overrides)).put("pendingOverrides", JSONArray())
|
||||
save(context, state)
|
||||
if (withPath.isNotEmpty()) Log.i(TAG, "agent environment keys for this session: ${withPath.map { it.substringBefore('=') }}")
|
||||
withPath
|
||||
@@ -164,8 +114,7 @@ object AgentEnv {
|
||||
save(context, state)
|
||||
}
|
||||
|
||||
private const val FAST_PATH = "libddfastpath.so"
|
||||
private const val LEGACY_FAST_PATH = "libblfastpath.so"
|
||||
private val retiredOverrides = setOf("libddfastpath.so", "libblfastpath.so")
|
||||
|
||||
private fun pathOf(lines: List<String>) =
|
||||
lines.lastOrNull { it.startsWith("PATH=") }?.substringAfter('=')?.takeIf { it.isNotBlank() } ?: LinuxRuntime.GUEST_PATH
|
||||
@@ -196,7 +145,7 @@ object AgentEnv {
|
||||
if (!state.has(key)) state.put(key, JSONArray())
|
||||
}
|
||||
for (key in listOf("pendingOverrides", "activeOverrides")) {
|
||||
state.put(key, JSONArray(strings(state.optJSONArray(key)).map { if (it == LEGACY_FAST_PATH) FAST_PATH else it }.distinct()))
|
||||
state.put(key, JSONArray(strings(state.optJSONArray(key)).filterNot { it in retiredOverrides }.distinct()))
|
||||
}
|
||||
return state
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ object Codex : AgentHarness {
|
||||
override val plans = false
|
||||
override val efforts = listOf("low", "medium", "high")
|
||||
|
||||
// Codex's sandbox needs Landlock and seccomp, which proot does not provide, so commands run unsandboxed
|
||||
// Codex's sandbox needs Landlock and seccomp, which the Android guest cannot provide, so commands run unsandboxed
|
||||
// and "untrusted" is what makes Codex ask before each one that is not known to be safe.
|
||||
override val permissions = listOf(
|
||||
AgentHarness.Permission(AgentHarness.ASK, R.string.agent_permission_ask, R.string.agent_permission_ask_hint),
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.OrphanReaper
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
@@ -68,7 +67,7 @@ object AgentHost {
|
||||
|
||||
/** Where the agent runs and what the user sees, which no file in the checkout tells it. */
|
||||
@VisibleForTesting
|
||||
internal const val BRIEF = "You run inside DroidDeck on the user's handheld, in its Linux userland (Ubuntu under proot, aarch64), " +
|
||||
internal const val BRIEF = "You run inside DroidDeck on the user's handheld, in its Linux userland (Ubuntu, aarch64), " +
|
||||
"and the user talks to you from DroidDeck's Agent tab, often on a small screen, so keep replies short. " +
|
||||
"DroidDeck's rules for working here are in your global instructions file (~/.claude/CLAUDE.md or ~/.codex/AGENTS.md); " +
|
||||
"if they are not loaded, read ${AgentSetup.CTL}/AGENTS.md before acting on the device. " +
|
||||
@@ -545,34 +544,23 @@ object AgentHost {
|
||||
state = if (installed) State.IDLE else State.MISSING
|
||||
}
|
||||
|
||||
/**
|
||||
* A process for [command] in the Linux userland, run the way the store helpers run theirs:
|
||||
* proot over the installed rootfs, without a session. Loopback adb is connected first so
|
||||
* droiddeckctl reaches the app.
|
||||
*/
|
||||
fun guest(app: Context, command: List<String>, workdir: String = "/root", connectAdb: Boolean = true, fakeRoot: Boolean = false): ProcessBuilder {
|
||||
fun guest(app: Context, command: List<String>, workdir: String = "/root", connectAdb: Boolean = true): ProcessBuilder {
|
||||
val adb = AgentAdb.prepare(app)
|
||||
val env = listOf(
|
||||
"/usr/bin/env", "HOME=/root", "PATH=$GUEST_PATH", "LANG=C.UTF-8",
|
||||
"ADB_SERIAL=${adb.serial}", "ADB_VENDOR_KEYS=${adb.vendorKeys}", "DROIDDECK_PACKAGE=${app.packageName}",
|
||||
"ADB_SERVER_SOCKET=localfilesystem:${File(app.noBackupFilesDir, "agent-adb.sock").path}",
|
||||
"DD_AGENT=1", "DD_AGENT_INBOX=${File(app.filesDir, "agent").path}", "BROWSER=/root/.local/bin/android-open", "DD_BROWSER_DISPLAY=${AgentAdb.browserDisplay}",
|
||||
)
|
||||
val shell = listOf(
|
||||
"/bin/sh", "-c",
|
||||
// proot ends the adb server with the command, so each command that needs adb connects it.
|
||||
(if (connectAdb) "adb start-server >/dev/null 2>&1; adb connect \"\$ADB_SERIAL\" >/dev/null 2>&1; " else "") +
|
||||
"cd \"$1\" 2>/dev/null; shift; exec \"$@\"", "sh", workdir,
|
||||
)
|
||||
val proot = LinuxRuntime.command(app, null, null, LinuxRuntime.sharedStorage(app), null, env + shell + command, fakeRoot)
|
||||
return ProcessBuilder(proot).redirectErrorStream(true).apply {
|
||||
environment().apply {
|
||||
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(app).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(app).path)
|
||||
if (SessionPrefs.prootNoSeccomp(app)) put("PROOT_NO_SECCOMP", "1")
|
||||
LinuxRuntime.prootLibraryPath(app).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
val root = LinuxRuntime.rootDir(app)
|
||||
val mounts = LinuxRuntime.binds(app, null, null, LinuxRuntime.sharedStorage(app), null)
|
||||
return com.droiddeck.launcher.runtime.NativeGuest.processBuilder(app, root, mounts, env + shell + command)
|
||||
.redirectErrorStream(true)
|
||||
}
|
||||
|
||||
fun guestFileExists(context: Context, path: String): Boolean {
|
||||
@@ -711,7 +699,6 @@ object AgentHost {
|
||||
claimLabRequest(app)
|
||||
claimOpenUrl(app)
|
||||
claimDeviceCode(app)
|
||||
// proot comes from an add-on pack fetched after the app starts, so the runtime can become usable later.
|
||||
if (!available && state != State.WORKING) available = LinuxRuntime.hasRootfs(app)
|
||||
lab = LabProgress.read(LinuxRuntime.rootDir(app))
|
||||
AgentHostService.update(app)
|
||||
|
||||
@@ -7,15 +7,13 @@ import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/** Runs a guest program without proot (`droiddeckctl native`), for testing the native userland. */
|
||||
/** Runs a native guest program (`droiddeckctl native`), for testing the native userland. */
|
||||
object AgentNative {
|
||||
private const val OUTPUT_CAP = 256 * 1024
|
||||
|
||||
fun run(context: Context, request: JSONObject, timeoutMs: Long): JSONObject {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
com.droiddeck.launcher.session.SessionFiles.stage(context, root)
|
||||
// with the setting off, staging leaves the rootfs as proot wants it
|
||||
if (!com.droiddeck.launcher.session.SessionPrefs.nativeUserland(context)) NativeGuest.prepare(context, root)
|
||||
if (!NativeGuest.available(root)) throw AgentException("NATIVE_UNAVAILABLE", "The rootfs has no native hook or glibc loader yet; start a session once")
|
||||
val argvJson = request.optJSONArray("argv") ?: throw AgentException("INVALID_REQUEST", "argv is required")
|
||||
val argv = (0 until argvJson.length()).map { argvJson.getString(it) }
|
||||
|
||||
@@ -5,10 +5,6 @@ import android.os.SystemClock
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Linux userland processes, read from /proc: proot runs them as real processes under the app's
|
||||
* own uid, so the app can list and end them without a shell.
|
||||
*/
|
||||
object AgentProcesses {
|
||||
data class Proc(
|
||||
val pid: Int, val ppid: Int, val name: String, val args: String,
|
||||
@@ -24,7 +20,7 @@ object AgentProcesses {
|
||||
|
||||
/** Guest processes, those under [turnPid] (the agent's current turn) first. */
|
||||
@Synchronized
|
||||
fun snapshot(turnPid: Int): List<Proc> {
|
||||
fun snapshot(root: File, turnPid: Int): List<Proc> {
|
||||
val me = Process.myPid()
|
||||
val uid = Process.myUid()
|
||||
val stats = HashMap<Int, Stat>()
|
||||
@@ -40,14 +36,15 @@ object AgentProcesses {
|
||||
val now = SystemClock.elapsedRealtime()
|
||||
val uptimeTicks = now * HZ / 1000
|
||||
val elapsed = (now - lastAt).coerceAtLeast(1)
|
||||
fun isProot(pid: Int): Boolean {
|
||||
val argv = args[pid].orEmpty().split(' ')
|
||||
val program = if (argv.first().endsWith("/linker64")) argv.getOrElse(1) { "" } else argv.first()
|
||||
return program.endsWith("proot.so") || program.endsWith("/proot")
|
||||
}
|
||||
val launchers = com.droiddeck.launcher.runtime.GuestWorkers.guestPids().toSet() + turnPid +
|
||||
com.droiddeck.launcher.session.SessionState.guestPid
|
||||
val rootPath = root.path.trimEnd('/') + "/"
|
||||
fun ancestors(pid: Int) = generateSequence(stats[pid]?.ppid) { stats[it]?.ppid }.takeWhile { it > 1 }.take(64)
|
||||
fun nativeGuest(pid: Int): Boolean = pid in launchers || args[pid].orEmpty().split(' ').take(2).any {
|
||||
it.startsWith(rootPath)
|
||||
}
|
||||
val out = stats.values.filter { s ->
|
||||
!isProot(s.pid) && args[s.pid].orEmpty().isNotEmpty() && ancestors(s.pid).any { isProot(it) }
|
||||
args[s.pid].orEmpty().isNotEmpty() && (nativeGuest(s.pid) || ancestors(s.pid).any(::nativeGuest))
|
||||
}.map { s ->
|
||||
val full = args[s.pid].orEmpty()
|
||||
val cpu = lastTicks[s.pid]?.let { ((s.ticks - it) * 1000 * 100 / HZ / elapsed).toInt().coerceIn(0, 800) } ?: 0
|
||||
|
||||
@@ -144,8 +144,6 @@ object AgentSetup {
|
||||
"apt -f install -y --fix-missing; " +
|
||||
"apt install -y --no-install-recommends git gh adb curl ca-certificates python3; $harnessInstall"
|
||||
|
||||
fun runsAsRoot(step: Step) = step == Step.INSTALL
|
||||
|
||||
/** Runs [step]'s action. [CONNECTION] is the app's own pairing flow, so the caller opens it. */
|
||||
fun run(context: Context, step: Step) = run(context, step, null)
|
||||
|
||||
@@ -189,7 +187,7 @@ object AgentSetup {
|
||||
val result = runCatching {
|
||||
installHelpers(app)
|
||||
runCatching { harness.prepare(LinuxRuntime.rootDir(app)) }
|
||||
val child = AgentHost.guest(app, command, fakeRoot = runsAsRoot(step)).start()
|
||||
val child = AgentHost.guest(app, command).start()
|
||||
val pid = AgentProcesses.pidOf(child)
|
||||
OrphanReaper.keep(pid)
|
||||
try {
|
||||
@@ -198,7 +196,7 @@ object AgentSetup {
|
||||
child.inputStream.bufferedReader().forEachLine { line ->
|
||||
log.appendLine(line)
|
||||
val text = line.trim()
|
||||
if (text.isNotEmpty() && !noise(text)) main.post {
|
||||
if (text.isNotEmpty()) main.post {
|
||||
detail[step] = text.take(160)
|
||||
if (step == Step.GITHUB && text.startsWith("GitHub device code:")) AgentHostService.update(app)
|
||||
}
|
||||
@@ -259,7 +257,7 @@ object AgentSetup {
|
||||
// A running or newer Allow owns the row, including the instructions it shows while it waits.
|
||||
if (step == Step.CONNECTION && (generation != connectionGeneration || status[step] == Status.WORKING)) return@post
|
||||
if (status[step] != Status.WORKING) status[step] = if (ok) Status.DONE else Status.TODO
|
||||
val last = output.lines().lastOrNull { it.isNotBlank() && !noise(it.trim()) }?.trim()?.take(160)
|
||||
val last = output.lines().lastOrNull { it.isNotBlank() }?.trim()?.take(160)
|
||||
when {
|
||||
ok -> detail.remove(step)
|
||||
step == Step.CONNECTION -> detail[step] = app.getString(
|
||||
@@ -270,9 +268,6 @@ object AgentSetup {
|
||||
}
|
||||
}
|
||||
|
||||
/** proot warns about its bindings on every start; that says nothing about the step. */
|
||||
private fun noise(line: String) = line.startsWith("proot warning")
|
||||
|
||||
private fun set(step: Step, value: Status) {
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) status[step] = value else main.post { status[step] = value }
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class DirectAudioRelayComponent extends SessionPart {
|
||||
}
|
||||
}
|
||||
final java.io.PrintWriter log = out;
|
||||
pid = HostProcess.start(command.toString(), env.toArray(new String[0]),
|
||||
pid = HostProcess.startUncounted(command.toString(), env.toArray(new String[0]),
|
||||
app().getFilesDir(), null,
|
||||
line -> {
|
||||
Log.i(TAG, line);
|
||||
|
||||
@@ -186,13 +186,16 @@ public class PulseAudioComponent extends SessionPart {
|
||||
env.add("LD_LIBRARY_PATH=/system/lib64:" + modules + ":" + workingDir.getAbsolutePath());
|
||||
env.add("HOME=" + workingDir);
|
||||
env.add("TMPDIR=" + workingDir);
|
||||
// The daemon closes every fd at start but this one; in a worker process it is the binder
|
||||
// fd whose closing Android takes for the process's death.
|
||||
env.add("PULSE_PASSED_FD=" + com.droiddeck.launcher.runtime.GuestWorker.BINDER_FD_TOKEN);
|
||||
|
||||
String command = String.join(" ", HostProcess.dataExecutable(workingDir.getAbsolutePath() + "/libpulseaudio.so"))
|
||||
+ " --system=false --disable-shm=true --fail=false"
|
||||
+ " -n --file=default.pa --daemonize=false --use-pid-file=false --exit-idle-time=-1"
|
||||
+ " --log-level=info";
|
||||
final java.io.PrintWriter out = openLog();
|
||||
if (!host.launch(generation, () -> HostProcess.start(command, env.toArray(new String[0]), workingDir, status -> {
|
||||
if (!host.launch(generation, () -> HostProcess.startUncounted(command, env.toArray(new String[0]), workingDir, status -> {
|
||||
if (host.exited(generation)) {
|
||||
Log.w(TAG, "audio host exited with status " + status + "; restarting");
|
||||
start(generation);
|
||||
|
||||
@@ -152,9 +152,6 @@ internal class AddonPack(
|
||||
const val COMPLETE = ".complete"
|
||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
||||
|
||||
@JvmField
|
||||
val PROOT = AddonPack("proot", BuildConfig.PACK_PROOT_SHA256, BuildConfig.PACK_PROOT_SIZE,
|
||||
listOf("libproot.so", "libproot-loader.so"))
|
||||
@JvmField
|
||||
val DIRECTAUDIO = AddonPack("directaudio", BuildConfig.PACK_DIRECTAUDIO_SHA256, BuildConfig.PACK_DIRECTAUDIO_SIZE,
|
||||
listOf("linux-wine11/version.txt", "linux-wine11-systhread/version.txt"))
|
||||
|
||||
@@ -284,11 +284,6 @@ object DeviceReport {
|
||||
k("Linux x86 (FEX)", if (com.droiddeck.launcher.runtime.LinuxFex.ready(context)) "ready" else "not set up")
|
||||
k("gamescope realtime", SessionPrefs.gamescopeRealtime(context))
|
||||
k("pace cores", SessionPrefs.paceCores(context))
|
||||
k("proot without seccomp", SessionPrefs.prootNoSeccomp(context))
|
||||
k("native userland (no proot)", SessionPrefs.nativeUserland(context))
|
||||
k("proot fast path", SessionPrefs.prootFastPath(context))
|
||||
k("proot binary", LinuxRuntime.prootSource(context) + " " + LinuxRuntime.prootBinary(context).path)
|
||||
k("proot fast path (eligible)", com.droiddeck.launcher.runtime.ProotFastPath.enabled(context))
|
||||
k("Guest host name", SessionPrefs.guestHostname(context))
|
||||
k("DirectAudio for games", SessionPrefs.directAudio(context))
|
||||
k("Stretch 16:9 to panel", SessionPrefs.stretch16x9(context))
|
||||
@@ -308,7 +303,8 @@ object DeviceReport {
|
||||
})
|
||||
|
||||
h("Android process limits")
|
||||
k("Phantom proc monitor", PhantomProcessLimit.reportValue(PhantomProcessLimit.read(context)))
|
||||
k("Guest-worker handoff available", com.droiddeck.launcher.runtime.GuestWorkers.enabled(context))
|
||||
k("Session root in guest worker", com.droiddeck.launcher.runtime.GuestWorkers.sessionRootUncounted ?: "no session")
|
||||
|
||||
h("Device switch files")
|
||||
SessionService.envSwitchFile(context)?.takeIf { it.isFile }?.let { f ->
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.os.ParcelFileDescriptor
|
||||
import android.util.Log
|
||||
import java.io.File
|
||||
import java.util.function.Consumer
|
||||
@@ -7,6 +8,9 @@ import java.util.function.Consumer
|
||||
object HostProcess {
|
||||
private const val TAG = "HostProcess"
|
||||
private const val LINKER = "/system/bin/linker64"
|
||||
// sh -c WORKER_CD sh DIR NAME=VALUE... -- PROGRAM ARGS...
|
||||
private const val WORKER_CD = "cd \"\$1\" || exit 126; shift; " +
|
||||
"while [ \$# -gt 0 ] && [ \"\$1\" != -- ]; do export \"\$1\"; shift; done; shift; exec \"\$@\""
|
||||
|
||||
/** Android 10+ refuses to execute app data files for targetSdk 29+; its linker still loads them. */
|
||||
@JvmStatic
|
||||
@@ -65,6 +69,77 @@ object HostProcess {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* As [start], but the program runs as the main process of one of the app's worker processes,
|
||||
* which Android does not count against the app's child processes (docs/phantom-processes.md).
|
||||
* Falls back to [start] when no worker is available. The exit status is the program's exit
|
||||
* code, or 128 plus the signal that ended it, as Process.waitFor() reports it.
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun startUncounted(command: String, env: Array<String>?, dir: File?, onExit: Consumer<Int>?, onLine: Consumer<String>?,
|
||||
outputFile: File? = null, onOutputComplete: Runnable? = null): Int {
|
||||
val context = com.droiddeck.launcher.runtime.GuestWorkers.context
|
||||
val argv = split(command)
|
||||
// A missing working directory fails the launch (start() returns -1 for it), not the program
|
||||
if (context == null || argv.isEmpty() || !com.droiddeck.launcher.runtime.GuestWorkers.enabled(context) ||
|
||||
(dir != null && !dir.isDirectory)) {
|
||||
return start(command, env, dir, onExit, onLine, outputFile, onOutputComplete)
|
||||
}
|
||||
val environment = LinkedHashMap(System.getenv())
|
||||
env?.forEach { line ->
|
||||
val eq = line.indexOf('=')
|
||||
if (eq > 0) environment[line.substring(0, eq)] = line.substring(eq + 1)
|
||||
}
|
||||
val assignments = environment.map { (k, v) -> "$k=$v" }
|
||||
// A worker cannot chdir before its exec, so Android's shell does it. The shell starts with an
|
||||
// environment of its own (the program's LD_PRELOAD of glibc libraries would stop it loading)
|
||||
// and exports the program's before the exec.
|
||||
val launch = if (dir != null) {
|
||||
listOf("/system/bin/sh", "-c", WORKER_CD, "sh", dir.path) + assignments + listOf("--") + argv
|
||||
} else argv
|
||||
val workerEnv = if (dir != null) listOf("PATH=/system/bin") else assignments
|
||||
var input: ParcelFileDescriptor? = null
|
||||
var reader: ParcelFileDescriptor? = null
|
||||
var output: ParcelFileDescriptor? = null
|
||||
val pid = try {
|
||||
input = ParcelFileDescriptor.open(File("/dev/null"), ParcelFileDescriptor.MODE_READ_ONLY)
|
||||
output = when {
|
||||
onLine != null -> ParcelFileDescriptor.createPipe().let { reader = it[0]; it[1] }
|
||||
outputFile != null -> ParcelFileDescriptor.open(outputFile,
|
||||
ParcelFileDescriptor.MODE_WRITE_ONLY or ParcelFileDescriptor.MODE_CREATE or ParcelFileDescriptor.MODE_APPEND)
|
||||
else -> ParcelFileDescriptor.open(File("/dev/null"), ParcelFileDescriptor.MODE_WRITE_ONLY)
|
||||
}
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.start(context, launch, workerEnv, listOf(input, output, output)) { status ->
|
||||
onExit?.accept(if (status < 0) -1 else if (status and 0x7f == 0) (status shr 8) and 0xff else 128 + (status and 0x7f))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "no worker for ${argv.first()}", e)
|
||||
-1
|
||||
} finally {
|
||||
runCatching { input?.close() }
|
||||
runCatching { output?.close() }
|
||||
}
|
||||
if (pid <= 0) {
|
||||
reader?.close()
|
||||
return start(command, env, dir, onExit, onLine, outputFile, onOutputComplete)
|
||||
}
|
||||
Log.i(TAG, "started pid $pid outside the child-process count: ${argv.first()} (${argv.size - 1} arguments)")
|
||||
reader?.let { pipe ->
|
||||
Thread({
|
||||
try {
|
||||
ParcelFileDescriptor.AutoCloseInputStream(pipe).bufferedReader().useLines { lines ->
|
||||
lines.forEach { onLine?.accept(it) }
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
} finally {
|
||||
onOutputComplete?.run()
|
||||
}
|
||||
}, "proc-out-$pid").apply { priority = Thread.NORM_PRIORITY - 1; isDaemon = true; start() }
|
||||
}
|
||||
return pid
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun pidOf(process: Process): Int = try {
|
||||
val field = process.javaClass.getDeclaredField("pid")
|
||||
|
||||
@@ -81,7 +81,7 @@ object NetworkReport {
|
||||
append("\netc/droiddeck-net (the link as the session sees it):\n")
|
||||
FileUtils.readString(netdev)?.lines()?.forEach { append(" ").append(it).append('\n') }
|
||||
}
|
||||
append("\nproot makes no network namespace, so the session uses the phone's connection\n")
|
||||
append("\nThe session uses the phone's connection\n")
|
||||
append("directly: IPv4 and IPv6 both pass through, and there is nothing to forward.\n")
|
||||
append("Steam reads Android's transport, connectivity and metering through the runtime's\n")
|
||||
append("NetworkManager D-Bus bridge. Android settings manage Wi-Fi and cellular connections.\n")
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
enum class PhantomProcessStatus {
|
||||
NOT_APPLICABLE,
|
||||
DISABLED,
|
||||
ENABLED,
|
||||
UNSET,
|
||||
UNREADABLE,
|
||||
}
|
||||
|
||||
object PhantomProcessLimit {
|
||||
private const val SETTING = "settings_enable_monitor_phantom_procs"
|
||||
|
||||
private const val MAX_PHANTOM = "2147483647"
|
||||
private const val PREFS = "phantom-process-limit"
|
||||
private const val PREF_ANDROID_12_OFF = "android12-off"
|
||||
|
||||
fun usesDeviceConfig(sdk: Int = Build.VERSION.SDK_INT): Boolean = sdk == Build.VERSION_CODES.S
|
||||
|
||||
fun shellCommands(enabled: Boolean, sdk: Int = Build.VERSION.SDK_INT): List<String> = when {
|
||||
usesDeviceConfig(sdk) && enabled -> listOf(
|
||||
"device_config delete activity_manager max_phantom_processes",
|
||||
"device_config set_sync_disabled_for_tests none",
|
||||
"settings put global $SETTING true",
|
||||
)
|
||||
usesDeviceConfig(sdk) -> listOf(
|
||||
"device_config set_sync_disabled_for_tests persistent",
|
||||
"device_config put activity_manager max_phantom_processes $MAX_PHANTOM",
|
||||
"settings put global $SETTING false",
|
||||
)
|
||||
else -> listOf("settings put global $SETTING ${if (enabled) "true" else "false"}")
|
||||
}
|
||||
|
||||
fun verifyCommand(sdk: Int = Build.VERSION.SDK_INT): String =
|
||||
if (usesDeviceConfig(sdk)) "device_config get activity_manager max_phantom_processes"
|
||||
else "settings get global $SETTING"
|
||||
|
||||
fun verified(output: String, enabled: Boolean, sdk: Int = Build.VERSION.SDK_INT): Boolean {
|
||||
val value = output.trim()
|
||||
return if (usesDeviceConfig(sdk)) (value == MAX_PHANTOM) != enabled
|
||||
else value == if (enabled) "true" else "false"
|
||||
}
|
||||
|
||||
fun adbCommand(enabled: Boolean, sdk: Int = Build.VERSION.SDK_INT): String =
|
||||
shellCommands(enabled, sdk).joinToString(" && ") { "adb shell $it" }
|
||||
|
||||
fun adbCommand(): String = adbCommand(false)
|
||||
|
||||
fun rememberAndroid12(context: Context, off: Boolean) {
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putBoolean(PREF_ANDROID_12_OFF, off).apply()
|
||||
}
|
||||
|
||||
fun read(context: Context, sdk: Int = Build.VERSION.SDK_INT): PhantomProcessStatus {
|
||||
if (sdk < Build.VERSION_CODES.S) return PhantomProcessStatus.NOT_APPLICABLE
|
||||
if (usesDeviceConfig(sdk)) {
|
||||
val off = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getBoolean(PREF_ANDROID_12_OFF, false)
|
||||
val global = try {
|
||||
GlobalSettings.read(context, SETTING)
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
return android12Status(off, global, systemProperty(OVERRIDE_PROPERTY))
|
||||
}
|
||||
val global = try {
|
||||
GlobalSettings.read(context, SETTING)
|
||||
} catch (_: Exception) {
|
||||
return PhantomProcessStatus.UNREADABLE
|
||||
}
|
||||
return status(global, systemProperty(OVERRIDE_PROPERTY))
|
||||
}
|
||||
|
||||
fun android12Status(rememberedOff: Boolean, global: String?, override: String?): PhantomProcessStatus =
|
||||
if (rememberedOff || status(global, override) == PhantomProcessStatus.DISABLED) PhantomProcessStatus.DISABLED
|
||||
else PhantomProcessStatus.UNREADABLE
|
||||
|
||||
fun status(global: String?, override: String?): PhantomProcessStatus {
|
||||
val value = global?.trim()?.lowercase()?.takeIf { it.isNotEmpty() }
|
||||
?: override?.trim()?.lowercase()?.takeIf { it.isNotEmpty() }
|
||||
return when (value) {
|
||||
"false", "0" -> PhantomProcessStatus.DISABLED
|
||||
null -> PhantomProcessStatus.UNSET
|
||||
else -> PhantomProcessStatus.ENABLED
|
||||
}
|
||||
}
|
||||
|
||||
private const val OVERRIDE_PROPERTY = "persist.sys.fflag.override.$SETTING"
|
||||
|
||||
private fun systemProperty(name: String): String? = try {
|
||||
Class.forName("android.os.SystemProperties")
|
||||
.getMethod("get", String::class.java)
|
||||
.invoke(null, name) as? String
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
fun hasDeveloperToggle(sdk: Int = Build.VERSION.SDK_INT): Boolean = sdk >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
|
||||
|
||||
fun blocksSteam(status: PhantomProcessStatus): Boolean =
|
||||
status != PhantomProcessStatus.NOT_APPLICABLE && status != PhantomProcessStatus.DISABLED
|
||||
|
||||
fun title(context: Context, status: PhantomProcessStatus): String = context.getString(when (status) {
|
||||
PhantomProcessStatus.ENABLED -> R.string.phantom_title_on
|
||||
PhantomProcessStatus.UNSET -> R.string.phantom_title_unset
|
||||
PhantomProcessStatus.UNREADABLE -> R.string.phantom_title_unreadable
|
||||
PhantomProcessStatus.DISABLED -> R.string.phantom_title_off
|
||||
PhantomProcessStatus.NOT_APPLICABLE -> R.string.phantom_title_not_required
|
||||
})
|
||||
|
||||
fun instructions(context: Context, status: PhantomProcessStatus): String = when (status) {
|
||||
PhantomProcessStatus.ENABLED, PhantomProcessStatus.UNSET, PhantomProcessStatus.UNREADABLE ->
|
||||
context.getString(R.string.phantom_instructions_fix, fixSentence(context))
|
||||
PhantomProcessStatus.DISABLED -> context.getString(R.string.phantom_instructions_off)
|
||||
PhantomProcessStatus.NOT_APPLICABLE -> context.getString(R.string.phantom_instructions_not_applicable)
|
||||
}
|
||||
|
||||
fun gateInstructions(context: Context, status: PhantomProcessStatus): String = when (status) {
|
||||
PhantomProcessStatus.ENABLED, PhantomProcessStatus.UNSET, PhantomProcessStatus.UNREADABLE -> fixSentence(context)
|
||||
else -> instructions(context, status)
|
||||
}
|
||||
|
||||
fun fixSentence(context: Context, sdk: Int = Build.VERSION.SDK_INT): String =
|
||||
context.getString(if (hasDeveloperToggle(sdk)) R.string.phantom_fix_toggle else R.string.phantom_fix_no_toggle)
|
||||
|
||||
fun reportValue(status: PhantomProcessStatus): String = when (status) {
|
||||
PhantomProcessStatus.DISABLED -> "disabled (good - the OS will not kill the session's children)"
|
||||
PhantomProcessStatus.ENABLED -> "ENABLED (the OS may kill the session with no log; turn off Restrict child processes)"
|
||||
PhantomProcessStatus.UNSET -> "not set (ROM default applies; DroidDeck requires an explicit disabled value)"
|
||||
PhantomProcessStatus.UNREADABLE -> "unreadable (DroidDeck could not verify the setting)"
|
||||
PhantomProcessStatus.NOT_APPLICABLE -> "not applicable before Android 12"
|
||||
}
|
||||
}
|
||||
@@ -28,17 +28,18 @@ object SessionLogCapture {
|
||||
out.flush()
|
||||
writer = out
|
||||
this.target = target
|
||||
pid = HostProcess.start(
|
||||
pid = HostProcess.startUncounted(
|
||||
command(Process.myPid(), sinceMillis),
|
||||
null, target.parentFile, null,
|
||||
) { line ->
|
||||
synchronized(this) {
|
||||
try {
|
||||
writer?.apply { write(line); newLine(); flush() }
|
||||
} catch (e: Exception) {
|
||||
onLine = { line ->
|
||||
synchronized(this) {
|
||||
try {
|
||||
writer?.apply { write(line); newLine(); flush() }
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
if (pid == -1) {
|
||||
out.write("logcat could not be started; this ROM may not hand an app its own entries.\n")
|
||||
out.flush()
|
||||
|
||||
@@ -161,7 +161,13 @@ object WirelessAdbFix {
|
||||
}
|
||||
}.getOrDefault(address is Inet4Address)
|
||||
|
||||
fun localConnectPort(context: Context): Int? =
|
||||
fun verifyLocalPairing(context: Context) {
|
||||
val port = localConnectPort(context) ?: error(context.getString(R.string.adbpair_command_failed))
|
||||
check(acceptsKey(context, LOOPBACK, port)) { context.getString(R.string.adbpair_command_failed) }
|
||||
saveConnection(context, LOOPBACK, port)
|
||||
}
|
||||
|
||||
private fun localConnectPort(context: Context): Int? =
|
||||
tlsPortProperty()
|
||||
?: findConnectPort(context, LOOPBACK)
|
||||
|
||||
@@ -242,26 +248,6 @@ object WirelessAdbFix {
|
||||
return resolvedPort.get().takeIf { it in 1..65535 }
|
||||
}
|
||||
|
||||
fun setChildProcessLimit(context: Context, host: String, port: Int, enabled: Boolean) {
|
||||
loadOrCreateIdentity(context.applicationContext)
|
||||
Kadb.create(host, port).use { adb ->
|
||||
PhantomProcessLimit.shellCommands(enabled).forEach { command ->
|
||||
val change = adb.shell(command)
|
||||
check(change.exitCode == 0) { change.allOutput.ifBlank { context.getString(R.string.adbfix_command_failed, change.exitCode) } }
|
||||
}
|
||||
val result = adb.shell(PhantomProcessLimit.verifyCommand())
|
||||
check(result.exitCode == 0 && PhantomProcessLimit.verified(result.output, enabled)) {
|
||||
context.getString(R.string.adbfix_not_confirmed, result.allOutput.trim())
|
||||
}
|
||||
}
|
||||
if (PhantomProcessLimit.usesDeviceConfig()) PhantomProcessLimit.rememberAndroid12(context, !enabled)
|
||||
saveConnection(context, host, port)
|
||||
}
|
||||
|
||||
fun setUsingSavedPairing(context: Context, enabled: Boolean) {
|
||||
withSavedPairing(context) { appContext, host, port -> setChildProcessLimit(appContext, host, port, enabled) }
|
||||
}
|
||||
|
||||
fun hasSavedPairing(context: Context): Boolean = savedConnection(context.applicationContext) != null
|
||||
|
||||
fun savedPairingIsLocal(context: Context): Boolean = savedConnection(context.applicationContext)?.host
|
||||
|
||||
@@ -38,7 +38,6 @@ class WirelessAdbPairingService : Service() {
|
||||
private var pairingHost: String? = null
|
||||
private var pairingPort: Int? = null
|
||||
@Volatile private var working = false
|
||||
@Volatile private var limitEnabled = false
|
||||
@Volatile private var session = 0
|
||||
private val timeout = Runnable { finish(Stage.Failed(getString(R.string.adbpair_timed_out))) }
|
||||
|
||||
@@ -52,15 +51,14 @@ class WirelessAdbPairingService : Service() {
|
||||
onCode(code)
|
||||
}
|
||||
ACTION_CANCEL -> finish(Stage.Idle)
|
||||
else -> begin(intent?.getBooleanExtra(EXTRA_ENABLE_LIMIT, false) == true)
|
||||
else -> begin()
|
||||
}
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
private fun begin(enableLimit: Boolean) {
|
||||
private fun begin() {
|
||||
if (working) return
|
||||
session++
|
||||
limitEnabled = enableLimit
|
||||
pairingHost = null
|
||||
pairingPort = null
|
||||
working = false
|
||||
@@ -123,7 +121,6 @@ class WirelessAdbPairingService : Service() {
|
||||
}
|
||||
working = true
|
||||
val owner = session
|
||||
val enable = limitEnabled
|
||||
show(Stage.Working(getString(R.string.adbpair_pairing)))
|
||||
Thread({
|
||||
val paired = runCatching { kotlinx.coroutines.runBlocking { WirelessAdbFix.pair(this@WirelessAdbPairingService, WirelessAdbFix.LOOPBACK, port, code) } }
|
||||
@@ -141,12 +138,7 @@ class WirelessAdbPairingService : Service() {
|
||||
stopDiscovery()
|
||||
show(Stage.Working(getString(R.string.adbpair_connecting)))
|
||||
}
|
||||
val result = runCatching {
|
||||
val connectPort = WirelessAdbFix.localConnectPort(this)
|
||||
?: error(getString(R.string.adbpair_port_not_found))
|
||||
main.post { if (owner == session) show(Stage.Working(getString(R.string.adbpair_applying))) }
|
||||
WirelessAdbFix.setChildProcessLimit(this, WirelessAdbFix.LOOPBACK, connectPort, enable)
|
||||
}
|
||||
val result = runCatching { WirelessAdbFix.verifyLocalPairing(this) }
|
||||
main.post {
|
||||
working = false
|
||||
if (owner != session) return@post
|
||||
@@ -235,15 +227,15 @@ class WirelessAdbPairingService : Service() {
|
||||
.addAction(Notification.Action.Builder(null, getString(R.string.common_cancel), cancel).build())
|
||||
}
|
||||
is Stage.Working -> builder
|
||||
.setContentTitle(getString(R.string.adbpair_title_working))
|
||||
.setContentTitle(getString(R.string.adbpair_title_pair))
|
||||
.setContentText(stage.step)
|
||||
.setProgress(0, 0, true)
|
||||
.setOngoing(true)
|
||||
.setOnlyAlertOnce(true)
|
||||
Stage.Done -> builder
|
||||
.setContentTitle(getString(R.string.adbpair_title_done))
|
||||
.setContentText(getString(R.string.adbpair_done_text))
|
||||
.setStyle(Notification.BigTextStyle().bigText(getString(R.string.adbpair_done_text)))
|
||||
.setContentTitle(getString(R.string.adbpair_paired))
|
||||
.setContentText(getString(R.string.adbpair_return_to_app))
|
||||
.setStyle(Notification.BigTextStyle().bigText(getString(R.string.adbpair_return_to_app)))
|
||||
.setAutoCancel(true)
|
||||
is Stage.Failed -> builder
|
||||
.setContentTitle(getString(R.string.adbpair_title_failed))
|
||||
@@ -262,7 +254,6 @@ class WirelessAdbPairingService : Service() {
|
||||
private const val ACTION_CODE = "com.droiddeck.launcher.action.WIRELESS_ADB_CODE"
|
||||
private const val ACTION_CANCEL = "com.droiddeck.launcher.action.WIRELESS_ADB_CANCEL"
|
||||
private const val KEY_CODE = "code"
|
||||
private const val EXTRA_ENABLE_LIMIT = "enable_limit"
|
||||
private const val TIMEOUT_MS = 5 * 60_000L
|
||||
|
||||
private val current = MutableStateFlow<Stage>(Stage.Idle)
|
||||
@@ -270,10 +261,10 @@ class WirelessAdbPairingService : Service() {
|
||||
|
||||
private fun publish(stage: Stage) { current.value = stage }
|
||||
|
||||
fun start(context: Context, enableLimit: Boolean = false) {
|
||||
fun start(context: Context) {
|
||||
context.getSystemService(NotificationManager::class.java)?.cancel(NOTIFICATION_ID)
|
||||
publish(Stage.Waiting)
|
||||
val intent = Intent(context, WirelessAdbPairingService::class.java).putExtra(EXTRA_ENABLE_LIMIT, enableLimit)
|
||||
val intent = Intent(context, WirelessAdbPairingService::class.java)
|
||||
if (Build.VERSION.SDK_INT >= 26) context.startForegroundService(intent) else context.startService(intent)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.droiddeck.launcher.runtime
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.StatFs
|
||||
import android.system.Os
|
||||
import android.util.Log
|
||||
import androidx.annotation.StringRes
|
||||
import com.droiddeck.launcher.R
|
||||
@@ -116,7 +115,6 @@ object AppImageManager {
|
||||
|
||||
private fun extract(context: Context, dir: File, file: File, onProgress: (String) -> Unit): String? {
|
||||
val image = File(dir, "image.AppImage")
|
||||
val links = File(dir, ".links").apply { mkdirs() }
|
||||
try {
|
||||
dir.mkdirs()
|
||||
onProgress(context.getString(R.string.user_apps_copying, file.name))
|
||||
@@ -131,30 +129,15 @@ object AppImageManager {
|
||||
"cd \"$1\" && rm -rf squashfs-root AppDir && { $unpack; } >/dev/null && " +
|
||||
"rm -rf app && mv \"$(readlink -f squashfs-root)\" app && rm -f squashfs-root",
|
||||
"extract", "$GUEST_DIR/${dir.name}",
|
||||
), logName = "appimage-import", linkDir = links) { line -> if (out.length < 2000) out.appendLine(line) }
|
||||
), logName = "appimage-import") { line -> if (out.length < 2000) out.appendLine(line) }
|
||||
if (status != 0 || !File(dir, "app").isDirectory) {
|
||||
listOf("squashfs-root", "AppDir").forEach { FileUtils.delete(File(dir, it)) }
|
||||
return out.lines().lastOrNull { it.isNotBlank() }?.let { context.getString(R.string.appimg_extract_failed_detail, it) }
|
||||
?: context.getString(R.string.appimg_extract_failed)
|
||||
}
|
||||
copyLinkedFiles(File(dir, "app"), links)
|
||||
return null
|
||||
} finally {
|
||||
image.delete()
|
||||
FileUtils.delete(links)
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyLinkedFiles(app: File, links: File) {
|
||||
val roots = setOf(links.path + "/", links.canonicalPath + "/")
|
||||
app.walkTopDown().onEnter { !Files.isLink(it) }.forEach { f ->
|
||||
if (!Files.isLink(f)) return@forEach
|
||||
val target = runCatching { Os.readlink(f.path) }.getOrNull() ?: return@forEach
|
||||
if (roots.none { target.startsWith(it) }) return@forEach
|
||||
val data = f.toPath().toRealPath()
|
||||
java.nio.file.Files.delete(f.toPath())
|
||||
java.nio.file.Files.copy(data, f.toPath())
|
||||
if (java.nio.file.Files.isExecutable(data)) f.setExecutable(true, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -397,7 +397,7 @@ object BwrapSpawner {
|
||||
|
||||
/**
|
||||
* The sandbox started by the runtime's own glibc loader with the native hook, which maps the
|
||||
* sandbox's mounts; null when the runtime cannot load the hook (older glibc), so proot runs it.
|
||||
* sandbox's mounts; null when the runtime cannot load the hook (older glibc).
|
||||
*/
|
||||
private fun nativeLaunch(context: Context, plan: Plan): Pair<List<String>, Map<String, String>>? {
|
||||
val rootfs = LinuxRuntime.rootDir(context)
|
||||
@@ -415,15 +415,15 @@ object BwrapSpawner {
|
||||
val need = glibcMinor(hook, GLIBC_NEED) { it.maxOrNull() } ?: return null
|
||||
val have = glibcMinor(libc, GLIBC_RELEASE) { it.firstOrNull() } ?: return null
|
||||
if (have < need) {
|
||||
Log.i(TAG, "native userland: this runtime's glibc 2.$have cannot load the hook (2.$need); proot runs the sandbox")
|
||||
Log.i(TAG, "native userland: this runtime's glibc 2.$have cannot load the hook (2.$need)")
|
||||
return null
|
||||
}
|
||||
for (file in listOf(loader, libc)) {
|
||||
val key = "${file.path}:${file.length()}:${file.lastModified()}"
|
||||
if (key in seccompPatched) continue
|
||||
// an unpatched loader or libc dies under Android's filter before the hook loads: proot runs it
|
||||
// an unpatched loader or libc dies under Android's filter before the hook loads
|
||||
val patched = runCatching { ElfSeccompPatch.patchFile(file) }
|
||||
.onFailure { Log.e(TAG, "native userland: could not patch $file for Android's seccomp filter; proot runs the sandbox", it) }
|
||||
.onFailure { Log.e(TAG, "native userland: could not patch $file for Android's seccomp filter", it) }
|
||||
if (patched.isFailure) return null
|
||||
seccompPatched.add("${file.path}:${file.length()}:${file.lastModified()}")
|
||||
}
|
||||
@@ -496,7 +496,7 @@ object BwrapSpawner {
|
||||
* The kernel follows paths the hook does not see (ld.so, symbolic links), so each top-level
|
||||
* mount of the sandbox is also a link to its source in the sandbox's own root, and the
|
||||
* sandbox's links with absolute guest targets are made relative, which reaches them through those.
|
||||
* False when a mount's place could not be made; proot then runs the sandbox, whose mounts hide
|
||||
* False when a mount's place could not be made. The mount normally hides
|
||||
* whatever was left at their places.
|
||||
*/
|
||||
private fun linkMounts(plan: Plan): Boolean {
|
||||
@@ -524,7 +524,7 @@ object BwrapSpawner {
|
||||
}
|
||||
}
|
||||
} catch (e: java.io.IOException) {
|
||||
Log.e(TAG, "native userland: could not make a place for ${bind.guest}; proot runs the sandbox", e)
|
||||
Log.e(TAG, "native userland: could not make a place for ${bind.guest}", e)
|
||||
return false
|
||||
} ?: continue
|
||||
val path = at.toPath()
|
||||
@@ -558,38 +558,12 @@ object BwrapSpawner {
|
||||
return f
|
||||
}
|
||||
|
||||
internal fun prootEnvironment(plan: Plan, startsThroughEnvTool: Boolean): Map<String, String> =
|
||||
if (startsThroughEnvTool) emptyMap() else plan.env - "LD_PRELOAD"
|
||||
|
||||
private fun run(context: Context, plan: Plan, client: LocalSocket, out: DataOutputStream, id: Int) {
|
||||
val verbose = plan.env["DROIDDECK_PROOT_VERBOSE"]?.toIntOrNull()
|
||||
val native = if (NativeGuest.forSession(context)) nativeLaunch(context, plan) else null
|
||||
val builder = if (native != null) {
|
||||
ProcessBuilder(native.first).redirectErrorStream(true)
|
||||
.directory(File(hostPath(plan.binds, plan.root.path, plan.cwd)).takeIf { it.isDirectory } ?: plan.root)
|
||||
.also { b -> b.environment().apply { clear(); putAll(native.second) } }
|
||||
} else {
|
||||
val cmd = LinuxRuntime.prootPrefix(context, plan.root, plan.cwd)
|
||||
if (verbose != null) { cmd.add("-v"); cmd.add(verbose.toString()) }
|
||||
plan.binds.forEach { cmd.add("-b"); cmd.add(it.spec) }
|
||||
val envTool = hasEnvTool(plan)
|
||||
if (envTool) {
|
||||
cmd.add(plan.envTool)
|
||||
cmd.add("-i")
|
||||
plan.env.forEach { (k, v) -> cmd.add("$k=$v") }
|
||||
}
|
||||
cmd.addAll(plan.argv)
|
||||
ProcessBuilder(cmd).redirectErrorStream(true).directory(plan.root).also { b ->
|
||||
b.environment().apply {
|
||||
clear()
|
||||
putAll(prootEnvironment(plan, envTool))
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
|
||||
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
val (command, environment) = nativeLaunch(context, plan)
|
||||
?: throw IOException("The sandbox does not have a compatible native runtime")
|
||||
val builder = ProcessBuilder(command).redirectErrorStream(true)
|
||||
.directory(File(hostPath(plan.binds, plan.root.path, plan.cwd)).takeIf { it.isDirectory } ?: plan.root)
|
||||
.also { b -> b.environment().apply { clear(); putAll(environment) } }
|
||||
val process = builder.start()
|
||||
val pid = HostProcess.pidOf(process)
|
||||
com.droiddeck.launcher.session.OrphanReaper.keep(pid)
|
||||
@@ -617,8 +591,8 @@ object BwrapSpawner {
|
||||
while (true) {
|
||||
val n = try { stream.read(buffer) } catch (e: IOException) { -1 }
|
||||
if (n < 0) break
|
||||
if (logged < 4096 || verbose != null) {
|
||||
String(buffer, 0, if (verbose != null) n else minOf(n, 4096 - logged)).lines().filter { it.isNotBlank() }
|
||||
if (logged < 4096) {
|
||||
String(buffer, 0, minOf(n, 4096 - logged)).lines().filter { it.isNotBlank() }
|
||||
.forEach { Log.i(TAG, "sandbox $id: $it") }
|
||||
logged += n
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ object CurseForgeApp {
|
||||
}
|
||||
|
||||
internal var guest: (Context, List<String>, AtomicBoolean?, (String) -> Unit) -> Int = { context, argv, cancelled, onLine ->
|
||||
GuestCommand.run(context, argv, logName = "curseforge", extraBinds = BattleNetInstall.binds(context), fastPath = true,
|
||||
GuestCommand.run(context, argv, logName = "curseforge", extraBinds = BattleNetInstall.binds(context),
|
||||
cancelled = cancelled, redact = INSPECTOR, onLine = onLine)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ import java.nio.ByteOrder
|
||||
* dynamic linker makes the first two before any preloaded library (so before the hook's SIGSYS
|
||||
* handler) exists, so the call sites in the rootfs's ld.so and libc answer by themselves instead: the
|
||||
* `svc` after `mov x8, #nr` becomes a no-op for set_robust_list (glibc ignores the result) and
|
||||
* `mov x0, #-ENOSYS` for rseq and clone3 (glibc falls back from both). Under proot the same
|
||||
* answers are what proot gives.
|
||||
* `mov x0, #-ENOSYS` for rseq and clone3 (glibc falls back from both).
|
||||
*/
|
||||
object ElfSeccompPatch {
|
||||
private const val SVC = 0xd4000001.toInt()
|
||||
@@ -38,6 +37,11 @@ object ElfSeccompPatch {
|
||||
val end = minOf(data.size, buffer.getLong(at + 8).toInt() + buffer.getLong(at + 32).toInt()) and 3.inv()
|
||||
var pos = start
|
||||
while (pos + 4 <= end) {
|
||||
if (patchTermiosRequest(buffer, pos, end)) {
|
||||
patched++
|
||||
pos += 4
|
||||
continue
|
||||
}
|
||||
val replacement = when (buffer.getInt(pos)) {
|
||||
MOV_X8_SET_ROBUST_LIST -> NOP
|
||||
MOV_X8_CLONE3, MOV_X8_RSEQ -> MOV_X0_ENOSYS
|
||||
@@ -65,6 +69,40 @@ object ElfSeccompPatch {
|
||||
return patched
|
||||
}
|
||||
|
||||
/**
|
||||
* glibc 2.42 and later read and set a terminal with TCGETS2 and TCSETS2/W2/F2, which Android's
|
||||
* SELinux policy refuses on an app's pseudo-terminal slaves (EACCES): isatty() was false in every
|
||||
* Konsole, ssh and tmux session, so bash had no prompt or job control and stdout was not line
|
||||
* buffered. TCGETS and TCSETS* carry the same struct without its two speed fields, which glibc
|
||||
* then takes from c_cflag. A site is `movz xN, #lo` then `movk xN, #hi, lsl #16`; the movz gets
|
||||
* the old request and the movk becomes a no-op.
|
||||
*/
|
||||
private fun patchTermiosRequest(buffer: ByteBuffer, pos: Int, end: Int): Boolean {
|
||||
val movz = buffer.getInt(pos)
|
||||
if ((movz and 0x7fe00000) != 0x52800000) return false
|
||||
val low = (movz ushr 5) and 0xffff
|
||||
if (low !in 0x542a..0x542d) return false
|
||||
val register = movz and 0x1f
|
||||
var next = pos + 4
|
||||
while (next < minOf(end, pos + 4 + 4 * 4)) {
|
||||
val movk = buffer.getInt(next)
|
||||
if ((movk and 0x7fe00000) == 0x72a00000 && (movk and 0x1f) == register) {
|
||||
val request = when ((movk ushr 5) and 0xffff) {
|
||||
0x802c -> if (low == 0x542a) 0x5401 else return false
|
||||
0x402c -> if (low != 0x542a) 0x5402 + (low - 0x542b) else return false
|
||||
else -> return false
|
||||
}
|
||||
buffer.putInt(pos, (movz and 0x1f.inv() and (0xffff shl 5).inv()) or (request shl 5) or register)
|
||||
buffer.putInt(next, NOP)
|
||||
return true
|
||||
}
|
||||
// Anything between that might read or write the register would see the old low half
|
||||
if (intArrayOf(0, 5, 10, 16).any { (movk ushr it) and 0x1f == register }) return false
|
||||
next += 4
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/** Patches the file behind [path] (symlinks followed) if it still has unpatched call sites. */
|
||||
fun patchFile(path: File): Int {
|
||||
val target = path.canonicalFile
|
||||
|
||||
@@ -79,9 +79,9 @@ object FlatpakManager {
|
||||
?.maxByOrNull { it.first }?.second
|
||||
}
|
||||
|
||||
private fun runGuest(context: Context, argv: List<String>, fakeRoot: Boolean, onLine: (String) -> Unit): Int {
|
||||
private fun runGuest(context: Context, argv: List<String>, onLine: (String) -> Unit): Int {
|
||||
val name = "flatpak-" + (argv.getOrNull(2)?.takeIf { argv.getOrNull(1) == HELPER } ?: "setup")
|
||||
return GuestCommand.run(context, argv, fakeRoot, name, onLine = onLine)
|
||||
return GuestCommand.run(context, argv, name, onLine = onLine)
|
||||
}
|
||||
|
||||
private inline fun <T> exclusive(what: String, ifBusy: () -> T, block: () -> T): T {
|
||||
@@ -96,7 +96,7 @@ object FlatpakManager {
|
||||
if (!LinuxRuntime.isInstalled(context)) return context.getString(R.string.user_apps_runtime_required)
|
||||
return exclusive("setup", { context.getString(R.string.flatpakmgr_busy) }) {
|
||||
var failure: String? = null
|
||||
val status = runGuest(context, listOf("/bin/bash", SETUP), fakeRoot = true) { line ->
|
||||
val status = runGuest(context, listOf("/bin/bash", SETUP)) { line ->
|
||||
Log.i(TAG, "setup: $line")
|
||||
when {
|
||||
line.startsWith("== STEP ") -> onProgress(line.removePrefix("== STEP "), -1)
|
||||
@@ -120,7 +120,7 @@ object FlatpakManager {
|
||||
var error: String? = null
|
||||
var step = context.getString(R.string.flatpakmgr_starting)
|
||||
val argv = listOfNotNull("/usr/bin/python3", HELPER, verb, id)
|
||||
val status = runGuest(context, argv, fakeRoot = false) { line ->
|
||||
val status = runGuest(context, argv) { line ->
|
||||
val o = runCatching { JSONObject(line) }.getOrNull()
|
||||
if (o == null) { Log.i(TAG, "$verb: $line"); return@runGuest }
|
||||
when (o.optString("e")) {
|
||||
@@ -195,7 +195,7 @@ object FlatpakManager {
|
||||
if (!ready(context)) return emptySet()
|
||||
var apps: Set<String>? = null
|
||||
exclusive("updates", {}) {
|
||||
runGuest(context, listOf("/usr/bin/python3", HELPER, "updates"), fakeRoot = false) { line ->
|
||||
runGuest(context, listOf("/usr/bin/python3", HELPER, "updates")) { line ->
|
||||
val o = runCatching { JSONObject(line) }.getOrNull() ?: return@runGuest
|
||||
if (o.optString("e") == "updates") {
|
||||
val a = o.optJSONArray("apps")
|
||||
|
||||
@@ -6,13 +6,12 @@ import com.droiddeck.launcher.core.HostProcess
|
||||
import com.droiddeck.launcher.session.OrphanReaper
|
||||
import com.droiddeck.launcher.session.SessionFiles
|
||||
import com.droiddeck.launcher.session.SessionPaths
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
object GuestCommand {
|
||||
fun run(context: Context, argv: List<String>, fakeRoot: Boolean = false, logName: String? = null,
|
||||
linkDir: File? = null, extraBinds: List<String>? = null, fastPath: Boolean = false, cancelled: AtomicBoolean? = null,
|
||||
fun run(context: Context, argv: List<String>, logName: String? = null,
|
||||
extraBinds: List<String>? = null, cancelled: AtomicBoolean? = null,
|
||||
redact: Regex? = null, onLine: (String) -> Unit): Int {
|
||||
val log = logName?.let {
|
||||
try {
|
||||
@@ -21,7 +20,7 @@ object GuestCommand {
|
||||
}
|
||||
log?.println("== ${java.util.Date()} ${redacted(argv.joinToString(" "), redact)}")
|
||||
try {
|
||||
return runLogged(context, argv, fakeRoot, linkDir, extraBinds, fastPath, cancelled) { line -> log?.println(redacted(line, redact)); log?.flush(); onLine(line) }
|
||||
return runLogged(context, argv, extraBinds, cancelled) { line -> log?.println(redacted(line, redact)); log?.flush(); onLine(line) }
|
||||
} finally {
|
||||
log?.close()
|
||||
}
|
||||
@@ -29,16 +28,14 @@ object GuestCommand {
|
||||
|
||||
internal fun redacted(text: String, redact: Regex?): String = redact?.replace(text, "<redacted>") ?: text
|
||||
|
||||
private fun runLogged(context: Context, argv: List<String>, fakeRoot: Boolean, linkDir: File?, extraBinds: List<String>?,
|
||||
fastPath: Boolean, cancelled: AtomicBoolean?, onLine: (String) -> Unit): Int {
|
||||
private fun runLogged(context: Context, argv: List<String>, extraBinds: List<String>?,
|
||||
cancelled: AtomicBoolean?, onLine: (String) -> Unit): Int {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
LinuxRuntime.writeAccounts(context)
|
||||
SessionFiles.stage(context, root)
|
||||
LinuxNetworkLinkComponent(context, root).publish()
|
||||
val runtimeDir = File(context.filesDir, ".flatpak-rt").apply { mkdirs() }
|
||||
val binds = LinuxRuntime.binds(context, null, runtimeDir, LinuxRuntime.sharedStorage(context), extraBinds)
|
||||
val native = NativeGuest.forSession(context)
|
||||
val fastPathKey = if (!native && fastPath && !fakeRoot && linkDir == null && ProotFastPath.enabled(context)) ProotFastPath.key(root, binds) else null
|
||||
val guest = mutableListOf(
|
||||
"/usr/bin/env", "-i", "HOME=/root", "USER=root", "LANG=C.UTF-8",
|
||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games", "XDG_RUNTIME_DIR=${LinuxRuntime.GUEST_RUNTIME_DIR}",
|
||||
@@ -53,26 +50,8 @@ object GuestCommand {
|
||||
"no_proxy=localhost,127.0.0.1,::1", "NO_PROXY=localhost,127.0.0.1,::1",
|
||||
)
|
||||
}
|
||||
fastPathKey?.let { guest += ProotFastPath.guestEnv(root, binds, it) }
|
||||
guest += argv
|
||||
val builder = if (native) {
|
||||
NativeGuest.processBuilder(context, root, binds, guest).redirectErrorStream(true)
|
||||
} else {
|
||||
val cmd = LinuxRuntime.prootPrefix(context, root, "/root", fakeRoot)
|
||||
if (linkDir != null) cmd.add("--link2symlink")
|
||||
binds.forEach { cmd.add("-b"); cmd.add(it) }
|
||||
cmd += guest
|
||||
ProcessBuilder(cmd).directory(root).redirectErrorStream(true).also { b ->
|
||||
b.environment().apply {
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
|
||||
if (linkDir != null) put("PROOT_L2S_DIR", linkDir.path)
|
||||
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
|
||||
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (k, v) -> put(k, v) } }
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
val builder = NativeGuest.processBuilder(context, root, binds, guest).redirectErrorStream(true)
|
||||
if (cancelled?.get() == true) return 130
|
||||
val process = builder.start()
|
||||
val pid = HostProcess.pidOf(process)
|
||||
|
||||
@@ -0,0 +1,886 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.app.Service
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.ServiceConnection
|
||||
import android.net.LocalServerSocket
|
||||
import android.net.LocalSocket
|
||||
import android.os.Binder
|
||||
import android.os.Handler
|
||||
import android.os.IBinder
|
||||
import android.os.Looper
|
||||
import android.os.Parcel
|
||||
import android.os.ParcelFileDescriptor
|
||||
import android.os.Process
|
||||
import android.system.ErrnoException
|
||||
import android.system.Os
|
||||
import android.system.OsConstants
|
||||
import android.system.StructPollfd
|
||||
import android.util.Log
|
||||
import org.json.JSONObject
|
||||
import java.io.DataInputStream
|
||||
import java.io.File
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* A guest program run as the main process of its own Android process.
|
||||
*
|
||||
* Android counts the processes in an app process's cgroup against its child-process limit, but not
|
||||
* the app processes themselves. The worker execs the program in place; its binder fd stays open
|
||||
* across the exec, so the system keeps the process as a live service process. The program's own
|
||||
* children are still counted. See docs/phantom-processes.md.
|
||||
*/
|
||||
open class GuestWorker : Service() {
|
||||
private val binder = object : Binder() {
|
||||
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean {
|
||||
if (code != RUN) return super.onTransact(code, data, reply, flags)
|
||||
val argv = data.createStringArray() ?: return false
|
||||
val env = data.createStringArray() ?: return false
|
||||
val fds = List(data.readInt()) { data.readFileDescriptor() }
|
||||
val targets = data.createIntArray() ?: IntArray(fds.size) { it }
|
||||
val fillBinderFd = data.readInt() != 0
|
||||
val go = data.readFileDescriptor()
|
||||
val nice = data.readInt()
|
||||
reply?.writeInt(Process.myPid())
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
// The app writes a byte once it has the reply and has taken the launch on: an exec
|
||||
// before then would end this process with the reply undelivered, and with none (the
|
||||
// app gave up and starts the program another way) the program must not run here.
|
||||
var why = ""
|
||||
// poll() with a timeout counts as network I/O to StrictMode on the main thread
|
||||
android.os.StrictMode.setThreadPolicy(android.os.StrictMode.ThreadPolicy.LAX)
|
||||
val committed = runCatching {
|
||||
fun byte(timeout: Int): Int {
|
||||
val poll = StructPollfd().apply { fd = go.fileDescriptor; events = OsConstants.POLLIN.toShort() }
|
||||
val ready = Os.poll(arrayOf(poll), timeout)
|
||||
return (if (ready > 0) Os.read(go.fileDescriptor, ByteArray(1), 0, 1) else -1)
|
||||
.also { why = "poll $ready revents ${poll.revents} read $it" }
|
||||
}
|
||||
// The commit, an answer, and the app's word that it has the answer: the app may
|
||||
// have stopped waiting for it (and started the program another way) meanwhile.
|
||||
// That last word comes, or the app closes its end (a byte or EOF): no timeout,
|
||||
// which could drop a launch the app has already reported as started.
|
||||
byte(GO_TIMEOUT_MS) == 1 && Os.write(go.fileDescriptor, byteArrayOf(1), 0, 1) == 1 && byte(-1) == 1
|
||||
}.getOrElse { why = it.toString(); false }
|
||||
go.close()
|
||||
if (committed) exec(argv, env, fds, targets, fillBinderFd, nice)
|
||||
else {
|
||||
Log.w(TAG, "launch not committed ($why): not running ${argv.firstOrNull()}")
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent): IBinder = binder
|
||||
|
||||
private fun exec(argv: Array<String>, env: Array<String>, fds: List<ParcelFileDescriptor?>, targets: IntArray, fillBinderFd: Boolean,
|
||||
nice: Int) {
|
||||
try {
|
||||
val top = targets.maxOrNull() ?: 2
|
||||
val (binderTop, binderFd) = keepBinderOpen(maxOf(BINDER_FDS, top + 1))
|
||||
// Out of the way first, so that placing one fd cannot overwrite another not yet placed.
|
||||
val above = maxOf(MOVED_FDS, top + 1, binderTop + 1)
|
||||
val moved = fds.map { pfd -> pfd?.let { Os.fcntlInt(it.fileDescriptor, OsConstants.F_DUPFD, above) } }
|
||||
moved.forEachIndexed { i, fd ->
|
||||
if (fd == null || i >= targets.size) return@forEachIndexed
|
||||
val source = ParcelFileDescriptor.adoptFd(fd).also { kept.add(it) }.fileDescriptor
|
||||
Os.dup2(source, targets[i])
|
||||
Os.fcntlInt(source, OsConstants.F_SETFD, OsConstants.FD_CLOEXEC)
|
||||
}
|
||||
// A session of its own: in zygote's process group, a program signalling its group
|
||||
// (kill(0, sig)) would reach every process of the app.
|
||||
runCatching { Os.setsid() }
|
||||
// The native hook closes the binder fds in every other process (hook/handoff.c). Only an
|
||||
// app launch asks for the number (a whole argument or variable value), never a guest's.
|
||||
val fill = { arg: String ->
|
||||
if (!fillBinderFd) arg
|
||||
else if (arg == BINDER_FD_TOKEN) binderFd.toString()
|
||||
else if (arg.endsWith("=$BINDER_FD_TOKEN")) arg.removeSuffix(BINDER_FD_TOKEN) + binderFd
|
||||
else arg
|
||||
}
|
||||
// This thread blocks SIGQUIT, SIGUSR1 and SIGPIPE (Android's runtime), and an exec keeps
|
||||
// that: the program's hook sets DDH_SIGMASK instead (none blocked, unless the request says).
|
||||
val mask = if (env.any { it.startsWith("DDH_SIGMASK=") }) emptyList() else listOf("DDH_SIGMASK=0")
|
||||
// Android raised this thread to THREAD_PRIORITY_TOP_APP_BOOST (a service the top app binds with
|
||||
// BIND_IMPORTANT is scheduled as the top app); the program and its threads would keep it and
|
||||
// run ahead of the game. They get the asker's priority instead, as a forked child would.
|
||||
runCatching { Process.setThreadPriority(nice) }
|
||||
Os.execve(argv[0], argv.map(fill).toTypedArray(),
|
||||
env.filterNot { it.startsWith("DDH_WORKER_PID=") }.map(fill).toTypedArray() + mask +
|
||||
"DDH_WORKER_PID=${Process.myPid()}")
|
||||
} catch (e: ErrnoException) {
|
||||
Log.e(TAG, "could not exec ${argv.firstOrNull()}", e)
|
||||
}
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
|
||||
/**
|
||||
* Binder fds stay open across the exec, at [from] or above, where no fd of the program goes.
|
||||
* Returns the highest fd used and the one on /dev/binder, whose closing Android takes for
|
||||
* the death of this process.
|
||||
*/
|
||||
private fun keepBinderOpen(from: Int): Pair<Int, Int> {
|
||||
var highest = from - 1
|
||||
var binder = -1
|
||||
File("/proc/self/fd").listFiles()?.forEach { link ->
|
||||
val target = runCatching { Os.readlink(link.path) }.getOrNull() ?: return@forEach
|
||||
if (target !in BINDER_DEVICES && !target.startsWith("/dev/binderfs/")) return@forEach
|
||||
// A copy, not adoptFd(): some of these fds are owned (fdsan) by a ParcelFileDescriptor.
|
||||
val copy = runCatching { ParcelFileDescriptor.fromFd(link.name.toIntOrNull() ?: return@forEach) }.getOrNull()
|
||||
?: return@forEach
|
||||
val kept = Os.fcntlInt(copy.fileDescriptor, OsConstants.F_DUPFD, from)
|
||||
highest = maxOf(highest, kept)
|
||||
if (target.substringAfterLast('/') == "binder") binder = kept
|
||||
copy.close()
|
||||
}
|
||||
return highest to binder
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val RUN = IBinder.FIRST_CALL_TRANSACTION
|
||||
/** An argument, or a variable's whole value, in an app launch: replaced by the number of its kept binder fd. */
|
||||
const val BINDER_FD_TOKEN = "@DDH_WORKER_BINDER_FD@"
|
||||
// Longer than the app may wait for the hook's "go" (GuestWorkers.ACK_TIMEOUT_MS) before it commits
|
||||
private const val GO_TIMEOUT_MS = 15000
|
||||
private val BINDER_DEVICES = setOf("/dev/binder", "/dev/hwbinder", "/dev/vndbinder")
|
||||
private const val BINDER_FDS = 900
|
||||
private const val MOVED_FDS = 1200
|
||||
private const val TAG = "GuestWorker"
|
||||
private val kept = ArrayList<ParcelFileDescriptor>()
|
||||
|
||||
fun isWorkerProcess(context: Context, process: String?): Boolean =
|
||||
process != null && process.startsWith(context.packageName + ":g") &&
|
||||
process.substring(context.packageName.length + 2).all { it.isDigit() }
|
||||
}
|
||||
}
|
||||
|
||||
class GuestWorker0 : GuestWorker()
|
||||
class GuestWorker1 : GuestWorker()
|
||||
class GuestWorker2 : GuestWorker()
|
||||
class GuestWorker3 : GuestWorker()
|
||||
class GuestWorker4 : GuestWorker()
|
||||
class GuestWorker5 : GuestWorker()
|
||||
class GuestWorker6 : GuestWorker()
|
||||
class GuestWorker7 : GuestWorker()
|
||||
class GuestWorker8 : GuestWorker()
|
||||
class GuestWorker9 : GuestWorker()
|
||||
class GuestWorker10 : GuestWorker()
|
||||
class GuestWorker11 : GuestWorker()
|
||||
class GuestWorker12 : GuestWorker()
|
||||
class GuestWorker13 : GuestWorker()
|
||||
class GuestWorker14 : GuestWorker()
|
||||
class GuestWorker15 : GuestWorker()
|
||||
class GuestWorker16 : GuestWorker()
|
||||
class GuestWorker17 : GuestWorker()
|
||||
class GuestWorker18 : GuestWorker()
|
||||
class GuestWorker19 : GuestWorker()
|
||||
class GuestWorker20 : GuestWorker()
|
||||
class GuestWorker21 : GuestWorker()
|
||||
class GuestWorker22 : GuestWorker()
|
||||
class GuestWorker23 : GuestWorker()
|
||||
class GuestWorker24 : GuestWorker()
|
||||
class GuestWorker25 : GuestWorker()
|
||||
class GuestWorker26 : GuestWorker()
|
||||
class GuestWorker27 : GuestWorker()
|
||||
class GuestWorker28 : GuestWorker()
|
||||
class GuestWorker29 : GuestWorker()
|
||||
class GuestWorker30 : GuestWorker()
|
||||
class GuestWorker31 : GuestWorker()
|
||||
class GuestWorker32 : GuestWorker()
|
||||
class GuestWorker33 : GuestWorker()
|
||||
class GuestWorker34 : GuestWorker()
|
||||
class GuestWorker35 : GuestWorker()
|
||||
class GuestWorker36 : GuestWorker()
|
||||
class GuestWorker37 : GuestWorker()
|
||||
class GuestWorker38 : GuestWorker()
|
||||
class GuestWorker39 : GuestWorker()
|
||||
class GuestWorker40 : GuestWorker()
|
||||
class GuestWorker41 : GuestWorker()
|
||||
class GuestWorker42 : GuestWorker()
|
||||
class GuestWorker43 : GuestWorker()
|
||||
class GuestWorker44 : GuestWorker()
|
||||
class GuestWorker45 : GuestWorker()
|
||||
class GuestWorker46 : GuestWorker()
|
||||
class GuestWorker47 : GuestWorker()
|
||||
class GuestWorker48 : GuestWorker()
|
||||
class GuestWorker49 : GuestWorker()
|
||||
class GuestWorker50 : GuestWorker()
|
||||
class GuestWorker51 : GuestWorker()
|
||||
class GuestWorker52 : GuestWorker()
|
||||
class GuestWorker53 : GuestWorker()
|
||||
class GuestWorker54 : GuestWorker()
|
||||
class GuestWorker55 : GuestWorker()
|
||||
class GuestWorker56 : GuestWorker()
|
||||
class GuestWorker57 : GuestWorker()
|
||||
class GuestWorker58 : GuestWorker()
|
||||
class GuestWorker59 : GuestWorker()
|
||||
class GuestWorker60 : GuestWorker()
|
||||
class GuestWorker61 : GuestWorker()
|
||||
class GuestWorker62 : GuestWorker()
|
||||
class GuestWorker63 : GuestWorker()
|
||||
|
||||
/** The pool of [GuestWorker] processes, and the socket guests ask it through (`droiddeck-spawn`). */
|
||||
object GuestWorkers {
|
||||
private const val TAG = "GuestWorkers"
|
||||
private val classes: List<Class<out GuestWorker>> = listOf(
|
||||
GuestWorker0::class.java, GuestWorker1::class.java, GuestWorker2::class.java,
|
||||
GuestWorker3::class.java, GuestWorker4::class.java, GuestWorker5::class.java,
|
||||
GuestWorker6::class.java, GuestWorker7::class.java, GuestWorker8::class.java,
|
||||
GuestWorker9::class.java, GuestWorker10::class.java, GuestWorker11::class.java,
|
||||
GuestWorker12::class.java, GuestWorker13::class.java, GuestWorker14::class.java,
|
||||
GuestWorker15::class.java, GuestWorker16::class.java, GuestWorker17::class.java,
|
||||
GuestWorker18::class.java, GuestWorker19::class.java, GuestWorker20::class.java,
|
||||
GuestWorker21::class.java, GuestWorker22::class.java, GuestWorker23::class.java,
|
||||
GuestWorker24::class.java, GuestWorker25::class.java, GuestWorker26::class.java,
|
||||
GuestWorker27::class.java, GuestWorker28::class.java, GuestWorker29::class.java,
|
||||
GuestWorker30::class.java, GuestWorker31::class.java, GuestWorker32::class.java,
|
||||
GuestWorker33::class.java, GuestWorker34::class.java, GuestWorker35::class.java,
|
||||
GuestWorker36::class.java, GuestWorker37::class.java, GuestWorker38::class.java,
|
||||
GuestWorker39::class.java, GuestWorker40::class.java, GuestWorker41::class.java,
|
||||
GuestWorker42::class.java, GuestWorker43::class.java, GuestWorker44::class.java,
|
||||
GuestWorker45::class.java, GuestWorker46::class.java, GuestWorker47::class.java,
|
||||
GuestWorker48::class.java, GuestWorker49::class.java, GuestWorker50::class.java,
|
||||
GuestWorker51::class.java, GuestWorker52::class.java, GuestWorker53::class.java,
|
||||
GuestWorker54::class.java, GuestWorker55::class.java, GuestWorker56::class.java,
|
||||
GuestWorker57::class.java, GuestWorker58::class.java, GuestWorker59::class.java,
|
||||
GuestWorker60::class.java, GuestWorker61::class.java, GuestWorker62::class.java,
|
||||
GuestWorker63::class.java,
|
||||
)
|
||||
|
||||
private class Slot(val index: Int) {
|
||||
lateinit var connection: ServiceConnection
|
||||
val connected = CountDownLatch(1)
|
||||
@Volatile var service: IBinder? = null
|
||||
@Volatile var pid = -1
|
||||
@Volatile var guest = false
|
||||
/** The session it runs a program for ([serve]'s number). */
|
||||
@Volatile var session = 0
|
||||
@Volatile var onExit: ((Int) -> Unit)? = null
|
||||
/** The priority it runs its program at: the asker's (a guest, or the app thread that started it). */
|
||||
@Volatile var nice = 0
|
||||
/** Set once its program was handed over: only then does its end count as the program's. */
|
||||
@Volatile var started = false
|
||||
/** Between the pid and the last word of a launch (under the slots lock): its end is held back. */
|
||||
var launching = false
|
||||
/** It ended while launching: reported once the launch turns out to have run, never otherwise. */
|
||||
var endedLaunching = false
|
||||
}
|
||||
|
||||
private val slots = arrayOfNulls<Slot>(classes.size)
|
||||
// Workers bound ahead of need while a session runs: a zygote fork and the bind take about
|
||||
// 60-100 ms, which every program the session starts would otherwise wait for.
|
||||
private val warm = ArrayDeque<Slot>()
|
||||
@Volatile private var warmTarget = 0
|
||||
// Numbers the sessions: an old session's teardown can still be running when the next one starts.
|
||||
@Volatile private var session = 0
|
||||
// The latest session whose teardown has begun
|
||||
@Volatile private var stopped = 0
|
||||
// Held for a launch's last word and for marking a session stopped
|
||||
private val authorizing = Any()
|
||||
private val warming = java.util.concurrent.atomic.AtomicBoolean(false)
|
||||
private const val WARM_WORKERS = 2
|
||||
// A game's start hands off a burst of programs (Wine's services, the agent's checks) within a few
|
||||
// seconds: bound ahead while the client starts it, not forked while the game draws its first frames.
|
||||
private const val LAUNCH_WORKERS = 16
|
||||
private const val LAUNCH_MS = 20_000L
|
||||
@Volatile private var launchUntil = 0L
|
||||
private val launches = java.util.concurrent.atomic.AtomicInteger()
|
||||
private const val ACK_TIMEOUT_MS = 5000
|
||||
private const val ANSWER_TIMEOUT_MS = 5000
|
||||
private const val RECEIVE_TIMEOUT_MS = 10000
|
||||
// argv and the environment of one exec, with room: Linux caps them at a quarter of the stack
|
||||
private const val MAX_REQUEST_BYTES = 8 shl 20
|
||||
private const val MAX_RECEIVING = 32
|
||||
private val receiving = java.util.concurrent.atomic.AtomicInteger()
|
||||
private val connections = java.util.concurrent.Executors.newSingleThreadExecutor { Thread(it, "guest-worker-binder").apply { isDaemon = true } }
|
||||
@Volatile private var server: Thread? = null
|
||||
// Android sets a worker's main thread to THREAD_PRIORITY_TOP_APP_BOOST again each time the app returns to the top
|
||||
private const val TOP_APP_BOOST = -10
|
||||
private const val PRIORITY_CHECK_MS = 2000L
|
||||
@Volatile private var keeper: Thread? = null
|
||||
|
||||
/** The app, once [attach] or [serve] ran in its main process; null before. */
|
||||
@Volatile var context: Context? = null
|
||||
private set
|
||||
|
||||
/** Whether this Android version and runtime can hand off guest programs to workers. */
|
||||
fun enabled(context: Context): Boolean =
|
||||
android.os.Build.VERSION.SDK_INT >= 30 &&
|
||||
NativeGuest.enabled(context)
|
||||
|
||||
/** How the running session's root was started: in a worker (true) or counted (false); null with none running. */
|
||||
@Volatile var sessionRootUncounted: Boolean? = null
|
||||
|
||||
/** Whether pid is a program running in one of the workers. */
|
||||
fun runsInWorker(pid: Int): Boolean = pid > 0 && synchronized(slots) { slots.any { it != null && it.started && it.pid == pid } }
|
||||
|
||||
fun socketName(context: Context): String = "droiddeck-spawn." + context.packageName + "." + Process.myUid()
|
||||
|
||||
/**
|
||||
* Runs [argv] (a host command line) as the main process of a free worker with [env] and the
|
||||
* fds in [stdio] as its 0, 1 and 2. Returns its pid, or -1. Blocks: not for the main thread.
|
||||
* [onExit] runs once the process is gone.
|
||||
*/
|
||||
fun start(context: Context, argv: List<String>, env: List<String>, stdio: List<ParcelFileDescriptor>, onExit: (Int) -> Unit): Int =
|
||||
start(context, argv, env, stdio, IntArray(stdio.size) { it }, onExit)
|
||||
|
||||
/** As [start], with the fds in [fds] placed at the numbers in [targets]. */
|
||||
fun start(context: Context, argv: List<String>, env: List<String>, fds: List<ParcelFileDescriptor>, targets: IntArray,
|
||||
onExit: (Int) -> Unit): Int = start(context, argv, env, fds, targets, false, onExit)
|
||||
|
||||
/**
|
||||
* [guest]: one of the session's guest programs, which [guestPids] lists and [stopGuests] ends.
|
||||
* [commit] runs with the pid before the worker may run the program; false, and it does not.
|
||||
* [confirmed] runs once the worker has taken it on, just before it is told to run it; false, and it does not.
|
||||
* [owner]: the session asking (the one a guest's request names), else the latest.
|
||||
*/
|
||||
private fun start(context: Context, argv: List<String>, env: List<String>, fds: List<ParcelFileDescriptor>, targets: IntArray,
|
||||
guest: Boolean, onExit: (Int) -> Unit, commit: (Int) -> Boolean = { true },
|
||||
confirmed: () -> Boolean = { true }, owner: Int = session,
|
||||
nice: Int = Process.getThreadPriority(Process.myTid())): Int {
|
||||
val app = context.applicationContext
|
||||
if (guest && owner <= stopped) {
|
||||
Log.w(TAG, (if (owner == 0) "a request naming no session" else "session $owner is stopping") +
|
||||
": not starting ${argv.firstOrNull()}")
|
||||
return -1
|
||||
}
|
||||
val slot = takeWarm() ?: bind(app)?.takeIf { fresh ->
|
||||
fresh.connected.await(10, TimeUnit.SECONDS).also { if (!it) release(app, fresh) }
|
||||
} ?: run {
|
||||
Log.w(TAG, "no worker started for ${argv.firstOrNull()}")
|
||||
return -1
|
||||
}
|
||||
slot.guest = guest
|
||||
slot.session = owner
|
||||
slot.onExit = onExit
|
||||
slot.nice = nice
|
||||
// during a game's start the pool drains instead: its refill would fork while the game starts
|
||||
if (android.os.SystemClock.elapsedRealtime() >= launchUntil) refill(app)
|
||||
// The worker execs once a byte comes through this socket: after the reply has reached us, so
|
||||
// that its exec does not cut the reply off, and after the slot is marked started. Closed
|
||||
// without one, the worker ends without running the program (the caller starts it another way).
|
||||
// It answers with a byte of its own: without that it gave up waiting, and nothing runs.
|
||||
var go: Array<ParcelFileDescriptor>? = null
|
||||
var data: Parcel? = Parcel.obtain()
|
||||
val reply = Parcel.obtain()
|
||||
try {
|
||||
go = ParcelFileDescriptor.createSocketPair()
|
||||
data!!.writeStringArray(argv.toTypedArray())
|
||||
data.writeStringArray(env.toTypedArray())
|
||||
data.writeInt(fds.size)
|
||||
fds.forEach { data.writeFileDescriptor(it.fileDescriptor) }
|
||||
data.writeIntArray(targets)
|
||||
data.writeInt(if (guest) 0 else 1)
|
||||
data.writeFileDescriptor(go[0].fileDescriptor)
|
||||
data.writeInt(nice)
|
||||
slot.service!!.transact(GuestWorker.RUN, data, reply, 0)
|
||||
// The worker has its own copy: with ours closed (and the request's, which holds one too),
|
||||
// a worker that gave up leaves no reader
|
||||
data.recycle()
|
||||
data = null
|
||||
go[0].close()
|
||||
val pid = reply.readInt()
|
||||
// Once a session's teardown has begun (stopGuests), none of its programs may start: it
|
||||
// would not find them.
|
||||
val stopping = { guest && owner <= stopped }
|
||||
if (stopping() || !commit(pid)) {
|
||||
Log.w(TAG, "worker ${slot.index}: ${argv.firstOrNull()} was not taken on")
|
||||
release(app, slot)
|
||||
return -1
|
||||
}
|
||||
// launching, not started yet: an end before the last word is reported only if the launch ran
|
||||
val live = synchronized(slots) {
|
||||
(slots[slot.index] === slot && !stopping()).also { if (it) { slot.pid = pid; slot.launching = true } }
|
||||
}
|
||||
if (!live) {
|
||||
Log.w(TAG, "worker ${slot.index} ended, or its session is stopping, before running ${argv.firstOrNull()}")
|
||||
release(app, slot)
|
||||
return -1
|
||||
}
|
||||
Os.write(go[1].fileDescriptor, byteArrayOf(1), 0, 1)
|
||||
val answer = StructPollfd().apply { fd = go[1].fileDescriptor; events = OsConstants.POLLIN.toShort() }
|
||||
// then the word to run it: given only here, once its answer is in, so that a worker whose
|
||||
// answer came too late never runs a program this call reports as not started. [confirmed]
|
||||
// goes first: a caller that hears nothing runs the program itself, so it must have heard
|
||||
// before the worker may run it (an app dying in between loses the program, not doubles it).
|
||||
// The word and a teardown's start exclude each other: a launch is authorized before stopGuests()
|
||||
// marks the session stopped, and is then stopped with the pids it takes (guestPids lists a
|
||||
// launching slot), or never.
|
||||
val answered = Os.poll(arrayOf(answer), ANSWER_TIMEOUT_MS) > 0 && Os.read(go[1].fileDescriptor, ByteArray(1), 0, 1) == 1
|
||||
val accepted = answered && synchronized(authorizing) {
|
||||
!stopping() && confirmed() && Os.write(go[1].fileDescriptor, byteArrayOf(1), 0, 1) == 1
|
||||
}
|
||||
val endedRunning = synchronized(slots) {
|
||||
slot.launching = false
|
||||
if (accepted && !slot.endedLaunching) slot.started = true
|
||||
accepted && slot.endedLaunching
|
||||
}
|
||||
if (!accepted) {
|
||||
Log.w(TAG, "worker ${slot.index} did not take ${argv.firstOrNull()} on")
|
||||
release(app, slot)
|
||||
return -1
|
||||
}
|
||||
// it ran and was already gone by now: its end, once
|
||||
if (endedRunning) reportEnd(app, slot)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "worker ${slot.index} refused ${argv.firstOrNull()}", e)
|
||||
synchronized(slots) { slot.launching = false }
|
||||
release(app, slot)
|
||||
return -1
|
||||
} finally {
|
||||
data?.recycle()
|
||||
reply.recycle()
|
||||
go?.forEach { runCatching { it.close() } }
|
||||
}
|
||||
Log.i(TAG, "worker ${slot.index} (pid ${slot.pid}) runs ${argv.lastOrNull { !it.startsWith("-") }}")
|
||||
return slot.pid
|
||||
}
|
||||
|
||||
/** Binds a free worker; its [Slot.connected] opens once it is up. Null when all are in use. */
|
||||
private fun bind(app: Context): Slot? {
|
||||
val slot = synchronized(slots) {
|
||||
val index = slots.indexOfFirst { it == null }
|
||||
if (index < 0) {
|
||||
Log.w(TAG, "all ${slots.size} workers are busy")
|
||||
return null
|
||||
}
|
||||
Slot(index).also { slots[index] = it }
|
||||
}
|
||||
slot.connection = object : ServiceConnection {
|
||||
override fun onServiceConnected(name: ComponentName, binder: IBinder) {
|
||||
slot.service = binder
|
||||
slot.connected.countDown()
|
||||
}
|
||||
|
||||
override fun onServiceDisconnected(name: ComponentName) = release(app, slot)
|
||||
|
||||
override fun onBindingDied(name: ComponentName) = release(app, slot)
|
||||
}
|
||||
// Callbacks off the main thread: start() waits for onServiceConnected, and a caller holding a
|
||||
// lock the main thread is waiting for (PulseAudio's launch) would otherwise wait out the timeout.
|
||||
val bound = runCatching {
|
||||
app.bindService(Intent(app, classes[slot.index]), Context.BIND_AUTO_CREATE or Context.BIND_IMPORTANT,
|
||||
connections, slot.connection)
|
||||
}.onFailure { Log.w(TAG, "worker ${slot.index} could not be bound", it) }.getOrDefault(false)
|
||||
if (!bound) {
|
||||
release(app, slot)
|
||||
return null
|
||||
}
|
||||
return slot
|
||||
}
|
||||
|
||||
private fun takeWarm(): Slot? = synchronized(slots) {
|
||||
while (warm.isNotEmpty()) {
|
||||
val slot = warm.removeFirst()
|
||||
if (slots[slot.index] === slot && slot.service?.isBinderAlive == true) return slot
|
||||
}
|
||||
null
|
||||
}
|
||||
|
||||
/** Brings the warm workers back up to [warmTarget], one at a time, off the caller's thread. */
|
||||
private fun refill(app: Context) {
|
||||
if (warmTarget == 0 || !warming.compareAndSet(false, true)) return
|
||||
Thread({
|
||||
try {
|
||||
while (true) {
|
||||
val missing = warmTarget - synchronized(slots) { warm.size }
|
||||
if (missing <= 0) break
|
||||
// all at once: the zygote forks them in parallel
|
||||
val fresh = (1..missing).mapNotNull { bind(app) }
|
||||
if (fresh.isEmpty()) break
|
||||
for (slot in fresh) {
|
||||
if (!slot.connected.await(10, TimeUnit.SECONDS)) {
|
||||
release(app, slot)
|
||||
continue
|
||||
}
|
||||
// decided once, under the lock: kept warm, or released
|
||||
val kept = synchronized(slots) {
|
||||
(slots[slot.index] === slot && warmTarget > 0).also { if (it) warm.addLast(slot) }
|
||||
}
|
||||
if (!kept) release(app, slot)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
warming.set(false)
|
||||
}
|
||||
}, "guest-worker-warm").apply { isDaemon = true; start() }
|
||||
}
|
||||
|
||||
/** A game is about to start: [LAUNCH_WORKERS] bound ahead, back to [WARM_WORKERS] once it is up. */
|
||||
fun expectLaunch(context: Context) {
|
||||
val app = context.applicationContext
|
||||
val raised = synchronized(slots) { (warmTarget > 0).also { if (it) warmTarget = LAUNCH_WORKERS } }
|
||||
if (!raised) return
|
||||
launchUntil = android.os.SystemClock.elapsedRealtime() + LAUNCH_MS
|
||||
val launch = launches.incrementAndGet()
|
||||
refill(app)
|
||||
Thread({
|
||||
try {
|
||||
Thread.sleep(LAUNCH_MS)
|
||||
} catch (_: InterruptedException) {
|
||||
return@Thread
|
||||
}
|
||||
if (launches.get() != launch) return@Thread
|
||||
val extra = synchronized(slots) {
|
||||
if (warmTarget != LAUNCH_WORKERS) emptyList()
|
||||
else {
|
||||
warmTarget = WARM_WORKERS
|
||||
List((warm.size - WARM_WORKERS).coerceAtLeast(0)) { warm.removeLast() }
|
||||
}
|
||||
}
|
||||
extra.forEach { release(app, it) }
|
||||
refill(app)
|
||||
}, "guest-worker-launch").apply { isDaemon = true; start() }
|
||||
}
|
||||
|
||||
private fun release(app: Context, slot: Slot) {
|
||||
var report = false
|
||||
val removed = synchronized(slots) {
|
||||
warm.remove(slot)
|
||||
if (slot.launching) slot.endedLaunching = true else report = slot.started
|
||||
(slots[slot.index] === slot).also { if (it) slots[slot.index] = null }
|
||||
}
|
||||
if (!removed) return
|
||||
runCatching { app.unbindService(slot.connection) }
|
||||
if (report) reportEnd(app, slot)
|
||||
}
|
||||
|
||||
private fun reportEnd(app: Context, slot: Slot) {
|
||||
val onExit = slot.onExit ?: return
|
||||
Thread({ onExit(exitStatus(app, slot.pid)) }, "guest-worker-exit").start()
|
||||
}
|
||||
|
||||
/** The worker's exit as a wait status (exit code << 8, or the signal), -1 when unknown. */
|
||||
private fun exitStatus(app: Context, pid: Int): Int {
|
||||
if (pid <= 0 || android.os.Build.VERSION.SDK_INT < 30) return -1
|
||||
val am = app.getSystemService(ActivityManager::class.java)
|
||||
var recorded = false
|
||||
repeat(20) {
|
||||
am.getHistoricalProcessExitReasons(app.packageName, pid, 1).firstOrNull()?.let {
|
||||
recorded = true
|
||||
// an exit code only when the process exited itself; a signal number otherwise (a native crash)
|
||||
if (it.reason == android.app.ApplicationExitInfo.REASON_EXIT_SELF) return (it.status and 0xff) shl 8
|
||||
if (it.status in 1..64) return it.status and 0x7f
|
||||
// Android records the death first and the zygote's status later (as UNKNOWN, 0, then
|
||||
// EXIT_SELF): a reason without a status may still be completed
|
||||
if (it.reason != android.app.ApplicationExitInfo.REASON_UNKNOWN) return OsConstants.SIGKILL
|
||||
}
|
||||
Thread.sleep(50)
|
||||
}
|
||||
// killed by Android with no signal recorded, not a clean exit
|
||||
return if (recorded) OsConstants.SIGKILL else -1
|
||||
}
|
||||
|
||||
/** The pids of session [of]'s guest programs running in workers. */
|
||||
fun guestPids(of: Int = session): List<Int> =
|
||||
synchronized(slots) { slots.mapNotNull { s -> s?.takeIf { it.guest && it.session == of }?.pid?.takeIf { it > 0 } } }
|
||||
|
||||
/** Ends session [of]'s guest programs that are still running, and, for the latest session, the warm workers. */
|
||||
fun stopGuests(of: Int = session) {
|
||||
// the check and the reset together: a new session's serve() may be under way
|
||||
val drained = synchronized(authorizing) {
|
||||
synchronized(slots) {
|
||||
stopped = maxOf(stopped, of)
|
||||
if (of != session) emptyList() else { warmTarget = 0; warm.toList().also { warm.clear() } }
|
||||
}
|
||||
}
|
||||
context?.let { app -> drained.forEach { release(app, it) } }
|
||||
val pids = guestPids(of)
|
||||
if (pids.isEmpty()) return
|
||||
pids.forEach { Process.sendSignal(it, OsConstants.SIGTERM) }
|
||||
Thread.sleep(500)
|
||||
pids.forEach { Process.killProcess(it) }
|
||||
}
|
||||
|
||||
/** Listens for `droiddeck-spawn` requests from the session's guests. */
|
||||
fun attach(context: Context) {
|
||||
this.context = context.applicationContext
|
||||
}
|
||||
|
||||
/** Puts a running program's main thread back to its asker's priority after Android boosted it (once started, never stops). */
|
||||
private fun keepPriorities() {
|
||||
synchronized(this) {
|
||||
if (keeper != null) return
|
||||
keeper = Thread({
|
||||
while (true) {
|
||||
try {
|
||||
Thread.sleep(PRIORITY_CHECK_MS)
|
||||
} catch (_: InterruptedException) {
|
||||
return@Thread
|
||||
}
|
||||
val running = synchronized(slots) {
|
||||
slots.filterNotNull().filter { it.started && it.pid > 0 && it.nice != TOP_APP_BOOST }
|
||||
}
|
||||
for (s in running) runCatching {
|
||||
if (Process.getThreadPriority(s.pid) == TOP_APP_BOOST) Process.setThreadPriority(s.pid, s.nice)
|
||||
}
|
||||
}
|
||||
}, "guest-worker-priority").apply { isDaemon = true; start() }
|
||||
}
|
||||
}
|
||||
|
||||
/** Starts a session's use of the workers (and the spawn socket, once); returns its number. */
|
||||
fun serve(context: Context): Int {
|
||||
val app = context.applicationContext
|
||||
this.context = app
|
||||
val number = synchronized(slots) { warmTarget = WARM_WORKERS; ++session }
|
||||
refill(app)
|
||||
keepPriorities()
|
||||
synchronized(this) {
|
||||
if (server != null) return number
|
||||
server = Thread({
|
||||
val socket = try {
|
||||
LocalServerSocket(socketName(app))
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "no spawn socket", e)
|
||||
synchronized(this) { server = null }
|
||||
return@Thread
|
||||
}
|
||||
while (true) {
|
||||
val client = runCatching { socket.accept() }.getOrNull()
|
||||
if (client == null) {
|
||||
Thread.sleep(100) // out of fds, for one: do not spin
|
||||
continue
|
||||
}
|
||||
// A bounded number of requests still coming in: a stalled sender holds a thread
|
||||
if (receiving.incrementAndGet() > MAX_RECEIVING) {
|
||||
receiving.decrementAndGet()
|
||||
Log.w(TAG, "$MAX_RECEIVING spawn requests are still coming in: refusing another")
|
||||
runCatching { client.close() }
|
||||
continue
|
||||
}
|
||||
Thread({
|
||||
try {
|
||||
handle(app, client) { receiving.decrementAndGet() }
|
||||
} catch (e: Throwable) {
|
||||
Log.w(TAG, "spawn request failed", e)
|
||||
}
|
||||
}, "guest-spawn").start()
|
||||
}
|
||||
}, "guest-spawn-server").apply { isDaemon = true; start() }
|
||||
}
|
||||
return number
|
||||
}
|
||||
|
||||
private fun handle(app: Context, client: LocalSocket, received: () -> Unit) {
|
||||
var receiving = true
|
||||
val done = { if (receiving) { receiving = false; received() } }
|
||||
try {
|
||||
handleRequest(app, client, done)
|
||||
} finally {
|
||||
done()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleRequest(app: Context, client: LocalSocket, received: () -> Unit) {
|
||||
client.use {
|
||||
if (client.peerCredentials.uid != Process.myUid()) return
|
||||
// The whole request and its fds within this, however slowly they come (the wait for a
|
||||
// program's exit is not): each read gets what is left of it
|
||||
val deadline = android.os.SystemClock.elapsedRealtime() + RECEIVE_TIMEOUT_MS
|
||||
fun left() {
|
||||
val ms = deadline - android.os.SystemClock.elapsedRealtime()
|
||||
if (ms <= 0) throw java.net.SocketTimeoutException("spawn request not received in time")
|
||||
client.soTimeout = ms.toInt()
|
||||
}
|
||||
val input = DataInputStream(client.inputStream)
|
||||
val fds = ArrayList<ParcelFileDescriptor>()
|
||||
fun take() {
|
||||
val received = client.ancillaryFileDescriptors.orEmpty()
|
||||
try {
|
||||
received.forEach { fds.add(ParcelFileDescriptor.dup(it)) }
|
||||
} finally {
|
||||
received.forEach { runCatching { Os.close(it) } }
|
||||
}
|
||||
}
|
||||
// fds can come with any read, the request's own bytes too: each read's are taken at once
|
||||
fun fill(bytes: ByteArray) {
|
||||
var got = 0
|
||||
while (got < bytes.size) {
|
||||
left()
|
||||
val n = input.read(bytes, got, bytes.size - got)
|
||||
take()
|
||||
if (n < 0) throw java.io.EOFException("spawn request ended at $got of ${bytes.size} bytes")
|
||||
got += n
|
||||
}
|
||||
}
|
||||
// Until start() has them: closed on every way out before that, from the first byte on
|
||||
var handedOver = false
|
||||
try {
|
||||
val length = ByteArray(4).also { fill(it) }.let { java.nio.ByteBuffer.wrap(it).int }
|
||||
if (length !in 1..MAX_REQUEST_BYTES) {
|
||||
Log.w(TAG, "spawn request of $length bytes refused")
|
||||
return
|
||||
}
|
||||
val payload = ByteArray(length).also { fill(it) }
|
||||
val request = JSONObject(String(payload))
|
||||
if (request.has("fdchunks")) {
|
||||
// The hook sends its fds after the request, a chunk with each byte (hook/handoff.c)
|
||||
val total = (request.optJSONArray("fds")?.length() ?: 0) + (if (request.has("table")) 1 else 0)
|
||||
while (fds.size < total) {
|
||||
left()
|
||||
if (input.read() < 0) throw java.io.EOFException("fds ended at ${fds.size} of $total")
|
||||
take()
|
||||
}
|
||||
} else {
|
||||
take()
|
||||
}
|
||||
received()
|
||||
val argv = request.getJSONArray("argv").let { a -> List(a.length()) { a.getString(it) } }
|
||||
val env = LinkedHashMap<String, String>()
|
||||
request.optJSONObject("env")?.let { o -> o.keys().forEach { env[it] = o.getString(it) } }
|
||||
request.optJSONArray("envlist")?.let { a ->
|
||||
for (i in 0 until a.length()) a.getString(i).split('=', limit = 2).let { if (it.size == 2) env[it[0]] = it[1] }
|
||||
}
|
||||
// What the hook told the program that asked (it may run in a worker itself) is not this one's
|
||||
env.keys.removeAll { it.startsWith("DDH_") }
|
||||
val cwd = request.optString("cwd", "/")
|
||||
val wait = request.optBoolean("wait", false)
|
||||
// A path without a slash names a file in the cwd, as execve() takes it, not one on PATH
|
||||
val file = request.optString("file", "").let { if (it.isNotEmpty() && '/' !in it) "./$it" else it }
|
||||
// The handoff table (the hook's) comes last among the fds; the rest go to these numbers.
|
||||
val tableIndex = request.optInt("table", -1)
|
||||
val numbers = request.optJSONArray("fds")?.let { a -> IntArray(a.length()) { a.getInt(it) } } ?: IntArray(3) { it }
|
||||
val table = fds.getOrNull(tableIndex)?.takeIf { pfd ->
|
||||
runCatching { Os.readlink("/proc/self/fd/${pfd.fd}") }.getOrNull()?.contains("ddnatv-handoff") == true
|
||||
}
|
||||
val slot = request.optInt("slot", -1)
|
||||
val parent = request.optInt("parent", -1)
|
||||
var programFds = fds.filterIndexed { i, _ -> i != tableIndex }
|
||||
var targets = numbers
|
||||
if (table != null && slot >= 0) {
|
||||
// The program reports its own exit status into the table (hook/handoff.c)
|
||||
val tableFd = (numbers.maxOrNull() ?: 2) + 1
|
||||
programFds = programFds + table
|
||||
targets = numbers + tableFd
|
||||
env["DDH_TABLE"] = "$tableFd:$slot:$parent:${request.optInt("child", -1)}"
|
||||
}
|
||||
val root = env["DDNATV_ROOT"]?.let(::File)
|
||||
val out = client.outputStream
|
||||
if (root == null || argv.isEmpty()) {
|
||||
out.write("error no guest root or program\n".toByteArray())
|
||||
return
|
||||
}
|
||||
val shell = listOf("/usr/bin/bash", "/bin/bash").first { File(root, it.removePrefix("/")).isFile }
|
||||
val args = if (file.isNotEmpty()) {
|
||||
listOf("-c", "unset DDH_WRAPPER; cd -- \"\$1\" 2>/dev/null; a=\$2; f=\$3; shift 3; exec -a \"\$a\" \"\$f\" \"\$@\"",
|
||||
"droiddeck-spawn", cwd, argv[0], file) + argv.drop(1)
|
||||
} else {
|
||||
listOf("-c", "unset DDH_WRAPPER; cd -- \"\$1\" 2>/dev/null; shift; exec \"\$@\"", "droiddeck-spawn", cwd) + argv
|
||||
}
|
||||
val command = NativeGuest.command(root, shell, args)
|
||||
env["DDNATV_REAL_EXE"] = File(root, shell.removePrefix("/")).path
|
||||
// The hook restores these in the program (tools/nativeguest/hook/handoff.c).
|
||||
if (request.has("sigign")) env["DDH_SIGIGN"] = request.getLong("sigign").toString()
|
||||
if (request.has("nofile")) {
|
||||
env["DDH_NOFILE"] = request.getLong("nofile").toString() +
|
||||
(if (request.has("nofilemax")) ":" + request.getLong("nofilemax") else "")
|
||||
}
|
||||
if (request.has("umask")) env["DDH_UMASK"] = request.getLong("umask").toString()
|
||||
if (request.has("pgid")) env["DDH_PGID"] = request.getLong("pgid").toString()
|
||||
if (request.has("anchor")) env["DDH_ANCHOR"] = request.getLong("anchor").toString()
|
||||
if (request.has("pstart")) env["DDH_PSTART"] = request.getLong("pstart").toString()
|
||||
if (request.has("astart")) env["DDH_ASTART"] = request.getLong("astart").toString()
|
||||
env["DDH_SIGMASK"] = request.optLong("sigmask", 0L).toString()
|
||||
// The shell above: the hook restores nothing there (bash changes its own signal mask),
|
||||
// only in the program it execs, which no longer has this.
|
||||
env["DDH_WRAPPER"] = "1"
|
||||
val child = request.optInt("child", -1)
|
||||
val exited = CountDownLatch(1)
|
||||
var status = -1
|
||||
var worker = -1
|
||||
// The hook answers the pid with "go" (ack): without it (it died, or gave up and runs the
|
||||
// program itself) the worker must not run it too.
|
||||
val ack = request.optBoolean("ack", false)
|
||||
var answered = false
|
||||
// the hook's last word, sent once the worker has taken the program on and before it runs it
|
||||
var confirmedToHook = false
|
||||
// The session whose guest asks, not the latest: a new session can start (serve()) while an
|
||||
// older one's guests are still sending, and that older one's teardown must find its programs.
|
||||
// A request that names none is refused (start() runs nothing for session 0): the hook and
|
||||
// droiddeck-spawn always name it, and which session's it is cannot be told otherwise.
|
||||
val owner = request.optInt("session", 0).coerceAtLeast(0)
|
||||
// The sender is the forked child (or droiddeck-spawn): its priority is the one the program would inherit
|
||||
val nice = runCatching { Process.getThreadPriority(client.peerCredentials.pid) }.getOrDefault(Process.THREAD_PRIORITY_DEFAULT)
|
||||
val pid = start(app, command, env.map { (k, v) -> "$k=$v" }, programFds, targets, true, owner = owner, nice = nice, onExit = { code ->
|
||||
status = code
|
||||
if (table != null && slot >= 0) reportExit(table, slot, code, parent, child, worker)
|
||||
exited.countDown()
|
||||
}, confirmed = {
|
||||
!ack || runCatching {
|
||||
out.write("ok\n".toByteArray())
|
||||
out.flush()
|
||||
confirmedToHook = true
|
||||
}.isSuccess
|
||||
}, commit = { started ->
|
||||
worker = started
|
||||
if (!ack) return@start true
|
||||
runCatching {
|
||||
out.write("pid $started\n".toByteArray())
|
||||
out.flush()
|
||||
answered = true
|
||||
client.soTimeout = ACK_TIMEOUT_MS
|
||||
// the whole line: a hook whose write stopped short treats it as failed and runs the program itself
|
||||
val line = StringBuilder()
|
||||
var ended = false
|
||||
while (!ended) {
|
||||
val c = input.read()
|
||||
if (c < 0) break
|
||||
if (c == '\n'.code) ended = true else line.append(c.toChar())
|
||||
}
|
||||
ended && line.toString() == "go"
|
||||
}.getOrDefault(false)
|
||||
})
|
||||
handedOver = true
|
||||
programFds.filter { it !== table }.forEach { runCatching { it.close() } }
|
||||
if (pid <= 0) table?.let { runCatching { it.close() } }
|
||||
if (!answered) {
|
||||
out.write(if (pid > 0) "pid $pid\n".toByteArray() else "error no worker\n".toByteArray())
|
||||
out.flush()
|
||||
} else if (!confirmedToHook) {
|
||||
// nothing runs it in a worker: the hook runs it itself
|
||||
runCatching { out.write("error not started\n".toByteArray()); out.flush() }
|
||||
}
|
||||
if (pid > 0 && wait) {
|
||||
exited.await()
|
||||
// droiddeck-spawn exits with this: an exit code, or 128 plus the signal
|
||||
val code = if (status < 0) 1 else if (status and 0x7f == 0) (status shr 8) and 0xff else 128 + (status and 0x7f)
|
||||
out.write("exit $code\n".toByteArray())
|
||||
out.flush()
|
||||
}
|
||||
} finally {
|
||||
if (!handedOver) fds.forEach { runCatching { it.close() } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Layout of the hook's table (tools/nativeguest/hook/handoff.c): a 64-byte header, then 64-byte
|
||||
// entries of int32 child, real, parent, state, ..., and at 32 the app's report: int32 status, child.
|
||||
// The report is one 8-byte write tagged with the child it is for; only the hook changes an
|
||||
// entry's state, so a report that lands after the entry went to another child is ignored there.
|
||||
private fun reportExit(table: ParcelFileDescriptor, slot: Int, status: Int, parent: Int, child: Int, worker: Int) {
|
||||
runCatching {
|
||||
val entry = 64L + slot * 64L
|
||||
val head = java.nio.ByteBuffer.allocate(16).order(java.nio.ByteOrder.nativeOrder())
|
||||
Os.pread(table.fileDescriptor, head, entry)
|
||||
val real = head.getInt(4)
|
||||
val state = head.getInt(12)
|
||||
// Also while the hook holds the entry (TAKEN) or has already guessed its end (EXITED):
|
||||
// the report is for this child only, and wins over the timeout's guess (ddh_status)
|
||||
if (head.getInt(0) != child || head.getInt(8) != parent || (real != 0 && real != worker) || state !in 1..4)
|
||||
return@runCatching
|
||||
// An exit Android has no record of is reported as a failure, not as a signal.
|
||||
val report = java.nio.ByteBuffer.allocate(8).order(java.nio.ByteOrder.nativeOrder())
|
||||
.putInt(0, if (status < 0) 1 shl 8 else status).putInt(4, child)
|
||||
Os.pwrite(table.fileDescriptor, report, entry + 32)
|
||||
if (parent > 0) Process.sendSignal(parent, OsConstants.SIGCHLD)
|
||||
}.onFailure { Log.w(TAG, "could not report an exit to the guest's parent", it) }
|
||||
runCatching { table.close() }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.droiddeck.launcher.runtime;
|
||||
|
||||
import com.droiddeck.launcher.core.AddonPack;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
import android.system.StructStat;
|
||||
import android.system.StructUtsname;
|
||||
import com.droiddeck.launcher.gpu.SystemVulkanDriver;
|
||||
import com.droiddeck.launcher.session.SessionPrefs;
|
||||
|
||||
@@ -58,70 +55,8 @@ public final class LinuxRuntime {
|
||||
return dir;
|
||||
}
|
||||
|
||||
public static File prootTempDir(Context context) {
|
||||
File dir = new File(liveDir(context), "proot");
|
||||
dir.mkdirs();
|
||||
return dir;
|
||||
}
|
||||
|
||||
private static final String HOST_DIR = "opt/android-host";
|
||||
public static final String PROOT_PACK = "add-on pack";
|
||||
public static final String PROOT_ROOTFS = "rootfs fallback";
|
||||
public static final String PROOT_MISSING = "missing";
|
||||
|
||||
private static File rootfsProot(Context context) {
|
||||
return new File(rootDir(context), HOST_DIR + "/proot");
|
||||
}
|
||||
|
||||
private static File rootfsLoader(Context context) {
|
||||
return new File(rootDir(context), HOST_DIR + "/loader");
|
||||
}
|
||||
|
||||
private static boolean rootfsProotReady(Context context) {
|
||||
return Build.VERSION.SDK_INT < 29 && rootfsProot(context).isFile() && rootfsLoader(context).isFile();
|
||||
}
|
||||
|
||||
/** proot execs its loader, and targetSdk 29+ may exec only the APK's libraries, which hold the pack's matching loader. */
|
||||
public static boolean stockProotAllowed(Context context) {
|
||||
return Build.VERSION.SDK_INT < 29 && SessionPrefs.allowStockProot(context);
|
||||
}
|
||||
|
||||
/** Android 10+ refuses to execute files from app data for targetSdk 29+, but executes the APK's extracted libraries. */
|
||||
private static File bundledLoader(Context context) {
|
||||
File file = new File(context.getApplicationInfo().nativeLibraryDir, "libproot-loader.so");
|
||||
return file.isFile() ? file : null;
|
||||
}
|
||||
|
||||
public static boolean patchedProot(Context context) {
|
||||
return AddonPack.PROOT.installed(context);
|
||||
}
|
||||
|
||||
public static File prootBinary(Context context) {
|
||||
if (AddonPack.PROOT.installed(context)) return AddonPack.PROOT.file(context, "libproot.so");
|
||||
if (stockProotAllowed(context)) return rootfsProot(context);
|
||||
return AddonPack.PROOT.file(context, "libproot.so");
|
||||
}
|
||||
|
||||
public static File prootLoader(Context context) {
|
||||
File bundled = bundledLoader(context);
|
||||
if (AddonPack.PROOT.installed(context)) return bundled != null ? bundled : AddonPack.PROOT.file(context, "libproot-loader.so");
|
||||
if (stockProotAllowed(context)) return rootfsLoader(context);
|
||||
return bundled != null ? bundled : AddonPack.PROOT.file(context, "libproot-loader.so");
|
||||
}
|
||||
|
||||
public static String prootSource(Context context) {
|
||||
File bin = prootBinary(context);
|
||||
if (!bin.isFile()) return PROOT_MISSING;
|
||||
return patchedProot(context) && !bin.equals(rootfsProot(context)) ? PROOT_PACK : PROOT_ROOTFS;
|
||||
}
|
||||
|
||||
public static String prootLibraryPath(Context context) {
|
||||
File dir = new File(rootDir(context), HOST_DIR);
|
||||
return dir.equals(prootBinary(context).getParentFile()) ? dir.getPath() : "";
|
||||
}
|
||||
|
||||
public static boolean isInstalled(Context context) {
|
||||
return hasRootfs(context) && (patchedProot(context) || rootfsProotReady(context));
|
||||
return hasRootfs(context) && NativeGuest.INSTANCE.loader(rootDir(context)) != null;
|
||||
}
|
||||
|
||||
public static boolean hasRootfs(Context context) {
|
||||
@@ -142,42 +77,9 @@ public final class LinuxRuntime {
|
||||
return manifests.length > 0 ? manifests[0] : null;
|
||||
}
|
||||
|
||||
public static List<String> command(Context context, File sessionRoot, File runtimeDir,
|
||||
File externalStorage, List<String> guestCommand) {
|
||||
return command(context, sessionRoot, runtimeDir, externalStorage, null, guestCommand);
|
||||
}
|
||||
|
||||
public static List<String> command(Context context, File sessionRoot, File runtimeDir,
|
||||
File externalStorage, List<String> extraBinds,
|
||||
List<String> guestCommand) {
|
||||
return command(context, sessionRoot, runtimeDir, externalStorage, extraBinds, guestCommand, false);
|
||||
}
|
||||
|
||||
public static List<String> command(Context context, File sessionRoot, File runtimeDir,
|
||||
File externalStorage, List<String> extraBinds,
|
||||
List<String> guestCommand, boolean fakeRoot) {
|
||||
File root = rootDir(context);
|
||||
List<String> binds = binds(context, sessionRoot, runtimeDir, externalStorage, extraBinds);
|
||||
if (sessionRoot != null) lastBinds = binds;
|
||||
return commandWithBinds(context, root, binds, guestCommand, fakeRoot);
|
||||
}
|
||||
|
||||
public static List<String> commandWithBinds(Context context, File root, List<String> binds,
|
||||
List<String> guestCommand) {
|
||||
return commandWithBinds(context, root, binds, guestCommand, false);
|
||||
}
|
||||
|
||||
public static List<String> commandWithBinds(Context context, File root, List<String> binds,
|
||||
List<String> guestCommand, boolean fakeRoot) {
|
||||
List<String> cmd = fakeRoot ? rootPrefix(context, root, "/root") : prootPrefix(context, root, "/root");
|
||||
for (String spec : binds) bind(cmd, spec);
|
||||
cmd.addAll(guestCommand);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private static volatile List<String> lastBinds;
|
||||
|
||||
/** The mounts of a session started without proot, which sandboxes and root helpers see too. */
|
||||
/** The mounts of the running session, which sandboxes and root helpers see too. */
|
||||
public static void rememberSessionBinds(List<String> binds) {
|
||||
lastBinds = binds;
|
||||
}
|
||||
@@ -193,36 +95,6 @@ public final class LinuxRuntime {
|
||||
return SessionPrefs.mountSharedStorage(context) ? android.os.Environment.getExternalStorageDirectory() : null;
|
||||
}
|
||||
|
||||
public static List<String> prootPrefix(Context context, File root, String cwd) {
|
||||
return prootPrefix(context, root, cwd, false);
|
||||
}
|
||||
|
||||
public static List<String> rootPrefix(Context context, File root, String cwd) {
|
||||
List<String> cmd = prootPrefix(context, root, cwd, true);
|
||||
cmd.add("--link2symlink");
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public static List<String> prootPrefix(Context context, File root, String cwd, boolean fakeRoot) {
|
||||
NativeGuest.relinkAfterProot(root);
|
||||
List<String> cmd = new ArrayList<>();
|
||||
cmd.addAll(com.droiddeck.launcher.core.HostProcess.dataExecutable(prootBinary(context).getPath()));
|
||||
cmd.add("--kill-on-exit");
|
||||
cmd.add("--kernel-release=" + guestUtsname(SessionPrefs.guestHostname(context)));
|
||||
int uid = Process.myUid();
|
||||
if (fakeRoot) {
|
||||
cmd.add("-0");
|
||||
} else {
|
||||
cmd.add("-i");
|
||||
cmd.add(uid + ":" + uid);
|
||||
}
|
||||
cmd.add("-r");
|
||||
cmd.add(root.getPath());
|
||||
cmd.add("-w");
|
||||
cmd.add(cwd);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public static List<String> binds(Context context, File sessionRoot, File runtimeDir,
|
||||
File externalStorage, List<String> extraBinds) {
|
||||
File root = rootDir(context);
|
||||
@@ -320,9 +192,7 @@ public final class LinuxRuntime {
|
||||
if (extraBinds != null) {
|
||||
for (String spec : extraBinds) bind(cmd, spec);
|
||||
}
|
||||
List<String> specs = new ArrayList<>();
|
||||
for (int i = 0; i + 1 < cmd.size(); i += 2) specs.add(cmd.get(i + 1));
|
||||
return specs;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
private static void bindPowerVrGpuNode(Context context, List<String> cmd) {
|
||||
@@ -597,16 +467,9 @@ public final class LinuxRuntime {
|
||||
}
|
||||
|
||||
private static void bind(List<String> cmd, String spec) {
|
||||
cmd.add("-b");
|
||||
cmd.add(spec);
|
||||
}
|
||||
|
||||
static String guestUtsname(String hostname) {
|
||||
StructUtsname host = Os.uname();
|
||||
return "\\" + host.sysname + "\\" + hostname + "\\" + host.release
|
||||
+ "\\" + host.version + "\\" + host.machine + "\\localdomain\\-1\\";
|
||||
}
|
||||
|
||||
public static synchronized void writeAccounts(Context context) throws IOException {
|
||||
File root = rootDir(context);
|
||||
int uid = Process.myUid();
|
||||
|
||||
@@ -184,10 +184,6 @@ public final class LinuxRuntimeInstaller {
|
||||
}
|
||||
};
|
||||
boolean desktop = DesktopCatalog.INSTANCE.desktopInstalled(app);
|
||||
if (packsOnly(app, release, progress)) {
|
||||
job.ok = true;
|
||||
return true;
|
||||
}
|
||||
job.ok = installOnce(app, release, progress);
|
||||
if (job.ok && desktop) keepDesktop(app, progress);
|
||||
return job.ok;
|
||||
@@ -356,22 +352,6 @@ public final class LinuxRuntimeInstaller {
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean packsOnly(Context context, Release release, ProgressListener listener) {
|
||||
if (!LinuxRuntime.hasRootfs(context) || LinuxRuntime.isInstalled(context) || !release.version.equals(rootfsVersion(context))) return false;
|
||||
File root = LinuxRuntime.rootDir(context);
|
||||
try {
|
||||
recoverInterruptedSwap(root, new File(root.getParentFile(), LinuxRuntime.DIR + ".new"), new File(root.getParentFile(), LinuxRuntime.DIR + ".old"));
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "packs only: " + e);
|
||||
return false;
|
||||
}
|
||||
String downloading = context.getString(R.string.rtinst_downloading);
|
||||
if (listener != null) listener.onProgress(Step.DOWNLOADING, downloading, 0);
|
||||
return AddonPack.PROOT.await(context, () -> true, packProgress(listener, downloading))
|
||||
&& AddonPack.DIRECTAUDIO.await(context, () -> true, packProgress(listener, downloading))
|
||||
&& LinuxRuntime.isInstalled(context);
|
||||
}
|
||||
|
||||
private static boolean installOnce(Context context, Release release, ProgressListener listener) {
|
||||
File archive = new File(context.getCacheDir(), archiveName(release));
|
||||
boolean keepPartial = false;
|
||||
@@ -383,9 +363,6 @@ public final class LinuxRuntimeInstaller {
|
||||
emptyTrash(LinuxRuntime.rootDir(context).getParentFile());
|
||||
String downloading = context.getString(R.string.rtinst_downloading);
|
||||
if (listener != null) listener.onProgress(Step.DOWNLOADING, downloading, 0);
|
||||
if (!LinuxRuntime.patchedProot(context) && !AddonPack.PROOT.await(context, () -> true, packProgress(listener, downloading))
|
||||
&& !LinuxRuntime.stockProotAllowed(context))
|
||||
return fail("Cannot download proot", AddonPack.PROOT.getFailure());
|
||||
if (!AddonPack.DIRECTAUDIO.await(context, () -> true, packProgress(listener, downloading)))
|
||||
return fail("Cannot download DirectAudio", AddonPack.DIRECTAUDIO.getFailure());
|
||||
boolean ok = Downloader.downloadFile(release.url, archive, true, release.sha256, (fraction) -> {
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.io.File
|
||||
import java.nio.file.Files
|
||||
|
||||
/**
|
||||
* Starts guest programs directly on the Android kernel, with no proot: the glibc loader of the
|
||||
* Starts guest programs directly on the Android kernel: the glibc loader of the
|
||||
* rootfs runs the program and [HOOK] translates the guest's absolute paths, execs and the system
|
||||
* calls Android's seccomp policy blocks, from inside the process.
|
||||
*/
|
||||
@@ -15,24 +15,16 @@ object NativeGuest {
|
||||
const val HOOK = "usr/lib/libddnatv-hook.so"
|
||||
private val LIB_DIRS = listOf("usr/lib", "usr/lib/aarch64-linux-gnu", "usr/local/lib", "usr/lib/systemd")
|
||||
|
||||
/** Libraries every native program loads before the hook, as /etc/ld.so.preload does for proot. */
|
||||
/** Libraries every guest program loads before the native hook. */
|
||||
fun preloadList(root: File): List<String> {
|
||||
val listed = File(root, "etc/droiddeck/native-preload").takeIf { it.isFile }?.readLines().orEmpty()
|
||||
return listed.map { it.trim() }.filter { it.startsWith("/") && File(root, it.removePrefix("/")).isFile }
|
||||
}
|
||||
|
||||
fun enabled(context: Context): Boolean =
|
||||
SessionPrefs.nativeUserland(context) && available(LinuxRuntime.rootDir(context))
|
||||
available(LinuxRuntime.rootDir(context))
|
||||
|
||||
/** The mode the running session started in; null between sessions. */
|
||||
@Volatile var sessionMode: Boolean? = null
|
||||
|
||||
/**
|
||||
* Whether a session's helpers (root commands, Flatpak sandboxes, installers) run natively: the
|
||||
* session's own mode while one runs, as the setting can change under it and the rootfs is only
|
||||
* prepared for native programs at a session's start.
|
||||
*/
|
||||
fun forSession(context: Context): Boolean = sessionMode ?: enabled(context)
|
||||
@Volatile var sessionPrepared = false
|
||||
|
||||
/**
|
||||
* Development switch: etc/droiddeck/seccomp-sim names a helper (a guest path, then its arguments)
|
||||
@@ -93,7 +85,7 @@ object NativeGuest {
|
||||
|
||||
private fun hostProgram(root: File, program: String): File = File(root, program.removePrefix("/"))
|
||||
|
||||
/** The environment of the session process: the hook's root, the mounts proot used to make, the preload list. */
|
||||
/** The environment of the session process: the hook's root, the guest mounts, the preload list. */
|
||||
fun sessionEnvironment(root: File, binds: List<String>, program: String, hostname: String? = null): Map<String, String> {
|
||||
val preload = preloadList(root)
|
||||
return linkedMapOf(
|
||||
@@ -111,9 +103,11 @@ object NativeGuest {
|
||||
fun workingDirectory(root: File, binds: List<String>, cwd: String): File =
|
||||
File(BwrapSpawner.hostPath(binds.map { BwrapSpawner.Bind.parse(it) }, root.path, cwd)).takeIf { it.isDirectory } ?: root
|
||||
|
||||
/** A process for [guest] (argv) started as proot would with [binds], in guest directory [cwd]. */
|
||||
/** A process for [guest] (argv) started with [binds], in guest directory [cwd]. */
|
||||
fun processBuilder(context: Context, root: File, binds: List<String>, guest: List<String>, cwd: String = "/root"): ProcessBuilder {
|
||||
if (sessionMode == null) prepare(context, root)
|
||||
if (!available(root)) com.droiddeck.launcher.session.SessionFiles.stage(context, root)
|
||||
check(available(root)) { "The installed Linux runtime is missing its native loader or hook" }
|
||||
if (!sessionPrepared) prepare(context, root)
|
||||
return ProcessBuilder(command(root, guest.first(), guest.drop(1)))
|
||||
.directory(workingDirectory(root, binds, cwd))
|
||||
.also { builder ->
|
||||
@@ -174,21 +168,15 @@ object NativeGuest {
|
||||
|
||||
private const val RELINK_STAMP = "etc/droiddeck/native-symlinks"
|
||||
|
||||
@JvmStatic
|
||||
fun relinkAfterProot(root: File) {
|
||||
File(root, RELINK_STAMP).delete()
|
||||
}
|
||||
|
||||
private val HOST_LINK_TARGETS = listOf("/proc", "/dev", "/sys", "/sdcard", "/storage", "/data", "/system", "/vendor", "/apex",
|
||||
"/system_ext", "/product", "/odm", "/linkerconfig", "/mnt", "/root/Storage")
|
||||
|
||||
/**
|
||||
* Symbolic links the kernel follows by itself (ld.so, Steam, anything that skips the hook) read
|
||||
* their absolute target on Android's own filesystem. The image's links were made for proot,
|
||||
* which reads the target inside the rootfs, so each is rewritten as a relative link, which
|
||||
* resolves the same way under proot and without it. Rerun when the runtime changes.
|
||||
* their absolute target on Android's own filesystem. Rewrite rootfs links as relative paths so
|
||||
* the loader resolves them inside the guest. Rerun when the runtime changes.
|
||||
*/
|
||||
fun relinkAbsoluteSymlinks(context: Context, root: File, commands: () -> Sequence<List<String>> = ::procCommands): Int {
|
||||
fun relinkAbsoluteSymlinks(context: Context, root: File): Int {
|
||||
val stamp = File(root, RELINK_STAMP)
|
||||
val version = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.installedVersion(context).orEmpty() + "/3"
|
||||
if (stamp.isFile && stamp.readText() == version) return 0
|
||||
@@ -216,20 +204,11 @@ object NativeGuest {
|
||||
|
||||
override fun visitFileFailed(file: java.nio.file.Path, exc: java.io.IOException) = java.nio.file.FileVisitResult.CONTINUE
|
||||
})
|
||||
if (!prootRunning(LinuxRuntime.prootBinary(context).path, commands())) {
|
||||
stamp.parentFile?.mkdirs()
|
||||
stamp.writeText(version)
|
||||
}
|
||||
stamp.parentFile?.mkdirs()
|
||||
stamp.writeText(version)
|
||||
return rewritten
|
||||
}
|
||||
|
||||
internal fun prootRunning(proot: String, commands: Sequence<List<String>>): Boolean =
|
||||
commands.any { args -> args.take(2).any { it == proot } }
|
||||
|
||||
private fun procCommands(): Sequence<List<String>> = (File("/proc").listFiles() ?: emptyArray()).asSequence()
|
||||
.filter { it.name.all(Char::isDigit) }
|
||||
.mapNotNull { runCatching { File(it, "cmdline").readText().split('\u0000') }.getOrNull() }
|
||||
|
||||
/**
|
||||
* The guest path that host path [target] stands for in a session with [binds] ("src:dst"), or null
|
||||
* when it is a guest path already: the rootfs, or the longest mount source holding it (the first
|
||||
@@ -254,8 +233,8 @@ object NativeGuest {
|
||||
|
||||
/**
|
||||
* Wine prefixes' drive links (dosdevices) hold guest paths ("s:" -> /mnt/droiddeck-sd), which
|
||||
* proot follows and the hook follows inside a mount. Earlier native sessions made them point at
|
||||
* their real places, which proot cannot see: those are given their guest paths back.
|
||||
* the native hook follows inside a mount. Earlier builds pointed them at host paths, so convert
|
||||
* those links back to guest paths.
|
||||
*/
|
||||
fun relinkPrefixDrives(root: File, binds: List<String>): Int {
|
||||
val compatdata = listOf(File(root, "root/.local/share/Steam/steamapps/compatdata")) + binds.mapNotNull { spec ->
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
|
||||
object ProotFastPath {
|
||||
private const val TAG = "ProotFastPath"
|
||||
const val LIBRARY = "/usr/local/lib/libddfastpath.so"
|
||||
const val MAX_BINDS = 256
|
||||
|
||||
fun allows(preference: Boolean, noSeccomp: Boolean, source: String, nativeUserland: Boolean = false): Boolean =
|
||||
preference && !noSeccomp && !nativeUserland && source == LinuxRuntime.PROOT_PACK
|
||||
|
||||
fun enabled(context: Context): Boolean {
|
||||
val preference = SessionPrefs.prootFastPath(context)
|
||||
val noSeccomp = SessionPrefs.prootNoSeccomp(context)
|
||||
val nativeUserland = SessionPrefs.nativeUserland(context)
|
||||
val source = LinuxRuntime.prootSource(context)
|
||||
val on = allows(preference, noSeccomp, source, nativeUserland)
|
||||
if (preference && !noSeccomp && !nativeUserland && !on)
|
||||
Log.i(TAG, "proot: fast path off - binary is $source, not the patched proot")
|
||||
return on
|
||||
}
|
||||
|
||||
fun key(root: File, binds: List<String>): String? {
|
||||
if (binds.size > MAX_BINDS || binds.any { it.contains('|') } || root.path.contains('|')) return null
|
||||
val digest = MessageDigest.getInstance("SHA-256")
|
||||
.digest((root.path + "\n" + binds.joinToString("\n")).toByteArray())
|
||||
return digest.take(12).joinToString("") { "%02x".format(it) }
|
||||
}
|
||||
|
||||
fun hostEnv(key: String): Pair<String, String> = "PROOT_FASTPATH" to key
|
||||
|
||||
fun guestEnv(root: File, binds: List<String>, key: String, sdk: Int = Build.VERSION.SDK_INT): List<String> = listOf(
|
||||
"PROOT_FP_ROOT=" + root.path,
|
||||
"PROOT_FP_BINDS=" + binds.joinToString("|"),
|
||||
"PROOT_FP_KEY=$key",
|
||||
"PROOT_FP_ANDROID_API=$sdk",
|
||||
)
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import android.os.Process
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.core.HostProcess
|
||||
import com.droiddeck.launcher.session.OrphanReaper
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import org.json.JSONObject
|
||||
import java.io.DataInputStream
|
||||
import java.io.DataOutputStream
|
||||
@@ -117,22 +116,7 @@ object RootSpawner {
|
||||
val guest = mutableListOf("/usr/bin/env", "-i")
|
||||
request.optJSONObject("env")?.let { e -> e.keys().forEach { k -> guest.add("$k=${e.getString(k)}") } }
|
||||
guest.addAll(argv)
|
||||
val builder = if (NativeGuest.forSession(context)) {
|
||||
NativeGuest.processBuilder(context, root, binds, guest, cwd)
|
||||
} else {
|
||||
val cmd = LinuxRuntime.rootPrefix(context, root, cwd)
|
||||
binds.forEach { cmd.add("-b"); cmd.add(it) }
|
||||
cmd.addAll(guest)
|
||||
ProcessBuilder(cmd).directory(root).also { b ->
|
||||
b.environment().apply {
|
||||
clear()
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
|
||||
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
val builder = NativeGuest.processBuilder(context, root, binds, guest, cwd)
|
||||
val streams = listOf(stdio(fds.getOrNull(0), false), stdio(fds.getOrNull(1), true), stdio(fds.getOrNull(2), true))
|
||||
try {
|
||||
builder.redirectInput(streams[0].redirect ?: ProcessBuilder.Redirect.PIPE)
|
||||
|
||||
@@ -34,12 +34,10 @@ object BottomDesktop {
|
||||
val guest: List<String>,
|
||||
val binds: List<String>,
|
||||
val sessionRoot: File,
|
||||
val hostEnvironment: Array<String>,
|
||||
val root: File,
|
||||
val sessionDir: File,
|
||||
val generation: Int,
|
||||
val installed: Boolean,
|
||||
val nativeUserland: Boolean,
|
||||
val sharedStorage: File?,
|
||||
)
|
||||
|
||||
@@ -57,10 +55,10 @@ object BottomDesktop {
|
||||
private var service: Messenger? = null
|
||||
private var binding: ServiceConnection? = null
|
||||
private var pendingAttach: Message? = null
|
||||
/** The desktop guest's proot: -1 when there is none, 0 while it is being started. */
|
||||
/** The desktop guest's process: -1 when there is none, 0 while it is being started. */
|
||||
@Volatile private var guestPid = -1
|
||||
|
||||
/** The proot to freeze with the session when it pauses. */
|
||||
/** The process to freeze with the session when it pauses. */
|
||||
val suspendPid: Int get() = guestPid
|
||||
private var guestGeneration = 0
|
||||
var outputSize = 0 to 0
|
||||
@@ -87,16 +85,14 @@ object BottomDesktop {
|
||||
guest: List<String>,
|
||||
binds: List<String>,
|
||||
sessionRoot: File,
|
||||
hostEnvironment: Array<String>,
|
||||
root: File,
|
||||
sessionDir: File,
|
||||
generation: Int,
|
||||
nativeUserland: Boolean,
|
||||
sharedStorage: File?,
|
||||
stillCurrent: () -> Boolean,
|
||||
) {
|
||||
val prepared = Launch(ArrayList(guest), ArrayList(binds), sessionRoot, hostEnvironment.copyOf(), root, sessionDir, generation,
|
||||
DesktopCatalog.desktopInstalled(root), nativeUserland, sharedStorage)
|
||||
val prepared = Launch(ArrayList(guest), ArrayList(binds), sessionRoot, root, sessionDir, generation,
|
||||
DesktopCatalog.desktopInstalled(root), sharedStorage)
|
||||
synchronized(launchLock) { if (stillCurrent()) launch = prepared }
|
||||
}
|
||||
|
||||
@@ -324,15 +320,9 @@ object BottomDesktop {
|
||||
add("DD_IME_DIR=" + imeDir.path)
|
||||
add(SCRIPT)
|
||||
}
|
||||
val command = if (current.nativeUserland) {
|
||||
com.droiddeck.launcher.runtime.NativeGuest.command(current.root, guest.first(), guest.drop(1))
|
||||
} else {
|
||||
LinuxRuntime.commandWithBinds(context, current.root, binds, guest)
|
||||
}
|
||||
val environment = if (current.nativeUserland) {
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, guest.first(), SessionPrefs.guestHostname(context))
|
||||
.map { (k, v) -> "$k=$v" }.toTypedArray()
|
||||
} else current.hostEnvironment
|
||||
val command = com.droiddeck.launcher.runtime.NativeGuest.command(current.root, guest.first(), guest.drop(1))
|
||||
val environment = com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, guest.first(), SessionPrefs.guestHostname(context))
|
||||
.map { (k, v) -> "$k=$v" }.toTypedArray()
|
||||
val line = command.joinToString(" ") { it.replace("\\", "\\\\").replace(" ", "\\ ") }
|
||||
val pid = HostProcess.start(line, environment, current.root, { status ->
|
||||
main.post {
|
||||
@@ -343,7 +333,7 @@ object BottomDesktop {
|
||||
guestGeneration++
|
||||
setState(if (state == State.RUNNING || status == 0) State.ENDED else State.FAILED)
|
||||
}
|
||||
}, null, File(dir, "proot.log"))
|
||||
}, null, File(dir, "process.log"))
|
||||
main.post {
|
||||
if (generation != guestGeneration || launch !== current) {
|
||||
if (pid > 1) SessionService.stopTerminalProcess(context, pid)
|
||||
|
||||
@@ -217,7 +217,7 @@ object GraphicsReport {
|
||||
}
|
||||
if (guestLines.any { it.contains("MEM_EXEC_INIT") }) {
|
||||
appendLine("note: kbase refused KBASE_IOCTL_MEM_EXEC_INIT with EPERM. That answer comes from the kbase driver")
|
||||
appendLine(" itself (proot does not filter ioctls; Android's seccomp would kill or return ENOSYS; SELinux")
|
||||
appendLine(" itself (Android's seccomp would kill or return ENOSYS; SELinux")
|
||||
appendLine(" would return EACCES), so it is the kernel's policy for this context, not the session's.")
|
||||
}
|
||||
appendLine("-- driver lines from the session log (${guestLines.size})")
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.droiddeck.launcher.session
|
||||
|
||||
import java.io.File
|
||||
|
||||
/** Finds the processes a session left running, also once proot is gone and they belong to init. */
|
||||
/** Finds the processes a session left running, including processes reparented to init. */
|
||||
object GuestLeftovers {
|
||||
private const val MARKER = "DD_DEBUG_DIR="
|
||||
|
||||
@@ -15,7 +15,6 @@ object GuestLeftovers {
|
||||
parentOf(proc)?.let { parents[pid] = it }
|
||||
if (pid in skip) return@forEach
|
||||
val exe = runCatching { File(proc, "exe").canonicalPath }.getOrNull()
|
||||
// proot runs a guest through its loader, which is then the process's executable
|
||||
if (exe?.startsWith(rootfs) == true ||
|
||||
marker != null && carries(runCatching { File(proc, "environ").readBytes() }.getOrNull(), marker)) {
|
||||
matched.add(pid)
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.R
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
|
||||
internal object MemoryReadout {
|
||||
data class Device(val totalKb: Long, val availableKb: Long, val swapTotalKb: Long, val swapFreeKb: Long) {
|
||||
@@ -37,6 +45,8 @@ internal object MemoryReadout {
|
||||
fun androidKb(device: Device, split: Split): Long =
|
||||
(device.usedKb - split.gameKb - split.droiddeckKb - (split.gpuKb ?: 0)).coerceAtLeast(0)
|
||||
|
||||
fun gb(kb: Long): String = String.format(Locale.US, "%.1f", kb / (1024.0 * 1024.0))
|
||||
|
||||
fun availableMb(): Long? = runCatching { parseMeminfo(File("/proc/meminfo").readText())?.availableKb?.div(1024) }.getOrNull()
|
||||
|
||||
fun device(): Device? = runCatching { parseMeminfo(File("/proc/meminfo").readText()) }.getOrNull()
|
||||
@@ -106,3 +116,60 @@ object MemoryLog {
|
||||
thread = null
|
||||
}
|
||||
}
|
||||
|
||||
class MemoryHud(context: Context) {
|
||||
var text by mutableStateOf("")
|
||||
private set
|
||||
|
||||
private val context = context.applicationContext
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
@Volatile private var running = false
|
||||
@Volatile private var generation = 0
|
||||
private var thread: Thread? = null
|
||||
|
||||
fun refresh() {
|
||||
if (SessionPrefs.memoryHud(context) == SessionPrefs.MEMORY_HUD_OFF) stop() else start()
|
||||
}
|
||||
|
||||
fun start() {
|
||||
if (running || SessionPrefs.memoryHud(context) == SessionPrefs.MEMORY_HUD_OFF) return
|
||||
running = true
|
||||
val token = ++generation
|
||||
thread = Thread({
|
||||
while (running && generation == token) {
|
||||
val line = runCatching { sample() }.getOrDefault("")
|
||||
handler.post { if (running && generation == token) text = line }
|
||||
try { Thread.sleep(PERIOD_MS) } catch (e: InterruptedException) { break }
|
||||
}
|
||||
}, "memory-hud").apply { isDaemon = true; start() }
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
running = false
|
||||
generation++
|
||||
thread?.interrupt()
|
||||
thread = null
|
||||
text = ""
|
||||
}
|
||||
|
||||
private fun sample(): String {
|
||||
val device = MemoryReadout.device() ?: return ""
|
||||
val memory = context.getString(
|
||||
R.string.memory_hud_simple,
|
||||
MemoryReadout.gb(device.usedKb), MemoryReadout.gb(device.totalKb),
|
||||
MemoryReadout.gb(device.swapUsedKb), MemoryReadout.gb(device.swapTotalKb),
|
||||
)
|
||||
if (SessionPrefs.memoryHud(context) != SessionPrefs.MEMORY_HUD_ADVANCED) return memory
|
||||
val split = MemoryReadout.split()
|
||||
val parts = context.getString(
|
||||
R.string.memory_hud_split,
|
||||
MemoryReadout.gb(split.gameKb), MemoryReadout.gb(split.droiddeckKb), MemoryReadout.gb(MemoryReadout.androidKb(device, split)),
|
||||
)
|
||||
val gpu = split.gpuKb?.let { context.getString(R.string.memory_hud_gpu, MemoryReadout.gb(it)) }
|
||||
return listOfNotNull(memory, parts, gpu).joinToString("\n")
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val PERIOD_MS = 2000L
|
||||
}
|
||||
}
|
||||
@@ -47,12 +47,11 @@ object ProtonExtras {
|
||||
Tool("ge", "GE-Proton", "GE-Proton", "GloriousEggroll/proton-ge-custom", Regex("aarch64\\.tar\\.(gz|xz)$")),
|
||||
Tool("cachyos", "proton-cachyos", "proton-cachyos", "CachyOS/proton-cachyos", Regex("arm64\\.tar\\.(gz|xz)$")),
|
||||
Tool("droiddeck", "DroidDeck-Proton", "DroidDeck-Proton", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Proton-.*aarch64\\.tar\\.(gz|xz)$")),
|
||||
// Bionic (Android libc) Proton started outside the Linux userland; test builds are prereleases. No-proot only.
|
||||
// Bionic (Android libc) Proton started outside the Linux userland; test builds are prereleases.
|
||||
Tool(BIONIC, "DroidDeck-Bionic", "DroidDeck-Bionic", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Bionic-.*aarch64\\.tar\\.(gz|xz)$"), prereleases = true),
|
||||
)
|
||||
|
||||
/** The sources offered on this device: DroidDeck-Bionic only with Run without proot on. */
|
||||
fun offered(context: Context): List<Tool> = tools.filter { it.id != BIONIC || NativeGuest.enabled(context) }
|
||||
fun offered(context: Context): List<Tool> = tools.filter { it.id != BIONIC || LinuxRuntime.isInstalled(context) }
|
||||
|
||||
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
|
||||
private fun requests(context: Context) = File(home(context), ".dd-proton-extra")
|
||||
@@ -394,20 +393,8 @@ object ProtonExtras {
|
||||
internal fun guestProcess(context: Context, guest: List<String>): ProcessBuilder {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
val runtimeDir = File(context.filesDir, ".proton-install-rt").apply { mkdirs() }
|
||||
return if (com.droiddeck.launcher.runtime.NativeGuest.enabled(context)) {
|
||||
com.droiddeck.launcher.runtime.NativeGuest.processBuilder(context, root,
|
||||
LinuxRuntime.binds(context, null, runtimeDir, null, null), guest).redirectErrorStream(true)
|
||||
} else {
|
||||
ProcessBuilder(LinuxRuntime.command(context, null, runtimeDir, null, guest))
|
||||
.directory(root)
|
||||
.redirectErrorStream(true)
|
||||
.also { builder ->
|
||||
val hostEnv = builder.environment()
|
||||
hostEnv["PROOT_LOADER"] = LinuxRuntime.prootLoader(context).path
|
||||
hostEnv["PROOT_TMP_DIR"] = LinuxRuntime.prootTempDir(context).path
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { hostEnv["LD_LIBRARY_PATH"] = it }
|
||||
}
|
||||
}
|
||||
return NativeGuest.processBuilder(context, root,
|
||||
LinuxRuntime.binds(context, null, runtimeDir, null, null), guest).redirectErrorStream(true)
|
||||
}
|
||||
|
||||
internal fun releases(tool: Tool): JSONArray? = releases(tool) { page ->
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
/** A launch the user asked for that waits for something else to finish first, and is forgotten if it waits too long. */
|
||||
class QueuedLaunch<T : Any>(private val lifetimeMs: Long = 15 * 60_000L) {
|
||||
var launch: T? = null
|
||||
private set
|
||||
var queuedAt: Long = 0L
|
||||
private set
|
||||
|
||||
fun queue(launch: T, now: Long) {
|
||||
this.launch = launch
|
||||
queuedAt = now
|
||||
}
|
||||
|
||||
/** Takes back a saved launch with the time it was first queued; one without a valid time or past its lifetime is dropped. */
|
||||
fun restore(launch: T?, queuedAt: Long, now: Long) {
|
||||
if (launch != null && fresh(queuedAt, now)) {
|
||||
this.launch = launch
|
||||
this.queuedAt = queuedAt
|
||||
} else {
|
||||
clear()
|
||||
}
|
||||
}
|
||||
|
||||
/** The launch if it is still wanted; an expired one is cleared. */
|
||||
fun current(now: Long): T? {
|
||||
val queued = launch ?: return null
|
||||
if (fresh(queuedAt, now)) return queued
|
||||
clear()
|
||||
return null
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
launch = null
|
||||
}
|
||||
|
||||
private fun fresh(queuedAt: Long, now: Long) = now - queuedAt in 0..lifetimeMs
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
/**
|
||||
* Starts a queued launch once nothing stands in its way and retries until it can or it expires. One runner belongs to one
|
||||
* activity: destroying it clears its queue and cancels its retry, so a restored activity is the only one that starts the launch.
|
||||
*/
|
||||
class QueuedLaunchRunner<T : Any>(
|
||||
private val queue: QueuedLaunch<T>,
|
||||
private val now: () -> Long,
|
||||
private val blocked: () -> Boolean,
|
||||
private val busy: () -> Boolean,
|
||||
private val schedule: (delayMs: Long, task: Runnable) -> Unit,
|
||||
private val unschedule: (Runnable) -> Unit,
|
||||
private val start: (T) -> Unit,
|
||||
private val retryMs: Long = 2_000L,
|
||||
) {
|
||||
private var posted = false
|
||||
private var retry: Runnable? = null
|
||||
private var destroyed = false
|
||||
|
||||
/** Call whenever the blocking setting may have changed. */
|
||||
fun poke() {
|
||||
if (destroyed || posted) return
|
||||
val launch = queue.current(now()) ?: return
|
||||
if (blocked()) return
|
||||
posted = true
|
||||
schedule(0L, Runnable {
|
||||
posted = false
|
||||
attempt(launch)
|
||||
})
|
||||
}
|
||||
|
||||
private fun attempt(launch: T) {
|
||||
if (destroyed || queue.current(now()) !== launch) return
|
||||
if (busy()) {
|
||||
val again = Runnable { if (!destroyed && queue.launch === launch) poke() }
|
||||
retry = again
|
||||
schedule(retryMs, again)
|
||||
return
|
||||
}
|
||||
queue.clear()
|
||||
start(launch)
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
destroyed = true
|
||||
queue.clear()
|
||||
retry?.let(unschedule)
|
||||
retry = null
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import com.droiddeck.launcher.runtime.BwrapSpawner
|
||||
import com.droiddeck.launcher.runtime.DesktopCatalog
|
||||
import com.droiddeck.launcher.runtime.LegacyNames
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.ProotFastPath
|
||||
import java.io.File
|
||||
|
||||
object SessionFiles {
|
||||
@@ -121,15 +120,15 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-fex" to "usr/local/bin/droiddeck-fex",
|
||||
"libddsession.so" to "usr/local/lib/libddsession.so",
|
||||
"libfakeinput.so" to "usr/local/lib/libfakeinput.so",
|
||||
"libddfastpath.so" to "usr/local/lib/libddfastpath.so",
|
||||
"libddnatv-hook.so" to "usr/lib/libddnatv-hook.so",
|
||||
"libddaudit.so" to "usr/local/lib/libddaudit.so",
|
||||
"libssbs.so" to "usr/local/lib/libssbs.so",
|
||||
"usr/local/bin/droiddeck-session" to "usr/local/bin/droiddeck-session",
|
||||
"usr/local/bin/droiddeck-fonts" to "usr/local/bin/droiddeck-fonts",
|
||||
"usr/local/bin/droiddeck-agent" to "usr/local/bin/droiddeck-agent",
|
||||
"usr/local/bin/steam-compatibility" to "usr/local/bin/steam-compatibility",
|
||||
"usr/local/bin/droiddeck-clipboard" to "usr/local/bin/droiddeck-clipboard",
|
||||
"usr/local/bin/droiddeck-spawn" to "usr/local/bin/droiddeck-spawn",
|
||||
"usr/local/bin/droiddeck-log-writer" to "usr/local/bin/droiddeck-log-writer",
|
||||
"usr/local/bin/droiddeck-desktop-clipboard" to "usr/local/bin/droiddeck-desktop-clipboard",
|
||||
"usr/local/bin/droiddeck-gpu-window" to "usr/local/bin/droiddeck-gpu-window",
|
||||
"usr/local/bin/droiddeck-steam-install" to "usr/local/bin/droiddeck-steam-install",
|
||||
@@ -154,6 +153,7 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-desktop-bookmarks" to "usr/local/bin/droiddeck-desktop-bookmarks",
|
||||
"usr/local/bin/droiddeck-downloads" to "usr/local/bin/droiddeck-downloads",
|
||||
"usr/local/bin/droiddeck-root" to "usr/local/bin/droiddeck-root",
|
||||
"usr/local/bin/droiddeck-user" to "usr/local/bin/droiddeck-user",
|
||||
"usr/local/bin/droiddeck-text" to "usr/local/bin/droiddeck-text",
|
||||
"usr/local/bin/droiddeck-snapd" to "usr/local/bin/droiddeck-snapd",
|
||||
"usr/local/bin/droiddeck-emulators" to "usr/local/bin/droiddeck-emulators",
|
||||
@@ -338,26 +338,25 @@ object SessionFiles {
|
||||
if (!File(Environment.getExternalStorageDirectory(), NO_PAD_SWITCH).exists()) {
|
||||
preload.append("/usr/local/lib/libfakeinput.so\n")
|
||||
}
|
||||
val nativeUserland = SessionPrefs.nativeUserland(context)
|
||||
if (nativeUserland) com.droiddeck.launcher.runtime.NativeGuest.prepare(context, root)
|
||||
if (ProotFastPath.enabled(context)) {
|
||||
val library = com.droiddeck.launcher.agent.AgentEnv.fastPathLibrary(context)
|
||||
preload.append(library + "\n")
|
||||
if (startsSession && library != ProotFastPath.LIBRARY) Log.i(TAG, "fast path preload: $library (debugging override)")
|
||||
}
|
||||
com.droiddeck.launcher.runtime.NativeGuest.prepare(context, root)
|
||||
val etc = File(root, "etc").apply { mkdirs() }
|
||||
File(etc, "droiddeck").mkdirs()
|
||||
FileUtils.writeString(File(etc, "droiddeck/native-preload"), preload.toString())
|
||||
val staged = File(etc, "ld.so.preload.staged")
|
||||
if (!FileUtils.writeString(staged, preload.toString())
|
||||
|| !staged.renameTo(File(etc, "ld.so.preload"))) {
|
||||
staged.delete()
|
||||
Log.e(TAG, "could not write ld.so.preload")
|
||||
File(etc, "ld.so.preload.staged").delete()
|
||||
File(etc, "ld.so.preload").takeIf { it.isFile }?.let { legacy ->
|
||||
val managed = setOf("/usr/local/lib/libddsession.so", "/usr/local/lib/libfakeinput.so")
|
||||
val remaining = legacy.readLines().filterNot { it.trim() in managed || it.trim().endsWith("/libddfastpath.so") }
|
||||
if (remaining.all { it.isBlank() }) legacy.delete()
|
||||
else FileUtils.writeString(legacy, remaining.joinToString("\n", postfix = "\n"))
|
||||
}
|
||||
File(root, "usr/local/lib/libddfastpath.so").delete()
|
||||
File(root, "usr/local/lib/libddaudit.so").delete()
|
||||
|
||||
if (!FileUtils.writeString(File(etc, "steam-compatibility-label"), context.getString(R.string.steam_compat_label))) {
|
||||
Log.e(TAG, "could not write steam-compatibility-label")
|
||||
}
|
||||
writeCjkFontConfig(root, etc)
|
||||
writeSessionBusPolicy(etc)
|
||||
writeDesktopStrings(context, File(etc, "droiddeck").apply { mkdirs() })
|
||||
val droiddeckEtc = File(etc, "droiddeck").apply { mkdirs() }
|
||||
val stagedSocket = File(droiddeckEtc, "bwrap-socket.staged")
|
||||
@@ -880,6 +879,24 @@ object SessionFiles {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A session bus admits only its owner, and with droiddeck-user (the native hook's ordinary
|
||||
* user) a root process and a user's share the bus while the kernel sees one Android uid.
|
||||
*/
|
||||
private fun writeSessionBusPolicy(etc: File) {
|
||||
val xml = """<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<policy context="default">
|
||||
<allow user="*"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
"""
|
||||
val conf = File(etc, "dbus-1/session.d/droiddeck-users.conf")
|
||||
conf.parentFile?.mkdirs()
|
||||
if (!FileUtils.writeString(conf, xml)) Log.e(TAG, "could not write the session bus policy")
|
||||
}
|
||||
|
||||
private fun writeCjkFontConfig(root: File, etc: File) {
|
||||
try {
|
||||
val confDir = File(etc, "fonts/conf.d").apply { mkdirs() }
|
||||
|
||||
@@ -63,6 +63,24 @@ object SessionPrefs {
|
||||
.takeIf { value -> orientationOptions.any { it.first == value } }
|
||||
?: ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
|
||||
|
||||
fun orientation(context: Context, mode: String?): Int {
|
||||
val key = when (mode) {
|
||||
"steam", SessionService.MODE_STEAM, SessionService.MODE_RUN -> "orientation.steam"
|
||||
"desktop", SessionService.MODE_DESKTOP -> "orientation.desktop"
|
||||
else -> null
|
||||
} ?: return orientation(context)
|
||||
val stored = prefs(context).getInt(key, Int.MIN_VALUE)
|
||||
return if (stored == Int.MIN_VALUE) orientation(context)
|
||||
else stored.takeIf { value -> orientationOptions.any { it.first == value } } ?: orientation(context)
|
||||
}
|
||||
|
||||
fun setOrientation(context: Context, mode: String, orientation: Int) {
|
||||
require(mode == "steam" || mode == "desktop")
|
||||
require(orientationOptions.any { it.first == orientation })
|
||||
val key = if (mode == "steam") "orientation.steam" else "orientation.desktop"
|
||||
prefs(context).edit().putInt(key, orientation).apply()
|
||||
}
|
||||
|
||||
/** The session menu's width in dp the user dragged it to; null keeps the default. */
|
||||
fun drawerWidthDp(context: Context): Int? = prefs(context).getInt("drawerWidthDp", 0).takeIf { it > 0 }
|
||||
|
||||
@@ -75,11 +93,19 @@ object SessionPrefs {
|
||||
prefs(context).edit().putInt("orientation", orientation).apply()
|
||||
}
|
||||
|
||||
fun windowOrientation(context: Context, followScreen: Boolean, smallestWidthDp: Int): Int =
|
||||
if (followScreen && smallestWidthDp >= SessionDisplay.UNFOLDED_MIN_DP && !prefs(context).contains("orientation"))
|
||||
fun windowOrientation(context: Context, followScreen: Boolean, smallestWidthDp: Int, mode: String? = null): Int {
|
||||
val modeKey = when (mode) {
|
||||
"steam", SessionService.MODE_STEAM, SessionService.MODE_RUN -> "orientation.steam"
|
||||
"desktop", SessionService.MODE_DESKTOP -> "orientation.desktop"
|
||||
else -> null
|
||||
}
|
||||
val preferences = prefs(context)
|
||||
if (modeKey != null && preferences.contains(modeKey)) return orientation(context, mode)
|
||||
return if (followScreen && smallestWidthDp >= SessionDisplay.UNFOLDED_MIN_DP && !preferences.contains("orientation"))
|
||||
ActivityInfo.SCREEN_ORIENTATION_USER else orientation(context)
|
||||
}
|
||||
|
||||
fun portrait(context: Context): Boolean = when (orientation(context)) {
|
||||
fun portrait(context: Context, mode: String? = null): Boolean = when (orientation(context, mode)) {
|
||||
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT -> true
|
||||
ActivityInfo.SCREEN_ORIENTATION_USER ->
|
||||
context.resources.configuration.orientation == android.content.res.Configuration.ORIENTATION_PORTRAIT
|
||||
@@ -493,6 +519,17 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("drawerPageHidden", keys.joinToString(",")).apply()
|
||||
}
|
||||
|
||||
fun drawerSections(context: Context): Map<String, Boolean> =
|
||||
idList(prefs(context).getString("drawerSections", null)).mapNotNull { entry ->
|
||||
val at = entry.lastIndexOf('=').takeIf { it > 0 } ?: return@mapNotNull null
|
||||
entry.substring(0, at) to (entry.substring(at + 1) == "1")
|
||||
}.toMap()
|
||||
|
||||
fun setDrawerSections(context: Context, sections: Map<String, Boolean>) {
|
||||
prefs(context).edit().putString("drawerSections", sections.entries.filter { ',' !in it.key }
|
||||
.joinToString(",") { "${it.key}=${if (it.value) 1 else 0}" }).apply()
|
||||
}
|
||||
|
||||
fun setNavTabHidden(context: Context, keys: Set<String>) {
|
||||
prefs(context).edit().putString("navTabHidden", keys.joinToString(",")).apply()
|
||||
}
|
||||
@@ -587,6 +624,13 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("hudGraph", on).apply()
|
||||
}
|
||||
|
||||
fun hudColor(context: Context): String =
|
||||
prefs(context).getString("hudColor", HUD_COLOR_MINT)?.takeIf { it in HUD_COLORS } ?: HUD_COLOR_MINT
|
||||
|
||||
fun setHudColor(context: Context, color: String) {
|
||||
if (color in HUD_COLORS) prefs(context).edit().putString("hudColor", color).apply()
|
||||
}
|
||||
|
||||
fun hudOpacity(context: Context): Int =
|
||||
prefs(context).getInt("hudOpacity", HUD_OPACITY_DEFAULT).takeIf { it in HUD_OPACITY_RANGE } ?: HUD_OPACITY_DEFAULT
|
||||
|
||||
@@ -643,6 +687,8 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("__KEEP_droidDeckHudPos__", "$x,$y").apply()
|
||||
}
|
||||
|
||||
const val HUD_COLOR_MINT = "mint"
|
||||
val HUD_COLORS = listOf(HUD_COLOR_MINT, "white", "sky", "amber", "violet")
|
||||
val HUD_OPACITY_RANGE = 30..100
|
||||
const val HUD_OPACITY_DEFAULT = 70
|
||||
|
||||
@@ -1083,22 +1129,11 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("mountSharedStorage", on).apply()
|
||||
}
|
||||
|
||||
fun prootNoSeccomp(context: Context): Boolean = prefs(context).getBoolean("prootNoSeccomp", false)
|
||||
/** Whether the Plasma desktop, and so its apps and shells, runs as an ordinary user instead of root (native userland only). */
|
||||
fun desktopAsUser(context: Context): Boolean = prefs(context).getBoolean("desktopAsUser", false)
|
||||
|
||||
fun setProotNoSeccomp(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("prootNoSeccomp", on).apply()
|
||||
}
|
||||
|
||||
fun nativeUserland(context: Context): Boolean = prefs(context).getBoolean("nativeUserland", true)
|
||||
|
||||
fun setNativeUserland(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("nativeUserland", on).apply()
|
||||
}
|
||||
|
||||
fun prootFastPath(context: Context): Boolean = prefs(context).getBoolean("prootFastPath", true)
|
||||
|
||||
fun setProotFastPath(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("prootFastPath", on).apply()
|
||||
fun setDesktopAsUser(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("desktopAsUser", on).apply()
|
||||
}
|
||||
|
||||
fun cursorComposite(context: Context): Boolean = prefs(context).getBoolean("cursorComposite", true)
|
||||
@@ -1107,10 +1142,6 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("cursorComposite", on).apply()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun allowStockProot(context: Context): Boolean =
|
||||
context.getExternalFilesDir(null)?.let { File(it, "droiddeck-stock-proot").isFile } == true
|
||||
|
||||
const val DEFAULT_GUEST_HOSTNAME = "DroidDeck"
|
||||
|
||||
@JvmStatic
|
||||
@@ -1374,6 +1405,18 @@ object SessionPrefs {
|
||||
prefs(context).edit().putInt("backgroundAppLimit", limit).apply()
|
||||
}
|
||||
|
||||
const val MEMORY_HUD_OFF = "off"
|
||||
const val MEMORY_HUD_SIMPLE = "simple"
|
||||
const val MEMORY_HUD_ADVANCED = "advanced"
|
||||
|
||||
fun memoryHud(context: Context): String =
|
||||
prefs(context).getString("memoryHud", MEMORY_HUD_OFF)
|
||||
?.takeIf { it == MEMORY_HUD_SIMPLE || it == MEMORY_HUD_ADVANCED } ?: MEMORY_HUD_OFF
|
||||
fun setMemoryHud(context: Context, value: String) {
|
||||
require(value == MEMORY_HUD_OFF || value == MEMORY_HUD_SIMPLE || value == MEMORY_HUD_ADVANCED)
|
||||
prefs(context).edit().putString("memoryHud", value).apply()
|
||||
}
|
||||
|
||||
fun storageDiagnosticsEnabled(context: Context): Boolean =
|
||||
prefs(context).getBoolean("storageDiagnostics", false)
|
||||
|
||||
@@ -1786,16 +1829,15 @@ object SessionPrefs {
|
||||
|
||||
const val PIP_FPS = 30
|
||||
|
||||
fun compositorFpsLimit(mirrorRefreshLimit: Int, sessionLimit: Int = 0, pip: Boolean = false): Int {
|
||||
val limit = when {
|
||||
mirrorRefreshLimit <= 0 && sessionLimit <= 0 -> FPS_UNPACED
|
||||
mirrorRefreshLimit <= 0 -> sessionLimit
|
||||
sessionLimit <= 0 -> mirrorRefreshLimit
|
||||
else -> minOf(mirrorRefreshLimit, sessionLimit)
|
||||
}
|
||||
fun compositorFpsLimit(mirrorRefreshLimit: Int, sessionLimit: Int = 0, pip: Boolean = false, hostCap: Int = 0): Int {
|
||||
val limit = listOf(mirrorRefreshLimit, sessionLimit, hostCap).filter { it > 0 }.minOrNull() ?: FPS_UNPACED
|
||||
return if (pip && mirrorRefreshLimit <= 0 && (limit <= 0 || limit > PIP_FPS)) PIP_FPS else limit
|
||||
}
|
||||
|
||||
/** The per-app rate Android holds this window to (Game Mode's FPS override), or 0 when the panel's rate applies. */
|
||||
fun hostFrameCap(overrideHz: Float, panelHz: Float): Int =
|
||||
if (overrideHz > 1f && panelHz - overrideHz > 1f) Math.round(overrideHz) else 0
|
||||
|
||||
val upscalerChoices = listOf(
|
||||
2 to "Nearest", 0 to "Linear", 4 to "AMD FSR 1", 3 to "Snapdragon GSR",
|
||||
8 to "Snapdragon GSR (quality)", 7 to "NVIDIA NIS", 6 to "Sharpen only",
|
||||
@@ -2096,6 +2138,12 @@ object SessionPrefs {
|
||||
(resolutionChosen(context, SessionService.MODE_DESKTOP) || resolutionChosen(context, SessionService.MODE_DESKTOP, true))) SessionService.MODE_DESKTOP
|
||||
else prefMode(mode)
|
||||
|
||||
fun showGlassesShortcut(context: Context): Boolean = prefs(context).getBoolean("showGlassesShortcut", true)
|
||||
|
||||
fun setShowGlassesShortcut(context: Context, show: Boolean) {
|
||||
prefs(context).edit().putBoolean("showGlassesShortcut", show).apply()
|
||||
}
|
||||
|
||||
fun pipAutoEnter(context: Context): Boolean = prefs(context).getBoolean("pipAutoEnter", true)
|
||||
|
||||
fun setPipAutoEnter(context: Context, enabled: Boolean) {
|
||||
|
||||
@@ -47,7 +47,6 @@ import com.droiddeck.launcher.input.SteamControllerBle
|
||||
import com.droiddeck.launcher.runtime.BwrapSpawner
|
||||
import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.ProotFastPath
|
||||
import com.droiddeck.launcher.runtime.UserApps
|
||||
import com.droiddeck.launcher.wayland.WaylandCompositor
|
||||
import java.io.File
|
||||
@@ -523,7 +522,6 @@ class SessionService : Service() {
|
||||
val runtimeDir = File(filesDir, ".wayland-rt").apply { mkdirs() }
|
||||
killStragglers()
|
||||
val stillStarting = { gen == sessionGen && SessionState.running }
|
||||
val prootPack = LinuxRuntime.patchedProot(this) || AddonPack.PROOT.await(this, stillStarting)
|
||||
val directAudioPack = AddonPack.DIRECTAUDIO.await(this, stillStarting)
|
||||
val systemVulkan = SystemVulkanDriver.usesDefault(SessionPrefs.linuxDriver(this))
|
||||
val powerVrPack = !systemVulkan || (stillStarting() && AddonPack.POWERVR.await(this, stillStarting))
|
||||
@@ -544,17 +542,6 @@ class SessionService : Service() {
|
||||
Toast.makeText(this, R.string.session_directaudio_missing, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
if (!LinuxRuntime.patchedProot(this)) {
|
||||
if (LinuxRuntime.stockProotAllowed(this)) {
|
||||
Log.w(TAG, "proot: patched proot missing; droiddeck-stock-proot allows the rootfs copy")
|
||||
} else {
|
||||
val message = getString(R.string.session_proot_missing)
|
||||
Log.e(TAG, "$message (pack ready=$prootPack)")
|
||||
failSession(gen, "PROOT_MISSING", message, -1)
|
||||
stopSession(-1, gen)
|
||||
return
|
||||
}
|
||||
}
|
||||
val agentEnvironment = runCatching { com.droiddeck.launcher.agent.AgentEnv.beginSession(this) }
|
||||
.onFailure { Log.w(TAG, "agent environment skipped", it) }
|
||||
.getOrDefault(emptyList())
|
||||
@@ -603,11 +590,6 @@ class SessionService : Service() {
|
||||
return
|
||||
}
|
||||
val sessionLog = File(sessionDir, "session.log")
|
||||
val prootLine = "== proot: ${LinuxRuntime.prootBinary(this).path} (${LinuxRuntime.prootSource(this)})"
|
||||
Log.i(TAG, prootLine)
|
||||
runCatching { sessionLog.appendText(prootLine + "\n") }
|
||||
.onFailure { Log.w(TAG, "could not write the proot line to ${sessionLog.path}", it) }
|
||||
|
||||
Log.i(TAG, SessionEvents.step("gpu-clock-pin") { GpuClockPin.start(this) })
|
||||
Log.i(TAG, SessionEvents.step("thread-hints") { GameThreadHints.start(this) })
|
||||
|
||||
@@ -632,7 +614,6 @@ class SessionService : Service() {
|
||||
return
|
||||
}
|
||||
if (steamHere) guest.add("DD_EPIC_APP_ID=" + com.droiddeck.launcher.stores.epic.EpicClient.shortcutAppId)
|
||||
val fastPathAt = guest.size
|
||||
|
||||
val pulse = SessionEvents.step("audio") { startAudio(guest, sessionDir, directAudioPack) }
|
||||
SessionEvents.step("vk-bridge") { startVkBridge(guest, sessionDir) }
|
||||
@@ -661,7 +642,7 @@ class SessionService : Service() {
|
||||
Log.i(TAG, "game resolution: ${w}x$h on a ${size.first}x${size.second} output")
|
||||
}
|
||||
if (SessionState.followScreen || size.first < size.second ||
|
||||
SessionPrefs.orientation(this) == android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER)
|
||||
SessionPrefs.orientation(this, SessionState.mode) == android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER)
|
||||
guest.add("DD_FOLLOW_OUTPUT=1")
|
||||
if (SessionState.hdr) {
|
||||
guest.add("DD_HDR=1")
|
||||
@@ -705,10 +686,25 @@ class SessionService : Service() {
|
||||
if (com.droiddeck.launcher.gpu.Lossless.owned(this)) guest.add("DD_LOSSLESS_OWNED=1")
|
||||
}
|
||||
guest.add("DD_LAUNCH_DIR=" + sessionRoot.path)
|
||||
// this session's worker number: the shared field may be a newer session's by the time it is used
|
||||
var ownWorkers = 0
|
||||
if (com.droiddeck.launcher.runtime.GuestWorkers.enabled(this)) {
|
||||
// Under the lock a stop takes its number with: a stop either comes first (and this session
|
||||
// starts no workers) or owns them
|
||||
ownWorkers = synchronized(stopLock) {
|
||||
if (gen != sessionGen || !SessionState.running) 0
|
||||
else com.droiddeck.launcher.runtime.GuestWorkers.serve(this).also { guestWorkerSession = it }
|
||||
}
|
||||
if (ownWorkers > 0) {
|
||||
guest.add("DD_SPAWN=" + com.droiddeck.launcher.runtime.GuestWorkers.socketName(this))
|
||||
guest.add("DD_SPAWN_SESSION=$ownWorkers")
|
||||
}
|
||||
}
|
||||
// Proton builds up to 11.12 report X11 text fields under this name.
|
||||
guest.add("BL_LAUNCH_DIR=" + sessionRoot.path)
|
||||
GameStorage.effective(this)?.let { guest.add("DD_LIBRARY_LABEL=" + it.label.replace('"', ' ')) }
|
||||
if (SessionState.mode == MODE_STEAM && SessionState.steamUi == "desktop") guest.add("DD_STEAM_UI=desktop")
|
||||
if (SessionPrefs.desktopAsUser(this)) guest.add("DD_DESKTOP_USER=1")
|
||||
// Detailed graphics logs: per-game logs and the guest's Vulkan summary (a GPU that is not
|
||||
// an Adreno, or Setup's switch), and graphics-report.txt for every session.
|
||||
if (GraphicsReport.detailed(this)) guest.add("DD_GAME_LOGS=1")
|
||||
@@ -744,63 +740,27 @@ class SessionService : Service() {
|
||||
SessionEvents.step("shm-clear") { FileUtils.clear(File(LinuxRuntime.liveDir(this), "shm")) }
|
||||
|
||||
val sharedStorage = LinuxRuntime.sharedStorage(this)
|
||||
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sessionRoot, runtimeDir, sharedStorage)
|
||||
val nativeUserland = com.droiddeck.launcher.runtime.NativeGuest.enabled(this)
|
||||
val binds = sessionBinds(controllersOn, fakeInputDir, sessionDir, guest, sharedStorage)
|
||||
if (!com.droiddeck.launcher.runtime.NativeGuest.available(root)) {
|
||||
val message = getString(R.string.session_native_missing)
|
||||
failSession(gen, "NATIVE_RUNTIME_MISSING", message, -1)
|
||||
stopSession(-1, gen)
|
||||
abandonStart(gen, sessionDir)
|
||||
return
|
||||
}
|
||||
synchronized(stopLock) {
|
||||
if (gen == sessionGen && SessionState.running) com.droiddeck.launcher.runtime.NativeGuest.sessionMode = nativeUserland
|
||||
if (gen == sessionGen && SessionState.running) com.droiddeck.launcher.runtime.NativeGuest.sessionPrepared = true
|
||||
}
|
||||
val fastPathKey = if (ProotFastPath.enabled(this)) {
|
||||
val prootBinds = LinuxRuntime.binds(
|
||||
this, sessionRoot, runtimeDir, sharedStorage, binds,
|
||||
)
|
||||
val root = LinuxRuntime.rootDir(this)
|
||||
ProotFastPath.key(root, prootBinds)?.also { key ->
|
||||
val env = ProotFastPath.guestEnv(root, prootBinds, key)
|
||||
guest.addAll(fastPathAt, env)
|
||||
shellGuest.addAll(fastPathAt, env)
|
||||
Log.i(TAG, "proot: fast path on (${prootBinds.size} binds)")
|
||||
} ?: run {
|
||||
Log.w(TAG, "proot: fast path off - ${prootBinds.size} binds (it holds ${ProotFastPath.MAX_BINDS}) or a path it cannot be told")
|
||||
null
|
||||
}
|
||||
} else null
|
||||
|
||||
val sessionBindSpecs = LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds)
|
||||
val command = if (nativeUserland) {
|
||||
LinuxRuntime.rememberSessionBinds(sessionBindSpecs)
|
||||
com.droiddeck.launcher.runtime.NativeGuest.command(root, guest.first(), guest.drop(1))
|
||||
} else {
|
||||
LinuxRuntime.command(this, sessionRoot, runtimeDir, sharedStorage, binds, guest)
|
||||
}
|
||||
|
||||
val prootEnv = HostEnvironment()
|
||||
prootEnv["PROOT_LOADER"] = LinuxRuntime.prootLoader(this).path
|
||||
prootEnv["PROOT_TMP_DIR"] = LinuxRuntime.prootTempDir(this).path
|
||||
if (SessionPrefs.prootNoSeccomp(this)) {
|
||||
prootEnv["PROOT_NO_SECCOMP"] = "1"
|
||||
if (!nativeUserland) Log.i(TAG, "proot: seccomp acceleration off by request")
|
||||
}
|
||||
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (k, v) -> prootEnv[k] = v } }
|
||||
for (key in listOf("PROOT_PROFILE", "PROOT_PROFILE_SLOW_US")) {
|
||||
guest.lastOrNull { it.startsWith("$key=") }?.substringAfter('=')?.let { prootEnv[key] = it }
|
||||
}
|
||||
val prootLibs = LinuxRuntime.prootLibraryPath(this)
|
||||
if (prootLibs.isNotEmpty()) prootEnv["LD_LIBRARY_PATH"] = prootLibs
|
||||
|
||||
LinuxRuntime.rememberSessionBinds(sessionBindSpecs)
|
||||
val drives = com.droiddeck.launcher.runtime.NativeGuest.relinkPrefixDrives(root, sessionBindSpecs)
|
||||
if (drives > 0) Log.i(TAG, "$drives Wine drive links given their guest paths back")
|
||||
val hostEnv = if (nativeUserland) HostEnvironment().also { env ->
|
||||
Log.i(TAG, "native userland: no proot (${sessionBindSpecs.size} mounts)")
|
||||
val command = com.droiddeck.launcher.runtime.NativeGuest.command(root, guest.first(), guest.drop(1))
|
||||
val hostEnv = HostEnvironment().also { env ->
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, guest.first(), SessionPrefs.guestHostname(this))
|
||||
.forEach { (k, v) -> env[k] = v }
|
||||
} else prootEnv
|
||||
|
||||
// The terminal and the bottom desktop run the way the session does: without proot when it does
|
||||
val terminalCommand = if (nativeUserland) {
|
||||
com.droiddeck.launcher.runtime.NativeGuest.command(root, shellGuest.first(), shellGuest.drop(1))
|
||||
} else {
|
||||
LinuxRuntime.command(this, sessionRoot, runtimeDir, sharedStorage, binds, shellGuest)
|
||||
}
|
||||
val terminalCommand = com.droiddeck.launcher.runtime.NativeGuest.command(root, shellGuest.first(), shellGuest.drop(1))
|
||||
val terminalHostEnvironment = LinkedHashMap(System.getenv())
|
||||
hostEnv.asArray().forEach { entry ->
|
||||
val separator = entry.indexOf('=')
|
||||
@@ -808,9 +768,7 @@ class SessionService : Service() {
|
||||
}
|
||||
if (gen == sessionGen && SessionState.running) {
|
||||
SessionTerminal.prepare(terminalCommand, terminalHostEnvironment.map { (key, value) -> "$key=$value" }.toTypedArray(), root, gen)
|
||||
val (fastPathName, _) = ProotFastPath.hostEnv("")
|
||||
BottomDesktop.prepare(desktopGuest, binds, sessionRoot,
|
||||
prootEnv.asArray().filterNot { it.startsWith("$fastPathName=") }.toTypedArray(), root, sessionDir, gen, nativeUserland, sharedStorage,
|
||||
BottomDesktop.prepare(desktopGuest, binds, sessionRoot, root, sessionDir, gen, sharedStorage,
|
||||
) { gen == sessionGen && SessionState.running }
|
||||
}
|
||||
|
||||
@@ -863,15 +821,15 @@ class SessionService : Service() {
|
||||
watchLaunchRequests(sessionRoot)
|
||||
watchSyncWanted(root)
|
||||
EsyncPacks.fetchInBackground(this, root)
|
||||
val pid = SessionEvents.step("guest-launch") { HostProcess.start(line, hostEnv.asArray(), root, { status ->
|
||||
val pid = SessionEvents.step("guest-launch") { HostProcess.startUncounted(line, hostEnv.asArray(), root, { status ->
|
||||
if (gen != sessionGen) {
|
||||
Log.i(TAG, "an earlier session's process ended ($status); the current one carries on")
|
||||
return@start
|
||||
return@startUncounted
|
||||
}
|
||||
val program = programStatus(sessionRoot)
|
||||
Log.i(TAG, "session ended: $status" + if (program != null) " (program $program)" else "")
|
||||
stopSession(program ?: status ?: -1, gen)
|
||||
}, null, sessionLog.takeIf { "PROOT_PROFILE=1" in hostEnv.asArray() }) }
|
||||
}, null, null) }
|
||||
Log.i(TAG, "session pid $pid, log ${sessionLog.path}")
|
||||
if (gen != sessionGen || !SessionState.running) {
|
||||
Log.i(TAG, "session stopped while its guest was starting; taking it down")
|
||||
@@ -882,12 +840,21 @@ class SessionService : Service() {
|
||||
syncWatcher = null
|
||||
}
|
||||
abandonStart(gen, sessionDir, started)
|
||||
if (pid > 1) Thread({ teardown(pid) }, "session-teardown").start()
|
||||
val workers = ownWorkers
|
||||
if (pid > 1) Thread({ teardown(pid, workerSession = workers) }, "session-teardown").start()
|
||||
else com.droiddeck.launcher.runtime.GuestWorkers.stopGuests(workers)
|
||||
return
|
||||
}
|
||||
sessionPid = pid
|
||||
// Under the lock Stop clears it with, and only while this session still runs: a Stop since the
|
||||
// check above has cleared it already, and this would set it again for no running session.
|
||||
val uncounted = com.droiddeck.launcher.runtime.GuestWorkers.runsInWorker(pid)
|
||||
SessionEvents.record("guest.worker", mapOf("handoff" to uncounted))
|
||||
synchronized(stopLock) {
|
||||
if (gen == sessionGen && SessionState.running)
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.sessionRootUncounted = uncounted
|
||||
}
|
||||
if (pid > 1) {
|
||||
raiseTracer(pid, gen)
|
||||
SessionEvents.guestStarted(pid)
|
||||
} else {
|
||||
SessionEvents.record("guest.start_failed", mapOf("pid" to pid))
|
||||
@@ -1256,8 +1223,6 @@ class SessionService : Service() {
|
||||
fakeInputDir: File,
|
||||
sessionDir: File,
|
||||
guest: MutableList<String>,
|
||||
sessionRoot: File,
|
||||
runtimeDir: File,
|
||||
sharedStorage: File?,
|
||||
): ArrayList<String> {
|
||||
val binds = ArrayList<String>()
|
||||
@@ -1385,9 +1350,6 @@ class SessionService : Service() {
|
||||
if (storageDiagnosticLibrary != null && library != null) libraries.add(SecondaryLibrary.CARD_GUESTS[0] to library.label)
|
||||
val gamesLibraries = GameStorage.gamesFolderLibraries(this)
|
||||
if (gamesLibraries.isNotEmpty()) {
|
||||
var room = if (ProotFastPath.enabled(this)) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
for (games in gamesLibraries) {
|
||||
if (games.host.path + ":" + games.guest !in binds) continue
|
||||
val problem = GameStorage.prepare(this, games.host.path)
|
||||
@@ -1397,12 +1359,7 @@ class SessionService : Service() {
|
||||
}
|
||||
try {
|
||||
val extra = SecondaryLibrary.binds(filesDir, games.host, listOf(games.guest)).drop(1)
|
||||
if (extra.size > room) {
|
||||
Log.w(TAG, "steam library: ${games.host} needs ${extra.size} binds, $room left for the fast path; not a library this session")
|
||||
continue
|
||||
}
|
||||
binds.addAll(extra)
|
||||
room -= extra.size
|
||||
libraries.add(games.guest to games.label)
|
||||
Log.i(TAG, "steam library: ${games.host} -> ${games.guest} (\"${games.label}\")")
|
||||
} catch (e: Exception) {
|
||||
@@ -1427,15 +1384,8 @@ class SessionService : Service() {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
val room = if (ProotFastPath.enabled(this)) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
val content = SecondaryLibrary.contentPath(entry.host)
|
||||
val extra = SecondaryLibrary.binds(filesDir, entry.host, listOf(entry.guest), content = content)
|
||||
if (extra.size > room) {
|
||||
Log.w(TAG, "added steam library: ${entry.path} needs ${extra.size} binds, $room left for the fast path; not a library this session")
|
||||
continue
|
||||
}
|
||||
File(LinuxRuntime.rootDir(this), entry.guest.removePrefix("/")).mkdirs()
|
||||
binds.addAll(extra)
|
||||
libraries.add(entry.guest to entry.label)
|
||||
@@ -1456,17 +1406,10 @@ class SessionService : Service() {
|
||||
if (problem != null) {
|
||||
Log.w(TAG, "x86-64 steam library: $problem")
|
||||
} else try {
|
||||
val room = if (ProotFastPath.enabled(this)) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
val extra = SecondaryLibrary.binds(filesDir, x64, listOf(GameStorage.X64_CARD_GUEST)).drop(1)
|
||||
if (extra.size > room) {
|
||||
Log.w(TAG, "x86-64 steam library: $x64 needs ${extra.size} binds, $room left for the fast path; not a library this session")
|
||||
} else {
|
||||
binds.addAll(extra)
|
||||
x64Libraries.put(org.json.JSONObject().put("path", GameStorage.X64_CARD_GUEST).put("label", library.label.replace('"', ' ').replace('\\', ' ')))
|
||||
Log.i(TAG, "x86-64 steam library: $x64 -> ${GameStorage.X64_CARD_GUEST} (\"${library.label}\")")
|
||||
}
|
||||
binds.addAll(extra)
|
||||
x64Libraries.put(org.json.JSONObject().put("path", GameStorage.X64_CARD_GUEST).put("label", library.label.replace('"', ' ').replace('\\', ' ')))
|
||||
Log.i(TAG, "x86-64 steam library: $x64 -> ${GameStorage.X64_CARD_GUEST} (\"${library.label}\")")
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "x86-64 steam library: $x64 private directories could not be prepared", e)
|
||||
}
|
||||
@@ -1478,14 +1421,7 @@ class SessionService : Service() {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
val room = if (ProotFastPath.enabled(this)) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
val extra = SecondaryLibrary.binds(filesDir, entry.x64Host, listOf(entry.x64Guest)).drop(1)
|
||||
if (extra.size > room) {
|
||||
Log.w(TAG, "x86-64 steam library: ${entry.x64Host} needs ${extra.size} binds, $room left for the fast path; not a library this session")
|
||||
continue
|
||||
}
|
||||
binds.addAll(extra)
|
||||
x64Libraries.put(org.json.JSONObject().put("path", entry.x64Guest).put("label", entry.label))
|
||||
} catch (e: Exception) {
|
||||
@@ -1514,15 +1450,11 @@ class SessionService : Service() {
|
||||
try {
|
||||
val listing = File(filesDir, "session/desktop-volumes.json").apply { parentFile?.mkdirs() }
|
||||
val volumes = org.json.JSONArray()
|
||||
var room = if (ProotFastPath.enabled(this)) {
|
||||
ProotFastPath.MAX_BINDS - LinuxRuntime.binds(this, sessionRoot, runtimeDir, sharedStorage, binds).size
|
||||
} else Int.MAX_VALUE
|
||||
for (root in com.droiddeck.launcher.files.StorageRoots.list(this)) {
|
||||
if (!root.removable || !root.readable) continue
|
||||
val path = root.dir.absolutePath
|
||||
if (':' in path || '|' in path || room <= 0) continue
|
||||
if (':' in path || '|' in path) continue
|
||||
binds.add(path)
|
||||
room--
|
||||
volumes.put(org.json.JSONObject().put("path", path).put("label", root.label))
|
||||
}
|
||||
listing.writeText(volumes.toString())
|
||||
@@ -1535,17 +1467,22 @@ class SessionService : Service() {
|
||||
return binds
|
||||
}
|
||||
|
||||
private fun teardown(prootPid: Int, expectedStartTime: Long? = null) {
|
||||
fun stillSameProcess(): Boolean = expectedStartTime == null || readStat(prootPid)?.second == expectedStartTime
|
||||
// The workers' session number of the session running now (GuestWorkers.serve)
|
||||
@Volatile private var guestWorkerSession = 0
|
||||
|
||||
private fun teardown(guestPid: Int, expectedStartTime: Long? = null, workerSession: Int = guestWorkerSession) {
|
||||
fun stillSameProcess(): Boolean = expectedStartTime == null || readStat(guestPid)?.second == expectedStartTime
|
||||
if (!stillSameProcess()) return
|
||||
val tree = descendants(prootPid)
|
||||
// The session's programs that run in worker processes are not descendants of its root.
|
||||
val workers = if (expectedStartTime == null) com.droiddeck.launcher.runtime.GuestWorkers.guestPids(workerSession) else emptyList()
|
||||
val tree = descendants(guestPid) + workers.flatMap { pid -> listOfNotNull(readStat(pid)?.let { Pair(pid, it.second) }) + descendants(pid) }
|
||||
if (!stillSameProcess()) return
|
||||
saveWineRegistries(tree)
|
||||
android.os.Process.sendSignal(prootPid, 15)
|
||||
if (!waitForExit(prootPid, GRACE_MS)) {
|
||||
android.os.Process.sendSignal(guestPid, 15)
|
||||
if (!waitForExit(guestPid, GRACE_MS)) {
|
||||
if (!stillSameProcess()) return
|
||||
Log.w(TAG, "proot $prootPid did not exit on SIGTERM; killing it")
|
||||
android.os.Process.killProcess(prootPid)
|
||||
Log.w(TAG, "guest $guestPid did not exit on SIGTERM; killing it")
|
||||
android.os.Process.killProcess(guestPid)
|
||||
}
|
||||
var killed = 0
|
||||
for ((pid, started) in tree) {
|
||||
@@ -1554,7 +1491,8 @@ class SessionService : Service() {
|
||||
android.os.Process.killProcess(pid)
|
||||
killed++
|
||||
}
|
||||
if (killed > 0) Log.i(TAG, "swept $killed process(es) proot left behind")
|
||||
if (killed > 0) Log.i(TAG, "swept $killed guest process(es)")
|
||||
if (expectedStartTime == null) com.droiddeck.launcher.runtime.GuestWorkers.stopGuests(workerSession)
|
||||
}
|
||||
|
||||
private fun clearCachedApps() {
|
||||
@@ -1614,8 +1552,8 @@ class SessionService : Service() {
|
||||
return try { Pair(fields[1].toInt(), fields[19].toLong()) } catch (e: NumberFormatException) { null }
|
||||
}
|
||||
|
||||
private fun askSteamToExit(prootPid: Int) {
|
||||
if (!File("/proc/$prootPid").exists()) return
|
||||
private fun askSteamToExit(guestPid: Int) {
|
||||
if (!File("/proc/$guestPid").exists()) return
|
||||
val request = File(LinuxRuntime.sessionRoot(this), "steam-stop")
|
||||
try {
|
||||
request.writeText("")
|
||||
@@ -1624,11 +1562,11 @@ class SessionService : Service() {
|
||||
return
|
||||
}
|
||||
val started = System.currentTimeMillis()
|
||||
if (waitForExit(prootPid, STEAM_PICKUP_MS) || request.exists()) {
|
||||
if (waitForExit(guestPid, STEAM_PICKUP_MS) || request.exists()) {
|
||||
request.delete()
|
||||
return
|
||||
}
|
||||
val exited = waitForExit(prootPid, STEAM_EXIT_MS)
|
||||
val exited = waitForExit(guestPid, STEAM_EXIT_MS)
|
||||
Log.i(TAG, "Steam client ${if (exited) "exited" else "did not exit"} after ${System.currentTimeMillis() - started} ms")
|
||||
}
|
||||
|
||||
@@ -1729,6 +1667,7 @@ class SessionService : Service() {
|
||||
SessionEvents.record("steam.game_launch_requested", mapOf("gameId" to gameId, "generation" to gen))
|
||||
watchGameExit(gameId, gen, exitWatchToken, pendingSteamPreviousGameId)
|
||||
Log.i(TAG, "queued Steam game $gameId for the running client")
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.expectLaunch(this)
|
||||
}
|
||||
|
||||
private fun watchGameExit(
|
||||
@@ -1906,7 +1845,7 @@ class SessionService : Service() {
|
||||
val rootfs = try { File(filesDir, "linuxfs").canonicalPath } catch (e: Exception) { return } + "/"
|
||||
val leftovers = GuestLeftovers.find(rootfs, ended, OrphanReaper.spared() + android.os.Process.myPid())
|
||||
leftovers.forEach { android.os.Process.killProcess(it) }
|
||||
if (leftovers.isNotEmpty()) Log.w(TAG, "killed ${leftovers.size} guest process(es) proot no longer tracked")
|
||||
if (leftovers.isNotEmpty()) Log.w(TAG, "killed ${leftovers.size} guest process(es)")
|
||||
}
|
||||
|
||||
private fun killStragglers() {
|
||||
@@ -2295,24 +2234,6 @@ class SessionService : Service() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun raiseTracer(pid: Int, gen: Int) {
|
||||
Thread({
|
||||
try {
|
||||
Thread.sleep(2000)
|
||||
} catch (e: InterruptedException) {
|
||||
return@Thread
|
||||
}
|
||||
if (gen != sessionGen || sessionPid != pid) return@Thread
|
||||
val nice = try {
|
||||
WaylandCompositor.nativeRaisePriority(pid, TRACER_NICE)
|
||||
} catch (t: Throwable) {
|
||||
Log.w(TAG, "tracer priority", t)
|
||||
return@Thread
|
||||
}
|
||||
Log.i(TAG, "proot tracer $pid: nice $nice (asked for $TRACER_NICE)")
|
||||
}, "tracer-priority").start()
|
||||
}
|
||||
|
||||
private fun failSession(gen: Int, code: String, message: String, status: Int?) {
|
||||
synchronized(stopLock) {
|
||||
if (gen == sessionGen) SessionEvents.fail(code, message, status)
|
||||
@@ -2325,12 +2246,16 @@ class SessionService : Service() {
|
||||
return
|
||||
}
|
||||
completeNativeSleep()
|
||||
var workers = 0
|
||||
val (ended, endedArch) = synchronized(stopLock) {
|
||||
if (gen != null && gen != sessionGen) return
|
||||
// as it is when running is cleared: startup registers its workers under this lock too
|
||||
workers = guestWorkerSession
|
||||
cancelQueuedSteamGame()
|
||||
gameExitWatchToken++
|
||||
// also when startup stopped before the guest ran
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionMode = null
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionPrepared = false
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.sessionRootUncounted = null
|
||||
if (!SessionState.running) return
|
||||
if (relaunch) SessionState.confirmRelaunchStop()
|
||||
SessionEvents.record("guest.exited", mapOf("status" to status))
|
||||
@@ -2358,7 +2283,7 @@ class SessionService : Service() {
|
||||
launchWatcher = null
|
||||
syncWatcher?.stopWatching()
|
||||
syncWatcher = null
|
||||
val prootPid = sessionPid
|
||||
val guestPid = sessionPid
|
||||
sessionPid = -1
|
||||
// The kept shell goes through the same teardown, which reads its descendants before signalling it.
|
||||
val shell = SessionTerminal.detach(sessionGen)?.let { pid -> readStat(pid)?.second?.let { pid to it } }
|
||||
@@ -2386,12 +2311,13 @@ class SessionService : Service() {
|
||||
com.droiddeck.launcher.input.SteamTouchDevice.release()
|
||||
val steamClientMayRun = SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP
|
||||
val finishAfterTeardown: () -> Unit = {
|
||||
if (prootPid > 1 || auxiliary.isNotEmpty()) {
|
||||
if (guestPid > 1 || auxiliary.isNotEmpty()) {
|
||||
Thread({
|
||||
if (prootPid > 1 && steamClientMayRun) askSteamToExit(prootPid)
|
||||
if (guestPid > 1 && steamClientMayRun) askSteamToExit(guestPid)
|
||||
com.droiddeck.launcher.stores.gog.GogComet.end(stoppedSession)
|
||||
auxiliary.forEach { (pid, started) -> teardown(pid, started) }
|
||||
if (prootPid > 1) teardown(prootPid)
|
||||
if (guestPid > 1) teardown(guestPid, workerSession = workers)
|
||||
else com.droiddeck.launcher.runtime.GuestWorkers.stopGuests(workers)
|
||||
killGuestLeftovers(ended)
|
||||
pruneSystemVulkanRuntime()
|
||||
finishSessionStop(status, stoppedGen, collectEnded)
|
||||
@@ -2400,13 +2326,14 @@ class SessionService : Service() {
|
||||
} else {
|
||||
Thread({ pruneSystemVulkanRuntime() }, "system-vulkan-prune").start()
|
||||
Thread({
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.stopGuests(workers)
|
||||
com.droiddeck.launcher.stores.gog.GogComet.end(stoppedSession)
|
||||
finishSessionStop(status, stoppedGen, collectEnded)
|
||||
if (launcherEnded) importLauncherGames()
|
||||
}, "gog-session-stop").start()
|
||||
}
|
||||
}
|
||||
if (prootPid > 1) acquireLocks()
|
||||
if (guestPid > 1) acquireLocks()
|
||||
if (controller != null) controller.closeAndResume(finishAfterTeardown) else finishAfterTeardown()
|
||||
}
|
||||
|
||||
@@ -2650,7 +2577,6 @@ class SessionService : Service() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SessionService"
|
||||
private const val TRACER_NICE = -6
|
||||
private const val MIC_RELEASE_TIMEOUT_MS = 5_000L
|
||||
private const val TU_DEBUG_SWITCH = "Download/droiddeck-tu-debug"
|
||||
private const val GAME_PREFIX = "DROIDDECK_GAME_"
|
||||
@@ -2690,7 +2616,7 @@ class SessionService : Service() {
|
||||
private const val ACTION_AUXILIARY_EXITED = "com.droiddeck.launcher.AUXILIARY_EXITED"
|
||||
private const val EXTRA_AUXILIARY_PID = "auxiliaryPid"
|
||||
private val STRAGGLERS = listOf("droiddeck-session", "gamescope", "Xwayland", "steamrtarm64",
|
||||
"steamwebhelper", "linuxfs/opt/android-host/proot", "/libproot.so", "pulseaudio/libpulseaudio.so")
|
||||
"steamwebhelper", "pulseaudio/libpulseaudio.so")
|
||||
private const val GRACE_MS = 1200L
|
||||
private const val WINE_SAVE_MS = 3000L
|
||||
private const val STEAM_PICKUP_MS = 1500L
|
||||
|
||||
@@ -18,11 +18,11 @@ object SettingsReset {
|
||||
"storesInstallLanguage",
|
||||
"hud", "hudDeck", "hudFps", "hudBattery", "hudGraph", "hudColor", "hudOpacity", "__KEEP_droidDeckHud__", "__KEEP_droidDeckHudPos__", "backHold", "dockedMenuController", "backActionsInverted", "backDoubleTapMs", "touch", "pen", "penButton", "osc", "shape", "steamController",
|
||||
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "unfoldedControlsWithController",
|
||||
"stretch16x9", "avoidNotch", "picturePosition", "integerScaling", "railLabels", "developerTools", "navTabOrder", "navTabShelved", "navTabHidden", "drawerPageOrder", "drawerPageHidden", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys",
|
||||
"stretch16x9", "avoidNotch", "picturePosition", "integerScaling", "railLabels", "developerTools", "navTabOrder", "navTabShelved", "navTabHidden", "drawerPageOrder", "drawerPageHidden", "drawerSections", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys",
|
||||
"gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop",
|
||||
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "paceCores",
|
||||
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
|
||||
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite", "mountSharedStorage",
|
||||
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "cursorComposite", "mountSharedStorage",
|
||||
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
|
||||
"upscaler", "upscaleSharpness", "screenEffects", "blackFrameInsertion", "textureAnisotropy", "textureLodBias",
|
||||
"steamDownloadsInBackground", "steam_offline", "steam_offline_auto", "steam_offline_by_network", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
|
||||
|
||||
@@ -12,8 +12,6 @@ import org.json.JSONObject
|
||||
/** Steam libraries the user added beside the internal one and the card library, each a folder of its own. */
|
||||
object SteamLibraries {
|
||||
const val GUEST_ROOT = "/mnt/droiddeck-lib"
|
||||
// Each library costs a bind per redirected tool and prefix folder; the PRoot fast path holds 256 in all.
|
||||
const val MAX = 4
|
||||
private val lock = Any()
|
||||
|
||||
class Entry(val id: String, val path: String, val label: String) {
|
||||
@@ -52,7 +50,6 @@ object SteamLibraries {
|
||||
|
||||
fun add(context: Context, picked: String, label: String? = null): AddResult {
|
||||
val entries = list(context)
|
||||
if (entries.size >= MAX) return AddResult.Refused(context.getString(R.string.libraries_full, MAX))
|
||||
val path = innerLibrary(File(picked))?.path ?: picked
|
||||
val host = canonical(File(path))
|
||||
if (taken(context, entries).any { overlaps(it, host) }) return AddResult.Refused(context.getString(R.string.libraries_overlap))
|
||||
@@ -61,7 +58,6 @@ object SteamLibraries {
|
||||
GameStorage.prepare(context, path)?.let { return AddResult.Refused(it) }
|
||||
synchronized(lock) {
|
||||
val current = list(context)
|
||||
if (current.size >= MAX) return AddResult.Refused(context.getString(R.string.libraries_full, MAX))
|
||||
if (current.any { overlaps(canonical(it.host), host) }) return AddResult.Refused(context.getString(R.string.libraries_overlap))
|
||||
// A removed library's mount stays registered with Steam until its next session, so ids are never reused.
|
||||
val next = maxOf(SessionPrefs.steamLibraryNextId(context), (current.maxOfOrNull { it.id.toInt() } ?: 0) + 1)
|
||||
|
||||
@@ -10,9 +10,23 @@ import java.io.File
|
||||
// browser view placed outside the Big Picture window, composition capped at "notification" so gamescope keeps the game
|
||||
// focused, and gamepad focus on the main UI. The hold is a lease the app renews, so Steam recovers if the app goes away.
|
||||
object SteamQam {
|
||||
data class Target(val port: Int, val path: String)
|
||||
/** [mainPath] is Steam's main menu page, shown beside the quick access menu in the split layout. */
|
||||
data class Target(val port: Int, val path: String, val mainPath: String? = null)
|
||||
|
||||
const val MAIN_MENU = 1
|
||||
const val QUICK_ACCESS = 2
|
||||
|
||||
/** Height in CSS pixels both menus are laid out at in the split layout, so they show at one scale. */
|
||||
const val SPLIT_CSS_HEIGHT = 480
|
||||
|
||||
/** Steam's own width for the main menu; quick access takes the rest of the panel. */
|
||||
const val MAIN_CSS_WIDTH = 240
|
||||
|
||||
/** Holds the parked main menu in place and spreads its item rows (not dividers) over the full height, at most 80 px each. */
|
||||
private const val MAIN_PARKED_CSS =
|
||||
".BasicUI > .Panel { transform: none !important; width: 100% !important; height: 100% !important; margin: 0 !important; } " +
|
||||
".BasicUI > .Panel > :has(> .Focusable) { flex: 1 1 0 !important; height: auto !important; max-height: 80px; } " +
|
||||
".BasicUI > .Panel > :has(> .Focusable) > .Panel { height: 100% !important; }"
|
||||
const val LEASE_MS = 5_000
|
||||
private const val TAG = "SteamQam"
|
||||
private const val EVAL_MS = 6_000L
|
||||
@@ -26,21 +40,54 @@ object SteamQam {
|
||||
* Takes or renews the lease for [owner], or releases it. A live lease held by a newer panel is never taken back by an
|
||||
* older one, so a late request from a panel being torn down cannot end its replacement's lease or change its layout.
|
||||
*/
|
||||
internal fun leaseScript(on: Boolean, owner: Long, aspect: Float = 0f): String =
|
||||
internal fun leaseScript(on: Boolean, owner: Long, aspect: Float = 0f, split: Boolean = false): String =
|
||||
if (on) "if (!(g.__ddQamUntil > Date.now()) || !(g.__ddQamOwner > $owner)) { g.__ddQamOwner = $owner; g.__ddQamUntil = Date.now() + $LEASE_MS;" +
|
||||
(if (aspect > 0f) " g.__ddQamAspect = $aspect;" else "") + " }"
|
||||
(if (aspect > 0f) " g.__ddQamAspect = $aspect;" else "") + " g.__ddQamSplit = $split; }"
|
||||
else "if (g.__ddQamOwner === $owner) g.__ddQamUntil = 0;"
|
||||
|
||||
/** [aspect] is the panel's width over height: the menu is laid out at that shape so every tab shows at one scale. */
|
||||
internal fun script(on: Boolean, aspect: Float = 0f, owner: Long = 0): String = """(() => {
|
||||
const g = globalThis, QAM = 2;
|
||||
/**
|
||||
* [aspect] is the panel's width over height: the menu is laid out at that shape so every tab shows at one scale. With
|
||||
* [split], Steam's main menu is kept rendered at its own width beside the quick access menu, which gets the rest.
|
||||
*/
|
||||
internal fun script(on: Boolean, aspect: Float = 0f, owner: Long = 0, split: Boolean = false): String = """(() => {
|
||||
const g = globalThis, QAM = 2, MAIN = 1;
|
||||
const W = SteamUIStore.WindowStore.SteamUIWindows[0];
|
||||
const m = W.MenuStore, c = W.m_CompositionStateStore;
|
||||
const nav = W.m_FocusNavContext;
|
||||
const popup = g_PopupManager.GetExistingPopup("SP BPM_uid0");
|
||||
const held = () => g.__ddQamUntil > Date.now();
|
||||
const ours = () => held() && m.m_eOpenSideMenu === QAM && !g.__ddQamTop;
|
||||
const split = () => held() && g.__ddQamSplit === true;
|
||||
// Steam's views carry no names: the main menu's is the one Steam focuses while the main menu is open. Until Steam
|
||||
// has shown it, the main menu is opened once with its view parked like the quick access menu's.
|
||||
const probing = () => g.__ddMainProbe > Date.now();
|
||||
const ours = () => held() && !g.__ddQamTop && (m.m_eOpenSideMenu === QAM || (probing() && m.m_eOpenSideMenu === MAIN));
|
||||
const width = (h) => g.__ddQamAspect > 0 ? Math.round(h * g.__ddQamAspect) : 0;
|
||||
const parkX = () => popup.m_popup.innerWidth + 64;
|
||||
const mainSize = () => [$MAIN_CSS_WIDTH, $SPLIT_CSS_HEIGHT];
|
||||
const qamSplitSize = () => [Math.max(Math.round($SPLIT_CSS_HEIGHT * (g.__ddQamAspect > 0 ? g.__ddQamAspect : 1)) - $MAIN_CSS_WIDTH, 320), $SPLIT_CSS_HEIGHT];
|
||||
const size = (w, h) => split() ? qamSplitSize() : [width(h) || w, h];
|
||||
const mainView = () => views().find(v => v.__ddMain);
|
||||
// Only the quick access view is parked: the one Steam focuses while quick access is open. Before Steam has
|
||||
// focused it, any view but the main menu's and the header's web page (Store and other pages) may be it.
|
||||
const headerView = () => W.m_HeaderStore?.m_currentBrowserAndBackstack?.m_browserView;
|
||||
const isQam = (v) => !v.__ddMain && v !== headerView() &&
|
||||
(!!v.__ddQamView || !views().some(o => o.__ddQamView) || (probing() && m.m_eOpenSideMenu === MAIN));
|
||||
const mainParked = () => split() && (m.m_eOpenSideMenu !== MAIN || probing());
|
||||
const mainDoc = () => {
|
||||
for (const s of SteamUIStore.m_GamepadNavigationManager?.m_rgGamepadInputSources || []) {
|
||||
try { const d = s.m_targetWindow?.document; if (d?.title?.startsWith("MainMenu")) return d; } catch (e) {}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
// Steam slides the main menu out whenever it is not the open side menu; parked, it stays in place and fills its view.
|
||||
const mainStyle = (on) => {
|
||||
const d = mainDoc();
|
||||
let s = d?.getElementById("dd-main-split");
|
||||
if (!on) { s?.remove(); return; }
|
||||
if (!d?.head) return;
|
||||
if (!s) { s = d.createElement("style"); s.id = "dd-main-split"; d.head.appendChild(s); }
|
||||
if (s.textContent !== "$MAIN_PARKED_CSS") s.textContent = "$MAIN_PARKED_CSS";
|
||||
};
|
||||
if (!c.__ddQam) {
|
||||
c.__ddQam = c.ComputeOverallMinimumRequestedComposition;
|
||||
m.__ddQam = m.OnMenuDeactivated;
|
||||
@@ -59,6 +106,18 @@ object SteamQam {
|
||||
return without >= 2 ? v : 1;
|
||||
};
|
||||
}
|
||||
// Steam frosts its Store page while a side menu is open; a parked menu is not over it.
|
||||
const inst = m.m_Instance;
|
||||
if (inst?.SetStoreBrowserGlass && !inst.__ddQamGlass) {
|
||||
inst.__ddQamGlass = inst.SetStoreBrowserGlass;
|
||||
inst.SetStoreBrowserGlass = function (e) { return inst.__ddQamGlass.call(this, ours() ? 0 : e); };
|
||||
}
|
||||
const glass = () => {
|
||||
const on = !ours() && m.m_eOpenSideMenu !== 0;
|
||||
if (g.__ddQamGlassOn === on) return;
|
||||
g.__ddQamGlassOn = on;
|
||||
inst?.SetStoreBrowserGlass?.(m.m_eOpenSideMenu);
|
||||
};
|
||||
const views = () => popup?.m_rgChildBrowserViews || [];
|
||||
const backdrop = (hide) => {
|
||||
const doc = popup?.m_popup?.document;
|
||||
@@ -75,16 +134,61 @@ object SteamQam {
|
||||
};
|
||||
const keep = () => {
|
||||
for (const v of views()) {
|
||||
if (v.__ddQam) continue;
|
||||
v.__ddQam = v.SetBounds;
|
||||
if (!v.__ddQam) v.__ddQam = v.SetBounds;
|
||||
if (v.__ddQamW === 4) continue;
|
||||
v.__ddQamW = 4;
|
||||
v.__ddQamVis = v.__ddQamVis || v.SetVisible;
|
||||
v.__ddQamFocus = v.__ddQamFocus || v.SetFocus;
|
||||
v.SetBounds = function (x, y, w, h, ...r) {
|
||||
if (v.__ddMain && mainParked()) {
|
||||
if (w > 0) v.__ddMainAsked = [x, y, w, h];
|
||||
[w, h] = mainSize();
|
||||
v.__ddMainOn = true; v.__ddMainW = w; v.__ddMainH = h;
|
||||
return v.__ddQam.call(this, parkX(), 0, w, h, ...r);
|
||||
}
|
||||
if (v.__ddMain && w > 0) mainStyle(false);
|
||||
v.__ddAsked = [x, y, w, h];
|
||||
if (w > 0 && ours()) { x = popup.m_popup.innerWidth + 64; w = width(h) || w; }
|
||||
if (w > 0 && ours() && isQam(v)) { x = parkX(); [w, h] = size(w, h); }
|
||||
v.__ddAt = x;
|
||||
v.__ddW = w;
|
||||
v.__ddH = h;
|
||||
return v.__ddQam.call(this, x, y, w, h, ...r);
|
||||
};
|
||||
v.SetVisible = function (on, ...r) {
|
||||
return v.__ddQamVis.call(this, on || (!!v.__ddMain && mainParked()), ...r);
|
||||
};
|
||||
v.SetFocus = function (on, ...r) {
|
||||
if (on && m.m_eOpenSideMenu === MAIN && v !== headerView()) {
|
||||
for (const o of views()) if (o !== v) delete o.__ddMain;
|
||||
v.__ddMain = true;
|
||||
delete v.__ddQamView;
|
||||
}
|
||||
if (on && m.m_eOpenSideMenu === QAM && !v.__ddMain && v !== headerView()) {
|
||||
for (const o of views()) if (o !== v) delete o.__ddQamView;
|
||||
v.__ddQamView = true;
|
||||
}
|
||||
return v.__ddQamFocus.call(this, on, ...r);
|
||||
};
|
||||
}
|
||||
if (g.__ddMainProbe && !probing()) { g.__ddMainProbe = 0; g.__ddMainProbed = true; }
|
||||
if (probing() && mainView()) { g.__ddMainProbe = 0; g.__ddMainProbed = true; }
|
||||
const mv = mainView();
|
||||
if (mv && !probing()) {
|
||||
if (mainParked()) {
|
||||
const [w, h] = mainSize();
|
||||
if (!mv.__ddMainOn || mv.__ddMainW !== w || mv.__ddMainH !== h) {
|
||||
mv.__ddQam.call(mv, parkX(), 0, w, h);
|
||||
mv.__ddQamVis.call(mv, true);
|
||||
mv.__ddMainOn = true; mv.__ddMainW = w; mv.__ddMainH = h;
|
||||
}
|
||||
} else if (mv.__ddMainOn) {
|
||||
mv.__ddMainOn = false;
|
||||
if (m.m_eOpenSideMenu !== MAIN) { mv.__ddQamVis.call(mv, false); mv.__ddQam.call(mv, 0, 0, 0, 0); }
|
||||
else if (mv.__ddMainAsked) mv.__ddQam.call(mv, ...mv.__ddMainAsked);
|
||||
}
|
||||
}
|
||||
mainStyle(!!mv && mainParked() && !probing());
|
||||
glass();
|
||||
if (!held()) {
|
||||
const parked = !g.__ddQamTop;
|
||||
g.__ddQamTop = false;
|
||||
@@ -124,6 +228,25 @@ object SteamQam {
|
||||
}
|
||||
g.__ddQamTop = false;
|
||||
}
|
||||
// Each Split activation gets a fresh probe budget, and a spent one refills after a backoff, so a Steam that was
|
||||
// still loading does not leave the main menu undiscovered for good.
|
||||
if (split() !== !!g.__ddQamSplitOn) { g.__ddQamSplitOn = split(); if (split()) g.__ddMainProbes = 0; }
|
||||
if (split() && !mv) {
|
||||
if (probing()) return;
|
||||
if ((g.__ddMainProbes || 0) >= 3 && Date.now() - (g.__ddMainProbeLast || 0) > 30000) g.__ddMainProbes = 0;
|
||||
if ((g.__ddMainProbes || 0) < 3 && m.m_eOpenSideMenu !== MAIN) {
|
||||
g.__ddMainProbes = (g.__ddMainProbes || 0) + 1;
|
||||
g.__ddMainProbeLast = Date.now();
|
||||
g.__ddMainProbe = Date.now() + 1500;
|
||||
m.OpenMainMenu();
|
||||
c.EnsureCorrectComposition?.();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (g.__ddMainProbed) {
|
||||
g.__ddMainProbed = false;
|
||||
if (m.m_eOpenSideMenu === MAIN) m.OpenQuickAccessMenu(g.__ddQamTab ?? undefined);
|
||||
}
|
||||
const decky = !!g.DeckyPluginLoader?.tabsHook?.qamBrowserViewPatch;
|
||||
// Decky hooks the menu after Steam starts; the menu has to unmount for its tab to appear, so reopen on the next tick.
|
||||
if (m.m_eOpenSideMenu === QAM && decky && !g.__ddQamDecky) { g.__ddQamDecky = true; m.CloseSideMenus(); return; }
|
||||
@@ -136,18 +259,26 @@ object SteamQam {
|
||||
if (m.m_eQuickAccessTab != null) g.__ddQamTab = m.m_eQuickAccessTab;
|
||||
if (!g.__ddQamOn) { g.__ddQamOn = true; c.EnsureCorrectComposition?.(); }
|
||||
for (const v of views()) {
|
||||
if (v.__ddMain) continue;
|
||||
if (!isQam(v)) {
|
||||
// A view parked before the quick access view was known goes back where Steam asked for it.
|
||||
const a = v.__ddAsked;
|
||||
if (a?.[2] > 0 && v.__ddAt >= popup.m_popup.innerWidth) { v.__ddQam.call(v, ...a); v.__ddAt = a[0]; v.__ddW = a[2]; v.__ddH = a[3]; }
|
||||
continue;
|
||||
}
|
||||
if (!v.__ddAsked) {
|
||||
const b = v.GetBounds?.();
|
||||
if (b && b.width > 0) { v.__ddAsked = [b.x, b.y, b.width, b.height]; v.__ddAt = b.x; v.__ddW = b.width; }
|
||||
if (b && b.width > 0) { v.__ddAsked = [b.x, b.y, b.width, b.height]; v.__ddAt = b.x; v.__ddW = b.width; v.__ddH = b.height; }
|
||||
}
|
||||
const a = v.__ddAsked;
|
||||
if (a?.[2] > 0 && (v.__ddAt < popup.m_popup.innerWidth || (width(a[3]) && v.__ddW !== width(a[3])))) v.SetBounds(...a);
|
||||
const [w, h] = a?.[2] > 0 ? size(a[2], a[3]) : [0, 0];
|
||||
if (a?.[2] > 0 && (v.__ddAt < popup.m_popup.innerWidth || v.__ddW !== w || v.__ddH !== h)) v.SetBounds(...a);
|
||||
}
|
||||
const main = nav?.m_rgGamepadNavigationTrees?.find(t => t.m_ID === "GamepadUI_Full_Root");
|
||||
if (main && nav.m_LastActiveNavTree?.m_ID?.startsWith("QuickAccess")) nav.SetActiveNavTree(main);
|
||||
if (main && /^(QuickAccess|MainMenu)/.test(nav.m_LastActiveNavTree?.m_ID ?? "")) nav.SetActiveNavTree(main);
|
||||
backdrop(true);
|
||||
};
|
||||
${leaseScript(on, owner, aspect)}
|
||||
${leaseScript(on, owner, aspect, split)}
|
||||
keep();
|
||||
if (held() && !g.__ddQamTimer) {
|
||||
g.__ddQamTimer = setInterval(() => {
|
||||
@@ -161,7 +292,8 @@ object SteamQam {
|
||||
/** [open] is Steam's open side menu; [top] is true while the menu is shown on the top screen. */
|
||||
data class Hold(val open: Int, val top: Boolean)
|
||||
|
||||
fun hold(context: Context, aspect: Float, owner: Long): Hold? = eval(context, script(true, aspect, owner))?.let(::parseHold)
|
||||
fun hold(context: Context, aspect: Float, owner: Long, split: Boolean = false): Hold? =
|
||||
eval(context, script(true, aspect, owner, split))?.let(::parseHold)
|
||||
|
||||
internal fun parseHold(text: String): Hold? = runCatching {
|
||||
val a = JSONArray(text)
|
||||
@@ -181,7 +313,9 @@ object SteamQam {
|
||||
fun target(context: Context): Target? = runCatching {
|
||||
val devtools = File(AgentGuest.dir(context), "cdp-port").readText().trim().toInt()
|
||||
val (relay, secret) = parseRelay(helper(context, "start", devtools.toString())) ?: return null
|
||||
val found = runCatching { parseTarget(relay, get(relay, "/$secret/json"))?.let { it.copy(path = "/$secret${it.path}") } }
|
||||
val found = runCatching {
|
||||
parseTarget(relay, get(relay, "/$secret/json"))?.let { t -> t.copy(path = "/$secret${t.path}", mainPath = t.mainPath?.let { "/$secret$it" }) }
|
||||
}
|
||||
if (found.getOrNull() == null) helper(context, "stop", relay.toString())
|
||||
found.getOrThrow()
|
||||
}.onFailure { android.util.Log.e(TAG, "no quick access target: $it") }.getOrNull()
|
||||
@@ -232,14 +366,16 @@ object SteamQam {
|
||||
|
||||
internal fun parseTarget(port: Int, json: String): Target? {
|
||||
val list = JSONArray(json)
|
||||
for (i in 0 until list.length()) {
|
||||
val t = list.optJSONObject(i) ?: continue
|
||||
if (!t.optString("title").startsWith("QuickAccess")) continue
|
||||
val ws = t.optString("webSocketDebuggerUrl")
|
||||
val path = Regex("^ws://[^/]+(/devtools/page/[A-Za-z0-9-]+)$").find(ws)?.groupValues?.get(1) ?: continue
|
||||
return Target(port, path)
|
||||
fun page(prefix: String): String? {
|
||||
for (i in 0 until list.length()) {
|
||||
val t = list.optJSONObject(i) ?: continue
|
||||
if (!t.optString("title").startsWith(prefix)) continue
|
||||
val ws = t.optString("webSocketDebuggerUrl")
|
||||
Regex("^ws://[^/]+(/devtools/page/[A-Za-z0-9-]+)$").find(ws)?.groupValues?.get(1)?.let { return it }
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
return page("QuickAccess")?.let { Target(port, it, page("MainMenu")) }
|
||||
}
|
||||
|
||||
private fun eval(context: Context, expression: String): String? = runCatching {
|
||||
|
||||
@@ -64,8 +64,8 @@ internal class StoreArchiveUnpacker(
|
||||
val binds = if (listOf(app.filesDir, app.cacheDir).any { work.absolutePath.startsWith(it.absolutePath + "/") }) null
|
||||
else listOf(work.absolutePath)
|
||||
fun bsdtar(args: List<String>, onLine: (String) -> Unit) =
|
||||
GuestCommand.run(app, listOf("/usr/bin/bsdtar") + args, logName = logName, extraBinds = binds, fastPath = true, cancelled = cancelled) { line ->
|
||||
if (!line.startsWith("proot ")) onLine(line)
|
||||
GuestCommand.run(app, listOf("/usr/bin/bsdtar") + args, logName = logName, extraBinds = binds, cancelled = cancelled) { line ->
|
||||
onLine(line)
|
||||
}
|
||||
var entries = 0L
|
||||
var size = 0L
|
||||
|
||||
@@ -82,7 +82,7 @@ object BattleNetInstall {
|
||||
internal fun run(context: Context, args: List<String>, cancelled: AtomicBoolean?, onLine: (String) -> Unit): Int =
|
||||
GuestCommand.run(
|
||||
context, listOf(BattleNet.PROGRAM) + args, logName = "battlenet-agent",
|
||||
extraBinds = binds(context), fastPath = true, cancelled = cancelled, onLine = onLine,
|
||||
extraBinds = binds(context), cancelled = cancelled, onLine = onLine,
|
||||
)
|
||||
|
||||
fun enqueue(context: Context, item: CatalogItem, folder: File, update: Boolean = false) {
|
||||
|
||||
@@ -67,7 +67,7 @@ object EaLsx {
|
||||
}
|
||||
|
||||
@Volatile var game: Game? = null
|
||||
@Volatile private var account: Account? = null
|
||||
@Volatile internal var account: Account? = null
|
||||
/** The one session of the current launch that may act for the account. */
|
||||
/** Bumped whenever the launch changes; a connection accepted under an older one is not admitted. */
|
||||
@Volatile internal var generation = 0
|
||||
@@ -333,10 +333,11 @@ object EaLsx {
|
||||
|
||||
private fun now() = LocalDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))
|
||||
|
||||
private fun answer(session: Session, m: Message): String? {
|
||||
internal fun answer(session: Session, m: Message): String? {
|
||||
val g = game
|
||||
val who = account
|
||||
val person = who?.takeIf { session.trusted }
|
||||
val profile = who?.takeIf { session.trusted || session.claimed }
|
||||
val locale = g?.locale ?: "en_US"
|
||||
return when (m.name) {
|
||||
"ChallengeResponse" -> {
|
||||
@@ -355,15 +356,16 @@ object EaLsx {
|
||||
"GetConfig" -> tag("GetConfigResponse", body = SERVICES.joinToString("") { tag("Service", "Name" to it.first, "Facility" to it.second) })
|
||||
"GetProfile" -> tag(
|
||||
"GetProfileResponse",
|
||||
"Persona" to person?.persona.orEmpty(), "SubscriberLevel" to 0, "CommerceCurrency" to "USD", "IsTrialSubscriber" to false,
|
||||
"Country" to "US", "UserId" to person?.userId.orEmpty(), "GeoCountry" to "US", "AvatarId" to "", "IsSubscriber" to false,
|
||||
"IsSteamSubscriber" to false, "PersonaId" to person?.personaId.orEmpty(), "IsUnderAge" to false, "UserIndex" to 0,
|
||||
"Persona" to profile?.persona.orEmpty(), "SubscriberLevel" to 0, "CommerceCurrency" to "USD", "IsTrialSubscriber" to false,
|
||||
"Country" to "US", "UserId" to profile?.userId.orEmpty(), "GeoCountry" to "US", "AvatarId" to "", "IsSubscriber" to false,
|
||||
"IsSteamSubscriber" to false, "PersonaId" to profile?.personaId.orEmpty(), "IsUnderAge" to false, "UserIndex" to 0,
|
||||
)
|
||||
"GetSetting" -> tag("GetSettingResponse", "Setting" to when (m.attrs["SettingId"]) {
|
||||
"ENVIRONMENT" -> "production"
|
||||
"LANGUAGE" -> locale
|
||||
else -> "false"
|
||||
})
|
||||
"GetSettings" -> tag("GetSettingsResponse", "IsIGOAvailable" to false, "IsIGOEnabled" to false, "IsTelemetryEnabled" to false, "IsManualOffline" to false)
|
||||
"GetGameInfo" -> tag("GetGameInfoResponse", "GameInfo" to when (m.attrs["GameInfoId"]) {
|
||||
"FREETRIAL" -> "false"
|
||||
"LANGUAGES" -> LANGUAGES
|
||||
@@ -403,7 +405,7 @@ object EaLsx {
|
||||
)
|
||||
})
|
||||
}
|
||||
"GetPresence" -> tag("GetPresenceResponse", "UserId" to person?.userId.orEmpty(), "Presence" to "INGAME")
|
||||
"GetPresence" -> tag("GetPresenceResponse", "UserId" to profile?.userId.orEmpty(), "Presence" to "INGAME")
|
||||
"QueryPresence" -> tag("QueryPresenceResponse", body = "")
|
||||
"QueryFriends" -> tag("QueryFriendsResponse", body = "")
|
||||
"GetBlockList" -> tag("GetBlockListResponse", "Return" to "Success", body = "")
|
||||
|
||||
@@ -249,7 +249,7 @@ internal class EpicClientInstaller(private val app: Context) : DownloadQueue.Dow
|
||||
desktopParts.forEach { argv += listOf("--desktop", guest(it.file)) }
|
||||
if (runtimePart != null && glesPart != null) argv += listOf("--runtime", guest(runtimePart.file), "--gles", guest(glesPart.file))
|
||||
var answer: JSONObject? = null
|
||||
val code = GuestCommand.run(app, argv, fakeRoot = true, logName = "epic-client") { line ->
|
||||
val code = GuestCommand.run(app, argv, logName = "epic-client") { line ->
|
||||
if (line.startsWith("{")) runCatching { JSONObject(line) }.getOrNull()?.let { answer = it }
|
||||
}
|
||||
val result = answer
|
||||
|
||||
@@ -8,7 +8,6 @@ import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.SessionEvents
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import com.droiddeck.launcher.stores.AchievementNotifications
|
||||
@@ -139,22 +138,10 @@ object GogComet {
|
||||
val data = File(context.filesDir, "gog-achievements").apply { mkdirs() }
|
||||
val ready = CountDownLatch(1)
|
||||
val guest = listOf("/usr/bin/env", "HOME=/root", "XDG_DATA_HOME=${data.path}/data", "XDG_CONFIG_HOME=${data.path}/config", "COMET_LOG=off", "COMET_ALLOWED_CLIENTS=${policy.path}", BIN, "--credentials-stdin")
|
||||
val pb = if (com.droiddeck.launcher.runtime.NativeGuest.forSession(context)) {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
com.droiddeck.launcher.runtime.NativeGuest.processBuilder(context, root,
|
||||
LinuxRuntime.binds(context, null, null, LinuxRuntime.sharedStorage(context), null), guest).redirectErrorStream(true)
|
||||
} else {
|
||||
ProcessBuilder(LinuxRuntime.command(context, null, null, LinuxRuntime.sharedStorage(context), guest)).redirectErrorStream(true).also {
|
||||
it.environment().apply {
|
||||
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(context).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(context).path)
|
||||
if (SessionPrefs.prootNoSeccomp(context)) put("PROOT_NO_SECCOMP", "1")
|
||||
LinuxRuntime.prootLibraryPath(context).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
val pb = com.droiddeck.launcher.runtime.NativeGuest.processBuilder(context, root,
|
||||
LinuxRuntime.binds(context, null, null, LinuxRuntime.sharedStorage(context), null), guest).redirectErrorStream(true)
|
||||
val child = pb.start()
|
||||
process = child; account = user; session = SessionState.sessionId
|
||||
Thread({
|
||||
|
||||
@@ -101,11 +101,9 @@ internal object ItchPatch {
|
||||
.distinct().takeIf { it.isNotEmpty() }
|
||||
val tail = ArrayDeque<String>()
|
||||
val code = try {
|
||||
GuestCommand.run(app, args, logName = "itch-butler", extraBinds = binds, fastPath = true, cancelled = cancelled) { line ->
|
||||
if (!line.startsWith("proot ")) {
|
||||
if (tail.size == 4) tail.removeFirst()
|
||||
tail.addLast(line)
|
||||
}
|
||||
GuestCommand.run(app, args, logName = "itch-butler", extraBinds = binds, cancelled = cancelled) { line ->
|
||||
if (tail.size == 4) tail.removeFirst()
|
||||
tail.addLast(line)
|
||||
}
|
||||
} finally {
|
||||
StoreInstalls.deleteTree(staging)
|
||||
|
||||
@@ -61,18 +61,7 @@ internal class XboxCredentials(private val app: Context, expectedGeneration: Str
|
||||
}
|
||||
|
||||
private fun identity(pid: Int, root: Int): String? {
|
||||
if (root <= 0 || pid <= 0) return null
|
||||
val status = java.io.File("/proc/$pid/status").readLines()
|
||||
val tracer = status.first { it.startsWith("TracerPid:") }.substringAfter(':').trim().toInt()
|
||||
if (tracer != 0) {
|
||||
// under proot, every guest process is traced by the proot the app started
|
||||
val tracerGroup = java.io.File("/proc/$tracer/status").readLines()
|
||||
.first { it.startsWith("Tgid:") }.substringAfter(':').trim().toInt()
|
||||
if (tracerGroup != root) return null
|
||||
} else if (!descendsFrom(pid, root)) {
|
||||
// without proot, the process the app started is the backend itself (or its parent)
|
||||
return null
|
||||
}
|
||||
if (root <= 0 || pid <= 0 || !descendsFrom(pid, root)) return null
|
||||
val executable = android.system.Os.stat(binary.path)
|
||||
if (!mapsBackend(java.io.File("/proc/$pid/maps").readText(), binary.path, executable.st_ino))
|
||||
return null
|
||||
|
||||
@@ -4,8 +4,6 @@ import android.content.Context
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.ProotFastPath
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import org.json.JSONObject
|
||||
import java.io.Closeable
|
||||
@@ -84,33 +82,15 @@ internal object Xodus {
|
||||
val external = LinuxRuntime.sharedStorage(app)
|
||||
val extraBinds = StoreInstallRoot.externalBindSpecsForXodus(app)
|
||||
val binds = LinuxRuntime.binds(app, null, null, external, extraBinds)
|
||||
val fastPathPreloaded = runCatching {
|
||||
File(root, "etc/ld.so.preload").useLines { lines -> lines.any { it.trim() == ProotFastPath.LIBRARY } }
|
||||
}.getOrDefault(false)
|
||||
val native = com.droiddeck.launcher.runtime.NativeGuest.forSession(app)
|
||||
val fastPathKey = if (!native && ProotFastPath.enabled(app) && fastPathPreloaded &&
|
||||
File(root, ProotFastPath.LIBRARY.removePrefix("/")).isFile) ProotFastPath.key(root, binds) else null
|
||||
val guestCommand = mutableListOf(
|
||||
"/usr/bin/env", "HOME=/root", "XODUS_LOG=off", "RUST_LOG=off",
|
||||
"XDG_RUNTIME_DIR=${runtime.path}", "DROIDDECK_XBOX_CREDENTIAL_SOCKET=${credentials.name}", binary,
|
||||
)
|
||||
fastPathKey?.let { key ->
|
||||
guestCommand.addAll(guestCommand.lastIndex, ProotFastPath.guestEnv(root, binds, key))
|
||||
}
|
||||
guestCommand.addAll(args)
|
||||
val builder = if (native) com.droiddeck.launcher.runtime.NativeGuest.processBuilder(app, root, binds, guestCommand)
|
||||
else ProcessBuilder(LinuxRuntime.commandWithBinds(app, root, binds, guestCommand)).directory(LinuxRuntime.rootDir(app))
|
||||
val builder = com.droiddeck.launcher.runtime.NativeGuest.processBuilder(app, root, binds, guestCommand)
|
||||
if (launchDirectory != null) builder.environment()["TMPDIR"] = launchDirectory.path
|
||||
builder.environment()["DROIDDECK_XBOX_CREDENTIAL_PORT"] = credentials.port.toString()
|
||||
builder.environment()["DROIDDECK_XBOX_CREDENTIAL_KEY"] = credentials.key
|
||||
if (!native) builder.environment().apply {
|
||||
remove("LD_PRELOAD"); remove("LD_AUDIT"); remove("LD_LIBRARY_PATH")
|
||||
put("PROOT_LOADER", LinuxRuntime.prootLoader(app).path)
|
||||
put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(app).path)
|
||||
if (SessionPrefs.prootNoSeccomp(app)) put("PROOT_NO_SECCOMP", "1")
|
||||
fastPathKey?.let { ProotFastPath.hostEnv(it).let { (key, value) -> put(key, value) } }
|
||||
LinuxRuntime.prootLibraryPath(app).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) }
|
||||
}
|
||||
val digest = java.security.MessageDigest.getInstance("SHA-256")
|
||||
File(pack, binary.removePrefix("$DIR/")).inputStream().use { input ->
|
||||
val buffer = ByteArray(65536)
|
||||
|
||||
@@ -223,7 +223,7 @@ internal fun AgentProcessList(modifier: Modifier) {
|
||||
var procs by remember { mutableStateOf<List<AgentProcesses.Proc>?>(null) }
|
||||
LaunchedEffect(refresh) {
|
||||
while (true) {
|
||||
procs = withContext(Dispatchers.IO) { AgentProcesses.snapshot(AgentHost.turnPid) }
|
||||
procs = withContext(Dispatchers.IO) { AgentProcesses.snapshot(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context), AgentHost.turnPid) }
|
||||
delay(2_000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,6 @@ private fun action(step: Step): Int = when (step) {
|
||||
Step.PREPARE -> R.string.agent_action_prepare
|
||||
}
|
||||
|
||||
/** The pairing DroidDeck already uses for the phantom process fix; the agent reuses its key. */
|
||||
private fun pair(context: android.content.Context) {
|
||||
if (QuestExperimental.isSupported()) return AgentSetup.trustOnDevice(context)
|
||||
if (!WirelessAdbPairingService.notificationsEnabled(context)) {
|
||||
@@ -293,5 +292,5 @@ private fun pair(context: android.content.Context) {
|
||||
return
|
||||
}
|
||||
WirelessAdbPairingService.start(context)
|
||||
PairingGuideActivity.start(context, null, false)
|
||||
PairingGuideActivity.start(context, null)
|
||||
}
|
||||
@@ -8,11 +8,14 @@ import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.AlignHorizontalCenter
|
||||
import androidx.compose.material.icons.outlined.AlignHorizontalLeft
|
||||
import androidx.compose.material.icons.outlined.AlignHorizontalRight
|
||||
import androidx.compose.material.icons.outlined.VerticalSplit
|
||||
import androidx.compose.material.icons.outlined.WidthFull
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@@ -72,7 +75,8 @@ internal enum class QamFit(val id: String, @StringRes val label: Int, val icon:
|
||||
FULL("full", R.string.bottom_qam_layout_full, Icons.Outlined.WidthFull, 0),
|
||||
LEFT("left", R.string.bottom_qam_layout_left, Icons.Outlined.AlignHorizontalLeft, -1),
|
||||
CENTER("center", R.string.bottom_qam_layout_center, Icons.Outlined.AlignHorizontalCenter, 0),
|
||||
RIGHT("right", R.string.bottom_qam_layout_right, Icons.Outlined.AlignHorizontalRight, 1);
|
||||
RIGHT("right", R.string.bottom_qam_layout_right, Icons.Outlined.AlignHorizontalRight, 1),
|
||||
SPLIT("split", R.string.bottom_qam_layout_split, Icons.Outlined.VerticalSplit, 0);
|
||||
|
||||
val next: QamFit get() = entries[(ordinal + 1) % entries.size]
|
||||
|
||||
@@ -92,6 +96,7 @@ internal enum class QamFit(val id: String, @StringRes val label: Int, val icon:
|
||||
|
||||
internal object QamLayout {
|
||||
private const val WIDE_CSS = "div.BasicUI { width: 100% !important; } div[class*=\\\"tab_\\\"] { max-width: none !important; }"
|
||||
private const val PARKED_CSS = " #Footer { display: none !important; }"
|
||||
|
||||
/** Scale and left edge of the menu in a box; [align] -1, 0 or 1 places a narrower menu left, centred or right. */
|
||||
fun fit(boxWidth: Float, boxHeight: Float, contentRight: Float, cssHeight: Float, align: Int = 0): Pair<Float, Float> {
|
||||
@@ -102,10 +107,13 @@ internal object QamLayout {
|
||||
fun toCss(x: Float, y: Float, scale: Float, left: Float): Pair<Float, Float> = (x - left) / scale to y / scale
|
||||
|
||||
/** Makes the menu follow the panel-shaped view (Steam sizes it once, on open) and lifts each tab's 300 px cap, then measures where the content ends. */
|
||||
/** [wide] is false while the menu is shown on the top screen, where it keeps Steam's own layout. */
|
||||
fun contentScript(wide: Boolean): String = "(() => { let s = document.getElementById('dd-qam-wide'); " +
|
||||
/**
|
||||
* [wide] is false while the menu is shown on the top screen, where it keeps Steam's own layout. [parked] hides the
|
||||
* button-hint footer Steam draws in a game, which stays an empty black strip while the controller is not on the menu.
|
||||
*/
|
||||
fun contentScript(wide: Boolean, parked: Boolean = wide): String = "(() => { let s = document.getElementById('dd-qam-wide'); " +
|
||||
"if (!s) { s = document.createElement('style'); s.id = 'dd-qam-wide'; document.head.appendChild(s); } " +
|
||||
"const css = '${if (wide) WIDE_CSS else ""}'; " +
|
||||
"const css = '${(if (wide) WIDE_CSS else "") + (if (parked) PARKED_CSS else "")}'; " +
|
||||
"if (s.textContent !== css) s.textContent = css; if (document.scrollingElement.scrollLeft) document.scrollingElement.scrollLeft = 0; " +
|
||||
"const w = innerWidth; let right = 0; for (const e of document.body.querySelectorAll('*')) { " +
|
||||
"const r = e.getBoundingClientRect(); const tab = /(^| )tab_/.test(String(e.className)); " +
|
||||
@@ -117,17 +125,90 @@ private const val TICK_MS = 1_000L
|
||||
private const val FAST_TICK_MS = 150L
|
||||
private const val MAX_RETRY_MS = 4_000L
|
||||
|
||||
/** The last frame shown, so returning to the panel shows the menu at once while the live stream reconnects. */
|
||||
/** One of Steam's menu pages streamed to the panel; the last frame is kept so returning to the panel shows it at once. */
|
||||
internal class MenuStream {
|
||||
@Volatile var page: CdpPage? = null
|
||||
val live = java.util.concurrent.atomic.AtomicBoolean(false)
|
||||
val image = mutableStateOf<ImageBitmap?>(null)
|
||||
val shape = mutableStateOf<FloatArray?>(null)
|
||||
|
||||
fun show(frame: ImageBitmap) {
|
||||
image.value = frame
|
||||
live.set(true)
|
||||
}
|
||||
|
||||
/** Connects to [path] and starts its screencast; false when the page cannot be reached. */
|
||||
fun connect(port: Int, path: String): Boolean {
|
||||
page?.close()
|
||||
page = null
|
||||
live.set(false)
|
||||
val p = runCatching {
|
||||
CdpPage(port, path) { method, params ->
|
||||
if (method == "Page.screencastFrame") {
|
||||
page?.send("Page.screencastFrameAck", JSONObject().put("sessionId", params.optInt("sessionId")))
|
||||
decodeFrame(params.optString("data"))?.let(::show)
|
||||
}
|
||||
}
|
||||
}.onFailure { android.util.Log.w("SteamQam", "devtools connect: $it") }.getOrNull() ?: return false
|
||||
page = p
|
||||
p.send("Page.enable")
|
||||
val started = p.call("Page.startScreencast", JSONObject().put("format", "jpeg").put("quality", 85)
|
||||
.put("maxWidth", 1920).put("maxHeight", 1440))
|
||||
if (started == null || started.has("error") || !started.has("result")) {
|
||||
p.close()
|
||||
page = null
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/** Runs [script], which returns the page's [width, height, pixel ratio, content right], and refreshes a still page. */
|
||||
fun refresh(script: String) {
|
||||
val p = page ?: return
|
||||
// The screencast sends frames only when the menu repaints, so a still menu needs one screenshot.
|
||||
if (!live.get()) {
|
||||
p.call("Page.captureScreenshot", JSONObject().put("format", "jpeg").put("quality", 85))
|
||||
?.optJSONObject("result")?.optString("data")?.let(::decodeFrame)?.let(::show)
|
||||
}
|
||||
(p.evaluate(script) as? String)?.let { text ->
|
||||
runCatching {
|
||||
val a = JSONArray(text)
|
||||
val layout = FloatArray(4) { a.getDouble(it).toFloat() }
|
||||
if (!layout.contentEquals(shape.value)) shape.value = layout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Stops the stream and runs [restore] on the page, which outlives this connection. */
|
||||
fun stop(restore: String) {
|
||||
val p = page ?: return
|
||||
page = null
|
||||
runCatching { p.send("Page.stopScreencast") }
|
||||
runCatching { p.evaluate(restore) }
|
||||
p.close()
|
||||
}
|
||||
|
||||
fun frame(): QamFrame? {
|
||||
val img = image.value
|
||||
val l = shape.value
|
||||
return if (img != null && l != null && l[0] > 0f) QamFrame(img, l[0], l[1], l[3].coerceIn(l[0] * 0.25f, l[0])) else null
|
||||
}
|
||||
}
|
||||
|
||||
/** Steam's main menu beside the quick access menu; Steam's side of the hold keeps it in place and filling its view. */
|
||||
internal object MainMenuLayout {
|
||||
const val CONTENT_SCRIPT = "JSON.stringify([innerWidth, innerHeight, devicePixelRatio, innerWidth])"
|
||||
}
|
||||
|
||||
/** Panel streams kept across visits to the panel. */
|
||||
private object QamCache {
|
||||
@Volatile var image: ImageBitmap? = null
|
||||
@Volatile var shape: FloatArray? = null
|
||||
val qam = MenuStream()
|
||||
val main = MenuStream()
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun SteamQamPanel() {
|
||||
val context = LocalContext.current.applicationContext
|
||||
var image by remember { mutableStateOf(QamCache.image) }
|
||||
var shape by remember { mutableStateOf(QamCache.shape) }
|
||||
var failed by remember { mutableStateOf(false) }
|
||||
var slow by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(Unit) {
|
||||
@@ -135,78 +216,67 @@ internal fun SteamQamPanel() {
|
||||
slow = true
|
||||
}
|
||||
val fit = QamFit.current(context)
|
||||
val holder = remember { arrayOfNulls<CdpPage>(1) }
|
||||
val qam = QamCache.qam
|
||||
val mainMenu = QamCache.main
|
||||
val owner = remember { SteamQam.newOwner() }
|
||||
val relay = remember { intArrayOf(0) }
|
||||
val live = remember { java.util.concurrent.atomic.AtomicBoolean(false) }
|
||||
val mainPath = remember { arrayOfNulls<String>(1) }
|
||||
val aspect = remember { floatArrayOf(0f) }
|
||||
val measure = Modifier.fillMaxSize().onSizeChanged { if (it.height > 0) aspect[0] = it.width.toFloat() / it.height }
|
||||
val show = { frame: ImageBitmap -> image = frame; QamCache.image = frame; live.set(true) }
|
||||
LaunchedEffect(Unit) {
|
||||
withContext(Dispatchers.IO) {
|
||||
var misses = 0
|
||||
// The main menu page backs off on its own, so Quick Access stays available while its neighbour cannot connect.
|
||||
var mainMisses = 0
|
||||
var mainRetryAt = 0L
|
||||
fun split() = QamFit.current(context) == QamFit.SPLIT
|
||||
// The lease is renewed on its own, so slow discovery or a retry backoff never lets the held menu lapse.
|
||||
val renew = launch {
|
||||
while (isActive) {
|
||||
if (SessionState.phase == SessionPhase.READY && aspect[0] > 0f) SteamQam.hold(context, aspect[0], owner)
|
||||
if (SessionState.phase == SessionPhase.READY && aspect[0] > 0f) SteamQam.hold(context, aspect[0], owner, split())
|
||||
delay(TICK_MS)
|
||||
}
|
||||
}
|
||||
try {
|
||||
while (isActive) {
|
||||
// Holding the menu before Steam's first frame keeps gamescope from presenting it.
|
||||
if (SessionState.phase != SessionPhase.READY) {
|
||||
if (SessionState.phase != SessionPhase.READY || aspect[0] == 0f) {
|
||||
delay(FAST_TICK_MS)
|
||||
continue
|
||||
}
|
||||
if (aspect[0] == 0f) {
|
||||
delay(FAST_TICK_MS)
|
||||
continue
|
||||
}
|
||||
val held = SteamQam.hold(context, aspect[0], owner)
|
||||
val split = split()
|
||||
val held = SteamQam.hold(context, aspect[0], owner, split)
|
||||
ensureActive()
|
||||
var reached = held != null
|
||||
if (held?.open == SteamQam.QUICK_ACCESS) {
|
||||
var page = holder[0]
|
||||
if (page == null || page.closed) {
|
||||
page?.close()
|
||||
live.set(false)
|
||||
page = SteamQam.target(context)?.let { t ->
|
||||
if (qam.page?.closed != false) {
|
||||
val t = SteamQam.target(context)
|
||||
if (t != null) {
|
||||
if (relay[0] != 0 && relay[0] != t.port) SteamQam.stopRelay(context, relay[0])
|
||||
relay[0] = t.port
|
||||
runCatching {
|
||||
CdpPage(t.port, t.path) { method, params ->
|
||||
if (method == "Page.screencastFrame") {
|
||||
holder[0]?.send("Page.screencastFrameAck", JSONObject().put("sessionId", params.optInt("sessionId")))
|
||||
decodeFrame(params.optString("data"))?.let(show)
|
||||
}
|
||||
}
|
||||
}.onFailure { android.util.Log.w("SteamQam", "devtools connect: $it") }.getOrNull()
|
||||
mainPath[0] = t.mainPath
|
||||
qam.connect(t.port, t.path)
|
||||
mainMenu.stop(MainMenuLayout.CONTENT_SCRIPT)
|
||||
}
|
||||
holder[0] = page
|
||||
ensureActive()
|
||||
page?.send("Page.enable")
|
||||
val started = page?.call("Page.startScreencast", JSONObject().put("format", "jpeg").put("quality", 85)
|
||||
.put("maxWidth", 1920).put("maxHeight", 1440))
|
||||
if (page != null && (started == null || started.has("error") || !started.has("result"))) {
|
||||
page.close()
|
||||
page = null
|
||||
holder[0] = null
|
||||
}
|
||||
}
|
||||
// The screencast sends frames only when the menu repaints, so a still menu needs one screenshot.
|
||||
if (!live.get()) {
|
||||
page?.call("Page.captureScreenshot", JSONObject().put("format", "jpeg").put("quality", 85))
|
||||
?.optJSONObject("result")?.optString("data")?.let(::decodeFrame)?.let(show)
|
||||
}
|
||||
reached = page != null
|
||||
val wide = !held.top && QamFit.current(context) == QamFit.FULL
|
||||
(page?.evaluate(QamLayout.contentScript(wide)) as? String)?.let { text ->
|
||||
runCatching {
|
||||
val a = JSONArray(text)
|
||||
val layout = floatArrayOf(a.getDouble(0).toFloat(), a.getDouble(1).toFloat(), a.getDouble(2).toFloat(), a.getDouble(3).toFloat())
|
||||
if (!layout.contentEquals(shape)) { shape = layout; QamCache.shape = layout }
|
||||
reached = qam.page?.closed == false
|
||||
val wide = !held.top && (QamFit.current(context) == QamFit.FULL || split)
|
||||
qam.refresh(QamLayout.contentScript(wide, parked = !held.top))
|
||||
val path = mainPath[0]
|
||||
if (split && path != null) {
|
||||
val now = android.os.SystemClock.elapsedRealtime()
|
||||
if (mainMenu.page?.closed != false && now >= mainRetryAt) {
|
||||
if (mainMenu.connect(relay[0], path)) {
|
||||
mainMisses = 0
|
||||
} else {
|
||||
mainMisses++
|
||||
mainRetryAt = now + minOf(TICK_MS shl minOf(mainMisses - 1, 2), MAX_RETRY_MS)
|
||||
}
|
||||
}
|
||||
mainMenu.refresh(MainMenuLayout.CONTENT_SCRIPT)
|
||||
} else if (!split) {
|
||||
mainMenu.stop(MainMenuLayout.CONTENT_SCRIPT)
|
||||
}
|
||||
}
|
||||
failed = !reached
|
||||
@@ -214,7 +284,7 @@ internal fun SteamQamPanel() {
|
||||
misses = if (reached) 0 else misses + 1
|
||||
val wait = when {
|
||||
!reached -> minOf(TICK_MS shl minOf(misses - 1, 2), MAX_RETRY_MS)
|
||||
live.get() -> TICK_MS
|
||||
qam.live.get() && (!split || mainMenu.live.get() || mainMenu.page?.closed != false) -> TICK_MS
|
||||
else -> FAST_TICK_MS
|
||||
}
|
||||
val used = QamFit.current(context)
|
||||
@@ -225,35 +295,46 @@ internal fun SteamQamPanel() {
|
||||
} finally {
|
||||
withContext(NonCancellable) {
|
||||
renew.cancelAndJoin()
|
||||
val page = holder[0]
|
||||
holder[0] = null
|
||||
runCatching { page?.send("Page.stopScreencast") }
|
||||
// The page outlives this connection, so the widened layout would otherwise stay on the top screen.
|
||||
runCatching { page?.evaluate(QamLayout.contentScript(wide = false)) }
|
||||
page?.close()
|
||||
// The pages outlive these connections, so the widened layouts would otherwise stay on the top screen.
|
||||
qam.stop(QamLayout.contentScript(wide = false))
|
||||
mainMenu.stop(MainMenuLayout.CONTENT_SCRIPT)
|
||||
SteamQam.release(context, relay[0], owner)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
val img = image
|
||||
val l = shape
|
||||
val f = remember(img, l) {
|
||||
if (img != null && l != null && l[0] > 0f) QamFrame(img, l[0], l[1], l[3].coerceIn(l[0] * 0.25f, l[0])) else null
|
||||
}
|
||||
if (f == null) {
|
||||
val qamFrame = qam.frame()
|
||||
if (qamFrame == null) {
|
||||
Box(measure) {
|
||||
if (slow) PanelNote(stringResource(if (failed) R.string.bottom_qam_unavailable else R.string.achievements_reading))
|
||||
}
|
||||
return
|
||||
}
|
||||
BoxWithConstraints(measure.background(f.fill)) {
|
||||
if (fit != QamFit.SPLIT) {
|
||||
MenuCanvas(qamFrame, fit.align, measure) { qam.page }
|
||||
return
|
||||
}
|
||||
// Each side is as wide as its menu at the shared scale, so neither is shrunk nor padded with empty space.
|
||||
val mainFrame = mainMenu.frame()
|
||||
val mainWidth = mainFrame?.cssWidth ?: SteamQam.MAIN_CSS_WIDTH.toFloat()
|
||||
Row(measure) {
|
||||
val left = Modifier.weight(mainWidth).fillMaxHeight()
|
||||
if (mainFrame != null) MenuCanvas(mainFrame, -1, left) { mainMenu.page }
|
||||
else Box(left.background(qamFrame.fill))
|
||||
MenuCanvas(qamFrame, -1, Modifier.weight(qamFrame.cssWidth).fillMaxHeight()) { qam.page }
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws [f] scaled into the box, placed by [align], and forwards touches on it to [page]. */
|
||||
@Composable
|
||||
private fun MenuCanvas(f: QamFrame, align: Int, modifier: Modifier, page: () -> CdpPage?) {
|
||||
BoxWithConstraints(modifier.background(f.fill)) {
|
||||
val density = LocalDensity.current
|
||||
val boxW = with(density) { maxWidth.toPx() }
|
||||
val boxH = with(density) { maxHeight.toPx() }
|
||||
val (scale, left) = QamLayout.fit(boxW, boxH, f.contentRight, f.cssHeight, fit.align)
|
||||
val (scale, left) = QamLayout.fit(boxW, boxH, f.contentRight, f.cssHeight, align)
|
||||
Canvas(
|
||||
Modifier.fillMaxSize().pointerInput(f.cssWidth, f.contentRight, boxW, boxH, fit) {
|
||||
Modifier.fillMaxSize().pointerInput(f.cssWidth, f.contentRight, boxW, boxH, align) {
|
||||
var touching = false
|
||||
var target: CdpPage? = null
|
||||
try {
|
||||
@@ -268,7 +349,7 @@ internal fun SteamQamPanel() {
|
||||
PointerEventType.Release -> "touchEnd"
|
||||
else -> null
|
||||
}?.takeIf { it == "touchStart" || touching } ?: continue
|
||||
if (type == "touchStart") target = holder[0]
|
||||
if (type == "touchStart") target = page()
|
||||
touching = type != "touchEnd"
|
||||
val points = if (type == "touchEnd") JSONArray()
|
||||
else JSONArray().put(JSONObject().put("x", x.toDouble()).put("y", y.toDouble()))
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
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
|
||||
fun DeveloperDisplayChoiceDialog(
|
||||
displays: List<Pair<Int, String>>,
|
||||
onMainScreen: () -> Unit,
|
||||
onSecondaryScreen: (Int) -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(stringResource(R.string.setup_adb_pair_button)) },
|
||||
text = {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(4.dp), modifier = Modifier.fillMaxWidth()) {
|
||||
Text(stringResource(R.string.gate_choose_display))
|
||||
TextButton(modifier = Modifier.fillMaxWidth().focusGlide(CircleShape), onClick = onMainScreen) { Text(stringResource(R.string.gate_main_screen)) }
|
||||
displays.forEach { (id, label) ->
|
||||
TextButton(modifier = Modifier.fillMaxWidth().focusGlide(CircleShape), onClick = { onSecondaryScreen(id) }) { Text(label) }
|
||||
}
|
||||
}
|
||||
},
|
||||
confirmButton = { TextButton(onClick = onDismiss, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Context
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.expandVertically
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.foundation.LocalIndication
|
||||
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.interaction.collectIsFocusedAsState
|
||||
import androidx.compose.foundation.interaction.collectIsHoveredAsState
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.ExpandMore
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.compositionLocalOf
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateMapOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.stateDescription
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
/**
|
||||
* Inside the session menu every top-level settings group folds to its header and a summary of its values.
|
||||
* Groups start folded; a group the player opens or folds stays that way across sessions.
|
||||
*/
|
||||
internal object DrawerSectionState {
|
||||
private val chosen = mutableStateMapOf<String, Boolean>()
|
||||
|
||||
fun load(context: Context) {
|
||||
if (DevPreview.drawer != null) return
|
||||
chosen.clear()
|
||||
chosen.putAll(SessionPrefs.drawerSections(context))
|
||||
}
|
||||
|
||||
fun isOpen(key: String) = chosen[key] ?: false
|
||||
|
||||
fun toggle(context: Context, key: String) {
|
||||
chosen[key] = !isOpen(key)
|
||||
if (DevPreview.drawer == null) SessionPrefs.setDrawerSections(context, chosen.toMap())
|
||||
}
|
||||
}
|
||||
|
||||
internal class DrawerSections(val context: Context, val track: (String) -> Modifier)
|
||||
|
||||
internal val LocalDrawerSections = compositionLocalOf<DrawerSections?> { null }
|
||||
|
||||
@Composable
|
||||
internal fun DrawerSection(
|
||||
sections: DrawerSections, key: String, title: String, summary: String?, tag: String?,
|
||||
content: @Composable ColumnScope.() -> Unit,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val open = DrawerSectionState.isOpen(key)
|
||||
val source = remember { MutableInteractionSource() }
|
||||
val hot = source.collectIsFocusedAsState().value || source.collectIsHoveredAsState().value
|
||||
val rotation by animateFloatAsState(if (open) 180f else 0f, Motion.tw(180), label = "sectionArrow")
|
||||
val state = stringResource(if (open) R.string.widgets_expanded else R.string.widgets_collapsed)
|
||||
val toggle = { DrawerSectionState.toggle(sections.context, key) }
|
||||
val shape = RoundedCornerShape(14.dp)
|
||||
Column(
|
||||
Modifier.fillMaxWidth().padding(top = 6.dp).clip(shape)
|
||||
.background(colors.surface).border(1.dp, if (open) pal.line2 else pal.line, shape),
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
modifier = Modifier.fillMaxWidth().heightIn(min = 48.dp)
|
||||
.then(sections.track("section-$key"))
|
||||
.testTag("drawer-section-$key")
|
||||
.background(if (hot) pal.signal.copy(alpha = 0.12f) else androidx.compose.ui.graphics.Color.Transparent)
|
||||
.glideBorder(hot, shape, pal.signal)
|
||||
.hoverable(source)
|
||||
.clickable(interactionSource = source, indication = LocalIndication.current, role = Role.Button, onClick = toggle)
|
||||
.controllerConfirm(onClick = toggle)
|
||||
.semantics { contentDescription = title; stateDescription = state }
|
||||
.padding(start = 12.dp, end = 8.dp, top = 6.dp, bottom = 6.dp),
|
||||
) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
Text(title.uppercase(), fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.2.sp,
|
||||
color = if (open) colors.onBackground else colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f, fill = false))
|
||||
if (tag != null) Text(
|
||||
tag, fontSize = 10.sp, fontWeight = FontWeight.SemiBold, color = pal.signal, maxLines = 1,
|
||||
modifier = Modifier.clip(RoundedCornerShape(6.dp)).background(pal.signal.copy(alpha = 0.14f))
|
||||
.padding(horizontal = 6.dp, vertical = 2.dp),
|
||||
)
|
||||
}
|
||||
if (!open && !summary.isNullOrEmpty()) Text(
|
||||
summary, fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.padding(top = 2.dp),
|
||||
)
|
||||
}
|
||||
Icon(Icons.Outlined.ExpandMore, contentDescription = null, tint = colors.onSurfaceVariant,
|
||||
modifier = Modifier.size(22.dp).rotate(rotation))
|
||||
}
|
||||
AnimatedVisibility(open, enter = expandVertically(Motion.tw(200)) + fadeIn(Motion.tw(160)),
|
||||
exit = shrinkVertically(Motion.tw(160)) + fadeOut(Motion.tw(120))) {
|
||||
Column(Modifier.fillMaxWidth()) {
|
||||
Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
// Only top-level groups fold; groups and dialogs opened from inside one draw normally.
|
||||
CompositionLocalProvider(LocalDrawerSections provides null) { content() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,8 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
fun on(key: String) = cfg[key] == "1"
|
||||
fun int(key: String, fallback: Int) = cfg[key]?.toIntOrNull() ?: fallback
|
||||
|
||||
SettingsGroup(stringResource(R.string.drawer_hud)) {
|
||||
SettingsGroup(stringResource(R.string.drawer_hud), key = "performance-hud",
|
||||
detail = stringResource(if (a.hudOn) R.string.widgets_on else R.string.widgets_off)) {
|
||||
ToggleRow(host, "hud", stringResource(R.string.drawer_hud), null, a.hudOn, chipModifier = track("hud"), onChange = a.onHud)
|
||||
if (a.hudOn) ToggleRow(
|
||||
host, "hud-only-during-game", stringResource(R.string.hud_only_during_game),
|
||||
@@ -62,7 +63,7 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
if (a.dashboardAvailable && a.secondScreenDisplays.isNotEmpty()) BottomStripSettings(host, track)
|
||||
if (!a.hudOn) return
|
||||
|
||||
SettingsGroup(stringResource(R.string.hud_group_look)) {
|
||||
SettingsGroup(stringResource(R.string.hud_group_look), key = "performance-hud-look") {
|
||||
SliderRow(stringResource(R.string.hud_scale), null, int("hudScale", 100), 50..150, step = 5, format = { "$it%" },
|
||||
modifier = track("hud-scale")) { a.onHudSetting("hudScale", it.toString()) }
|
||||
SliderRow(stringResource(R.string.drawer_hud_opacity), null, int("hudOpacity", 80), 0..100, step = 5, format = { "$it%" },
|
||||
@@ -85,7 +86,7 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
}
|
||||
|
||||
var editing by remember { mutableStateOf(false) }
|
||||
SettingsGroup(stringResource(R.string.hud_group_metrics)) {
|
||||
SettingsGroup(stringResource(R.string.hud_group_metrics), key = "performance-hud-metrics") {
|
||||
ActionRow(stringResource(R.string.hud_group_metrics), null, stringResource(R.string.common_edit),
|
||||
onClick = { editing = true }, modifier = track("hud-readings"))
|
||||
val rows = DroidDeckHudSize.rowsFor(DroidDeckHudSize.from(cfg["hudSize"]), cfg)
|
||||
@@ -103,7 +104,7 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
)
|
||||
}
|
||||
|
||||
if (on("showTemp") || on("showGpuTemp") || on("showBatteryTemp")) SettingsGroup(stringResource(R.string.hud_group_temps)) {
|
||||
if (on("showTemp") || on("showGpuTemp") || on("showBatteryTemp")) SettingsGroup(stringResource(R.string.hud_group_temps), key = "performance-hud-temps") {
|
||||
ChoiceRow(host, "hud-temp-unit", stringResource(R.string.hud_temp_unit), null,
|
||||
listOf("c" to "°C", "f" to "°F"), if (cfg["tempUnit"].equals("f", true)) "f" else "c",
|
||||
chipModifier = track("hud-temp-unit")) { a.onHudSetting("tempUnit", it) }
|
||||
@@ -129,7 +130,7 @@ internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (Stri
|
||||
}
|
||||
}
|
||||
|
||||
SettingsGroup(stringResource(R.string.hud_group_more)) {
|
||||
SettingsGroup(stringResource(R.string.hud_group_more), key = "performance-hud-more") {
|
||||
ActionRow(stringResource(R.string.hud_export), stringResource(R.string.hud_export_hint),
|
||||
stringResource(R.string.hud_export_button), onClick = a.onHudExport, modifier = track("hud-export"))
|
||||
ActionRow(stringResource(R.string.hud_reset), null, stringResource(R.string.hud_reset_button),
|
||||
@@ -145,7 +146,7 @@ private fun BottomStripSettings(host: MenuHost, track: (String) -> Modifier) {
|
||||
var hudOn by remember { mutableStateOf(SessionPrefs.bottomHud(context)) }
|
||||
var onTabs by remember { mutableStateOf(SessionPrefs.bottomStripOnTabs(context)) }
|
||||
var shown by remember { mutableStateOf(SessionPrefs.bottomStripMetrics(context)) }
|
||||
SettingsGroup(stringResource(R.string.bottom_hud_group)) {
|
||||
SettingsGroup(stringResource(R.string.bottom_hud_group), key = "performance-bottom-hud") {
|
||||
ToggleRow(host, "bottom-hud", stringResource(R.string.bottom_hud_group), null, hudOn,
|
||||
chipModifier = track("bottom-hud")) { on ->
|
||||
hudOn = on
|
||||
|
||||
@@ -1,52 +1,171 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
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.focus.FocusRequester
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.gpu.FrameGen
|
||||
import com.droiddeck.launcher.gpu.Lossless
|
||||
|
||||
@Composable
|
||||
internal fun FrameGenMenu(
|
||||
host: MenuHost, mode: FrameGen.Mode, lossless: Lossless.State,
|
||||
mode: FrameGen.Mode,
|
||||
lossless: Lossless.State,
|
||||
onPick: (FrameGen.Mode) -> Unit,
|
||||
onImportLossless: () -> Unit,
|
||||
gameProfileId: String? = null,
|
||||
hasGameOverride: Boolean = false,
|
||||
onResetGame: () -> Unit = {},
|
||||
focusModifier: Modifier = Modifier,
|
||||
legacyButtons: Boolean = false,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
AnchoredMenu(host.open == "fg", onDismiss = { if (host.open == "fg") host.open = null }, title = stringResource(R.string.frame_gen_title)) { firstItemFocus ->
|
||||
val need = when {
|
||||
lossless.ready -> null
|
||||
lossless.owned -> stringResource(R.string.lsfg_needs_install)
|
||||
else -> stringResource(R.string.lsfg_needs_steam)
|
||||
}
|
||||
@Composable
|
||||
fun item(m: FrameGen.Mode, enabled: Boolean = true, detail: String? = null, focus: FocusRequester? = null) =
|
||||
MenuItem(FrameGen.label(context, m), checked = mode == m, enabled = enabled, detail = detail, focusRequester = focus) {
|
||||
onPick(m); host.open = null
|
||||
val need = when {
|
||||
lossless.ready -> null
|
||||
lossless.owned -> stringResource(R.string.lsfg_needs_install)
|
||||
else -> stringResource(R.string.lsfg_needs_steam)
|
||||
}
|
||||
val selectedEngine = mode.engine.takeIf { it != FrameGen.ENGINE_OFF }
|
||||
val offLabel = FrameGen.label(LocalContext.current, FrameGen.Mode.OFF)
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val engines = listOf(FrameGen.ENGINE_LSFG to "LSFG", FrameGen.ENGINE_DDFG to "DDFG")
|
||||
|
||||
Column(Modifier.fillMaxWidth().padding(start = 10.dp, end = 10.dp, top = 0.dp, bottom = 8.dp)) {
|
||||
if (!legacyButtons) OutlinedButton(
|
||||
onClick = { onPick(FrameGen.Mode.OFF.copy(multiplier = mode.multiplier)) },
|
||||
modifier = Modifier.fillMaxWidth().controllerConfirm(
|
||||
onClick = { onPick(FrameGen.Mode.OFF.copy(multiplier = mode.multiplier)) },
|
||||
),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||
colors = ButtonDefaults.outlinedButtonColors(
|
||||
containerColor = if (selectedEngine == null) colors.primary.copy(alpha = 0.16f) else colors.surface,
|
||||
contentColor = if (selectedEngine == null) colors.primary else colors.onSurface,
|
||||
),
|
||||
) { Text(offLabel) }
|
||||
|
||||
Row(Modifier.fillMaxWidth().then(if (legacyButtons) Modifier else Modifier.padding(top = 8.dp)), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
val focusIndex = engines.indexOfFirst { (engine, _) ->
|
||||
selectedEngine == engine || engine != FrameGen.ENGINE_LSFG || lossless.ready
|
||||
}
|
||||
item(FrameGen.Mode.OFF, focus = firstItemFocus)
|
||||
engines.forEachIndexed { index, (engine, label) ->
|
||||
val selected = selectedEngine == engine
|
||||
val enabled = selected || engine != FrameGen.ENGINE_LSFG || lossless.ready
|
||||
val pick = {
|
||||
onPick(if (selected) FrameGen.Mode.OFF.copy(multiplier = mode.multiplier) else FrameGen.Mode(engine, mode.multiplier.coerceIn(2, 4)))
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = pick,
|
||||
enabled = enabled,
|
||||
modifier = (if (index == focusIndex) focusModifier else Modifier)
|
||||
.weight(1f).controllerConfirm(enabled = enabled, 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) }
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedEngine != null) {
|
||||
val multiplierEnabled = mode.engine != FrameGen.ENGINE_LSFG || lossless.ready
|
||||
Row(
|
||||
Modifier.fillMaxWidth().padding(top = 8.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
(2..4).forEach { multiplier ->
|
||||
val selected = mode.multiplier == multiplier && mode.target == 0
|
||||
val pickMultiplier = {
|
||||
onPick(mode.copy(multiplier = multiplier, target = 0))
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = pickMultiplier,
|
||||
enabled = multiplierEnabled,
|
||||
modifier = Modifier.weight(1f).controllerConfirm(
|
||||
enabled = multiplierEnabled,
|
||||
onClick = pickMultiplier,
|
||||
),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||
colors = ButtonDefaults.outlinedButtonColors(
|
||||
containerColor = if (selected) colors.secondary.copy(alpha = 0.18f) else colors.surface,
|
||||
contentColor = if (selected) colors.secondary else colors.onSurface,
|
||||
),
|
||||
) { Text("${multiplier}×") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedEngine == FrameGen.ENGINE_LSFG) {
|
||||
Row(
|
||||
Modifier.fillMaxWidth().padding(top = 8.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
FrameGen.ADAPTIVE_TARGETS.forEach { target ->
|
||||
val adaptiveMode = FrameGen.Mode(FrameGen.ENGINE_LSFG, target = target)
|
||||
val selected = mode.target == target
|
||||
val pickTarget = { onPick(adaptiveMode) }
|
||||
OutlinedButton(
|
||||
onClick = pickTarget,
|
||||
enabled = lossless.ready,
|
||||
modifier = Modifier.weight(1f).controllerConfirm(
|
||||
enabled = lossless.ready,
|
||||
onClick = pickTarget,
|
||||
),
|
||||
contentPadding = PaddingValues(horizontal = 8.dp, vertical = 8.dp),
|
||||
colors = ButtonDefaults.outlinedButtonColors(
|
||||
containerColor = if (selected) colors.secondary.copy(alpha = 0.18f) else colors.surface,
|
||||
contentColor = if (selected) colors.secondary else colors.onSurface,
|
||||
),
|
||||
) {
|
||||
Text(FrameGen.label(LocalContext.current, adaptiveMode))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedEngine == FrameGen.ENGINE_LSFG && !lossless.ready) {
|
||||
Text(need.orEmpty(), color = colors.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(top = 6.dp))
|
||||
}
|
||||
|
||||
if (gameProfileId != null) {
|
||||
MenuItem(stringResource(R.string.comp_game_use_general), checked = !hasGameOverride) {
|
||||
onResetGame()
|
||||
host.open = null
|
||||
val resetGame = onResetGame
|
||||
OutlinedButton(
|
||||
onClick = resetGame,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 8.dp)
|
||||
.controllerConfirm(onClick = resetGame),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.comp_game_use_general) + if (hasGameOverride) "" else " ✓")
|
||||
}
|
||||
}
|
||||
for (m in 2..4) item(FrameGen.Mode(FrameGen.ENGINE_DDFG, m))
|
||||
val lsfg = (2..4).map { FrameGen.Mode(FrameGen.ENGINE_LSFG, it) } +
|
||||
FrameGen.ADAPTIVE_TARGETS.map { FrameGen.Mode(FrameGen.ENGINE_LSFG, target = it) }
|
||||
lsfg.forEachIndexed { i, m -> item(m, enabled = lossless.ready, detail = need.takeIf { i == 0 }) }
|
||||
|
||||
if (lossless.owned) {
|
||||
val using = when (lossless.source) {
|
||||
Lossless.Source.STEAM -> stringResource(R.string.lsfg_using_steam)
|
||||
Lossless.Source.IMPORT -> stringResource(R.string.lsfg_using_import)
|
||||
Lossless.Source.NONE -> null
|
||||
}
|
||||
MenuItem(stringResource(R.string.lsfg_import), checked = false, detail = using) { host.open = null; onImportLossless() }
|
||||
OutlinedButton(
|
||||
onClick = onImportLossless,
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 8.dp)
|
||||
.controllerConfirm(onClick = onImportLossless),
|
||||
contentPadding = PaddingValues(horizontal = 12.dp, vertical = 8.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.lsfg_import) + (using?.let { " · $it" } ?: ""))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ import java.io.File
|
||||
internal fun Pane(
|
||||
s: FrontEndState, selected: String, a: FrontEndActions, page: (@Composable () -> Unit)?, modifier: Modifier,
|
||||
onSelect: (String) -> Unit, onAndroidAppClick: (HomeApp.LaunchableApp) -> Unit,
|
||||
onOpenDeveloperOptions: () -> Unit, onRequestWirelessAdb: (Boolean) -> Unit, onPairWirelessDebugging: () -> Unit,
|
||||
onPairWirelessDebugging: () -> Unit,
|
||||
) {
|
||||
BoxWithConstraints(modifier = modifier) {
|
||||
CompositionLocalProvider(LocalNarrowPane provides (maxWidth < NarrowPaneWidth)) {
|
||||
@@ -174,7 +174,7 @@ internal fun Pane(
|
||||
label = "pane",
|
||||
) { key ->
|
||||
val drawn = (if (page != null && key == s.pageKey) page else pages[key])
|
||||
?: { Content(s, if (key == "games") gameShown[0] else if (key == "soundtracks") soundShown[0] else key, a, Modifier.fillMaxSize(), onSelect, onAndroidAppClick, onOpenDeveloperOptions, onRequestWirelessAdb, onPairWirelessDebugging) }
|
||||
?: { Content(s, if (key == "games") gameShown[0] else if (key == "soundtracks") soundShown[0] else key, a, Modifier.fillMaxSize(), onSelect, onAndroidAppClick, onPairWirelessDebugging) }
|
||||
val hopSink by androidx.compose.animation.core.animateFloatAsState(
|
||||
if (Hops.sinking == key) 1f else 0f, Motion.tw(260), label = "hopSink",
|
||||
)
|
||||
@@ -237,7 +237,7 @@ private fun romFor(s: FrontEndState, selected: String): Pair<Library.Emulator, L
|
||||
private fun Content(
|
||||
s: FrontEndState, selected: String, a: FrontEndActions, modifier: Modifier,
|
||||
onSelect: (String) -> Unit, onAndroidAppClick: (HomeApp.LaunchableApp) -> Unit,
|
||||
onOpenDeveloperOptions: () -> Unit, onRequestWirelessAdb: (Boolean) -> Unit, onPairWirelessDebugging: () -> Unit,
|
||||
onPairWirelessDebugging: () -> Unit,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val detailPosterWidth = if (LocalConfiguration.current.screenHeightDp < 600) 72.dp else 120.dp
|
||||
@@ -247,7 +247,7 @@ private fun Content(
|
||||
val padV = if (narrow) 12.dp else 18.dp
|
||||
if (selected == "setup") {
|
||||
Column(modifier = modifier.padding(horizontal = padH).padding(top = padV)) {
|
||||
SetupPanel(s, a, onOpenDeveloperOptions, onRequestWirelessAdb, onPairWirelessDebugging)
|
||||
SetupPanel(s, a, onPairWirelessDebugging)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -94,7 +94,6 @@ import androidx.compose.ui.layout.boundsInRoot
|
||||
import androidx.compose.ui.layout.LayoutCoordinates
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.onPlaced
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
|
||||
internal val AttentionAmber: Color @Composable get() = LocalPalette.current.warning
|
||||
|
||||
@@ -212,8 +211,7 @@ internal fun railLabelIcon(key: String): Pair<Int, ImageVector> = when (key) {
|
||||
else -> R.string.rail_updates to updatesIcon(RunningBuild.kind())
|
||||
}
|
||||
|
||||
internal fun setupNeedsAttention(s: FrontEndState): Boolean = !s.ready || (s.available != null && s.available != s.installed) ||
|
||||
PhantomProcessLimit.blocksSteam(s.phantomProcessStatus)
|
||||
internal fun setupNeedsAttention(s: FrontEndState): Boolean = !s.ready || (s.available != null && s.available != s.installed)
|
||||
|
||||
internal fun railBadge(s: FrontEndState, key: String, setupNeedsAttention: Boolean = setupNeedsAttention(s)): Boolean = when (key) {
|
||||
"setup" -> setupNeedsAttention
|
||||
|
||||
@@ -86,8 +86,6 @@ import com.droiddeck.launcher.gpu.FrameGen
|
||||
import com.droiddeck.launcher.gpu.Lossless
|
||||
import com.droiddeck.launcher.input.SecondScreenDisplay
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import kotlin.math.roundToInt
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
@@ -120,6 +118,7 @@ class FrontEndState(
|
||||
val clearCachedApps: Boolean = false,
|
||||
val adbPaired: Boolean = false,
|
||||
val backgroundAppLimit: Int = -1,
|
||||
val memoryHud: String = "off",
|
||||
val tpUbwcMode: String? = null,
|
||||
val tpUbwcRestartRequired: Boolean = false,
|
||||
val canRestartApp: Boolean = false,
|
||||
@@ -164,14 +163,12 @@ class FrontEndState(
|
||||
val buildLabel: String = "local",
|
||||
val oscMode: String = SessionPrefs.OSC_AUTO,
|
||||
val controller: com.droiddeck.launcher.input.ControllerPrefs.Settings? = null,
|
||||
val phantomProcessStatus: PhantomProcessStatus = PhantomProcessStatus.NOT_APPLICABLE,
|
||||
val adreno: Boolean = true,
|
||||
val vkBridge: Boolean = false,
|
||||
val venus: Boolean = false,
|
||||
val venusHostVulkan: String? = null,
|
||||
val vkBridgeSafe: Boolean = true,
|
||||
val bridgeProtonDxvk: Boolean = false,
|
||||
val showPhantomGate: Boolean = false,
|
||||
val orientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE,
|
||||
val launcherOrientation: Int = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER,
|
||||
val homePage: String = com.droiddeck.launcher.core.AppUiPrefs.HOME_PAGE_STEAM,
|
||||
@@ -262,6 +259,7 @@ class FrontEndActions(
|
||||
val onBuildWatermark: () -> Unit = {},
|
||||
val onSteamGpuDrawing: () -> Unit = {},
|
||||
val onClearCachedApps: (Boolean) -> Unit = {},
|
||||
val onMemoryHud: (String) -> Unit = {},
|
||||
val onTpUbwcMode: (String) -> Unit = {},
|
||||
val onRestartApp: () -> Unit = {},
|
||||
val onBackgroundAppLimit: (Int) -> Unit = {},
|
||||
@@ -313,15 +311,9 @@ class FrontEndActions(
|
||||
val onIntegrationLocation: () -> Unit = {},
|
||||
val onAndroidApp: (HomeApp.LaunchableApp, Int?) -> Unit = { _, _ -> },
|
||||
val onBackActionsInverted: (Boolean) -> Unit = {},
|
||||
val onRefreshPhantomStatus: () -> Unit = {},
|
||||
val onOpenDeveloperOptions: (Int?) -> Unit = {},
|
||||
val onSetPhantomProcessLimit: (Boolean, (String?) -> Unit) -> Unit,
|
||||
val onCopyPhantomCommand: (Boolean) -> Unit = {},
|
||||
val onDismissPhantomGate: () -> Unit = {},
|
||||
val onStartWirelessAdbPairing: (Boolean) -> Unit = {},
|
||||
val onStartPairingGuide: (Int?, Boolean) -> Boolean = { _, _ -> false },
|
||||
val onShowPhantomGate: () -> Unit = {},
|
||||
val onQueuePlaySteam: () -> Unit = {},
|
||||
val onStartWirelessAdbPairing: () -> Unit = {},
|
||||
val onStartPairingGuide: (Int?) -> Boolean = { false },
|
||||
val onEnsureNotifications: ((Boolean) -> Unit) -> Unit = { it(true) },
|
||||
val controller: ControllerActions? = null,
|
||||
val updates: UpdatesActions = UpdatesActions(),
|
||||
@@ -509,92 +501,39 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
if (com.droiddeck.launcher.stores.StoresState.openGameRequest != null) selected = "stores"
|
||||
}
|
||||
var showDeveloperDisplayChoice by rememberSaveable { mutableStateOf(false) }
|
||||
var developerChoiceGuided by rememberSaveable { mutableStateOf(false) }
|
||||
var developerChoiceToggle by rememberSaveable { mutableStateOf(false) }
|
||||
var guidedLimitEnabled by rememberSaveable { mutableStateOf(false) }
|
||||
var appToChooseDisplay by remember { mutableStateOf<HomeApp.LaunchableApp?>(null) }
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val ctx = LocalContext.current
|
||||
val phantomGateVisible = s.showPhantomGate && PhantomProcessLimit.blocksSteam(s.phantomProcessStatus)
|
||||
val processSettingsPageVisible = phantomGateVisible || showDeveloperDisplayChoice
|
||||
val requestDeveloperOptions = {
|
||||
developerChoiceGuided = false
|
||||
developerChoiceToggle = false
|
||||
if (s.secondScreenDisplays.isEmpty()) a.onOpenDeveloperOptions(null)
|
||||
else showDeveloperDisplayChoice = true
|
||||
val openPairingOn: (Int?) -> Unit = { displayId ->
|
||||
a.onStartWirelessAdbPairing()
|
||||
if (!a.onStartPairingGuide(displayId)) a.onOpenDeveloperOptions(displayId)
|
||||
}
|
||||
val openDeveloperOptionsOn: (Int?) -> Unit = { displayId ->
|
||||
if (developerChoiceGuided) a.onStartWirelessAdbPairing(guidedLimitEnabled)
|
||||
val guided = developerChoiceGuided || developerChoiceToggle
|
||||
if (!guided || !a.onStartPairingGuide(displayId, developerChoiceToggle)) a.onOpenDeveloperOptions(displayId)
|
||||
developerChoiceGuided = false
|
||||
developerChoiceToggle = false
|
||||
}
|
||||
val requestChildProcessToggle = {
|
||||
if (!PhantomProcessLimit.hasDeveloperToggle() || com.droiddeck.launcher.core.GlobalSettings.developerOptionsOn(ctx)) {
|
||||
requestDeveloperOptions()
|
||||
} else {
|
||||
developerChoiceGuided = false
|
||||
developerChoiceToggle = true
|
||||
if (s.secondScreenDisplays.isEmpty()) openDeveloperOptionsOn(null)
|
||||
else showDeveloperDisplayChoice = true
|
||||
}
|
||||
}
|
||||
val startGuidedPairing: (Boolean) -> Unit = { enabled ->
|
||||
val startGuidedPairing: () -> Unit = {
|
||||
a.onEnsureNotifications { granted ->
|
||||
if (granted) {
|
||||
guidedLimitEnabled = enabled
|
||||
developerChoiceGuided = true
|
||||
if (s.secondScreenDisplays.isEmpty()) openDeveloperOptionsOn(null)
|
||||
if (s.secondScreenDisplays.isEmpty()) openPairingOn(null)
|
||||
else showDeveloperDisplayChoice = true
|
||||
}
|
||||
}
|
||||
}
|
||||
val childProcessRequest = androidx.compose.runtime.rememberUpdatedState {
|
||||
if (PhantomProcessLimit.hasDeveloperToggle()) requestChildProcessToggle() else a.onShowPhantomGate()
|
||||
}
|
||||
DisposableEffect(Unit) {
|
||||
val handler: () -> Unit = { childProcessRequest.value() }
|
||||
ChildProcessSetup.request = handler
|
||||
onDispose { if (ChildProcessSetup.request === handler) ChildProcessSetup.request = null }
|
||||
}
|
||||
var applyingSavedPairing by remember { mutableStateOf(false) }
|
||||
val fixPhantomLimit = {
|
||||
if (!s.adbPaired || !com.droiddeck.launcher.core.GlobalSettings.wirelessDebuggingOn(ctx)) startGuidedPairing(false)
|
||||
else if (!applyingSavedPairing) {
|
||||
applyingSavedPairing = true
|
||||
a.onSetPhantomProcessLimit(false) { error ->
|
||||
applyingSavedPairing = false
|
||||
if (error != null) startGuidedPairing(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
LaunchedEffect(s.showPhantomGate, s.phantomProcessStatus) {
|
||||
if (phantomGateVisible) {
|
||||
while (true) {
|
||||
kotlinx.coroutines.delay(2_000)
|
||||
a.onRefreshPhantomStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
val pageBack = { if (!Hops.back(a.onPageBack)) a.onPageBack() }
|
||||
BackHandler(enabled = !processSettingsPageVisible && s.pageKey != null && page != null) { pageBack() }
|
||||
BackHandler(enabled = !showDeveloperDisplayChoice && s.pageKey != null && page != null) { pageBack() }
|
||||
LaunchedEffect(s.pageKey, selected) { Hops.forget(s.pageKey ?: selected) }
|
||||
BackHandler(enabled = !processSettingsPageVisible && s.pageKey == null && Hops.origin?.page == selected) {
|
||||
BackHandler(enabled = !showDeveloperDisplayChoice && s.pageKey == null && Hops.origin?.page == selected) {
|
||||
val rail = Hops.origin?.rail ?: return@BackHandler
|
||||
Hops.back { selected = rail }
|
||||
}
|
||||
val density = androidx.compose.ui.platform.LocalDensity.current.density
|
||||
remember(density) { Hops.density = density; true }
|
||||
BackHandler(
|
||||
enabled = !processSettingsPageVisible && (s.pageKey == null || page == null) &&
|
||||
enabled = !showDeveloperDisplayChoice && (s.pageKey == null || page == null) &&
|
||||
(selected.startsWith("emu:") || selected.startsWith("rom:") || selected.startsWith("user:") || selected == "store"),
|
||||
) {
|
||||
selected = if (selected.startsWith("rom:")) "emu:" + selected.removePrefix("rom:").substringBefore(':') else "desktop"
|
||||
}
|
||||
val backToMore = s.pageKey == null && Hops.origin == null && selected in NavTabs.more(s)
|
||||
BackHandler(enabled = !processSettingsPageVisible && backToMore) {
|
||||
BackHandler(enabled = !showDeveloperDisplayChoice && backToMore) {
|
||||
selected = NavTabs.MORE
|
||||
}
|
||||
LaunchedEffect(s.soundtracksEnabled) {
|
||||
@@ -696,8 +635,8 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
.onFocusChanged { anyFocused = it.hasFocus },
|
||||
) {
|
||||
val bottomNavigation = maxHeight > maxWidth
|
||||
LaunchedEffect(processSettingsPageVisible) {
|
||||
if (processSettingsPageVisible) return@LaunchedEffect
|
||||
LaunchedEffect(showDeveloperDisplayChoice) {
|
||||
if (showDeveloperDisplayChoice) return@LaunchedEffect
|
||||
snapshotFlow { window.isWindowFocused }.first { it }
|
||||
if (inputModeManager.inputMode != InputMode.Keyboard) inputModeManager.requestInputMode(InputMode.Keyboard)
|
||||
if (s.dualScreen && frontFocus.primaryAttached == 0) focusDualPane()
|
||||
@@ -707,12 +646,12 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
LaunchedEffect(s.pageKey) {
|
||||
val closed = openPage != null && s.pageKey == null
|
||||
openPage = s.pageKey
|
||||
if (!closed || frontFocus.focusedRail != null || processSettingsPageVisible || inputModeManager.inputMode != InputMode.Keyboard) return@LaunchedEffect
|
||||
if (!closed || frontFocus.focusedRail != null || showDeveloperDisplayChoice || inputModeManager.inputMode != InputMode.Keyboard) return@LaunchedEffect
|
||||
withFrameNanos { }
|
||||
runCatching { frontFocus.paneEntry().requestFocus() }
|
||||
}
|
||||
LaunchedEffect(selected, s.pageKey, processSettingsPageVisible) {
|
||||
if (processSettingsPageVisible) return@LaunchedEffect
|
||||
LaunchedEffect(selected, s.pageKey, showDeveloperDisplayChoice) {
|
||||
if (showDeveloperDisplayChoice) return@LaunchedEffect
|
||||
kotlinx.coroutines.delay(Motion.ms(PAGE_EXIT_MS).toLong())
|
||||
if (inputModeManager.inputMode != InputMode.Keyboard) return@LaunchedEffect
|
||||
if (s.pageKey == "performance") {
|
||||
@@ -727,7 +666,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
else focusWithinFrames({ anyFocused }) { if (frontFocus.primaryAttached > 0) frontFocus.primary else frontFocus.railFor(railSelection) }
|
||||
}
|
||||
LaunchedEffect(railPicks) {
|
||||
if (railPicks == 0 || processSettingsPageVisible) return@LaunchedEffect
|
||||
if (railPicks == 0 || showDeveloperDisplayChoice) return@LaunchedEffect
|
||||
kotlinx.coroutines.delay(Motion.ms(PAGE_EXIT_MS).toLong())
|
||||
if (inputModeManager.inputMode != InputMode.Keyboard) return@LaunchedEffect
|
||||
val entry = withTimeoutOrNull(1_000) { snapshotFlow { frontFocus.primaryAttached > 0 }.first { it } }
|
||||
@@ -765,7 +704,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
}
|
||||
var screenAt by remember { mutableStateOf(Offset.Zero) }
|
||||
if (s.dualScreen) DualPanelPublisher(s, railSelection, openTab, { key ->
|
||||
if (processSettingsPageVisible) return@DualPanelPublisher
|
||||
if (showDeveloperDisplayChoice) return@DualPanelPublisher
|
||||
if (inputModeManager.inputMode != InputMode.Keyboard) inputModeManager.requestInputMode(InputMode.Keyboard)
|
||||
focusManager.clearFocus(force = true)
|
||||
onRailSelect(key)
|
||||
@@ -774,7 +713,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
val pageKeyNow = androidx.compose.runtime.rememberUpdatedState(s.pageKey)
|
||||
var railHold by remember { mutableStateOf<kotlinx.coroutines.Job?>(null) }
|
||||
val tabStep = androidx.compose.runtime.rememberUpdatedState { step: Int ->
|
||||
if (!processSettingsPageVisible) {
|
||||
if (!showDeveloperDisplayChoice) {
|
||||
val keys = navigationKeys(s)
|
||||
keys.getOrNull(keys.indexOf(railSelectionNow.value) + step)?.let { key ->
|
||||
PageSwipe.direction = step
|
||||
@@ -819,7 +758,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
) {
|
||||
Pane(
|
||||
s, selected, a, page,
|
||||
Modifier.fillMaxSize().then(paneFocus).pageSwipe({ !processSettingsPageVisible && appToChooseDisplay == null }, edgeGuard = { !bottomNavigation }) { dir ->
|
||||
Modifier.fillMaxSize().then(paneFocus).pageSwipe({ !showDeveloperDisplayChoice && appToChooseDisplay == null }, edgeGuard = { !bottomNavigation }) { dir ->
|
||||
val keys = navigationKeys(s)
|
||||
val at = keys.indexOf(railSelectionNow.value)
|
||||
if (at >= 0) keys.getOrNull(at + dir)?.let { key ->
|
||||
@@ -832,9 +771,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
if (s.secondScreenDisplays.isEmpty() && s.ownScreen == null) a.onAndroidApp(app, null)
|
||||
else appToChooseDisplay = app
|
||||
},
|
||||
onOpenDeveloperOptions = requestChildProcessToggle,
|
||||
onPairWirelessDebugging = { startGuidedPairing(false) },
|
||||
onRequestWirelessAdb = startGuidedPairing,
|
||||
onPairWirelessDebugging = startGuidedPairing,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -866,18 +803,6 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
onDismiss = { appToChooseDisplay = null },
|
||||
)
|
||||
}
|
||||
if (phantomGateVisible) {
|
||||
Box(Modifier.fillMaxSize().background(colors.background)) {
|
||||
PhantomProcessGatePage(
|
||||
status = s.phantomProcessStatus,
|
||||
onDismiss = a.onDismissPhantomGate,
|
||||
onOpenDeveloperOptions = requestChildProcessToggle,
|
||||
applyingSavedPairing = applyingSavedPairing,
|
||||
onFixWithWirelessDebugging = fixPhantomLimit,
|
||||
onCopyCommand = { a.onCopyPhantomCommand(false) },
|
||||
)
|
||||
}
|
||||
}
|
||||
if (showDeveloperDisplayChoice) {
|
||||
DeveloperDisplayChoiceDialog(
|
||||
displays = s.secondScreenDisplays.map { display ->
|
||||
@@ -885,16 +810,14 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
},
|
||||
onMainScreen = {
|
||||
showDeveloperDisplayChoice = false
|
||||
openDeveloperOptionsOn(null)
|
||||
openPairingOn(null)
|
||||
},
|
||||
onSecondaryScreen = { displayId ->
|
||||
showDeveloperDisplayChoice = false
|
||||
openDeveloperOptionsOn(displayId)
|
||||
openPairingOn(displayId)
|
||||
},
|
||||
onDismiss = {
|
||||
showDeveloperDisplayChoice = false
|
||||
developerChoiceGuided = false
|
||||
developerChoiceToggle = false
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -903,7 +826,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
(s.pageKey == null && Hops.origin?.page == selected) ||
|
||||
((s.pageKey == null || page == null) &&
|
||||
(selected.startsWith("emu:") || selected.startsWith("rom:") || selected.startsWith("user:") || selected == "store"))
|
||||
val exitArmed = !processSettingsPageVisible && !hasBackTarget
|
||||
val exitArmed = !showDeveloperDisplayChoice && !hasBackTarget
|
||||
LaunchedEffect(exitArmed, selected) { ExitGesture.reset() }
|
||||
BackHandler(enabled = exitArmed && DevPreview.drawer == null) {
|
||||
when (ExitGesture.back()) {
|
||||
@@ -920,10 +843,6 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
}
|
||||
}
|
||||
|
||||
internal object ChildProcessSetup {
|
||||
@Volatile var request: (() -> Unit)? = null
|
||||
}
|
||||
|
||||
internal object MainTabSteps {
|
||||
@Volatile var handler: ((Int) -> Unit)? = null
|
||||
@Volatile var otherKeys = 0
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.compose.ui.platform.LocalLifecycleOwner
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import android.os.Build
|
||||
@@ -50,6 +53,7 @@ import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -79,8 +83,6 @@ import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import com.droiddeck.launcher.core.AppLanguage
|
||||
import com.droiddeck.launcher.core.DeviceSupport
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.stores.download.StoreDownloadTier
|
||||
import com.droiddeck.launcher.R
|
||||
@@ -146,28 +148,24 @@ internal fun CheckRow(state: CheckState, title: String, detail: String?, divider
|
||||
internal fun SetupPanel(
|
||||
s: FrontEndState,
|
||||
a: FrontEndActions,
|
||||
onOpenDeveloperOptions: () -> Unit,
|
||||
onRequestWirelessAdb: (Boolean) -> Unit,
|
||||
onPairWirelessDebugging: () -> Unit,
|
||||
) {
|
||||
val host = rememberMenuHost()
|
||||
val ctx = LocalContext.current
|
||||
var hideHomeFromRecents by remember { mutableStateOf(com.droiddeck.launcher.core.AppUiPrefs.hideHomeFromRecents(ctx)) }
|
||||
var processLimitBusy by remember { mutableStateOf(false) }
|
||||
var processLimitMessage by remember { mutableStateOf<String?>(null) }
|
||||
val setProcessLimit: (Boolean) -> Unit = { enabled ->
|
||||
processLimitBusy = true
|
||||
processLimitMessage = null
|
||||
a.onSetPhantomProcessLimit(enabled) { error ->
|
||||
processLimitBusy = false
|
||||
if (error == null) {
|
||||
a.onRefreshPhantomStatus()
|
||||
} else {
|
||||
processLimitMessage = ctx.getString(R.string.setup_limit_adb_failed)
|
||||
onRequestWirelessAdb(enabled)
|
||||
var steamOrientation by remember { mutableStateOf(SessionPrefs.orientation(ctx, "steam")) }
|
||||
var desktopOrientation by remember { mutableStateOf(SessionPrefs.orientation(ctx, "desktop")) }
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
DisposableEffect(lifecycleOwner, ctx) {
|
||||
val observer = LifecycleEventObserver { _, event ->
|
||||
if (event == Lifecycle.Event.ON_RESUME) {
|
||||
steamOrientation = SessionPrefs.orientation(ctx, "steam")
|
||||
desktopOrientation = SessionPrefs.orientation(ctx, "desktop")
|
||||
}
|
||||
}
|
||||
lifecycleOwner.lifecycle.addObserver(observer)
|
||||
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
|
||||
}
|
||||
var hideHomeFromRecents by remember { mutableStateOf(com.droiddeck.launcher.core.AppUiPrefs.hideHomeFromRecents(ctx)) }
|
||||
val runtime = when {
|
||||
s.busy -> stringResource(R.string.common_working)
|
||||
s.removalPending -> stringResource(R.string.setup_retry_removal)
|
||||
@@ -180,9 +178,7 @@ internal fun SetupPanel(
|
||||
val gpu = remember { com.droiddeck.launcher.gpu.GpuInfo.detect() }
|
||||
val gpuOk = gpu.support == com.droiddeck.launcher.gpu.GpuInfo.Support.TESTED || s.vkBridge
|
||||
val gpuName = remember { DeviceSupport.gpuName(ctx) }
|
||||
val limitBlocks = PhantomProcessLimit.blocksSteam(s.phantomProcessStatus)
|
||||
val signedIn = s.offlineAccount != null
|
||||
var showLimitDetails by rememberSaveable { mutableStateOf(false) }
|
||||
var editSgdbKey by remember { mutableStateOf(false) }
|
||||
var editDownloadPrefix by remember { mutableStateOf(false) }
|
||||
var editDownloadProxy by remember { mutableStateOf(false) }
|
||||
@@ -214,12 +210,6 @@ internal fun SetupPanel(
|
||||
var tabTurned by remember { mutableStateOf(false) }
|
||||
val pick: (Int) -> Unit = { i -> tab = i; tabTurned = true; searching = false; query = ""; if (i == DEVELOPER_TAB) logsRefresh++ }
|
||||
val inputModeManager = LocalInputModeManager.current
|
||||
LaunchedEffect(Unit) {
|
||||
while (true) {
|
||||
kotlinx.coroutines.delay(2_000)
|
||||
a.onRefreshPhantomStatus()
|
||||
}
|
||||
}
|
||||
LaunchedEffect(tab) {
|
||||
if (tabTurned && inputModeManager.inputMode == InputMode.Keyboard) {
|
||||
androidx.compose.runtime.withFrameNanos { }
|
||||
@@ -227,7 +217,7 @@ internal fun SetupPanel(
|
||||
}
|
||||
}
|
||||
val runtimeOk = s.ready && !s.busy && !s.removalPending
|
||||
val checks = listOf(gpuOk, runtimeOk, !limitBlocks, signedIn)
|
||||
val checks = listOf(gpuOk, runtimeOk, signedIn)
|
||||
val passing = checks.count { it }
|
||||
var showChecks by rememberSaveable { mutableStateOf(s.vkBridge) }
|
||||
Rise(0, Modifier.fillMaxSize()) {
|
||||
@@ -254,7 +244,7 @@ internal fun SetupPanel(
|
||||
if (listing) SettingsSearchResults(query) { section -> pick(section.ordinal) }
|
||||
else when (tab) {
|
||||
OVERVIEW_TAB -> {
|
||||
OnboardingCard(limitBlocks, a.onShowPhantomGate)
|
||||
OnboardingCard()
|
||||
// Setup's "Safe mode" row, under the GPU row while the bridge is on and can be used here.
|
||||
val bridgeModeRow = !s.adreno && s.vkBridge && com.droiddeck.launcher.core.DeviceSupport.bridgeUsable()
|
||||
val gpuCheck: @Composable (Boolean) -> Unit = { divider ->
|
||||
@@ -343,41 +333,6 @@ internal fun SetupPanel(
|
||||
if (divider) Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
}
|
||||
}
|
||||
val limitCheck: @Composable (Boolean) -> Unit = { divider ->
|
||||
CheckRow(
|
||||
if (limitBlocks) CheckState.WARN else CheckState.OK,
|
||||
stringResource(R.string.setup_limit),
|
||||
when (s.phantomProcessStatus) {
|
||||
PhantomProcessStatus.ENABLED -> stringResource(R.string.setup_limit_on)
|
||||
PhantomProcessStatus.UNSET -> stringResource(R.string.setup_limit_unset)
|
||||
PhantomProcessStatus.UNREADABLE -> stringResource(R.string.setup_limit_unknown)
|
||||
else -> PhantomProcessLimit.title(ctx, s.phantomProcessStatus)
|
||||
},
|
||||
divider = divider && !showLimitDetails,
|
||||
) {
|
||||
if (limitBlocks) PrimaryButton(stringResource(R.string.setup_fix_it), compact = true, onClick = a.onShowPhantomGate)
|
||||
else if (s.phantomProcessStatus != PhantomProcessStatus.NOT_APPLICABLE) {
|
||||
SecondaryButton(if (showLimitDetails) stringResource(R.string.common_hide) else stringResource(R.string.setup_details), compact = true) { showLimitDetails = !showLimitDetails }
|
||||
}
|
||||
}
|
||||
AnimatedVisibility(showLimitDetails, enter = expandVertically(Motion.sp(1f)) + fadeIn(Motion.sp(1f)), exit = shrinkVertically(Motion.sp(1f)) + fadeOut(Motion.sp(1f))) {
|
||||
Column(modifier = Modifier.fillMaxWidth().padding(start = 56.dp, end = 14.dp, top = 4.dp, bottom = 10.dp)) {
|
||||
Text(
|
||||
if (limitBlocks) PhantomProcessLimit.gateInstructions(ctx, s.phantomProcessStatus)
|
||||
else PhantomProcessLimit.instructions(ctx, s.phantomProcessStatus),
|
||||
fontSize = 14.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(vertical = 4.dp),
|
||||
)
|
||||
Actions {
|
||||
if (s.phantomProcessStatus == PhantomProcessStatus.DISABLED) {
|
||||
SecondaryButton(stringResource(R.string.setup_limit_turn_on), compact = true, enabled = !processLimitBusy) { setProcessLimit(true) }
|
||||
}
|
||||
}
|
||||
if (processLimitBusy) LinearProgressIndicator(modifier = Modifier.fillMaxWidth().padding(vertical = 6.dp))
|
||||
processLimitMessage?.let { Text(it, fontSize = 14.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(vertical = 4.dp)) }
|
||||
}
|
||||
}
|
||||
if (divider && showLimitDetails) Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
}
|
||||
val accountCheck: @Composable (Boolean) -> Unit = { divider ->
|
||||
CheckRow(
|
||||
if (signedIn) CheckState.OK else CheckState.WARN,
|
||||
@@ -392,13 +347,12 @@ internal fun SetupPanel(
|
||||
divider = divider,
|
||||
)
|
||||
}
|
||||
val all = listOf(gpuCheck, runtimeCheck, limitCheck, accountCheck)
|
||||
val all = listOf(gpuCheck, runtimeCheck, accountCheck)
|
||||
ReadinessCard(
|
||||
passing, checks.size,
|
||||
listOfNotNull(
|
||||
gpu.displayName(ctx),
|
||||
s.installed?.let { stringResource(R.string.setup_ready_runtime, it) },
|
||||
stringResource(R.string.setup_ready_limit_off).takeIf { !limitBlocks },
|
||||
s.offlineAccount?.takeIf { it.isNotEmpty() }?.let { stringResource(R.string.setup_ready_signed_in, it) },
|
||||
).joinToString(" · "),
|
||||
open = showChecks, onDetails = { showChecks = !showChecks },
|
||||
@@ -516,7 +470,27 @@ internal fun SetupPanel(
|
||||
ChoiceRow(
|
||||
host, "orientation", stringResource(R.string.setup_session_orientation), stringResource(R.string.setup_session_orientation_hint),
|
||||
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
|
||||
s.orientation, onPick = a.onOrientation,
|
||||
s.orientation, onPick = { value ->
|
||||
a.onOrientation(value)
|
||||
steamOrientation = SessionPrefs.orientation(ctx, "steam")
|
||||
desktopOrientation = SessionPrefs.orientation(ctx, "desktop")
|
||||
},
|
||||
)
|
||||
ChoiceRow(
|
||||
host, "orientation-steam", stringResource(R.string.setup_session_orientation) + " (Steam)", stringResource(R.string.setup_session_orientation_hint),
|
||||
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
|
||||
steamOrientation, onPick = { value ->
|
||||
steamOrientation = value
|
||||
SessionPrefs.setOrientation(ctx, "steam", value)
|
||||
},
|
||||
)
|
||||
ChoiceRow(
|
||||
host, "orientation-desktop", stringResource(R.string.setup_session_orientation) + " (Desktop)", stringResource(R.string.setup_session_orientation_hint),
|
||||
SessionPrefs.orientationOptions.map { (value, label) -> value to stringResource(label) },
|
||||
desktopOrientation, onPick = { value ->
|
||||
desktopOrientation = value
|
||||
SessionPrefs.setOrientation(ctx, "desktop", value)
|
||||
},
|
||||
)
|
||||
ToggleRow(
|
||||
host, "launcher-fullscreen", stringResource(R.string.setup_fullscreen),
|
||||
@@ -736,6 +710,15 @@ private fun MemoryGroup(s: FrontEndState, a: FrontEndActions, host: MenuHost, on
|
||||
s.backgroundAppLimit, enabled = s.adbPaired || s.backgroundAppLimit != com.droiddeck.launcher.core.BackgroundAppLimit.OFF,
|
||||
onPick = a.onBackgroundAppLimit,
|
||||
)
|
||||
ChoiceRow(
|
||||
host, "memory-hud", stringResource(R.string.setup_memory_hud), stringResource(R.string.setup_memory_hud_hint),
|
||||
listOf(
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_OFF to stringResource(R.string.game_env_off),
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_SIMPLE to stringResource(R.string.setup_memory_hud_simple),
|
||||
com.droiddeck.launcher.session.SessionPrefs.MEMORY_HUD_ADVANCED to stringResource(R.string.setup_memory_hud_advanced),
|
||||
),
|
||||
s.memoryHud, onPick = a.onMemoryHud,
|
||||
)
|
||||
if (!s.adbPaired) ActionRow(
|
||||
stringResource(R.string.setup_adb_pair), stringResource(R.string.setup_adb_pair_hint),
|
||||
stringResource(R.string.setup_adb_pair_button), onPairWirelessDebugging,
|
||||
@@ -783,7 +766,7 @@ internal fun ReadinessCard(
|
||||
|
||||
@Composable
|
||||
private fun FrameGenMenu(s: FrontEndState, a: FrontEndActions, host: MenuHost) {
|
||||
FrameGenMenu(host, s.frameGen, s.lossless, a.onFrameGenPick, a.onImportLossless)
|
||||
FrameGenMenu(s.frameGen, s.lossless, a.onFrameGenPick, a.onImportLossless, legacyButtons = true)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -831,8 +814,7 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
|
||||
) {
|
||||
host.open = if (host.open == "fg") null else "fg"
|
||||
}
|
||||
FrameGenMenu(
|
||||
host = host,
|
||||
if (host.open == "fg") FrameGenMenu(
|
||||
mode = if (frameGenProfileKey != null) gameFrameGenMode else s.frameGen,
|
||||
lossless = s.lossless,
|
||||
onPick = { mode ->
|
||||
@@ -846,6 +828,7 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
|
||||
}
|
||||
},
|
||||
onImportLossless = a.onImportLossless,
|
||||
legacyButtons = true,
|
||||
gameProfileId = frameGenProfileKey,
|
||||
hasGameOverride = gameFrameGenOverride,
|
||||
onResetGame = {
|
||||
@@ -1272,7 +1255,7 @@ private fun CustomColorRows() {
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun OnboardingCard(limitBlocks: Boolean = false, onSetUpLimit: () -> Unit = {}) {
|
||||
internal fun OnboardingCard() {
|
||||
val active by com.droiddeck.launcher.session.Onboarding.active.collectAsState()
|
||||
val failed by com.droiddeck.launcher.session.Onboarding.failed.collectAsState()
|
||||
val facts by com.droiddeck.launcher.session.Onboarding.facts.collectAsState()
|
||||
@@ -1318,18 +1301,5 @@ internal fun OnboardingCard(limitBlocks: Boolean = false, onSetUpLimit: () -> Un
|
||||
}
|
||||
}
|
||||
}
|
||||
if (limitBlocks) {
|
||||
Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 10.dp),
|
||||
) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(stringResource(R.string.setup_limit), fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground)
|
||||
Text(stringResource(R.string.onboarding_limit_reason), fontSize = 13.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
PrimaryButton(stringResource(R.string.onboarding_limit_action), compact = true, onClick = onSetUpLimit)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,9 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.draw.clip
|
||||
@@ -31,6 +34,7 @@ import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.unit.IntOffset
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.runtime.getValue
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
@@ -67,6 +71,21 @@ internal val GlassesIcon: ImageVector by lazy {
|
||||
}.build()
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun rememberShowGlassesShortcut(): Boolean {
|
||||
val context = LocalContext.current
|
||||
var show by remember(context) { mutableStateOf(SessionPrefs.showGlassesShortcut(context)) }
|
||||
DisposableEffect(context) {
|
||||
val preferences = context.getSharedPreferences("session", android.content.Context.MODE_PRIVATE)
|
||||
val listener = android.content.SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
|
||||
if (key == "showGlassesShortcut") show = SessionPrefs.showGlassesShortcut(context)
|
||||
}
|
||||
preferences.registerOnSharedPreferenceChangeListener(listener)
|
||||
onDispose { preferences.unregisterOnSharedPreferenceChangeListener(listener) }
|
||||
}
|
||||
return show
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun rememberGlasses(): Pair<GlassesState, GlassesSettings> {
|
||||
val g by Glasses.state.collectAsState()
|
||||
@@ -88,7 +107,7 @@ internal fun VrControllerGroups(host: MenuHost, track: (String) -> Modifier = {
|
||||
androidx.compose.runtime.LaunchedEffect(Unit) { com.droiddeck.launcher.input.VrControllers.load(context) }
|
||||
val c by com.droiddeck.launcher.input.VrControllers.settings.collectAsState()
|
||||
val emulate = com.droiddeck.launcher.input.VrControllers.Emulate.entries
|
||||
SettingsGroup(stringResource(R.string.vr_controllers_group)) {
|
||||
SettingsGroup(stringResource(R.string.vr_controllers_group), key = "vr-controllers") {
|
||||
ChoiceRow(host, "vr-emulate", stringResource(R.string.vr_controllers_emulate), stringResource(R.string.vr_controllers_emulate_hint),
|
||||
emulate.map { it to stringResource(when (it) {
|
||||
com.droiddeck.launcher.input.VrControllers.Emulate.OFF -> R.string.vr_controllers_off
|
||||
@@ -133,6 +152,7 @@ internal fun GlassesGroups(
|
||||
) {
|
||||
val display = tab == null || tab == GlassesTab.DISPLAY
|
||||
val vr = tab == null || tab == GlassesTab.VR
|
||||
val showShortcut = rememberShowGlassesShortcut()
|
||||
val picture = GlassesRendering.picture(s, g.sbs, steamVrRunning)
|
||||
val usesGlasses = GlassesRendering.usesGlasses(g, outputActive, steamVrRunning)
|
||||
val spatialTracking = g.spatialConnected && s.positionalTracking
|
||||
@@ -142,13 +162,13 @@ internal fun GlassesGroups(
|
||||
val directView = usesGlasses && picture == GlassesRendering.Picture.STEREO
|
||||
val menuScreen = !inSession && g.usable && s.gameOnGlasses && s.screen3dof
|
||||
if (g.canControl && onRecenter != null && s.headTracking && (virtualScreen || menuScreen || (directView && steamVrRunning))) {
|
||||
SettingsGroup(stringResource(R.string.glasses_quick_actions), compact = true) {
|
||||
SettingsGroup(stringResource(R.string.glasses_quick_actions), compact = true, key = "vr-glasses-quick") {
|
||||
ActionRow(stringResource(R.string.glasses_recenter),
|
||||
if (virtualScreen || menuScreen) stringResource(R.string.glasses_recenter_screen_hint) else null,
|
||||
stringResource(R.string.cardboard_recenter_button), onRecenter)
|
||||
}
|
||||
}
|
||||
if (display) SettingsGroup(g.model) {
|
||||
if (display) SettingsGroup(g.model, key = "vr-glasses") {
|
||||
if (g.experimental) SettingsRow(stringResource(R.string.glasses_control), stringResource(
|
||||
if (g.supportsDisplayModeControl) R.string.glasses_xreal_experimental else R.string.glasses_pro2_experimental)) {}
|
||||
val status = if (g.hasDisplay) stringResource(R.string.glasses_status, g.width, g.height, kotlin.math.round(g.hz).toInt(),
|
||||
@@ -168,9 +188,15 @@ internal fun GlassesGroups(
|
||||
}
|
||||
ToggleRow(host, "glasses-game", stringResource(R.string.glasses_game_on), stringResource(R.string.glasses_game_on_hint),
|
||||
s.gameOnGlasses, chipModifier = track("glasses-game")) { Glasses.setGameOnGlasses(it) }
|
||||
if (inSession) {
|
||||
val context = androidx.compose.ui.platform.LocalContext.current
|
||||
ToggleRow(host, "glasses-shortcut", stringResource(R.string.glasses_show_shortcut),
|
||||
stringResource(R.string.glasses_show_shortcut_hint), showShortcut,
|
||||
chipModifier = track("glasses-shortcut")) { SessionPrefs.setShowGlassesShortcut(context, it) }
|
||||
}
|
||||
}
|
||||
if (display && g.canControl && g.supportsDisplayModeControl && (inSession || g.sbs || g.sbsSupport == GlassesState.SBS_FAILS)) {
|
||||
SettingsGroup(stringResource(R.string.glasses_display_mode)) {
|
||||
SettingsGroup(stringResource(R.string.glasses_display_mode), key = "vr-glasses-mode") {
|
||||
if (g.sbsSupport == GlassesState.SBS_FAILS && !g.sbs) {
|
||||
ActionRow(stringResource(R.string.glasses_3d), stringResource(R.string.glasses_3d_failed),
|
||||
stringResource(R.string.stores_dl_retry), { Glasses.set3d(true) })
|
||||
@@ -182,12 +208,12 @@ internal fun GlassesGroups(
|
||||
val profiles = if (inSession) listOf(GlassesDisplayModes.profile(g.sbs, false))
|
||||
else listOf(GlassesDisplayProfile.TWO_D, GlassesDisplayProfile.THREE_D)
|
||||
for (profile in profiles) SettingsGroup(stringResource(if (profile == GlassesDisplayProfile.TWO_D)
|
||||
R.string.glasses_output_2d else R.string.glasses_output_3d)) {
|
||||
R.string.glasses_output_2d else R.string.glasses_output_3d), key = "vr-glasses-output-${profile.name.lowercase()}") {
|
||||
GlassesResolutionRow(host, g, s, profile, track)
|
||||
if ((profile == GlassesDisplayProfile.THREE_D) == g.sbs) GlassesRefreshRow(host, g, s, track)
|
||||
}
|
||||
}
|
||||
if (display && (g.canControl || g.hasDisplay)) SettingsGroup(stringResource(R.string.glasses_picture_group)) {
|
||||
if (display && (g.canControl || g.hasDisplay)) SettingsGroup(stringResource(R.string.glasses_picture_group), key = "vr-glasses-picture") {
|
||||
ChoiceRow(host, "glasses-picture", stringResource(R.string.glasses_picture), stringResource(R.string.glasses_picture_hint),
|
||||
listOf(
|
||||
GlassesSettings.PICTURE_AUTO to stringResource(R.string.glasses_picture_auto),
|
||||
@@ -213,7 +239,7 @@ internal fun GlassesGroups(
|
||||
format = { SpatialMeasurements.distance(it / 10f) }, modifier = track("glasses-distance")) { Glasses.setScreenDistanceDm(it) }
|
||||
}
|
||||
}
|
||||
if (vr && (g.canControl || g.hasDisplay)) SettingsGroup(stringResource(R.string.cardboard_steamvr)) {
|
||||
if (vr && (g.canControl || g.hasDisplay)) SettingsGroup(stringResource(R.string.cardboard_steamvr), key = "vr-glasses-steamvr") {
|
||||
steamVr()
|
||||
if (g.supportsDisplayModeControl) ToggleRow(host, "glasses-auto3d", stringResource(R.string.glasses_auto3d),
|
||||
stringResource(R.string.glasses_auto3d_hint), s.auto3d, chipModifier = track("glasses-auto3d")) { Glasses.setAuto3d(it) }
|
||||
@@ -226,7 +252,7 @@ internal fun GlassesGroups(
|
||||
format = { "$it°" }, modifier = track("glasses-vr-fov")) { Glasses.setVrFovDeg(it) }
|
||||
}
|
||||
if ((tab == null || tab == GlassesTab.TRACKING) && g.canControl) {
|
||||
SettingsGroup(stringResource(R.string.glasses_head_tracking)) {
|
||||
SettingsGroup(stringResource(R.string.glasses_head_tracking), key = "vr-glasses-tracking") {
|
||||
val trackingHint = when {
|
||||
inSession && !usesGlasses -> R.string.glasses_screen_no_output
|
||||
spatialVr -> R.string.glasses_head_tracking_spatial_vr_hint
|
||||
@@ -240,13 +266,13 @@ internal fun GlassesGroups(
|
||||
chipModifier = track("glasses-tracking")) { Glasses.setHeadTracking(it) }
|
||||
}
|
||||
val calibration by Glasses.calibration.collectAsState()
|
||||
if (calibration.supported) SettingsGroup(stringResource(R.string.glasses_calibration)) {
|
||||
if (calibration.supported) SettingsGroup(stringResource(R.string.glasses_calibration), key = "vr-glasses-calibration") {
|
||||
GlassesCalibrationControls(calibration,
|
||||
onStart = Glasses::startCalibration, onCancel = Glasses::cancelCalibration,
|
||||
onReset = Glasses::resetCalibration, onDone = { onRecenter?.invoke() })
|
||||
}
|
||||
}
|
||||
if ((tab == null || tab == GlassesTab.HARDWARE) && g.canControl && g.hardwareControls) SettingsGroup(stringResource(R.string.glasses_hardware)) {
|
||||
if ((tab == null || tab == GlassesTab.HARDWARE) && g.canControl && g.hardwareControls) SettingsGroup(stringResource(R.string.glasses_hardware), key = "vr-glasses-hardware") {
|
||||
if (g.brightnessMax > 0) SliderRow(stringResource(R.string.glasses_brightness), null, g.brightness.coerceAtLeast(0), 0..g.brightnessMax, step = 1,
|
||||
modifier = track("glasses-brightness")) { Glasses.setBrightness(it) }
|
||||
if (g.volumeMax > 0) SliderRow(stringResource(R.string.glasses_volume), null, g.volume.coerceAtLeast(0), 0..g.volumeMax, step = 1,
|
||||
@@ -259,7 +285,7 @@ internal fun GlassesGroups(
|
||||
androidx.compose.runtime.LaunchedEffect(Unit) { HandTracking.load(context) }
|
||||
if ((tab == null || tab == GlassesTab.TRACKING) && g.canControl) {
|
||||
if (g.spatialConnected) {
|
||||
SettingsGroup(stringResource(R.string.glasses_experimental)) {
|
||||
SettingsGroup(stringResource(R.string.glasses_experimental), key = "vr-glasses-experimental") {
|
||||
val spatial by SpatialTracking.status.collectAsState()
|
||||
ToggleRow(host, "glasses-position", stringResource(R.string.glasses_position), stringResource(R.string.glasses_position_hint),
|
||||
s.positionalTracking, chipModifier = track("glasses-position")) { Glasses.setPositionalTracking(it) }
|
||||
@@ -282,7 +308,7 @@ internal fun GlassesGroups(
|
||||
s.joyConTracking, enabled = s.positionalTracking, chipModifier = track("glasses-joycons")) { Glasses.setJoyConTracking(it) }
|
||||
}
|
||||
}
|
||||
if (hands.usable) SettingsGroup(stringResource(R.string.phone_camera_tracking_group)) {
|
||||
if (hands.usable) SettingsGroup(stringResource(R.string.phone_camera_tracking_group), key = "vr-hand-camera") {
|
||||
HandCameraRows(host, track, inSession)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,20 @@ internal fun GlassesSetupPanel() {
|
||||
val (glasses, settings) = rememberGlasses()
|
||||
val host = rememberMenuHost()
|
||||
val tabs = glassesTabs(glasses)
|
||||
val context = androidx.compose.ui.platform.LocalContext.current
|
||||
val showShortcut = rememberShowGlassesShortcut()
|
||||
var selectedTab by rememberSaveable { mutableStateOf(GlassesTab.DISPLAY) }
|
||||
val tab = selectedTab.takeIf { selected -> tabs.any { it.first == selected } } ?: GlassesTab.DISPLAY
|
||||
LaunchedEffect(tab, glasses.present, glasses.canControl, glasses.model) { host.open = null }
|
||||
|
||||
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
Note(stringResource(R.string.setup_glasses_scope))
|
||||
SettingsGroup(stringResource(R.string.glasses_shortcut_group), key = "glasses-shortcut") {
|
||||
ToggleRow(host, "glasses-shortcut", stringResource(R.string.glasses_show_shortcut),
|
||||
stringResource(R.string.glasses_show_shortcut_hint), showShortcut) {
|
||||
com.droiddeck.launcher.session.SessionPrefs.setShowGlassesShortcut(context, it)
|
||||
}
|
||||
}
|
||||
if (!glasses.present && !glasses.hasDisplay && !glasses.canControl) {
|
||||
Note(stringResource(R.string.setup_glasses_connect))
|
||||
} else {
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.droiddeck.launcher.session.SessionPrefs
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.atan2
|
||||
import kotlin.math.hypot
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
@SuppressLint("ViewConstructor")
|
||||
@@ -63,6 +64,7 @@ class InputSurfaceView(
|
||||
private val art by lazy(LazyThreadSafetyMode.NONE) { PadArt(context) }
|
||||
private var artworkDpad = emptyList<HoldButton>()
|
||||
private val artworkDpadBounds = RectF()
|
||||
private var crossDpads = emptyList<Pair<List<HoldButton>, RectF>>()
|
||||
private var requestedLayout = customLayout
|
||||
init { customLayout = surfaceStyle.shown(customLayout); addView(content, LayoutParams(-1, -1)); renderCustom(pad) }
|
||||
|
||||
@@ -185,6 +187,7 @@ class InputSurfaceView(
|
||||
|
||||
private fun renderCustom(pad: PadBridge?) {
|
||||
artworkDpad = emptyList()
|
||||
crossDpads = emptyList()
|
||||
val canvas = object : ViewGroup(context) {
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
val layout = customLayout
|
||||
@@ -203,6 +206,7 @@ class InputSurfaceView(
|
||||
child.layout(x, y, x + child.measuredWidth, y + child.measuredHeight)
|
||||
}
|
||||
updateArtworkDpad(this)
|
||||
updateCrossDpad(this)
|
||||
}
|
||||
|
||||
override fun dispatchDraw(canvas: Canvas) {
|
||||
@@ -244,11 +248,39 @@ class InputSurfaceView(
|
||||
canvas.getChildAt(index) as? HoldButton
|
||||
}
|
||||
val previous = artworkDpad
|
||||
artworkDpad = if (crossed(buttons)) buttons else emptyList()
|
||||
artworkDpad = if (crossed(buttons, artworkDpadBounds)) buttons else emptyList()
|
||||
if (artworkDpad != previous) (previous + artworkDpad).forEach { it.invalidate() }
|
||||
}
|
||||
|
||||
private fun crossed(buttons: List<HoldButton>): Boolean {
|
||||
private fun updateCrossDpad(canvas: ViewGroup) {
|
||||
val buttons = (0 until canvas.childCount).map(canvas::getChildAt).filterIsInstance<HoldButton>()
|
||||
val (ups, rights, downs, lefts) = DIRECTIONS.map { direction -> buttons.filter { (it.tag as? InputSurfaceElement)?.control == direction } }
|
||||
crossDpads = ups.flatMap { up -> rights.flatMap { right -> downs.flatMap { down ->
|
||||
lefts.mapNotNull { left -> listOf(up, right, down, left).let { arms -> hole(arms)?.let { arms to it } } } } } }
|
||||
}
|
||||
|
||||
private fun hole(buttons: List<HoldButton>): RectF? {
|
||||
val (up, right, down, left) = buttons
|
||||
val hole = RectF(left.right.toFloat(), up.bottom.toFloat(), right.left.toFloat(), down.top.toFloat())
|
||||
val across = max(up.left, down.left) to min(up.right, down.right)
|
||||
val along = max(left.top, right.top) to min(left.bottom, right.bottom)
|
||||
return hole.takeIf {
|
||||
!it.isEmpty && across.first < across.second && along.first < along.second &&
|
||||
across.first < it.right && across.second > it.left && along.first < it.bottom && along.second > it.top
|
||||
}
|
||||
}
|
||||
|
||||
private fun crossTarget(x: Float, y: Float): HoldButton? {
|
||||
val first = crossDpads.firstOrNull()?.first?.first() ?: return null
|
||||
val hx = x - (originX(first) - first.left)
|
||||
val hy = y - (originY(first) - first.top)
|
||||
return crossDpads.filter { (arms, hole) -> arms.all { it.visibility == VISIBLE } && hole.contains(hx, hy) }
|
||||
.flatMap { it.first }.distinct().minByOrNull { arm ->
|
||||
hypot(max(max(arm.left - hx, hx - arm.right), 0f), max(max(arm.top - hy, hy - arm.bottom), 0f))
|
||||
}
|
||||
}
|
||||
|
||||
private fun crossed(buttons: List<HoldButton>, bounds: RectF): Boolean {
|
||||
if (buttons.size != DIRECTIONS.size) return false
|
||||
val (up, right, down, left) = buttons
|
||||
val centerX = (left.left + right.right) / 2f
|
||||
@@ -258,7 +290,7 @@ class InputSurfaceView(
|
||||
kotlin.math.abs((left.top + left.bottom) / 2f - centerY) > 2f ||
|
||||
kotlin.math.abs((right.top + right.bottom) / 2f - centerY) > 2f ||
|
||||
up.bottom >= down.top || left.right >= right.left) return false
|
||||
artworkDpadBounds.set(left.left.toFloat(), up.top.toFloat(), right.right.toFloat(), down.bottom.toFloat())
|
||||
bounds.set(left.left.toFloat(), up.top.toFloat(), right.right.toFloat(), down.bottom.toFloat())
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -284,6 +316,7 @@ class InputSurfaceView(
|
||||
val views = (canvas.childCount - 1 downTo 0).map(canvas::getChildAt).filter { it.visibility == VISIBLE }
|
||||
views.firstOrNull { !(it is StickView && it.adaptive) && hits(it, x, y, 0f) }?.let { return it }
|
||||
views.filter { it is HoldButton && hits(it, x, y, slack(it)) }.minByOrNull { distance(it, x, y) }?.let { return it }
|
||||
crossTarget(x, y)?.let { return it }
|
||||
if (views.any { it is HoldButton && hits(it, x, y, slack(it) + ADAPTIVE_CLEARANCE_PX) }) return null
|
||||
return views.filter { it is StickView && it.adaptive && it !in owners.values && (hits(it, x, y, 0f) || it.captures(x - originX(it), y - originY(it))) }
|
||||
.minByOrNull { distance(it, x, y) }
|
||||
|
||||
@@ -487,7 +487,7 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s.steamLibraries.size < com.droiddeck.launcher.session.SteamLibraries.MAX) for (found in s.foundSteamLibraries) {
|
||||
for (found in s.foundSteamLibraries) {
|
||||
SettingsRow(
|
||||
found.label,
|
||||
stringResource(R.string.libraries_found_hint, pluralStringResource(R.plurals.mode_added_count, found.games, found.games), found.shown),
|
||||
@@ -495,19 +495,17 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
SecondaryButton(stringResource(R.string.libraries_add_found), compact = true) { a.onAddFoundSteamLibrary(found.path) }
|
||||
}
|
||||
}
|
||||
if (s.allFilesAccessMissing && s.steamLibraries.size < com.droiddeck.launcher.session.SteamLibraries.MAX) {
|
||||
if (s.allFilesAccessMissing) {
|
||||
SettingsRow(stringResource(R.string.libraries_access_title), stringResource(R.string.libraries_access_hint)) {
|
||||
SecondaryButton(stringResource(R.string.libraries_access_allow), compact = true, onClick = a.onAllowAllFilesAccess)
|
||||
}
|
||||
}
|
||||
SettingsRow(
|
||||
stringResource(R.string.libraries_add),
|
||||
if (s.steamLibraries.size < com.droiddeck.launcher.session.SteamLibraries.MAX) stringResource(R.string.libraries_hint)
|
||||
else stringResource(R.string.libraries_full, com.droiddeck.launcher.session.SteamLibraries.MAX),
|
||||
stringResource(R.string.libraries_hint),
|
||||
) {
|
||||
SecondaryButton(
|
||||
stringResource(R.string.mode_choose_folder),
|
||||
enabled = s.steamLibraries.size < com.droiddeck.launcher.session.SteamLibraries.MAX,
|
||||
onClick = a.onAddSteamLibrary,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -116,10 +116,7 @@ internal object NavTabs {
|
||||
|
||||
fun more(s: FrontEndState) = listed(s).filter { place(s, it) == TabPlace.MORE }
|
||||
|
||||
fun bar(s: FrontEndState): List<String> {
|
||||
val shown = listed(s).filter { place(s, it) == TabPlace.BAR }
|
||||
return if (more(s).isEmpty()) shown else shown + MORE
|
||||
}
|
||||
fun bar(s: FrontEndState): List<String> = listed(s).filter { place(s, it) == TabPlace.BAR } + MORE
|
||||
|
||||
fun setHidden(context: Context, key: String, hide: Boolean) {
|
||||
hidden = if (hide && hideable(key)) hidden + key else hidden - key
|
||||
|
||||
@@ -11,7 +11,7 @@ internal fun PenSettingsGroup(
|
||||
host: MenuHost, pen: SessionPrefs.Pen, track: (String) -> Modifier = { Modifier },
|
||||
onPick: (key: String, value: String) -> Unit,
|
||||
) {
|
||||
SettingsGroup(stringResource(R.string.mode_pen)) {
|
||||
SettingsGroup(stringResource(R.string.mode_pen), key = "controller-pen") {
|
||||
ChoiceRow(host, "pen", stringResource(R.string.mode_pen), null,
|
||||
listOf(SessionPrefs.PEN_MOUSE to stringResource(R.string.mode_pen_mouse),
|
||||
SessionPrefs.PEN_TOUCH to stringResource(R.string.mode_pen_touch)),
|
||||
|
||||
@@ -46,12 +46,9 @@ fun PerformancePage(
|
||||
fsyncFirst: Boolean,
|
||||
gamescopeRealtime: Boolean,
|
||||
gpuClockPin: Boolean,
|
||||
prootNoSeccomp: Boolean,
|
||||
prootFastPath: Boolean,
|
||||
nativeUserland: Boolean,
|
||||
desktopAsUser: Boolean,
|
||||
cursorComposite: Boolean,
|
||||
guestHostname: String,
|
||||
phantomWarning: String?,
|
||||
onClientOverride: (Boolean) -> Unit,
|
||||
onPaceCores: (Boolean) -> Unit,
|
||||
onTuSysmem: (Boolean) -> Unit,
|
||||
@@ -64,9 +61,7 @@ fun PerformancePage(
|
||||
onFsyncFirst: (Boolean) -> Unit,
|
||||
onGamescopeRealtime: (Boolean) -> Unit,
|
||||
onGpuClockPin: (Boolean) -> Unit,
|
||||
onProotNoSeccomp: (Boolean) -> Unit,
|
||||
onProotFastPath: (Boolean) -> Unit,
|
||||
onNativeUserland: (Boolean) -> Unit,
|
||||
onDesktopAsUser: (Boolean) -> Unit,
|
||||
onCursorComposite: (Boolean) -> Unit,
|
||||
onGuestHostname: (String) -> Unit,
|
||||
onClientCore: (Int, Boolean) -> Unit,
|
||||
@@ -150,26 +145,6 @@ fun PerformancePage(
|
||||
stringResource(R.string.perf_fastsync_hint),
|
||||
fastSync, onChange = onFastSync,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "seccomp", stringResource(R.string.perf_seccomp),
|
||||
stringResource(R.string.perf_seccomp_hint),
|
||||
prootNoSeccomp, onChange = onProotNoSeccomp,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "fastpath", stringResource(R.string.perf_fastpath),
|
||||
when {
|
||||
nativeUserland -> stringResource(R.string.perf_fastpath_needs_proot)
|
||||
prootNoSeccomp -> stringResource(R.string.perf_fastpath_needs_seccomp)
|
||||
else -> stringResource(R.string.perf_fastpath_hint)
|
||||
},
|
||||
prootFastPath && !prootNoSeccomp && !nativeUserland, enabled = !prootNoSeccomp && !nativeUserland,
|
||||
onChange = onProotFastPath,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "nativeuserland", stringResource(R.string.perf_native_userland),
|
||||
stringResource(R.string.perf_native_userland_hint),
|
||||
nativeUserland, onChange = onNativeUserland,
|
||||
)
|
||||
ToggleRow(
|
||||
host, "cursorcomposite", stringResource(R.string.perf_cursor_composite),
|
||||
stringResource(R.string.perf_cursor_composite_hint),
|
||||
@@ -194,16 +169,12 @@ fun PerformancePage(
|
||||
modifier = Modifier.width(220.dp).focusGlide(),
|
||||
)
|
||||
}
|
||||
}
|
||||
if (phantomWarning != null) {
|
||||
Spacer(Modifier.height(16.dp))
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().clip(RoundedCornerShape(12.dp)).background(colors.error.copy(alpha = 0.08f))
|
||||
.border(1.dp, colors.error.copy(alpha = 0.4f), RoundedCornerShape(12.dp)).padding(12.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.perf_phantom_warning), fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.error)
|
||||
Text(phantomWarning, fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 4.dp))
|
||||
}
|
||||
ToggleRow(
|
||||
host, "desktopasuser", stringResource(R.string.perf_desktop_as_user),
|
||||
stringResource(R.string.perf_desktop_as_user_hint),
|
||||
desktopAsUser,
|
||||
onChange = onDesktopAsUser,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (embedded) Column {
|
||||
@@ -218,7 +189,7 @@ fun PerformancePage(
|
||||
|
||||
@Composable
|
||||
internal fun GpuClockGroup(host: MenuHost, on: Boolean, chipModifier: Modifier = Modifier, onChange: (Boolean) -> Unit) {
|
||||
SettingsGroup(stringResource(R.string.perf_gpu)) {
|
||||
SettingsGroup(stringResource(R.string.perf_gpu), key = "performance-gpu") {
|
||||
ToggleRow(
|
||||
host, "gpuclock", stringResource(R.string.perf_gpuclock),
|
||||
null,
|
||||
|
||||
@@ -1,306 +0,0 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import com.droiddeck.launcher.R
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.NetworkCapabilities
|
||||
import android.os.Build
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import com.droiddeck.launcher.ui.GlideAlertDialog as AlertDialog
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.produceState
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
import com.droiddeck.launcher.core.PhantomProcessStatus
|
||||
import com.droiddeck.launcher.core.WirelessAdbPairingService
|
||||
import com.droiddeck.launcher.core.WirelessAdbPairingService.Stage
|
||||
import com.droiddeck.launcher.session.QuestExperimental
|
||||
|
||||
@Composable
|
||||
fun PhantomProcessGatePage(
|
||||
status: PhantomProcessStatus,
|
||||
applyingSavedPairing: Boolean,
|
||||
onDismiss: () -> Unit,
|
||||
onOpenDeveloperOptions: () -> Unit,
|
||||
onFixWithWirelessDebugging: () -> Unit,
|
||||
onCopyCommand: () -> Unit,
|
||||
) {
|
||||
BackHandler(onBack = onDismiss)
|
||||
val context = LocalContext.current
|
||||
val stage by WirelessAdbPairingService.stage.collectAsState()
|
||||
val environment by produceState(GateEnvironment.read(context)) {
|
||||
while (true) {
|
||||
value = GateEnvironment.read(context)
|
||||
kotlinx.coroutines.delay(2_000)
|
||||
}
|
||||
}
|
||||
val hasToggle = PhantomProcessLimit.hasDeveloperToggle()
|
||||
val sideQuest = QuestExperimental.isSupported()
|
||||
|
||||
BoxWithConstraints(Modifier.fillMaxWidth()) {
|
||||
val compact = maxWidth < 620.dp && maxHeight < 500.dp
|
||||
SettingsPage(
|
||||
host = rememberMenuHost(),
|
||||
title = stringResource(R.string.gate_title),
|
||||
eyebrow = stringResource(R.string.gate_eyebrow),
|
||||
lede = if (compact) null else stringResource(R.string.gate_lede),
|
||||
onBack = onDismiss,
|
||||
scrollContent = true,
|
||||
compactLayout = compact,
|
||||
) {
|
||||
BoxWithConstraints(Modifier.fillMaxWidth()) {
|
||||
val wide = maxWidth >= 620.dp
|
||||
val fix: @Composable ColumnScope.() -> Unit = {
|
||||
if (sideQuest) SideQuestGroup(compact, onCopyCommand)
|
||||
else FixGroup(hasToggle, stage, environment, compact, applyingSavedPairing, onOpenDeveloperOptions, onFixWithWirelessDebugging,
|
||||
onCancel = { WirelessAdbPairingService.cancel(context) })
|
||||
}
|
||||
val side: @Composable ColumnScope.() -> Unit = {
|
||||
StatusGroup(status, compact)
|
||||
if (!sideQuest) OtherWays(hasToggle, compact, onOpenDeveloperOptions, onFixWithWirelessDebugging, onCopyCommand)
|
||||
}
|
||||
if (wide) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(14.dp), modifier = Modifier.widthIn(max = 900.dp).fillMaxWidth()) {
|
||||
Column(Modifier.weight(1.2f), content = fix)
|
||||
Column(Modifier.weight(1f), content = side)
|
||||
}
|
||||
} else {
|
||||
Column(Modifier.widthIn(max = 600.dp).fillMaxWidth()) {
|
||||
fix()
|
||||
side()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private data class GateEnvironment(val onWifi: Boolean) {
|
||||
companion object {
|
||||
fun read(context: Context): GateEnvironment {
|
||||
val connectivity = context.getSystemService(ConnectivityManager::class.java)
|
||||
val wifi = runCatching {
|
||||
connectivity?.allNetworks?.any { network ->
|
||||
connectivity.getNetworkCapabilities(network)?.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) == true
|
||||
} == true
|
||||
}.getOrDefault(true)
|
||||
return GateEnvironment(wifi)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun FixGroup(
|
||||
hasToggle: Boolean,
|
||||
stage: Stage,
|
||||
environment: GateEnvironment,
|
||||
compact: Boolean,
|
||||
applyingSavedPairing: Boolean,
|
||||
onOpenDeveloperOptions: () -> Unit,
|
||||
onFixWithWirelessDebugging: () -> Unit,
|
||||
onCancel: () -> Unit,
|
||||
) {
|
||||
val pairing = stage is Stage.Waiting || stage is Stage.CodeNeeded || stage is Stage.Working
|
||||
SettingsGroup(if (hasToggle) stringResource(R.string.setup_dev_options) else stringResource(R.string.gate_fix_for_me), compact = compact) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(if (compact) 10.dp else 14.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
when {
|
||||
applyingSavedPairing -> Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
CircularProgressIndicator(Modifier.size(18.dp), strokeWidth = 2.dp)
|
||||
Body(stringResource(R.string.adbpair_applying))
|
||||
}
|
||||
pairing -> PairingProgress(stage, onCancel)
|
||||
hasToggle -> {
|
||||
Body(stringResource(R.string.gate_toggle_steps))
|
||||
PrimaryButton(stringResource(R.string.gate_open_dev), compact = compact, onClick = onOpenDeveloperOptions)
|
||||
SecondaryButton(stringResource(R.string.gate_use_wireless_instead), compact = compact, enabled = environment.onWifi, onClick = onFixWithWirelessDebugging)
|
||||
}
|
||||
else -> {
|
||||
Body(stringResource(R.string.gate_no_toggle))
|
||||
(stage as? Stage.Failed)?.let { Body(it.error, error = true) }
|
||||
PrimaryButton(
|
||||
if (stage is Stage.Failed) stringResource(R.string.store_try_again) else stringResource(R.string.gate_fix_for_me),
|
||||
compact = compact,
|
||||
enabled = environment.onWifi,
|
||||
onClick = onFixWithWirelessDebugging,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (!hasToggle && !pairing) {
|
||||
if (!environment.onWifi) {
|
||||
Body(stringResource(R.string.gate_needs_wifi), warn = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PairingProgress(stage: Stage, onCancel: () -> Unit) {
|
||||
val steps = listOf(
|
||||
stringResource(R.string.gate_step1),
|
||||
stringResource(R.string.gate_step2),
|
||||
stringResource(R.string.gate_step3),
|
||||
)
|
||||
val active = when (stage) {
|
||||
Stage.Waiting -> 1
|
||||
is Stage.CodeNeeded -> 2
|
||||
else -> 3
|
||||
}
|
||||
steps.forEachIndexed { index, step ->
|
||||
val done = index < active
|
||||
val current = index == active
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Text(if (done) "✓" else "${index + 1}", fontSize = 13.sp, fontWeight = FontWeight.SemiBold,
|
||||
color = if (done) LocalPalette.current.good else MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
Text(step, style = MaterialTheme.typography.bodySmall,
|
||||
color = if (current) MaterialTheme.colorScheme.onBackground else MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
CircularProgressIndicator(modifier = Modifier.size(16.dp), strokeWidth = 2.dp)
|
||||
Text(
|
||||
when (stage) {
|
||||
Stage.Waiting -> stringResource(R.string.gate_waiting)
|
||||
is Stage.CodeNeeded -> stage.error ?: stringResource(R.string.gate_code_needed)
|
||||
is Stage.Working -> stage.step
|
||||
else -> ""
|
||||
},
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = if (stage is Stage.CodeNeeded && stage.error != null) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
SecondaryButton(stringResource(R.string.common_cancel), compact = true, onClick = onCancel)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun StatusGroup(status: PhantomProcessStatus, compact: Boolean) {
|
||||
SettingsGroup(stringResource(R.string.gate_status), compact = compact) {
|
||||
Column(Modifier.fillMaxWidth().padding(if (compact) 10.dp else 14.dp), verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||
Text(PhantomProcessLimit.title(LocalContext.current, status), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onBackground)
|
||||
Body(stringResource(R.string.gate_polling))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun OtherWays(
|
||||
hasToggle: Boolean,
|
||||
compact: Boolean,
|
||||
onOpenDeveloperOptions: () -> Unit,
|
||||
onFixWithWirelessDebugging: () -> Unit,
|
||||
onCopyCommand: () -> Unit,
|
||||
) {
|
||||
var open by rememberSaveable { mutableStateOf(false) }
|
||||
SettingsGroup(stringResource(R.string.gate_other_ways), compact = compact) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.fillMaxWidth().clickable { open = !open }.padding(horizontal = 14.dp, vertical = 10.dp),
|
||||
) {
|
||||
Body(if (hasToggle) stringResource(R.string.gate_other_toggle) else stringResource(R.string.gate_other_no_toggle), modifier = Modifier.weight(1f))
|
||||
Text(if (open) "▴" else "▾", fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
if (open) Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(start = 14.dp, end = 14.dp, bottom = 14.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
if (!hasToggle) {
|
||||
Body(stringResource(R.string.gate_some_roms))
|
||||
SecondaryButton(stringResource(R.string.gate_open_dev), compact = true, onClick = onOpenDeveloperOptions)
|
||||
}
|
||||
Body(stringResource(R.string.gate_from_computer))
|
||||
AdbCommand()
|
||||
SecondaryButton(stringResource(R.string.gate_copy_command), compact = true, onClick = onCopyCommand)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SideQuestGroup(compact: Boolean, onCopyCommand: () -> Unit) {
|
||||
SettingsGroup(stringResource(R.string.gate_sidequest), compact = compact) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth().padding(if (compact) 10.dp else 14.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Body(stringResource(R.string.gate_sidequest_steps))
|
||||
AdbCommand()
|
||||
PrimaryButton(stringResource(R.string.gate_copy_command), compact = compact, onClick = onCopyCommand)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AdbCommand() {
|
||||
Text(
|
||||
PhantomProcessLimit.adbCommand(),
|
||||
style = MaterialTheme.typography.bodySmall.copy(fontFamily = FontFamily.Monospace, fontSize = 11.sp),
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Body(text: String, modifier: Modifier = Modifier, error: Boolean = false, warn: Boolean = false) {
|
||||
Text(
|
||||
text,
|
||||
modifier = modifier,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = when {
|
||||
error -> MaterialTheme.colorScheme.error
|
||||
warn -> androidx.compose.ui.graphics.Color(0xFFFFB86B)
|
||||
else -> MaterialTheme.colorScheme.onSurfaceVariant
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DeveloperDisplayChoiceDialog(
|
||||
displays: List<Pair<Int, String>>,
|
||||
onMainScreen: () -> Unit,
|
||||
onSecondaryScreen: (Int) -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = { Text(stringResource(R.string.gate_open_dev)) },
|
||||
text = {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(4.dp), modifier = Modifier.fillMaxWidth()) {
|
||||
Text(stringResource(R.string.gate_choose_display))
|
||||
TextButton(modifier = Modifier.fillMaxWidth().focusGlide(CircleShape), onClick = onMainScreen) { Text(stringResource(R.string.gate_main_screen)) }
|
||||
displays.forEach { (id, label) ->
|
||||
TextButton(modifier = Modifier.fillMaxWidth().focusGlide(CircleShape), onClick = { onSecondaryScreen(id) }) { Text(label) }
|
||||
}
|
||||
}
|
||||
},
|
||||
confirmButton = { TextButton(onClick = onDismiss, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
@@ -6,17 +6,19 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
/** HUD holds the Performance page and GAMES the Game page; the names stay because saved page orders use them. */
|
||||
internal enum class SessionDrawerPage(val firstControl: String) {
|
||||
CONTROLLER("input-profile"),
|
||||
GLASSES("glasses-game"),
|
||||
DISPLAY("fg"),
|
||||
HUD("hud"),
|
||||
EFFECTS("look"),
|
||||
GAMES("anisotropy"),
|
||||
AGENT("agent-input"),
|
||||
SESSION("suspend"),
|
||||
CONTROLLER("section-controller-input"),
|
||||
HUD("section-performance-pacing"),
|
||||
FRAMEGEN("fg"),
|
||||
DISPLAY("section-display"),
|
||||
EFFECTS("section-effects-look"),
|
||||
GAMES("section-game-profile"),
|
||||
VR("section-vr-steamvr"),
|
||||
SESSION("pause"),
|
||||
MORE("more-edit"),
|
||||
VR("steamvr"),
|
||||
ACHIEVEMENTS("achievements"),
|
||||
AGENT("agent-input"),
|
||||
}
|
||||
|
||||
internal object DrawerPages {
|
||||
@@ -71,16 +73,16 @@ internal object DrawerPages {
|
||||
}
|
||||
|
||||
internal fun offeredDrawerPages(
|
||||
hasGlasses: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentTab.shown,
|
||||
hasAchievements: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentTab.shown,
|
||||
): List<SessionDrawerPage> =
|
||||
DrawerPages.order.filter {
|
||||
(hasGlasses || it != SessionDrawerPage.GLASSES) &&
|
||||
(hasAchievements || it != SessionDrawerPage.ACHIEVEMENTS) &&
|
||||
(hasAgent || it != SessionDrawerPage.AGENT)
|
||||
}
|
||||
|
||||
internal fun sessionDrawerPages(
|
||||
hasGlasses: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentTab.shown,
|
||||
): List<SessionDrawerPage> = offeredDrawerPages(hasGlasses, hasAgent).filter { it !in DrawerPages.hidden }
|
||||
hasAchievements: Boolean = false, hasAgent: Boolean = com.droiddeck.launcher.agent.AgentTab.shown,
|
||||
): List<SessionDrawerPage> = offeredDrawerPages(hasAchievements, hasAgent).filter { it !in DrawerPages.hidden }
|
||||
|
||||
/** The pages shown as tabs: everything up to and including the More tab. */
|
||||
internal fun List<SessionDrawerPage>.strip(): List<SessionDrawerPage> {
|
||||
|
||||
@@ -79,6 +79,48 @@ import androidx.compose.ui.text.style.LineHeightStyle
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.platform.testTag
|
||||
|
||||
|
||||
@Composable
|
||||
fun HudText(text: String, color: String = "mint", opacity: Int = 70) {
|
||||
if (text.isEmpty()) return
|
||||
val accent = hudInk(color)
|
||||
val wash = (opacity.coerceIn(30, 100) / 100f)
|
||||
val ink = accent.copy(alpha = (0.5f + wash * 0.5f).coerceIn(0.62f, 1f))
|
||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.TopEnd) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.End,
|
||||
modifier = Modifier
|
||||
.padding(12.dp)
|
||||
.background(
|
||||
Brush.verticalGradient(
|
||||
listOf(accent.copy(alpha = wash * 0.28f), Color.Black.copy(alpha = wash * 0.72f)),
|
||||
),
|
||||
RoundedCornerShape(8.dp),
|
||||
)
|
||||
.padding(horizontal = 8.dp, vertical = 5.dp),
|
||||
) {
|
||||
Text(
|
||||
text,
|
||||
fontFamily = FontFamily.Monospace,
|
||||
fontSize = 12.sp,
|
||||
color = ink,
|
||||
textAlign = TextAlign.End,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun hudInk(color: String): Color = Color(
|
||||
when (color) {
|
||||
"white" -> 0xFFF2F5F8
|
||||
"sky" -> 0xFF66C0F4
|
||||
"amber" -> 0xFFFFB74D
|
||||
"violet" -> 0xFFD0A2FF
|
||||
else -> 0xFF3DDC84
|
||||
}.toInt(),
|
||||
)
|
||||
|
||||
|
||||
private class LoadStage(@androidx.annotation.StringRes val label: Int, @androidx.annotation.StringRes val detail: Int)
|
||||
|
||||
private fun loadStages(steam: Boolean): List<LoadStage> = if (steam) listOf(
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -65,7 +65,6 @@ internal object SettingsIndex {
|
||||
|
||||
val entries: List<SettingsEntry> = listOf(
|
||||
s(SettingsSection.OVERVIEW, R.string.setup_runtime, "ubuntu", "linux", "repair", "update"),
|
||||
s(SettingsSection.OVERVIEW, R.string.setup_limit, "phantom", "process", "killed", "background"),
|
||||
s(SettingsSection.OVERVIEW, R.string.setup_account, "steam", "login", "sign in"),
|
||||
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_override, "steam client cores", "cpu"),
|
||||
@@ -78,16 +77,15 @@ internal object SettingsIndex {
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_gpuclock, "gpu", "clock", "max"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.setup_clear_cached, "memory", "ram", "crash", "sleep", "killed"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.setup_bg_limit, "memory", "ram", "background apps"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.setup_memory_hud, "memory", "ram", "overlay"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_sysmem),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_xalia),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_esync, "esync", "sync", "wine"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_fsync, "fsync", "sync", "wine"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_fastsync, "ntsync", "sync", "wine"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_seccomp, "proot"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_fastpath, "proot"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_native_userland, "proot"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_cursor_composite, "mouse", "cursor"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_hostname, "name"),
|
||||
s(SettingsSection.PERFORMANCE, R.string.perf_desktop_as_user, "root", "user", "sudo", "fakeroot"),
|
||||
|
||||
s(SettingsSection.CONTROLLER, R.string.setup_tab_controller, "gamepad", "buttons", "mapping", "profile", "remap"),
|
||||
SettingsEntry(SettingsPlace.TAB, R.string.rail_storage, tab = "storage", words = listOf("sd card", "space", "uninstall", "disk")),
|
||||
|
||||
@@ -443,7 +443,11 @@ fun ValueChip(text: String, open: Boolean, enabled: Boolean = true, modifier: Mo
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SettingsGroup(title: String, compact: Boolean = false, detail: String? = null, content: @Composable ColumnScope.() -> Unit) {
|
||||
fun SettingsGroup(title: String, compact: Boolean = false, detail: String? = null, key: String? = null, tag: String? = null, content: @Composable ColumnScope.() -> Unit) {
|
||||
LocalDrawerSections.current?.let { sections ->
|
||||
DrawerSection(sections, key ?: title, title, detail, tag, content)
|
||||
return
|
||||
}
|
||||
val tight = compact || LocalCompactSettings.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
@@ -462,7 +466,7 @@ fun SettingsGroup(title: String, compact: Boolean = false, detail: String? = nul
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hintLines: Int? = null, stacked: Boolean = false, control: @Composable () -> Unit) {
|
||||
fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hintLines: Int? = null, stacked: Boolean = false, tightControlSpacing: Boolean = false, control: @Composable () -> Unit) {
|
||||
val compact = LocalCompactSettings.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
@@ -484,13 +488,13 @@ fun SettingsRow(label: String, hint: String?, highlighted: Boolean = false, hint
|
||||
} else if (stacked || LocalNarrowPane.current) Column(
|
||||
modifier = Modifier.fillMaxWidth().background(bg).padding(
|
||||
horizontal = if (compact) 10.dp else 14.dp,
|
||||
vertical = if (compact) 6.dp else 12.dp),
|
||||
vertical = if (tightControlSpacing) 2.dp else if (compact) 6.dp else 12.dp),
|
||||
) {
|
||||
Text(label, fontSize = if (compact) 13.sp else 15.sp,
|
||||
lineHeight = if (compact) 16.sp else androidx.compose.ui.unit.TextUnit.Unspecified,
|
||||
fontWeight = FontWeight.SemiBold, color = colors.onBackground)
|
||||
if (hint != null || hintLines != null) hintText(if (compact) 11.sp else 13.sp)
|
||||
Box(Modifier.padding(top = if (compact) 6.dp else 8.dp)) { control() }
|
||||
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),
|
||||
|
||||
@@ -13,7 +13,7 @@ internal fun FrameGenGroup(s: FrontEndState, a: FrontEndActions) {
|
||||
SettingsRow(stringResource(R.string.frame_gen_title), stringResource(R.string.frame_gen_hint), highlighted = host.open == "fg") {
|
||||
Box {
|
||||
ValueChip(s.frameGenLabel, host.open == "fg") { host.open = if (host.open == "fg") null else "fg" }
|
||||
FrameGenMenu(host, s.frameGen, s.lossless, a.onFrameGenPick, a.onImportLossless)
|
||||
if (host.open == "fg") FrameGenMenu(s.frameGen, s.lossless, a.onFrameGenPick, a.onImportLossless)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,6 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
|
||||
val onboardingRows = com.droiddeck.launcher.session.Onboarding.rows(onboardingActive, onboardingFailed, onboardingFacts)
|
||||
val firstRun by com.droiddeck.launcher.session.Onboarding.firstRun.collectAsState()
|
||||
val settling = firstRun && onboardingActive.isNotEmpty() && com.droiddeck.launcher.session.Onboarding.pending(onboardingRows)
|
||||
val limitBlocks = com.droiddeck.launcher.core.PhantomProcessLimit.blocksSteam(s.phantomProcessStatus)
|
||||
val mark: @Composable () -> Unit = {
|
||||
Wordmark(if (narrow) 30.dp else 40.dp)
|
||||
}
|
||||
@@ -185,7 +184,7 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
|
||||
if (!settling && (s.busy || (s.available != null && s.available != s.installed))) RuntimeChip(s)
|
||||
else if (!settling && setupNeedsAttention(s)) SecondaryButton(stringResource(R.string.play_needs_you), compact = true,
|
||||
modifier = Modifier.testTag("play-needs-you")) { SetupTabs.openSection = SettingsSection.OVERVIEW }
|
||||
else if (!settling && s.integration.suggested && signedIn && !limitBlocks)
|
||||
else if (!settling && s.integration.suggested && signedIn)
|
||||
IntegrationSuggestion(s.integration, { a.onSteamIntegration(null) }, a.onDismissIntegration)
|
||||
}
|
||||
if (narrow) Column(
|
||||
@@ -208,18 +207,10 @@ internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier)
|
||||
val firstRun by com.droiddeck.launcher.session.Onboarding.firstRun.collectAsState()
|
||||
val settling = firstRun && onboardingActive.isNotEmpty() && com.droiddeck.launcher.session.Onboarding.pending(onboardingRows)
|
||||
val overall = com.droiddeck.launcher.session.Onboarding.overall(onboardingRows)
|
||||
val limitBlocks = com.droiddeck.launcher.core.PhantomProcessLimit.blocksSteam(s.phantomProcessStatus)
|
||||
LaunchedEffect(settling) {
|
||||
while (settling) {
|
||||
kotlinx.coroutines.delay(2_000)
|
||||
a.onRefreshPhantomStatus()
|
||||
}
|
||||
a.onRefreshPhantomStatus()
|
||||
}
|
||||
if (settling) PrimaryButton(
|
||||
stringResource(if (limitBlocks) R.string.onboarding_button_finish else R.string.onboarding_button_getting_ready, overall),
|
||||
enabled = limitBlocks, main = true, large = true, progress = overall / 100f,
|
||||
modifier = Modifier.testTag("play-steam"), onClick = { a.onQueuePlaySteam(); ChildProcessSetup.request?.invoke() ?: a.onShowPhantomGate() },
|
||||
stringResource(R.string.onboarding_button_getting_ready, overall),
|
||||
enabled = false, main = true, large = true, progress = overall / 100f,
|
||||
modifier = Modifier.testTag("play-steam"), onClick = {},
|
||||
) else PrimaryButton(stringResource(R.string.games_play_steam), enabled = !s.busy, main = true, large = true, icon = Icons.Filled.PlayArrow, modifier = Modifier.testTag("play-steam"), onClick = click)
|
||||
},
|
||||
rows = { tab -> a.modeSheet(mode, tab, extras) },
|
||||
|
||||
@@ -56,6 +56,7 @@ import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
@@ -358,6 +359,67 @@ internal fun SessionAchievementsPanel(label: String, state: AchievementsState, t
|
||||
}
|
||||
}
|
||||
|
||||
/** The Achievements page of the session menu: the same list as the full panel, inside the menu's own scroll. */
|
||||
@Composable
|
||||
internal fun DrawerAchievementsPage(game: StoreAchievements.Game, title: String?, track: (String) -> Modifier) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val label = StoreAchievements.forSource(game.source)?.label.orEmpty()
|
||||
val state = rememberAchievements(game) ?: AchievementsState.READING
|
||||
val kinds = remember(state.list) {
|
||||
val list = state.list.orEmpty()
|
||||
val split = groups(list)
|
||||
if (split.size < 2) emptyList() else listOf(R.string.stores_tab_all to list) + split
|
||||
}
|
||||
var pick by remember { mutableIntStateOf(0) }
|
||||
if (pick >= kinds.size) pick = 0
|
||||
var noteHadFocus by remember { mutableStateOf(false) }
|
||||
val firstRow = remember { FocusRequester() }
|
||||
val loaded = !state.list.isNullOrEmpty()
|
||||
LaunchedEffect(loaded) {
|
||||
if (loaded && noteHadFocus) {
|
||||
noteHadFocus = false
|
||||
withFrameNanos { }
|
||||
runCatching { firstRow.requestFocus() }
|
||||
}
|
||||
}
|
||||
Column(Modifier.fillMaxWidth().padding(top = 8.dp, start = 4.dp, end = 4.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
|
||||
Text(title.orEmpty(), fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
|
||||
state.list?.takeIf { it.isNotEmpty() }?.let { list ->
|
||||
if (state.all) Trophy(18.dp, Modifier.padding(end = 6.dp))
|
||||
Text(stringResource(R.string.achievements_count_short, state.done, list.size), fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = pal.signal)
|
||||
}
|
||||
}
|
||||
val list = state.list
|
||||
if (list.isNullOrEmpty()) {
|
||||
Text(achievementsNote(state, label).orEmpty(), fontSize = 13.sp, color = colors.onSurfaceVariant,
|
||||
modifier = Modifier.padding(top = 12.dp).then(track("achievements"))
|
||||
.onFocusChanged { if (it.isFocused) noteHadFocus = true }.focusable())
|
||||
return@Column
|
||||
}
|
||||
LinearProgressIndicator(
|
||||
progress = { state.done / list.size.toFloat() }, color = pal.signal, trackColor = pal.line,
|
||||
modifier = Modifier.padding(top = 8.dp).fillMaxWidth().height(4.dp).clip(RoundedCornerShape(2.dp)),
|
||||
)
|
||||
if (kinds.isNotEmpty()) TabStrip(
|
||||
kinds.map { (name, group) -> if (name == R.string.stores_tab_all) stringResource(name) + " · " + group.size else stringResource(name, group.size) },
|
||||
pick, { pick = it }, Modifier.padding(top = 10.dp), bumpers = false, compact = true,
|
||||
)
|
||||
val shown = kinds.getOrNull(pick)?.second ?: list
|
||||
val sections = if (pick == 0) groups(shown).filter { it.second.isNotEmpty() } else listOf(null to shown)
|
||||
val first = sections.firstOrNull()?.second?.firstOrNull()?.id
|
||||
Column(Modifier.padding(top = 6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
for ((group, items) in sections) {
|
||||
if (group != null) AchievementGroupLabel(stringResource(group, items.size))
|
||||
for (a in items) androidx.compose.runtime.key(a.id) {
|
||||
AchievementRow(a, compact = true, if (a.id == first) track("achievements").focusRequester(firstRow) else Modifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun DrawerAchievementsRow(progress: Pair<Int, Int>?, modifier: Modifier = Modifier, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="512"
|
||||
android:viewportHeight="512">
|
||||
<path android:fillColor="#FFFFFFFF" android:fillType="evenOdd" android:pathData="M 142 335 L 148 343 L 148 345 L 155 352 L 165 365 L 166 368 L 169 370 L 171 374 L 176 379 L 177 382 L 179 383 L 181 387 L 187 393 L 187 395 L 193 401 L 196 400 L 200 392 L 206 386 L 259 419 L 262 418 L 266 411 L 264 406 L 250 398 L 249 396 L 242 391 L 237 389 L 236 387 L 231 385 L 227 381 L 215 374 L 215 371 L 222 361 L 222 356 L 220 353 Z M 472 198 L 463 195 L 446 195 L 436 198 L 431 198 L 426 200 L 418 201 L 415 203 L 382 209 L 375 212 L 361 214 L 353 217 L 349 224 L 349 226 L 346 229 L 339 245 L 336 248 L 281 354 L 274 365 L 275 370 L 279 376 L 279 379 L 311 450 L 311 453 L 317 465 L 325 473 L 327 474 L 339 474 L 348 470 L 353 465 L 360 454 L 369 436 L 369 434 L 372 430 L 374 424 L 385 404 L 388 396 L 399 376 L 463 246 L 466 243 L 470 232 L 480 214 L 479 205 Z M 444 224 L 445 226 L 337 439 L 334 435 L 332 428 L 316 393 L 315 388 L 312 384 L 312 381 L 305 367 L 305 364 L 307 362 L 348 282 L 369 244 L 369 242 L 372 239 L 381 238 L 386 236 L 390 236 L 395 234 L 409 232 L 423 228 L 432 227 L 440 224 Z M 211 187 L 201 192 L 201 194 L 203 196 L 203 198 L 228 249 L 225 251 L 166 265 L 165 266 L 169 280 L 234 264 L 242 278 L 242 280 L 265 327 L 278 321 L 278 319 L 250 261 L 252 259 L 313 244 L 310 229 L 244 246 L 235 230 L 235 228 L 226 211 L 226 209 L 224 207 L 215 186 Z M 233 127 L 233 129 L 235 131 L 240 133 L 243 136 L 248 138 L 287 162 L 287 165 L 279 178 L 281 181 L 288 183 L 290 182 L 304 186 L 310 186 L 313 188 L 316 187 L 320 189 L 343 192 L 350 195 L 352 194 L 357 196 L 362 196 L 354 186 L 351 184 L 350 181 L 347 179 L 339 168 L 335 165 L 335 163 L 324 152 L 323 149 L 320 147 L 311 135 L 307 134 L 302 136 L 302 138 L 297 144 L 297 146 L 295 148 L 292 148 L 282 141 L 276 139 L 266 132 L 264 132 L 253 125 L 247 123 L 242 119 L 237 120 Z M 221 73 L 212 70 L 195 70 L 175 75 L 170 75 L 154 80 L 140 82 L 135 84 L 130 84 L 123 87 L 103 91 L 95 103 L 88 119 L 86 121 L 79 136 L 75 141 L 73 147 L 66 158 L 59 174 L 56 177 L 23 240 L 24 245 L 34 266 L 34 269 L 44 289 L 44 292 L 60 326 L 63 335 L 67 342 L 72 347 L 76 349 L 91 348 L 95 346 L 106 334 L 118 310 L 118 308 L 120 306 L 229 88 L 228 80 Z M 193 99 L 194 100 L 190 107 L 190 109 L 183 121 L 183 123 L 181 125 L 176 137 L 174 139 L 132 224 L 130 226 L 123 242 L 112 261 L 89 307 L 88 311 L 85 314 L 58 250 L 53 241 L 62 223 L 74 202 L 118 117 L 121 114 L 129 113 L 134 111 L 139 111 L 162 105 L 167 105 L 188 99 Z" />
|
||||
</vector>
|
||||
@@ -200,7 +200,6 @@
|
||||
<string name="app_fex_hint">يشغّل FEX برامج Linux المخصصة لـ x86 على جهاز ARM64 هذا. يستخدمه الخيار «تلقائي» عندما يكون البرنامج مبنيًا لـ x86.</string>
|
||||
<string name="app_fex_x86">%1$s عبر FEX</string>
|
||||
<string name="app_fex_not_ready">هذا البرنامج مبني لأجهزة كمبيوتر %1$s ويعمل عبر FEX، الذي لم يتم إعداده بعد. افتح Steam مرة واحدة أثناء تسجيل الدخول: سيجعله DroidDeck يُنزّل FEX وSteam Linux Runtime اللازمة، ثم يُفتح هذا البرنامج.</string>
|
||||
<string name="session_proot_missing">تعذّر تنزيل proot الخاص بـ DroidDeck. تحقّق من الاتصال وحاول مرة أخرى. لم تبدأ الجلسة لأن proot الاحتياطي أبطأ من أن يصلح للعب.</string>
|
||||
<string name="session_powervr_missing">تعذّر تنزيل بيئة رسومات PowerVR. تحقق من الاتصال وحاول مرة أخرى.</string>
|
||||
<string name="session_graphics_runtime_failed">تعذّر تجهيز بيئة الرسومات، لذا لم تبدأ الجلسة.</string>
|
||||
<string name="session_game_environment_failed">تعذّر إعداد بيئة اللعبة، لذا لم تبدأ الجلسة.</string>
|
||||
@@ -450,7 +449,6 @@
|
||||
<string name="libraries_rename">إعادة التسمية</string>
|
||||
<string name="libraries_rename_title">اسم المكتبة</string>
|
||||
<string name="libraries_pick">اختر مجلدًا للمكتبة</string>
|
||||
<string name="libraries_full">الحد الأقصى للمكتبات المضافة: %1$d</string>
|
||||
<string name="libraries_overlap">هذا المجلد مكتبة بالفعل أو داخل مكتبة أخرى</string>
|
||||
<string name="libraries_missing">%1$s · غير متاح</string>
|
||||
<string name="libraries_applies_next">يسري بدءًا من جلسة Steam التالية</string>
|
||||
@@ -640,21 +638,14 @@
|
||||
<string name="perf_fsync_hint">يشغّل خاصية fsync المدمجة في Proton على ملفات Proton الأصلية، مع توفير futex_waitv في مساحة المستخدم، فلا يحتاج إلى حزمة ويستمر في العمل لحظة تحديث Steam لـ Proton. أثناء تفعيله، تستخدمه الألعاب قبل droiddeck-esync، باستثناء القليل الذي يبقيه Proton معطّلًا لـ fsync. يُطبَّق في الجلسة التالية.</string>
|
||||
<string name="perf_esync_hint">تنتظر مؤشرات ترابط Windows في اللعبة بعضها بعضًا عبر eventfd والذاكرة المشتركة، بدلًا من رحلات ذهاب وعودة عبر wineserver. يستخدم حزمة droiddeck-esync مُعدّة لإصدار Proton ذاك بالضبط؛ وتُجلَب الحزم تلقائيًا. وإلى أن تتوفر حزمة لإصدار Proton جديد، يحل droiddeck-fsync محله. يُطبَّق في الجلسة التالية.</string>
|
||||
<string name="perf_xalia_hint">يعطّل مساعد التنقّل بوحدة التحكم في Proton، الذي يستهلك CPU في كل لعبة.</string>
|
||||
<string name="perf_seccomp">تشغيل proot بلا seccomp</string>
|
||||
<string name="perf_seccomp_hint">قد يُصلح أخطاء استدعاءات النظام (syscall) الناقصة على بعض الأنوية. قد يقلّل الأداء.</string>
|
||||
<string name="perf_native_userland">التشغيل دون proot (تجريبي)</string>
|
||||
<string name="perf_native_userland_hint">يبدأ تشغيل جانب Linux مباشرة على Android. يسري على الجلسة التالية. أوقفه إذا تعذر تشغيل أي شيء.</string>
|
||||
<string name="perf_fastpath">مسار proot السريع</string>
|
||||
<string name="perf_fastpath_needs_proot">لا يُستخدم دون proot.</string>
|
||||
<string name="perf_fastpath_needs_seccomp">يحتاج إلى مرشّح seccomp في proot.</string>
|
||||
<string name="perf_fastpath_hint">عمليات بحث أسرع عن الملفات وتقطّع أقل. أوقفه إذا تعذّر على برنامج العثور على ملفاته.</string>
|
||||
<string name="perf_cursor_composite">رسم المؤشر داخل gamescope</string>
|
||||
<string name="perf_cursor_composite_hint">يرسم Gamescope المؤشر بنفسه بدلًا من تسليمه إلى Android. فعّله لمؤشر تتحكّم فيه وحدة التحكم. الإيقاف أسرع على الهاتف. يُطبَّق في الجلسة التالية.</string>
|
||||
<string name="perf_identity">هوية الجلسة</string>
|
||||
<string name="perf_hostname">اسم المضيف</string>
|
||||
<string name="perf_hostname_hint">الاسم الذي يراه Steam لهذا الجهاز. اتركه خاليًا للاستعادة إلى %1$s.</string>
|
||||
<string name="perf_hostname_invalid">أحرف وأرقام وشرطات داخلية فقط، حتى 63 حرفًا.</string>
|
||||
<string name="perf_phantom_warning">Android مهيَّأ لإنهاء هذه الجلسة</string>
|
||||
<string name="perf_desktop_as_user">تشغيل سطح المكتب كمستخدم</string>
|
||||
<string name="perf_desktop_as_user_hint">يعمل سطح المكتب وتطبيقاته وطرفياته كمستخدم عادي باسم deck بدلًا من root، للتطبيقات التي ترفض root. يظل sudo يعمل. يسري على سطح المكتب التالي.</string>
|
||||
<string name="driver_installed">مثبّت</string>
|
||||
<string name="driver_available">متاح للتنزيل</string>
|
||||
<string name="driver_nothing_new">لا جديد منذ آخر تحقّق.</string>
|
||||
@@ -849,7 +840,6 @@
|
||||
<string name="setup_check_done">تم</string>
|
||||
<string name="setup_check_warn">يحتاج إلى انتباه</string>
|
||||
<string name="setup_check_busy">قيد التنفيذ</string>
|
||||
<string name="setup_limit_adb_failed">تحقّق من عنوان IP والمنفذ في تصحيح الأخطاء اللاسلكي، أو أعد الإقران إذا أزال Android هذا الجهاز.</string>
|
||||
<string name="setup_install">تثبيت</string>
|
||||
<string name="setup_manage">إدارة</string>
|
||||
<string name="setup_tab_overview">نظرة عامة</string>
|
||||
@@ -873,16 +863,10 @@
|
||||
<string name="setup_installed">مثبّت</string>
|
||||
<string name="setup_runtime_update">%1$s · يتوفر تحديث</string>
|
||||
<string name="setup_runtime_current">%1$s · محدَّث</string>
|
||||
<string name="setup_limit">حد العمليات الفرعية</string>
|
||||
<string name="setup_limit_on">مفعَّل · قد يُغلق Android تطبيق Steam. إيقافه يستغرق دقيقة.</string>
|
||||
<string name="setup_limit_unset">غير مُحدَّد · قد يُغلق Android تطبيق Steam. إيقافه يستغرق دقيقة.</string>
|
||||
<string name="setup_limit_unknown">تعذّر التحقّق منه · إيقافه يستغرق دقيقة.</string>
|
||||
<string name="setup_fix_it">إصلاح</string>
|
||||
<string name="setup_details">التفاصيل</string>
|
||||
<string name="setup_dev_options">خيارات المطوّرين</string>
|
||||
<string name="setup_use_wireless">استخدام تصحيح الأخطاء اللاسلكي</string>
|
||||
<string name="setup_check_again">التحقّق مرة أخرى</string>
|
||||
<string name="setup_limit_turn_on">تفعيل الحد</string>
|
||||
<string name="setup_account">حساب Steam</string>
|
||||
<string name="setup_signed_in_offline">تم تسجيل الدخول باسم %1$s · وضع عدم الاتصال</string>
|
||||
<string name="setup_signed_in">تم تسجيل الدخول باسم %1$s</string>
|
||||
@@ -1302,35 +1286,14 @@
|
||||
<item quantity="many">آخر التغييرات · %1$d إصدارًا</item>
|
||||
<item quantity="other">آخر التغييرات · %1$d إصدار</item>
|
||||
</plurals>
|
||||
<string name="gate_title">إعداد واحد في Android يجب تغييره</string>
|
||||
<string name="gate_eyebrow">Steam</string>
|
||||
<string name="gate_lede">يوقف Android التطبيقات التي تبدأ عمليات خلفية كثيرة، وSteam يبدأ عشرات منها. وإلى أن يتغيّر هذا، تُغلَق الألعاب دون أي خطأ.</string>
|
||||
<string name="gate_fix_for_me">إصلاحه لي</string>
|
||||
<string name="gate_toggle_steps">فعِّل «إيقاف القيود المفروضة على العمليات الثانوية»، ثم عُد. اترك خيارات المطوّرين مفعّلة، وإلا سيُعاد تعطيل المفتاح.</string>
|
||||
<string name="gate_open_dev">فتح خيارات المطوّرين</string>
|
||||
<string name="gate_no_toggle">لا يحتوي إصدار Android هذا على مفتاح لذلك، لذا يغيّره DroidDeck عبر تصحيح الأخطاء اللاسلكي. يستغرق نحو دقيقة، ولا يحتاج إلى جهاز كمبيوتر.</string>
|
||||
<string name="gate_needs_wifi">يحتاج تصحيح الأخطاء اللاسلكي إلى Wi-Fi. تعمل أي شبكة؛ فهو لا يحتاج إلى اتصال بالإنترنت.</string>
|
||||
<string name="gate_step1">افتح الإعدادات ← خيارات المطوّرين ← تصحيح الأخطاء اللاسلكي وفعِّله</string>
|
||||
<string name="gate_step2">اضغط على «إقران جهاز برمز إقران»</string>
|
||||
<string name="gate_step3">أدخل الرمز في إشعار DroidDeck</string>
|
||||
<string name="pairguide_build_number">في «لمحة عن الهاتف»، انقر على «رقم الإصدار» 7 مرات</string>
|
||||
<string name="pairguide_wireless">فعّل «تصحيح الأخطاء اللاسلكي»</string>
|
||||
<string name="pairguide_pair">افتح «تصحيح الأخطاء اللاسلكي»، ثم انقر على «إقران الجهاز باستخدام رمز الإقران»</string>
|
||||
<string name="pairguide_child_process">فعّل «إيقاف قيود العمليات الفرعية»</string>
|
||||
<string name="pairguide_row_child_process">إيقاف قيود العمليات الفرعية</string>
|
||||
<string name="pairguide_row_build_number">رقم الإصدار</string>
|
||||
<string name="pairguide_row_wireless">تصحيح الأخطاء اللاسلكي</string>
|
||||
<string name="pairguide_row_pair">إقران الجهاز باستخدام رمز الإقران</string>
|
||||
<string name="gate_waiting">في انتظار نافذة الإقران المنبثقة…</string>
|
||||
<string name="gate_code_needed">تم العثور على النافذة المنبثقة. أدخل رمزها في الإشعار.</string>
|
||||
<string name="gate_status">الحالة</string>
|
||||
<string name="gate_polling">يتم التحقّق كل ثانيتين. تُغلَق هذه الصفحة عند إيقافه.</string>
|
||||
<string name="gate_other_ways">طرق أخرى</string>
|
||||
<string name="gate_use_wireless_instead">استخدام تصحيح الأخطاء اللاسلكي بدلًا من ذلك</string>
|
||||
<string name="gate_some_roms">تضيف بعض إصدارات ROM هذا المفتاح رغم ذلك. ابحث عن «العمليات الفرعية» في خيارات المطوّرين.</string>
|
||||
<string name="gate_from_computer">من جهاز كمبيوتر يحتوي على ADB:</string>
|
||||
<string name="gate_copy_command">نسخ الأمر</string>
|
||||
<string name="gate_sidequest_steps">وصّل النظارة بالكمبيوتر وافتح SideQuest. اختر “Run ADB Command” ثم “Custom Command”، واكتب الأمر الظاهر أدناه، ثم اختر “Run Command”.</string>
|
||||
<string name="gate_choose_display">اختر الشاشة التي ستُفتَح فيها إعدادات Android.</string>
|
||||
<string name="gate_main_screen">الشاشة الرئيسية</string>
|
||||
<string name="ctrl_color">اللون</string>
|
||||
@@ -1807,14 +1770,6 @@
|
||||
<string name="session_ended_desktop">توقّف سطح المكتب بشكل غير متوقَّع. شارِك السجلات مع بلاغ عن الخطأ، أو حاوِل مرة أخرى.</string>
|
||||
<string name="session_ended_detail">حالة الخروج %1$d · %2$s</string>
|
||||
<string name="session_ended_no_log">لا يوجد سجل</string>
|
||||
<plurals name="session_hint_enosys">
|
||||
<item quantity="zero">يُظهر السجل %1$d خطأ من نوع «Function not implemented»: تسريع seccomp في proot يتسبّب في فشل أداة مساعدة على هذا الجهاز. جرِّب %2$s → «%3$s» (أو «%4$s») وابدأ من جديد.</item>
|
||||
<item quantity="one">يُظهر السجل خطأً واحدًا من نوع «Function not implemented»: تسريع seccomp في proot يتسبّب في فشل أداة مساعدة على هذا الجهاز. جرِّب %2$s → «%3$s» (أو «%4$s») وابدأ من جديد.</item>
|
||||
<item quantity="two">يُظهر السجل خطأين من نوع «Function not implemented»: تسريع seccomp في proot يتسبّب في فشل أداة مساعدة على هذا الجهاز. جرِّب %2$s → «%3$s» (أو «%4$s») وابدأ من جديد.</item>
|
||||
<item quantity="few">يُظهر السجل %1$d أخطاء من نوع «Function not implemented»: تسريع seccomp في proot يتسبّب في فشل أداة مساعدة على هذا الجهاز. جرِّب %2$s → «%3$s» (أو «%4$s») وابدأ من جديد.</item>
|
||||
<item quantity="many">يُظهر السجل %1$d خطأً من نوع «Function not implemented»: تسريع seccomp في proot يتسبّب في فشل أداة مساعدة على هذا الجهاز. جرِّب %2$s → «%3$s» (أو «%4$s») وابدأ من جديد.</item>
|
||||
<item quantity="other">يُظهر السجل %1$d خطأ من نوع «Function not implemented»: تسريع seccomp في proot يتسبّب في فشل أداة مساعدة على هذا الجهاز. جرِّب %2$s → «%3$s» (أو «%4$s») وابدأ من جديد.</item>
|
||||
</plurals>
|
||||
<string name="mode_decky_plugins">الإضافات</string>
|
||||
<string name="mode_decky_plugins_hint">ثبِّت ملف ZIP لإضافة في جلسة Steam التالية.</string>
|
||||
<string name="mode_decky_plugin_downloading">جارٍ التنزيل…</string>
|
||||
@@ -2236,6 +2191,7 @@
|
||||
<string name="bottom_qam_layout_left">يسار</string>
|
||||
<string name="bottom_qam_layout_center">وسط</string>
|
||||
<string name="bottom_qam_layout_right">يمين</string>
|
||||
<string name="bottom_qam_layout_split">مقسّم</string>
|
||||
<string name="bottom_qam_unavailable">قائمة الوصول السريع في Steam غير متاحة بعد.</string>
|
||||
<string name="bottom_page_telemetry">إحصاءات داخل اللعبة</string>
|
||||
<string name="bottom_hud_group">مؤشرات الشاشة السفلية</string>
|
||||
@@ -2366,7 +2322,6 @@
|
||||
<string name="deckymgr_restore_failed">تعذّر استعادة الإضافة الحالية</string>
|
||||
<string name="adbfix_save_failed">تعذّر حفظ هوية تصحيح الأخطاء اللاسلكي</string>
|
||||
<string name="adbfix_command_failed">فشل أمر ADB (%1$d)</string>
|
||||
<string name="adbfix_not_confirmed">لم يؤكّد Android تغيير حدّ العمليات الفرعية: %1$s</string>
|
||||
<string name="adbfix_no_pairing">لا يوجد إقران محفوظ لتصحيح الأخطاء اللاسلكي</string>
|
||||
<string name="adbfix_enter_address">أدخِل عنوان IP الحالي ورقم المنفذ لتصحيح الأخطاء اللاسلكي</string>
|
||||
<string name="adbpair_timed_out">انتهت مهلة انتظار النافذة المنبثقة للإقران. حاوِل مرة أخرى من DroidDeck.</string>
|
||||
@@ -2376,8 +2331,6 @@
|
||||
<string name="adbpair_pairing">جارٍ الإقران…</string>
|
||||
<string name="adbpair_code_rejected">لم ينجح هذا الرمز. افتح النافذة المنبثقة للإقران مرة أخرى وأدخِل رمزها الجديد.</string>
|
||||
<string name="adbpair_connecting">تم الإقران. جارٍ الاتصال…</string>
|
||||
<string name="adbpair_port_not_found">تم الإقران، لكن لم يتم العثور على منفذ تصحيح الأخطاء اللاسلكي. اترك تصحيح الأخطاء اللاسلكي مفعَّلاً وحاوِل مرة أخرى.</string>
|
||||
<string name="adbpair_applying">جارٍ تطبيق الإعداد…</string>
|
||||
<string name="adbpair_command_failed">فشل أمر تصحيح الأخطاء اللاسلكي</string>
|
||||
<string name="adbpair_channel_name">إعداد تصحيح الأخطاء اللاسلكي</string>
|
||||
<string name="adbpair_progress_channel_name">تقدّم إعداد تصحيح الأخطاء اللاسلكي</string>
|
||||
@@ -2390,9 +2343,6 @@
|
||||
<string name="adbpair_title_code">أدخِل رمز إقران Wi-Fi</string>
|
||||
<string name="adbpair_title_retry">أعِد تجربة الرمز</string>
|
||||
<string name="adbpair_enter_code">إدخال الرمز</string>
|
||||
<string name="adbpair_title_working">جارٍ إعداد Steam</string>
|
||||
<string name="adbpair_title_done">Steam جاهز</string>
|
||||
<string name="adbpair_done_text">اضغط للعودة إلى DroidDeck. يمكنك إيقاف تصحيح الأخطاء اللاسلكي الآن.</string>
|
||||
<string name="adbpair_title_failed">توقَّف إعداد تصحيح الأخطاء اللاسلكي</string>
|
||||
<string name="selfinst_download_failed">فشل التنزيل</string>
|
||||
<string name="selfinst_size_mismatch">حجم التنزيل غير مطابق لملف APK المنشور، وتم تجاهله - حاوِل مرة أخرى</string>
|
||||
@@ -2542,16 +2492,6 @@
|
||||
<string name="hdr_none">لا تُعلن هذه الشاشة عن دعم HDR</string>
|
||||
<string name="hdr_not_hdr10">تدعم هذه الشاشة %1$s، وليس HDR10</string>
|
||||
<string name="gpu_this_gpu">وحدة GPU هذه</string>
|
||||
<string name="phantom_title_on">حدّ العمليات الفرعية مفعَّل</string>
|
||||
<string name="phantom_title_unset">حدّ العمليات الفرعية غير محدَّد</string>
|
||||
<string name="phantom_title_unreadable">تعذّر التحقّق من حدّ العمليات الفرعية</string>
|
||||
<string name="phantom_title_off">حدّ العمليات الفرعية غير مفعَّل</string>
|
||||
<string name="phantom_title_not_required">حدّ العمليات الفرعية غير مطلوب</string>
|
||||
<string name="phantom_instructions_fix">%1$s إذا لم يكن ذلك ممكنًا، وصِّل هذا الجهاز بكمبيوتر يستخدم ADB ونفِّذ الأمر أدناه. عُد إلى هنا وتحقَّق مرة أخرى.</string>
|
||||
<string name="phantom_instructions_off">يمكن بدء جلسات Steam.</string>
|
||||
<string name="phantom_instructions_not_applicable">لا يستخدم إصدار Android هذا هذا الحدّ.</string>
|
||||
<string name="phantom_fix_toggle">فعِّل «إيقاف القيود المفروضة على العمليات الثانوية» في خيارات المطوّرين، واترك خيارات المطوّرين مفعَّلة بعد ذلك.</string>
|
||||
<string name="phantom_fix_no_toggle">لا يحتوي إصدار Android هذا على مفتاح لذلك. استخدِم تصحيح الأخطاء اللاسلكي لتغييره من هذا الجهاز.</string>
|
||||
<string name="upd_block_no_apk">لا يتوفّر تنزيل لهذا الإصدار الخاص بهذه النسخة من DroidDeck.</string>
|
||||
<string name="upd_block_version_code">لن يثبِّته Android فوق هذا الإصدار لأن versionCode %1$d أقل من %2$d المثبَّت.</string>
|
||||
<string name="upd_fail_downgrade">لن يثبِّت Android إصدارًا أقدم فوق إصدار أحدث. ابقَ على هذا الإصدار إلى أن تلحق به قناة التحديثات.</string>
|
||||
@@ -2580,14 +2520,12 @@
|
||||
<string name="gstore_volume_free">%1$s · %2$s متاحة</string>
|
||||
<string name="mode_storage_auto_short">تلقائي</string>
|
||||
<string name="appupd_catalog_rejected">فشل كتالوج التحديثات في اختباراته (%1$s)</string>
|
||||
<string name="main_adb_clip_label">إعداد العمليات الفرعية لـ DroidDeck</string>
|
||||
<string name="setup_signed_in_offline_unnamed">تم تسجيل الدخول · وضع عدم الاتصال</string>
|
||||
<string name="setup_signed_in_unnamed">تم تسجيل الدخول</string>
|
||||
<string name="driver_tag_bundled">مرفق</string>
|
||||
<string name="driver_tag_downloaded">منزَّل</string>
|
||||
<string name="driver_tag_imported">مستورَد</string>
|
||||
<string name="driver_tag_bundle">Android + Linux</string>
|
||||
<string name="phantom_warning">%1$s. %2$s\n\n%3$s</string>
|
||||
<string name="display_session">شاشة الجلسة</string>
|
||||
<string name="display_zero_copy">العرض بدون نسخ</string>
|
||||
<string name="display_resolution_landscape">دقة الوضع الأفقي</string>
|
||||
@@ -3026,7 +2964,6 @@
|
||||
<string name="setup_ready">جاهز للّعب</string>
|
||||
<string name="setup_not_ready">غير جاهز للّعب بعد</string>
|
||||
<string name="setup_ready_runtime">بيئة التشغيل %1$s</string>
|
||||
<string name="setup_ready_limit_off">حدّ العمليات الفرعية غير مفعَّل</string>
|
||||
<string name="setup_ready_signed_in">تم تسجيل الدخول باسم %1$s</string>
|
||||
<string name="setup_needs_you">عندما يحتاج الأمر إلى تدخّلك</string>
|
||||
<string name="setup_group_look">المظهر</string>
|
||||
@@ -3962,6 +3899,13 @@
|
||||
<string name="setup_clear_cached">إغلاق التطبيقات المخزّنة مؤقتًا قبل الجلسة</string>
|
||||
<string name="setup_clear_cached_hint">عند بدء الجلسة، يُغلق DroidDeck التطبيقات التي يُبقيها Android في الخلفية، لتحصل اللعبة على ذاكرة أكبر. يجب تفعيل تصحيح الأخطاء اللاسلكي.</string>
|
||||
<string name="setup_clear_cached_unpaired">يتطلّب إقران DroidDeck بتصحيح الأخطاء اللاسلكي (إقران، أدناه).</string>
|
||||
<string name="setup_memory_hud">مؤشر الذاكرة</string>
|
||||
<string name="setup_memory_hud_hint">الذاكرة وswap المستخدمة، على شاشة الجلسة. يقسّمها الوضع المتقدّم بين اللعبة وDroidDeck وAndroid وGPU.</string>
|
||||
<string name="setup_memory_hud_simple">بسيط</string>
|
||||
<string name="setup_memory_hud_advanced">متقدّم</string>
|
||||
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
|
||||
<string name="memory_hud_split">اللعبة %1$s · DroidDeck %2$s · Android %3$s GB</string>
|
||||
<string name="memory_hud_gpu">GPU %1$s GB</string>
|
||||
<string name="setup_bg_limit">التطبيقات في الخلفية أثناء الجلسة</string>
|
||||
<string name="setup_bg_limit_hint">أثناء تشغيل الجلسة، يُبقي Android هذا العدد من التطبيقات كحد أقصى في الذاكرة المؤقتة ويُغلق الباقي، لتحصل اللعبة على ذاكرتها. يُعيد DroidDeck الحد إلى ما كان عليه عند انتهاء الجلسة. يجب تفعيل تصحيح الأخطاء اللاسلكي.</string>
|
||||
<string name="setup_bg_limit_4">4 كحد أقصى</string>
|
||||
@@ -4308,4 +4252,7 @@
|
||||
<string name="steam_store_linux_build">تثبّت هذه اللعبة إصدار Linux الخاص بها. ثبّتها من Steam.</string>
|
||||
<string name="game_zoom_title">تكبير اللعبة</string>
|
||||
<string name="game_zoom_hint">اضبط تكبير اللعبة من 100% إلى 300%</string>
|
||||
<string name="glasses_shortcut_group">اختصار داخل اللعبة</string>
|
||||
<string name="glasses_show_shortcut">إظهار اختصار النظارات الذكية</string>
|
||||
<string name="glasses_show_shortcut_hint">إظهار زر النظارات الذكية العائم فوق اللعبة.</string>
|
||||
</resources>
|
||||
@@ -200,7 +200,6 @@
|
||||
<string name="app_fex_hint">FEX ejecuta programas Linux x86 en este dispositivo ARM64. Auto lo usa cuando el programa es para x86.</string>
|
||||
<string name="app_fex_x86">%1$s con FEX</string>
|
||||
<string name="app_fex_not_ready">Este programa está hecho para PC %1$s y se ejecuta con FEX, que aún no está listo. Abre Steam una vez con tu sesión iniciada: DroidDeck hará que descargue FEX y el Steam Linux Runtime que necesita, y después se abrirá.</string>
|
||||
<string name="session_proot_missing">No se pudo descargar el proot de DroidDeck. Revisa la conexión e inténtalo de nuevo. La sesión no se inició porque el proot alternativo es demasiado lento para jugar.</string>
|
||||
<string name="session_powervr_missing">No se pudo descargar el entorno gráfico de PowerVR. Revisa la conexión e inténtalo de nuevo.</string>
|
||||
<string name="session_graphics_runtime_failed">No se pudo preparar el entorno gráfico, así que la sesión no se inició.</string>
|
||||
<string name="session_game_environment_failed">No se pudo configurar el entorno del juego, así que la sesión no se inició.</string>
|
||||
@@ -447,7 +446,6 @@
|
||||
<string name="libraries_rename">Cambiar nombre</string>
|
||||
<string name="libraries_rename_title">Nombre de la biblioteca</string>
|
||||
<string name="libraries_pick">Elige una carpeta para la biblioteca</string>
|
||||
<string name="libraries_full">Como máximo %1$d bibliotecas agregadas</string>
|
||||
<string name="libraries_overlap">Esa carpeta ya es una biblioteca o está dentro de una</string>
|
||||
<string name="libraries_missing">%1$s · no disponible</string>
|
||||
<string name="libraries_applies_next">Se aplica a partir de la próxima sesión de Steam</string>
|
||||
@@ -634,21 +632,14 @@
|
||||
<string name="perf_fsync_hint">Usa el fsync propio de Proton con los archivos originales de Proton, con futex_waitv proporcionado en espacio de usuario, así que no necesita paquete y sigue funcionando en cuanto Steam actualiza Proton. Mientras está activado, los juegos lo usan antes que droiddeck-esync, salvo los pocos que Proton mantiene sin fsync. Se aplica en la próxima sesión.</string>
|
||||
<string name="perf_esync_hint">Los hilos de Windows de los juegos se esperan entre sí mediante eventfd y memoria compartida, sin pasar por wineserver. Usa un paquete droiddeck-esync hecho para esa versión exacta de Proton; los paquetes se descargan automáticamente. Mientras no exista uno para una versión nueva de Proton, droiddeck-fsync lo sustituye. Se aplica en la próxima sesión.</string>
|
||||
<string name="perf_xalia_hint">Desactiva el asistente de navegación con control de Proton, que consume CPU en cada juego.</string>
|
||||
<string name="perf_seccomp">Ejecutar proot sin seccomp</string>
|
||||
<string name="perf_seccomp_hint">Puede corregir errores de syscalls ausentes en algunos kernels. Puede reducir el rendimiento.</string>
|
||||
<string name="perf_native_userland">Ejecutar sin proot (experimental)</string>
|
||||
<string name="perf_native_userland_hint">Inicia el entorno Linux directamente en Android. Se aplica a la próxima sesión. Desactívalo si algo falla al iniciar.</string>
|
||||
<string name="perf_fastpath">Ruta rápida de proot</string>
|
||||
<string name="perf_fastpath_needs_proot">No se usa sin proot.</string>
|
||||
<string name="perf_fastpath_needs_seccomp">Requiere el filtro seccomp de proot.</string>
|
||||
<string name="perf_fastpath_hint">Búsquedas de archivos más rápidas y menos microcortes. Desactívalo si un programa no encuentra sus archivos.</string>
|
||||
<string name="perf_cursor_composite">Dibujar el cursor dentro de gamescope</string>
|
||||
<string name="perf_cursor_composite_hint">Gamescope dibuja el puntero por sí mismo en lugar de pasárselo a Android. Actívalo para un cursor manejado con el control. Desactivado es más rápido en un celular. Se aplica en la próxima sesión.</string>
|
||||
<string name="perf_identity">Identidad de la sesión</string>
|
||||
<string name="perf_hostname">Nombre del host</string>
|
||||
<string name="perf_hostname_hint">El nombre que Steam ve para este dispositivo. En blanco restaura %1$s.</string>
|
||||
<string name="perf_hostname_invalid">Solo letras, dígitos y guiones internos, hasta 63 caracteres.</string>
|
||||
<string name="perf_phantom_warning">Android está configurado para cerrar esta sesión</string>
|
||||
<string name="perf_desktop_as_user">El escritorio se ejecuta como usuario</string>
|
||||
<string name="perf_desktop_as_user_hint">El escritorio, sus apps y sus terminales se ejecutan como el usuario común deck en lugar de root, para las apps que rechazan root. sudo sigue funcionando. Se aplica al próximo escritorio.</string>
|
||||
<string name="driver_installed">Instalado</string>
|
||||
<string name="driver_available">Disponible para descargar</string>
|
||||
<string name="driver_nothing_new">Nada nuevo desde la última comprobación.</string>
|
||||
@@ -867,7 +858,6 @@
|
||||
<string name="setup_check_done">Hecho</string>
|
||||
<string name="setup_check_warn">Requiere atención</string>
|
||||
<string name="setup_check_busy">Trabajando</string>
|
||||
<string name="setup_limit_adb_failed">Revisa la dirección IP y el puerto de la Depuración inalámbrica, o vincula de nuevo si Android quitó este dispositivo.</string>
|
||||
<string name="setup_install">Instalar</string>
|
||||
<string name="setup_manage">Administrar</string>
|
||||
<string name="setup_tab_overview">Resumen</string>
|
||||
@@ -891,16 +881,10 @@
|
||||
<string name="setup_installed">Instalado</string>
|
||||
<string name="setup_runtime_update">%1$s · actualización disponible</string>
|
||||
<string name="setup_runtime_current">%1$s · al día</string>
|
||||
<string name="setup_limit">Límite de procesos secundarios</string>
|
||||
<string name="setup_limit_on">Activado · Android puede cerrar Steam. Desactivarlo tarda un minuto.</string>
|
||||
<string name="setup_limit_unset">Sin definir · Android puede cerrar Steam. Desactivarlo tarda un minuto.</string>
|
||||
<string name="setup_limit_unknown">No se pudo comprobar · desactivarlo tarda un minuto.</string>
|
||||
<string name="setup_fix_it">Solucionar</string>
|
||||
<string name="setup_details">Detalles</string>
|
||||
<string name="setup_dev_options">Opciones de desarrollador</string>
|
||||
<string name="setup_use_wireless">Usar Depuración inalámbrica</string>
|
||||
<string name="setup_check_again">Comprobar de nuevo</string>
|
||||
<string name="setup_limit_turn_on">Activar límite</string>
|
||||
<string name="setup_account">Cuenta de Steam</string>
|
||||
<string name="setup_signed_in_offline">Sesión iniciada como %1$s · modo sin conexión</string>
|
||||
<string name="setup_signed_in">Sesión iniciada como %1$s</string>
|
||||
@@ -1308,35 +1292,14 @@
|
||||
<item quantity="other">Cambios recientes · %1$d versiones</item>
|
||||
<item quantity="many">Cambios recientes · %1$d versiones</item>
|
||||
</plurals>
|
||||
<string name="gate_title">Un ajuste de Android por cambiar</string>
|
||||
<string name="gate_eyebrow">Steam</string>
|
||||
<string name="gate_lede">Android detiene las apps que inician muchos procesos en segundo plano, y Steam inicia decenas. Hasta que esto cambie, los juegos se cierran sin mostrar ningún error.</string>
|
||||
<string name="gate_fix_for_me">Solucionarlo por mí</string>
|
||||
<string name="gate_toggle_steps">Activa “Inhabilitar restricciones de procesos secundarios” y vuelve. Deja activadas las Opciones de desarrollador o el interruptor se desactivará de nuevo.</string>
|
||||
<string name="gate_open_dev">Abrir Opciones de desarrollador</string>
|
||||
<string name="gate_no_toggle">Esta versión de Android no tiene un interruptor para ello, así que DroidDeck lo cambia mediante la Depuración inalámbrica. Tarda un minuto y no necesitas una computadora.</string>
|
||||
<string name="gate_needs_wifi">La Depuración inalámbrica necesita Wi-Fi. Sirve cualquier red; no necesita internet.</string>
|
||||
<string name="gate_step1">Abre Ajustes → Opciones de desarrollador → Depuración inalámbrica y actívala</string>
|
||||
<string name="gate_step2">Toca “Vincular dispositivo con código de vinculación”</string>
|
||||
<string name="gate_step3">Escribe el código en la notificación de DroidDeck</string>
|
||||
<string name="pairguide_build_number">En Acerca del teléfono, toca Número de compilación 7 veces</string>
|
||||
<string name="pairguide_wireless">Activa la Depuración inalámbrica</string>
|
||||
<string name="pairguide_pair">Abre Depuración inalámbrica y toca “Vincular dispositivo con código de vinculación”</string>
|
||||
<string name="pairguide_child_process">Activa “Inhabilitar restricciones de procesos secundarios”</string>
|
||||
<string name="pairguide_row_child_process">Inhabilitar restricciones de procesos secundarios</string>
|
||||
<string name="pairguide_row_build_number">Número de compilación</string>
|
||||
<string name="pairguide_row_wireless">Depuración inalámbrica</string>
|
||||
<string name="pairguide_row_pair">Vincular dispositivo con código de vinculación</string>
|
||||
<string name="gate_waiting">Esperando la ventana de vinculación…</string>
|
||||
<string name="gate_code_needed">Ventana encontrada. Ingresa su código en la notificación.</string>
|
||||
<string name="gate_status">Estado</string>
|
||||
<string name="gate_polling">Se comprueba cada 2 segundos. Esta página se cierra cuando esté desactivado.</string>
|
||||
<string name="gate_other_ways">Otras formas</string>
|
||||
<string name="gate_use_wireless_instead">Usar Depuración inalámbrica en su lugar</string>
|
||||
<string name="gate_some_roms">Algunas ROM agregan el interruptor de todos modos. Busca “procesos secundarios” en Opciones de desarrollador.</string>
|
||||
<string name="gate_from_computer">Desde una computadora con ADB:</string>
|
||||
<string name="gate_copy_command">Copiar comando</string>
|
||||
<string name="gate_sidequest_steps">Conecta el visor a una computadora y abre SideQuest. Elige “Run ADB Command” y luego “Custom Command”, escribe el comando que aparece abajo y selecciona “Run Command”.</string>
|
||||
<string name="gate_choose_display">Elige en qué pantalla abrir los Ajustes de Android.</string>
|
||||
<string name="gate_main_screen">Pantalla principal</string>
|
||||
<string name="ctrl_color">Color</string>
|
||||
@@ -1826,11 +1789,6 @@
|
||||
<string name="session_ended_desktop">El escritorio se detuvo inesperadamente. Comparte los registros en un informe de error o inténtalo de nuevo.</string>
|
||||
<string name="session_ended_detail">Código de salida %1$d · %2$s</string>
|
||||
<string name="session_ended_no_log">sin registro</string>
|
||||
<plurals name="session_hint_enosys">
|
||||
<item quantity="one">El registro muestra %1$d error \\"Function not implemented\\": la aceleración seccomp de proot hace fallar un proceso auxiliar en este dispositivo. Prueba %2$s → \\"%3$s\\" (o \\"%4$s\\") y vuelve a iniciar.</item>
|
||||
<item quantity="other">El registro muestra %1$d errores \\"Function not implemented\\": la aceleración seccomp de proot hace fallar un proceso auxiliar en este dispositivo. Prueba %2$s → \\"%3$s\\" (o \\"%4$s\\") y vuelve a iniciar.</item>
|
||||
<item quantity="many">El registro muestra %1$d errores \\"Function not implemented\\": la aceleración seccomp de proot hace fallar un proceso auxiliar en este dispositivo. Prueba %2$s → \\"%3$s\\" (o \\"%4$s\\") y vuelve a iniciar.</item>
|
||||
</plurals>
|
||||
<string name="mode_decky_plugins">Plugins</string>
|
||||
<string name="mode_decky_plugins_hint">Instala un ZIP de plugin para la próxima sesión de Steam.</string>
|
||||
<string name="mode_decky_plugin_downloading">Descargando…</string>
|
||||
@@ -2231,6 +2189,7 @@
|
||||
<string name="bottom_qam_layout_left">Izquierda</string>
|
||||
<string name="bottom_qam_layout_center">Centro</string>
|
||||
<string name="bottom_qam_layout_right">Derecha</string>
|
||||
<string name="bottom_qam_layout_split">Dividido</string>
|
||||
<string name="bottom_qam_unavailable">El menú de acceso rápido de Steam aún no está disponible.</string>
|
||||
<string name="bottom_page_telemetry">Estadísticas del juego</string>
|
||||
<string name="bottom_hud_group">HUD de la pantalla inferior</string>
|
||||
@@ -2358,7 +2317,6 @@
|
||||
<string name="deckymgr_restore_failed">No se pudo restaurar el plugin existente</string>
|
||||
<string name="adbfix_save_failed">No se pudo guardar la identidad de la Depuración inalámbrica</string>
|
||||
<string name="adbfix_command_failed">Falló el comando ADB (%1$d)</string>
|
||||
<string name="adbfix_not_confirmed">Android no confirmó el cambio del límite de procesos secundarios: %1$s</string>
|
||||
<string name="adbfix_no_pairing">No hay ninguna vinculación de Depuración inalámbrica guardada</string>
|
||||
<string name="adbfix_enter_address">Ingresa la dirección IP y el puerto actuales de la Depuración inalámbrica</string>
|
||||
<string name="adbpair_timed_out">Se agotó el tiempo de espera de la ventana de vinculación. Inténtalo de nuevo desde DroidDeck.</string>
|
||||
@@ -2368,8 +2326,6 @@
|
||||
<string name="adbpair_pairing">Vinculando…</string>
|
||||
<string name="adbpair_code_rejected">Ese código no funcionó. Vuelve a abrir la ventana de vinculación e ingresa su nuevo código.</string>
|
||||
<string name="adbpair_connecting">Vinculado. Conectando…</string>
|
||||
<string name="adbpair_port_not_found">Vinculado, pero no se encontró el puerto de la Depuración inalámbrica. Deja activada la Depuración inalámbrica e inténtalo de nuevo.</string>
|
||||
<string name="adbpair_applying">Aplicando el ajuste…</string>
|
||||
<string name="adbpair_command_failed">Falló el comando de la Depuración inalámbrica</string>
|
||||
<string name="adbpair_channel_name">Configuración de la Depuración inalámbrica</string>
|
||||
<string name="adbpair_progress_channel_name">Progreso de la configuración de la Depuración inalámbrica</string>
|
||||
@@ -2382,9 +2338,6 @@
|
||||
<string name="adbpair_title_code">Ingresa el código de vinculación Wi-Fi</string>
|
||||
<string name="adbpair_title_retry">Vuelve a probar el código</string>
|
||||
<string name="adbpair_enter_code">Ingresar código</string>
|
||||
<string name="adbpair_title_working">Preparando Steam</string>
|
||||
<string name="adbpair_title_done">Steam está listo</string>
|
||||
<string name="adbpair_done_text">Toca para volver a DroidDeck. Ya puedes desactivar la Depuración inalámbrica.</string>
|
||||
<string name="adbpair_title_failed">Se detuvo la configuración de la Depuración inalámbrica</string>
|
||||
<string name="selfinst_download_failed">Error en la descarga</string>
|
||||
<string name="selfinst_size_mismatch">El tamaño de la descarga no coincidía con el APK publicado y se descartó - inténtalo de nuevo</string>
|
||||
@@ -2534,16 +2487,6 @@
|
||||
<string name="hdr_none">esta pantalla no indica compatibilidad con HDR</string>
|
||||
<string name="hdr_not_hdr10">esta pantalla admite %1$s, no HDR10</string>
|
||||
<string name="gpu_this_gpu">esta GPU</string>
|
||||
<string name="phantom_title_on">El límite de procesos secundarios está activado</string>
|
||||
<string name="phantom_title_unset">El límite de procesos secundarios no está definido</string>
|
||||
<string name="phantom_title_unreadable">No se pudo comprobar el límite de procesos secundarios</string>
|
||||
<string name="phantom_title_off">El límite de procesos secundarios está desactivado</string>
|
||||
<string name="phantom_title_not_required">El límite de procesos secundarios no es necesario</string>
|
||||
<string name="phantom_instructions_fix">%1$s Si no es posible, conecta este dispositivo a una computadora con ADB y ejecuta el comando de abajo. Después vuelve aquí y comprueba de nuevo.</string>
|
||||
<string name="phantom_instructions_off">Ya se pueden iniciar sesiones de Steam.</string>
|
||||
<string name="phantom_instructions_not_applicable">Esta versión de Android no usa este límite.</string>
|
||||
<string name="phantom_fix_toggle">Activa “Inhabilitar restricciones de procesos secundarios” en Opciones de desarrollador y deja activadas las Opciones de desarrollador después.</string>
|
||||
<string name="phantom_fix_no_toggle">Esta versión de Android no tiene un interruptor para ello. Usa la Depuración inalámbrica para cambiarlo desde este dispositivo.</string>
|
||||
<string name="upd_block_no_apk">Esta versión no tiene descarga para esta copia de DroidDeck.</string>
|
||||
<string name="upd_block_version_code">Android no la instalará sobre esta versión porque su versionCode %1$d es inferior al %2$d instalado.</string>
|
||||
<string name="upd_fail_downgrade">Android no instala una versión anterior sobre una más reciente. Quédate en esta versión hasta que el canal la alcance.</string>
|
||||
@@ -2572,14 +2515,12 @@
|
||||
<string name="gstore_volume_free">%1$s · %2$s libres</string>
|
||||
<string name="mode_storage_auto_short">Automático</string>
|
||||
<string name="appupd_catalog_rejected">El catálogo de actualizaciones no superó las comprobaciones (%1$s)</string>
|
||||
<string name="main_adb_clip_label">Ajuste de procesos secundarios de DroidDeck</string>
|
||||
<string name="setup_signed_in_offline_unnamed">Sesión iniciada · modo sin conexión</string>
|
||||
<string name="setup_signed_in_unnamed">Sesión iniciada</string>
|
||||
<string name="driver_tag_bundled">INCLUIDO</string>
|
||||
<string name="driver_tag_downloaded">DESCARGADO</string>
|
||||
<string name="driver_tag_imported">IMPORTADO</string>
|
||||
<string name="driver_tag_bundle">ANDROID + LINUX</string>
|
||||
<string name="phantom_warning">%1$s. %2$s\n\n%3$s</string>
|
||||
<string name="display_session">Pantalla de la sesión</string>
|
||||
<string name="display_zero_copy">Presentación sin copia</string>
|
||||
<string name="display_resolution_landscape">Resolución horizontal</string>
|
||||
@@ -2986,7 +2927,6 @@
|
||||
<string name="setup_ready">Listo para jugar</string>
|
||||
<string name="setup_not_ready">Aún no está listo para jugar</string>
|
||||
<string name="setup_ready_runtime">runtime %1$s</string>
|
||||
<string name="setup_ready_limit_off">límite de procesos desactivado</string>
|
||||
<string name="setup_ready_signed_in">sesión iniciada como %1$s</string>
|
||||
<string name="setup_needs_you">Cuando algo requiera tu atención</string>
|
||||
<string name="setup_group_look">Aspecto</string>
|
||||
@@ -3845,6 +3785,13 @@
|
||||
<string name="setup_clear_cached">Cerrar apps en caché antes de una sesión</string>
|
||||
<string name="setup_clear_cached_hint">Al iniciar una sesión, DroidDeck cierra las apps que Android mantiene en segundo plano para que el juego tenga más memoria. La Depuración inalámbrica debe estar activada.</string>
|
||||
<string name="setup_clear_cached_unpaired">DroidDeck debe estar vinculado con la Depuración inalámbrica (Vincular, abajo).</string>
|
||||
<string name="setup_memory_hud">Indicador de memoria</string>
|
||||
<string name="setup_memory_hud_hint">Memoria y swap en uso, en la pantalla de la sesión. Avanzado lo divide entre el juego, DroidDeck, Android y la GPU.</string>
|
||||
<string name="setup_memory_hud_simple">Simple</string>
|
||||
<string name="setup_memory_hud_advanced">Avanzado</string>
|
||||
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
|
||||
<string name="memory_hud_split">juego %1$s · DroidDeck %2$s · Android %3$s GB</string>
|
||||
<string name="memory_hud_gpu">GPU %1$s GB</string>
|
||||
<string name="setup_bg_limit">Apps en segundo plano durante una sesión</string>
|
||||
<string name="setup_bg_limit_hint">Mientras una sesión está en curso, Android mantiene en caché como máximo esta cantidad de apps y cierra las demás para que el juego use su memoria. DroidDeck restablece el límite anterior cuando termina la sesión. La Depuración inalámbrica debe estar activada.</string>
|
||||
<string name="setup_bg_limit_4">Como máximo 4</string>
|
||||
@@ -4186,4 +4133,7 @@
|
||||
<string name="steam_store_close_steam">Cierra Steam primero</string>
|
||||
<string name="steam_store_session_wait">Pausa primero la descarga de Steam</string>
|
||||
<string name="steam_store_linux_build">Este juego instala su versión para Linux. Instálalo desde Steam.</string>
|
||||
<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>
|
||||
</resources>
|
||||
@@ -200,7 +200,6 @@
|
||||
<string name="app_fex_hint">FEX стартира x86 Linux програми на това ARM64 устройство. Автоматично го използва, когато програмата е компилирана за x86.</string>
|
||||
<string name="app_fex_x86">%1$s през FEX</string>
|
||||
<string name="app_fex_not_ready">Тази програма е компилирана за %1$s компютри и се стартира през FEX, който още не е настроен. Отворете Steam веднъж, докато сте влезли: DroidDeck ще изтегли FEX и необходимата Steam Linux Runtime, след което тя ще се отвори.</string>
|
||||
<string name="session_proot_missing">proot на DroidDeck не можа да бъде изтеглен. Проверете връзката и опитайте пак. Сесията не беше стартирана, защото резервният proot е твърде бавен за игра.</string>
|
||||
<string name="session_powervr_missing">Графичната среда за PowerVR не можа да бъде изтеглена. Проверете връзката и опитайте отново.</string>
|
||||
<string name="session_graphics_runtime_failed">Графичната среда не можа да бъде подготвена, затова сесията не беше стартирана.</string>
|
||||
<string name="session_game_environment_failed">Средата на играта не можа да бъде настроена, затова сесията не беше стартирана.</string>
|
||||
@@ -446,7 +445,6 @@
|
||||
<string name="libraries_rename">Преименувай</string>
|
||||
<string name="libraries_rename_title">Име на библиотеката</string>
|
||||
<string name="libraries_pick">Избери папка за библиотеката</string>
|
||||
<string name="libraries_full">Най-много %1$d добавени библиотеки</string>
|
||||
<string name="libraries_overlap">Тази папка вече е библиотека или се намира в такава</string>
|
||||
<string name="libraries_missing">%1$s · не е налична</string>
|
||||
<string name="libraries_applies_next">Влиза в сила от следващата сесия на Steam</string>
|
||||
@@ -632,21 +630,14 @@
|
||||
<string name="perf_fsync_hint">Стартира собствения fsync на Proton върху оригиналните файлове на Proton, с futex_waitv, подаден от потребителско ниво, затова не изисква пакет и продължава да работи веднага след актуализация на Proton от Steam. Докато е включен, игрите го използват преди droiddeck-esync, освен малкото, които Proton държи извън fsync. Прилага се от следващата сесия.</string>
|
||||
<string name="perf_esync_hint">Windows нишките на игрите се изчакват взаимно чрез eventfd и обща памет, вместо през обиколки през wineserver. Използва пакет droiddeck-esync, направен точно за тази версия на Proton; пакетите се извличат автоматично. Докато не съществува такъв за нова версия на Proton, droiddeck-fsync го замества. Прилага се от следващата сесия.</string>
|
||||
<string name="perf_xalia_hint">Изключва помощника на Proton за навигация с контролер, който използва процесорно време във всяка игра.</string>
|
||||
<string name="perf_seccomp">Стартиране на proot без seccomp</string>
|
||||
<string name="perf_seccomp_hint">Може да отстрани грешки с липсващи системни извиквания на някои ядра. Може да намали производителността.</string>
|
||||
<string name="perf_native_userland">Стартиране без proot (експериментално)</string>
|
||||
<string name="perf_native_userland_hint">Стартира Linux частта директно в Android. Влиза в сила от следващата сесия. Изключи, ако нещо не се стартира.</string>
|
||||
<string name="perf_fastpath">Бърз път на proot</string>
|
||||
<string name="perf_fastpath_needs_proot">Не се използва без proot.</string>
|
||||
<string name="perf_fastpath_needs_seccomp">Изисква филтъра seccomp на proot.</string>
|
||||
<string name="perf_fastpath_hint">По-бързо търсене на файлове и по-малко заекване. Изключете, ако програма не може да намери файловете си.</string>
|
||||
<string name="perf_cursor_composite">Изобразяване на курсора в gamescope</string>
|
||||
<string name="perf_cursor_composite_hint">Gamescope сам рисува показалеца, вместо да го предава на Android. Включете за курсор, управляван с контролер. Изключено е по-бързо на телефон. Прилага се от следващата сесия.</string>
|
||||
<string name="perf_identity">Идентичност на сесията</string>
|
||||
<string name="perf_hostname">Име на хоста</string>
|
||||
<string name="perf_hostname_hint">Името, което Steam вижда за това устройство. Оставено празно възстановява %1$s.</string>
|
||||
<string name="perf_hostname_invalid">Само букви, цифри и тирета по средата, до 63 знака.</string>
|
||||
<string name="perf_phantom_warning">Android е настроен да прекратява тази сесия</string>
|
||||
<string name="perf_desktop_as_user">Работният плот работи като потребител</string>
|
||||
<string name="perf_desktop_as_user_hint">Работният плот, приложенията и терминалите му работят като обикновения потребител deck вместо root, за приложения, които отказват root. sudo продължава да работи. Важи за следващия работен плот.</string>
|
||||
<string name="driver_installed">Инсталиран</string>
|
||||
<string name="driver_available">Налично за изтегляне</string>
|
||||
<string name="driver_nothing_new">Нищо ново от последната проверка.</string>
|
||||
@@ -837,7 +828,6 @@
|
||||
<string name="setup_check_done">Готово</string>
|
||||
<string name="setup_check_warn">Нужно е внимание</string>
|
||||
<string name="setup_check_busy">Обработва се</string>
|
||||
<string name="setup_limit_adb_failed">Проверете IP адреса и порта за безжично отстраняване на грешки или сдвоете отново, ако Android е премахнал това устройство.</string>
|
||||
<string name="setup_install">Инсталиране</string>
|
||||
<string name="setup_manage">Управление</string>
|
||||
<string name="setup_tab_overview">Общ преглед</string>
|
||||
@@ -861,16 +851,10 @@
|
||||
<string name="setup_installed">Инсталирано</string>
|
||||
<string name="setup_runtime_update">%1$s · налична актуализация</string>
|
||||
<string name="setup_runtime_current">%1$s · актуално</string>
|
||||
<string name="setup_limit">Ограничение на дъщерните процеси</string>
|
||||
<string name="setup_limit_on">Включено · Android може да затвори Steam. Изключването отнема минута.</string>
|
||||
<string name="setup_limit_unset">Не е зададено · Android може да затвори Steam. Изключването отнема минута.</string>
|
||||
<string name="setup_limit_unknown">Не можа да се провери · изключването отнема минута.</string>
|
||||
<string name="setup_fix_it">Поправи</string>
|
||||
<string name="setup_details">Подробности</string>
|
||||
<string name="setup_dev_options">Опции за програмисти</string>
|
||||
<string name="setup_use_wireless">Използване на безжично отстраняване на грешки</string>
|
||||
<string name="setup_check_again">Проверка отново</string>
|
||||
<string name="setup_limit_turn_on">Включване на ограничението</string>
|
||||
<string name="setup_account">Акаунт в Steam</string>
|
||||
<string name="setup_signed_in_offline">Влезли сте като %1$s · офлайн режим</string>
|
||||
<string name="setup_signed_in">Влезли сте като %1$s</string>
|
||||
@@ -1274,35 +1258,14 @@
|
||||
<item quantity="one">Скорошни промени · %1$d версия</item>
|
||||
<item quantity="other">Скорошни промени · %1$d версии</item>
|
||||
</plurals>
|
||||
<string name="gate_title">Една настройка на Android за промяна</string>
|
||||
<string name="gate_eyebrow">Steam</string>
|
||||
<string name="gate_lede">Android спира приложения, които стартират много фонови процеси, а Steam стартира десетки. Докато това не се промени, игрите се затварят без грешка.</string>
|
||||
<string name="gate_fix_for_me">Поправи го вместо мен</string>
|
||||
<string name="gate_toggle_steps">Включете „Деактивиране на ограниченията за дъщерните процеси“, след което се върнете. Оставете Опции за програмисти включени, иначе превключвателят се изключва отново.</string>
|
||||
<string name="gate_open_dev">Отваряне на Опции за програмисти</string>
|
||||
<string name="gate_no_toggle">Тази версия на Android няма превключвател за това, затова DroidDeck го променя чрез безжично отстраняване на грешки. Отнема около минута, не е нужен компютър.</string>
|
||||
<string name="gate_needs_wifi">Безжичното отстраняване на грешки изисква Wi-Fi. Работи с всяка мрежа; не е необходим интернет.</string>
|
||||
<string name="gate_step1">Отворете Настройки → Опции за програмисти → Безжично отстраняване на грешки и го включете</string>
|
||||
<string name="gate_step2">Докоснете „Сдвояване на устройство с код за сдвояване“</string>
|
||||
<string name="gate_step3">Въведете кода в известието на DroidDeck</string>
|
||||
<string name="pairguide_build_number">В „Всичко за телефона“ докоснете „Номер на версията“ 7 пъти</string>
|
||||
<string name="pairguide_wireless">Включете „Безжично отстраняване на грешки“</string>
|
||||
<string name="pairguide_pair">Отворете „Безжично отстраняване на грешки“, след което докоснете „Сдвояване на устройството с код за сдвояване“</string>
|
||||
<string name="pairguide_child_process">Включете „Деактивиране на ограниченията за дъщерните процеси“</string>
|
||||
<string name="pairguide_row_child_process">Деактивиране на ограниченията за дъщерните процеси</string>
|
||||
<string name="pairguide_row_build_number">Номер на версията</string>
|
||||
<string name="pairguide_row_wireless">Безжично отстраняване на грешки</string>
|
||||
<string name="pairguide_row_pair">Сдвояване на устройството с код за сдвояване</string>
|
||||
<string name="gate_waiting">Изчакване на изскачащия прозорец за сдвояване…</string>
|
||||
<string name="gate_code_needed">Изскачащият прозорец е намерен. Въведете кода му в известието.</string>
|
||||
<string name="gate_status">Състояние</string>
|
||||
<string name="gate_polling">Проверява се на всеки 2 секунди. Тази страница се затваря, когато е изключено.</string>
|
||||
<string name="gate_other_ways">Други начини</string>
|
||||
<string name="gate_use_wireless_instead">Използване на безжично отстраняване на грешки вместо това</string>
|
||||
<string name="gate_some_roms">Някои ROM-и добавят превключвателя въпреки това. Потърсете „child process“ в Опции за програмисти.</string>
|
||||
<string name="gate_from_computer">От компютър с ADB:</string>
|
||||
<string name="gate_copy_command">Копиране на командата</string>
|
||||
<string name="gate_sidequest_steps">Свържете шлема с компютър и отворете SideQuest. Изберете „Run ADB Command“, после „Custom Command“, въведете командата, показана по-долу, и изберете „Run Command“.</string>
|
||||
<string name="gate_choose_display">Изберете на кой екран да се отворят настройките на Android.</string>
|
||||
<string name="gate_main_screen">Основен екран</string>
|
||||
<string name="ctrl_color">Цвят</string>
|
||||
@@ -1739,10 +1702,6 @@
|
||||
<string name="session_ended_desktop">Работният плот спря неочаквано. Сподели логовете в отчет за грешка или опитай отново.</string>
|
||||
<string name="session_ended_detail">Код на изход %1$d · %2$s</string>
|
||||
<string name="session_ended_no_log">няма лог</string>
|
||||
<plurals name="session_hint_enosys">
|
||||
<item quantity="one">Логът показва %1$d грешка „Function not implemented“: ускорението на proot чрез seccomp се проваля при помощен процес на това устройство. Пробвай %2$s → „%3$s“ (или „%4$s“) и стартирай отново.</item>
|
||||
<item quantity="other">Логът показва %1$d грешки „Function not implemented“: ускорението на proot чрез seccomp се проваля при помощен процес на това устройство. Пробвай %2$s → „%3$s“ (или „%4$s“) и стартирай отново.</item>
|
||||
</plurals>
|
||||
<string name="mode_decky_plugins">Плъгини</string>
|
||||
<string name="mode_decky_plugins_hint">Инсталирай ZIP с плъгин за следващата сесия на Steam.</string>
|
||||
<string name="mode_decky_plugin_downloading">Изтегляне…</string>
|
||||
@@ -2136,6 +2095,7 @@
|
||||
<string name="bottom_qam_layout_left">Вляво</string>
|
||||
<string name="bottom_qam_layout_center">В центъра</string>
|
||||
<string name="bottom_qam_layout_right">Вдясно</string>
|
||||
<string name="bottom_qam_layout_split">Разделено</string>
|
||||
<string name="bottom_qam_unavailable">Менюто за бърз достъп на Steam още не е налично.</string>
|
||||
<string name="bottom_page_telemetry">Статистика в играта</string>
|
||||
<string name="bottom_hud_group">HUD на долния екран</string>
|
||||
@@ -2262,7 +2222,6 @@
|
||||
<string name="deckymgr_restore_failed">Съществуващият плъгин не можа да бъде възстановен</string>
|
||||
<string name="adbfix_save_failed">Идентичността на безжичното отстраняване на грешки не можа да бъде запазена</string>
|
||||
<string name="adbfix_command_failed">Командата на ADB се провали (%1$d)</string>
|
||||
<string name="adbfix_not_confirmed">Android не потвърди промяната на ограничението за дъщерни процеси: %1$s</string>
|
||||
<string name="adbfix_no_pairing">Няма запазено чифтосване за безжично отстраняване на грешки</string>
|
||||
<string name="adbfix_enter_address">Въведи текущия IP адрес и порт за безжично отстраняване на грешки</string>
|
||||
<string name="adbpair_timed_out">Изтече времето за изчакване на изскачащия прозорец за чифтосване. Опитай отново от DroidDeck.</string>
|
||||
@@ -2272,8 +2231,6 @@
|
||||
<string name="adbpair_pairing">Чифтосване…</string>
|
||||
<string name="adbpair_code_rejected">Този код не работи. Отвори отново изскачащия прозорец за чифтосване и въведи новия му код.</string>
|
||||
<string name="adbpair_connecting">Чифтосано. Свързване…</string>
|
||||
<string name="adbpair_port_not_found">Чифтосано, но портът за безжично отстраняване на грешки не беше намерен. Остави безжичното отстраняване на грешки включено и опитай отново.</string>
|
||||
<string name="adbpair_applying">Прилагане на настройката…</string>
|
||||
<string name="adbpair_command_failed">Командата за безжично отстраняване на грешки се провали</string>
|
||||
<string name="adbpair_channel_name">Настройка на безжично отстраняване на грешки</string>
|
||||
<string name="adbpair_progress_channel_name">Напредък на настройката на безжичното отстраняване на грешки</string>
|
||||
@@ -2286,9 +2243,6 @@
|
||||
<string name="adbpair_title_code">Въведи кода за чифтосване по Wi-Fi</string>
|
||||
<string name="adbpair_title_retry">Опитай кода отново</string>
|
||||
<string name="adbpair_enter_code">Въвеждане на код</string>
|
||||
<string name="adbpair_title_working">Настройка на Steam</string>
|
||||
<string name="adbpair_title_done">Steam е готов</string>
|
||||
<string name="adbpair_done_text">Докосни, за да се върнеш в DroidDeck. Вече можеш да изключиш безжичното отстраняване на грешки.</string>
|
||||
<string name="adbpair_title_failed">Настройката на безжичното отстраняване на грешки спря</string>
|
||||
<string name="selfinst_download_failed">Изтеглянето не успя</string>
|
||||
<string name="selfinst_size_mismatch">Размерът на изтеглянето не съответстваше на публикуваното APK и беше отхвърлен - опитай отново</string>
|
||||
@@ -2438,16 +2392,6 @@
|
||||
<string name="hdr_none">този екран не отчита поддръжка на HDR</string>
|
||||
<string name="hdr_not_hdr10">този екран поддържа %1$s, не HDR10</string>
|
||||
<string name="gpu_this_gpu">този GPU</string>
|
||||
<string name="phantom_title_on">Ограничението за дъщерни процеси е включено</string>
|
||||
<string name="phantom_title_unset">Ограничението за дъщерни процеси не е зададено</string>
|
||||
<string name="phantom_title_unreadable">Ограничението за дъщерни процеси не можа да бъде проверено</string>
|
||||
<string name="phantom_title_off">Ограничението за дъщерни процеси е изключено</string>
|
||||
<string name="phantom_title_not_required">Ограничението за дъщерни процеси не е необходимо</string>
|
||||
<string name="phantom_instructions_fix">%1$s Ако това не е възможно, свържи устройството с компютър с ADB и изпълни командата отдолу. Върни се тук и провери отново.</string>
|
||||
<string name="phantom_instructions_off">Сесиите на Steam могат да стартират.</string>
|
||||
<string name="phantom_instructions_not_applicable">Тази версия на Android не използва това ограничение.</string>
|
||||
<string name="phantom_fix_toggle">Включи „Деактивиране на ограниченията за дъщерните процеси“ в Опции за програмисти и остави Опции за програмисти включени след това.</string>
|
||||
<string name="phantom_fix_no_toggle">Тази версия на Android няма превключвател за това. Използвай безжично отстраняване на грешки, за да го промениш от това устройство.</string>
|
||||
<string name="upd_block_no_apk">Тази версия няма изтегляне за това копие на DroidDeck.</string>
|
||||
<string name="upd_block_version_code">Android няма да я инсталира върху тази версия, защото нейният versionCode %1$d е по-нисък от инсталираното %2$d.</string>
|
||||
<string name="upd_fail_downgrade">Android няма да инсталира по-стара версия върху по-нова. Остани на тази версия, докато каналът я настигне.</string>
|
||||
@@ -2476,14 +2420,12 @@
|
||||
<string name="gstore_volume_free">%1$s · %2$s свободни</string>
|
||||
<string name="mode_storage_auto_short">Автоматично</string>
|
||||
<string name="appupd_catalog_rejected">Каталогът с актуализации не премина проверките (%1$s)</string>
|
||||
<string name="main_adb_clip_label">Настройка на DroidDeck за дъщерни процеси</string>
|
||||
<string name="setup_signed_in_offline_unnamed">Вписан · офлайн режим</string>
|
||||
<string name="setup_signed_in_unnamed">Вписан</string>
|
||||
<string name="driver_tag_bundled">ВГРАДЕН</string>
|
||||
<string name="driver_tag_downloaded">ИЗТЕГЛЕН</string>
|
||||
<string name="driver_tag_imported">ИМПОРТИРАН</string>
|
||||
<string name="driver_tag_bundle">ANDROID + LINUX</string>
|
||||
<string name="phantom_warning">%1$s. %2$s\n\n%3$s</string>
|
||||
<string name="display_session">Екран на сесията</string>
|
||||
<string name="display_zero_copy">Представяне без копиране</string>
|
||||
<string name="display_resolution_landscape">Резолюция в пейзажен режим</string>
|
||||
@@ -2914,7 +2856,6 @@
|
||||
<string name="setup_ready">Готово за игра</string>
|
||||
<string name="setup_not_ready">Още не е готово за игра</string>
|
||||
<string name="setup_ready_runtime">среда %1$s</string>
|
||||
<string name="setup_ready_limit_off">ограничението за процеси е изключено</string>
|
||||
<string name="setup_ready_signed_in">вписан като %1$s</string>
|
||||
<string name="setup_needs_you">Когато нещо изисква действие</string>
|
||||
<string name="setup_group_look">Визия</string>
|
||||
@@ -3806,6 +3747,13 @@
|
||||
<string name="setup_clear_cached">Затваряне на кешираните приложения преди сесия</string>
|
||||
<string name="setup_clear_cached_hint">При стартиране на сесия DroidDeck затваря приложенията, които Android държи във фонов режим, за да има играта повече памет. Безжичното отстраняване на грешки трябва да е включено.</string>
|
||||
<string name="setup_clear_cached_unpaired">Изисква DroidDeck да е сдвоен чрез безжично отстраняване на грешки (Сдвояване, по-долу).</string>
|
||||
<string name="setup_memory_hud">Показател за паметта</string>
|
||||
<string name="setup_memory_hud_hint">Използвана памет и swap на екрана на сесията. Разширеният режим я разделя между играта, DroidDeck, Android и GPU.</string>
|
||||
<string name="setup_memory_hud_simple">Опростен</string>
|
||||
<string name="setup_memory_hud_advanced">Разширен</string>
|
||||
<string name="memory_hud_simple">RAM %1$s/%2$s GB · swap %3$s/%4$s GB</string>
|
||||
<string name="memory_hud_split">игра %1$s · DroidDeck %2$s · Android %3$s GB</string>
|
||||
<string name="memory_hud_gpu">GPU %1$s GB</string>
|
||||
<string name="setup_bg_limit">Фонови приложения по време на сесия</string>
|
||||
<string name="setup_bg_limit_hint">Докато сесията работи, Android държи в кеша най-много толкова приложения и затваря останалите, за да получи играта тяхната памет. DroidDeck връща предишното ограничение, когато сесията приключи. Безжичното отстраняване на грешки трябва да е включено.</string>
|
||||
<string name="setup_bg_limit_4">Най-много 4</string>
|
||||
@@ -4148,4 +4096,7 @@
|
||||
<string name="steam_store_linux_build">Тази игра инсталира версията си за Linux. Инсталирайте я от Steam.</string>
|
||||
<string name="game_zoom_title">Мащабиране на играта</string>
|
||||
<string name="game_zoom_hint">Регулирайте увеличението на играта от 100% до 300%</string>
|
||||
<string name="glasses_shortcut_group">Пряк път в играта</string>
|
||||
<string name="glasses_show_shortcut">Показване на прекия път за Smart Glasses</string>
|
||||
<string name="glasses_show_shortcut_hint">Показва плаващия бутон за Smart Glasses върху играта.</string>
|
||||
</resources>
|
||||
Loaded 100 of 351 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user