mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
chore: merge main into feat/lse-emu
This commit is contained in:
commit
e8e4ad565b
437 files changed
+12933
-4769
No files matched your search
@@ -25,7 +25,7 @@ jobs:
|
||||
validate:
|
||||
name: Validate source and build result
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
timeout-minutes: 70
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
@@ -152,6 +152,9 @@ jobs:
|
||||
runs-on: ${{ fromJSON(needs.components-runner.outputs.labels) }}
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- name: Reclaim files a cancelled container build left owned by root
|
||||
if: runner.environment == 'self-hosted'
|
||||
run: sudo -n chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || echo "::warning::could not reclaim $GITHUB_WORKSPACE"
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
@@ -192,17 +195,17 @@ jobs:
|
||||
app/src/main/assets/linuxfs
|
||||
!app/src/main/assets/linuxfs/usr/local/lib/droiddeck-comet
|
||||
!app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox
|
||||
!app/src/main/assets/linuxfs/i386/libblsession.so
|
||||
!app/src/main/assets/linuxfs/i386/libddsession.so
|
||||
!app/src/main/assets/linuxfs/i386/libfakeinput.so
|
||||
!app/src/main/assets/linuxfs/i386/libfaultreport.so
|
||||
!app/src/main/assets/linuxfs/libblaudit.so
|
||||
!app/src/main/assets/linuxfs/libblfastpath.so
|
||||
!app/src/main/assets/linuxfs/libddaudit.so
|
||||
!app/src/main/assets/linuxfs/libddfastpath.so
|
||||
!app/src/main/assets/linuxfs/libddnatv-hook.so
|
||||
!app/src/main/assets/linuxfs/libblsession.so
|
||||
!app/src/main/assets/linuxfs/libddsession.so
|
||||
!app/src/main/assets/linuxfs/libfakeinput.so
|
||||
!app/src/main/assets/linuxfs/libssbs.so
|
||||
!app/src/main/assets/linuxfs/usr/local/bin/droiddeck-clipboard
|
||||
!app/src/main/assets/linuxfs/x86_64/libblsession.so
|
||||
!app/src/main/assets/linuxfs/x86_64/libddsession.so
|
||||
!app/src/main/assets/linuxfs/x86_64/libfakeinput.so
|
||||
!app/src/main/assets/linuxfs/x86_64/libfaultreport.so
|
||||
!app/src/main/assets/linuxfs/x86_64/libvulkan-thunk.so
|
||||
@@ -353,6 +356,9 @@ jobs:
|
||||
outputs:
|
||||
variants: ${{ steps.variants.outputs.list }}
|
||||
steps:
|
||||
- name: Reclaim files a cancelled container build left owned by root
|
||||
if: runner.environment == 'self-hosted'
|
||||
run: sudo -n chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || echo "::warning::could not reclaim $GITHUB_WORKSPACE"
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
@@ -70,12 +70,13 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
|
||||
- Runtime, shim, input and controller work build on WinNative and Bannerlator by maxjivi05.
|
||||
- mmap ring buffer controller input by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)).
|
||||
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT). FEX's code disk cache was checked in its source.
|
||||
- [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.
|
||||
- x86 AppImages, and arm64 ones whose runtime can't unpack on Android, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence.
|
||||
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
|
||||
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
|
||||
- Wine write watches use userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later). libblsession supplies the arm64 syscall number and answers `PAGEMAP_SCAN` from `/proc/self/pagemap`.
|
||||
- libblsession runs Wine's arm64 `SIGUSR2` context handler (`dlls/ntdll/unix/signal_arm64.c`, LGPL-2.1-or-later) in place on a frame laid out like [Linux](https://github.com/torvalds/linux)'s `arch/arm64/kernel/signal.c`, and serves `fill_vm_counters` in `dlls/ntdll/unix/process.c` the kernel's own `/proc/<pid>/status`.
|
||||
- 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.
|
||||
@@ -96,9 +97,10 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
- Battle.net is by [@kayakyakr](https://github.com/kayakyakr). It runs Blizzard's own client in Proton (downloaded from Blizzard, not included) and shows key art from the [Battle.net Shop](https://shop.battle.net). Without Steam, its games see the pad as an Xbox 360 controller via `PROTON_SPOOF_STEAMINPUT_VIDPID` in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/winebus.sys`.
|
||||
- The EA store follows the EA app's protocols as documented by [ArmchairDevelopers](https://github.com/ArmchairDevelopers)' [Maxima](https://github.com/ArmchairDevelopers/Maxima) (GPL-3.0): sign-in, the GraphQL queries (included verbatim, since EA matches them by hash), build archives, online activation licences and the LSX game endpoint. The code is DroidDeck's own.
|
||||
- Battle.net installs drive Blizzard's Agent the way [@barncastle](https://github.com/barncastle)'s [Battle.Net-Installer](https://github.com/barncastle/Battle.Net-Installer) does, with requests from [wowdev.wiki](https://wowdev.wiki/Agent). Read without taking code: [@mubaraknumann](https://github.com/mubaraknumann)'s [unifideck](https://github.com/mubaraknumann/unifideck), [@djmittens](https://github.com/djmittens)'s [neo-mittens](https://github.com/djmittens/neo-mittens) `bnetswitch`, [@BCD1210](https://github.com/BCD1210)'s [soju](https://github.com/BCD1210/soju) and [Lutris](https://github.com/lutris/lutris)'s `product.db` reader.
|
||||
- The Rockstar launcher service looks for launcher pipe names in the executables beside the game, since [CitizenFX](https://github.com/citizenfx/fivem)'s `ros-patches-five` shows GTA V opening `GTAVLauncher_Pipe` and [@pingod](https://github.com/pingod)'s [rdr2-linux-launcher](https://github.com/pingod/rdr2-linux-launcher) notes that Rockstar's protected executables resolve such strings only at run time. Read without taking code.
|
||||
- World of Warcraft addon imports replace an addon's folder from a temporary copy, as [WowUp](https://github.com/WowUp/WowUp) does, and read flavour folders the way [WoWDeck](https://github.com/sigboe/wowdeck) does. No code from either is used.
|
||||
- The World of Warcraft addon Download window searches [WoWInterface](https://www.wowinterface.com) through its MMOUI API. [CurseForge](https://www.curseforge.com/wow) opens in the user's browser, with no API and no key.
|
||||
- Xbox games load [@domsvoboda](https://github.com/domsvoboda)'s [xodus-nexus](https://github.com/domsvoboda/xodus-nexus) modules (LGPL-2.1-or-later), including `wintypes.dll`. Content licensing sends delegation-compact device tickets in the licensing wire form, following the [nexus-backend](https://github.com/domsvoboda/nexus-backend) commit `27c335e`. Minecraft's GameInput setup was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinux](https://github.com/Wyze3306/BedrockOnLinux) (MIT).
|
||||
- The Xbox store runs [@domsvoboda](https://github.com/domsvoboda)'s [nexus-backend](https://github.com/domsvoboda/nexus-backend) 0.2.15 (GPL-3.0, a fork of [Xodus](https://github.com/xodus-gaming/xodus)), and Xbox games load the Windows modules of his [nexus-runtime](https://github.com/domsvoboda/nexus-runtime) (LGPL-2.1-or-later), including the C++ [nexus-xgameruntime](https://github.com/domsvoboda/nexus-xgameruntime) and `wintypes.dll`. Content licensing sends delegation-compact device tickets in the licensing wire form, as nexus-backend's Store license path (commit `27c335e`) does. Minecraft's GameInput setup was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinux](https://github.com/Wyze3306/BedrockOnLinux) (MIT).
|
||||
- The Xbox Cloud Gaming player uses the WebRTC client of [@unknownskl](https://github.com/unknownskl)'s [Greenlight](https://github.com/unknownskl/greenlight) (MIT), and its offer tweaks and sharpening follow [@redphx](https://github.com/redphx)'s [Better xCloud](https://github.com/redphx/better-xcloud) (MIT). See `tools/xcloud-player/NOTICE.md`.
|
||||
- The itch.io butler pack ships butler's `7z.so`, itch.io's build of [7-Zip](https://www.7-zip.org) by Igor Pavlov (LGPL-2.1, unRAR restriction on RAR code), unmodified. Other archives use Apache Commons Compress and the runtime's bsdtar (libarchive).
|
||||
- The Store uses [Flatpak](https://github.com/flatpak/flatpak) (LGPL-2.1) through DroidDeck's own bubblewrap shim. Chromium and Electron apps start directly, since [zypak](https://github.com/refi64/zypak) by [@refi64](https://github.com/refi64) (BSD-3-Clause) always uses Flatpak's spawn portal.
|
||||
@@ -113,6 +115,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
- The DroidDeck HUD is [@The412Banner](https://github.com/The412Banner)'s [FusionHUD](https://github.com/The412Banner/FusionHUD) (GPL-3.0 with an attribution term). Its readings match Valve's [MangoHud](https://github.com/flightlessmango/MangoHud) build (MIT), with frame times from gamescope patch 0125.
|
||||
- The HUD's CPU, GPU load, thermal and battery readers come from [@xXJSONDeruloXx](https://github.com/xXJSONDeruloXx)'s work.
|
||||
- LSFG frame generation comes from Camille LaVey and the [Eden](https://eden-emu.dev) project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported by [@maxjivi05](https://github.com/maxjivi05). It needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders.
|
||||
- Black frame insertion follows the design of [@artzox](https://github.com/artzox)'s [BFI Presenter](https://github.com/artzox/BFI-Presenter) (GPL-3.0): the strobe runs on the display's refresh clock and the game is paced to the lit refresh. Both build on [Blur Busters](https://blurbusters.com)' research on MPRT and motion blur. No BFI Presenter code is used.
|
||||
- Remote Play decodes through Android's MediaCodec or the [FFmpeg](https://ffmpeg.org) (LGPL-2.1-or-later) in Steam's runtime. Qualcomm low latency settings follow [Moonlight](https://github.com/moonlight-stream/moonlight-android) (GPL-3.0).
|
||||
- [PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire) (MIT) sockets use the settings in its `module-access.c`, and [WirePlumber](https://gitlab.freedesktop.org/pipewire/wireplumber) (MIT) keeps those clients at full permissions.
|
||||
|
||||
|
||||
+5
-7
@@ -130,7 +130,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "com.droiddeck.launcher"
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
targetSdkVersion 34
|
||||
versionCode 19
|
||||
versionName "0.7.1"
|
||||
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
|
||||
@@ -201,10 +201,6 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
lint {
|
||||
disable 'ExpiredTargetSdkVersion'
|
||||
}
|
||||
|
||||
androidResources {
|
||||
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>droiddeck-rockstar:<dir>droiddeck-dirt:<dir>directaudio:<dir>hybris'
|
||||
}
|
||||
@@ -216,7 +212,7 @@ android {
|
||||
jniLibs {
|
||||
useLegacyPackaging = true
|
||||
pickFirsts += ['**/libtermux.so']
|
||||
excludes += ['**/libproot.so', '**/libproot-loader.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
|
||||
excludes += ['**/libproot.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,8 +274,10 @@ def stageRuntimeAssets = tasks.register('stageRuntimeAssets', Sync) {
|
||||
dependsOn(stageSessionScripts)
|
||||
from(layout.projectDirectory.dir('src/main/assets')) { exclude 'pulseaudio.tzst' }
|
||||
from(rootProject.file('tools/linuxfs/innoextract'))
|
||||
from(rootProject.file('tools')) { include 'droiddeckctl', 'adb_device.py', 'proot_profile.py'; into('agent/ctl') }
|
||||
from(rootProject.file('tools')) { include 'droiddeckctl', 'droiddeck-scenario', 'adb_device.py', 'proot_profile.py'; into('agent/ctl') }
|
||||
from(rootProject.file('tools/agent/AGENTS.md')) { into('agent/ctl') }
|
||||
from(rootProject.file('docs/agent-control.md')) { into('agent/ctl') }
|
||||
from(rootProject.file('tools/agent/skills')) { into('agent/skills') }
|
||||
from(layout.buildDirectory.dir('prepared-assets'))
|
||||
into(runtimeAssetsDir)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,12 @@
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
@@ -48,7 +53,8 @@
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<uses-feature android:name="android.hardware.vulkan.version" android:version="0x401000" android:required="true" />
|
||||
@@ -70,6 +76,7 @@
|
||||
android:hardwareAccelerated="true"
|
||||
android:largeHeap="true"
|
||||
android:extractNativeLibs="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:appCategory="game"
|
||||
android:isGame="true">
|
||||
|
||||
@@ -143,6 +150,7 @@
|
||||
<category android:name="android.intent.category.CAR_LAUNCHER" />
|
||||
<data android:scheme="droiddeck" android:host="game" />
|
||||
<data android:scheme="droiddeck" android:host="soundtrack" />
|
||||
<data android:scheme="droiddeck" android:host="settings" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.CREATE_SHORTCUT" />
|
||||
@@ -291,6 +299,15 @@
|
||||
android:resizeableActivity="true"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||
|
||||
<activity
|
||||
android:name=".session.KeepTopActivity"
|
||||
android:exported="false"
|
||||
android:excludeFromRecents="true"
|
||||
android:noHistory="true"
|
||||
android:taskAffinity="${applicationId}.keeptop"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
|
||||
android:resizeableActivity="true"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density" />
|
||||
<activity
|
||||
android:name=".ui.SessionTypingActivity"
|
||||
android:exported="false"
|
||||
@@ -312,7 +329,11 @@
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density"
|
||||
android:theme="@style/SessionTheme" />
|
||||
|
||||
<service android:name=".agent.AgentHostService" android:exported="false" />
|
||||
<service android:name=".agent.AgentHostService" android:exported="false"
|
||||
android:foregroundServiceType="specialUse">
|
||||
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
android:value="Keeps the user's on-device assistant running between screens" />
|
||||
</service>
|
||||
<service
|
||||
android:name=".update.UpdateWatch"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE"
|
||||
@@ -320,7 +341,11 @@
|
||||
<service
|
||||
android:name=".session.SessionService"
|
||||
android:exported="false"
|
||||
android:stopWithTask="false" />
|
||||
android:stopWithTask="false"
|
||||
android:foregroundServiceType="specialUse">
|
||||
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
android:value="Runs the user's Linux gaming session while its window is in the background" />
|
||||
</service>
|
||||
<!-- The compositor's native state is one per process, so the bottom-screen desktop's compositor runs in its own. -->
|
||||
<service
|
||||
android:name=".wayland.BottomDesktopCompositorService"
|
||||
@@ -328,10 +353,15 @@
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name=".runtime.RuntimeInstallService"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="dataSync" />
|
||||
<service
|
||||
android:name=".core.WirelessAdbPairingService"
|
||||
android:exported="false" />
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="specialUse">
|
||||
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
android:value="Waits for the wireless debugging pairing code the user enters" />
|
||||
</service>
|
||||
<service
|
||||
android:name=".stores.download.StoreDownloadService"
|
||||
android:exported="false"
|
||||
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec python3 /root/.local/share/droiddeck/ctl/droiddeck-scenario "$@"
|
||||
@@ -40,6 +40,12 @@ add_library(gpuclock SHARED gpuclock/kgsl_clock.c gpuclock/kgsl_busy.c)
|
||||
|
||||
add_library(termux SHARED termux/termux.c)
|
||||
|
||||
# An executable packaged as a library: the only place a targetSdk 29+ app may execute files from.
|
||||
add_library(ddexec SHARED ddexec/ddexec.c)
|
||||
target_compile_options(ddexec PRIVATE -O2 -ffreestanding -fno-builtin -fno-stack-protector -fno-asynchronous-unwind-tables)
|
||||
target_link_options(ddexec PRIVATE -nostdlib -Wl,-e,_start -Wl,-z,noexecstack -Wl,--no-undefined -Wl,-Bsymbolic
|
||||
-Wl,-z,max-page-size=16384)
|
||||
|
||||
add_library(ddvenc SHARED venc/venc_server.cpp)
|
||||
target_compile_features(ddvenc PRIVATE cxx_std_17)
|
||||
target_link_libraries(ddvenc mediandk log)
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
// libddexec.so: starts an ELF program from the app's data directory.
|
||||
//
|
||||
// usage: libddexec.so <file> <argv0> [args...]
|
||||
//
|
||||
// From targetSdk 29, Android refuses execve() of app data files, but still lets the app map them
|
||||
// executable, and executes the APK's extracted libraries. This executable is one of those libraries:
|
||||
// it maps <file> (and its PT_INTERP, if it names one) the way the kernel's ELF loader would, builds the
|
||||
// stack the kernel would have built for "<argv0> [args...]", and jumps to the entry point.
|
||||
// It is freestanding: no libc, no relocations, so the kernel can run it as a static PIE.
|
||||
|
||||
#include <elf.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define SYS_faccessat 48
|
||||
#define SYS_openat 56
|
||||
#define SYS_close 57
|
||||
#define SYS_pread64 67
|
||||
#define SYS_write 64
|
||||
#define SYS_exit_group 94
|
||||
#define SYS_munmap 215
|
||||
#define SYS_mmap 222
|
||||
#define SYS_mprotect 226
|
||||
|
||||
#define AT_FDCWD_ (-100)
|
||||
#define O_RDONLY_ 0
|
||||
#define O_CLOEXEC_ 02000000
|
||||
#define PROT_READ_ 1
|
||||
#define PROT_WRITE_ 2
|
||||
#define PROT_EXEC_ 4
|
||||
#define MAP_PRIVATE_ 0x02
|
||||
#define MAP_FIXED_ 0x10
|
||||
#define MAP_ANONYMOUS_ 0x20
|
||||
#define MAX_PHDRS 64
|
||||
#define STACK_GAP 65536
|
||||
|
||||
static long sys6(long n, long a, long b, long c, long d, long e, long f) {
|
||||
register long x8 __asm__("x8") = n;
|
||||
register long x0 __asm__("x0") = a;
|
||||
register long x1 __asm__("x1") = b;
|
||||
register long x2 __asm__("x2") = c;
|
||||
register long x3 __asm__("x3") = d;
|
||||
register long x4 __asm__("x4") = e;
|
||||
register long x5 __asm__("x5") = f;
|
||||
__asm__ volatile("svc #0" : "+r"(x0) : "r"(x8), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5) : "memory", "cc");
|
||||
return x0;
|
||||
}
|
||||
|
||||
static size_t slen(const char *s) {
|
||||
size_t n = 0;
|
||||
while (s[n]) n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
static void out(const char *s) { sys6(SYS_write, 2, (long)s, (long)slen(s), 0, 0, 0); }
|
||||
|
||||
static void out_num(long v) {
|
||||
char buf[24];
|
||||
int i = (int)sizeof(buf) - 1;
|
||||
buf[i] = 0;
|
||||
unsigned long u = v < 0 ? (unsigned long)-v : (unsigned long)v;
|
||||
do {
|
||||
buf[--i] = (char)('0' + u % 10);
|
||||
u /= 10;
|
||||
} while (u && i > 1);
|
||||
if (v < 0) buf[--i] = '-';
|
||||
out(buf + i);
|
||||
}
|
||||
|
||||
__attribute__((noreturn)) static void die(const char *what, const char *path, long err) {
|
||||
out("libddexec: ");
|
||||
if (path) {
|
||||
out(path);
|
||||
out(": ");
|
||||
}
|
||||
out(what);
|
||||
if (err) {
|
||||
out(" (");
|
||||
out_num(err);
|
||||
out(")");
|
||||
}
|
||||
out("\n");
|
||||
sys6(SYS_exit_group, 127, 0, 0, 0, 0, 0);
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
static long xpread(int fd, void *buf, size_t len, long off) {
|
||||
size_t done = 0;
|
||||
while (done < len) {
|
||||
long n = sys6(SYS_pread64, fd, (long)((char *)buf + done), (long)(len - done), off + (long)done, 0, 0);
|
||||
if (n <= 0) return n < 0 ? n : -1;
|
||||
done += (size_t)n;
|
||||
}
|
||||
return (long)done;
|
||||
}
|
||||
|
||||
struct image {
|
||||
uintptr_t base;
|
||||
uintptr_t phdr;
|
||||
uintptr_t entry;
|
||||
unsigned long phnum;
|
||||
unsigned long phent;
|
||||
char interp[256];
|
||||
};
|
||||
|
||||
static uintptr_t trunc_page(uintptr_t v, uintptr_t page) { return v & ~(page - 1); }
|
||||
static uintptr_t round_page(uintptr_t v, uintptr_t page) { return (v + page - 1) & ~(page - 1); }
|
||||
|
||||
static int prot_of(uint32_t flags) {
|
||||
return ((flags & PF_R) ? PROT_READ_ : 0) | ((flags & PF_W) ? PROT_WRITE_ : 0) | ((flags & PF_X) ? PROT_EXEC_ : 0);
|
||||
}
|
||||
|
||||
static void map_failed(const char *path, long r) { die("cannot map a segment", path, r); }
|
||||
|
||||
static void load(const char *path, struct image *im, uintptr_t page) {
|
||||
int fd = (int)sys6(SYS_openat, AT_FDCWD_, (long)path, O_RDONLY_ | O_CLOEXEC_, 0, 0, 0);
|
||||
if (fd < 0) die("cannot open", path, fd);
|
||||
Elf64_Ehdr eh;
|
||||
if (xpread(fd, &eh, sizeof(eh), 0) != (long)sizeof(eh)) die("not an ELF file", path, 0);
|
||||
if (eh.e_ident[EI_MAG0] != ELFMAG0 || eh.e_ident[EI_MAG1] != ELFMAG1 || eh.e_ident[EI_MAG2] != ELFMAG2 ||
|
||||
eh.e_ident[EI_MAG3] != ELFMAG3 || eh.e_ident[EI_CLASS] != ELFCLASS64 || eh.e_machine != EM_AARCH64 ||
|
||||
(eh.e_type != ET_EXEC && eh.e_type != ET_DYN) || eh.e_phentsize != sizeof(Elf64_Phdr) ||
|
||||
eh.e_phnum == 0 || eh.e_phnum > MAX_PHDRS)
|
||||
die("not a 64-bit ARM ELF program", path, 0);
|
||||
Elf64_Phdr ph[MAX_PHDRS];
|
||||
long size = (long)eh.e_phnum * (long)sizeof(Elf64_Phdr);
|
||||
if (xpread(fd, ph, (size_t)size, (long)eh.e_phoff) != size) die("truncated program headers", path, 0);
|
||||
|
||||
uintptr_t lo = UINTPTR_MAX, hi = 0;
|
||||
for (int i = 0; i < eh.e_phnum; i++) {
|
||||
if (ph[i].p_type != PT_LOAD) continue;
|
||||
uintptr_t s = trunc_page(ph[i].p_vaddr, page), e = round_page(ph[i].p_vaddr + ph[i].p_memsz, page);
|
||||
if (s < lo) lo = s;
|
||||
if (e > hi) hi = e;
|
||||
}
|
||||
if (lo >= hi) die("no loadable segments", path, 0);
|
||||
|
||||
uintptr_t bias = 0;
|
||||
if (eh.e_type == ET_DYN) {
|
||||
long r = sys6(SYS_mmap, 0, (long)(hi - lo), 0, MAP_PRIVATE_ | MAP_ANONYMOUS_, -1, 0);
|
||||
if (r < 0 && r > -4096) map_failed(path, r);
|
||||
bias = (uintptr_t)r - lo;
|
||||
}
|
||||
|
||||
for (int i = 0; i < eh.e_phnum; i++) {
|
||||
Elf64_Phdr *p = &ph[i];
|
||||
if (p->p_type != PT_LOAD || p->p_memsz == 0) continue;
|
||||
int prot = prot_of(p->p_flags);
|
||||
uintptr_t seg = bias + p->p_vaddr;
|
||||
uintptr_t start = trunc_page(seg, page);
|
||||
uintptr_t file_end = seg + p->p_filesz;
|
||||
uintptr_t mem_end = round_page(seg + p->p_memsz, page);
|
||||
int zero_tail = p->p_memsz > p->p_filesz && (file_end & (page - 1)) != 0;
|
||||
if (p->p_filesz > 0) {
|
||||
uintptr_t len = round_page(file_end, page) - start;
|
||||
long r = sys6(SYS_mmap, (long)start, (long)len, prot | (zero_tail ? PROT_WRITE_ : 0),
|
||||
MAP_PRIVATE_ | MAP_FIXED_, fd, (long)trunc_page(p->p_offset, page));
|
||||
if (r < 0 && r > -4096) map_failed(path, r);
|
||||
if (zero_tail) {
|
||||
for (volatile char *z = (volatile char *)file_end; (uintptr_t)z < round_page(file_end, page); z++) *z = 0;
|
||||
if (!(prot & PROT_WRITE_)) sys6(SYS_mprotect, (long)trunc_page(file_end, page), (long)page, prot, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
uintptr_t anon = p->p_filesz > 0 ? round_page(file_end, page) : start;
|
||||
if (mem_end > anon) {
|
||||
long r = sys6(SYS_mmap, (long)anon, (long)(mem_end - anon), prot, MAP_PRIVATE_ | MAP_FIXED_ | MAP_ANONYMOUS_, -1, 0);
|
||||
if (r < 0 && r > -4096) map_failed(path, r);
|
||||
}
|
||||
}
|
||||
|
||||
im->base = bias;
|
||||
im->entry = bias + eh.e_entry;
|
||||
im->phnum = eh.e_phnum;
|
||||
im->phent = eh.e_phentsize;
|
||||
im->phdr = 0;
|
||||
im->interp[0] = 0;
|
||||
for (int i = 0; i < eh.e_phnum; i++) {
|
||||
if (ph[i].p_type == PT_PHDR) im->phdr = bias + ph[i].p_vaddr;
|
||||
if (ph[i].p_type == PT_INTERP) {
|
||||
if (ph[i].p_filesz == 0 || ph[i].p_filesz >= sizeof(im->interp)) die("bad PT_INTERP", path, 0);
|
||||
if (xpread(fd, im->interp, ph[i].p_filesz, (long)ph[i].p_offset) != (long)ph[i].p_filesz)
|
||||
die("truncated PT_INTERP", path, 0);
|
||||
im->interp[ph[i].p_filesz] = 0;
|
||||
}
|
||||
}
|
||||
if (!im->phdr) {
|
||||
for (int i = 0; i < eh.e_phnum; i++) {
|
||||
Elf64_Phdr *p = &ph[i];
|
||||
if (p->p_type == PT_LOAD && eh.e_phoff >= p->p_offset && eh.e_phoff < p->p_offset + p->p_filesz) {
|
||||
im->phdr = bias + p->p_vaddr + (eh.e_phoff - p->p_offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!im->phdr) die("program headers are not in a loaded segment", path, 0);
|
||||
sys6(SYS_close, fd, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static unsigned long auxv_get(const uintptr_t *auxv, unsigned long type, unsigned long fallback) {
|
||||
for (; auxv[0] != AT_NULL; auxv += 2)
|
||||
if (auxv[0] == type) return auxv[1];
|
||||
return fallback;
|
||||
}
|
||||
|
||||
__attribute__((used, noreturn)) void ddexec_main(uintptr_t *sp) {
|
||||
long argc = (long)sp[0];
|
||||
char **argv = (char **)(sp + 1);
|
||||
char **envp = argv + argc + 1;
|
||||
long nenv = 0;
|
||||
while (envp[nenv]) nenv++;
|
||||
uintptr_t *auxv = (uintptr_t *)(envp + nenv + 1);
|
||||
long naux = 0;
|
||||
while (auxv[naux * 2] != AT_NULL) naux++;
|
||||
if (argc < 3) die("usage: libddexec.so <file> <argv0> [args...]", 0, 0);
|
||||
|
||||
uintptr_t page = auxv_get(auxv, AT_PAGESZ, 4096);
|
||||
const char *path = argv[1];
|
||||
struct image prog, interp;
|
||||
load(path, &prog, page);
|
||||
int has_interp = prog.interp[0] != 0;
|
||||
if (has_interp) load(prog.interp, &interp, page);
|
||||
|
||||
// The new stack: argc, argv, envp and auxv as the kernel lays them out, below the current one.
|
||||
// The strings stay where the kernel put them.
|
||||
static const unsigned long replaced[] = {AT_PHDR, AT_PHENT, AT_PHNUM, AT_BASE, AT_ENTRY, AT_EXECFN};
|
||||
long nreplaced = (long)(sizeof(replaced) / sizeof(replaced[0]));
|
||||
long new_argc = argc - 2;
|
||||
long words = 1 + (new_argc + 1) + (nenv + 1) + (naux + nreplaced + 1) * 2;
|
||||
uintptr_t *nsp = (uintptr_t *)(((uintptr_t)sp - STACK_GAP - (uintptr_t)words * sizeof(uintptr_t)) & ~(uintptr_t)15);
|
||||
uintptr_t *w = nsp;
|
||||
*w++ = (uintptr_t)new_argc;
|
||||
for (long i = 0; i < new_argc; i++) *w++ = (uintptr_t)argv[i + 2];
|
||||
*w++ = 0;
|
||||
for (long i = 0; i < nenv; i++) *w++ = (uintptr_t)envp[i];
|
||||
*w++ = 0;
|
||||
for (long i = 0; i < naux; i++) {
|
||||
unsigned long type = auxv[i * 2];
|
||||
int skip = 0;
|
||||
for (long r = 0; r < nreplaced; r++)
|
||||
if (type == replaced[r]) skip = 1;
|
||||
if (skip) continue;
|
||||
*w++ = type;
|
||||
*w++ = auxv[i * 2 + 1];
|
||||
}
|
||||
*w++ = AT_PHDR;
|
||||
*w++ = prog.phdr;
|
||||
*w++ = AT_PHENT;
|
||||
*w++ = prog.phent;
|
||||
*w++ = AT_PHNUM;
|
||||
*w++ = prog.phnum;
|
||||
*w++ = AT_BASE;
|
||||
*w++ = has_interp ? interp.base : 0;
|
||||
*w++ = AT_ENTRY;
|
||||
*w++ = prog.entry;
|
||||
*w++ = AT_EXECFN;
|
||||
*w++ = (uintptr_t)path;
|
||||
*w++ = AT_NULL;
|
||||
*w++ = 0;
|
||||
|
||||
uintptr_t entry = has_interp ? interp.entry : prog.entry;
|
||||
__asm__ volatile("mov sp, %0\n"
|
||||
"mov x0, #0\n"
|
||||
"br %1\n"
|
||||
:
|
||||
: "r"(nsp), "r"(entry)
|
||||
: "memory");
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
__attribute__((naked, noreturn)) void _start(void) {
|
||||
__asm__ volatile("mov x0, sp\n"
|
||||
"and sp, x0, #~15\n"
|
||||
"bl ddexec_main\n");
|
||||
}
|
||||
@@ -2312,7 +2312,7 @@ __attribute__((visibility("hidden"))) static int inject_uevent(const char *actio
|
||||
const char *subsystem, const char *devname,
|
||||
unsigned major, unsigned minor) {
|
||||
using inject_fn = int (*)(const char *, const char *, const char *, const char *, unsigned, unsigned);
|
||||
static auto inject = reinterpret_cast<inject_fn>(dlsym(RTLD_DEFAULT, "bl_udevmon_inject"));
|
||||
static auto inject = reinterpret_cast<inject_fn>(dlsym(RTLD_DEFAULT, "dd_udevmon_inject"));
|
||||
return inject ? inject(action, devpath, subsystem, devname, major, minor) : -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) in vec2 fragTexCoord;
|
||||
layout(location = 0) out vec4 outColor;
|
||||
layout(set = 0, binding = 0) uniform sampler2D InputTexture;
|
||||
layout(push_constant) uniform Constants {
|
||||
vec4 ndc;
|
||||
vec2 resolution;
|
||||
float extra;
|
||||
float pad;
|
||||
} pc;
|
||||
|
||||
float luma(vec3 c) {
|
||||
return dot(c, vec3(0.2126, 0.7152, 0.0722));
|
||||
}
|
||||
|
||||
float edgeVertical(vec2 uv, vec2 px) {
|
||||
float a = luma(texture(InputTexture, uv - vec2(px.x, 0.0)).rgb);
|
||||
float b = luma(texture(InputTexture, uv + vec2(px.x, 0.0)).rgb);
|
||||
return abs(a - b);
|
||||
}
|
||||
|
||||
float edgeHorizontal(vec2 uv, vec2 px) {
|
||||
float a = luma(texture(InputTexture, uv - vec2(0.0, px.y)).rgb);
|
||||
float b = luma(texture(InputTexture, uv + vec2(0.0, px.y)).rgb);
|
||||
return abs(a - b);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 px = 1.0 / max(pc.resolution, vec2(1.0));
|
||||
vec2 uv = clamp(fragTexCoord, px * 0.5, vec2(1.0) - px * 0.5);
|
||||
vec4 center = texture(InputTexture, uv);
|
||||
|
||||
float lc = luma(center.rgb);
|
||||
float ll = luma(texture(InputTexture, uv - vec2(px.x, 0.0)).rgb);
|
||||
float lr = luma(texture(InputTexture, uv + vec2(px.x, 0.0)).rgb);
|
||||
float lu = luma(texture(InputTexture, uv - vec2(0.0, px.y)).rgb);
|
||||
float ld = luma(texture(InputTexture, uv + vec2(0.0, px.y)).rgb);
|
||||
|
||||
float dL = abs(lc - ll);
|
||||
float dR = abs(lc - lr);
|
||||
float dU = abs(lc - lu);
|
||||
float dD = abs(lc - ld);
|
||||
float localMin = min(lc, min(min(ll, lr), min(lu, ld)));
|
||||
float localMax = max(lc, max(max(ll, lr), max(lu, ld)));
|
||||
float localContrast = localMax - localMin;
|
||||
float threshold = max(0.045, localContrast * 0.08);
|
||||
|
||||
float vertical = max(dL, dR);
|
||||
float horizontal = max(dU, dD);
|
||||
float strongest = max(vertical, horizontal);
|
||||
if (strongest <= threshold) {
|
||||
outColor = center;
|
||||
return;
|
||||
}
|
||||
|
||||
bool verticalEdge = vertical >= horizontal;
|
||||
vec2 tangent = verticalEdge ? vec2(0.0, px.y) : vec2(px.x, 0.0);
|
||||
vec2 normal = verticalEdge
|
||||
? vec2(dL >= dR ? -1.0 : 1.0, 0.0)
|
||||
: vec2(0.0, dU >= dD ? -1.0 : 1.0);
|
||||
|
||||
float negativeRun = 0.0;
|
||||
float positiveRun = 0.0;
|
||||
for (int i = 1; i <= 6; ++i) {
|
||||
vec2 offset = tangent * float(i);
|
||||
float edgeN = verticalEdge ? edgeVertical(uv - offset, px) : edgeHorizontal(uv - offset, px);
|
||||
float edgeP = verticalEdge ? edgeVertical(uv + offset, px) : edgeHorizontal(uv + offset, px);
|
||||
if (negativeRun == float(i - 1) && edgeN > threshold * 0.65) negativeRun = float(i);
|
||||
if (positiveRun == float(i - 1) && edgeP > threshold * 0.65) positiveRun = float(i);
|
||||
}
|
||||
|
||||
float span = negativeRun + positiveRun;
|
||||
float edgeConfidence = smoothstep(threshold, threshold * 2.5, strongest);
|
||||
|
||||
float nw = luma(texture(InputTexture, uv + vec2(-px.x, -px.y)).rgb);
|
||||
float ne = luma(texture(InputTexture, uv + vec2(px.x, -px.y)).rgb);
|
||||
float sw = luma(texture(InputTexture, uv + vec2(-px.x, px.y)).rgb);
|
||||
float se = luma(texture(InputTexture, uv + vec2(px.x, px.y)).rgb);
|
||||
float endpointPattern = clamp(abs(negativeRun - positiveRun) / max(span, 1.0), 0.0, 1.0);
|
||||
float endpointArea = endpointPattern / (1.0 + span * 0.055);
|
||||
float crossingA = verticalEdge ? abs(nw - ne) : abs(nw - sw);
|
||||
float crossingB = verticalEdge ? abs(sw - se) : abs(ne - se);
|
||||
float crossingContrast = abs(crossingA - crossingB);
|
||||
float crossingPattern = smoothstep(threshold, threshold * 2.5, crossingContrast);
|
||||
float areaWeight = 0.38 * crossingPattern * clamp(span / 4.0, 0.0, 1.0);
|
||||
float diagonalContrast = max(abs(nw - se), abs(ne - sw));
|
||||
float cornerFactor = 1.0 - 0.18 * smoothstep(threshold, threshold * 3.0, diagonalContrast);
|
||||
float baseWeight = areaWeight * endpointArea * edgeConfidence * cornerFactor;
|
||||
|
||||
float diagonalStrength = abs(abs(nw - se) - abs(ne - sw));
|
||||
float diagonalPattern = smoothstep(threshold, threshold * 2.5, diagonalStrength);
|
||||
float diagonalFallback = 0.16 * diagonalPattern * edgeConfidence * cornerFactor;
|
||||
|
||||
float weight = clamp(
|
||||
baseWeight <= 0.0001 ? diagonalFallback : baseWeight,
|
||||
0.0, 0.42
|
||||
);
|
||||
vec3 across = texture(InputTexture, uv + normal * px).rgb;
|
||||
outColor = vec4(mix(center.rgb, across, weight), center.a);
|
||||
}
|
||||
@@ -0,0 +1,443 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
static const uint32_t smaa_code[] = {
|
||||
0x07230203u, 0x00010000u, 0x0008000bu, 0x00000254u, 0x00000000u, 0x00020011u, 0x00000001u, 0x0006000bu,
|
||||
0x00000001u, 0x4c534c47u, 0x6474732eu, 0x3035342eu, 0x00000000u, 0x0003000eu, 0x00000000u, 0x00000001u,
|
||||
0x0007000fu, 0x00000004u, 0x00000004u, 0x6e69616du, 0x00000000u, 0x00000072u, 0x000000f6u, 0x00030010u,
|
||||
0x00000004u, 0x00000007u, 0x00030003u, 0x00000002u, 0x000001c2u, 0x00040005u, 0x00000004u, 0x6e69616du,
|
||||
0x00000000u, 0x00050005u, 0x0000000bu, 0x616d756cu, 0x33667628u, 0x0000003bu, 0x00030005u, 0x0000000au,
|
||||
0x00000063u, 0x00080005u, 0x00000012u, 0x65676465u, 0x74726556u, 0x6c616369u, 0x32667628u, 0x3266763bu,
|
||||
0x0000003bu, 0x00030005u, 0x00000010u, 0x00007675u, 0x00030005u, 0x00000011u, 0x00007870u, 0x00080005u,
|
||||
0x00000016u, 0x65676465u, 0x69726f48u, 0x746e6f7au, 0x76286c61u, 0x763b3266u, 0x003b3266u, 0x00030005u,
|
||||
0x00000014u, 0x00007675u, 0x00030005u, 0x00000015u, 0x00007870u, 0x00030005u, 0x00000021u, 0x00000061u,
|
||||
0x00060005u, 0x00000025u, 0x75706e49u, 0x78655474u, 0x65727574u, 0x00000000u, 0x00040005u, 0x00000031u,
|
||||
0x61726170u, 0x0000006du, 0x00030005u, 0x00000034u, 0x00000062u, 0x00040005u, 0x0000003cu, 0x61726170u,
|
||||
0x0000006du, 0x00030005u, 0x00000045u, 0x00000061u, 0x00040005u, 0x0000004eu, 0x61726170u, 0x0000006du,
|
||||
0x00030005u, 0x00000051u, 0x00000062u, 0x00040005u, 0x00000059u, 0x61726170u, 0x0000006du, 0x00030005u,
|
||||
0x00000062u, 0x00007870u, 0x00050005u, 0x00000064u, 0x736e6f43u, 0x746e6174u, 0x00000073u, 0x00040006u,
|
||||
0x00000064u, 0x00000000u, 0x0063646eu, 0x00060006u, 0x00000064u, 0x00000001u, 0x6f736572u, 0x6974756cu,
|
||||
0x00006e6fu, 0x00050006u, 0x00000064u, 0x00000002u, 0x72747865u, 0x00000061u, 0x00040006u, 0x00000064u,
|
||||
0x00000003u, 0x00646170u, 0x00030005u, 0x00000066u, 0x00006370u, 0x00030005u, 0x00000070u, 0x00007675u,
|
||||
0x00060005u, 0x00000072u, 0x67617266u, 0x43786554u, 0x64726f6fu, 0x00000000u, 0x00040005u, 0x0000007cu,
|
||||
0x746e6563u, 0x00007265u, 0x00030005u, 0x00000080u, 0x0000636cu, 0x00040005u, 0x00000081u, 0x61726170u,
|
||||
0x0000006du, 0x00030005u, 0x00000085u, 0x00006c6cu, 0x00040005u, 0x0000008du, 0x61726170u, 0x0000006du,
|
||||
0x00030005u, 0x00000090u, 0x0000726cu, 0x00040005u, 0x00000098u, 0x61726170u, 0x0000006du, 0x00030005u,
|
||||
0x0000009bu, 0x0000756cu, 0x00040005u, 0x000000a3u, 0x61726170u, 0x0000006du, 0x00030005u, 0x000000a6u,
|
||||
0x0000646cu, 0x00040005u, 0x000000aeu, 0x61726170u, 0x0000006du, 0x00030005u, 0x000000b1u, 0x00004c64u,
|
||||
0x00030005u, 0x000000b6u, 0x00005264u, 0x00030005u, 0x000000bbu, 0x00005564u, 0x00030005u, 0x000000c0u,
|
||||
0x00004464u, 0x00050005u, 0x000000c5u, 0x61636f6cu, 0x6e694d6cu, 0x00000000u, 0x00050005u, 0x000000cfu,
|
||||
0x61636f6cu, 0x78614d6cu, 0x00000000u, 0x00060005u, 0x000000d9u, 0x61636f6cu, 0x6e6f436cu, 0x73617274u,
|
||||
0x00000074u, 0x00050005u, 0x000000ddu, 0x65726874u, 0x6c6f6873u, 0x00000064u, 0x00050005u, 0x000000e3u,
|
||||
0x74726576u, 0x6c616369u, 0x00000000u, 0x00050005u, 0x000000e7u, 0x69726f68u, 0x746e6f7au, 0x00006c61u,
|
||||
0x00050005u, 0x000000ebu, 0x6f727473u, 0x7365676eu, 0x00000074u, 0x00050005u, 0x000000f6u, 0x4374756fu,
|
||||
0x726f6c6fu, 0x00000000u, 0x00060005u, 0x000000fau, 0x74726576u, 0x6c616369u, 0x65676445u, 0x00000000u,
|
||||
0x00040005u, 0x000000feu, 0x676e6174u, 0x00746e65u, 0x00040005u, 0x0000010bu, 0x6d726f6eu, 0x00006c61u,
|
||||
0x00050005u, 0x0000011du, 0x6167656eu, 0x65766974u, 0x006e7552u, 0x00050005u, 0x0000011eu, 0x69736f70u,
|
||||
0x65766974u, 0x006e7552u, 0x00030005u, 0x00000120u, 0x00000069u, 0x00040005u, 0x00000129u, 0x7366666fu,
|
||||
0x00007465u, 0x00040005u, 0x0000012eu, 0x65676465u, 0x0000004eu, 0x00040005u, 0x00000136u, 0x61726170u,
|
||||
0x0000006du, 0x00040005u, 0x00000137u, 0x61726170u, 0x0000006du, 0x00040005u, 0x0000013eu, 0x61726170u,
|
||||
0x0000006du, 0x00040005u, 0x0000013fu, 0x61726170u, 0x0000006du, 0x00040005u, 0x00000143u, 0x65676465u,
|
||||
0x00000050u, 0x00040005u, 0x0000014bu, 0x61726170u, 0x0000006du, 0x00040005u, 0x0000014cu, 0x61726170u,
|
||||
0x0000006du, 0x00040005u, 0x00000153u, 0x61726170u, 0x0000006du, 0x00040005u, 0x00000154u, 0x61726170u,
|
||||
0x0000006du, 0x00040005u, 0x0000017bu, 0x6e617073u, 0x00000000u, 0x00060005u, 0x0000017fu, 0x65676465u,
|
||||
0x666e6f43u, 0x6e656469u, 0x00006563u, 0x00030005u, 0x00000186u, 0x0000776eu, 0x00040005u, 0x00000192u,
|
||||
0x61726170u, 0x0000006du, 0x00030005u, 0x00000195u, 0x0000656eu, 0x00040005u, 0x000001a0u, 0x61726170u,
|
||||
0x0000006du, 0x00030005u, 0x000001a3u, 0x00007773u, 0x00040005u, 0x000001aeu, 0x61726170u, 0x0000006du,
|
||||
0x00030005u, 0x000001b1u, 0x00006573u, 0x00040005u, 0x000001bbu, 0x61726170u, 0x0000006du, 0x00060005u,
|
||||
0x000001beu, 0x70646e65u, 0x746e696fu, 0x74746150u, 0x006e7265u, 0x00060005u, 0x000001c7u, 0x70646e65u,
|
||||
0x746e696fu, 0x61657241u, 0x00000000u, 0x00050005u, 0x000001ceu, 0x736f7263u, 0x676e6973u, 0x00000041u,
|
||||
0x00050005u, 0x000001ddu, 0x736f7263u, 0x676e6973u, 0x00000042u, 0x00070005u, 0x000001ecu, 0x736f7263u,
|
||||
0x676e6973u, 0x746e6f43u, 0x74736172u, 0x00000000u, 0x00060005u, 0x000001f1u, 0x736f7263u, 0x676e6973u,
|
||||
0x74746150u, 0x006e7265u, 0x00050005u, 0x000001f7u, 0x61657261u, 0x67696557u, 0x00007468u, 0x00070005u,
|
||||
0x00000200u, 0x67616964u, 0x6c616e6fu, 0x746e6f43u, 0x74736172u, 0x00000000u, 0x00060005u, 0x0000020au,
|
||||
0x6e726f63u, 0x61467265u, 0x726f7463u, 0x00000000u, 0x00050005u, 0x00000214u, 0x65736162u, 0x67696557u,
|
||||
0x00007468u, 0x00070005u, 0x0000021cu, 0x67616964u, 0x6c616e6fu, 0x65727453u, 0x6874676eu, 0x00000000u,
|
||||
0x00060005u, 0x00000227u, 0x67616964u, 0x6c616e6fu, 0x74746150u, 0x006e7265u, 0x00070005u, 0x0000022du,
|
||||
0x67616964u, 0x6c616e6fu, 0x6c6c6146u, 0x6b636162u, 0x00000000u, 0x00040005u, 0x00000235u, 0x67696577u,
|
||||
0x00007468u, 0x00040005u, 0x0000023eu, 0x6f726361u, 0x00007373u, 0x00040047u, 0x00000025u, 0x00000021u,
|
||||
0x00000000u, 0x00040047u, 0x00000025u, 0x00000022u, 0x00000000u, 0x00030047u, 0x00000064u, 0x00000002u,
|
||||
0x00050048u, 0x00000064u, 0x00000000u, 0x00000023u, 0x00000000u, 0x00050048u, 0x00000064u, 0x00000001u,
|
||||
0x00000023u, 0x00000010u, 0x00050048u, 0x00000064u, 0x00000002u, 0x00000023u, 0x00000018u, 0x00050048u,
|
||||
0x00000064u, 0x00000003u, 0x00000023u, 0x0000001cu, 0x00040047u, 0x00000072u, 0x0000001eu, 0x00000000u,
|
||||
0x00040047u, 0x000000f6u, 0x0000001eu, 0x00000000u, 0x00020013u, 0x00000002u, 0x00030021u, 0x00000003u,
|
||||
0x00000002u, 0x00030016u, 0x00000006u, 0x00000020u, 0x00040017u, 0x00000007u, 0x00000006u, 0x00000003u,
|
||||
0x00040020u, 0x00000008u, 0x00000007u, 0x00000007u, 0x00040021u, 0x00000009u, 0x00000006u, 0x00000008u,
|
||||
0x00040017u, 0x0000000du, 0x00000006u, 0x00000002u, 0x00040020u, 0x0000000eu, 0x00000007u, 0x0000000du,
|
||||
0x00050021u, 0x0000000fu, 0x00000006u, 0x0000000eu, 0x0000000eu, 0x0004002bu, 0x00000006u, 0x00000019u,
|
||||
0x3e59b3d0u, 0x0004002bu, 0x00000006u, 0x0000001au, 0x3f371759u, 0x0004002bu, 0x00000006u, 0x0000001bu,
|
||||
0x3d93dd98u, 0x0006002cu, 0x00000007u, 0x0000001cu, 0x00000019u, 0x0000001au, 0x0000001bu, 0x00040020u,
|
||||
0x00000020u, 0x00000007u, 0x00000006u, 0x00090019u, 0x00000022u, 0x00000006u, 0x00000001u, 0x00000000u,
|
||||
0x00000000u, 0x00000000u, 0x00000001u, 0x00000000u, 0x0003001bu, 0x00000023u, 0x00000022u, 0x00040020u,
|
||||
0x00000024u, 0x00000000u, 0x00000023u, 0x0004003bu, 0x00000024u, 0x00000025u, 0x00000000u, 0x00040015u,
|
||||
0x00000028u, 0x00000020u, 0x00000000u, 0x0004002bu, 0x00000028u, 0x00000029u, 0x00000000u, 0x0004002bu,
|
||||
0x00000006u, 0x0000002cu, 0x00000000u, 0x00040017u, 0x0000002fu, 0x00000006u, 0x00000004u, 0x0004002bu,
|
||||
0x00000028u, 0x00000048u, 0x00000001u, 0x0004002bu, 0x00000006u, 0x00000063u, 0x3f800000u, 0x0006001eu,
|
||||
0x00000064u, 0x0000002fu, 0x0000000du, 0x00000006u, 0x00000006u, 0x00040020u, 0x00000065u, 0x00000009u,
|
||||
0x00000064u, 0x0004003bu, 0x00000065u, 0x00000066u, 0x00000009u, 0x00040015u, 0x00000067u, 0x00000020u,
|
||||
0x00000001u, 0x0004002bu, 0x00000067u, 0x00000068u, 0x00000001u, 0x00040020u, 0x00000069u, 0x00000009u,
|
||||
0x0000000du, 0x0005002cu, 0x0000000du, 0x0000006cu, 0x00000063u, 0x00000063u, 0x00040020u, 0x00000071u,
|
||||
0x00000001u, 0x0000000du, 0x0004003bu, 0x00000071u, 0x00000072u, 0x00000001u, 0x0004002bu, 0x00000006u,
|
||||
0x00000075u, 0x3f000000u, 0x00040020u, 0x0000007bu, 0x00000007u, 0x0000002fu, 0x0004002bu, 0x00000006u,
|
||||
0x000000deu, 0x3d3851ecu, 0x0004002bu, 0x00000006u, 0x000000e0u, 0x3da3d70au, 0x00020014u, 0x000000f1u,
|
||||
0x00040020u, 0x000000f5u, 0x00000003u, 0x0000002fu, 0x0004003bu, 0x000000f5u, 0x000000f6u, 0x00000003u,
|
||||
0x00040020u, 0x000000f9u, 0x00000007u, 0x000000f1u, 0x0004002bu, 0x00000006u, 0x00000113u, 0xbf800000u,
|
||||
0x00040020u, 0x0000011fu, 0x00000007u, 0x00000067u, 0x0004002bu, 0x00000067u, 0x00000127u, 0x00000006u,
|
||||
0x0004002bu, 0x00000006u, 0x00000161u, 0x3f266666u, 0x0004002bu, 0x00000006u, 0x00000182u, 0x40200000u,
|
||||
0x0004002bu, 0x00000006u, 0x000001cau, 0x3d6147aeu, 0x0004002bu, 0x00000006u, 0x000001f8u, 0x3ec28f5cu,
|
||||
0x0004002bu, 0x00000006u, 0x000001fcu, 0x40800000u, 0x0004002bu, 0x00000006u, 0x0000020bu, 0x3e3851ecu,
|
||||
0x0004002bu, 0x00000006u, 0x0000020eu, 0x40400000u, 0x0004002bu, 0x00000006u, 0x0000022eu, 0x3e23d70au,
|
||||
0x0004002bu, 0x00000006u, 0x00000237u, 0x38d1b717u, 0x0004002bu, 0x00000006u, 0x0000023cu, 0x3ed70a3du,
|
||||
0x0004002bu, 0x00000028u, 0x0000024du, 0x00000003u, 0x00050036u, 0x00000002u, 0x00000004u, 0x00000000u,
|
||||
0x00000003u, 0x000200f8u, 0x00000005u, 0x0004003bu, 0x0000000eu, 0x00000062u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x00000070u, 0x00000007u, 0x0004003bu, 0x0000007bu, 0x0000007cu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000080u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000081u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000085u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000008du, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000090u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000098u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000009bu, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000000a3u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000a6u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000000aeu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000b1u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000b6u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000bbu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000c0u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000c5u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000cfu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000d9u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000ddu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000e3u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000000e7u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000000ebu, 0x00000007u, 0x0004003bu, 0x000000f9u, 0x000000fau, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x000000feu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000100u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x0000010bu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000010du, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000011du, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000011eu, 0x00000007u, 0x0004003bu,
|
||||
0x0000011fu, 0x00000120u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000129u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000012eu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000130u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x00000136u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000137u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x0000013eu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000013fu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000143u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000145u, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x0000014bu, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x0000014cu, 0x00000007u, 0x0004003bu,
|
||||
0x0000000eu, 0x00000153u, 0x00000007u, 0x0004003bu, 0x0000000eu, 0x00000154u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000017bu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x0000017fu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000186u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000192u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000195u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001a0u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001a3u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001aeu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001b1u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x000001bbu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001beu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001c7u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001ceu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001d0u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001ddu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001dfu, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001ecu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x000001f1u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x000001f7u, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000200u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000020au, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000214u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000021cu, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000227u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x0000022du, 0x00000007u, 0x0004003bu, 0x00000020u, 0x00000235u, 0x00000007u, 0x0004003bu,
|
||||
0x00000008u, 0x0000023eu, 0x00000007u, 0x00050041u, 0x00000069u, 0x0000006au, 0x00000066u, 0x00000068u,
|
||||
0x0004003du, 0x0000000du, 0x0000006bu, 0x0000006au, 0x0007000cu, 0x0000000du, 0x0000006du, 0x00000001u,
|
||||
0x00000028u, 0x0000006bu, 0x0000006cu, 0x00050050u, 0x0000000du, 0x0000006eu, 0x00000063u, 0x00000063u,
|
||||
0x00050088u, 0x0000000du, 0x0000006fu, 0x0000006eu, 0x0000006du, 0x0003003eu, 0x00000062u, 0x0000006fu,
|
||||
0x0004003du, 0x0000000du, 0x00000073u, 0x00000072u, 0x0004003du, 0x0000000du, 0x00000074u, 0x00000062u,
|
||||
0x0005008eu, 0x0000000du, 0x00000076u, 0x00000074u, 0x00000075u, 0x0004003du, 0x0000000du, 0x00000077u,
|
||||
0x00000062u, 0x0005008eu, 0x0000000du, 0x00000078u, 0x00000077u, 0x00000075u, 0x00050083u, 0x0000000du,
|
||||
0x00000079u, 0x0000006cu, 0x00000078u, 0x0008000cu, 0x0000000du, 0x0000007au, 0x00000001u, 0x0000002bu,
|
||||
0x00000073u, 0x00000076u, 0x00000079u, 0x0003003eu, 0x00000070u, 0x0000007au, 0x0004003du, 0x00000023u,
|
||||
0x0000007du, 0x00000025u, 0x0004003du, 0x0000000du, 0x0000007eu, 0x00000070u, 0x00050057u, 0x0000002fu,
|
||||
0x0000007fu, 0x0000007du, 0x0000007eu, 0x0003003eu, 0x0000007cu, 0x0000007fu, 0x0004003du, 0x0000002fu,
|
||||
0x00000082u, 0x0000007cu, 0x0008004fu, 0x00000007u, 0x00000083u, 0x00000082u, 0x00000082u, 0x00000000u,
|
||||
0x00000001u, 0x00000002u, 0x0003003eu, 0x00000081u, 0x00000083u, 0x00050039u, 0x00000006u, 0x00000084u,
|
||||
0x0000000bu, 0x00000081u, 0x0003003eu, 0x00000080u, 0x00000084u, 0x0004003du, 0x00000023u, 0x00000086u,
|
||||
0x00000025u, 0x0004003du, 0x0000000du, 0x00000087u, 0x00000070u, 0x00050041u, 0x00000020u, 0x00000088u,
|
||||
0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x00000089u, 0x00000088u, 0x00050050u, 0x0000000du,
|
||||
0x0000008au, 0x00000089u, 0x0000002cu, 0x00050083u, 0x0000000du, 0x0000008bu, 0x00000087u, 0x0000008au,
|
||||
0x00050057u, 0x0000002fu, 0x0000008cu, 0x00000086u, 0x0000008bu, 0x0008004fu, 0x00000007u, 0x0000008eu,
|
||||
0x0000008cu, 0x0000008cu, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000008du, 0x0000008eu,
|
||||
0x00050039u, 0x00000006u, 0x0000008fu, 0x0000000bu, 0x0000008du, 0x0003003eu, 0x00000085u, 0x0000008fu,
|
||||
0x0004003du, 0x00000023u, 0x00000091u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000092u, 0x00000070u,
|
||||
0x00050041u, 0x00000020u, 0x00000093u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x00000094u,
|
||||
0x00000093u, 0x00050050u, 0x0000000du, 0x00000095u, 0x00000094u, 0x0000002cu, 0x00050081u, 0x0000000du,
|
||||
0x00000096u, 0x00000092u, 0x00000095u, 0x00050057u, 0x0000002fu, 0x00000097u, 0x00000091u, 0x00000096u,
|
||||
0x0008004fu, 0x00000007u, 0x00000099u, 0x00000097u, 0x00000097u, 0x00000000u, 0x00000001u, 0x00000002u,
|
||||
0x0003003eu, 0x00000098u, 0x00000099u, 0x00050039u, 0x00000006u, 0x0000009au, 0x0000000bu, 0x00000098u,
|
||||
0x0003003eu, 0x00000090u, 0x0000009au, 0x0004003du, 0x00000023u, 0x0000009cu, 0x00000025u, 0x0004003du,
|
||||
0x0000000du, 0x0000009du, 0x00000070u, 0x00050041u, 0x00000020u, 0x0000009eu, 0x00000062u, 0x00000048u,
|
||||
0x0004003du, 0x00000006u, 0x0000009fu, 0x0000009eu, 0x00050050u, 0x0000000du, 0x000000a0u, 0x0000002cu,
|
||||
0x0000009fu, 0x00050083u, 0x0000000du, 0x000000a1u, 0x0000009du, 0x000000a0u, 0x00050057u, 0x0000002fu,
|
||||
0x000000a2u, 0x0000009cu, 0x000000a1u, 0x0008004fu, 0x00000007u, 0x000000a4u, 0x000000a2u, 0x000000a2u,
|
||||
0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000000a3u, 0x000000a4u, 0x00050039u, 0x00000006u,
|
||||
0x000000a5u, 0x0000000bu, 0x000000a3u, 0x0003003eu, 0x0000009bu, 0x000000a5u, 0x0004003du, 0x00000023u,
|
||||
0x000000a7u, 0x00000025u, 0x0004003du, 0x0000000du, 0x000000a8u, 0x00000070u, 0x00050041u, 0x00000020u,
|
||||
0x000000a9u, 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x000000aau, 0x000000a9u, 0x00050050u,
|
||||
0x0000000du, 0x000000abu, 0x0000002cu, 0x000000aau, 0x00050081u, 0x0000000du, 0x000000acu, 0x000000a8u,
|
||||
0x000000abu, 0x00050057u, 0x0000002fu, 0x000000adu, 0x000000a7u, 0x000000acu, 0x0008004fu, 0x00000007u,
|
||||
0x000000afu, 0x000000adu, 0x000000adu, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000000aeu,
|
||||
0x000000afu, 0x00050039u, 0x00000006u, 0x000000b0u, 0x0000000bu, 0x000000aeu, 0x0003003eu, 0x000000a6u,
|
||||
0x000000b0u, 0x0004003du, 0x00000006u, 0x000000b2u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000b3u,
|
||||
0x00000085u, 0x00050083u, 0x00000006u, 0x000000b4u, 0x000000b2u, 0x000000b3u, 0x0006000cu, 0x00000006u,
|
||||
0x000000b5u, 0x00000001u, 0x00000004u, 0x000000b4u, 0x0003003eu, 0x000000b1u, 0x000000b5u, 0x0004003du,
|
||||
0x00000006u, 0x000000b7u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000b8u, 0x00000090u, 0x00050083u,
|
||||
0x00000006u, 0x000000b9u, 0x000000b7u, 0x000000b8u, 0x0006000cu, 0x00000006u, 0x000000bau, 0x00000001u,
|
||||
0x00000004u, 0x000000b9u, 0x0003003eu, 0x000000b6u, 0x000000bau, 0x0004003du, 0x00000006u, 0x000000bcu,
|
||||
0x00000080u, 0x0004003du, 0x00000006u, 0x000000bdu, 0x0000009bu, 0x00050083u, 0x00000006u, 0x000000beu,
|
||||
0x000000bcu, 0x000000bdu, 0x0006000cu, 0x00000006u, 0x000000bfu, 0x00000001u, 0x00000004u, 0x000000beu,
|
||||
0x0003003eu, 0x000000bbu, 0x000000bfu, 0x0004003du, 0x00000006u, 0x000000c1u, 0x00000080u, 0x0004003du,
|
||||
0x00000006u, 0x000000c2u, 0x000000a6u, 0x00050083u, 0x00000006u, 0x000000c3u, 0x000000c1u, 0x000000c2u,
|
||||
0x0006000cu, 0x00000006u, 0x000000c4u, 0x00000001u, 0x00000004u, 0x000000c3u, 0x0003003eu, 0x000000c0u,
|
||||
0x000000c4u, 0x0004003du, 0x00000006u, 0x000000c6u, 0x00000080u, 0x0004003du, 0x00000006u, 0x000000c7u,
|
||||
0x00000085u, 0x0004003du, 0x00000006u, 0x000000c8u, 0x00000090u, 0x0007000cu, 0x00000006u, 0x000000c9u,
|
||||
0x00000001u, 0x00000025u, 0x000000c7u, 0x000000c8u, 0x0004003du, 0x00000006u, 0x000000cau, 0x0000009bu,
|
||||
0x0004003du, 0x00000006u, 0x000000cbu, 0x000000a6u, 0x0007000cu, 0x00000006u, 0x000000ccu, 0x00000001u,
|
||||
0x00000025u, 0x000000cau, 0x000000cbu, 0x0007000cu, 0x00000006u, 0x000000cdu, 0x00000001u, 0x00000025u,
|
||||
0x000000c9u, 0x000000ccu, 0x0007000cu, 0x00000006u, 0x000000ceu, 0x00000001u, 0x00000025u, 0x000000c6u,
|
||||
0x000000cdu, 0x0003003eu, 0x000000c5u, 0x000000ceu, 0x0004003du, 0x00000006u, 0x000000d0u, 0x00000080u,
|
||||
0x0004003du, 0x00000006u, 0x000000d1u, 0x00000085u, 0x0004003du, 0x00000006u, 0x000000d2u, 0x00000090u,
|
||||
0x0007000cu, 0x00000006u, 0x000000d3u, 0x00000001u, 0x00000028u, 0x000000d1u, 0x000000d2u, 0x0004003du,
|
||||
0x00000006u, 0x000000d4u, 0x0000009bu, 0x0004003du, 0x00000006u, 0x000000d5u, 0x000000a6u, 0x0007000cu,
|
||||
0x00000006u, 0x000000d6u, 0x00000001u, 0x00000028u, 0x000000d4u, 0x000000d5u, 0x0007000cu, 0x00000006u,
|
||||
0x000000d7u, 0x00000001u, 0x00000028u, 0x000000d3u, 0x000000d6u, 0x0007000cu, 0x00000006u, 0x000000d8u,
|
||||
0x00000001u, 0x00000028u, 0x000000d0u, 0x000000d7u, 0x0003003eu, 0x000000cfu, 0x000000d8u, 0x0004003du,
|
||||
0x00000006u, 0x000000dau, 0x000000cfu, 0x0004003du, 0x00000006u, 0x000000dbu, 0x000000c5u, 0x00050083u,
|
||||
0x00000006u, 0x000000dcu, 0x000000dau, 0x000000dbu, 0x0003003eu, 0x000000d9u, 0x000000dcu, 0x0004003du,
|
||||
0x00000006u, 0x000000dfu, 0x000000d9u, 0x00050085u, 0x00000006u, 0x000000e1u, 0x000000dfu, 0x000000e0u,
|
||||
0x0007000cu, 0x00000006u, 0x000000e2u, 0x00000001u, 0x00000028u, 0x000000deu, 0x000000e1u, 0x0003003eu,
|
||||
0x000000ddu, 0x000000e2u, 0x0004003du, 0x00000006u, 0x000000e4u, 0x000000b1u, 0x0004003du, 0x00000006u,
|
||||
0x000000e5u, 0x000000b6u, 0x0007000cu, 0x00000006u, 0x000000e6u, 0x00000001u, 0x00000028u, 0x000000e4u,
|
||||
0x000000e5u, 0x0003003eu, 0x000000e3u, 0x000000e6u, 0x0004003du, 0x00000006u, 0x000000e8u, 0x000000bbu,
|
||||
0x0004003du, 0x00000006u, 0x000000e9u, 0x000000c0u, 0x0007000cu, 0x00000006u, 0x000000eau, 0x00000001u,
|
||||
0x00000028u, 0x000000e8u, 0x000000e9u, 0x0003003eu, 0x000000e7u, 0x000000eau, 0x0004003du, 0x00000006u,
|
||||
0x000000ecu, 0x000000e3u, 0x0004003du, 0x00000006u, 0x000000edu, 0x000000e7u, 0x0007000cu, 0x00000006u,
|
||||
0x000000eeu, 0x00000001u, 0x00000028u, 0x000000ecu, 0x000000edu, 0x0003003eu, 0x000000ebu, 0x000000eeu,
|
||||
0x0004003du, 0x00000006u, 0x000000efu, 0x000000ebu, 0x0004003du, 0x00000006u, 0x000000f0u, 0x000000ddu,
|
||||
0x000500bcu, 0x000000f1u, 0x000000f2u, 0x000000efu, 0x000000f0u, 0x000300f7u, 0x000000f4u, 0x00000000u,
|
||||
0x000400fau, 0x000000f2u, 0x000000f3u, 0x000000f4u, 0x000200f8u, 0x000000f3u, 0x0004003du, 0x0000002fu,
|
||||
0x000000f7u, 0x0000007cu, 0x0003003eu, 0x000000f6u, 0x000000f7u, 0x000100fdu, 0x000200f8u, 0x000000f4u,
|
||||
0x0004003du, 0x00000006u, 0x000000fbu, 0x000000e3u, 0x0004003du, 0x00000006u, 0x000000fcu, 0x000000e7u,
|
||||
0x000500beu, 0x000000f1u, 0x000000fdu, 0x000000fbu, 0x000000fcu, 0x0003003eu, 0x000000fau, 0x000000fdu,
|
||||
0x0004003du, 0x000000f1u, 0x000000ffu, 0x000000fau, 0x000300f7u, 0x00000102u, 0x00000000u, 0x000400fau,
|
||||
0x000000ffu, 0x00000101u, 0x00000106u, 0x000200f8u, 0x00000101u, 0x00050041u, 0x00000020u, 0x00000103u,
|
||||
0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x00000104u, 0x00000103u, 0x00050050u, 0x0000000du,
|
||||
0x00000105u, 0x0000002cu, 0x00000104u, 0x0003003eu, 0x00000100u, 0x00000105u, 0x000200f9u, 0x00000102u,
|
||||
0x000200f8u, 0x00000106u, 0x00050041u, 0x00000020u, 0x00000107u, 0x00000062u, 0x00000029u, 0x0004003du,
|
||||
0x00000006u, 0x00000108u, 0x00000107u, 0x00050050u, 0x0000000du, 0x00000109u, 0x00000108u, 0x0000002cu,
|
||||
0x0003003eu, 0x00000100u, 0x00000109u, 0x000200f9u, 0x00000102u, 0x000200f8u, 0x00000102u, 0x0004003du,
|
||||
0x0000000du, 0x0000010au, 0x00000100u, 0x0003003eu, 0x000000feu, 0x0000010au, 0x0004003du, 0x000000f1u,
|
||||
0x0000010cu, 0x000000fau, 0x000300f7u, 0x0000010fu, 0x00000000u, 0x000400fau, 0x0000010cu, 0x0000010eu,
|
||||
0x00000116u, 0x000200f8u, 0x0000010eu, 0x0004003du, 0x00000006u, 0x00000110u, 0x000000b1u, 0x0004003du,
|
||||
0x00000006u, 0x00000111u, 0x000000b6u, 0x000500beu, 0x000000f1u, 0x00000112u, 0x00000110u, 0x00000111u,
|
||||
0x000600a9u, 0x00000006u, 0x00000114u, 0x00000112u, 0x00000113u, 0x00000063u, 0x00050050u, 0x0000000du,
|
||||
0x00000115u, 0x00000114u, 0x0000002cu, 0x0003003eu, 0x0000010du, 0x00000115u, 0x000200f9u, 0x0000010fu,
|
||||
0x000200f8u, 0x00000116u, 0x0004003du, 0x00000006u, 0x00000117u, 0x000000bbu, 0x0004003du, 0x00000006u,
|
||||
0x00000118u, 0x000000c0u, 0x000500beu, 0x000000f1u, 0x00000119u, 0x00000117u, 0x00000118u, 0x000600a9u,
|
||||
0x00000006u, 0x0000011au, 0x00000119u, 0x00000113u, 0x00000063u, 0x00050050u, 0x0000000du, 0x0000011bu,
|
||||
0x0000002cu, 0x0000011au, 0x0003003eu, 0x0000010du, 0x0000011bu, 0x000200f9u, 0x0000010fu, 0x000200f8u,
|
||||
0x0000010fu, 0x0004003du, 0x0000000du, 0x0000011cu, 0x0000010du, 0x0003003eu, 0x0000010bu, 0x0000011cu,
|
||||
0x0003003eu, 0x0000011du, 0x0000002cu, 0x0003003eu, 0x0000011eu, 0x0000002cu, 0x0003003eu, 0x00000120u,
|
||||
0x00000068u, 0x000200f9u, 0x00000121u, 0x000200f8u, 0x00000121u, 0x000400f6u, 0x00000123u, 0x00000124u,
|
||||
0x00000000u, 0x000200f9u, 0x00000125u, 0x000200f8u, 0x00000125u, 0x0004003du, 0x00000067u, 0x00000126u,
|
||||
0x00000120u, 0x000500b3u, 0x000000f1u, 0x00000128u, 0x00000126u, 0x00000127u, 0x000400fau, 0x00000128u,
|
||||
0x00000122u, 0x00000123u, 0x000200f8u, 0x00000122u, 0x0004003du, 0x0000000du, 0x0000012au, 0x000000feu,
|
||||
0x0004003du, 0x00000067u, 0x0000012bu, 0x00000120u, 0x0004006fu, 0x00000006u, 0x0000012cu, 0x0000012bu,
|
||||
0x0005008eu, 0x0000000du, 0x0000012du, 0x0000012au, 0x0000012cu, 0x0003003eu, 0x00000129u, 0x0000012du,
|
||||
0x0004003du, 0x000000f1u, 0x0000012fu, 0x000000fau, 0x000300f7u, 0x00000132u, 0x00000000u, 0x000400fau,
|
||||
0x0000012fu, 0x00000131u, 0x0000013au, 0x000200f8u, 0x00000131u, 0x0004003du, 0x0000000du, 0x00000133u,
|
||||
0x00000070u, 0x0004003du, 0x0000000du, 0x00000134u, 0x00000129u, 0x00050083u, 0x0000000du, 0x00000135u,
|
||||
0x00000133u, 0x00000134u, 0x0003003eu, 0x00000136u, 0x00000135u, 0x0004003du, 0x0000000du, 0x00000138u,
|
||||
0x00000062u, 0x0003003eu, 0x00000137u, 0x00000138u, 0x00060039u, 0x00000006u, 0x00000139u, 0x00000012u,
|
||||
0x00000136u, 0x00000137u, 0x0003003eu, 0x00000130u, 0x00000139u, 0x000200f9u, 0x00000132u, 0x000200f8u,
|
||||
0x0000013au, 0x0004003du, 0x0000000du, 0x0000013bu, 0x00000070u, 0x0004003du, 0x0000000du, 0x0000013cu,
|
||||
0x00000129u, 0x00050083u, 0x0000000du, 0x0000013du, 0x0000013bu, 0x0000013cu, 0x0003003eu, 0x0000013eu,
|
||||
0x0000013du, 0x0004003du, 0x0000000du, 0x00000140u, 0x00000062u, 0x0003003eu, 0x0000013fu, 0x00000140u,
|
||||
0x00060039u, 0x00000006u, 0x00000141u, 0x00000016u, 0x0000013eu, 0x0000013fu, 0x0003003eu, 0x00000130u,
|
||||
0x00000141u, 0x000200f9u, 0x00000132u, 0x000200f8u, 0x00000132u, 0x0004003du, 0x00000006u, 0x00000142u,
|
||||
0x00000130u, 0x0003003eu, 0x0000012eu, 0x00000142u, 0x0004003du, 0x000000f1u, 0x00000144u, 0x000000fau,
|
||||
0x000300f7u, 0x00000147u, 0x00000000u, 0x000400fau, 0x00000144u, 0x00000146u, 0x0000014fu, 0x000200f8u,
|
||||
0x00000146u, 0x0004003du, 0x0000000du, 0x00000148u, 0x00000070u, 0x0004003du, 0x0000000du, 0x00000149u,
|
||||
0x00000129u, 0x00050081u, 0x0000000du, 0x0000014au, 0x00000148u, 0x00000149u, 0x0003003eu, 0x0000014bu,
|
||||
0x0000014au, 0x0004003du, 0x0000000du, 0x0000014du, 0x00000062u, 0x0003003eu, 0x0000014cu, 0x0000014du,
|
||||
0x00060039u, 0x00000006u, 0x0000014eu, 0x00000012u, 0x0000014bu, 0x0000014cu, 0x0003003eu, 0x00000145u,
|
||||
0x0000014eu, 0x000200f9u, 0x00000147u, 0x000200f8u, 0x0000014fu, 0x0004003du, 0x0000000du, 0x00000150u,
|
||||
0x00000070u, 0x0004003du, 0x0000000du, 0x00000151u, 0x00000129u, 0x00050081u, 0x0000000du, 0x00000152u,
|
||||
0x00000150u, 0x00000151u, 0x0003003eu, 0x00000153u, 0x00000152u, 0x0004003du, 0x0000000du, 0x00000155u,
|
||||
0x00000062u, 0x0003003eu, 0x00000154u, 0x00000155u, 0x00060039u, 0x00000006u, 0x00000156u, 0x00000016u,
|
||||
0x00000153u, 0x00000154u, 0x0003003eu, 0x00000145u, 0x00000156u, 0x000200f9u, 0x00000147u, 0x000200f8u,
|
||||
0x00000147u, 0x0004003du, 0x00000006u, 0x00000157u, 0x00000145u, 0x0003003eu, 0x00000143u, 0x00000157u,
|
||||
0x0004003du, 0x00000006u, 0x00000158u, 0x0000011du, 0x0004003du, 0x00000067u, 0x00000159u, 0x00000120u,
|
||||
0x00050082u, 0x00000067u, 0x0000015au, 0x00000159u, 0x00000068u, 0x0004006fu, 0x00000006u, 0x0000015bu,
|
||||
0x0000015au, 0x000500b4u, 0x000000f1u, 0x0000015cu, 0x00000158u, 0x0000015bu, 0x000300f7u, 0x0000015eu,
|
||||
0x00000000u, 0x000400fau, 0x0000015cu, 0x0000015du, 0x0000015eu, 0x000200f8u, 0x0000015du, 0x0004003du,
|
||||
0x00000006u, 0x0000015fu, 0x0000012eu, 0x0004003du, 0x00000006u, 0x00000160u, 0x000000ddu, 0x00050085u,
|
||||
0x00000006u, 0x00000162u, 0x00000160u, 0x00000161u, 0x000500bau, 0x000000f1u, 0x00000163u, 0x0000015fu,
|
||||
0x00000162u, 0x000200f9u, 0x0000015eu, 0x000200f8u, 0x0000015eu, 0x000700f5u, 0x000000f1u, 0x00000164u,
|
||||
0x0000015cu, 0x00000147u, 0x00000163u, 0x0000015du, 0x000300f7u, 0x00000166u, 0x00000000u, 0x000400fau,
|
||||
0x00000164u, 0x00000165u, 0x00000166u, 0x000200f8u, 0x00000165u, 0x0004003du, 0x00000067u, 0x00000167u,
|
||||
0x00000120u, 0x0004006fu, 0x00000006u, 0x00000168u, 0x00000167u, 0x0003003eu, 0x0000011du, 0x00000168u,
|
||||
0x000200f9u, 0x00000166u, 0x000200f8u, 0x00000166u, 0x0004003du, 0x00000006u, 0x00000169u, 0x0000011eu,
|
||||
0x0004003du, 0x00000067u, 0x0000016au, 0x00000120u, 0x00050082u, 0x00000067u, 0x0000016bu, 0x0000016au,
|
||||
0x00000068u, 0x0004006fu, 0x00000006u, 0x0000016cu, 0x0000016bu, 0x000500b4u, 0x000000f1u, 0x0000016du,
|
||||
0x00000169u, 0x0000016cu, 0x000300f7u, 0x0000016fu, 0x00000000u, 0x000400fau, 0x0000016du, 0x0000016eu,
|
||||
0x0000016fu, 0x000200f8u, 0x0000016eu, 0x0004003du, 0x00000006u, 0x00000170u, 0x00000143u, 0x0004003du,
|
||||
0x00000006u, 0x00000171u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000172u, 0x00000171u, 0x00000161u,
|
||||
0x000500bau, 0x000000f1u, 0x00000173u, 0x00000170u, 0x00000172u, 0x000200f9u, 0x0000016fu, 0x000200f8u,
|
||||
0x0000016fu, 0x000700f5u, 0x000000f1u, 0x00000174u, 0x0000016du, 0x00000166u, 0x00000173u, 0x0000016eu,
|
||||
0x000300f7u, 0x00000176u, 0x00000000u, 0x000400fau, 0x00000174u, 0x00000175u, 0x00000176u, 0x000200f8u,
|
||||
0x00000175u, 0x0004003du, 0x00000067u, 0x00000177u, 0x00000120u, 0x0004006fu, 0x00000006u, 0x00000178u,
|
||||
0x00000177u, 0x0003003eu, 0x0000011eu, 0x00000178u, 0x000200f9u, 0x00000176u, 0x000200f8u, 0x00000176u,
|
||||
0x000200f9u, 0x00000124u, 0x000200f8u, 0x00000124u, 0x0004003du, 0x00000067u, 0x00000179u, 0x00000120u,
|
||||
0x00050080u, 0x00000067u, 0x0000017au, 0x00000179u, 0x00000068u, 0x0003003eu, 0x00000120u, 0x0000017au,
|
||||
0x000200f9u, 0x00000121u, 0x000200f8u, 0x00000123u, 0x0004003du, 0x00000006u, 0x0000017cu, 0x0000011du,
|
||||
0x0004003du, 0x00000006u, 0x0000017du, 0x0000011eu, 0x00050081u, 0x00000006u, 0x0000017eu, 0x0000017cu,
|
||||
0x0000017du, 0x0003003eu, 0x0000017bu, 0x0000017eu, 0x0004003du, 0x00000006u, 0x00000180u, 0x000000ddu,
|
||||
0x0004003du, 0x00000006u, 0x00000181u, 0x000000ddu, 0x00050085u, 0x00000006u, 0x00000183u, 0x00000181u,
|
||||
0x00000182u, 0x0004003du, 0x00000006u, 0x00000184u, 0x000000ebu, 0x0008000cu, 0x00000006u, 0x00000185u,
|
||||
0x00000001u, 0x00000031u, 0x00000180u, 0x00000183u, 0x00000184u, 0x0003003eu, 0x0000017fu, 0x00000185u,
|
||||
0x0004003du, 0x00000023u, 0x00000187u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000188u, 0x00000070u,
|
||||
0x00050041u, 0x00000020u, 0x00000189u, 0x00000062u, 0x00000029u, 0x0004003du, 0x00000006u, 0x0000018au,
|
||||
0x00000189u, 0x0004007fu, 0x00000006u, 0x0000018bu, 0x0000018au, 0x00050041u, 0x00000020u, 0x0000018cu,
|
||||
0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000018du, 0x0000018cu, 0x0004007fu, 0x00000006u,
|
||||
0x0000018eu, 0x0000018du, 0x00050050u, 0x0000000du, 0x0000018fu, 0x0000018bu, 0x0000018eu, 0x00050081u,
|
||||
0x0000000du, 0x00000190u, 0x00000188u, 0x0000018fu, 0x00050057u, 0x0000002fu, 0x00000191u, 0x00000187u,
|
||||
0x00000190u, 0x0008004fu, 0x00000007u, 0x00000193u, 0x00000191u, 0x00000191u, 0x00000000u, 0x00000001u,
|
||||
0x00000002u, 0x0003003eu, 0x00000192u, 0x00000193u, 0x00050039u, 0x00000006u, 0x00000194u, 0x0000000bu,
|
||||
0x00000192u, 0x0003003eu, 0x00000186u, 0x00000194u, 0x0004003du, 0x00000023u, 0x00000196u, 0x00000025u,
|
||||
0x0004003du, 0x0000000du, 0x00000197u, 0x00000070u, 0x00050041u, 0x00000020u, 0x00000198u, 0x00000062u,
|
||||
0x00000029u, 0x0004003du, 0x00000006u, 0x00000199u, 0x00000198u, 0x00050041u, 0x00000020u, 0x0000019au,
|
||||
0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000019bu, 0x0000019au, 0x0004007fu, 0x00000006u,
|
||||
0x0000019cu, 0x0000019bu, 0x00050050u, 0x0000000du, 0x0000019du, 0x00000199u, 0x0000019cu, 0x00050081u,
|
||||
0x0000000du, 0x0000019eu, 0x00000197u, 0x0000019du, 0x00050057u, 0x0000002fu, 0x0000019fu, 0x00000196u,
|
||||
0x0000019eu, 0x0008004fu, 0x00000007u, 0x000001a1u, 0x0000019fu, 0x0000019fu, 0x00000000u, 0x00000001u,
|
||||
0x00000002u, 0x0003003eu, 0x000001a0u, 0x000001a1u, 0x00050039u, 0x00000006u, 0x000001a2u, 0x0000000bu,
|
||||
0x000001a0u, 0x0003003eu, 0x00000195u, 0x000001a2u, 0x0004003du, 0x00000023u, 0x000001a4u, 0x00000025u,
|
||||
0x0004003du, 0x0000000du, 0x000001a5u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000001a6u, 0x00000062u,
|
||||
0x00000029u, 0x0004003du, 0x00000006u, 0x000001a7u, 0x000001a6u, 0x0004007fu, 0x00000006u, 0x000001a8u,
|
||||
0x000001a7u, 0x00050041u, 0x00000020u, 0x000001a9u, 0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u,
|
||||
0x000001aau, 0x000001a9u, 0x00050050u, 0x0000000du, 0x000001abu, 0x000001a8u, 0x000001aau, 0x00050081u,
|
||||
0x0000000du, 0x000001acu, 0x000001a5u, 0x000001abu, 0x00050057u, 0x0000002fu, 0x000001adu, 0x000001a4u,
|
||||
0x000001acu, 0x0008004fu, 0x00000007u, 0x000001afu, 0x000001adu, 0x000001adu, 0x00000000u, 0x00000001u,
|
||||
0x00000002u, 0x0003003eu, 0x000001aeu, 0x000001afu, 0x00050039u, 0x00000006u, 0x000001b0u, 0x0000000bu,
|
||||
0x000001aeu, 0x0003003eu, 0x000001a3u, 0x000001b0u, 0x0004003du, 0x00000023u, 0x000001b2u, 0x00000025u,
|
||||
0x0004003du, 0x0000000du, 0x000001b3u, 0x00000070u, 0x00050041u, 0x00000020u, 0x000001b4u, 0x00000062u,
|
||||
0x00000029u, 0x0004003du, 0x00000006u, 0x000001b5u, 0x000001b4u, 0x00050041u, 0x00000020u, 0x000001b6u,
|
||||
0x00000062u, 0x00000048u, 0x0004003du, 0x00000006u, 0x000001b7u, 0x000001b6u, 0x00050050u, 0x0000000du,
|
||||
0x000001b8u, 0x000001b5u, 0x000001b7u, 0x00050081u, 0x0000000du, 0x000001b9u, 0x000001b3u, 0x000001b8u,
|
||||
0x00050057u, 0x0000002fu, 0x000001bau, 0x000001b2u, 0x000001b9u, 0x0008004fu, 0x00000007u, 0x000001bcu,
|
||||
0x000001bau, 0x000001bau, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x000001bbu, 0x000001bcu,
|
||||
0x00050039u, 0x00000006u, 0x000001bdu, 0x0000000bu, 0x000001bbu, 0x0003003eu, 0x000001b1u, 0x000001bdu,
|
||||
0x0004003du, 0x00000006u, 0x000001bfu, 0x0000011du, 0x0004003du, 0x00000006u, 0x000001c0u, 0x0000011eu,
|
||||
0x00050083u, 0x00000006u, 0x000001c1u, 0x000001bfu, 0x000001c0u, 0x0006000cu, 0x00000006u, 0x000001c2u,
|
||||
0x00000001u, 0x00000004u, 0x000001c1u, 0x0004003du, 0x00000006u, 0x000001c3u, 0x0000017bu, 0x0007000cu,
|
||||
0x00000006u, 0x000001c4u, 0x00000001u, 0x00000028u, 0x000001c3u, 0x00000063u, 0x00050088u, 0x00000006u,
|
||||
0x000001c5u, 0x000001c2u, 0x000001c4u, 0x0008000cu, 0x00000006u, 0x000001c6u, 0x00000001u, 0x0000002bu,
|
||||
0x000001c5u, 0x0000002cu, 0x00000063u, 0x0003003eu, 0x000001beu, 0x000001c6u, 0x0004003du, 0x00000006u,
|
||||
0x000001c8u, 0x000001beu, 0x0004003du, 0x00000006u, 0x000001c9u, 0x0000017bu, 0x00050085u, 0x00000006u,
|
||||
0x000001cbu, 0x000001c9u, 0x000001cau, 0x00050081u, 0x00000006u, 0x000001ccu, 0x00000063u, 0x000001cbu,
|
||||
0x00050088u, 0x00000006u, 0x000001cdu, 0x000001c8u, 0x000001ccu, 0x0003003eu, 0x000001c7u, 0x000001cdu,
|
||||
0x0004003du, 0x000000f1u, 0x000001cfu, 0x000000fau, 0x000300f7u, 0x000001d2u, 0x00000000u, 0x000400fau,
|
||||
0x000001cfu, 0x000001d1u, 0x000001d7u, 0x000200f8u, 0x000001d1u, 0x0004003du, 0x00000006u, 0x000001d3u,
|
||||
0x00000186u, 0x0004003du, 0x00000006u, 0x000001d4u, 0x00000195u, 0x00050083u, 0x00000006u, 0x000001d5u,
|
||||
0x000001d3u, 0x000001d4u, 0x0006000cu, 0x00000006u, 0x000001d6u, 0x00000001u, 0x00000004u, 0x000001d5u,
|
||||
0x0003003eu, 0x000001d0u, 0x000001d6u, 0x000200f9u, 0x000001d2u, 0x000200f8u, 0x000001d7u, 0x0004003du,
|
||||
0x00000006u, 0x000001d8u, 0x00000186u, 0x0004003du, 0x00000006u, 0x000001d9u, 0x000001a3u, 0x00050083u,
|
||||
0x00000006u, 0x000001dau, 0x000001d8u, 0x000001d9u, 0x0006000cu, 0x00000006u, 0x000001dbu, 0x00000001u,
|
||||
0x00000004u, 0x000001dau, 0x0003003eu, 0x000001d0u, 0x000001dbu, 0x000200f9u, 0x000001d2u, 0x000200f8u,
|
||||
0x000001d2u, 0x0004003du, 0x00000006u, 0x000001dcu, 0x000001d0u, 0x0003003eu, 0x000001ceu, 0x000001dcu,
|
||||
0x0004003du, 0x000000f1u, 0x000001deu, 0x000000fau, 0x000300f7u, 0x000001e1u, 0x00000000u, 0x000400fau,
|
||||
0x000001deu, 0x000001e0u, 0x000001e6u, 0x000200f8u, 0x000001e0u, 0x0004003du, 0x00000006u, 0x000001e2u,
|
||||
0x000001a3u, 0x0004003du, 0x00000006u, 0x000001e3u, 0x000001b1u, 0x00050083u, 0x00000006u, 0x000001e4u,
|
||||
0x000001e2u, 0x000001e3u, 0x0006000cu, 0x00000006u, 0x000001e5u, 0x00000001u, 0x00000004u, 0x000001e4u,
|
||||
0x0003003eu, 0x000001dfu, 0x000001e5u, 0x000200f9u, 0x000001e1u, 0x000200f8u, 0x000001e6u, 0x0004003du,
|
||||
0x00000006u, 0x000001e7u, 0x00000195u, 0x0004003du, 0x00000006u, 0x000001e8u, 0x000001b1u, 0x00050083u,
|
||||
0x00000006u, 0x000001e9u, 0x000001e7u, 0x000001e8u, 0x0006000cu, 0x00000006u, 0x000001eau, 0x00000001u,
|
||||
0x00000004u, 0x000001e9u, 0x0003003eu, 0x000001dfu, 0x000001eau, 0x000200f9u, 0x000001e1u, 0x000200f8u,
|
||||
0x000001e1u, 0x0004003du, 0x00000006u, 0x000001ebu, 0x000001dfu, 0x0003003eu, 0x000001ddu, 0x000001ebu,
|
||||
0x0004003du, 0x00000006u, 0x000001edu, 0x000001ceu, 0x0004003du, 0x00000006u, 0x000001eeu, 0x000001ddu,
|
||||
0x00050083u, 0x00000006u, 0x000001efu, 0x000001edu, 0x000001eeu, 0x0006000cu, 0x00000006u, 0x000001f0u,
|
||||
0x00000001u, 0x00000004u, 0x000001efu, 0x0003003eu, 0x000001ecu, 0x000001f0u, 0x0004003du, 0x00000006u,
|
||||
0x000001f2u, 0x000000ddu, 0x0004003du, 0x00000006u, 0x000001f3u, 0x000000ddu, 0x00050085u, 0x00000006u,
|
||||
0x000001f4u, 0x000001f3u, 0x00000182u, 0x0004003du, 0x00000006u, 0x000001f5u, 0x000001ecu, 0x0008000cu,
|
||||
0x00000006u, 0x000001f6u, 0x00000001u, 0x00000031u, 0x000001f2u, 0x000001f4u, 0x000001f5u, 0x0003003eu,
|
||||
0x000001f1u, 0x000001f6u, 0x0004003du, 0x00000006u, 0x000001f9u, 0x000001f1u, 0x00050085u, 0x00000006u,
|
||||
0x000001fau, 0x000001f8u, 0x000001f9u, 0x0004003du, 0x00000006u, 0x000001fbu, 0x0000017bu, 0x00050088u,
|
||||
0x00000006u, 0x000001fdu, 0x000001fbu, 0x000001fcu, 0x0008000cu, 0x00000006u, 0x000001feu, 0x00000001u,
|
||||
0x0000002bu, 0x000001fdu, 0x0000002cu, 0x00000063u, 0x00050085u, 0x00000006u, 0x000001ffu, 0x000001fau,
|
||||
0x000001feu, 0x0003003eu, 0x000001f7u, 0x000001ffu, 0x0004003du, 0x00000006u, 0x00000201u, 0x00000186u,
|
||||
0x0004003du, 0x00000006u, 0x00000202u, 0x000001b1u, 0x00050083u, 0x00000006u, 0x00000203u, 0x00000201u,
|
||||
0x00000202u, 0x0006000cu, 0x00000006u, 0x00000204u, 0x00000001u, 0x00000004u, 0x00000203u, 0x0004003du,
|
||||
0x00000006u, 0x00000205u, 0x00000195u, 0x0004003du, 0x00000006u, 0x00000206u, 0x000001a3u, 0x00050083u,
|
||||
0x00000006u, 0x00000207u, 0x00000205u, 0x00000206u, 0x0006000cu, 0x00000006u, 0x00000208u, 0x00000001u,
|
||||
0x00000004u, 0x00000207u, 0x0007000cu, 0x00000006u, 0x00000209u, 0x00000001u, 0x00000028u, 0x00000204u,
|
||||
0x00000208u, 0x0003003eu, 0x00000200u, 0x00000209u, 0x0004003du, 0x00000006u, 0x0000020cu, 0x000000ddu,
|
||||
0x0004003du, 0x00000006u, 0x0000020du, 0x000000ddu, 0x00050085u, 0x00000006u, 0x0000020fu, 0x0000020du,
|
||||
0x0000020eu, 0x0004003du, 0x00000006u, 0x00000210u, 0x00000200u, 0x0008000cu, 0x00000006u, 0x00000211u,
|
||||
0x00000001u, 0x00000031u, 0x0000020cu, 0x0000020fu, 0x00000210u, 0x00050085u, 0x00000006u, 0x00000212u,
|
||||
0x0000020bu, 0x00000211u, 0x00050083u, 0x00000006u, 0x00000213u, 0x00000063u, 0x00000212u, 0x0003003eu,
|
||||
0x0000020au, 0x00000213u, 0x0004003du, 0x00000006u, 0x00000215u, 0x000001f7u, 0x0004003du, 0x00000006u,
|
||||
0x00000216u, 0x000001c7u, 0x00050085u, 0x00000006u, 0x00000217u, 0x00000215u, 0x00000216u, 0x0004003du,
|
||||
0x00000006u, 0x00000218u, 0x0000017fu, 0x00050085u, 0x00000006u, 0x00000219u, 0x00000217u, 0x00000218u,
|
||||
0x0004003du, 0x00000006u, 0x0000021au, 0x0000020au, 0x00050085u, 0x00000006u, 0x0000021bu, 0x00000219u,
|
||||
0x0000021au, 0x0003003eu, 0x00000214u, 0x0000021bu, 0x0004003du, 0x00000006u, 0x0000021du, 0x00000186u,
|
||||
0x0004003du, 0x00000006u, 0x0000021eu, 0x000001b1u, 0x00050083u, 0x00000006u, 0x0000021fu, 0x0000021du,
|
||||
0x0000021eu, 0x0006000cu, 0x00000006u, 0x00000220u, 0x00000001u, 0x00000004u, 0x0000021fu, 0x0004003du,
|
||||
0x00000006u, 0x00000221u, 0x00000195u, 0x0004003du, 0x00000006u, 0x00000222u, 0x000001a3u, 0x00050083u,
|
||||
0x00000006u, 0x00000223u, 0x00000221u, 0x00000222u, 0x0006000cu, 0x00000006u, 0x00000224u, 0x00000001u,
|
||||
0x00000004u, 0x00000223u, 0x00050083u, 0x00000006u, 0x00000225u, 0x00000220u, 0x00000224u, 0x0006000cu,
|
||||
0x00000006u, 0x00000226u, 0x00000001u, 0x00000004u, 0x00000225u, 0x0003003eu, 0x0000021cu, 0x00000226u,
|
||||
0x0004003du, 0x00000006u, 0x00000228u, 0x000000ddu, 0x0004003du, 0x00000006u, 0x00000229u, 0x000000ddu,
|
||||
0x00050085u, 0x00000006u, 0x0000022au, 0x00000229u, 0x00000182u, 0x0004003du, 0x00000006u, 0x0000022bu,
|
||||
0x0000021cu, 0x0008000cu, 0x00000006u, 0x0000022cu, 0x00000001u, 0x00000031u, 0x00000228u, 0x0000022au,
|
||||
0x0000022bu, 0x0003003eu, 0x00000227u, 0x0000022cu, 0x0004003du, 0x00000006u, 0x0000022fu, 0x00000227u,
|
||||
0x00050085u, 0x00000006u, 0x00000230u, 0x0000022eu, 0x0000022fu, 0x0004003du, 0x00000006u, 0x00000231u,
|
||||
0x0000017fu, 0x00050085u, 0x00000006u, 0x00000232u, 0x00000230u, 0x00000231u, 0x0004003du, 0x00000006u,
|
||||
0x00000233u, 0x0000020au, 0x00050085u, 0x00000006u, 0x00000234u, 0x00000232u, 0x00000233u, 0x0003003eu,
|
||||
0x0000022du, 0x00000234u, 0x0004003du, 0x00000006u, 0x00000236u, 0x00000214u, 0x000500bcu, 0x000000f1u,
|
||||
0x00000238u, 0x00000236u, 0x00000237u, 0x0004003du, 0x00000006u, 0x00000239u, 0x0000022du, 0x0004003du,
|
||||
0x00000006u, 0x0000023au, 0x00000214u, 0x000600a9u, 0x00000006u, 0x0000023bu, 0x00000238u, 0x00000239u,
|
||||
0x0000023au, 0x0008000cu, 0x00000006u, 0x0000023du, 0x00000001u, 0x0000002bu, 0x0000023bu, 0x0000002cu,
|
||||
0x0000023cu, 0x0003003eu, 0x00000235u, 0x0000023du, 0x0004003du, 0x00000023u, 0x0000023fu, 0x00000025u,
|
||||
0x0004003du, 0x0000000du, 0x00000240u, 0x00000070u, 0x0004003du, 0x0000000du, 0x00000241u, 0x0000010bu,
|
||||
0x0004003du, 0x0000000du, 0x00000242u, 0x00000062u, 0x00050085u, 0x0000000du, 0x00000243u, 0x00000241u,
|
||||
0x00000242u, 0x00050081u, 0x0000000du, 0x00000244u, 0x00000240u, 0x00000243u, 0x00050057u, 0x0000002fu,
|
||||
0x00000245u, 0x0000023fu, 0x00000244u, 0x0008004fu, 0x00000007u, 0x00000246u, 0x00000245u, 0x00000245u,
|
||||
0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x0000023eu, 0x00000246u, 0x0004003du, 0x0000002fu,
|
||||
0x00000247u, 0x0000007cu, 0x0008004fu, 0x00000007u, 0x00000248u, 0x00000247u, 0x00000247u, 0x00000000u,
|
||||
0x00000001u, 0x00000002u, 0x0004003du, 0x00000007u, 0x00000249u, 0x0000023eu, 0x0004003du, 0x00000006u,
|
||||
0x0000024au, 0x00000235u, 0x00060050u, 0x00000007u, 0x0000024bu, 0x0000024au, 0x0000024au, 0x0000024au,
|
||||
0x0008000cu, 0x00000007u, 0x0000024cu, 0x00000001u, 0x0000002eu, 0x00000248u, 0x00000249u, 0x0000024bu,
|
||||
0x00050041u, 0x00000020u, 0x0000024eu, 0x0000007cu, 0x0000024du, 0x0004003du, 0x00000006u, 0x0000024fu,
|
||||
0x0000024eu, 0x00050051u, 0x00000006u, 0x00000250u, 0x0000024cu, 0x00000000u, 0x00050051u, 0x00000006u,
|
||||
0x00000251u, 0x0000024cu, 0x00000001u, 0x00050051u, 0x00000006u, 0x00000252u, 0x0000024cu, 0x00000002u,
|
||||
0x00070050u, 0x0000002fu, 0x00000253u, 0x00000250u, 0x00000251u, 0x00000252u, 0x0000024fu, 0x0003003eu,
|
||||
0x000000f6u, 0x00000253u, 0x000100fdu, 0x00010038u, 0x00050036u, 0x00000006u, 0x0000000bu, 0x00000000u,
|
||||
0x00000009u, 0x00030037u, 0x00000008u, 0x0000000au, 0x000200f8u, 0x0000000cu, 0x0004003du, 0x00000007u,
|
||||
0x00000018u, 0x0000000au, 0x00050094u, 0x00000006u, 0x0000001du, 0x00000018u, 0x0000001cu, 0x000200feu,
|
||||
0x0000001du, 0x00010038u, 0x00050036u, 0x00000006u, 0x00000012u, 0x00000000u, 0x0000000fu, 0x00030037u,
|
||||
0x0000000eu, 0x00000010u, 0x00030037u, 0x0000000eu, 0x00000011u, 0x000200f8u, 0x00000013u, 0x0004003bu,
|
||||
0x00000020u, 0x00000021u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000031u, 0x00000007u, 0x0004003bu,
|
||||
0x00000020u, 0x00000034u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000003cu, 0x00000007u, 0x0004003du,
|
||||
0x00000023u, 0x00000026u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000027u, 0x00000010u, 0x00050041u,
|
||||
0x00000020u, 0x0000002au, 0x00000011u, 0x00000029u, 0x0004003du, 0x00000006u, 0x0000002bu, 0x0000002au,
|
||||
0x00050050u, 0x0000000du, 0x0000002du, 0x0000002bu, 0x0000002cu, 0x00050083u, 0x0000000du, 0x0000002eu,
|
||||
0x00000027u, 0x0000002du, 0x00050057u, 0x0000002fu, 0x00000030u, 0x00000026u, 0x0000002eu, 0x0008004fu,
|
||||
0x00000007u, 0x00000032u, 0x00000030u, 0x00000030u, 0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu,
|
||||
0x00000031u, 0x00000032u, 0x00050039u, 0x00000006u, 0x00000033u, 0x0000000bu, 0x00000031u, 0x0003003eu,
|
||||
0x00000021u, 0x00000033u, 0x0004003du, 0x00000023u, 0x00000035u, 0x00000025u, 0x0004003du, 0x0000000du,
|
||||
0x00000036u, 0x00000010u, 0x00050041u, 0x00000020u, 0x00000037u, 0x00000011u, 0x00000029u, 0x0004003du,
|
||||
0x00000006u, 0x00000038u, 0x00000037u, 0x00050050u, 0x0000000du, 0x00000039u, 0x00000038u, 0x0000002cu,
|
||||
0x00050081u, 0x0000000du, 0x0000003au, 0x00000036u, 0x00000039u, 0x00050057u, 0x0000002fu, 0x0000003bu,
|
||||
0x00000035u, 0x0000003au, 0x0008004fu, 0x00000007u, 0x0000003du, 0x0000003bu, 0x0000003bu, 0x00000000u,
|
||||
0x00000001u, 0x00000002u, 0x0003003eu, 0x0000003cu, 0x0000003du, 0x00050039u, 0x00000006u, 0x0000003eu,
|
||||
0x0000000bu, 0x0000003cu, 0x0003003eu, 0x00000034u, 0x0000003eu, 0x0004003du, 0x00000006u, 0x0000003fu,
|
||||
0x00000021u, 0x0004003du, 0x00000006u, 0x00000040u, 0x00000034u, 0x00050083u, 0x00000006u, 0x00000041u,
|
||||
0x0000003fu, 0x00000040u, 0x0006000cu, 0x00000006u, 0x00000042u, 0x00000001u, 0x00000004u, 0x00000041u,
|
||||
0x000200feu, 0x00000042u, 0x00010038u, 0x00050036u, 0x00000006u, 0x00000016u, 0x00000000u, 0x0000000fu,
|
||||
0x00030037u, 0x0000000eu, 0x00000014u, 0x00030037u, 0x0000000eu, 0x00000015u, 0x000200f8u, 0x00000017u,
|
||||
0x0004003bu, 0x00000020u, 0x00000045u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x0000004eu, 0x00000007u,
|
||||
0x0004003bu, 0x00000020u, 0x00000051u, 0x00000007u, 0x0004003bu, 0x00000008u, 0x00000059u, 0x00000007u,
|
||||
0x0004003du, 0x00000023u, 0x00000046u, 0x00000025u, 0x0004003du, 0x0000000du, 0x00000047u, 0x00000014u,
|
||||
0x00050041u, 0x00000020u, 0x00000049u, 0x00000015u, 0x00000048u, 0x0004003du, 0x00000006u, 0x0000004au,
|
||||
0x00000049u, 0x00050050u, 0x0000000du, 0x0000004bu, 0x0000002cu, 0x0000004au, 0x00050083u, 0x0000000du,
|
||||
0x0000004cu, 0x00000047u, 0x0000004bu, 0x00050057u, 0x0000002fu, 0x0000004du, 0x00000046u, 0x0000004cu,
|
||||
0x0008004fu, 0x00000007u, 0x0000004fu, 0x0000004du, 0x0000004du, 0x00000000u, 0x00000001u, 0x00000002u,
|
||||
0x0003003eu, 0x0000004eu, 0x0000004fu, 0x00050039u, 0x00000006u, 0x00000050u, 0x0000000bu, 0x0000004eu,
|
||||
0x0003003eu, 0x00000045u, 0x00000050u, 0x0004003du, 0x00000023u, 0x00000052u, 0x00000025u, 0x0004003du,
|
||||
0x0000000du, 0x00000053u, 0x00000014u, 0x00050041u, 0x00000020u, 0x00000054u, 0x00000015u, 0x00000048u,
|
||||
0x0004003du, 0x00000006u, 0x00000055u, 0x00000054u, 0x00050050u, 0x0000000du, 0x00000056u, 0x0000002cu,
|
||||
0x00000055u, 0x00050081u, 0x0000000du, 0x00000057u, 0x00000053u, 0x00000056u, 0x00050057u, 0x0000002fu,
|
||||
0x00000058u, 0x00000052u, 0x00000057u, 0x0008004fu, 0x00000007u, 0x0000005au, 0x00000058u, 0x00000058u,
|
||||
0x00000000u, 0x00000001u, 0x00000002u, 0x0003003eu, 0x00000059u, 0x0000005au, 0x00050039u, 0x00000006u,
|
||||
0x0000005bu, 0x0000000bu, 0x00000059u, 0x0003003eu, 0x00000051u, 0x0000005bu, 0x0004003du, 0x00000006u,
|
||||
0x0000005cu, 0x00000045u, 0x0004003du, 0x00000006u, 0x0000005du, 0x00000051u, 0x00050083u, 0x00000006u,
|
||||
0x0000005eu, 0x0000005cu, 0x0000005du, 0x0006000cu, 0x00000006u, 0x0000005fu, 0x00000001u, 0x00000004u,
|
||||
0x0000005eu, 0x000200feu, 0x0000005fu, 0x00010038u,
|
||||
};
|
||||
@@ -26,7 +26,7 @@ add_library(droiddeckwayland SHARED
|
||||
generated/linux-dmabuf-v1-protocol.c
|
||||
generated/wayland-android-protocol.c
|
||||
generated/viewporter-protocol.c
|
||||
generated/banner-desktop-v1-protocol.c
|
||||
generated/droiddeck-desktop-v1-protocol.c
|
||||
generated/presentation-time-protocol.c
|
||||
generated/pointer-constraints-unstable-v1-protocol.c
|
||||
generated/relative-pointer-unstable-v1-protocol.c
|
||||
|
||||
+9
-9
@@ -38,7 +38,7 @@
|
||||
|
||||
extern const struct wl_interface wl_surface_interface;
|
||||
|
||||
static const struct wl_interface *banner_desktop_v1_types[] = {
|
||||
static const struct wl_interface *droiddeck_desktop_v1_types[] = {
|
||||
NULL,
|
||||
&wl_surface_interface,
|
||||
&wl_surface_interface,
|
||||
@@ -47,16 +47,16 @@ static const struct wl_interface *banner_desktop_v1_types[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct wl_message banner_desktop_v1_requests[] = {
|
||||
{ "destroy", "", banner_desktop_v1_types + 0 },
|
||||
{ "set_desktop", "o", banner_desktop_v1_types + 1 },
|
||||
{ "set_window", "ouii", banner_desktop_v1_types + 2 },
|
||||
{ "set_zorder", "a", banner_desktop_v1_types + 0 },
|
||||
static const struct wl_message droiddeck_desktop_v1_requests[] = {
|
||||
{ "destroy", "", droiddeck_desktop_v1_types + 0 },
|
||||
{ "set_desktop", "o", droiddeck_desktop_v1_types + 1 },
|
||||
{ "set_window", "ouii", droiddeck_desktop_v1_types + 2 },
|
||||
{ "set_zorder", "a", droiddeck_desktop_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface banner_desktop_v1_interface = {
|
||||
"banner_desktop_v1", 1,
|
||||
4, banner_desktop_v1_requests,
|
||||
WL_PRIVATE const struct wl_interface droiddeck_desktop_v1_interface = {
|
||||
"droiddeck_desktop_v1", 1,
|
||||
4, droiddeck_desktop_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
|
||||
#ifndef BANNER_DESKTOP_V1_SERVER_PROTOCOL_H
|
||||
#define BANNER_DESKTOP_V1_SERVER_PROTOCOL_H
|
||||
#ifndef DROIDDECK_DESKTOP_V1_SERVER_PROTOCOL_H
|
||||
#define DROIDDECK_DESKTOP_V1_SERVER_PROTOCOL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
@@ -14,7 +14,7 @@ struct wl_client;
|
||||
struct wl_resource;
|
||||
|
||||
/*
|
||||
* @section page_copyright_banner_desktop_v1 Copyright
|
||||
* @section page_copyright_droiddeck_desktop_v1 Copyright
|
||||
*
|
||||
* Copyright 2026 The412Banner
|
||||
*
|
||||
@@ -42,15 +42,15 @@ struct wl_resource;
|
||||
|
||||
|
||||
|
||||
struct banner_desktop_v1;
|
||||
struct droiddeck_desktop_v1;
|
||||
struct wl_surface;
|
||||
|
||||
#ifndef BANNER_DESKTOP_V1_INTERFACE
|
||||
#define BANNER_DESKTOP_V1_INTERFACE
|
||||
extern const struct wl_interface banner_desktop_v1_interface;
|
||||
#ifndef DROIDDECK_DESKTOP_V1_INTERFACE
|
||||
#define DROIDDECK_DESKTOP_V1_INTERFACE
|
||||
extern const struct wl_interface droiddeck_desktop_v1_interface;
|
||||
#endif
|
||||
|
||||
struct banner_desktop_v1_interface {
|
||||
struct droiddeck_desktop_v1_interface {
|
||||
void (*destroy)(struct wl_client *client,
|
||||
struct wl_resource *resource);
|
||||
void (*set_desktop)(struct wl_client *client,
|
||||
@@ -68,10 +68,10 @@ struct banner_desktop_v1_interface {
|
||||
};
|
||||
|
||||
|
||||
#define BANNER_DESKTOP_V1_DESTROY_SINCE_VERSION 1
|
||||
#define BANNER_DESKTOP_V1_SET_DESKTOP_SINCE_VERSION 1
|
||||
#define BANNER_DESKTOP_V1_SET_WINDOW_SINCE_VERSION 1
|
||||
#define BANNER_DESKTOP_V1_SET_ZORDER_SINCE_VERSION 1
|
||||
#define DROIDDECK_DESKTOP_V1_DESTROY_SINCE_VERSION 1
|
||||
#define DROIDDECK_DESKTOP_V1_SET_DESKTOP_SINCE_VERSION 1
|
||||
#define DROIDDECK_DESKTOP_V1_SET_WINDOW_SINCE_VERSION 1
|
||||
#define DROIDDECK_DESKTOP_V1_SET_ZORDER_SINCE_VERSION 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="banner_desktop_v1">
|
||||
<protocol name="droiddeck_desktop_v1">
|
||||
<copyright>
|
||||
Copyright 2026 The412Banner
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="banner_desktop_v1" version="1">
|
||||
<interface name="droiddeck_desktop_v1" version="1">
|
||||
<description summary="Windows virtual desktop layout">
|
||||
Each Wine process is a separate Wayland client, so a Windows virtual
|
||||
desktop can't be built from subsurfaces. Instead the process that owns
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "sc_layer.h"
|
||||
#include "ahb_swapchain.h"
|
||||
#include "viewporter-server-protocol.h"
|
||||
#include "banner-desktop-v1-server-protocol.h"
|
||||
#include "droiddeck-desktop-v1-server-protocol.h"
|
||||
#include "presentation-time-server-protocol.h"
|
||||
#include "pointer-constraints-unstable-v1-server-protocol.h"
|
||||
#include "relative-pointer-unstable-v1-server-protocol.h"
|
||||
@@ -79,7 +79,7 @@ static void open_session_log(void) {
|
||||
|
||||
localtime_r(&now, &tm);
|
||||
strftime(stamp, sizeof(stamp), "%Y-%m-%d_%H-%M-%S", &tm);
|
||||
const char *given = getenv("BL_WAYLAND_LOG");
|
||||
const char *given = getenv("DD_WAYLAND_LOG");
|
||||
if (given && *given) {
|
||||
snprintf(path, sizeof(path), "%s", given);
|
||||
} else {
|
||||
@@ -305,6 +305,14 @@ static int g_fallback_armed;
|
||||
volatile int g_fps_limit;
|
||||
volatile int g_release_unpaced;
|
||||
|
||||
volatile int g_bfi;
|
||||
volatile int g_bfi_picture_hold;
|
||||
static int g_bfi_running;
|
||||
static unsigned g_bfi_phase;
|
||||
static const char *g_bfi_blocked;
|
||||
static int g_scene_layer_only;
|
||||
static struct { unsigned lit, dark, failed; } g_bfi_stats;
|
||||
|
||||
volatile int g_hide_shell;
|
||||
|
||||
volatile int g_zero_copy;
|
||||
@@ -1788,14 +1796,14 @@ static void desktop_set_zorder(struct wl_client *c, struct wl_resource *r, struc
|
||||
apply_zorder();
|
||||
schedule_render();
|
||||
}
|
||||
static const struct banner_desktop_v1_interface desktop_impl = {
|
||||
static const struct droiddeck_desktop_v1_interface desktop_impl = {
|
||||
.destroy = desktop_destroy_req,
|
||||
.set_desktop = desktop_set_desktop,
|
||||
.set_window = desktop_set_window,
|
||||
.set_zorder = desktop_set_zorder,
|
||||
};
|
||||
static void bind_desktop(struct wl_client *c, void *data, uint32_t ver, uint32_t id) {
|
||||
struct wl_resource *r = wl_resource_create(c, &banner_desktop_v1_interface, ver, id);
|
||||
struct wl_resource *r = wl_resource_create(c, &droiddeck_desktop_v1_interface, ver, id);
|
||||
wl_resource_set_implementation(r, &desktop_impl, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -2278,6 +2286,10 @@ static void render_scene(void) {
|
||||
if (hdr_route == 3) { fx_on = 0; framegen = 0; }
|
||||
struct surface *ahb_only = ahb_layer_only_candidate(w, h);
|
||||
struct surface *layer_only = ahb_only ? ahb_only : hdr_unimported_fullscreen(&dl, w, h);
|
||||
g_scene_layer_only = hdr_route == 3 || layer_only;
|
||||
const int bfi = g_bfi_running && !g_scene_layer_only;
|
||||
/* The compositor pass BFI needs is route 2; a fullscreen HDR scene on route 0 would lose its HDR there too. */
|
||||
if (bfi && (hdr_route == 1 || (hdr_route == 0 && hs.n_hdr > 0))) hdr_route = 2;
|
||||
const int cursor_on = hdr_route == 3 || layer_only ? 0 : add_cursor(&dl, w);
|
||||
static int cursor_layer_said;
|
||||
if (layer_only && atomic_load(&g_cursor_composite) && !cursor_layer_said) {
|
||||
@@ -2328,19 +2340,21 @@ static void render_scene(void) {
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
} else if (hdr_route == 0 || hdr_route == 3) {
|
||||
const int pass_on = fx_on || framegen;
|
||||
int li = (g_zero_copy && !framegen && !cardboard && !cursor_on) ? layer_candidate(&dl, w, h) : -1;
|
||||
int li = (g_zero_copy && !framegen && !bfi && !cardboard && !cursor_on) ? layer_candidate(&dl, w, h) : -1;
|
||||
int over = li >= 0 ? dl.n - 1 - li : 0;
|
||||
const int fx_blocks = (li >= 0 && fx_on && over > 0);
|
||||
if (fx_blocks) { li = -1; over = 0; }
|
||||
const int ov_blocks = (li >= 0 && over > 0 && !fx_blocks && !sc_layer_overlay_affordable());
|
||||
if (ov_blocks) { li = -1; over = 0; }
|
||||
const int blocked = framegen ? 1 : (fx_blocks ? 2 : (ov_blocks ? 3 : 0));
|
||||
const int blocked = framegen ? 1 : bfi ? 4 : (fx_blocks ? 2 : (ov_blocks ? 3 : 0));
|
||||
if (g_zero_copy && !cursor_on && blocked != g_zero_copy_paused) {
|
||||
g_zero_copy_paused = blocked;
|
||||
if (blocked == 1)
|
||||
droiddeck_log("framegen", "zero-copy paused: frame generation needs the compositor pass");
|
||||
else if (blocked == 2)
|
||||
droiddeck_log("effects", "zero-copy paused: a window above the game needs the compositor pass for the whole scene");
|
||||
else if (blocked == 4)
|
||||
droiddeck_log("bfi", "zero-copy paused: black frame insertion needs the compositor pass");
|
||||
else if (blocked == 3)
|
||||
droiddeck_log("layer", "zero-copy paused: a window above the game would need a second display layer, "
|
||||
"which this display cannot compose in hardware - whole scene on the copy path");
|
||||
@@ -2351,6 +2365,7 @@ static void render_scene(void) {
|
||||
if (li < 0) ls = layer_only;
|
||||
if (cardboard) ls = NULL;
|
||||
if (cursor_on) ls = NULL;
|
||||
if (bfi) ls = NULL;
|
||||
if (ls && pass_on && li < 0 && !g_zero_copy_fx_skip_said) {
|
||||
g_zero_copy_fx_skip_said = 1;
|
||||
droiddeck_log(framegen ? "framegen" : "effects",
|
||||
@@ -2392,6 +2407,7 @@ static void render_scene(void) {
|
||||
: fx_blocks ? "a window is above it and screen effects need the whole scene"
|
||||
: !g_zero_copy ? "zero-copy presentation is off"
|
||||
: framegen ? "frame generation needs the compositor pass"
|
||||
: bfi ? "black frame insertion needs the compositor pass"
|
||||
: "it is not the one fullscreen window (only that one gets its own display layer)";
|
||||
}
|
||||
}
|
||||
@@ -2434,7 +2450,8 @@ static int on_fallback_timer(void *data) {
|
||||
}
|
||||
|
||||
static int commit_renders_on(void) {
|
||||
return g_render_on_commit && g_release_unpaced && !atomic_load(&g_stream_on) && !vkp_framegen_active();
|
||||
return g_render_on_commit && g_release_unpaced && !atomic_load(&g_stream_on) && !vkp_framegen_active() &&
|
||||
!g_bfi_running;
|
||||
}
|
||||
|
||||
static int render_on_commit(void) {
|
||||
@@ -2470,6 +2487,61 @@ static void on_commit_idle(void *data) {
|
||||
render_scene();
|
||||
}
|
||||
|
||||
/* Black frame insertion strobes on the display's refresh tick and paces the game to the lit refresh,
|
||||
* the design of BFI Presenter by artzox (https://github.com/artzox/BFI-Presenter, GPL-3.0), after Blur Busters'
|
||||
* research on MPRT and motion blur (https://blurbusters.com). No BFI Presenter code is used. */
|
||||
/* The panel's refresh from its display mode, not the measured tick rate: BFI's own presents can make ticks run
|
||||
* late under load, and a measured rate would then dip under the limit and switch BFI off and on many times a
|
||||
* second. 99 Hz lets panels that report 99.9 Hz for 100 Hz through. */
|
||||
#define BFI_MIN_REFRESH_MHZ 99000
|
||||
|
||||
static const char *bfi_blocked(void) {
|
||||
if (atomic_load(&g_stream_on)) return "the picture is being streamed";
|
||||
if (vkp_framegen_active()) return "frame generation is on";
|
||||
if (vkp_cardboard_active()) return "Cardboard VR is on";
|
||||
if (vkp_quest_layer_presentation()) return "this headset composes its own layers";
|
||||
if (g_scene_layer_only) return "the game's frames cannot be imported, so it is shown on its own display layer";
|
||||
if (atomic_load(&g_output_refresh_mhz) < BFI_MIN_REFRESH_MHZ) return "the screen runs below 100 Hz";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void bfi_update(void) {
|
||||
const char *why = g_bfi ? bfi_blocked() : NULL;
|
||||
const int run = g_bfi && !why;
|
||||
if (g_bfi && why && why != g_bfi_blocked)
|
||||
droiddeck_log("bfi", "black frame insertion waits: %s", why);
|
||||
g_bfi_blocked = why;
|
||||
if (run == g_bfi_running) return;
|
||||
g_bfi_running = run;
|
||||
g_bfi_phase = 0;
|
||||
g_dirty = 1;
|
||||
if (run) {
|
||||
const int mhz = atomic_load(&g_output_refresh_mhz);
|
||||
droiddeck_log("bfi", "black frame insertion on: %.0f Hz screen, a black refresh after every picture, "
|
||||
"the game is paced to %.0f fps", mhz / 1000.0, mhz / 2000.0);
|
||||
} else {
|
||||
/* Lit refreshes advanced the frame deadline without being held to it; a stale one would stall rendering. */
|
||||
g_scene_due_ns = 0;
|
||||
droiddeck_log("bfi", "black frame insertion off");
|
||||
}
|
||||
}
|
||||
|
||||
static void bfi_tick(void) {
|
||||
/* A capture copies the surface's last buffer: present pictures only, still composed into that surface. */
|
||||
if (g_bfi_picture_hold) {
|
||||
g_bfi_phase = 0;
|
||||
g_bfi_stats.lit++;
|
||||
render_scene();
|
||||
} else if ((g_bfi_phase++ & 1) == 0) {
|
||||
g_bfi_stats.lit++;
|
||||
render_scene();
|
||||
} else if (vkp_render_plain(g_scene_w, g_scene_h) == 0) {
|
||||
g_bfi_stats.dark++;
|
||||
} else {
|
||||
g_bfi_stats.failed++;
|
||||
}
|
||||
}
|
||||
|
||||
static void on_vsync(int64_t frame_time_ns) {
|
||||
int64_t now = now_ns();
|
||||
g_perf.ticks++;
|
||||
@@ -2491,6 +2563,12 @@ static void on_vsync(int64_t frame_time_ns) {
|
||||
if (vkp_effects_sync()) tick_change = 1;
|
||||
if (vkp_cardboard_pose_changed()) tick_change = 1;
|
||||
if (tick_change) g_dirty = 1;
|
||||
bfi_update();
|
||||
if (g_bfi_running) {
|
||||
g_tick_held = 0;
|
||||
bfi_tick();
|
||||
return;
|
||||
}
|
||||
if (g_tick_held && g_dirty) g_hold_missed_ns = now;
|
||||
g_tick_held = 0;
|
||||
if (!tick_change && commit_renders_on() && g_dirty_since_ns && now - g_dirty_since_ns < g_refresh_ns &&
|
||||
@@ -3862,6 +3940,11 @@ static int on_stats_timer(void *data) {
|
||||
g_pace.renders, g_pace.commit_renders, (unsigned long long)game, g_pace.reattaches, g_pace.null_attaches, g_pace.distinct,
|
||||
g_pace.presented, g_pace.replaced, g_pace.undrawn);
|
||||
}
|
||||
if (g_bfi_stats.lit || g_bfi_stats.dark || g_bfi_stats.failed) {
|
||||
droiddeck_log("bfi", "last 10 s: %u pictures, %u black refreshes, %u black refreshes not presented",
|
||||
g_bfi_stats.lit, g_bfi_stats.dark, g_bfi_stats.failed);
|
||||
memset(&g_bfi_stats, 0, sizeof(g_bfi_stats));
|
||||
}
|
||||
{
|
||||
const uint64_t seen = g_game_frames;
|
||||
memset(&g_pace, 0, sizeof(g_pace));
|
||||
@@ -4000,7 +4083,7 @@ int droiddeck_wayland_run(void) {
|
||||
wl_global_create(display, &zwp_linux_dmabuf_v1_interface, 4, NULL, bind_dmabuf);
|
||||
droiddeck_android_wlegl_init(display);
|
||||
wl_global_create(display, &wl_seat_interface, 9, NULL, bind_seat);
|
||||
wl_global_create(display, &banner_desktop_v1_interface, 1, NULL, bind_desktop);
|
||||
wl_global_create(display, &droiddeck_desktop_v1_interface, 1, NULL, bind_desktop);
|
||||
wl_global_create(display, &wp_presentation_interface, 2, NULL, bind_presentation);
|
||||
wl_global_create(display, &zwp_pointer_constraints_v1_interface, 1, NULL, bind_pointer_constraints);
|
||||
wl_global_create(display, &zwp_relative_pointer_manager_v1_interface, 1, NULL, bind_relative_pointer_manager);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "cas_frag.h"
|
||||
#include "color_frag.h"
|
||||
#include "fxaa_frag.h"
|
||||
#include "smaa_frag.h"
|
||||
#include "toon_frag.h"
|
||||
#include "hdr_frag.h"
|
||||
#include "ntsc_frag.h"
|
||||
@@ -41,7 +42,7 @@ struct fx_settings {
|
||||
int color_on;
|
||||
float brightness, contrast, gamma, saturation;
|
||||
float b_raw, c_raw, s_raw;
|
||||
int fxaa, toon, crt, ntsc;
|
||||
int aa_mode, toon, crt, ntsc;
|
||||
char look[48];
|
||||
};
|
||||
|
||||
@@ -78,7 +79,7 @@ void vkp_effects_set_deband(int enabled, int pct) {
|
||||
}
|
||||
static float clampf(float v, float lo, float hi) { return v < lo ? lo : v > hi ? hi : v; }
|
||||
void vkp_effects_set_screen(float brightness, float contrast, float gamma, float saturation,
|
||||
int fxaa, int toon, int crt, int ntsc) {
|
||||
int aa_mode, int toon, int crt, int ntsc) {
|
||||
int on = !(brightness == 0.0f && contrast == 0.0f && gamma == 1.0f && saturation == 100.0f);
|
||||
set_begin();
|
||||
g_set.color_on = on;
|
||||
@@ -87,7 +88,8 @@ void vkp_effects_set_screen(float brightness, float contrast, float gamma, float
|
||||
g_set.contrast = clampf(contrast / 100.0f, 0.0f, 2.0f);
|
||||
g_set.saturation = clampf(saturation / 100.0f, 0.0f, 2.0f);
|
||||
g_set.gamma = clampf(gamma, 0.1f, 5.0f);
|
||||
g_set.fxaa = fxaa ? 1 : 0; g_set.toon = toon ? 1 : 0; g_set.crt = crt ? 1 : 0; g_set.ntsc = ntsc ? 1 : 0;
|
||||
g_set.aa_mode = (aa_mode >= 0 && aa_mode <= 2) ? aa_mode : 0;
|
||||
g_set.toon = toon ? 1 : 0; g_set.crt = crt ? 1 : 0; g_set.ntsc = ntsc ? 1 : 0;
|
||||
set_end();
|
||||
}
|
||||
void vkp_effects_set_look(const char *name) {
|
||||
@@ -103,7 +105,7 @@ static const char *scaling_name(int m) {
|
||||
static int spatial_mode(int m) { return m >= 3 && m <= 8; }
|
||||
static int cas_active(const struct fx_settings *s) { return s->cas_on && s->cas_pct > 0; }
|
||||
static int effect_count(const struct fx_settings *s) {
|
||||
return s->fxaa + s->toon + s->color_on + cas_active(s) + s->hdr_on + s->ntsc + s->crt + s->deband_on;
|
||||
return (s->aa_mode != 0) + s->toon + s->color_on + cas_active(s) + s->hdr_on + s->ntsc + s->crt + s->deband_on;
|
||||
}
|
||||
|
||||
static void log_settings(const struct fx_settings *s) {
|
||||
@@ -121,7 +123,8 @@ static void log_settings(const struct fx_settings *s) {
|
||||
if (s->color_on)
|
||||
n += snprintf(line + n, sizeof(line) - n, ", colour b=%+.0f c=%+.0f g=%.2f s=%.0f%%",
|
||||
s->b_raw, s->c_raw, s->gamma, s->s_raw);
|
||||
if (s->fxaa) n += snprintf(line + n, sizeof(line) - n, ", FXAA on");
|
||||
if (s->aa_mode == 1) n += snprintf(line + n, sizeof(line) - n, ", FXAA on");
|
||||
else if (s->aa_mode == 2) n += snprintf(line + n, sizeof(line) - n, ", SMAA on");
|
||||
if (s->toon) n += snprintf(line + n, sizeof(line) - n, ", Toon on");
|
||||
if (s->hdr_on) n += snprintf(line + n, sizeof(line) - n, ", HDR on");
|
||||
if (s->ntsc) n += snprintf(line + n, sizeof(line) - n, ", NTSC on");
|
||||
@@ -202,7 +205,7 @@ static VkDescriptorSetLayout g_dsl;
|
||||
static VkPipelineLayout g_pl;
|
||||
static VkDescriptorPool g_dpool;
|
||||
static VkSampler g_sampler;
|
||||
enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_TOON, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_COUNT };
|
||||
enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_SMAA, P_TOON, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_COUNT };
|
||||
static VkPipeline g_pipe[P_COUNT];
|
||||
static struct fx_target g_t[2], g_mid;
|
||||
|
||||
@@ -438,6 +441,7 @@ static int objects_ensure(void) {
|
||||
MK(P_CAS, cas_code, "cas");
|
||||
MK(P_COLOR, color_code, "color");
|
||||
MK(P_FXAA, fxaa_code, "fxaa");
|
||||
MK(P_SMAA, smaa_code, "smaa");
|
||||
MK(P_TOON, toon_code, "toon");
|
||||
MK(P_HDR, hdr_code, "hdr");
|
||||
MK(P_NTSC, ntsc_code, "ntsc");
|
||||
@@ -446,7 +450,7 @@ static int objects_ensure(void) {
|
||||
#undef MK
|
||||
g_vk.DestroyShaderModule(g_dev, vert, NULL);
|
||||
g_ready = 1;
|
||||
droiddeck_log("effects", "chain ready: 13 passes (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, Toon, HDR, NTSC, CRT, deband) on %s", vkp_gpu_name());
|
||||
droiddeck_log("effects", "chain ready: 14 pipelines (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, SMAA, Toon, HDR, NTSC, CRT, deband) on %s", vkp_gpu_name());
|
||||
return 0;
|
||||
fail:
|
||||
objects_destroy();
|
||||
@@ -567,9 +571,10 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
|
||||
cur = NULL; cur_ds = g_scene.ds;
|
||||
}
|
||||
|
||||
enum { FX_FXAA, FX_TOON, FX_COLOR, FX_CAS, FX_HDR, FX_NTSC, FX_CRT, FX_DEBAND };
|
||||
enum { FX_FXAA, FX_SMAA, FX_TOON, FX_COLOR, FX_CAS, FX_HDR, FX_NTSC, FX_CRT, FX_DEBAND };
|
||||
int order[8], n = 0;
|
||||
if (s->fxaa) order[n++] = FX_FXAA;
|
||||
if (s->aa_mode == 1) order[n++] = FX_FXAA;
|
||||
else if (s->aa_mode == 2) order[n++] = FX_SMAA;
|
||||
if (s->toon) order[n++] = FX_TOON;
|
||||
if (s->color_on) order[n++] = FX_COLOR;
|
||||
if (cas_active(s)) order[n++] = FX_CAS;
|
||||
@@ -584,6 +589,7 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
|
||||
pr.res[0] = (float)cw; pr.res[1] = (float)ch;
|
||||
switch (order[i]) {
|
||||
case FX_FXAA: pass(cmd, g_pipe[P_FXAA], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_SMAA: pass(cmd, g_pipe[P_SMAA], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_TOON: pass(cmd, g_pipe[P_TOON], dst, cur_ds, &pr, sizeof(pr)); break;
|
||||
case FX_COLOR: {
|
||||
struct pc_color pc = {0};
|
||||
|
||||
@@ -30,7 +30,7 @@ void vkp_effects_set_cas(int enabled, int pct);
|
||||
void vkp_effects_set_hdr(int enabled);
|
||||
void vkp_effects_set_deband(int enabled, int pct);
|
||||
void vkp_effects_set_screen(float brightness, float contrast, float gamma, float saturation,
|
||||
int fxaa, int toon, int crt, int ntsc);
|
||||
int aa_mode, int toon, int crt, int ntsc);
|
||||
void vkp_effects_set_look(const char *name);
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "quest_device.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <sys/system_properties.h>
|
||||
#include <unistd.h>
|
||||
@@ -416,8 +417,13 @@ static void update_map(int scene_w, int scene_h) {
|
||||
if (mode == VKP_MODE_FILL) aspect = sx > sy ? sx : sy;
|
||||
else if (mode == VKP_MODE_INTEGER) {
|
||||
float m = sx < sy ? sx : sy;
|
||||
aspect = (float)(int)m;
|
||||
if (aspect < 1.0f) aspect = 1.0f;
|
||||
float nearest = roundf(m);
|
||||
if (nearest >= 1.0f && nearest > m &&
|
||||
nearest - m < 0.15f) {
|
||||
aspect = nearest;
|
||||
} else {
|
||||
aspect = m >= 1.0f ? (float)(int)m : m;
|
||||
}
|
||||
} else aspect = sx < sy ? sx : sy;
|
||||
g_map.kx = g_map.ky = aspect;
|
||||
g_map.off_x = (float)(g_map.rx + (int)((g_map.rw - scene_w * aspect) * 0.5f));
|
||||
@@ -2000,7 +2006,9 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
||||
1 + vkp_framegen_extra_images(), vkp_framegen_extra_images() ? "s" : "");
|
||||
destroy_swapchain();
|
||||
}
|
||||
const int want_hdr = hf && !hf->tonemap && g_colorspace_ext && !g_swap_hdr_unavailable;
|
||||
/* A black refresh carries no HDR frame; it keeps the swapchain's colour mode rather than flipping it. */
|
||||
const int want_hdr = (g_plain_frame && !hf) ? (g_swapchain && g_swap_is_hdr)
|
||||
: (hf && !hf->tonemap && g_colorspace_ext && !g_swap_hdr_unavailable);
|
||||
if (g_swapchain && want_hdr != g_swap_is_hdr) {
|
||||
droiddeck_log("color", want_hdr ? "HDR frames with frame generation: rebuilding the screen swapchain as HDR10"
|
||||
: hf ? "HDR output switched off: rebuilding the screen swapchain as SDR (frames tone-mapped)"
|
||||
|
||||
@@ -42,6 +42,8 @@ extern void droiddeck_wayland_set_output_refresh_rate(int mhz);
|
||||
extern volatile int g_fps_limit;
|
||||
extern volatile int g_release_unpaced;
|
||||
extern volatile int g_render_on_commit;
|
||||
extern volatile int g_bfi;
|
||||
extern volatile int g_bfi_picture_hold;
|
||||
extern volatile int g_hide_shell;
|
||||
extern volatile int g_zero_copy;
|
||||
extern volatile unsigned g_zero_copy_last;
|
||||
@@ -495,8 +497,8 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetDeband(JNIEnv *en
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetScreenEffects(JNIEnv *env, jclass clazz, jfloat brightness,
|
||||
jfloat contrast, jfloat gamma, jfloat saturation, jboolean fxaa, jboolean toon, jboolean crt, jboolean ntsc) {
|
||||
vkp_effects_set_screen(brightness, contrast, gamma, saturation, fxaa ? 1 : 0, toon ? 1 : 0, crt ? 1 : 0, ntsc ? 1 : 0);
|
||||
jfloat contrast, jfloat gamma, jfloat saturation, jint aa_mode, jboolean toon, jboolean crt, jboolean ntsc) {
|
||||
vkp_effects_set_screen(brightness, contrast, gamma, saturation, aa_mode, toon ? 1 : 0, crt ? 1 : 0, ntsc ? 1 : 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
@@ -669,6 +671,17 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetRenderOnCommit(JN
|
||||
__android_log_print(ANDROID_LOG_INFO, TAG, "render on commit %s", on ? "on" : "off");
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetBlackFrameInsertion(JNIEnv *env, jclass clazz, jboolean on) {
|
||||
g_bfi = on ? 1 : 0;
|
||||
__android_log_print(ANDROID_LOG_INFO, TAG, "black frame insertion %s", on ? "requested" : "off");
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetPictureHold(JNIEnv *env, jclass clazz, jboolean on) {
|
||||
g_bfi_picture_hold = on ? 1 : 0;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetFpsLimit(JNIEnv *env, jclass clazz, jint fps) {
|
||||
g_fps_limit = fps > 0 ? fps : 0;
|
||||
|
||||
@@ -20,6 +20,7 @@ class App : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
com.droiddeck.launcher.runtime.NativeGuest.init(this)
|
||||
Thread({ runCatching { EnhancedSessionLogShare.cleanupAbandonedStages(this) } }, "diagnostic-stage-cleanup").start()
|
||||
com.droiddeck.launcher.ui.Themes.loadGradient(this)
|
||||
com.droiddeck.launcher.ui.BuildWatermark.install(this)
|
||||
@@ -42,8 +43,10 @@ class App : Application() {
|
||||
if (process == "$packageName:vr_recovery" || process == "$packageName:rgb_diagnostic" ||
|
||||
process == "$packageName:shortcuts_sync" || process == "$packageName:bottom_desktop") return
|
||||
CrashHandler.install(this)
|
||||
com.droiddeck.launcher.input.ShortcutsRelay.Holder.install(this)
|
||||
com.droiddeck.launcher.agent.AgentHost.refresh(this)
|
||||
com.droiddeck.launcher.agent.AgentTab.load(this)
|
||||
com.droiddeck.launcher.ui.DeveloperTools.load(this)
|
||||
com.droiddeck.launcher.ui.NavTabs.load(this)
|
||||
com.droiddeck.launcher.ui.AgentPet.install(this)
|
||||
if (com.droiddeck.launcher.agent.AgentTab.visible) com.droiddeck.launcher.lab.LabNotice.openOnInstall = "agent"
|
||||
@@ -82,7 +85,7 @@ class App : Application() {
|
||||
Thread({
|
||||
runCatching {
|
||||
if (com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(app).isDirectory) {
|
||||
com.droiddeck.launcher.core.AddonPack.PROOT.ensure(app)
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -195,6 +195,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var showPhantomGate by mutableStateOf(false)
|
||||
private var directAudio by mutableStateOf(false)
|
||||
private var picturePosition by mutableStateOf("center")
|
||||
private var integerScaling by mutableStateOf(false)
|
||||
private var stretch16x9 by mutableStateOf(false)
|
||||
private var orientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)
|
||||
private var launcherOrientation by mutableStateOf(android.content.pm.ActivityInfo.SCREEN_ORIENTATION_USER)
|
||||
@@ -910,6 +911,16 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
|
||||
private fun readGameIntent(request: Intent) {
|
||||
request.getStringExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV)?.let { navRequest = it; request.removeExtra(com.droiddeck.launcher.stores.download.StoreDownloadService.EXTRA_NAV) }
|
||||
request.data?.takeIf { it.scheme == "droiddeck" && it.host == "settings" }?.let { uri ->
|
||||
val section = uri.pathSegments.firstOrNull()
|
||||
navRequest = if (section in setOf("storage", "sync", "downloads")) section
|
||||
else "settings:" + (com.droiddeck.launcher.ui.SettingsSection.of(section) ?: com.droiddeck.launcher.ui.SettingsSection.OVERVIEW).key
|
||||
request.data = null
|
||||
gameLinkReading = false
|
||||
pendingGameLink = null
|
||||
syncDualPanel()
|
||||
return
|
||||
}
|
||||
if (navRequest == com.droiddeck.launcher.core.AppUiPrefs.HOME_PAGE_APPS) {
|
||||
homeAppSelected = HomeApp.isHomeScreenEnabled(this) && HomeApp.isDefault(this)
|
||||
if (!homeAppSelected) navRequest = null
|
||||
@@ -1492,6 +1503,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
},
|
||||
onSaveExport = { sg, layout -> exportSaves(sg.name, layout) { GameSaves.game(sg) } },
|
||||
onPerformance = { refreshCores(); showComponents = false; showMapping = false; showPerformance = true },
|
||||
performancePanel = { PerformanceHost(embedded = true) },
|
||||
onRoms = { showRoms = true },
|
||||
onFiles = { startActivity(Intent(this, com.droiddeck.launcher.files.FileManagerActivity::class.java)) },
|
||||
onBrowseFiles = { dir ->
|
||||
@@ -1862,15 +1874,24 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
}
|
||||
|
||||
if (savedInstanceState == null) ui.post { startSteamAtStartupIfEnabled(cold = true) }
|
||||
else {
|
||||
val askAllFiles = Build.VERSION.SDK_INT >= 30 && com.droiddeck.launcher.files.AllFilesAccess.missing() &&
|
||||
!SessionPrefs.allFilesAsked(this)
|
||||
if (savedInstanceState == null) {
|
||||
if (!askAllFiles) ui.post { startSteamAtStartupIfEnabled(cold = true) }
|
||||
} else {
|
||||
restoreCompatLaunch(savedInstanceState)
|
||||
pendingSwitch = savedIntent(savedInstanceState, KEY_PENDING_SWITCH)
|
||||
savedIntent(savedInstanceState, KEY_SWITCHING_TO)?.let { awaitSessionEnd(it, savedInstanceState.getLong(KEY_SWITCH_DEADLINE)) }
|
||||
}
|
||||
|
||||
val wanted = ArrayList<String>()
|
||||
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
// From targetSdk 30, shared storage outside the app's own folders is all-files access or nothing.
|
||||
if (askAllFiles) {
|
||||
SessionPrefs.setAllFilesAsked(this)
|
||||
com.droiddeck.launcher.files.AllFilesAccess.open(this)
|
||||
}
|
||||
} else if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
wanted.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
if (SessionPrefs.micEnabled(this) && !SessionPrefs.micAsked(this)
|
||||
@@ -2551,6 +2572,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
backActionsInverted = backActionsInverted,
|
||||
directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null,
|
||||
picturePosition = if (mode == SessionService.MODE_STEAM) picturePosition else null,
|
||||
integerScaling = if (mode == SessionService.MODE_STEAM) integerScaling else null,
|
||||
stretch16x9 = if (mode == SessionService.MODE_STEAM) stretch16x9 else null,
|
||||
mic = if (mode == SessionService.MODE_STEAM) mic else null,
|
||||
gameStorage = if (mode == SessionService.MODE_STEAM) gameStorage else null,
|
||||
@@ -2612,6 +2634,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
},
|
||||
onDirectAudio = { on -> SessionPrefs.setDirectAudio(this, on); directAudio = on },
|
||||
onPicturePosition = { value -> SessionPrefs.setPicturePosition(this, value); picturePosition = value },
|
||||
onIntegerScaling = { on -> SessionPrefs.setIntegerScaling(this, on); integerScaling = on },
|
||||
onStretch16x9 = { on -> SessionPrefs.setStretch16x9(this, on); stretch16x9 = on },
|
||||
onMic = { on ->
|
||||
SessionPrefs.setMicEnabled(this, on)
|
||||
@@ -2692,7 +2715,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PerformanceHost() {
|
||||
private fun PerformanceHost(embedded: Boolean = false) {
|
||||
if (embedded) androidx.compose.runtime.LaunchedEffect(Unit) { refreshCores() }
|
||||
PerformancePage(
|
||||
cores = CpuCores.all.map { c -> CoreRow(c, "cpu$c" + (CpuCores.maxGhz(c)?.let { String.format(java.util.Locale.US, " · %.1f GHz", it) } ?: "")) },
|
||||
clientOverride = clientOverride, clientCores = clientCores, gameCores = gameCores, paceCores = paceCores,
|
||||
@@ -2738,6 +2762,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
SessionPrefs.setGameCpus(this, CpuCores.format(gameCores))
|
||||
},
|
||||
onDismiss = { showPerformance = false },
|
||||
embedded = embedded,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2949,6 +2974,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
backActionsInverted = SessionPrefs.backActionsInverted(this)
|
||||
directAudio = SessionPrefs.directAudio(this)
|
||||
picturePosition = SessionPrefs.picturePosition(this)
|
||||
integerScaling = SessionPrefs.integerScaling(this)
|
||||
stretch16x9 = SessionPrefs.stretch16x9(this)
|
||||
mic = SessionPrefs.micEnabled(this)
|
||||
refreshWifiDiscovery()
|
||||
@@ -3287,6 +3313,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
if (!ok) android.widget.Toast.makeText(this, R.string.setup_reset_settings_partial, android.widget.Toast.LENGTH_LONG).show()
|
||||
com.droiddeck.launcher.ui.Motion.refresh(this)
|
||||
com.droiddeck.launcher.agent.AgentTab.load(this)
|
||||
com.droiddeck.launcher.ui.DeveloperTools.load(this)
|
||||
com.droiddeck.launcher.ui.NavTabs.load(this)
|
||||
if (!switchLauncherIcon(LauncherIcon.DARK)) recreate()
|
||||
}
|
||||
|
||||
@@ -173,11 +173,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var adaptiveSticks by mutableStateOf<Boolean?>(null)
|
||||
private var quickButtons by mutableStateOf<Map<InputCommand, Boolean>>(emptyMap())
|
||||
private var picturePosition by mutableStateOf("center")
|
||||
private var integerScaling by mutableStateOf(false)
|
||||
|
||||
private fun applyGameAlignment() {
|
||||
if (!CompositorHost.isStarted) return
|
||||
val active = SessionState.mode == SessionService.MODE_STEAM &&
|
||||
!pipUi && !isInPictureInPictureMode && !cardboard.enabled
|
||||
!pipUi && !isInPictureInPictureMode && !activeCardboard.enabled
|
||||
val alignment = if (!active) ALIGN_CENTER else when (picturePosition) {
|
||||
"top" -> ALIGN_PICTURE_TOP
|
||||
"bottom" -> ALIGN_PICTURE_BOTTOM
|
||||
@@ -185,11 +186,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
"right" -> ALIGN_PICTURE_RIGHT
|
||||
else -> ALIGN_CENTER
|
||||
}
|
||||
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, alignment)
|
||||
WaylandCompositor.nativeSetScaleMode(if (active && integerScaling) SCALE_INTEGER else SCALE_FIT, alignment)
|
||||
}
|
||||
private var unfoldedPanel by mutableStateOf<OnScreenControls?>(null)
|
||||
private var unfoldedColumn: android.widget.LinearLayout? = null
|
||||
private var unfoldedDeckSurface: com.droiddeck.launcher.ui.InputSurfaceView? = null
|
||||
private var swappedInputSurface: com.droiddeck.launcher.ui.InputSurfaceView? = null
|
||||
private var unfoldedDeckPanel by mutableStateOf<com.droiddeck.launcher.input.DeckPanel?>(null)
|
||||
private var deckPanelLayouts: Map<com.droiddeck.launcher.input.DeckPanel, com.droiddeck.launcher.input.SavedInputLayout?> = emptyMap()
|
||||
private lateinit var sessionRoot: FrameLayout
|
||||
@@ -199,6 +201,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
@Volatile private var inputUsesLocalActions = false
|
||||
private var inputUsesPointer = false
|
||||
private var inputProfile = InputProfile.defaults(InputProfile.GAME)
|
||||
private var stockInputProfile = InputProfile.defaults(InputProfile.GAME)
|
||||
private val inputMotion = InputMotion { inputRouter }
|
||||
private val heldKeys = HeldInput { code, down -> WaylandCompositor.nativeSendKey(code, if (down) 1 else 0) }
|
||||
private val heldButtons = HeldInput(::sendSceneButton)
|
||||
@@ -499,6 +502,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var drawerGameProfileId by mutableStateOf<Long?>(null)
|
||||
private var drawerGameProfileSelectionMade = false
|
||||
private var fpsLimit by mutableStateOf(SessionState.fpsLimit)
|
||||
private var cornerTap by mutableStateOf(false)
|
||||
private fun fpsLimitKey(): String? = if (SessionState.running) SessionPrefs.fpsLimitKey(SessionState.mode, SessionState.gameId)
|
||||
else SessionPrefs.fpsLimitKey(intent.getStringExtra(SessionService.EXTRA_MODE), intent.getStringExtra(SessionService.EXTRA_GAME_ID))
|
||||
private var blackFrameInsertion by mutableStateOf(false)
|
||||
|
||||
private fun noSteamSession(): Boolean = (SessionState.mode == SessionService.MODE_RUN &&
|
||||
SessionState.program in setOf(
|
||||
@@ -537,6 +544,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var lastMouseY = Float.NaN
|
||||
private var padType by mutableStateOf(SessionPrefs.CONTROLLER_DECK)
|
||||
private var pcKeyboardOpen by mutableStateOf(false)
|
||||
private var fieldKeyboardOnPrimary = false
|
||||
private var pendingFieldKeyboard = false
|
||||
private var fieldKeyboardImeShown = false
|
||||
private var achievementsInFront by mutableStateOf<AchievementsInFront?>(null)
|
||||
private var achievementsOpen by mutableStateOf(false)
|
||||
private var hudOn by mutableStateOf(true)
|
||||
@@ -654,11 +664,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
override fun onDisplayAdded(displayId: Int) {
|
||||
notifyActivityDisplayStateChanged(displayId)
|
||||
refreshSecondScreenDisplays()
|
||||
updateBottomGame()
|
||||
}
|
||||
override fun onDisplayRemoved(displayId: Int) {
|
||||
if (refreshActivityDisplayId() && started) {
|
||||
SessionService.setActivityDisplay(this@SessionActivity, sessionActivityDisplayId)
|
||||
}
|
||||
updateBottomGame()
|
||||
refreshSecondScreenDisplays()
|
||||
}
|
||||
override fun onDisplayChanged(displayId: Int) {
|
||||
@@ -786,9 +798,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
com.droiddeck.launcher.gpu.SteamVrHealth.begin(this, SessionState.sessionId)
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
if (!SessionState.running) {
|
||||
SessionState.fpsLimit = 0
|
||||
fpsLimit = 0
|
||||
SessionState.fpsLimit = SessionPrefs.savedFpsLimit(this, fpsLimitKey())
|
||||
}
|
||||
fpsLimit = SessionState.fpsLimit
|
||||
cornerTap = SessionPrefs.drawerCornerTap(this)
|
||||
applyOutputPacing()
|
||||
if (!SessionState.running) {
|
||||
SessionState.followScreen = followChoice()
|
||||
@@ -848,6 +861,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
SteamControllerBle.listener = { uiHandler.post { updatePadMotion(); refreshControls() } }
|
||||
steamController = SteamControllerBle(this, inputRouter).also { it.start() }
|
||||
if (Build.VERSION.SDK_INT >= 31 && checkSelfPermission(BLUETOOTH_CONNECT) != android.content.pm.PackageManager.PERMISSION_GRANTED &&
|
||||
!SessionPrefs.bluetoothAsked(this)) {
|
||||
SessionPrefs.setBluetoothAsked(this)
|
||||
requestPermissions(arrayOf(BLUETOOTH_CONNECT), REQUEST_BLUETOOTH)
|
||||
}
|
||||
padMotion = com.droiddeck.launcher.input.PadMotion(this) {
|
||||
@Suppress("DEPRECATION")
|
||||
(if (Build.VERSION.SDK_INT >= 30) display else windowManager.defaultDisplay)?.rotation ?: android.view.Surface.ROTATION_0
|
||||
@@ -865,10 +883,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
root.addView(controls)
|
||||
}
|
||||
keyboard = KeyboardHost(this).also { host ->
|
||||
host.onImeChanged = { updateDesktopKeyboardButton() }
|
||||
host.onImeChanged = ::onPrimaryImeChanged
|
||||
root.addView(host)
|
||||
}
|
||||
desktopKeyboardButton = com.droiddeck.launcher.input.DesktopKeyboardButton(this) { keyboard?.show() }
|
||||
desktopKeyboardButton = com.droiddeck.launcher.input.DesktopKeyboardButton(this) { showPrimaryKeyboard() }
|
||||
.also { root.addView(it) }
|
||||
touchpad = TouchpadGestures(PointerGestures.slop(this), pointerListener)
|
||||
directTouchHold = DirectTouchHold(PointerGestures.slop(this), pointerListener, directTouchSink)
|
||||
@@ -886,6 +904,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
drawnRect()?.let { forwardTouch(event, it) }
|
||||
}
|
||||
override fun rightClick(x: Float, y: Float) {
|
||||
if (!screenTapsClick) return
|
||||
pointerListener.onLongPress()
|
||||
pointerListener.onButton(PointerGestures.BTN_RIGHT, true, x, y)
|
||||
surfaceView.postDelayed({ pointerListener.onButton(PointerGestures.BTN_RIGHT, false, x, y) }, 50L)
|
||||
@@ -1083,9 +1102,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (AgentGuest.keyboardDismissals != keyboardDismissalsSeen[0]) {
|
||||
keyboardDismissalsSeen[0] = AgentGuest.keyboardDismissals
|
||||
secondScreenPresentation?.closeFieldKeyboard()
|
||||
dismissFieldKeyboard()
|
||||
}
|
||||
}
|
||||
androidx.compose.runtime.LaunchedEffect(picturePosition, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
|
||||
androidx.compose.runtime.LaunchedEffect(picturePosition, integerScaling, SessionState.running, pipUi, cardboard.enabled) { applyGameAlignment() }
|
||||
DroidDeckTheme {
|
||||
if (pipUi) {
|
||||
if (SessionState.suspended) androidx.compose.foundation.layout.Box(
|
||||
@@ -1123,6 +1143,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
drawerPage = com.droiddeck.launcher.ui.SessionDrawerPage.GLASSES
|
||||
drawerOpen = true
|
||||
}
|
||||
if (!drawerOpen && !pcKeyboardOpen && !loading.visible) {
|
||||
com.droiddeck.launcher.ui.DrawerEntryHint(SessionState.mode == SessionService.MODE_STEAM, backActionsInverted) { drawerOpen = true }
|
||||
if (cornerTap) com.droiddeck.launcher.ui.DrawerCornerTap { drawerOpen = true }
|
||||
}
|
||||
if (loading.visible) LoadingOverlay(
|
||||
loading.step, loading.percent, loading.elapsed, loading.hint, loading.ended,
|
||||
topic = loading.topic, readable = loading.readable,
|
||||
@@ -1305,7 +1329,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
if (pcKeyboardOpen) com.droiddeck.launcher.ui.PcKeyboard(
|
||||
sendKey = { code, down -> if (CompositorHost.isStarted) sendGuestKey(code, down, 32) },
|
||||
onAndroidKeyboard = { pcKeyboardOpen = false; keyboard?.toggle() },
|
||||
onAndroidKeyboard = { pcKeyboardOpen = false; togglePrimaryKeyboard() },
|
||||
onClose = { pcKeyboardOpen = false },
|
||||
)
|
||||
if (!drawerDocked) SessionMenu(
|
||||
@@ -1429,6 +1453,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
secondScreenNone = !bottomOutputActive && !dockDrawer(),
|
||||
gameOnBottom = bottomOutputActive,
|
||||
gameSwapAvailable = bottomSwapAvailable,
|
||||
gameSwapBuiltIn = !::displayManager.isInitialized || displayManager.getDisplay(selectedSecondScreenDisplay)
|
||||
?.let(com.droiddeck.launcher.input.DualScreen::builtIn) ?: true,
|
||||
onGameOnBottom = { on -> drawerOpen = false; putGameOnBottom(on) },
|
||||
dashboardAvailable = bottomPages().isNotEmpty(),
|
||||
desktopAvailable = com.droiddeck.launcher.session.BottomDesktop.available(),
|
||||
@@ -1440,6 +1466,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onHudReset = { hudConfig = DroidDeckHudConfig.reset(this@SessionActivity); hud.applyConfig() },
|
||||
onHudOrderReset = { hudConfig = DroidDeckHudConfig.clearOrder(this@SessionActivity); hud.applyConfig() },
|
||||
onHudExport = { exportHudDiagnostics() },
|
||||
integerScaling = integerScaling,
|
||||
onIntegerScaling = { enabled ->
|
||||
SessionPrefs.setIntegerScaling(this@SessionActivity, enabled)
|
||||
integerScaling = enabled
|
||||
applyGameAlignment()
|
||||
},
|
||||
onUpscaler = { m ->
|
||||
val target = effectsEditorTarget ?: screenEffectsTarget
|
||||
val activeProfileId =
|
||||
@@ -1585,8 +1617,18 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onFpsLimit = { fps ->
|
||||
SessionState.fpsLimit = fps
|
||||
fpsLimit = fps
|
||||
SessionPrefs.saveFpsLimit(this@SessionActivity, fpsLimitKey(), fps)
|
||||
applyOutputPacing()
|
||||
},
|
||||
cornerTap = cornerTap,
|
||||
onCornerTap = { on -> SessionPrefs.setDrawerCornerTap(this@SessionActivity, on); cornerTap = on },
|
||||
blackFrameInsertion = blackFrameInsertion,
|
||||
blackFrameInsertionAvailable = blackFrameInsertion || blackFrameInsertionAvailable(),
|
||||
onBlackFrameInsertion = { on ->
|
||||
SessionPrefs.setBlackFrameInsertion(this@SessionActivity, on)
|
||||
blackFrameInsertion = on
|
||||
CompositorHost.setBlackFrameInsertion(on, refreshHz(), outputFpsLimit())
|
||||
},
|
||||
onFrameGenPick = { mode ->
|
||||
val appId = frameGenTargetGameId()
|
||||
|
||||
@@ -1609,7 +1651,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
pickLossless.launch(InAppFilePicker.buildIntent(
|
||||
this@SessionActivity, listOf("dll"), getString(R.string.lsfg_pick_title)))
|
||||
},
|
||||
onKeyboard = { drawerOpen = false; pcKeyboardOpen = false; keyboard?.toggle() },
|
||||
onKeyboard = { drawerOpen = false; pcKeyboardOpen = false; togglePrimaryKeyboard() },
|
||||
onHardwareKeyboard = ::togglePcKeyboard,
|
||||
wowChatShown = com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram),
|
||||
wowChat = wowChat.remembered,
|
||||
@@ -1840,7 +1882,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val all = com.droiddeck.launcher.input.VrControllers.Emulate.entries
|
||||
com.droiddeck.launcher.input.VrControllers.setEmulate(this, all[(pads.emulate.ordinal + 1) % all.size])
|
||||
}) else null,
|
||||
onKeyboard = { keyboard?.toggle() },
|
||||
onKeyboard = { togglePrimaryKeyboard() },
|
||||
onSessionMenu = { drawerOpen = true },
|
||||
onStopSteamVr = if (vr) ({ steamVrAction("stop") }) else null,
|
||||
brightness = glasses.brightness,
|
||||
@@ -1881,12 +1923,44 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun togglePcKeyboard() {
|
||||
drawerOpen = false
|
||||
keyboard?.hide()
|
||||
hidePrimaryKeyboard()
|
||||
onScreenControls?.releaseAll()
|
||||
bottomInputControls?.releaseAll()
|
||||
pcKeyboardOpen = !pcKeyboardOpen
|
||||
}
|
||||
|
||||
private fun showPrimaryKeyboard() {
|
||||
pendingFieldKeyboard = false
|
||||
fieldKeyboardOnPrimary = false
|
||||
keyboard?.show()
|
||||
}
|
||||
|
||||
private fun togglePrimaryKeyboard() {
|
||||
pendingFieldKeyboard = false
|
||||
fieldKeyboardOnPrimary = false
|
||||
keyboard?.toggle()
|
||||
}
|
||||
|
||||
private fun hidePrimaryKeyboard() {
|
||||
pendingFieldKeyboard = false
|
||||
fieldKeyboardOnPrimary = false
|
||||
keyboard?.hide()
|
||||
}
|
||||
|
||||
private fun onPrimaryImeChanged(visible: Boolean) {
|
||||
if (visible) fieldKeyboardImeShown = true
|
||||
else if (fieldKeyboardImeShown) {
|
||||
fieldKeyboardImeShown = false
|
||||
fieldKeyboardOnPrimary = false
|
||||
}
|
||||
updateDesktopKeyboardButton()
|
||||
}
|
||||
|
||||
private fun dismissFieldKeyboard() {
|
||||
pendingFieldKeyboard = false
|
||||
if (fieldKeyboardOnPrimary) hidePrimaryKeyboard()
|
||||
}
|
||||
|
||||
private fun updateControllerPrefs(change: () -> Unit) {
|
||||
change()
|
||||
controllerSettings = ControllerPrefs.read(this)
|
||||
@@ -2399,7 +2473,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
unfoldedControls = SessionPrefs.unfoldedControls(this)
|
||||
unfoldedControlsWithController = SessionPrefs.unfoldedControlsWithController(this)
|
||||
picturePosition = SessionPrefs.picturePosition(this)
|
||||
integerScaling = SessionPrefs.integerScaling(this)
|
||||
hudOn = SessionPrefs.hudEnabled(this)
|
||||
blackFrameInsertion = SessionPrefs.blackFrameInsertion(this)
|
||||
hudConfig = DroidDeckHudConfig.load(this)
|
||||
hudColor = SessionPrefs.hudColor(this)
|
||||
hudOpacity = SessionPrefs.hudOpacity(this)
|
||||
@@ -2654,7 +2730,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
runCatching { GameEnvironmentStore.publish(this) }
|
||||
.onFailure { Log.e(TAG, "Could not update game environment", it) }
|
||||
}, "game-env-publish").start()
|
||||
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, ALIGN_CENTER)
|
||||
applyGameAlignment()
|
||||
val activeProfileId = currentScreenEffectsProfileId()
|
||||
val activeUpscaler = SessionPrefs.screenEffectsUpscaler(this, activeProfileId)
|
||||
val activeEffects = SessionPrefs.screenEffects(this, activeProfileId)
|
||||
@@ -2669,7 +2745,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val waylandLog = File(SessionPaths.beginOrCurrent(this), "wayland.log")
|
||||
WaylandCompositor.setSessionLogFile(waylandLog)
|
||||
try {
|
||||
android.system.Os.setenv("BL_WAYLAND_LOG", waylandLog.path, true)
|
||||
android.system.Os.setenv("DD_WAYLAND_LOG", waylandLog.path, true)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "could not point the compositor's log at $waylandLog", e)
|
||||
}
|
||||
@@ -2862,13 +2938,25 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val display = if (Build.VERSION.SDK_INT >= 30) display else windowManager.defaultDisplay
|
||||
val wanted = window.attributes.preferredDisplayModeId
|
||||
val requested = display?.supportedModes?.firstOrNull { wanted != 0 && it.modeId == wanted }?.refreshRate
|
||||
val running = display?.refreshRate?.takeIf { it > 1f }
|
||||
// Display.refreshRate reports a per-app frame rate override (Game Mode FPS) instead of the panel's mode.
|
||||
val running = display?.mode?.refreshRate?.takeIf { it > 1f }
|
||||
val hz = listOfNotNull(requested, running).minOrNull() ?: 60f
|
||||
val mirrorCap = mirrorRefreshLimit().takeIf { it > 0 }?.toFloat() ?: Float.POSITIVE_INFINITY
|
||||
val capped = minOf(hz, PerfMode.peakRefreshCap(this), mirrorCap)
|
||||
return if (capped > 1f) capped else 60f
|
||||
}
|
||||
|
||||
private fun blackFrameInsertionAvailable(): Boolean {
|
||||
// Glasses that present the game run at their own rate, uncapped, as refreshHz() reads them.
|
||||
glassesScreen?.display?.let { glasses ->
|
||||
return (glasses.supportedModes?.maxOfOrNull { it.refreshRate } ?: 0f) >= PerfMode.BFI_MIN_REFRESH_HZ
|
||||
}
|
||||
val display = bottomGame?.takeIf { bottomOutputActive }?.display
|
||||
?: if (Build.VERSION.SDK_INT >= 30) display else @Suppress("DEPRECATION") windowManager.defaultDisplay
|
||||
val peak = display?.supportedModes?.maxOfOrNull { it.refreshRate } ?: 0f
|
||||
return minOf(peak, PerfMode.peakRefreshCap(this)) >= PerfMode.BFI_MIN_REFRESH_HZ
|
||||
}
|
||||
|
||||
private fun mirrorRefreshLimit(): Int =
|
||||
GlassesRendering.mirrorRefreshLimit(glassesSettings, glasses, glassesScreen != null)
|
||||
|
||||
@@ -3105,6 +3193,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun onSessionEnded(status: Int) {
|
||||
ended = true
|
||||
uiHandler.removeCallbacks(guardWhenRunning)
|
||||
com.droiddeck.launcher.session.KeepTopActivity.release()
|
||||
++steamVrRequestGeneration
|
||||
if (isInPictureInPictureMode) {
|
||||
runOnUiThread { finish() }
|
||||
@@ -3623,7 +3713,6 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return false
|
||||
return try {
|
||||
val presentation = secondScreenPresentation ?: secondScreenPresentation(target).also {
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
secondScreenPresentation = it
|
||||
}
|
||||
if (!presentation.isShowing) presentation.show()
|
||||
@@ -3982,16 +4071,23 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val candidates = SecondScreenDisplays.available(displayManager, primaryId)
|
||||
.filter { glassesScreen == null || it.id != glasses.displayId }
|
||||
val oldIds = secondScreenDisplays.map { it.id }.toSet()
|
||||
val oldSelectedDisplay = selectedSecondScreenDisplay
|
||||
secondScreenDisplays = candidates
|
||||
reconcileDock(primaryId)
|
||||
bottomSwapAvailable = bottomGame != null || bottomGameDisplay() != null
|
||||
val newIds = candidates.map { it.id }.toSet()
|
||||
if (secondScreenMode != SecondScreenMode.NONE && oldIds.isNotEmpty() && selectedSecondScreenDisplay !in newIds) {
|
||||
bottomSwapAvailable = bottomGame != null
|
||||
closeSecondScreen(reset = true)
|
||||
SessionState.secondScreenAutoOpened = false
|
||||
return
|
||||
}
|
||||
if (selectedSecondScreenDisplay !in newIds) selectedSecondScreenDisplay = candidates.firstOrNull()?.id ?: -1
|
||||
selectedSecondScreenDisplay = SecondScreenDisplays.selection(selectedSecondScreenDisplay, candidates.map { it.id }, gameOnBottom) {
|
||||
SessionState.secondScreenDisplay = it
|
||||
}
|
||||
if (selectedSecondScreenDisplay != oldSelectedDisplay) {
|
||||
updateBottomGame()
|
||||
}
|
||||
bottomSwapAvailable = bottomGame != null || bottomGameDisplay() != null
|
||||
if (secondScreenMode != SecondScreenMode.NONE && candidates.isEmpty()) {
|
||||
closeSecondScreen(reset = true)
|
||||
SessionState.secondScreenAutoOpened = false
|
||||
@@ -4013,12 +4109,22 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun openDualScreenControls() {
|
||||
if (SessionState.secondScreenAutoOpened || secondScreenMode != SecondScreenMode.NONE || pipUi) return
|
||||
if (gameOnBottom && selectedSecondScreenDisplay >= 0 && secondScreenDisplays.none { it.id == selectedSecondScreenDisplay }) return
|
||||
if (!SessionPrefs.dualScreenSessionControls(this)) return
|
||||
val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return
|
||||
if (secondScreenDisplays.none { it.id == target.displayId }) return
|
||||
val gameDisplay = bottomGame?.display?.displayId
|
||||
?: if (SessionState.gameOnBottom) bottomGameDisplay()?.displayId else null
|
||||
SessionState.secondScreenAutoOpened = true
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
selectSecondScreenMode(openingPanel())
|
||||
if (gameDisplay != null && gameDisplay != target.displayId && secondScreenDisplays.any { it.id == gameDisplay }) {
|
||||
panelMode(openingPanel())
|
||||
} else {
|
||||
val selectionChanged = selectedSecondScreenDisplay != target.displayId
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
SessionState.secondScreenDisplay = target.displayId
|
||||
if (selectionChanged) updateBottomGame()
|
||||
selectSecondScreenMode(openingPanel())
|
||||
}
|
||||
automaticPanel = secondScreenMode != SecondScreenMode.NONE
|
||||
dualControlsProvisional = ::loading.isInitialized && loading.visible
|
||||
}
|
||||
@@ -4044,6 +4150,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (secondScreenDisplays.none { it.id == displayId }) return
|
||||
selectedSecondScreenDisplay = displayId
|
||||
SessionState.secondScreenDisplay = displayId
|
||||
updateBottomGame()
|
||||
if (secondScreenMode != SecondScreenMode.NONE) showSecondScreen(secondScreenMode)
|
||||
}
|
||||
|
||||
@@ -4062,6 +4169,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
return
|
||||
}
|
||||
if (selectedSecondScreenDisplay !in secondScreenDisplays.map { it.id }) {
|
||||
if (gameOnBottom && selectedSecondScreenDisplay >= 0) {
|
||||
panelMode(mode)
|
||||
return
|
||||
}
|
||||
selectedSecondScreenDisplay = secondScreenDisplays.first().id
|
||||
}
|
||||
showSecondScreen(mode)
|
||||
@@ -4140,7 +4251,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
)
|
||||
}
|
||||
},
|
||||
onSwap = if (bottomSwapAvailable && com.droiddeck.launcher.input.DualScreen.builtIn(target)) ({ putGameOnBottom(true) }) else null,
|
||||
onSwap = if (bottomSwapAvailable) ({ putGameOnBottom(true) }) else null,
|
||||
onDeckPanel = ::selectDeckPanel,
|
||||
dashboard = if (bottomPages().isEmpty()) null else ({
|
||||
DroidDeckTheme {
|
||||
@@ -4192,19 +4303,35 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onFrame(null)
|
||||
return
|
||||
}
|
||||
try {
|
||||
android.view.PixelCopy.request(source, bitmap, { result ->
|
||||
if (result != android.view.PixelCopy.SUCCESS) {
|
||||
bitmap.recycle()
|
||||
onFrame(null)
|
||||
} else onFrame(bitmap)
|
||||
}, uiHandler)
|
||||
} catch (_: IllegalArgumentException) {
|
||||
bitmap.recycle()
|
||||
onFrame(null)
|
||||
withPictureFrame { done ->
|
||||
try {
|
||||
android.view.PixelCopy.request(source, bitmap, { result ->
|
||||
done()
|
||||
if (result != android.view.PixelCopy.SUCCESS) {
|
||||
bitmap.recycle()
|
||||
onFrame(null)
|
||||
} else onFrame(bitmap)
|
||||
}, uiHandler)
|
||||
} catch (_: IllegalArgumentException) {
|
||||
done()
|
||||
bitmap.recycle()
|
||||
onFrame(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** PixelCopy reads the last queued buffer, which black frame insertion makes black every other refresh. */
|
||||
private fun withPictureFrame(copy: (done: () -> Unit) -> Unit) {
|
||||
if (!CompositorHost.holdPicture()) return copy {}
|
||||
uiHandler.postDelayed({
|
||||
var released = false
|
||||
copy {
|
||||
if (!released) CompositorHost.releasePicture()
|
||||
released = true
|
||||
}
|
||||
}, BFI_PICTURE_SETTLE_MS)
|
||||
}
|
||||
|
||||
private fun tapSteamButton() {
|
||||
if (SessionState.mode == SessionService.MODE_STEAM) padBridge?.triggerSteamMenu()
|
||||
}
|
||||
@@ -4228,6 +4355,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val library = com.droiddeck.launcher.input.InputLibraries.read(this)
|
||||
val desktop = loadingMode() == SessionService.MODE_DESKTOP
|
||||
inputProfile = library.compileActive(desktop, secondScreenMode.panel(this))
|
||||
stockInputProfile = library.compileStock(desktop, secondScreenMode.panel(this))
|
||||
primaryInputLayout = library.activeLayout(desktop, InputRole.PRIMARY)
|
||||
adaptiveSticks = primaryInputLayout?.adaptiveSticks
|
||||
quickButtons = primaryInputLayout?.takeIf { it.editable }?.let { l -> l.quickButtons.associateWith { it !in l.style.hidden } }.orEmpty()
|
||||
@@ -4367,6 +4495,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (!started) return null
|
||||
if (secondScreenPresentation?.showsKeyboard != true && dockDrawer()) {
|
||||
val target = com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId) ?: return null
|
||||
if (gameOnBottom && selectedSecondScreenDisplay != target.displayId) return null
|
||||
if (drawerOpen || drawerPinned) drawerOpen = false
|
||||
typingReturnMode = secondScreenMode
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
@@ -4376,16 +4505,37 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
private fun openBottomKeyboard() {
|
||||
val presentation = bottomKeyboardPresentation() ?: return
|
||||
val presentation = bottomKeyboardPresentation()
|
||||
if (presentation == null) {
|
||||
if (keyboardBelongsOnPrimary()) {
|
||||
pendingFieldKeyboard = true
|
||||
retryFieldKeyboard(hasWindowFocus())
|
||||
}
|
||||
return
|
||||
}
|
||||
pendingFieldKeyboard = false
|
||||
if (fieldKeyboardOnPrimary) hidePrimaryKeyboard()
|
||||
presentation.requestKeyboard(forField = true)
|
||||
com.droiddeck.launcher.ui.SessionTyping.focusDisplay(this, presentation.display.displayId)
|
||||
}
|
||||
|
||||
private fun keyboardBelongsOnPrimary() = SecondScreenDisplays.keyboardOnPrimary(gameOnBottom, selectedSecondScreenDisplay,
|
||||
secondScreenDisplays.map { it.id }, taken = com.droiddeck.launcher.input.DualScreen::taken)
|
||||
|
||||
private fun retryFieldKeyboard(hasFocus: Boolean) {
|
||||
if (!pendingFieldKeyboard || !hasFocus || !resumed || pipUi) return
|
||||
pendingFieldKeyboard = false
|
||||
if (!keyboardBelongsOnPrimary()) return
|
||||
fieldKeyboardOnPrimary = true
|
||||
fieldKeyboardImeShown = keyboard?.hideMeansDismissal == true
|
||||
keyboard?.show()
|
||||
}
|
||||
|
||||
private fun onGameTextField(focused: Boolean) {
|
||||
if (!focused || !com.droiddeck.launcher.ui.WowChat.isWow(AgentGuest.gameProgram)) wowChat.chatClosed()
|
||||
else if (resumed && !pipUi && !pcKeyboardOpen &&
|
||||
resources.configuration.hardKeyboardHidden != android.content.res.Configuration.HARDKEYBOARDHIDDEN_NO) {
|
||||
keyboard?.takeIf { it.shown }?.hide()
|
||||
hidePrimaryKeyboard()
|
||||
wowChat.chatOpened()
|
||||
}
|
||||
}
|
||||
@@ -4472,9 +4622,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
private fun updateKeyboardRoute() {
|
||||
AgentGuest.routeKeyboard(this, SessionState.mode == SessionService.MODE_STEAM &&
|
||||
(secondScreenPresentation?.showsKeyboard == true || dockDrawer()) &&
|
||||
SessionPrefs.androidTextFieldKeyboard(this))
|
||||
AgentGuest.routeKeyboard(this, SecondScreenDisplays.routeKeyboard(
|
||||
SessionState.mode == SessionService.MODE_STEAM,
|
||||
SessionPrefs.androidTextFieldKeyboard(this),
|
||||
secondScreenPresentation?.showsKeyboard == true,
|
||||
dockDrawer(),
|
||||
SecondScreenDisplays.keyboardOnPrimary(gameOnBottom, selectedSecondScreenDisplay,
|
||||
secondScreenDisplays.map { it.id }, resumed && !pipUi, com.droiddeck.launcher.input.DualScreen::taken)))
|
||||
}
|
||||
|
||||
private fun dropDockedDrawer() {
|
||||
@@ -4636,25 +4790,18 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
gamePictureBounds[2], gamePictureBounds[3]
|
||||
)
|
||||
|
||||
val nativeWidth: Int
|
||||
val nativeHeight: Int
|
||||
if (glassesOutputActive) {
|
||||
val mode = glassesScreen?.display?.mode ?: return null
|
||||
val outputWidth = mode.physicalWidth.takeIf { it > 0 } ?: return null
|
||||
val outputHeight = mode.physicalHeight.takeIf { it > 0 } ?: return null
|
||||
val scaleX = width.toFloat() / outputWidth
|
||||
val scaleY = height.toFloat() / outputHeight
|
||||
|
||||
return android.graphics.RectF(
|
||||
rect.left * scaleX,
|
||||
rect.top * scaleY,
|
||||
rect.right * scaleX,
|
||||
rect.bottom * scaleY
|
||||
)
|
||||
nativeWidth = mode.physicalWidth.takeIf { it > 0 } ?: return null
|
||||
nativeHeight = mode.physicalHeight.takeIf { it > 0 } ?: return null
|
||||
} else {
|
||||
val nativeSize = IntArray(2)
|
||||
if (!WaylandCompositor.nativeOutputSize(nativeSize)) return null
|
||||
nativeWidth = nativeSize[0].takeIf { it > 0 } ?: return null
|
||||
nativeHeight = nativeSize[1].takeIf { it > 0 } ?: return null
|
||||
}
|
||||
|
||||
val nativeSize = IntArray(2)
|
||||
if (!WaylandCompositor.nativeOutputSize(nativeSize)) return null
|
||||
val nativeWidth = nativeSize[0].takeIf { it > 0 } ?: return null
|
||||
val nativeHeight = nativeSize[1].takeIf { it > 0 } ?: return null
|
||||
val scaleX = width.toFloat() / nativeWidth
|
||||
val scaleY = height.toFloat() / nativeHeight
|
||||
|
||||
@@ -4692,6 +4839,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var lockedSwipeY = 0f
|
||||
private var dismissTouch = false
|
||||
private var sessionTouchDown = false
|
||||
private var screenTapsClick = true
|
||||
|
||||
private fun onScreenMouseButtonShown(): Boolean = listOfNotNull(
|
||||
onScreenControls?.inputSurface, bottomInputControls?.inputSurface, unfoldedPanel?.inputSurface, unfoldedDeckSurface,
|
||||
secondScreenPresentation?.controlsView, swappedInputSurface,
|
||||
).any { it.isShown && inputProfile.showsMouseButton(it.inputRole, it.shownElements, stockInputProfile) }
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
val pen = PenStream.penIndex(event)
|
||||
@@ -4724,6 +4877,11 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
val snapshot = fingerTouchSnapshot(uiBlocking)
|
||||
val route = com.droiddeck.launcher.input.TouchRouter.decide(snapshot)
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||
screenTapsClick = !onScreenMouseButtonShown()
|
||||
if (::touchpad.isInitialized) touchpad.clicks = screenTapsClick
|
||||
if (::scrollTouch.isInitialized) scrollTouch.clicks = screenTapsClick
|
||||
}
|
||||
if (route != touchRoute) {
|
||||
Log.i(TAG, "touch route $touchRoute -> $route (mode=$routedTouchMode steamUi=${SessionState.steamUi} scrollLayer=$scrollTouchGesture)")
|
||||
touchRoute = route
|
||||
@@ -4863,7 +5021,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private fun dispatchDirectTouch(event: MotionEvent): Boolean {
|
||||
val rect = drawnRect() ?: return false
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN)
|
||||
ignoreGameTouch = topPictureMapped && !rect.contains(event.x, event.y)
|
||||
ignoreGameTouch = topPictureMapped && !glassesOutputActive &&
|
||||
!rect.contains(event.x, event.y)
|
||||
if (ignoreGameTouch) {
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||
directTouchHold.cancel()
|
||||
@@ -4872,6 +5031,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (event.actionMasked == MotionEvent.ACTION_UP || event.actionMasked == MotionEvent.ACTION_CANCEL) ignoreGameTouch = false
|
||||
return true
|
||||
}
|
||||
// With an on-screen mouse button the press comes from the button, so the pointer has to be there before
|
||||
// the two-finger gesture buffer holds the touch-down.
|
||||
if (SessionState.mode == SessionService.MODE_DESKTOP && !screenTapsClick && !pointerLocked &&
|
||||
event.actionMasked == MotionEvent.ACTION_DOWN) movePointer(event.x, event.y)
|
||||
if (SessionState.mode == SessionService.MODE_DESKTOP && twoFingerGestures.onTouch(event)) return true
|
||||
return forwardTouch(event, rect)
|
||||
}
|
||||
@@ -4906,7 +5069,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
}
|
||||
directTouchHold.onTouch(event)
|
||||
if (screenTapsClick) directTouchHold.onTouch(event)
|
||||
else if (!pointerLocked && (event.actionMasked == MotionEvent.ACTION_DOWN || event.actionMasked == MotionEvent.ACTION_MOVE))
|
||||
movePointer(event.x, event.y)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -5315,17 +5480,21 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val left = surfaceAt[0] - overlayAt[0]
|
||||
val top = surfaceAt[1] - overlayAt[1]
|
||||
val bounds = android.graphics.Rect(left, top, left + width, top + height)
|
||||
try {
|
||||
android.view.PixelCopy.request(surfaceView, bitmap, { result ->
|
||||
if (result == android.view.PixelCopy.SUCCESS && !isDestroyed) {
|
||||
pausedFrame = com.droiddeck.launcher.ui.PausedFrame(bitmap.asImageBitmap(), bounds)
|
||||
pausedFrameWanted = false
|
||||
} else {
|
||||
bitmap.recycle()
|
||||
}
|
||||
}, uiHandler)
|
||||
} catch (_: IllegalArgumentException) {
|
||||
bitmap.recycle()
|
||||
withPictureFrame { done ->
|
||||
try {
|
||||
android.view.PixelCopy.request(surfaceView, bitmap, { result ->
|
||||
done()
|
||||
if (result == android.view.PixelCopy.SUCCESS && !isDestroyed) {
|
||||
pausedFrame = com.droiddeck.launcher.ui.PausedFrame(bitmap.asImageBitmap(), bounds)
|
||||
pausedFrameWanted = false
|
||||
} else {
|
||||
bitmap.recycle()
|
||||
}
|
||||
}, uiHandler)
|
||||
} catch (_: IllegalArgumentException) {
|
||||
done()
|
||||
bitmap.recycle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5358,6 +5527,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun showPipUi(show: Boolean) {
|
||||
pipUi = show
|
||||
updateKeyboardRoute()
|
||||
if (!show) retryFieldKeyboard(hasWindowFocus())
|
||||
if (show) {
|
||||
if (::hud.isInitialized) hud.setHidden(true)
|
||||
drawerOpen = false
|
||||
@@ -5377,7 +5548,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
guestKeysDown.toList().forEach { sendGuestKey(it, false) }
|
||||
heldKeys.clear()
|
||||
heldButtons.clear()
|
||||
keyboard?.hide()
|
||||
hidePrimaryKeyboard()
|
||||
sessionClipboard.stop()
|
||||
padMotion?.stop()
|
||||
cursorVisible = false
|
||||
@@ -5389,7 +5560,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
listOf(PointerGestures.BTN_LEFT, PointerGestures.BTN_RIGHT, PointerGestures.BTN_MIDDLE).forEach {
|
||||
heldButtons.set(1, it, false)
|
||||
}
|
||||
WaylandCompositor.nativeSetScaleMode(SCALE_FIT, ALIGN_CENTER)
|
||||
applyGameAlignment()
|
||||
}
|
||||
} else if (!isFinishing && !isDestroyed) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
@@ -5418,7 +5589,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
override fun startActivityForResult(intent: Intent, requestCode: Int, options: Bundle?) {
|
||||
if (::pip.isInitialized && (requestCode >= 0 || intent.component?.packageName == packageName ||
|
||||
if (::pip.isInitialized && intent.component?.className != com.droiddeck.launcher.session.KeepTopActivity::class.java.name &&
|
||||
(requestCode >= 0 || intent.component?.packageName == packageName ||
|
||||
intent.action in setOf(Intent.ACTION_CHOOSER, Intent.ACTION_SEND, Intent.ACTION_OPEN_DOCUMENT,
|
||||
Intent.ACTION_GET_CONTENT, "android.settings.PICTURE_IN_PICTURE_SETTINGS"))) pip.background()
|
||||
super.startActivityForResult(intent, requestCode, options)
|
||||
@@ -5450,6 +5622,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
if (lightPause.stopped()) departureCleanup()
|
||||
if (runtimeRemovalBlocked) { super.onStop(); return }
|
||||
started = false
|
||||
if (::hud.isInitialized) hud.setBackgrounded(true)
|
||||
@@ -5493,6 +5666,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
uiHandler.removeCallbacks(lightPauseCheck)
|
||||
when (lightPause.resumed(com.droiddeck.launcher.session.KeepTopActivity.bounces)) {
|
||||
com.droiddeck.launcher.session.LightPause.Resume.LIGHT -> return
|
||||
com.droiddeck.launcher.session.LightPause.Resume.CLEANUP_FIRST -> departureCleanup()
|
||||
com.droiddeck.launcher.session.LightPause.Resume.NORMAL -> Unit
|
||||
}
|
||||
drawerGameInventoryRevision++
|
||||
com.droiddeck.launcher.input.SystemKeyCapture.attach(this, { hasWindowFocus() && !appUiOwnsPointer() && CompositorHost.isStarted }) { event ->
|
||||
com.droiddeck.launcher.input.GuestKeys.send(event) { code, down -> sendGuestKey(code, down, 8) }
|
||||
@@ -5520,6 +5699,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
onScreenControls?.reload()
|
||||
controllerSettings = ControllerPrefs.read(this)
|
||||
resumed = true
|
||||
updateKeyboardRoute()
|
||||
retryFieldKeyboard(hasWindowFocus())
|
||||
updateDesktopKeyboardButton()
|
||||
com.droiddeck.launcher.input.HomeButtonShortcuts.attach(this,
|
||||
enabled = {
|
||||
@@ -5556,10 +5737,63 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
SessionPrefs.sessionPrefs(this).registerOnSharedPreferenceChangeListener(cardboardPrefListener)
|
||||
}
|
||||
|
||||
private var memoryPressureAt = 0L
|
||||
private var focusBounce = false
|
||||
private val lightPause = com.droiddeck.launcher.session.LightPause()
|
||||
private val lightPauseCheck = Runnable { if (lightPause.timedOut()) departureCleanup() }
|
||||
private var topResumed = false
|
||||
private val guardWhenRunning = object : Runnable {
|
||||
override fun run() {
|
||||
if (!topResumed || isFinishing) return
|
||||
if (SessionState.running) guardOtherDisplays() else uiHandler.postDelayed(this, 2_000)
|
||||
}
|
||||
}
|
||||
|
||||
// RUNNING_LOW and RUNNING_CRITICAL are not delivered from API 34, so the guard also goes up
|
||||
// as soon as a running session is on top.
|
||||
override fun onTrimMemory(level: Int) {
|
||||
super.onTrimMemory(level)
|
||||
if (!com.droiddeck.launcher.session.TopUnderPressure.isPressure(level)) return
|
||||
memoryPressureAt = android.os.SystemClock.elapsedRealtime()
|
||||
guardOtherDisplays()
|
||||
}
|
||||
|
||||
override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) {
|
||||
super.onTopResumedActivityChanged(isTopResumedActivity)
|
||||
topResumed = isTopResumedActivity
|
||||
uiHandler.removeCallbacks(guardWhenRunning)
|
||||
if (isTopResumedActivity) uiHandler.post(guardWhenRunning)
|
||||
else if (com.droiddeck.launcher.session.TopUnderPressure.shouldReclaim(
|
||||
android.os.SystemClock.elapsedRealtime(), memoryPressureAt, SessionState.running, isFinishing)) guardOtherDisplays()
|
||||
}
|
||||
|
||||
private fun guardOtherDisplays() {
|
||||
if (!SessionState.running || isFinishing) return
|
||||
val wasResumed = lifecycle.currentState.isAtLeast(androidx.lifecycle.Lifecycle.State.RESUMED)
|
||||
val bounced = com.droiddeck.launcher.session.KeepTopActivity.guardOtherDisplays(this, display?.displayId ?: android.view.Display.DEFAULT_DISPLAY)
|
||||
if (com.droiddeck.launcher.session.KeepTopActivity.hasPendingStarts()) {
|
||||
uiHandler.removeCallbacks(guardWhenRunning)
|
||||
uiHandler.postDelayed(guardWhenRunning, com.droiddeck.launcher.session.KeepTopActivity.RETRY_MS)
|
||||
}
|
||||
if (!bounced) return
|
||||
if (!wasResumed) return
|
||||
focusBounce = true
|
||||
uiHandler.postDelayed({ focusBounce = false }, 500)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
if (focusBounce) {
|
||||
focusBounce = false
|
||||
lightPause.paused(com.droiddeck.launcher.session.KeepTopActivity.bounces)
|
||||
uiHandler.postDelayed(lightPauseCheck, 200)
|
||||
} else departureCleanup()
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun departureCleanup() {
|
||||
com.droiddeck.launcher.input.SystemKeyCapture.detach(this)
|
||||
com.droiddeck.launcher.input.HomeButtonShortcuts.detach(this)
|
||||
if (runtimeRemovalBlocked) { super.onPause(); return }
|
||||
if (runtimeRemovalBlocked) return
|
||||
physicalShortcuts.clear()
|
||||
backQamInput.cancel()
|
||||
mouseBackInput.cancel()
|
||||
@@ -5593,14 +5827,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
||||
if (::padMouse.isInitialized) padMouse.reset()
|
||||
resumed = false
|
||||
updateKeyboardRoute()
|
||||
updatePointerCapture()
|
||||
updatePadMotion()
|
||||
keyboard?.takeIf { it.shown }?.hide()
|
||||
val pendingKeyboard = pendingFieldKeyboard
|
||||
hidePrimaryKeyboard()
|
||||
pendingFieldKeyboard = pendingKeyboard
|
||||
SessionPrefs.sessionPrefs(this).unregisterOnSharedPreferenceChangeListener(cardboardPrefListener)
|
||||
SessionPrefs.sessionPrefs(this).unregisterOnSharedPreferenceChangeListener(screenEffectsProfilePrefListener)
|
||||
ControllerPrefs.prefs(this).unregisterOnSharedPreferenceChangeListener(shortcutPrefListener)
|
||||
updateHeadTracker()
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun steamVrAction(action: String) {
|
||||
@@ -5750,6 +5986,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
cardboard = c
|
||||
val e = effectiveCardboard(c)
|
||||
activeCardboard = e
|
||||
applyGameAlignment()
|
||||
if (CompositorHost.isStarted) pushCardboard(e)
|
||||
if (e.enabled && !was.enabled) headTracker?.recenter()
|
||||
updateHeadTracker()
|
||||
@@ -5840,9 +6077,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
private fun bottomGameDisplay(): Display? {
|
||||
if (!::displayManager.isInitialized) return null
|
||||
return com.droiddeck.launcher.input.DualScreen.sessionDisplay(this, displayManager, shownOnDisplayId)
|
||||
?.takeIf { it.isValid && com.droiddeck.launcher.input.DualScreen.builtIn(it) }
|
||||
if (!::displayManager.isInitialized || SessionPrefs.dualScreenSessionMode(this) == com.droiddeck.launcher.input.DualScreen.MODE_OFF) return null
|
||||
return com.droiddeck.launcher.input.DualScreen.selectedSessionDisplay(
|
||||
this, displayManager, shownOnDisplayId, selectedSecondScreenDisplay,
|
||||
)
|
||||
}
|
||||
|
||||
private fun putGameOnBottom(on: Boolean) {
|
||||
@@ -5968,7 +6206,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
tabs = tabs,
|
||||
)
|
||||
val keyboardExtra = com.droiddeck.launcher.ui.BarExtra(getString(R.string.second_show_keyboard), icon = R.drawable.ic_bottom_keyboard) {
|
||||
keyboard?.toggle()
|
||||
togglePrimaryKeyboard()
|
||||
}
|
||||
val profileLayout = secondaryInputLayout
|
||||
androidx.compose.foundation.layout.Box(
|
||||
@@ -5996,8 +6234,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
androidx.compose.runtime.key(profileLayout) {
|
||||
androidx.compose.ui.viewinterop.AndroidView(
|
||||
factory = { context -> com.droiddeck.launcher.ui.InputSurfaceView(context, padBridge, profileLayout?.elements.orEmpty(),
|
||||
surfaceStyle = profileLayout?.style ?: com.droiddeck.launcher.input.InputSurfaceStyle()) },
|
||||
surfaceStyle = profileLayout?.style ?: com.droiddeck.launcher.input.InputSurfaceStyle()).also { swappedInputSurface = it } },
|
||||
modifier = Modifier.fillMaxWidth().weight(1f),
|
||||
onRelease = { if (swappedInputSurface === it) swappedInputSurface = null },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -6164,6 +6403,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
releaseHeldGuestInput()
|
||||
}
|
||||
if (hasFocus && !pipUi) {
|
||||
retryFieldKeyboard(true)
|
||||
goFullscreen()
|
||||
refreshClipboard()
|
||||
}
|
||||
@@ -6208,6 +6448,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
uiHandler.removeCallbacks(guardWhenRunning)
|
||||
com.droiddeck.launcher.session.KeepTopActivity.release()
|
||||
synchronized(frameGenGlobalLock) {
|
||||
frameGenActivityActive = false
|
||||
frameGenRequests.incrementAndGet()
|
||||
@@ -6317,8 +6559,17 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode != REQUEST_BLUETOOTH || grantResults.firstOrNull() != android.content.pm.PackageManager.PERMISSION_GRANTED) return
|
||||
steamController?.stop()
|
||||
steamController = SteamControllerBle(this, inputRouter).also { it.start() }
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val EXTRA_RETURN_HOME = "returnHome"
|
||||
private const val BLUETOOTH_CONNECT = "android.permission.BLUETOOTH_CONNECT"
|
||||
private const val REQUEST_BLUETOOTH = 31
|
||||
const val EXTRA_LINK_TASK = "linkTask"
|
||||
const val EXTRA_STEAMVR = "steamVr"
|
||||
const val EXTRA_PLAYED_GAME = "com.droiddeck.launcher.PLAYED_GAME"
|
||||
@@ -6326,6 +6577,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private const val LEAVE_TIMEOUT_MS = 1_500L
|
||||
private const val TEXT_FIELD_TAP_MS = 1_000L
|
||||
private const val PAUSED_FRAME_MAX_EDGE = 1920f
|
||||
private const val BFI_PICTURE_SETTLE_MS = 50L
|
||||
private const val PAUSED_FRAME_REDRAW_MS = 150L
|
||||
private const val BOTTOM_RECOVERY_MS = 1_000L
|
||||
private const val BOTTOM_RECOVERY_TRIES = 3
|
||||
@@ -6369,6 +6621,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private val steamVrWorker = java.util.concurrent.ThreadPoolExecutor(0, 1, 30, java.util.concurrent.TimeUnit.SECONDS,
|
||||
java.util.concurrent.LinkedBlockingQueue()) { Thread(it, "steamvr") }
|
||||
private const val SCALE_FIT = 1
|
||||
private const val SCALE_INTEGER = 4
|
||||
private const val ALIGN_CENTER = 0
|
||||
private const val ALIGN_PICTURE_TOP = 3
|
||||
private const val ALIGN_PICTURE_BOTTOM = 4
|
||||
|
||||
@@ -58,7 +58,8 @@ 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 == "libblfastpath.so" && (SessionState.running || SessionState.guestPid > 0 || SessionState.phase == SessionPhase.STOPPING)) {
|
||||
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")
|
||||
}
|
||||
val source = File(inbox(context), name)
|
||||
@@ -73,7 +74,7 @@ object AgentEnv {
|
||||
staged.delete()
|
||||
throw AgentException("OVERRIDE_FAILED", "Could not stage the override")
|
||||
}
|
||||
if (name == "libblfastpath.so" && !arm64SharedLibrary(staged)) {
|
||||
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")
|
||||
}
|
||||
@@ -86,7 +87,7 @@ object AgentEnv {
|
||||
state.put("pendingOverrides", JSONArray(merge(strings(state.optJSONArray("pendingOverrides")), listOf(name))))
|
||||
save(context, state)
|
||||
state.put("installed", "$GUEST_BIN/$name")
|
||||
if (name == "libblfastpath.so") {
|
||||
if (name == "libddfastpath.so") {
|
||||
val digest = MessageDigest.getInstance("SHA-256")
|
||||
target.inputStream().use { input ->
|
||||
val buffer = ByteArray(65536)
|
||||
@@ -103,10 +104,10 @@ object AgentEnv {
|
||||
|
||||
fun fastPathLibrary(context: Context): String = synchronized(lock) {
|
||||
if (!AgentAccess.commandsAllowed(context)) return@synchronized ProotFastPath.LIBRARY
|
||||
if ("libblfastpath.so" !in strings(load(context).optJSONArray("activeOverrides"))) return@synchronized ProotFastPath.LIBRARY
|
||||
val file = File(bin(context), "libblfastpath.so")
|
||||
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/libblfastpath.so"
|
||||
"$GUEST_BIN/libddfastpath.so"
|
||||
}
|
||||
|
||||
private fun arm64SharedLibrary(file: File): Boolean = file.inputStream().use { input ->
|
||||
@@ -129,13 +130,18 @@ object AgentEnv {
|
||||
}
|
||||
val state = load(context)
|
||||
val active = strings(state.optJSONArray("pending"))
|
||||
val overrides = strings(state.optJSONArray("pendingOverrides"))
|
||||
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 }?.forEach { it.delete() }
|
||||
?.filter { it.name !in overrides && !(stranded && it.name == LEGACY_FAST_PATH) }?.forEach { it.delete() }
|
||||
val lines = strings(state.optJSONArray("persistent")) + active
|
||||
val withPath = if (overrides.none { it != "libblfastpath.so" }) lines else lines + "PATH=$GUEST_BIN:${pathOf(lines)}"
|
||||
val withPath = if (overrides.none { it != "libddfastpath.so" }) lines else lines + "PATH=$GUEST_BIN:${pathOf(lines)}"
|
||||
state.put("active", JSONArray(active)).put("pending", JSONArray())
|
||||
state.put("activeOverrides", JSONArray(overrides)).put("pendingOverrides", JSONArray())
|
||||
state.put("activeOverrides", JSONArray(overrides)).put("pendingOverrides", JSONArray(if (stranded) listOf(FAST_PATH) else emptyList()))
|
||||
save(context, state)
|
||||
if (withPath.isNotEmpty()) Log.i(TAG, "agent environment keys for this session: ${withPath.map { it.substringBefore('=') }}")
|
||||
withPath
|
||||
@@ -158,6 +164,9 @@ object AgentEnv {
|
||||
save(context, state)
|
||||
}
|
||||
|
||||
private const val FAST_PATH = "libddfastpath.so"
|
||||
private const val LEGACY_FAST_PATH = "libblfastpath.so"
|
||||
|
||||
private fun pathOf(lines: List<String>) =
|
||||
lines.lastOrNull { it.startsWith("PATH=") }?.substringAfter('=')?.takeIf { it.isNotBlank() } ?: LinuxRuntime.GUEST_PATH
|
||||
|
||||
@@ -186,6 +195,9 @@ object AgentEnv {
|
||||
for (key in listOf("pending", "active", "persistent", "pendingOverrides", "activeOverrides")) {
|
||||
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()))
|
||||
}
|
||||
return state
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,17 @@ interface AgentHarness {
|
||||
val signedIn: List<String>
|
||||
/** A guest command that signs in through $BROWSER. */
|
||||
val signIn: List<String>
|
||||
/**
|
||||
* Where the user makes an API key, for a CLI whose own sign-in is a terminal prompt: [signIn]
|
||||
* then only opens this page, and the key is pasted into DroidDeck and saved by [saveKey].
|
||||
*/
|
||||
val keyPage: String? get() = null
|
||||
/** Whether a key from [keyPage] is saved under [rootfs]. */
|
||||
fun hasKey(rootfs: File): Boolean = false
|
||||
fun saveKey(rootfs: File, key: String) {}
|
||||
/** Whether the CLI has models that need no account; [useFree] then counts as signed in. */
|
||||
val free: Boolean get() = false
|
||||
fun useFree(rootfs: File) {}
|
||||
/** Whether [Options.plan] means anything to this CLI. */
|
||||
val plans: Boolean
|
||||
/** Reasoning effort levels the CLI accepts, lowest first; empty when it has none. */
|
||||
@@ -35,6 +46,10 @@ interface AgentHarness {
|
||||
fun input(message: String): String? = null
|
||||
/** One line of the CLI's output, or null when it carries nothing to show. */
|
||||
fun parse(line: String): AgentEvent?
|
||||
/** The folder, under the userland's root, where the CLI loads user skills (`<name>/SKILL.md`). */
|
||||
val skills: String
|
||||
/** The CLI's global instructions file under the userland's root, where DroidDeck keeps its rules in a marked block. */
|
||||
val instructions: String
|
||||
/** Sets the CLI's own defaults in the userland before it runs; [rootfs] is the userland's root. */
|
||||
fun prepare(rootfs: File) {}
|
||||
/** Context and plan limits the CLI keeps on disk rather than printing, read once a turn of [conversation] is done. */
|
||||
@@ -45,7 +60,7 @@ interface AgentHarness {
|
||||
data class Options(val model: String? = null, val plan: Boolean = false, val brief: String? = null, val effort: String? = null)
|
||||
|
||||
companion object {
|
||||
val all: List<AgentHarness> = listOf(ClaudeCode, Codex)
|
||||
val all: List<AgentHarness> = listOf(ClaudeCode, Codex, OpenCode)
|
||||
fun byId(id: String?): AgentHarness = all.firstOrNull { it.id == id } ?: ClaudeCode
|
||||
}
|
||||
}
|
||||
@@ -83,6 +98,8 @@ object ClaudeCode : AgentHarness {
|
||||
* Commits and pull requests the agent makes carry no Claude Code credit or co-author line by
|
||||
* default. Only keys the user has not set are written, so their own choice stays.
|
||||
*/
|
||||
override val skills = "root/.claude/skills"
|
||||
override val instructions = "root/.claude/CLAUDE.md"
|
||||
override fun prepare(rootfs: File) {
|
||||
val file = File(rootfs, "root/.claude/settings.json")
|
||||
val settings = if (file.exists()) runCatching { JSONObject(file.readText()) }.getOrNull() ?: return else JSONObject()
|
||||
@@ -254,6 +271,8 @@ object Codex : AgentHarness {
|
||||
override val id = "codex"
|
||||
override val name = "Codex"
|
||||
override val binary = "/root/.local/bin/codex"
|
||||
override val skills = "root/.codex/skills"
|
||||
override val instructions = "root/.codex/AGENTS.md"
|
||||
// Code mode runs in a helper that each release ships as its own download.
|
||||
private const val HOST = "/root/.local/bin/codex-code-mode-host"
|
||||
override val files get() = listOf(binary, HOST)
|
||||
@@ -384,6 +403,184 @@ object Codex : AgentHarness {
|
||||
}
|
||||
}
|
||||
|
||||
/** OpenCode: `opencode run --format json`, resumed by session id. */
|
||||
object OpenCode : AgentHarness {
|
||||
override val id = "opencode"
|
||||
override val name = "OpenCode"
|
||||
override val binary = "/root/.opencode/bin/opencode"
|
||||
override val skills = "root/.config/opencode/skills"
|
||||
override val instructions = "root/.config/opencode/AGENTS.md"
|
||||
override val install = "curl -fsSL https://opencode.ai/install | bash -s -- --no-modify-path"
|
||||
private const val AUTH = "root/.local/share/opencode/auth.json"
|
||||
private const val FREE = "root/.config/opencode/.droiddeck-free"
|
||||
private const val MODELS = "root/.cache/droiddeck/opencode-models"
|
||||
|
||||
// `opencode models` lists only what the saved keys reach, so the check that runs it keeps the model list current.
|
||||
override val signedIn = listOf("sh", "-c",
|
||||
"mkdir -p /${MODELS.substringBeforeLast('/')}; $binary models --verbose > /$MODELS.$$ 2>/dev/null && mv -f /$MODELS.$$ /$MODELS; rm -f /$MODELS.$$; " +
|
||||
"grep -q '\"type\"' /$AUTH 2>/dev/null || [ -e /$FREE ]")
|
||||
override val keyPage = "https://opencode.ai/auth"
|
||||
override val signIn = listOf("/root/.local/bin/android-open", keyPage)
|
||||
override val free = true
|
||||
override val plans = true
|
||||
override val efforts = listOf("low", "medium", "high")
|
||||
|
||||
override fun hasKey(rootfs: File) = runCatching { JSONObject(File(rootfs, AUTH).readText()).has("opencode") }.getOrDefault(false)
|
||||
|
||||
/** The key opencode's own `auth login` would save for OpenCode Zen. */
|
||||
override fun saveKey(rootfs: File, key: String) {
|
||||
val file = File(rootfs, AUTH)
|
||||
// An auth.json that cannot be read holds other providers' sign-ins too, so it is never replaced.
|
||||
val auth = if (file.exists()) JSONObject(file.readText()) else JSONObject()
|
||||
auth.put("opencode", JSONObject().put("type", "api").put("key", key.trim()))
|
||||
file.parentFile?.mkdirs()
|
||||
file.writeText(auth.toString(2) + "\n")
|
||||
file.setReadable(false, false)
|
||||
file.setReadable(true, true)
|
||||
}
|
||||
|
||||
override fun useFree(rootfs: File) {
|
||||
File(rootfs, FREE).apply { parentFile?.mkdirs() }.writeText("Free OpenCode Zen models, chosen in DroidDeck's agent setup.\n")
|
||||
}
|
||||
|
||||
private class Listed(val modified: Long, val models: List<AgentHarness.Model>, val windows: Map<String, Long>)
|
||||
@Volatile private var listed: Listed? = null
|
||||
|
||||
private fun listed(rootfs: File): Listed? {
|
||||
val file = File(rootfs, MODELS)
|
||||
val modified = file.lastModified().takeIf { it > 0 } ?: return null
|
||||
listed?.takeIf { it.modified == modified }?.let { return it }
|
||||
return runCatching { listModels(file.readText()) }.getOrNull()?.let { (models, windows) -> Listed(modified, models, windows) }?.also { listed = it }
|
||||
}
|
||||
|
||||
override fun models(rootfs: File) = listed(rootfs)?.models.orEmpty()
|
||||
|
||||
/** `opencode models --verbose` prints each model's id on a line of its own, then its details as JSON. */
|
||||
@VisibleForTesting
|
||||
internal fun listModels(output: String): Pair<List<AgentHarness.Model>, Map<String, Long>> {
|
||||
val models = mutableListOf<AgentHarness.Model>()
|
||||
val windows = mutableMapOf<String, Long>()
|
||||
var id: String? = null
|
||||
val json = StringBuilder()
|
||||
for (line in output.lineSequence()) {
|
||||
val current = id
|
||||
if (current == null) {
|
||||
if (MODEL_ID.matches(line)) id = line.trim()
|
||||
continue
|
||||
}
|
||||
json.appendLine(line)
|
||||
if (line != "}") continue
|
||||
runCatching { JSONObject(json.toString()) }.getOrNull()?.takeIf { it.optString("status") != "deprecated" }?.let { o ->
|
||||
val provider = o.optString("providerID")
|
||||
val label = o.optString("name").ifEmpty { current }
|
||||
models += AgentHarness.Model(current, if (provider.isEmpty() || provider == "opencode") label else "$label · $provider")
|
||||
o.optJSONObject("limit")?.optLong("context")?.takeIf { it > 0 }?.let { windows[current] = it }
|
||||
}
|
||||
id = null
|
||||
json.clear()
|
||||
}
|
||||
return models to windows
|
||||
}
|
||||
|
||||
private val MODEL_ID = Regex("""^[\w.-]+/\S+$""")
|
||||
|
||||
private class Spent(var cost: Double = 0.0, var input: Long = 0, var output: Long = 0)
|
||||
private val spent = Spent()
|
||||
@Volatile private var model: String? = null
|
||||
|
||||
override fun turn(message: String, conversation: String?, options: AgentHarness.Options): List<String> {
|
||||
synchronized(spent) { spent.cost = 0.0; spent.input = 0; spent.output = 0 }
|
||||
model = options.model
|
||||
// DroidDeck runs the agent unattended; --auto approves all the agent does not deny itself, and plan mode denies edits.
|
||||
return buildList {
|
||||
addAll(listOf(binary, "run", "--format", "json", "--auto", "--thinking"))
|
||||
if (conversation != null) addAll(listOf("-s", conversation))
|
||||
if (options.plan) addAll(listOf("--agent", "plan"))
|
||||
options.model?.let { addAll(listOf("-m", it)) }
|
||||
options.effort?.let { addAll(listOf("--variant", it)) }
|
||||
add("--")
|
||||
// opencode run has no system prompt option, so a new conversation starts with the brief.
|
||||
add(if (conversation == null && options.brief != null) "${options.brief}\n\n$message" else message)
|
||||
}
|
||||
}
|
||||
|
||||
override fun usage(rootfs: File, conversation: String?): AgentEvent? {
|
||||
val id = model ?: return null
|
||||
return listed(rootfs)?.windows?.get(id)?.let { AgentEvent(window = it) }
|
||||
}
|
||||
|
||||
override fun parse(line: String): AgentEvent? {
|
||||
val o = runCatching { JSONObject(line) }.getOrNull() ?: return null
|
||||
val conversation = o.optString("sessionID").takeIf { it.isNotEmpty() }
|
||||
val part = o.optJSONObject("part")
|
||||
return when (o.optString("type")) {
|
||||
"text" -> AgentEvent(conversation, text(part) { AgentHost.Entry.Said(it) })
|
||||
"reasoning" -> AgentEvent(conversation, text(part) { AgentHost.Entry.Thought(it) })
|
||||
"tool_use" -> AgentEvent(conversation, part?.let { tool(it) }.orEmpty())
|
||||
"step_finish" -> {
|
||||
val tokens = part?.optJSONObject("tokens")
|
||||
val cache = tokens?.optJSONObject("cache")
|
||||
val total = synchronized(spent) {
|
||||
spent.cost += part?.optDouble("cost", 0.0) ?: 0.0
|
||||
spent.input += (tokens?.optLong("input") ?: 0) + (cache?.optLong("read") ?: 0) + (cache?.optLong("write") ?: 0)
|
||||
spent.output += (tokens?.optLong("output") ?: 0) + (tokens?.optLong("reasoning") ?: 0)
|
||||
AgentHost.Usage(0, spent.cost, spent.input, spent.output)
|
||||
}
|
||||
val context = tokens?.optLong("total")?.takeIf { it > 0 }
|
||||
// A step that ends to run tools is followed by another; any other reason ends the turn.
|
||||
if (part?.optString("reason") == "tool-calls") AgentEvent(conversation, context = context)
|
||||
else AgentEvent(conversation, listOf(AgentHost.Entry.Finished(null)), context = context, usage = total)
|
||||
}
|
||||
"error" -> {
|
||||
val error = o.optJSONObject("error")
|
||||
val message = error?.optJSONObject("data")?.optString("message")?.takeIf { it.isNotEmpty() }
|
||||
?: error?.optString("message")?.takeIf { it.isNotEmpty() } ?: error?.optString("name")?.takeIf { it.isNotEmpty() } ?: "error"
|
||||
AgentEvent(conversation, listOf(AgentHost.Entry.Finished(message)))
|
||||
}
|
||||
else -> conversation?.let { AgentEvent(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun text(part: JSONObject?, entry: (String) -> AgentHost.Entry) =
|
||||
part?.optString("text")?.trim()?.takeIf { it.isNotEmpty() }?.let { listOf(entry(it)) }.orEmpty()
|
||||
|
||||
private fun tool(part: JSONObject): List<AgentHost.Entry> {
|
||||
val id = part.optString("callID").ifEmpty { part.optString("id") }
|
||||
val state = part.optJSONObject("state") ?: JSONObject()
|
||||
val input = state.optJSONObject("input") ?: JSONObject()
|
||||
val path = input.optString("filePath")
|
||||
val (name, detail, full) = when (val tool = part.optString("tool")) {
|
||||
"bash" -> Triple("Bash", firstLine(input.optString("command")), input.optString("command"))
|
||||
"edit" -> Triple("Edit", path, path + "\n" + lineDiff(input.optString("oldString"), input.optString("newString")))
|
||||
"write" -> Triple("Write", path, path + "\n" + lineDiff("", input.optString("content")))
|
||||
"todowrite" -> Triple("TodoWrite", "", todos(input.optJSONArray("todos")))
|
||||
else -> Triple(tool.replaceFirstChar { it.uppercase() }.ifEmpty { "Tool" }, detail(input), input.toString(2))
|
||||
}
|
||||
val used = AgentHost.Entry.Used(id, name, detail, full)
|
||||
return when (state.optString("status")) {
|
||||
"completed" -> {
|
||||
val exit = state.optJSONObject("metadata")?.opt("exit")
|
||||
listOf(used, AgentHost.Entry.Result(id, state.optString("output"), exit is Number && exit.toInt() != 0))
|
||||
}
|
||||
"error" -> listOf(used, AgentHost.Entry.Result(id, state.optString("error"), true))
|
||||
else -> listOf(used)
|
||||
}
|
||||
}
|
||||
|
||||
private fun detail(input: JSONObject): String {
|
||||
for (key in listOf("filePath", "path", "pattern", "url", "query", "description", "prompt", "command")) {
|
||||
input.optString(key).takeIf { it.isNotEmpty() }?.let { return firstLine(it) }
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
private fun todos(list: JSONArray?) = (0 until (list?.length() ?: 0)).mapNotNull { i ->
|
||||
val todo = list?.optJSONObject(i) ?: return@mapNotNull null
|
||||
val mark = when (todo.optString("status")) { "completed" -> "[x]"; "in_progress" -> "[~]"; else -> "[ ]" }
|
||||
"$mark ${todo.optString("content")}"
|
||||
}.joinToString("\n")
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
internal fun firstLine(text: String) = text.lineSequence().first().take(160)
|
||||
|
||||
|
||||
@@ -68,18 +68,10 @@ object AgentHost {
|
||||
@VisibleForTesting
|
||||
internal const val BRIEF = "You run inside DroidDeck on the user's handheld, in its Linux userland (Ubuntu under proot, aarch64), " +
|
||||
"and the user talks to you from DroidDeck's Agent tab, often on a small screen, so keep replies short. " +
|
||||
"droiddeckctl inspects and drives the app over loopback adb (\$ADB_SERIAL); its guide is ${AgentSetup.CTL}/agent-control.md. " +
|
||||
"Steam, the desktop and games run in DroidDeck's session, a separate guest from yours: a program you start here is not in it and has no screen. " +
|
||||
"Reach the session through droiddeckctl: state, start steam, stop, launch, quit, focus, screenshot, logs, and guest to run a command inside it. " +
|
||||
"Starting, stopping or restarting a session leaves you running. " +
|
||||
"DroidDeck's rules for working here are in your global instructions file (~/.claude/CLAUDE.md or ~/.codex/AGENTS.md); " +
|
||||
"if they are not loaded, read ${AgentSetup.CTL}/AGENTS.md before acting on the device. " +
|
||||
"Never kill by a command-line pattern (pkill -f, pgrep -f piped to kill): your own command line holds the user's message, so the pattern matches you. " +
|
||||
"End a game with droiddeckctl quit, the session with droiddeckctl stop, anything else by its pid. " +
|
||||
"dd-lab-build builds the checkout as a Lab build and restarts DroidDeck on it (docs/lab-builds.md). DroidDeck runs the build in a " +
|
||||
"process of its own and shows the user its progress and time left; dd-lab-build follows that build's log until it is done. " +
|
||||
"Run it with run_in_background and keep checking its output, so the user can talk to you meanwhile. " +
|
||||
"The restart ends this process, and this conversation continues on the new build. " +
|
||||
"Files the user attaches are listed at the end of their message, under /root/.cache/droiddeck/attachments. " +
|
||||
"Commits and pull requests you make are the user's own: add no co-author line, AI credit or generated-by note. " +
|
||||
"To have the user pick between options, end your reply with a fenced code block whose language is choices, one short option per line, " +
|
||||
"and end your turn: DroidDeck shows them as buttons and sends the one picked as the next message."
|
||||
|
||||
|
||||
@@ -40,7 +40,11 @@ object AgentProcesses {
|
||||
val now = SystemClock.elapsedRealtime()
|
||||
val uptimeTicks = now * HZ / 1000
|
||||
val elapsed = (now - lastAt).coerceAtLeast(1)
|
||||
fun isProot(pid: Int) = args[pid].orEmpty().substringBefore(' ').endsWith("proot.so") || args[pid].orEmpty().substringBefore(' ').endsWith("/proot")
|
||||
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")
|
||||
}
|
||||
fun ancestors(pid: Int) = generateSequence(stats[pid]?.ppid) { stats[it]?.ppid }.takeWhile { it > 1 }.take(64)
|
||||
val out = stats.values.filter { s ->
|
||||
!isProot(s.pid) && args[s.pid].orEmpty().isNotEmpty() && ancestors(s.pid).any { isProot(it) }
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.mutableStateMapOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
@@ -26,6 +27,28 @@ object AgentSetup {
|
||||
val detail = mutableStateMapOf<Step, String>()
|
||||
var runtimeInstalled by mutableStateOf(true)
|
||||
private set
|
||||
/** The harness has a key from its [AgentHarness.keyPage] saved; signed in without one means its free models. */
|
||||
var keySaved by mutableStateOf(false)
|
||||
private set
|
||||
|
||||
/** Saves a pasted key for a harness that signs in with one, then checks the sign-in again. */
|
||||
fun saveKey(context: Context, key: String) = signInLocally(context) { harness, root -> harness.saveKey(root, key) }
|
||||
|
||||
fun useFree(context: Context) = signInLocally(context) { harness, root -> harness.useFree(root) }
|
||||
|
||||
private fun signInLocally(context: Context, write: (AgentHarness, File) -> Unit) {
|
||||
val app = context.applicationContext
|
||||
val harness = AgentHost.harness
|
||||
set(Step.SIGN_IN, Status.WORKING)
|
||||
Thread({
|
||||
val result = runCatching { write(harness, LinuxRuntime.rootDir(app)) }
|
||||
main.post {
|
||||
status[Step.SIGN_IN] = Status.UNKNOWN
|
||||
result.exceptionOrNull()?.let { detail[Step.SIGN_IN] = it.message ?: "failed" }
|
||||
check(app)
|
||||
}
|
||||
}, "agent-sign-in").start()
|
||||
}
|
||||
|
||||
val ready: Boolean get() = Step.entries.filter { it.required }.all { status[it] == Status.DONE }
|
||||
|
||||
@@ -40,7 +63,9 @@ object AgentSetup {
|
||||
private val main = Handler(Looper.getMainLooper())
|
||||
private const val REPO = "https://github.com/Droid-Deck/DroidDeck.git"
|
||||
private const val CHECKOUT = "/root/DroidDeck"
|
||||
private val HELPERS = listOf("android-open", "dd-gh-login", "droiddeckctl")
|
||||
private val HELPERS = listOf("android-open", "dd-gh-login", "droiddeckctl", "droiddeck-scenario")
|
||||
/** DroidDeck's own skills (tools/agent/skills), given to every harness. */
|
||||
private const val SKILLS = "agent/skills"
|
||||
internal const val CTL = "/root/.local/share/droiddeck/ctl"
|
||||
private const val PROBE_TIMEOUT_S = 60L
|
||||
|
||||
@@ -50,6 +75,7 @@ object AgentSetup {
|
||||
if (!runtimeInstalled) return
|
||||
AgentHost.refresh(app)
|
||||
val harness = AgentHost.harness
|
||||
keySaved = harness.hasKey(LinuxRuntime.rootDir(app))
|
||||
val probes = mutableListOf<Pair<Step, List<String>>>()
|
||||
for (step in Step.entries) if (status[step] != Status.WORKING) {
|
||||
when (step) {
|
||||
@@ -187,11 +213,98 @@ object AgentSetup {
|
||||
/** Written before every step, so the helpers a step relies on are there and match this DroidDeck version. */
|
||||
internal fun installHelpers(app: Context) {
|
||||
val root = LinuxRuntime.rootDir(app)
|
||||
val failed = mutableListOf<String>()
|
||||
fun attempt(what: String, block: () -> Unit) = runCatching(block).onFailure {
|
||||
android.util.Log.w("AgentSetup", "could not install $what", it)
|
||||
failed += what
|
||||
}
|
||||
val bin = File(root, "root/.local/bin").apply { mkdirs() }
|
||||
for (name in HELPERS) copyAsset(app, "agent/$name", File(bin, name))
|
||||
for (name in HELPERS) attempt(name) { copyAsset(app, "agent/$name", File(bin, name)) }
|
||||
val ctl = File(root, CTL.removePrefix("/")).apply { mkdirs() }
|
||||
for (name in app.assets.list("agent/ctl").orEmpty()) copyAsset(app, "agent/ctl/$name", File(ctl, name))
|
||||
for (name in app.assets.list("agent/ctl").orEmpty()) attempt("ctl/$name") { copyAsset(app, "agent/ctl/$name", File(ctl, name)) }
|
||||
val skills = app.assets.list(SKILLS).orEmpty().associateWith { app.assets.list("$SKILLS/$it").orEmpty().toList() }
|
||||
failed += installSkills(root, skills) { app.assets.open("$SKILLS/$it") }
|
||||
attempt("AGENTS.md") {
|
||||
val rules = app.assets.open("agent/ctl/AGENTS.md").use { it.readBytes().decodeToString() }
|
||||
failed += installInstructions(root, rules)
|
||||
}
|
||||
unpinAdbSerial(File(root, "root/.bashrc"))
|
||||
main.post { problems.clear(); problems.addAll(failed.distinct()) }
|
||||
}
|
||||
|
||||
/** What [installHelpers] could not install last time, shown in the Agent tab; empty when all is in place. */
|
||||
val problems = mutableStateListOf<String>()
|
||||
|
||||
/**
|
||||
* Writes each of DroidDeck's [skills] (name to its files) into every harness's skills folder, so
|
||||
* Claude Code, Codex and any later harness load the same ones, as of this DroidDeck version.
|
||||
* Skills the user added there are left alone. Returns the skills that could not be written.
|
||||
*/
|
||||
internal fun installSkills(root: File, skills: Map<String, List<String>>, open: (String) -> java.io.InputStream): List<String> {
|
||||
val failed = mutableListOf<String>()
|
||||
for (harness in AgentHarness.all) for ((name, files) in skills) runCatching {
|
||||
val dir = File(root, "${harness.skills}/$name")
|
||||
// A folder of that name without DroidDeck's mark is the user's own skill: keep it.
|
||||
if (dir.exists() && !File(dir, SKILL_MARK).exists()) return@runCatching
|
||||
dir.mkdirs()
|
||||
// Marked before copying, so a copy that fails part way is retried next turn, not taken for the user's.
|
||||
File(dir, SKILL_MARK).writeText("Installed by DroidDeck and replaced on every turn. Delete this file to keep your own edits.\n")
|
||||
for (file in files) open("$name/$file").use { replaceFile(it, File(dir, file), executable = false) }
|
||||
}.onFailure {
|
||||
android.util.Log.w("AgentSetup", "could not install skill $name for ${harness.name}", it)
|
||||
failed += "skill $name"
|
||||
}
|
||||
return failed
|
||||
}
|
||||
|
||||
/** Marks a skill folder as DroidDeck's, so it may be replaced; one without it belongs to the user. */
|
||||
internal const val SKILL_MARK = ".droiddeck"
|
||||
|
||||
/**
|
||||
* Where [file] really is when it is a symlink, as the guest sees it: an absolute target is a
|
||||
* userland path, so it is looked up under [root]. A dotfiles link keeps working that way.
|
||||
*/
|
||||
internal fun guestTarget(root: File, file: File): File {
|
||||
var current = file
|
||||
repeat(8) {
|
||||
val path = current.toPath()
|
||||
if (!java.nio.file.Files.isSymbolicLink(path)) return current
|
||||
val target = java.nio.file.Files.readSymbolicLink(path).toString()
|
||||
current = if (target.startsWith("/")) File(root, target.removePrefix("/")) else File(current.parentFile, target)
|
||||
}
|
||||
return current
|
||||
}
|
||||
|
||||
internal const val BLOCK_BEGIN = "<!-- BEGIN DroidDeck: replaced on every turn. Write your own rules outside this block. -->"
|
||||
internal const val BLOCK_END = "<!-- END DroidDeck -->"
|
||||
|
||||
/**
|
||||
* Puts DroidDeck's [rules] in a marked block of every harness's global instructions file,
|
||||
* keeping whatever the user wrote around it. Returns the files that could not be written.
|
||||
*/
|
||||
internal fun installInstructions(root: File, rules: String): List<String> {
|
||||
val failed = mutableListOf<String>()
|
||||
for (harness in AgentHarness.all) runCatching {
|
||||
val file = guestTarget(root, File(root, harness.instructions)).apply { parentFile?.mkdirs() }
|
||||
val existing = if (file.exists()) file.readText() else null
|
||||
val merged = withBlock(existing, rules)
|
||||
if (merged != existing) replaceFile(merged.byteInputStream(), file, executable = false)
|
||||
}.onFailure {
|
||||
android.util.Log.w("AgentSetup", "could not write ${harness.instructions}", it)
|
||||
failed += harness.instructions.substringAfterLast("root/")
|
||||
}
|
||||
return failed
|
||||
}
|
||||
|
||||
/** [existing] with DroidDeck's block set to [rules]: replaced in place, or put first when there is none yet. */
|
||||
internal fun withBlock(existing: String?, rules: String): String {
|
||||
val block = "$BLOCK_BEGIN\n${rules.trim()}\n$BLOCK_END\n"
|
||||
if (existing.isNullOrBlank()) return block
|
||||
val start = existing.indexOf(BLOCK_BEGIN)
|
||||
val end = existing.indexOf(BLOCK_END, start.coerceAtLeast(0))
|
||||
if (start < 0 || end < 0) return "$block\n$existing"
|
||||
val after = existing.substring(end + BLOCK_END.length).removePrefix("\n")
|
||||
return existing.substring(0, start) + block + after
|
||||
}
|
||||
|
||||
/** Older tools/agent/setup pinned the adb port in .bashrc, which overrides the live port DroidDeck passes. */
|
||||
@@ -201,8 +314,24 @@ object AgentSetup {
|
||||
if (fixed != text) runCatching { bashrc.writeText(fixed) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Written beside [target] and renamed over it, so a symlink left there by a hand-made setup is
|
||||
* replaced rather than followed: its absolute target is a userland path the app cannot reach,
|
||||
* and the failed write stopped every helper after it, the droiddeckctl guide included.
|
||||
*/
|
||||
private fun copyAsset(app: Context, asset: String, target: File) {
|
||||
app.assets.open(asset).use { input -> target.outputStream().use { input.copyTo(it) } }
|
||||
target.setExecutable(true, false)
|
||||
app.assets.open(asset).use { replaceFile(it, target) }
|
||||
}
|
||||
|
||||
/** Replaces [target], or the symlink at it, with [input]. */
|
||||
internal fun replaceFile(input: java.io.InputStream, target: File, executable: Boolean = true) {
|
||||
// A unique name, since an agent turn and a setup step can install at the same time.
|
||||
val staged = File.createTempFile(".${target.name}.", ".part", target.parentFile)
|
||||
staged.outputStream().use { input.copyTo(it) }
|
||||
if (executable) staged.setExecutable(true, false)
|
||||
if (!staged.renameTo(target)) {
|
||||
staged.delete()
|
||||
throw java.io.IOException("could not replace $target")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,14 @@ import java.nio.file.attribute.BasicFileAttributes
|
||||
|
||||
/**
|
||||
* What the agent adds to the Linux userland, measured and removable piece by piece. Sign-ins
|
||||
* (~/.claude, ~/.codex, gh's config) are left alone, so removing a CLI and installing it again
|
||||
* does not sign out.
|
||||
* (~/.claude, ~/.codex, ~/.local/share/opencode, gh's config) are left alone, so removing a CLI
|
||||
* and installing it again does not sign out.
|
||||
*/
|
||||
object AgentStorage {
|
||||
enum class Item(val paths: List<String>) {
|
||||
CLAUDE_CODE(listOf("/root/.local/share/claude", "/root/.local/bin/claude", "/root/cc")),
|
||||
CODEX(listOf("/root/.local/bin/codex", "/root/.local/bin/codex-code-mode-host")),
|
||||
OPENCODE(listOf("/root/.opencode")),
|
||||
BUILD_TOOLS(listOf("/root/android-sdk", "/root/aapt2", "/root/x86root", "/root/.gradle")),
|
||||
SOURCE(listOf("/root/DroidDeck")),
|
||||
CACHES(listOf("/root/.cache", "/root/.npm")),
|
||||
|
||||
@@ -7,7 +7,7 @@ import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
object AgentTab {
|
||||
var shown by mutableStateOf(true)
|
||||
var shown by mutableStateOf(false)
|
||||
private set
|
||||
|
||||
val visible: Boolean get() = shown && AgentHost.available
|
||||
|
||||
@@ -168,7 +168,7 @@ public class PulseAudioComponent extends SessionPart {
|
||||
env.add("HOME=" + workingDir);
|
||||
env.add("TMPDIR=" + workingDir);
|
||||
|
||||
String command = workingDir.getAbsolutePath() + "/libpulseaudio.so"
|
||||
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";
|
||||
@@ -259,7 +259,7 @@ public class PulseAudioComponent extends SessionPart {
|
||||
try {
|
||||
File modules = new File(workingDir, "modules/arm64");
|
||||
ArrayList<String> cmd = new ArrayList<>();
|
||||
cmd.add(pactl.getAbsolutePath());
|
||||
cmd.addAll(HostProcess.dataExecutable(pactl.getAbsolutePath()));
|
||||
java.util.Collections.addAll(cmd, args);
|
||||
ProcessBuilder builder = new ProcessBuilder(cmd);
|
||||
builder.directory(workingDir);
|
||||
@@ -316,8 +316,9 @@ public class PulseAudioComponent extends SessionPart {
|
||||
java.lang.Process process = null;
|
||||
try {
|
||||
File modules = new File(workingDir, "modules/arm64");
|
||||
ProcessBuilder builder = new ProcessBuilder(
|
||||
pactl.getAbsolutePath(), "suspend-" + kind, name, Boolean.toString(suspended));
|
||||
ArrayList<String> argv = new ArrayList<>(HostProcess.dataExecutable(pactl.getAbsolutePath()));
|
||||
argv.addAll(java.util.Arrays.asList("suspend-" + kind, name, Boolean.toString(suspended)));
|
||||
ProcessBuilder builder = new ProcessBuilder(argv);
|
||||
builder.directory(workingDir);
|
||||
builder.redirectErrorStream(true);
|
||||
builder.redirectOutput(new File("/dev/null"));
|
||||
|
||||
@@ -23,6 +23,7 @@ object GameEnvironment {
|
||||
)
|
||||
|
||||
fun validName(name: String) = namePattern.matches(name)
|
||||
fun currentName(name: String) = if (name.startsWith("BL_")) "DD_" + name.removePrefix("BL_") else name
|
||||
fun supported(name: String) = name !in unused && !name.startsWith("BOX64_") && !name.startsWith("BOX86_")
|
||||
fun validValue(value: String) = '\u0000' !in value && value.length <= 8192
|
||||
fun validScope(scope: String) = scope.isEmpty() || (Regex("[1-9][0-9]*").matches(scope) && scope.toLongOrNull()?.let { it in 1..4294967295L } == true)
|
||||
@@ -97,14 +98,14 @@ object GameEnvironment {
|
||||
|
||||
val syncBackends = listOf(SessionPrefs.SYNC_NTSYNC, SessionPrefs.SYNC_FSYNC, SessionPrefs.SYNC_ESYNC, SessionPrefs.SYNC_WINESERVER)
|
||||
|
||||
val syncKeys = listOf("BL_SYNC", "BL_FSYNC_FIRST", "BL_SYNC_FALLBACK", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
val syncKeys = listOf("DD_SYNC", "DD_FSYNC_FIRST", "DD_SYNC_FALLBACK", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
|
||||
fun syncEnvironment(backend: String): Map<String, String> {
|
||||
require(backend in syncBackends) { "unknown sync $backend" }
|
||||
return buildMap {
|
||||
put("BL_SYNC", if (backend == SessionPrefs.SYNC_NTSYNC) "1" else "0")
|
||||
put("BL_FSYNC_FIRST", if (backend == SessionPrefs.SYNC_FSYNC) "1" else "0")
|
||||
put("BL_SYNC_FALLBACK", if (backend == SessionPrefs.SYNC_WINESERVER) "0" else "1")
|
||||
put("DD_SYNC", if (backend == SessionPrefs.SYNC_NTSYNC) "1" else "0")
|
||||
put("DD_FSYNC_FIRST", if (backend == SessionPrefs.SYNC_FSYNC) "1" else "0")
|
||||
put("DD_SYNC_FALLBACK", if (backend == SessionPrefs.SYNC_WINESERVER) "0" else "1")
|
||||
if (backend == SessionPrefs.SYNC_FSYNC) put("PROTON_NO_ESYNC", "1")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ object GameEnvironmentOptions {
|
||||
Option("PROTON_NO_NTSYNC", "1", R.string.game_env_no_ntsync, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("PROTON_NO_ESYNC", "1", R.string.game_env_no_esync, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("PROTON_NO_FSYNC", "1", R.string.game_env_no_fsync, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("BL_FSYNC_FIRST", "1", R.string.game_env_fsync_first, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("DD_FSYNC_FIRST", "1", R.string.game_env_fsync_first, Type.TOGGLE, listOf("0", "1")),
|
||||
Option("DXVK_HUD", "fps", R.string.game_env_hud, Type.MULTIPLE, listOf("scale=0.5", "scale=0.7", "opacity=0.5", "opacity=0.7", "devinfo", "fps", "frametimes", "submissions", "drawcalls", "pipelines", "descriptors", "memory", "gpuload", "version", "api", "cs", "compiler", "samplers")),
|
||||
Option("DXVK_CONFIG", "dxvk.maxFrameRate = 60", R.string.game_env_dxvk_config, Type.TEXT),
|
||||
Option("VKD3D_FRAME_RATE", "60", R.string.game_env_vkd3d_limit, Type.NUMBER),
|
||||
|
||||
@@ -6,6 +6,12 @@ import java.util.function.Consumer
|
||||
|
||||
object HostProcess {
|
||||
private const val TAG = "HostProcess"
|
||||
private const val LINKER = "/system/bin/linker64"
|
||||
|
||||
/** Android 10+ refuses to execute app data files for targetSdk 29+; its linker still loads them. */
|
||||
@JvmStatic
|
||||
fun dataExecutable(path: String): List<String> =
|
||||
if (android.os.Build.VERSION.SDK_INT >= 29) listOf(LINKER, path) else listOf(path)
|
||||
|
||||
@JvmStatic
|
||||
fun start(command: String, env: Array<String>?, dir: File?, onExit: Consumer<Int>?, onLine: Consumer<String>?): Int =
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Process
|
||||
import android.util.Log
|
||||
import java.io.BufferedWriter
|
||||
@@ -113,7 +114,17 @@ object SessionLogCapture {
|
||||
}
|
||||
}
|
||||
|
||||
fun dumpMemoryPressure(target: File) {
|
||||
internal const val LMKD_COMMAND = "logcat -d -b main,events -v threadtime -s lowmemorykiller:D killinfo:I" +
|
||||
" | grep -v -E 'pgskip|zoneinfo_parse|polling check|thrashing:' | tail -n 120"
|
||||
|
||||
private fun lowMemoryKiller(context: Context?): String = when {
|
||||
context == null -> "(not captured)\n"
|
||||
!WirelessAdbFix.hasSavedPairing(context) -> "(not captured: pair DroidDeck with Wireless debugging in Settings > Diagnostics)\n"
|
||||
else -> runCatching { WirelessAdbFix.shell(context, LMKD_COMMAND) }
|
||||
.fold({ it.ifBlank { "(no lmkd lines in the log)\n" } }, { "(not captured: ${it.message})\n" })
|
||||
}
|
||||
|
||||
fun dumpMemoryPressure(target: File, context: Context? = null) {
|
||||
var temporary: File? = null
|
||||
try {
|
||||
val staged = File.createTempFile(target.name, ".part", target.parentFile).also { temporary = it }
|
||||
@@ -150,7 +161,8 @@ object SessionLogCapture {
|
||||
body.isNotEmpty() -> body
|
||||
else -> "(no readable events were returned)\n"
|
||||
} +
|
||||
"\n/proc/pressure/memory:\n$pressure\n/proc/meminfo:\n$meminfo\n/sys/class/kgsl/kgsl/page_alloc:\n$gpu"
|
||||
"\n/proc/pressure/memory:\n$pressure\n/proc/meminfo:\n$meminfo\n/sys/class/kgsl/kgsl/page_alloc:\n$gpu" +
|
||||
"\nAndroid's low memory killer (lmkd), read over Wireless debugging:\n${lowMemoryKiller(context)}"
|
||||
)
|
||||
Files.move(
|
||||
staged.toPath(), target.toPath(),
|
||||
|
||||
@@ -37,7 +37,7 @@ object SteamIntegration {
|
||||
locationOn = WifiDiscovery.locationEnabled(context),
|
||||
brightness = Settings.System.canWrite(context),
|
||||
home = HomeApp.isDefault(context),
|
||||
shortcuts = shortcutsEnabled(context),
|
||||
shortcuts = shortcutsEnabled(context) && shortcutsCurrent(context),
|
||||
shortcutsRestricted = restrictedSettings(context),
|
||||
suggested = !SessionPrefs.sessionPrefs(context).getBoolean("steam_integration_seen", false),
|
||||
)
|
||||
@@ -61,6 +61,10 @@ object SteamIntegration {
|
||||
return enabled.split(':').any { ComponentName.unflattenFromString(it.trim()) == shortcutsComponent }
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
fun shortcutsCurrent(context: Context): Boolean =
|
||||
runCatching { context.packageManager.getPackageInfo(Relay.PACKAGE, 0).versionCode }.getOrDefault(0) >= Relay.VERSION
|
||||
|
||||
fun shortcutsListed(context: Context): Boolean =
|
||||
context.getSystemService(android.view.accessibility.AccessibilityManager::class.java)
|
||||
?.installedAccessibilityServiceList.orEmpty()
|
||||
|
||||
@@ -335,7 +335,10 @@ object AddedGames {
|
||||
val path = canonical(exe)
|
||||
val owner = ownerFolder(app, exe)
|
||||
if (owner != null && owner.path !in SessionPrefs.removedAddedGames(app)) {
|
||||
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let { return AddResult.Existing(it) }
|
||||
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let {
|
||||
if (guestPath(app, exe) != null) AddedExes.put(app, AddedExes.Entry(owner.path, exe.path))
|
||||
return AddResult.Existing(it)
|
||||
}
|
||||
}
|
||||
if (guestPath(app, exe) == null) {
|
||||
(owner ?: exe.parentFile)?.takeIf { guestPath(app, it) == null }?.let { bindFolder(app, it) }
|
||||
@@ -344,7 +347,7 @@ object AddedGames {
|
||||
val folder = owner ?: exe.parentFile ?: return AddResult.NotFound
|
||||
SessionPrefs.setAddedGameRemoved(app, folder.path, false)
|
||||
SessionPrefs.setAddedGameExe(app, folder.path, exe.path)
|
||||
if (owner == null) AddedExes.put(app, AddedExes.Entry(folder.path, exe.path))
|
||||
AddedExes.put(app, AddedExes.Entry(folder.path, exe.path))
|
||||
val game = single(app, folder.path) ?: return AddResult.NotFound
|
||||
AddedGamesPublisher.later(app) { com.droiddeck.launcher.stores.SteamLiveShortcuts.sync(app, listOf(game)) { true } }
|
||||
Log.i(TAG, "added ${game.name} from its exe")
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.function.Supplier;
|
||||
|
||||
public final class LinuxVulkanDriver {
|
||||
private static final String TAG = "LinuxVulkanDriver";
|
||||
public static final String ENV = "BL_VK_DRIVER";
|
||||
public static final String ENV = "DD_VK_DRIVER";
|
||||
|
||||
public static final String HELP_TEXT =
|
||||
"The driver the Steam client, the games it launches and the desktop's programs render on, "
|
||||
|
||||
@@ -16,30 +16,36 @@ data class ScreenEffects(
|
||||
val hdr: Boolean = false,
|
||||
val deband: Boolean = false,
|
||||
val debandStrength: Int = 100,
|
||||
val fxaa: Boolean = false,
|
||||
val aaMode: Int = AA_OFF,
|
||||
val toon: Boolean = false,
|
||||
val crt: Boolean = false,
|
||||
val ntsc: Boolean = false,
|
||||
) {
|
||||
val fxaa: Boolean get() = aaMode == AA_FXAA
|
||||
val smaa: Boolean get() = aaMode == AA_SMAA
|
||||
val effectiveCas: Int get() = if (cas) casLevel else 0
|
||||
|
||||
val any: Boolean get() = brightness != 0 || contrast != 0 || abs(gamma - 1f) > 0.005f || saturation != 100 ||
|
||||
effectiveCas > 0 || hdr || deband || fxaa || toon || crt || ntsc
|
||||
effectiveCas > 0 || hdr || deband || aaMode != AA_OFF || toon || crt || ntsc
|
||||
|
||||
fun push(upscaler: Int) {
|
||||
WaylandCompositor.nativeSetCas(cas, casLevel)
|
||||
WaylandCompositor.nativeSetHdr(hdr)
|
||||
WaylandCompositor.nativeSetDeband(deband, debandStrength)
|
||||
WaylandCompositor.nativeSetScreenEffects(brightness.toFloat(), contrast.toFloat(), gamma, saturation.toFloat(), fxaa, toon, crt, ntsc)
|
||||
WaylandCompositor.nativeSetScreenEffects(brightness.toFloat(), contrast.toFloat(), gamma, saturation.toFloat(), aaMode, toon, crt, ntsc)
|
||||
WaylandCompositor.nativeSetLookName(ScreenEffectLooks.match(this, upscaler)?.name)
|
||||
}
|
||||
|
||||
fun encode(): JSONObject = JSONObject()
|
||||
.put("brightness", brightness).put("contrast", contrast).put("gamma", gamma.toDouble()).put("saturation", saturation)
|
||||
.put("cas", cas).put("casLevel", casLevel).put("hdr", hdr).put("deband", deband).put("debandStrength", debandStrength)
|
||||
.put("fxaa", fxaa).put("toon", toon).put("crt", crt).put("ntsc", ntsc)
|
||||
.put("aaMode", aaMode).put("fxaa", fxaa).put("toon", toon).put("crt", crt).put("ntsc", ntsc)
|
||||
|
||||
companion object {
|
||||
const val AA_OFF = 0
|
||||
const val AA_FXAA = 1
|
||||
const val AA_SMAA = 2
|
||||
|
||||
val OFF = ScreenEffects()
|
||||
|
||||
fun decode(json: JSONObject): ScreenEffects = ScreenEffects(
|
||||
@@ -52,7 +58,7 @@ data class ScreenEffects(
|
||||
hdr = json.optBoolean("hdr", false),
|
||||
deband = json.optBoolean("deband", false),
|
||||
debandStrength = json.optInt("debandStrength", 100).coerceIn(0, 200),
|
||||
fxaa = json.optBoolean("fxaa", false),
|
||||
aaMode = json.optInt("aaMode", if (json.optBoolean("fxaa", false)) AA_FXAA else AA_OFF).coerceIn(AA_OFF, AA_SMAA),
|
||||
toon = json.optBoolean("toon", false),
|
||||
crt = json.optBoolean("crt", false),
|
||||
ntsc = json.optBoolean("ntsc", false),
|
||||
@@ -79,13 +85,13 @@ object ScreenEffectLooks {
|
||||
desc = "Sharpening with a touch of contrast - the everyday one.", label = R.string.look_game_clarity, descRes = R.string.look_game_clarity_desc),
|
||||
Look("Vivid", ScreenEffects(brightness = 3, contrast = 10, gamma = 0.98f, saturation = 145, cas = true, casLevel = 30, deband = true),
|
||||
desc = "Colour pushed hard. Deband on so skies don't stripe.", label = R.string.look_vivid, descRes = R.string.look_vivid_desc),
|
||||
Look("Cinematic", ScreenEffects(brightness = -4, contrast = 22, gamma = 1.10f, saturation = 88, cas = true, casLevel = 20, fxaa = true, deband = true),
|
||||
Look("Cinematic", ScreenEffects(brightness = -4, contrast = 22, gamma = 1.10f, saturation = 88, cas = true, casLevel = 20, aaMode = ScreenEffects.AA_FXAA, deband = true),
|
||||
desc = "Deeper contrast, cooler colour, edges smoothed.", label = R.string.look_cinematic, descRes = R.string.look_cinematic_desc),
|
||||
Look("Competitive", ScreenEffects(brightness = 16, contrast = 18, gamma = 0.92f, saturation = 82, cas = true, casLevel = 75),
|
||||
desc = "Shadows lifted and heavy sharpening - spot people first.", label = R.string.look_competitive, descRes = R.string.look_competitive_desc),
|
||||
Look("Adaptive Sharpen", ScreenEffects(cas = true, casLevel = 85),
|
||||
desc = "Sharpening only, colour untouched.", label = R.string.look_adaptive_sharpen, descRes = R.string.look_adaptive_sharpen_desc),
|
||||
Look("Filmic", ScreenEffects(brightness = -2, contrast = 16, gamma = 1.14f, saturation = 92, cas = true, casLevel = 15, fxaa = true, deband = true),
|
||||
Look("Filmic", ScreenEffects(brightness = -2, contrast = 16, gamma = 1.14f, saturation = 92, cas = true, casLevel = 15, aaMode = ScreenEffects.AA_FXAA, deband = true),
|
||||
desc = "Film-like curve, slightly muted.", label = R.string.look_filmic, descRes = R.string.look_filmic_desc),
|
||||
Look("Arcade", ScreenEffects(brightness = 6, contrast = 20, gamma = 0.95f, saturation = 170, cas = true, casLevel = 45, deband = true),
|
||||
desc = "Loud and punchy.", label = R.string.look_arcade, descRes = R.string.look_arcade_desc),
|
||||
@@ -103,7 +109,7 @@ object ScreenEffectLooks {
|
||||
val t = l.effects
|
||||
t.brightness == e.brightness && t.contrast == e.contrast && abs(t.gamma - e.gamma) < 0.005f &&
|
||||
t.saturation == e.saturation && t.effectiveCas == e.effectiveCas &&
|
||||
t.fxaa == e.fxaa && t.crt == e.crt && t.toon == e.toon && t.ntsc == e.ntsc && t.deband == e.deband &&
|
||||
t.aaMode == e.aaMode && t.crt == e.crt && t.toon == e.toon && t.ntsc == e.ntsc && t.deband == e.deband &&
|
||||
(l.scalingMode == null || l.scalingMode == upscaler)
|
||||
}
|
||||
}
|
||||
@@ -256,12 +256,12 @@ public final class SystemVulkanDriver {
|
||||
if (xclipse) environment.add("DROIDDECK_HYBRIS_DXVK=dxvk-2.6.2");
|
||||
// The Android driver has a render node, but no KMS primary node. SDL presents
|
||||
// through the wrapper's Wayland Vulkan swapchain instead of a KMS-style path.
|
||||
environment.add("BL_GAMESCOPE_BACKEND=sdl");
|
||||
environment.add("DD_GAMESCOPE_BACKEND=sdl");
|
||||
// The Android pvr kernel accepts Vulkan DMA-BUF imports but rejects PRIME GEM handles.
|
||||
environment.add("BL_POWERVR_DRM_HANDLES=1");
|
||||
environment.add("BL_POWERVR_RENDER_NODE=" + node);
|
||||
environment.add("DD_POWERVR_DRM_HANDLES=1");
|
||||
environment.add("DD_POWERVR_RENDER_NODE=" + node);
|
||||
// Inner Gamescope/Xwayland lacks the bridge's Android-buffer WSI protocols.
|
||||
environment.add("BL_STEAM_GL_PRESENT=1");
|
||||
environment.add("DD_STEAM_GL_PRESENT=1");
|
||||
// Only actual Proton game launches use the bundled DXVK and X11 WSI layer.
|
||||
environment.add("DROIDDECK_POWERVR_RUNTIME=" + directory.getPath());
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
internal object DroidDeckHudConfig {
|
||||
val DEFAULTS: Map<String, String> = linkedMapOf(
|
||||
"hudSize" to "minimal", "hudLocked" to "1", "hudSnap" to "1", "hudScale" to "100", "hudDock" to "none", "hudOpacity" to "80", "hudColor" to "mid",
|
||||
"hudSize" to "minimal", "hudLocked" to "1", "hudHold" to "collapse", "hudSnap" to "1", "hudScale" to "100", "hudDock" to "none", "hudOpacity" to "80", "hudColor" to "mid",
|
||||
"hudOutline" to "40", "hudOutlineAccent" to "1",
|
||||
"showGpuModel" to "1", "showGPULoad" to "1", "showCPUUsage" to "1", "showCPULoad" to "1",
|
||||
"showPerCore" to "1", "showTemp" to "1", "showBatteryTemp" to "1", "showGpuTemp" to "0",
|
||||
@@ -18,6 +18,8 @@ internal object DroidDeckHudConfig {
|
||||
"tempUnit" to "c", "tempBands" to "1", "tempAuto" to "1", "tempRedCpu" to "90", "tempRedGpu" to "90", "tempRedBat" to "48",
|
||||
)
|
||||
|
||||
const val HOLD_LOCKS = "lock"
|
||||
|
||||
private val NOT_READINGS = setOf("showCPULoad", "showRenderer", "fpsDecimal")
|
||||
|
||||
/** Orders saved before the GPU switch was named after the alias the HUD actually reads. */
|
||||
|
||||
@@ -119,6 +119,7 @@ class DroidDeckHudHost(context: Context) {
|
||||
}
|
||||
hud.setOnSizeCycledListener { size -> DroidDeckHudConfig.set(context, "hudSize", size); onConfigChanged?.invoke() }
|
||||
hud.setOnDockChangedListener { token -> setDock(hud, DroidDeckHudDock.from(token)) }
|
||||
hud.setOnHoldListener { rawX, rawY -> collapseAt(hud, rawX, rawY) }
|
||||
hud.setOnScaledListener { percent ->
|
||||
DroidDeckHudConfig.set(context, "hudScale", percent.toString())
|
||||
onConfigChanged?.invoke()
|
||||
@@ -291,7 +292,7 @@ class DroidDeckHudHost(context: Context) {
|
||||
DroidDeckHudDock.RIGHT -> (maxX - hud.x) / hud.width
|
||||
DroidDeckHudDock.TOP -> hud.y / hud.height
|
||||
DroidDeckHudDock.BOTTOM -> (maxY - hud.y) / hud.height
|
||||
DroidDeckHudDock.NONE -> 0f
|
||||
DroidDeckHudDock.NONE, DroidDeckHudDock.FLOAT -> 0f
|
||||
}
|
||||
if (pulled >= 1f) { setDock(hud, DroidDeckHudDock.NONE); return }
|
||||
wantX = hud.x; wantY = hud.y
|
||||
@@ -375,12 +376,30 @@ class DroidDeckHudHost(context: Context) {
|
||||
hud.scaleX = s; hud.scaleY = s
|
||||
}
|
||||
|
||||
private fun setDock(hud: DroidDeckHudView, edge: DroidDeckHudDock) {
|
||||
private fun setDock(hud: DroidDeckHudView, edge: DroidDeckHudDock, center: Pair<Float, Float>? = null) {
|
||||
if (edge == hud.dock) return
|
||||
animateDock(hud, edge) { commitDock(hud, edge) }
|
||||
animateDock(hud, edge, center) { commitDock(hud, edge) }
|
||||
}
|
||||
|
||||
private fun collapseAt(hud: DroidDeckHudView, rawX: Float, rawY: Float) {
|
||||
if (hud.dock != DroidDeckHudDock.NONE) return
|
||||
val p = hud.parent as? View ?: return
|
||||
val at = IntArray(2).also { p.getLocationOnScreen(it) }
|
||||
val x = rawX - at[0]
|
||||
val y = rawY - at[1]
|
||||
val edge = if (snaps) nearestEdge(x, y, p.width.toFloat(), p.height.toFloat()) else DroidDeckHudDock.FLOAT
|
||||
setDock(hud, edge, Pair(x, y))
|
||||
}
|
||||
|
||||
private fun nearestEdge(x: Float, y: Float, width: Float, height: Float): DroidDeckHudDock = mapOf(
|
||||
DroidDeckHudDock.LEFT to x,
|
||||
DroidDeckHudDock.RIGHT to width - x,
|
||||
DroidDeckHudDock.TOP to y,
|
||||
DroidDeckHudDock.BOTTOM to height - y,
|
||||
).minByOrNull { it.value }!!.key
|
||||
|
||||
private fun commitDock(hud: DroidDeckHudView, edge: DroidDeckHudDock) {
|
||||
snapping = false
|
||||
val tabX = hud.x; val tabY = hud.y
|
||||
if (edge != DroidDeckHudDock.NONE) {
|
||||
val p = hud.parent as? View
|
||||
@@ -407,12 +426,17 @@ class DroidDeckHudHost(context: Context) {
|
||||
SessionPrefs.setDroidDeckHudPosition(context, wantX, wantY)
|
||||
}
|
||||
|
||||
private fun animateDock(hud: DroidDeckHudView, edge: DroidDeckHudDock, commit: () -> Unit) {
|
||||
private fun animateDock(hud: DroidDeckHudView, edge: DroidDeckHudDock, center: Pair<Float, Float>?, commit: () -> Unit) {
|
||||
stopMotion(hud)
|
||||
previewFade?.cancel(); previewFade = null
|
||||
snapping = false
|
||||
hud.alpha = 1f
|
||||
val p = hud.parent as? View
|
||||
if (edge != DroidDeckHudDock.NONE && center != null) {
|
||||
val (tabW, tabH) = hud.dockTabSize()
|
||||
wantX = center.first - tabW / 2f
|
||||
wantY = center.second - tabH / 2f
|
||||
}
|
||||
if (Motion.scale == 0f || p == null || !hud.isLaidOut || hud.width <= 0) {
|
||||
hud.scaleX = 1f; hud.scaleY = 1f
|
||||
hud.setDockPreview(DroidDeckHudDock.NONE, 0f)
|
||||
@@ -424,11 +448,14 @@ class DroidDeckHudHost(context: Context) {
|
||||
hud.pivotX = 0f; hud.pivotY = 0f
|
||||
hud.x = left; hud.y = top
|
||||
val (tabW, tabH) = hud.dockTabSize()
|
||||
wantX = left + (shownW - tabW) / 2f
|
||||
wantY = top + (shownH - tabH) / 2f
|
||||
if (center == null) {
|
||||
wantX = left + (shownW - tabW) / 2f
|
||||
wantY = top + (shownH - tabH) / 2f
|
||||
}
|
||||
val (tabX, tabY) = settled(p, edge, tabW, tabH)
|
||||
val sx = tabW / hud.width; val sy = tabH / hud.height
|
||||
val from = hud.dockPreviewBlend
|
||||
snapping = true
|
||||
hud.animate().x(tabX).y(tabY).scaleX(sx).scaleY(sy).setDuration(Motion.ms(220).toLong()).setInterpolator(EASE)
|
||||
.setUpdateListener { hud.setDockPreview(edge, from + (1f - from) * it.animatedFraction) }
|
||||
.withEndAction {
|
||||
@@ -473,7 +500,7 @@ class DroidDeckHudHost(context: Context) {
|
||||
DroidDeckHudDock.RIGHT -> x = maxX
|
||||
DroidDeckHudDock.TOP -> y = 0f
|
||||
DroidDeckHudDock.BOTTOM -> y = maxY
|
||||
DroidDeckHudDock.NONE -> {}
|
||||
DroidDeckHudDock.NONE, DroidDeckHudDock.FLOAT -> {}
|
||||
}
|
||||
return Pair(x, y)
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ enum class DroidDeckHudSize(val token: String, val label: String) {
|
||||
}
|
||||
|
||||
enum class DroidDeckHudDock(val token: String) {
|
||||
NONE("none"), LEFT("left"), RIGHT("right"), TOP("top"), BOTTOM("bottom");
|
||||
NONE("none"), LEFT("left"), RIGHT("right"), TOP("top"), BOTTOM("bottom"), FLOAT("float");
|
||||
|
||||
companion object {
|
||||
fun from(token: String?): DroidDeckHudDock = values().firstOrNull { it.token == token } ?: NONE
|
||||
|
||||
@@ -191,6 +191,8 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
private var onMovedListener: BiConsumer<Float, Float>? = null
|
||||
private var onSizeCycledListener: Consumer<String>? = null
|
||||
private var onLockChangedListener: Consumer<Boolean>? = null
|
||||
private var onHoldListener: BiConsumer<Float, Float>? = null
|
||||
fun setOnHoldListener(l: BiConsumer<Float, Float>?) { onHoldListener = l }
|
||||
fun setOnMovedListener(l: BiConsumer<Float, Float>?) { onMovedListener = l }
|
||||
fun setOnSizeCycledListener(l: Consumer<String>?) { onSizeCycledListener = l }
|
||||
fun setOnLockChangedListener(l: Consumer<Boolean>?) { onLockChangedListener = l }
|
||||
@@ -209,6 +211,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
override fun onDragged(rawX: Float, rawY: Float) { onDraggedListener?.accept(rawX, rawY) }
|
||||
override fun onFlung(velocityX: Float, velocityY: Float) { onFlungListener?.accept(velocityX, velocityY) }
|
||||
override fun onLockChanged(locked: Boolean) { onLockChangedListener?.accept(locked) }
|
||||
override fun onHold(rawX: Float, rawY: Float) { onHoldListener?.accept(rawX, rawY) }
|
||||
override fun onPinch(factor: Float) {
|
||||
val next = (scale * factor).coerceIn(MIN_SCALE, MAX_SCALE)
|
||||
if (next == scale) return
|
||||
@@ -224,6 +227,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
private var tabStartX = 0f
|
||||
private var tabStartY = 0f
|
||||
private var tabDragging = false
|
||||
private var tabPressed = false
|
||||
private var onTabDraggedListener: BiConsumer<Float, Float>? = null
|
||||
private var onTabDroppedListener: Runnable? = null
|
||||
private var onTabDragCancelledListener: Runnable? = null
|
||||
@@ -237,19 +241,24 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
tabDownRawX = event.rawX; tabDownRawY = event.rawY
|
||||
tabStartX = x; tabStartY = y
|
||||
tabDragging = false
|
||||
tabPressed = true
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
MotionEvent.ACTION_MOVE -> if (tabPressed) {
|
||||
val dx = event.rawX - tabDownRawX; val dy = event.rawY - tabDownRawY
|
||||
if (!tabDragging && dx * dx + dy * dy > touchSlop * touchSlop) tabDragging = true
|
||||
if (tabDragging) onTabDraggedListener?.accept(tabStartX + dx, tabStartY + dy)
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
MotionEvent.ACTION_UP -> if (tabPressed) {
|
||||
tabPressed = false
|
||||
if (tabDragging) { tabDragging = false; onTabDroppedListener?.run() }
|
||||
else onDockChangedListener?.accept(DroidDeckHudDock.NONE.token)
|
||||
}
|
||||
MotionEvent.ACTION_CANCEL -> if (tabDragging) {
|
||||
tabDragging = false
|
||||
onTabDragCancelledListener?.run()
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
tabPressed = false
|
||||
if (tabDragging) {
|
||||
tabDragging = false
|
||||
onTabDragCancelledListener?.run()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
@@ -341,6 +350,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
showSession = switchOn("showSession")
|
||||
tempDisplay = HudMetrics.TempDisplay.from(cfg)
|
||||
lockController.setLocked(cfg.get("hudLocked", "1") == "1")
|
||||
lockController.setHoldLocks(cfg.get("hudHold", "collapse") == DroidDeckHudConfig.HOLD_LOCKS)
|
||||
dock = DroidDeckHudDock.from(cfg.get("hudDock", "none"))
|
||||
|
||||
colorIntensity = when (cfg.get("hudColor", "vivid")) {
|
||||
@@ -591,7 +601,7 @@ class DroidDeckHudView(context: Context) : View(context) {
|
||||
DroidDeckHudDock.RIGHT -> intArrayOf(1, 2)
|
||||
DroidDeckHudDock.TOP -> intArrayOf(0, 1)
|
||||
DroidDeckHudDock.BOTTOM -> intArrayOf(2, 3)
|
||||
DroidDeckHudDock.NONE -> intArrayOf()
|
||||
DroidDeckHudDock.NONE, DroidDeckHudDock.FLOAT -> intArrayOf()
|
||||
}
|
||||
for (corner in edge) { round[corner * 2] = 0f; round[corner * 2 + 1] = 0f }
|
||||
tabPath.rewind()
|
||||
|
||||
@@ -275,7 +275,7 @@ internal class GameFrameFeed(
|
||||
private const val INFO_NS = 500_000_000L
|
||||
private const val SHIFT_NS = 1_000_000_000L
|
||||
private const val SHIFT_RECHECK_NS = 100_000_000L
|
||||
private const val CLOCK_CONTROL_PATH = "tmp/.bl-clock"
|
||||
private const val CLOCK_CONTROL_PATH = "tmp/.dd-clock"
|
||||
|
||||
fun forRoot(root: File) = GameFrameFeed(File(root, HudFrames.PATH), clockControl = File(root, CLOCK_CONTROL_PATH))
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ public class HudLockController {
|
||||
default void onDragged(float rawX, float rawY) {}
|
||||
default void onFlung(float velocityX, float velocityY) {}
|
||||
void onLockChanged(boolean locked);
|
||||
default void onHold(float rawX, float rawY) {}
|
||||
default void onPinch(float factor) {}
|
||||
default void onPinchEnd() {}
|
||||
}
|
||||
@@ -53,6 +54,7 @@ public class HudLockController {
|
||||
private final android.view.VelocityTracker velocity = android.view.VelocityTracker.obtain();
|
||||
|
||||
private boolean locked = false;
|
||||
private boolean holdLocks = false;
|
||||
|
||||
private float downRawX, downRawY, startX, startY;
|
||||
private boolean dragging = false;
|
||||
@@ -80,6 +82,8 @@ public class HudLockController {
|
||||
|
||||
public void setLocked(boolean locked) { this.locked = locked; }
|
||||
|
||||
public void setHoldLocks(boolean holdLocks) { this.holdLocks = holdLocks; }
|
||||
|
||||
public boolean isLocked() { return locked; }
|
||||
|
||||
public boolean isDragging() { return dragging; }
|
||||
@@ -119,6 +123,10 @@ public class HudLockController {
|
||||
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
if (!holdLocks) {
|
||||
cb.onHold(e.getRawX(), e.getRawY());
|
||||
return;
|
||||
}
|
||||
locked = !locked;
|
||||
cb.onLockChanged(locked);
|
||||
flash(locked, HOLD_TOGGLE_MS);
|
||||
|
||||
@@ -82,6 +82,12 @@ object DualScreen {
|
||||
fun sessionDisplay(context: Context, displayManager: DisplayManager, primaryDisplayId: Int): Display? =
|
||||
display(context, displayManager, primaryDisplayId, SessionPrefs.dualScreenSessionMode(context))
|
||||
|
||||
fun selectedSessionDisplay(context: Context, displayManager: DisplayManager, primaryDisplayId: Int, selectedDisplayId: Int): Display? =
|
||||
displayManager.getDisplay(selectedDisplayId)?.takeIf {
|
||||
SessionPrefs.dualScreenSessionMode(context) != MODE_OFF && it.isValid && it.displayId != primaryDisplayId &&
|
||||
(it.flags and Display.FLAG_PRESENTATION) != 0 && !taken(it.displayId)
|
||||
}
|
||||
|
||||
fun display(context: Context, displayManager: DisplayManager, primaryDisplayId: Int, mode: String = SessionPrefs.dualScreenMode(context)): Display? =
|
||||
when (mode) {
|
||||
MODE_OFF -> null
|
||||
|
||||
@@ -97,6 +97,16 @@ data class InputLibrary(
|
||||
fun compileActive(isDesktop: Boolean, panel: String? = null): InputProfile = compileParts(activeId(isDesktop), InputRole.entries.associateWith {
|
||||
preset(if (it == InputRole.SECONDARY) panelPart(isDesktop, panel).bindings else activePart(isDesktop, it).bindings)
|
||||
})
|
||||
fun compileStock(isDesktop: Boolean, panel: String? = null): InputProfile {
|
||||
val defaults = InputProfile.defaults(profile(activeId(isDesktop)).base)
|
||||
val stock = InputStockLayouts.presets(InputStockLayouts.layouts())
|
||||
return compileParts(defaults.id, InputRole.entries.associateWith { role ->
|
||||
val part = if (role == InputRole.SECONDARY) panelPart(isDesktop, panel) else activePart(isDesktop, role)
|
||||
val origin = layouts.firstOrNull { it.id == part.layout }?.origin ?: part.layout
|
||||
stock.firstOrNull { it.id == part.bindings || (origin != null && it.layoutId == origin) }
|
||||
?: SavedInputBindings(part.bindings, "", role == InputRole.PHYSICAL, part.layout, defaults.bindings[role].orEmpty())
|
||||
})
|
||||
}
|
||||
|
||||
fun saveSelection(isDesktop: Boolean, name: String, id: String = newInputId()): InputLibrary {
|
||||
val current = profile(activeId(isDesktop))
|
||||
|
||||
@@ -53,6 +53,16 @@ data class InputProfile(
|
||||
fun elementClickAction(role: InputRole, element: InputSurfaceElement): InputAction = clicks[role]?.get(element.id)
|
||||
?: defaultElementClick(element, elementAction(role, element.id, element.control)) { action(role, it) }
|
||||
|
||||
fun showsMouseButton(role: InputRole, shown: List<InputSurfaceElement>, stock: InputProfile): Boolean = shown.any { element ->
|
||||
val action = elementAction(role, element.id, element.control).takeIf {
|
||||
elements[role]?.get(element.id) != stock.elements[role]?.get(element.id) || it != stock.elementAction(role, element.id, element.control)
|
||||
}
|
||||
val click = elementClickAction(role, element).takeIf {
|
||||
clicks[role]?.get(element.id) != stock.clicks[role]?.get(element.id) || it != stock.elementClickAction(role, element)
|
||||
}
|
||||
listOfNotNull(action, click).any { it is InputAction.MouseButton && it.validFor(element.control) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val GAME = "game"
|
||||
const val DESKTOP = "desktop"
|
||||
|
||||
@@ -26,6 +26,8 @@ class KeyboardHost(
|
||||
var imeShowing = false
|
||||
private set
|
||||
var onImeChanged: ((Boolean) -> Unit)? = null
|
||||
val hideMeansDismissal: Boolean
|
||||
get() = Build.VERSION.SDK_INT < Build.VERSION_CODES.R || (shown && imeShowing)
|
||||
|
||||
init {
|
||||
isFocusable = false
|
||||
|
||||
@@ -176,7 +176,7 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
}
|
||||
|
||||
|
||||
fun elements(): List<InputSurfaceElement> {
|
||||
fun elements(previousStickGeometry: Boolean = false): List<InputSurfaceElement> {
|
||||
fit = fitScale()
|
||||
controls.forEach { it.radius = scaled(it.radiusDp) }
|
||||
placeAuto(width.toFloat(), height.toFloat())
|
||||
@@ -189,7 +189,7 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
}.map { c ->
|
||||
InputSurfaceElement(requireNotNull(InputControl.fromId(c.id)), (c.cx - c.halfW) / width, (c.cy - c.halfH) / height,
|
||||
2 * c.halfW / width, 2 * c.halfH / height, floating = settings.adaptiveSticks, hideWhenIdle = c.stick >= 0 && settings.adaptiveSticks,
|
||||
buttonShape = if (c.id in shoulderIds) InputButtonShape.PILL else InputButtonShape.CIRCLE).let(::widenStick).bounded()
|
||||
buttonShape = if (c.id in shoulderIds) InputButtonShape.PILL else InputButtonShape.CIRCLE).let { if (previousStickGeometry) widenStickPreviously(it) else widenStick(it) }.bounded()
|
||||
}.toMutableList()
|
||||
if (settings.keyboardButton) result += keyboard()
|
||||
return result
|
||||
@@ -315,7 +315,7 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
return e.copy(x = (cx - radius) / width, y = (cy - radius) / height, width = 2 * radius / width, height = 2 * radius / height)
|
||||
}
|
||||
|
||||
private fun widenStick(e: InputSurfaceElement): InputSurfaceElement {
|
||||
private fun widenStickPreviously(e: InputSurfaceElement): InputSurfaceElement {
|
||||
val extra = e.width * (STICK_REACH - 1f)
|
||||
return when (e.control) {
|
||||
InputControl.LS -> (e.x - extra).coerceAtLeast(0f).let { x -> e.copy(x = x, width = e.x + e.width - x) }
|
||||
@@ -323,6 +323,16 @@ internal class LegacyGamepadLayout(private val context: Context, private val wid
|
||||
else -> e
|
||||
}
|
||||
}
|
||||
|
||||
private fun widenStick(e: InputSurfaceElement): InputSurfaceElement {
|
||||
val extra = e.width * (STICK_REACH - 1f)
|
||||
val width = e.width + extra
|
||||
return when (e.control) {
|
||||
InputControl.LS -> e.copy(x = (e.x - extra).coerceIn(0f, (1f - width).coerceAtLeast(0f)), width = width)
|
||||
InputControl.RS -> e.copy(x = e.x.coerceIn(0f, (1f - width).coerceAtLeast(0f)), width = width)
|
||||
else -> e
|
||||
}
|
||||
}
|
||||
private companion object {
|
||||
const val MIN_FACE_MM = 9.5f
|
||||
const val FULL_SIZE_HEIGHT_MM = 85f
|
||||
|
||||
@@ -32,6 +32,7 @@ class OnScreenControls(context: Context, pad: PadBridge?, val dock: OnScreenLayo
|
||||
var isPinnedOnly = false
|
||||
private set
|
||||
val hasPinned get() = layout?.elements?.any { it.alwaysShown } == true
|
||||
val inputSurface: com.droiddeck.launcher.ui.InputSurfaceView get() = surface
|
||||
var onTouchMiss: ((MotionEvent) -> Unit)?
|
||||
get() = surface.onTouchMiss
|
||||
set(value) { surface.onTouchMiss = value }
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.Rect
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
object OnScreenLayout {
|
||||
data class Dock(val portrait: Boolean, val grips: Boolean, val left: InputControl = InputControl.LS, val right: InputControl = InputControl.RS) {
|
||||
@@ -41,6 +42,14 @@ object OnScreenLayout {
|
||||
return stored.mapNotNull { byId[it.id] } + placed.filter { p -> stored.none { it.id == p.id } }
|
||||
}
|
||||
|
||||
fun editorElements(context: Context, layout: SavedInputLayout, width: Int, height: Int, edited: Boolean = false): List<InputSurfaceElement> =
|
||||
elements(context, if (edited && width > 0 && height > 0) layout.copy(aspect = width.toFloat() / height) else layout, width, height, Rect())
|
||||
|
||||
fun editorFrame(layout: SavedInputLayout, displayed: List<InputSurfaceElement>): List<InputSurfaceElement> {
|
||||
val byId = displayed.associateBy { it.id }
|
||||
return layout.elements.map { byId[it.id] ?: it }
|
||||
}
|
||||
|
||||
fun fit(elements: List<InputSurfaceElement>, referenceWidth: Float, referenceHeight: Float, width: Int, height: Int, safe: Rect): List<InputSurfaceElement> {
|
||||
val w = width.toFloat()
|
||||
val h = height.toFloat()
|
||||
@@ -77,8 +86,11 @@ object OnScreenLayout {
|
||||
if (gamepad.any { it.id.startsWith("legacy:") }) {
|
||||
val named = layout.id.removePrefix("migrated.layout.").takeIf { it != layout.id }?.split('x')?.mapNotNull { it.toIntOrNull() }
|
||||
?.takeIf { it.size == 2 && it.all { size -> size > 0 } }?.let { it[0] to it[1] }
|
||||
for ((w, h) in listOfNotNull(named, width to height, long to short, short to long).distinct()) {
|
||||
if (matches(gamepad, LegacyGamepadLayout(display, w, h, scale = layout.scale).elements())) return (w.toFloat() to h.toFloat()) to true
|
||||
val aspectSize = layout.aspect.takeIf { layout.id == InputLibraries.OVERLAY && it > 0f }
|
||||
?.let { (it * height).roundToInt().coerceAtLeast(1) to height }
|
||||
for ((w, h) in listOfNotNull(named, width to height, aspectSize, long to short, short to long).distinct()) {
|
||||
val generator = LegacyGamepadLayout(display, w, h, scale = layout.scale)
|
||||
if (matches(gamepad, generator.elements()) || matches(gamepad, generator.elements(previousStickGeometry = true))) return (w.toFloat() to h.toFloat()) to true
|
||||
}
|
||||
}
|
||||
val aspect = layout.aspect.takeIf { it > 0f } ?: (long.toFloat() / short)
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.droiddeck.launcher.session.SessionState;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicIntegerArray;
|
||||
|
||||
public final class PadBridge {
|
||||
@@ -56,6 +58,7 @@ public final class PadBridge {
|
||||
private final FakeInputWriter[] playerWriters = new FakeInputWriter[SLOTS];
|
||||
private final PadState[] playerStates = new PadState[SLOTS];
|
||||
private final float[][] rawSticks = new float[SLOTS][4];
|
||||
private final Map<Integer, Boolean> rightStickLayouts = new HashMap<>();
|
||||
private final boolean[][] keyTriggers = new boolean[SLOTS][2];
|
||||
private final int[] retainedSticks = new int[SLOTS];
|
||||
private final PadState effectiveState = new PadState();
|
||||
@@ -240,6 +243,7 @@ public final class PadBridge {
|
||||
clearBackQamWrites();
|
||||
releaseBackPaddles();
|
||||
activeControllerId = NO_CONTROLLER;
|
||||
rightStickLayouts.clear();
|
||||
for (int slot = 0; slot < SLOTS; slot++) {
|
||||
owners[slot] = NO_CONTROLLER;
|
||||
partners[slot] = NO_CONTROLLER;
|
||||
@@ -525,20 +529,23 @@ public final class PadBridge {
|
||||
float lx = event.getAxisValue(MotionEvent.AXIS_X);
|
||||
float ly = event.getAxisValue(MotionEvent.AXIS_Y);
|
||||
boolean wired = wiredXboxLayout(device, event.getSource());
|
||||
float rx = event.getAxisValue(wired ? MotionEvent.AXIS_RX : MotionEvent.AXIS_Z);
|
||||
float ry = event.getAxisValue(wired ? MotionEvent.AXIS_RY : MotionEvent.AXIS_RZ);
|
||||
boolean rxRyStick = rightStickUsesRxRy(event, device, rightStickLayouts);
|
||||
float rx = event.getAxisValue(rxRyStick ? MotionEvent.AXIS_RX : MotionEvent.AXIS_Z);
|
||||
float ry = event.getAxisValue(rxRyStick ? MotionEvent.AXIS_RY : MotionEvent.AXIS_RZ);
|
||||
retainStick(slot, JoyCon.LEFT, lx, ly);
|
||||
retainStick(slot, JoyCon.RIGHT, rx, ry);
|
||||
projectSticks(slot);
|
||||
int source = event.getSource();
|
||||
float lt = 0f;
|
||||
float rt = 0f;
|
||||
if (wired || hasAxis(device, source, MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_BRAKE)) {
|
||||
lt = axisTrigger(leftTrigger(event, wired), keyTriggers[slot], 0);
|
||||
boolean signedLeft = signedZTriggers(event, device, wired, rxRyStick, true);
|
||||
boolean signedRight = signedZTriggers(event, device, wired, rxRyStick, false);
|
||||
if (signedLeft || hasAxis(device, source, MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_BRAKE)) {
|
||||
lt = axisTrigger(triggerValue(event, device, wired, rxRyStick, true), keyTriggers[slot], 0);
|
||||
pad.leftTrigger = lt;
|
||||
}
|
||||
if (wired || hasAxis(device, source, MotionEvent.AXIS_RTRIGGER, MotionEvent.AXIS_GAS)) {
|
||||
rt = axisTrigger(rightTrigger(event, wired), keyTriggers[slot], 1);
|
||||
if (signedRight || hasAxis(device, source, MotionEvent.AXIS_RTRIGGER, MotionEvent.AXIS_GAS)) {
|
||||
rt = axisTrigger(triggerValue(event, device, wired, rxRyStick, false), keyTriggers[slot], 1);
|
||||
pad.rightTrigger = rt;
|
||||
}
|
||||
if (hasAxis(device, source, MotionEvent.AXIS_HAT_X)) {
|
||||
@@ -596,6 +603,92 @@ public final class PadBridge {
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean rightStickUsesRxRy(MotionEvent event, InputDevice device, Map<Integer, Boolean> layouts) {
|
||||
int source = event.getSource();
|
||||
if (wiredXboxLayout(device, source)) return true;
|
||||
boolean hasRxRy = hasAxis(device, source, MotionEvent.AXIS_RX)
|
||||
&& hasAxis(device, source, MotionEvent.AXIS_RY);
|
||||
boolean hasZRz = hasAxis(device, source, MotionEvent.AXIS_Z)
|
||||
&& hasAxis(device, source, MotionEvent.AXIS_RZ);
|
||||
if (!hasRxRy) return false;
|
||||
if (!hasZRz) return true;
|
||||
Boolean cached = layouts.get(event.getDeviceId());
|
||||
if (cached != null) return cached;
|
||||
boolean rxRyEvidence = atMinimum(device, source, event, MotionEvent.AXIS_Z, MotionEvent.AXIS_RZ)
|
||||
&& nearCentre(device, source, event, MotionEvent.AXIS_RX, MotionEvent.AXIS_RY);
|
||||
boolean zRzEvidence = atMinimum(device, source, event, MotionEvent.AXIS_RX, MotionEvent.AXIS_RY)
|
||||
&& nearCentre(device, source, event, MotionEvent.AXIS_Z, MotionEvent.AXIS_RZ);
|
||||
if (rxRyEvidence == zRzEvidence) return false;
|
||||
boolean useRxRy = rxRyEvidence;
|
||||
layouts.put(event.getDeviceId(), useRxRy);
|
||||
return useRxRy;
|
||||
}
|
||||
|
||||
static boolean signedZTriggers(MotionEvent event, InputDevice device, boolean wired, boolean rxRyStick, boolean left) {
|
||||
if (wired) return true;
|
||||
if (!rxRyStick) return false;
|
||||
int source = event.getSource();
|
||||
int signedAxis = left ? MotionEvent.AXIS_Z : MotionEvent.AXIS_RZ;
|
||||
int dedicatedAxis = left ? MotionEvent.AXIS_LTRIGGER : MotionEvent.AXIS_RTRIGGER;
|
||||
int alternateAxis = left ? MotionEvent.AXIS_BRAKE : MotionEvent.AXIS_GAS;
|
||||
return hasAxis(device, source, signedAxis)
|
||||
&& !hasAxis(device, source, dedicatedAxis, alternateAxis);
|
||||
}
|
||||
|
||||
static float triggerValue(MotionEvent event, InputDevice device, boolean wired, boolean rxRyStick, boolean left) {
|
||||
if (signedZTriggers(event, device, wired, rxRyStick, left)) {
|
||||
int axis = left ? MotionEvent.AXIS_Z : MotionEvent.AXIS_RZ;
|
||||
float value = event.getAxisValue(axis);
|
||||
if (!wired && device != null) {
|
||||
InputDevice.MotionRange range = device.getMotionRange(axis, event.getSource());
|
||||
if (range != null && range.getMax() > range.getMin()) {
|
||||
return Math.max(0f, Math.min(1f,
|
||||
(value - range.getMin()) / (range.getMax() - range.getMin())));
|
||||
}
|
||||
}
|
||||
return Math.max(0f, Math.min(1f, (value + 1f) / 2f));
|
||||
}
|
||||
int source = event.getSource();
|
||||
int axis = left ? MotionEvent.AXIS_LTRIGGER : MotionEvent.AXIS_RTRIGGER;
|
||||
int alternate = left ? MotionEvent.AXIS_BRAKE : MotionEvent.AXIS_GAS;
|
||||
if (device == null) {
|
||||
float value = event.getAxisValue(axis);
|
||||
return value != 0f ? value : event.getAxisValue(alternate);
|
||||
}
|
||||
if (hasAxis(device, source, axis)) {
|
||||
float value = event.getAxisValue(axis);
|
||||
return value != 0f ? value : event.getAxisValue(alternate);
|
||||
}
|
||||
if (hasAxis(device, source, alternate)) return event.getAxisValue(alternate);
|
||||
return 0f;
|
||||
}
|
||||
|
||||
private static float restDistance(InputDevice device, int source, MotionEvent event, int xAxis, int yAxis) {
|
||||
return (restDistance(device.getMotionRange(xAxis, source), event.getAxisValue(xAxis))
|
||||
+ restDistance(device.getMotionRange(yAxis, source), event.getAxisValue(yAxis))) / 2f;
|
||||
}
|
||||
|
||||
private static float restDistance(InputDevice.MotionRange range, float value) {
|
||||
float span = range.getMax() - range.getMin();
|
||||
if (span <= 0f) return 1f;
|
||||
return Math.abs(value - (range.getMin() + range.getMax()) / 2f) / span;
|
||||
}
|
||||
|
||||
private static boolean atMinimum(InputDevice device, int source, MotionEvent event, int xAxis, int yAxis) {
|
||||
return atMinimum(device.getMotionRange(xAxis, source), event.getAxisValue(xAxis))
|
||||
&& atMinimum(device.getMotionRange(yAxis, source), event.getAxisValue(yAxis));
|
||||
}
|
||||
|
||||
private static boolean atMinimum(InputDevice.MotionRange range, float value) {
|
||||
float span = range.getMax() - range.getMin();
|
||||
return value - range.getMin() <= span * 0.02f;
|
||||
}
|
||||
|
||||
private static boolean nearCentre(InputDevice device, int source, MotionEvent event, int xAxis, int yAxis) {
|
||||
return restDistance(device.getMotionRange(xAxis, source), event.getAxisValue(xAxis)) <= 0.1f
|
||||
&& restDistance(device.getMotionRange(yAxis, source), event.getAxisValue(yAxis)) <= 0.1f;
|
||||
}
|
||||
|
||||
public interface TouchRoute {
|
||||
boolean active();
|
||||
|
||||
@@ -1182,16 +1275,4 @@ public final class PadBridge {
|
||||
&& device.getMotionRange(MotionEvent.AXIS_RZ, source) != null;
|
||||
}
|
||||
|
||||
public static float leftTrigger(MotionEvent event, boolean wired) {
|
||||
if (wired) return Math.max(0f, Math.min(1f, (event.getAxisValue(MotionEvent.AXIS_Z) + 1f) / 2f));
|
||||
float value = event.getAxisValue(MotionEvent.AXIS_LTRIGGER);
|
||||
return value != 0f ? value : event.getAxisValue(MotionEvent.AXIS_BRAKE);
|
||||
}
|
||||
|
||||
public static float rightTrigger(MotionEvent event, boolean wired) {
|
||||
if (wired) return Math.max(0f, Math.min(1f, (event.getAxisValue(MotionEvent.AXIS_RZ) + 1f) / 2f));
|
||||
float value = event.getAxisValue(MotionEvent.AXIS_RTRIGGER);
|
||||
return value != 0f ? value : event.getAxisValue(MotionEvent.AXIS_GAS);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,6 +42,7 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S
|
||||
private val total = Sticks()
|
||||
private val triggerAxes = HashMap<Int, Boolean>()
|
||||
private val wiredLayout = HashMap<Int, Boolean>()
|
||||
private val rightStickLayouts = HashMap<Int, Boolean>()
|
||||
private val down = HashMap<Int, MutableSet<Int>>()
|
||||
private val sent = HashMap<Int, IntArray>()
|
||||
private val held = LinkedHashMap<Int, Int>()
|
||||
@@ -87,14 +88,21 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S
|
||||
fun onMotion(event: MotionEvent): Boolean {
|
||||
if (event.actionMasked != MotionEvent.ACTION_MOVE) return true
|
||||
val sticks = physical.getOrPut(event.deviceId) { Sticks() }
|
||||
val wired = wiredLayout.getOrPut(event.deviceId) { PadBridge.wiredXboxLayout(event) }
|
||||
val device = event.device
|
||||
val wired = wiredLayout.getOrPut(event.deviceId) { PadBridge.wiredXboxLayout(device, event.source) }
|
||||
val rxRyStick = PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts)
|
||||
sticks.leftX = event.getAxisValue(MotionEvent.AXIS_X)
|
||||
sticks.leftY = event.getAxisValue(MotionEvent.AXIS_Y)
|
||||
sticks.rightX = scrollAxis(event, if (wired) MotionEvent.AXIS_RX else MotionEvent.AXIS_Z)
|
||||
sticks.rightY = scrollAxis(event, if (wired) MotionEvent.AXIS_RY else MotionEvent.AXIS_RZ)
|
||||
if (hasTriggerAxes(event)) {
|
||||
sticks.leftTrigger = PadBridge.leftTrigger(event, wired)
|
||||
sticks.rightTrigger = PadBridge.rightTrigger(event, wired)
|
||||
sticks.rightX = scrollAxis(event, if (rxRyStick) MotionEvent.AXIS_RX else MotionEvent.AXIS_Z)
|
||||
sticks.rightY = scrollAxis(event, if (rxRyStick) MotionEvent.AXIS_RY else MotionEvent.AXIS_RZ)
|
||||
val signedLeft = PadBridge.signedZTriggers(event, device, wired, rxRyStick, true)
|
||||
val signedRight = PadBridge.signedZTriggers(event, device, wired, rxRyStick, false)
|
||||
val analogTriggers = hasTriggerAxes(event)
|
||||
if (analogTriggers || signedLeft) {
|
||||
sticks.leftTrigger = PadBridge.triggerValue(event, device, wired, rxRyStick, true)
|
||||
}
|
||||
if (analogTriggers || signedRight) {
|
||||
sticks.rightTrigger = PadBridge.triggerValue(event, device, wired, rxRyStick, false)
|
||||
}
|
||||
val hatX = event.getAxisValue(MotionEvent.AXIS_HAT_X)
|
||||
val hatY = event.getAxisValue(MotionEvent.AXIS_HAT_Y)
|
||||
@@ -129,6 +137,7 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S
|
||||
physical.clear()
|
||||
triggerAxes.clear()
|
||||
wiredLayout.clear()
|
||||
rightStickLayouts.clear()
|
||||
touch.clear()
|
||||
down.clear()
|
||||
sent.clear()
|
||||
@@ -207,6 +216,7 @@ class PadMouse(private val listener: Listener, private val clock: () -> Long = S
|
||||
private fun hasTriggerAxes(event: android.view.InputEvent): Boolean = triggerAxes.getOrPut(event.deviceId) {
|
||||
val device = event.device ?: return@getOrPut true
|
||||
device.getMotionRange(MotionEvent.AXIS_LTRIGGER) != null || device.getMotionRange(MotionEvent.AXIS_BRAKE) != null ||
|
||||
device.getMotionRange(MotionEvent.AXIS_RTRIGGER) != null || device.getMotionRange(MotionEvent.AXIS_GAS) != null ||
|
||||
(event is MotionEvent && wiredLayout.getOrPut(event.deviceId) { PadBridge.wiredXboxLayout(event) })
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ class ScrollTouchGestures(
|
||||
private var flingY = 0f
|
||||
private var flingAt = 0L
|
||||
private var flinging = false
|
||||
var clicks = true
|
||||
|
||||
private val longPress = Runnable {
|
||||
held = true
|
||||
@@ -86,7 +87,7 @@ class ScrollTouchGestures(
|
||||
lastY = startY
|
||||
tracker = VelocityTracker.obtain().also { it.addMovement(event) }
|
||||
listener.onMove(startX, startY)
|
||||
handler.postDelayed(longPress, TouchTiming.HOLD_MS)
|
||||
if (clicks) handler.postDelayed(longPress, TouchTiming.HOLD_MS)
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val index = event.findPointerIndex(pointerId).takeIf { it >= 0 } ?: return true
|
||||
@@ -153,6 +154,7 @@ class ScrollTouchGestures(
|
||||
|
||||
private fun click(button: Int) {
|
||||
releaseClick()
|
||||
if (!clicks) return
|
||||
listener.onButton(button, true)
|
||||
clicked = button
|
||||
handler.postDelayed(clickUp, TouchTiming.CLICK_MS)
|
||||
|
||||
@@ -40,6 +40,18 @@ enum class SecondScreenMode(val id: String, @StringRes val label: Int, val bindi
|
||||
data class SecondScreenDisplay(val id: Int, val label: String)
|
||||
|
||||
object SecondScreenDisplays {
|
||||
fun selection(selected: Int, available: List<Int>, gameRequested: Boolean): Int =
|
||||
if (selected in available || gameRequested && selected >= 0) selected else available.firstOrNull() ?: -1
|
||||
|
||||
fun selection(selected: Int, available: List<Int>, gameRequested: Boolean, save: (Int) -> Unit): Int =
|
||||
selection(selected, available, gameRequested).also { if (it != selected) save(it) }
|
||||
|
||||
fun keyboardOnPrimary(gameRequested: Boolean, selected: Int, available: List<Int>, visible: Boolean = true, taken: (Int) -> Boolean): Boolean =
|
||||
visible && gameRequested && selected >= 0 && (selected !in available || taken(selected))
|
||||
|
||||
fun routeKeyboard(steam: Boolean, enabled: Boolean, panel: Boolean, dock: Boolean, primaryFallback: Boolean): Boolean =
|
||||
steam && enabled && (panel || dock || primaryFallback)
|
||||
|
||||
fun available(displayManager: DisplayManager, primaryDisplayId: Int = Display.DEFAULT_DISPLAY): List<SecondScreenDisplay> =
|
||||
displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
|
||||
.asSequence()
|
||||
|
||||
@@ -178,4 +178,56 @@ class ShortcutsRelay : Service(), InputManager.InputDeviceListener {
|
||||
private companion object {
|
||||
const val KEY_TIMEOUT_MS = 200L
|
||||
}
|
||||
|
||||
// Frontends such as Cocoon treat a running player process as an open game, so the relay runs only while a screen is started.
|
||||
object Holder : android.app.Application.ActivityLifecycleCallbacks, android.content.ServiceConnection {
|
||||
private const val RELEASE_MS = 1_000L
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var app: android.app.Application? = null
|
||||
private var started = 0
|
||||
private var bound = false
|
||||
private val release = Runnable { unbind() }
|
||||
|
||||
fun install(application: android.app.Application) {
|
||||
app?.unregisterActivityLifecycleCallbacks(this)
|
||||
handler.removeCallbacks(release)
|
||||
started = 0
|
||||
bound = false
|
||||
app = application
|
||||
application.registerActivityLifecycleCallbacks(this)
|
||||
}
|
||||
|
||||
override fun onActivityStarted(activity: android.app.Activity) {
|
||||
started++
|
||||
handler.removeCallbacks(release)
|
||||
if (!bound) bind()
|
||||
}
|
||||
|
||||
override fun onActivityStopped(activity: android.app.Activity) {
|
||||
started = (started - 1).coerceAtLeast(0)
|
||||
if (started == 0) handler.postDelayed(release, RELEASE_MS)
|
||||
}
|
||||
|
||||
private fun bind() {
|
||||
val context = app ?: return
|
||||
if (runCatching { context.packageManager.getPackageInfo(Relay.PACKAGE, 0) }.isFailure) return
|
||||
bound = runCatching {
|
||||
context.bindService(Intent(context, ShortcutsRelay::class.java), this, Context.BIND_AUTO_CREATE)
|
||||
}.getOrDefault(false)
|
||||
}
|
||||
|
||||
private fun unbind() {
|
||||
if (!bound) return
|
||||
bound = false
|
||||
runCatching { app?.unbindService(this) }
|
||||
}
|
||||
|
||||
override fun onServiceConnected(name: android.content.ComponentName?, service: IBinder?) = Unit
|
||||
override fun onServiceDisconnected(name: android.content.ComponentName?) = Unit
|
||||
override fun onActivityCreated(activity: android.app.Activity, savedInstanceState: android.os.Bundle?) = Unit
|
||||
override fun onActivityResumed(activity: android.app.Activity) = Unit
|
||||
override fun onActivityPaused(activity: android.app.Activity) = Unit
|
||||
override fun onActivitySaveInstanceState(activity: android.app.Activity, outState: android.os.Bundle) = Unit
|
||||
override fun onActivityDestroyed(activity: android.app.Activity) = Unit
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,11 @@ class TouchpadGestures(
|
||||
var bounds: android.graphics.RectF = android.graphics.RectF(0f, 0f, 1f, 1f)
|
||||
var sensitivity = 1.15f
|
||||
var desktop = false
|
||||
var clicks = true
|
||||
set(value) {
|
||||
if (field != value) lastTapAt = 0L
|
||||
field = value
|
||||
}
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private var lastX = 0f
|
||||
@@ -50,12 +55,17 @@ class TouchpadGestures(
|
||||
held = true
|
||||
dragging = true
|
||||
listener.onLongPress()
|
||||
listener.onButton(PointerGestures.BTN_LEFT, true, x, y)
|
||||
press(PointerGestures.BTN_LEFT)
|
||||
}
|
||||
private val clickUp = Runnable { releaseClick() }
|
||||
|
||||
private fun press(button: Int) {
|
||||
if (clicks) listener.onButton(button, true, x, y)
|
||||
}
|
||||
|
||||
private fun click(button: Int) {
|
||||
releaseClick()
|
||||
if (!clicks) return
|
||||
listener.onButton(button, true, x, y)
|
||||
clicked = button
|
||||
handler.postDelayed(clickUp, TouchTiming.CLICK_MS)
|
||||
@@ -108,12 +118,12 @@ class TouchpadGestures(
|
||||
travelled = 0f; held = false; twoFingers = false; scrolled = false; secondWasTap = false
|
||||
fingers = 1; pinching = false
|
||||
anchorId = event.getPointerId(0); moverId = -1; holdDrag = false; scrollLocked = false
|
||||
if (event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) {
|
||||
if (clicks && event.eventTime - lastTapAt < TouchTiming.DOUBLE_TAP_MS) {
|
||||
dragging = true
|
||||
listener.onButton(PointerGestures.BTN_LEFT, true, x, y)
|
||||
press(PointerGestures.BTN_LEFT)
|
||||
} else {
|
||||
dragging = false
|
||||
handler.postDelayed(longPress, TouchTiming.HOLD_MS)
|
||||
if (clicks) handler.postDelayed(longPress, TouchTiming.HOLD_MS)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -153,7 +163,7 @@ class TouchpadGestures(
|
||||
secondWasTap = false
|
||||
if (!dragging) {
|
||||
dragging = true
|
||||
listener.onButton(PointerGestures.BTN_LEFT, true, x, y)
|
||||
press(PointerGestures.BTN_LEFT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,12 +218,15 @@ object BwrapSpawner {
|
||||
private fun runtimeLib(rootfs: String, name: String): File? =
|
||||
LIB_DIRS.map { File(rootfs, "$it/$name") }.firstOrNull { it.exists() }
|
||||
|
||||
private fun gpu(rootfs: String, root: File, env: MutableMap<String, String>): List<Bind>? {
|
||||
internal fun gpu(
|
||||
rootfs: String, root: File, env: MutableMap<String, String>,
|
||||
kgslAvailable: Boolean = File("/dev/kgsl-3d0").exists(),
|
||||
): List<Bind>? {
|
||||
env["VKBRIDGE_SOCKET"]?.let { sock -> if (File(sock).exists()) return bridgeGpu(rootfs, root, env, sock) }
|
||||
val driver = runtimeLib(rootfs, "libvulkan_freedreno.so")
|
||||
if (driver == null || !File("/dev/kgsl-3d0").exists()) return null
|
||||
if (driver == null || !kgslAvailable) return null
|
||||
if (env.containsKey("VK_ICD_FILENAMES") || env.containsKey("VK_DRIVER_FILES")) return null
|
||||
if (env["BL_DESKTOP"] == "1" && env["GAMESCOPE_WAYLAND_DISPLAY"] == null) return null
|
||||
if (env["LIBGL_ALWAYS_SOFTWARE"] == "1" && env["GAMESCOPE_WAYLAND_DISPLAY"] == null) return null
|
||||
val binds = arrayListOf(Bind(driver.canonicalPath, "$GPU_DIR/libvulkan_freedreno.so"))
|
||||
for (name in GPU_LIBS) {
|
||||
val f = runtimeLib(rootfs, name) ?: continue
|
||||
@@ -388,7 +391,7 @@ object BwrapSpawner {
|
||||
val program = plan.argv.firstOrNull()?.takeIf { it.startsWith("/") }?.let(::host)?.canonicalFile
|
||||
?.takeIf { it.isFile && isStaticElf(it) } ?: return null
|
||||
if (!linkMounts(plan)) return null
|
||||
return (listOf(program.path) + plan.argv.drop(1)) to plan.env
|
||||
return (NativeGuest.execPrefix(program.path) + listOf(program.path) + plan.argv.drop(1)) to plan.env
|
||||
}
|
||||
val loader = SANDBOX_LOADERS.map(::host).firstOrNull { it.isFile }?.canonicalFile ?: return null
|
||||
val libc = SANDBOX_LIBCS.map(::host).firstOrNull { it.isFile }?.canonicalFile ?: return null
|
||||
@@ -415,13 +418,14 @@ object BwrapSpawner {
|
||||
plan.env.map { (k, v) -> "$k=$v" } + plan.argv
|
||||
val env = linkedMapOf(
|
||||
"DDNATV_ROOT" to sandbox,
|
||||
"DDNATV_EXEC" to NativeGuest.execLoader.orEmpty(),
|
||||
"DDNATV_LINK_ROOT" to rootfs.path,
|
||||
"DDNATV_BINDS" to plan.binds.joinToString("|") { "${it.host}:${it.guest}" },
|
||||
"DDNATV_HOSTNAME" to SessionPrefs.guestHostname(context),
|
||||
"LD_LIBRARY_PATH" to SANDBOX_LIB_DIRS.map(::host).filter { it.isDirectory }.joinToString(":") { it.path },
|
||||
"LD_PRELOAD" to hook.path,
|
||||
).filterValues { it.isNotEmpty() }
|
||||
return (NativeGuest.simulator(rootfs)?.let { it + launch } ?: launch) to env
|
||||
return (NativeGuest.simulator(rootfs)?.let { it + launch } ?: (NativeGuest.execPrefix(loader.path) + launch)) to env
|
||||
}
|
||||
|
||||
private val runpathDirs = java.util.concurrent.ConcurrentHashMap<String, List<String>>()
|
||||
@@ -546,7 +550,7 @@ object BwrapSpawner {
|
||||
.also { b -> b.environment().apply { clear(); putAll(native.second) } }
|
||||
} else {
|
||||
val cmd = LinuxRuntime.prootPrefix(context, plan.root, plan.cwd)
|
||||
if (verbose != null) { cmd.add(1, "-v"); cmd.add(2, verbose.toString()) }
|
||||
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) {
|
||||
|
||||
@@ -95,10 +95,13 @@ class DeviceControlsComponent(context: Context, root: File, private val activity
|
||||
permissionNotified = false
|
||||
context.contentResolver.registerContentObserver(Settings.System.CONTENT_URI, true, observer)
|
||||
requests.startWatching()
|
||||
context.registerReceiver(volumeSteps, IntentFilter().apply {
|
||||
val volumeFilter = IntentFilter().apply {
|
||||
addAction(VOLUME_CHANGED_ACTION)
|
||||
addAction(STREAM_MUTE_CHANGED_ACTION)
|
||||
}, null, handler)
|
||||
}
|
||||
if (android.os.Build.VERSION.SDK_INT >= 33)
|
||||
context.registerReceiver(volumeSteps, volumeFilter, null, handler, Context.RECEIVER_NOT_EXPORTED)
|
||||
else context.registerReceiver(volumeSteps, volumeFilter, null, handler)
|
||||
refresh.run()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ object GuestCommand {
|
||||
NativeGuest.processBuilder(context, root, binds, guest).redirectErrorStream(true)
|
||||
} else {
|
||||
val cmd = LinuxRuntime.prootPrefix(context, root, "/root", fakeRoot)
|
||||
if (linkDir != null) cmd.add(1, "--link2symlink")
|
||||
if (linkDir != null) cmd.add("--link2symlink")
|
||||
binds.forEach { cmd.add("-b"); cmd.add(it) }
|
||||
cmd += guest
|
||||
ProcessBuilder(cmd).directory(root).redirectErrorStream(true).also { b ->
|
||||
|
||||
@@ -21,6 +21,10 @@ object LegacyNames {
|
||||
"etc/bannerlator-network.json" to "etc/droiddeck-network.json",
|
||||
"etc/bannerlator-wifi-scan-request" to "etc/droiddeck-wifi-scan-request",
|
||||
)
|
||||
private val RETIRED_FILES = listOf("libblsession.so", "libblfastpath.so", "libblaudit.so").map { "usr/local/lib/$it" } +
|
||||
listOf("x86_64", "i386").map { "usr/local/lib/droiddeck-fex/$it/libblsession.so" }
|
||||
private const val LEGACY_MARKER = ".bl-"
|
||||
private val QUEUED_MARKERS = setOf(".bl-proton-extra", ".bl-steam-urls")
|
||||
private val MENU_REWRITES = listOf(
|
||||
Triple("usr/local/share/applications", "/usr/local/bin/bannerlator-", "/usr/local/bin/droiddeck-"),
|
||||
Triple("usr/share/applications", "Exec=env APPIMAGE_EXTRACT_AND_RUN=1 /opt/appimages/",
|
||||
@@ -38,6 +42,20 @@ object LegacyNames {
|
||||
fun migrateRootfs(root: File) {
|
||||
migrateEtc(root)
|
||||
for ((old, new) in MOVED_FILES) move(File(root, old), File(root, new))
|
||||
for (path in RETIRED_FILES) File(root, path).delete()
|
||||
File(root, "root").listFiles { f -> f.name.startsWith(LEGACY_MARKER) }?.forEach {
|
||||
val target = File(it.parentFile, ".dd-" + it.name.removePrefix(LEGACY_MARKER))
|
||||
if (it.name in QUEUED_MARKERS && it.isFile && !isLink(it) && target.isFile && !isLink(target)) {
|
||||
val queued = it.readText()
|
||||
if (queued.isNotBlank()) {
|
||||
val separator = if (target.length() > 0 && !target.readText().endsWith("\n")) "\n" else ""
|
||||
target.appendText(separator + if (queued.endsWith("\n")) queued else queued + "\n")
|
||||
}
|
||||
FileUtils.delete(it)
|
||||
} else {
|
||||
move(it, target)
|
||||
}
|
||||
}
|
||||
linkScripts(root)
|
||||
rewriteMenuEntries(root)
|
||||
}
|
||||
|
||||
@@ -106,13 +106,15 @@ class LinuxNetworkLinkComponent(
|
||||
synchronized(lock) { writeNetworkState(currentProperties, currentCapabilities) }
|
||||
}
|
||||
}
|
||||
appContext.registerReceiver(receiver, IntentFilter().apply {
|
||||
val wifiFilter = IntentFilter().apply {
|
||||
addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)
|
||||
addAction(WifiManager.RSSI_CHANGED_ACTION)
|
||||
addAction(WifiManager.WIFI_STATE_CHANGED_ACTION)
|
||||
addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION)
|
||||
addAction(LocationManager.MODE_CHANGED_ACTION)
|
||||
})
|
||||
}
|
||||
if (android.os.Build.VERSION.SDK_INT >= 33) appContext.registerReceiver(receiver, wifiFilter, Context.RECEIVER_NOT_EXPORTED)
|
||||
else appContext.registerReceiver(receiver, wifiFilter)
|
||||
wifiReceiver = receiver
|
||||
scanRequestStamp = File(rootDir, "etc/droiddeck-wifi-scan-request").lastModified()
|
||||
scanHandler.post(scanRequests)
|
||||
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -77,7 +78,18 @@ public final class LinuxRuntime {
|
||||
}
|
||||
|
||||
private static boolean rootfsProotReady(Context context) {
|
||||
return rootfsProot(context).isFile() && rootfsLoader(context).isFile();
|
||||
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) {
|
||||
@@ -86,22 +98,21 @@ public final class LinuxRuntime {
|
||||
|
||||
public static File prootBinary(Context context) {
|
||||
if (AddonPack.PROOT.installed(context)) return AddonPack.PROOT.file(context, "libproot.so");
|
||||
if (SessionPrefs.allowStockProot(context)) return rootfsProot(context);
|
||||
if (stockProotAllowed(context)) return rootfsProot(context);
|
||||
return AddonPack.PROOT.file(context, "libproot.so");
|
||||
}
|
||||
|
||||
public static File prootLoader(Context context) {
|
||||
if (AddonPack.PROOT.installed(context)) return AddonPack.PROOT.file(context, "libproot-loader.so");
|
||||
if (SessionPrefs.allowStockProot(context)) return rootfsLoader(context);
|
||||
return AddonPack.PROOT.file(context, "libproot-loader.so");
|
||||
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;
|
||||
if (AddonPack.PROOT.installed(context)
|
||||
&& bin.getPath().equals(AddonPack.PROOT.file(context, "libproot.so").getPath())) return PROOT_PACK;
|
||||
return PROOT_ROOTFS;
|
||||
return patchedProot(context) && !bin.equals(rootfsProot(context)) ? PROOT_PACK : PROOT_ROOTFS;
|
||||
}
|
||||
|
||||
public static String prootLibraryPath(Context context) {
|
||||
@@ -183,13 +194,13 @@ public final class LinuxRuntime {
|
||||
|
||||
public static List<String> rootPrefix(Context context, File root, String cwd) {
|
||||
List<String> cmd = prootPrefix(context, root, cwd, true);
|
||||
cmd.add(1, "--link2symlink");
|
||||
cmd.add("--link2symlink");
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public static List<String> prootPrefix(Context context, File root, String cwd, boolean fakeRoot) {
|
||||
List<String> cmd = new ArrayList<>();
|
||||
cmd.add(prootBinary(context).getPath());
|
||||
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();
|
||||
|
||||
@@ -384,7 +384,7 @@ public final class LinuxRuntimeInstaller {
|
||||
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))
|
||||
&& !SessionPrefs.allowStockProot(context))
|
||||
&& !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());
|
||||
|
||||
@@ -50,6 +50,21 @@ object NativeGuest {
|
||||
|
||||
fun hook(root: File): File = File(root, HOOK)
|
||||
|
||||
/**
|
||||
* libddexec.so, which starts the rootfs loader on Android 10+, where a targetSdk 29+ app may not
|
||||
* execute its data files; null where the kernel still starts them directly.
|
||||
*/
|
||||
@Volatile var execLoader: String? = null
|
||||
private set
|
||||
|
||||
/** What starts the program at [path] from the host: nothing before it, or [execLoader] and the path. */
|
||||
fun execPrefix(path: String): List<String> = execLoader?.let { listOf(it, path) }.orEmpty()
|
||||
|
||||
fun init(context: Context) {
|
||||
execLoader = File(context.applicationInfo.nativeLibraryDir, "libddexec.so")
|
||||
.takeIf { android.os.Build.VERSION.SDK_INT >= 29 && it.isFile }?.path
|
||||
}
|
||||
|
||||
fun loader(root: File): File? =
|
||||
listOf("usr/lib/ld-linux-aarch64.so.1", "lib/ld-linux-aarch64.so.1").map { File(root, it) }.firstOrNull { it.exists() }
|
||||
|
||||
@@ -60,9 +75,10 @@ object NativeGuest {
|
||||
/** Environment every native process starts with; a guest `env -i` is re-seeded by the hook. */
|
||||
fun environment(root: File, preload: List<String> = emptyList()): Map<String, String> = linkedMapOf(
|
||||
"DDNATV_ROOT" to root.path,
|
||||
"DDNATV_EXEC" to execLoader.orEmpty(),
|
||||
"LD_LIBRARY_PATH" to libraryPath(root),
|
||||
"LD_PRELOAD" to (preload.map { File(root, it.removePrefix("/")).path } + hook(root).path).joinToString(":"),
|
||||
)
|
||||
).filterValues { it.isNotEmpty() }
|
||||
|
||||
/**
|
||||
* The host command line for the guest program at [program] (an absolute guest path to a real
|
||||
@@ -72,7 +88,7 @@ object NativeGuest {
|
||||
val loader = checkNotNull(loader(root)) { "no glibc loader in ${root.path}" }
|
||||
val host = File(root, program.removePrefix("/"))
|
||||
val launch = listOf(loader.path, "--argv0", host.name, host.path) + args
|
||||
return simulator(root)?.let { it + launch } ?: launch
|
||||
return simulator(root)?.let { it + launch } ?: (execPrefix(loader.path) + launch)
|
||||
}
|
||||
|
||||
/** The environment of the session process: the hook's root, the mounts proot used to make, the preload list. */
|
||||
@@ -80,6 +96,7 @@ object NativeGuest {
|
||||
val preload = preloadList(root)
|
||||
return linkedMapOf(
|
||||
"DDNATV_ROOT" to root.path,
|
||||
"DDNATV_EXEC" to execLoader.orEmpty(),
|
||||
"DDNATV_HOSTNAME" to hostname.orEmpty(),
|
||||
"DDNATV_BINDS" to binds.joinToString("|") { if (it.contains(':')) it else "$it:$it" },
|
||||
"DDNATV_PRELOAD" to preload.joinToString(":"),
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.security.MessageDigest
|
||||
|
||||
object ProotFastPath {
|
||||
private const val TAG = "ProotFastPath"
|
||||
const val LIBRARY = "/usr/local/lib/libblfastpath.so"
|
||||
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 =
|
||||
|
||||
@@ -315,11 +315,11 @@ object BottomDesktop {
|
||||
main.post { if (generation == guestGeneration) watchIme(imeDir) }
|
||||
val binds = LinuxRuntime.binds(context, current.sessionRoot, runtime, Environment.getExternalStorageDirectory(), current.binds)
|
||||
val guest = ArrayList(current.guest).apply {
|
||||
add("BL_WIDTH=$width")
|
||||
add("BL_HEIGHT=$height")
|
||||
add("BL_DEBUG_DIR=" + dir.path)
|
||||
add("BL_TOP_SESSION=" + SessionState.mode)
|
||||
add("BL_IME_DIR=" + imeDir.path)
|
||||
add("DD_WIDTH=$width")
|
||||
add("DD_HEIGHT=$height")
|
||||
add("DD_DEBUG_DIR=" + dir.path)
|
||||
add("DD_TOP_SESSION=" + SessionState.mode)
|
||||
add("DD_IME_DIR=" + imeDir.path)
|
||||
add(SCRIPT)
|
||||
}
|
||||
val command = if (current.nativeUserland) {
|
||||
|
||||
@@ -440,7 +440,7 @@ object EsyncPacks {
|
||||
|
||||
fun enabled(context: Context): Boolean = SessionPrefs.syncFallback(context) || try {
|
||||
GameEnvironmentStore.read(context).let { config ->
|
||||
(listOf(config.shared) + config.games.values).any { it["BL_SYNC_FALLBACK"] == "1" }
|
||||
(listOf(config.shared) + config.games.values).any { it["DD_SYNC_FALLBACK"] == "1" }
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
false
|
||||
|
||||
@@ -57,8 +57,8 @@ object FexCatalog {
|
||||
}
|
||||
|
||||
fun environment(build: Build, sources: List<String> = DownloadSource.candidates(build.url)): List<String> = listOf(
|
||||
"BL_FEX_TAG=${build.tag}",
|
||||
"BL_FEX_SHA256=${build.sha256}",
|
||||
"BL_FEX_URLS=" + sources.joinToString(" "),
|
||||
"DD_FEX_TAG=${build.tag}",
|
||||
"DD_FEX_SHA256=${build.sha256}",
|
||||
"DD_FEX_URLS=" + sources.joinToString(" "),
|
||||
)
|
||||
}
|
||||
@@ -29,7 +29,8 @@ object GameEnvironmentStore {
|
||||
require(GameEnvironment.validName(name))
|
||||
val entry = value.get(name)
|
||||
require(entry == JSONObject.NULL || entry is String && GameEnvironment.validValue(entry))
|
||||
put(name, if (entry == JSONObject.NULL) null else entry as String)
|
||||
val current = GameEnvironment.currentName(name)
|
||||
if (current == name || !value.has(current)) put(current, if (entry == JSONObject.NULL) null else entry as String)
|
||||
}
|
||||
}
|
||||
val games = json.optJSONObject("games")
|
||||
@@ -52,10 +53,9 @@ object GameEnvironmentStore {
|
||||
|
||||
@Synchronized
|
||||
fun save(context: Context, config: GameEnvironment.Config) {
|
||||
val json = encode(config)
|
||||
decode(json)
|
||||
write(File(context.filesDir, SETTINGS), json.toString())
|
||||
publish(context, config)
|
||||
val normalized = decode(encode(config))
|
||||
write(File(context.filesDir, SETTINGS), encode(normalized).toString())
|
||||
publish(context, normalized)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
||||
@@ -34,8 +34,8 @@ object GraphicsReport {
|
||||
|
||||
/** The guest keys the report repeats: everything that decides which Vulkan driver loads. */
|
||||
private val ENV_PREFIXES = listOf(
|
||||
"VK_", "BL_VK", "BL_DRM", "BL_VKBRIDGE", "VKBRIDGE", "MESA_", "GALLIUM_", "ZINK", "TU_", "PANVK",
|
||||
"DROIDDECK_POWERVR", "DROIDDECK_HYBRIS", "BL_GAME_LOGS", "LIBGL_", "GAMESCOPE_DISABLE", "XWAYLAND",
|
||||
"VK_", "DD_VK", "DD_DRM", "DD_VKBRIDGE", "VKBRIDGE", "MESA_", "GALLIUM_", "ZINK", "TU_", "PANVK",
|
||||
"DROIDDECK_POWERVR", "DROIDDECK_HYBRIS", "DD_GAME_LOGS", "LIBGL_", "GAMESCOPE_DISABLE", "XWAYLAND",
|
||||
)
|
||||
|
||||
/** Per-game graphics logs and the guest's Vulkan summary: on for a non-Adreno GPU, or by Setup's switch. */
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.ActivityOptions
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.os.Bundle
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
import android.view.Display
|
||||
import android.view.WindowManager
|
||||
|
||||
// While a session runs, sits invisibly on top of every other display until it ends, so
|
||||
// that display's home launcher is not its top activity. lmkd kills the launcher first; restarted as a
|
||||
// top activity it takes focus from the session, which then drops to adj 50 and is killed next.
|
||||
class KeepTopActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@Suppress("DEPRECATION") overridePendingTransition(0, 0)
|
||||
if (intent.getBooleanExtra(EXTRA_BOUNCE, false)) {
|
||||
bounces++
|
||||
finish()
|
||||
return
|
||||
}
|
||||
if (intent.getIntExtra(EXTRA_GENERATION, -1) != generation) {
|
||||
finishAndRemoveTask()
|
||||
return
|
||||
}
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)
|
||||
val id = display?.displayId ?: Display.INVALID_DISPLAY
|
||||
starting.remove(id)
|
||||
guards[id]?.takeIf { it !== this && !it.isFinishing }?.finishAndRemoveTask()
|
||||
guards[id] = this
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
guards.values.remove(this)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "KeepTop"
|
||||
private const val EXTRA_BOUNCE = "bounce"
|
||||
private const val EXTRA_GENERATION = "generation"
|
||||
private var generation = 0
|
||||
var bounces = 0
|
||||
private set
|
||||
private val guards = HashMap<Int, KeepTopActivity>()
|
||||
private const val START_TIMEOUT_MS = 2_000L
|
||||
private val starting = HashMap<Int, Long>()
|
||||
|
||||
fun guardOtherDisplays(context: Context, sessionDisplay: Int): Boolean {
|
||||
val displays = context.getSystemService(DisplayManager::class.java)?.displays ?: return false
|
||||
var started = false
|
||||
for (display in displays) {
|
||||
val id = display.displayId
|
||||
if (id == sessionDisplay || display.state != Display.STATE_ON || guards[id]?.isFinishing == false ||
|
||||
starting[id]?.let { SystemClock.elapsedRealtime() - it < START_TIMEOUT_MS } == true) continue
|
||||
runCatching {
|
||||
launch(context, id, bounce = false)
|
||||
starting[id] = SystemClock.elapsedRealtime()
|
||||
started = true
|
||||
Log.i(TAG, "guarding display $id from a home launcher restart")
|
||||
}.onFailure { Log.w(TAG, "could not guard display $id", it) }
|
||||
}
|
||||
if (!started) return false
|
||||
return runCatching { launch(context, sessionDisplay, bounce = true) }
|
||||
.onFailure { Log.w(TAG, "could not return focus to display $sessionDisplay", it) }.isSuccess
|
||||
}
|
||||
|
||||
fun hasPendingStarts() = starting.isNotEmpty()
|
||||
|
||||
const val RETRY_MS = START_TIMEOUT_MS + 250
|
||||
|
||||
fun release() {
|
||||
generation++
|
||||
guards.values.toList().forEach { it.finishAndRemoveTask() }
|
||||
guards.clear()
|
||||
starting.clear()
|
||||
}
|
||||
|
||||
private fun launch(context: Context, displayId: Int, bounce: Boolean) {
|
||||
val intent = Intent(context, KeepTopActivity::class.java)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK or Intent.FLAG_ACTIVITY_NO_ANIMATION)
|
||||
.putExtra(EXTRA_BOUNCE, bounce)
|
||||
.putExtra(EXTRA_GENERATION, generation)
|
||||
context.startActivity(intent, ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
// Tracks a pause that skipped the session's departure cleanup for the keep-top focus bounce.
|
||||
internal class LightPause {
|
||||
private var pending = false
|
||||
private var bouncesAtPause = 0
|
||||
|
||||
fun paused(bounces: Int) {
|
||||
pending = true
|
||||
bouncesAtPause = bounces
|
||||
}
|
||||
|
||||
// The bounce resumes the session within tens of milliseconds; still paused at the timeout means
|
||||
// something else holds the pause.
|
||||
fun timedOut(): Boolean = take()
|
||||
|
||||
fun stopped(): Boolean = take()
|
||||
|
||||
fun resumed(bounces: Int): Resume {
|
||||
if (!pending) return Resume.NORMAL
|
||||
pending = false
|
||||
return if (bounces != bouncesAtPause) Resume.LIGHT else Resume.CLEANUP_FIRST
|
||||
}
|
||||
|
||||
private fun take(): Boolean {
|
||||
val was = pending
|
||||
pending = false
|
||||
return was
|
||||
}
|
||||
|
||||
enum class Resume { NORMAL, LIGHT, CLEANUP_FIRST }
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import android.view.Display
|
||||
|
||||
object PerfMode {
|
||||
private const val TAG = "PerfMode"
|
||||
const val BFI_MIN_REFRESH_HZ = 100f
|
||||
|
||||
fun apply(a: Activity, fpsLimit: Int = 0, refreshLimit: Int = 0): String {
|
||||
val parts = ArrayList<String>(2)
|
||||
|
||||
@@ -37,7 +37,7 @@ object ProtonExtras {
|
||||
)
|
||||
|
||||
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
|
||||
private fun requests(context: Context) = File(home(context), ".bl-proton-extra")
|
||||
private fun requests(context: Context) = File(home(context), ".dd-proton-extra")
|
||||
private fun toolsDir(context: Context) = File(home(context), ".local/share/Steam/compatibilitytools.d")
|
||||
private fun releasesFile(context: Context) = File(context.filesDir, "proton-extras.json")
|
||||
private fun latestFile(context: Context) = File(context.filesDir, "proton-latest.json")
|
||||
|
||||
@@ -68,7 +68,7 @@ object QuestExperimental {
|
||||
appendLine("driverMode=${SessionPrefs.gpuDriverMode(context)}")
|
||||
appendLine("androidDriver=${SessionPrefs.androidDriver(context)}")
|
||||
appendLine("steamSurfaceControlWorkaround=${SessionPrefs.hdr(context, "steam")}")
|
||||
appendLine("GPUOBJ fallback installed in Android driver and ARM64 libblsession")
|
||||
appendLine("GPUOBJ fallback installed in Android driver and ARM64 libddsession")
|
||||
appendLine("Experimental Quest 2/3/3S compatibility; 2D panel application")
|
||||
}
|
||||
Log.i(TAG, report)
|
||||
|
||||
@@ -544,6 +544,7 @@ object SessionArtifacts {
|
||||
"session died of a crash, the entry is in there unless the device rebooted.\n" +
|
||||
(if (newest) exitReasons(context) else "")
|
||||
)
|
||||
restartNote(File(dir, "device.txt").lastModified(), bootedAt())?.let { recoveryNote.appendText(it) }
|
||||
if (newest && lastExitForMemory(context)) killedForMemory = true
|
||||
}
|
||||
if (recoveryPreviouslyAttempted && !runtimeCaptured.exists() &&
|
||||
@@ -597,7 +598,7 @@ object SessionArtifacts {
|
||||
}
|
||||
val memoryLog = File(dir, "memory-pressure.log")
|
||||
if (newest && !memoryLog.exists()) {
|
||||
SessionLogCapture.dumpMemoryPressure(memoryLog)
|
||||
SessionLogCapture.dumpMemoryPressure(memoryLog, context)
|
||||
}
|
||||
if (stopWhenSessionStarts && SessionState.running) {
|
||||
record.failed = true
|
||||
@@ -686,5 +687,21 @@ object SessionArtifacts {
|
||||
return gone.size
|
||||
}
|
||||
|
||||
private fun bootedAt(): Long = System.currentTimeMillis() - android.os.SystemClock.elapsedRealtime()
|
||||
|
||||
internal fun restartNote(sessionStartedAt: Long, bootedAt: Long): String? {
|
||||
if (sessionStartedAt <= 0L) return null
|
||||
val stamp = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US)
|
||||
return if (bootedAt > sessionStartedAt + BOOT_CLOCK_SLACK_MS) {
|
||||
"The device itself probably restarted after this session began (estimated boot ${stamp.format(Date(bootedAt))}, from the clock and uptime, so a clock change can fake it):\n" +
|
||||
"if so, the whole system went down and crash.log is the new boot's buffer and says nothing about the session.\n"
|
||||
} else {
|
||||
"The device does not appear to have restarted since this session began (estimated boot ${stamp.format(Date(bootedAt))}, from the clock and uptime):\n" +
|
||||
"only this app's processes ended, so crash.log and the exit records cover the end.\n"
|
||||
}
|
||||
}
|
||||
|
||||
private const val BOOT_CLOCK_SLACK_MS = 60_000L
|
||||
|
||||
private fun now(): String = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(Date())
|
||||
}
|
||||
@@ -114,11 +114,11 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-steam-compat" to "usr/local/bin/droiddeck-steam-compat",
|
||||
"usr/local/bin/droiddeck-steam-taskset" to "usr/local/libexec/droiddeck-steam/taskset",
|
||||
"usr/local/bin/droiddeck-fex" to "usr/local/bin/droiddeck-fex",
|
||||
"libblsession.so" to "usr/local/lib/libblsession.so",
|
||||
"libddsession.so" to "usr/local/lib/libddsession.so",
|
||||
"libfakeinput.so" to "usr/local/lib/libfakeinput.so",
|
||||
"libblfastpath.so" to "usr/local/lib/libblfastpath.so",
|
||||
"libddfastpath.so" to "usr/local/lib/libddfastpath.so",
|
||||
"libddnatv-hook.so" to "usr/lib/libddnatv-hook.so",
|
||||
"libblaudit.so" to "usr/local/lib/libblaudit.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",
|
||||
@@ -243,7 +243,7 @@ object SessionFiles {
|
||||
"usr/local/lib/droiddeck-gpuload/VK_LAYER_DROIDDECK_vram_cap.json" to "usr/share/vulkan/implicit_layer.d/droiddeck_vram_cap.json",
|
||||
)
|
||||
val fexPreloads = listOf("x86_64", "i386").flatMap { arch ->
|
||||
listOf("libblsession.so", "libfakeinput.so", "libfaultreport.so").map { "$arch/$it" to "usr/local/lib/droiddeck-fex/$arch/$it" }
|
||||
listOf("libddsession.so", "libfakeinput.so", "libfaultreport.so").map { "$arch/$it" to "usr/local/lib/droiddeck-fex/$arch/$it" }
|
||||
} + listOf("libvulkan-thunk.so", "libwebkitinput.so").map { "x86_64/$it" to "usr/local/lib/droiddeck-fex/x86_64/$it" }
|
||||
// The Mali compatibility layer (tools/venus/layer, David Cimo): an implicit Vulkan layer that
|
||||
// fills in the features DXVK requires and Mali lacks. Idle outside Wine and on GPUs that have them.
|
||||
@@ -322,7 +322,7 @@ object SessionFiles {
|
||||
ledger.save()
|
||||
for (old in arrayOf("aarch64-unix", "aarch64-windows", "i386-windows")) File(root, "$DIRECTAUDIO_DIR/lib/wine/$old").deleteRecursively()
|
||||
val preload = StringBuilder(lsePreload(CpuFeatures.lacksAtomics, File(root, LSE_EMU).isFile))
|
||||
preload.append("/usr/local/lib/libblsession.so\n")
|
||||
preload.append("/usr/local/lib/libddsession.so\n")
|
||||
if (!File(Environment.getExternalStorageDirectory(), NO_PAD_SWITCH).exists()) {
|
||||
preload.append("/usr/local/lib/libfakeinput.so\n")
|
||||
}
|
||||
|
||||
@@ -85,6 +85,12 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("launcherFullscreen", on).apply()
|
||||
}
|
||||
|
||||
fun blackFrameInsertion(context: Context): Boolean = prefs(context).getBoolean("blackFrameInsertion", false)
|
||||
|
||||
fun setBlackFrameInsertion(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("blackFrameInsertion", on).apply()
|
||||
}
|
||||
|
||||
fun animationsEnabled(context: Context): Boolean = prefs(context).getBoolean("animations", true)
|
||||
|
||||
fun setAnimationsEnabled(context: Context, on: Boolean) {
|
||||
@@ -267,12 +273,45 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("railLabels", show).apply()
|
||||
}
|
||||
|
||||
fun agentTab(context: Context): Boolean = prefs(context).getBoolean("agentTab", true)
|
||||
fun agentTab(context: Context): Boolean = prefs(context).getBoolean("agentTab", false)
|
||||
|
||||
fun setAgentTab(context: Context, show: Boolean) {
|
||||
prefs(context).edit().putBoolean("agentTab", show).apply()
|
||||
}
|
||||
|
||||
fun developerTools(context: Context): Boolean =
|
||||
prefs(context).getBoolean("developerTools", agentTab(context) || com.droiddeck.launcher.agent.AgentAccess.commandsEnabled(context))
|
||||
|
||||
fun setDeveloperTools(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("developerTools", on).apply()
|
||||
}
|
||||
|
||||
fun fpsLimitKey(mode: String?, game: String?): String? = when (mode) {
|
||||
SessionService.MODE_RUN -> game?.trim()?.takeIf(com.droiddeck.launcher.frontend.GameLaunchLink::validId)?.let { "fpsLimit.game.$it" }
|
||||
SessionService.MODE_DESKTOP -> "fpsLimit.desktop"
|
||||
else -> null
|
||||
}
|
||||
|
||||
fun savedFpsLimit(context: Context, key: String?): Int = key?.let { prefs(context).getInt(it, 0) } ?: 0
|
||||
|
||||
fun saveFpsLimit(context: Context, key: String?, fps: Int) {
|
||||
key ?: return
|
||||
prefs(context).edit().apply { if (fps > 0) putInt(key, fps) else remove(key) }.apply()
|
||||
}
|
||||
|
||||
fun drawerCornerTap(context: Context): Boolean =
|
||||
prefs(context).getBoolean("drawerCornerTap", android.os.Build.MANUFACTURER.equals("Oculus", true) || android.os.Build.MANUFACTURER.equals("Meta", true))
|
||||
|
||||
fun setDrawerCornerTap(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("drawerCornerTap", on).apply()
|
||||
}
|
||||
|
||||
fun drawerHintShown(context: Context): Int = prefs(context).getInt("drawerHintShown", 0)
|
||||
|
||||
fun countDrawerHint(context: Context) {
|
||||
prefs(context).edit().putInt("drawerHintShown", drawerHintShown(context) + 1).apply()
|
||||
}
|
||||
|
||||
fun libraryShowUninstalled(context: Context): Boolean = prefs(context).getBoolean("libraryShowUninstalled", false)
|
||||
|
||||
fun setLibraryShowUninstalled(context: Context, show: Boolean) {
|
||||
@@ -303,7 +342,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("navTabOrder", order.joinToString(",")).apply()
|
||||
}
|
||||
|
||||
fun navTabShelved(context: Context): Set<String> = idList(prefs(context).getString("navTabShelved", "soundtracks,agent")).toSet()
|
||||
fun navTabShelved(context: Context): Set<String> = idList(prefs(context).getString("navTabShelved", "soundtracks,agent,storage,sync")).toSet()
|
||||
|
||||
fun setNavTabShelved(context: Context, keys: Set<String>) {
|
||||
prefs(context).edit().putString("navTabShelved", keys.joinToString(",")).apply()
|
||||
@@ -641,6 +680,13 @@ object SessionPrefs {
|
||||
position.takeIf { it in listOf("top", "bottom", "left", "right", "center") } ?: "center").apply()
|
||||
}
|
||||
|
||||
fun integerScaling(context: Context): Boolean =
|
||||
prefs(context).getBoolean("integerScaling", false)
|
||||
|
||||
fun setIntegerScaling(context: Context, enabled: Boolean) {
|
||||
prefs(context).edit().putBoolean("integerScaling", enabled).apply()
|
||||
}
|
||||
|
||||
fun returnAfterGame(context: Context): Boolean = prefs(context).getBoolean("returnAfterGame", true)
|
||||
|
||||
fun setReturnAfterGame(context: Context, on: Boolean) {
|
||||
@@ -648,7 +694,7 @@ object SessionPrefs {
|
||||
}
|
||||
|
||||
private fun shaderPrecacheApplied(context: Context) =
|
||||
java.io.File(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context), "root/.bl-shader-precache-applied")
|
||||
java.io.File(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context), "root/.dd-shader-precache-applied")
|
||||
|
||||
fun pendingShaderPrecache(context: Context): Boolean? {
|
||||
val prefs = prefs(context)
|
||||
@@ -694,6 +740,18 @@ object SessionPrefs {
|
||||
|
||||
fun micAsked(context: Context): Boolean = prefs(context).getBoolean("micAsked", false)
|
||||
|
||||
fun allFilesAsked(context: Context): Boolean = prefs(context).getBoolean("allFilesAsked", false)
|
||||
|
||||
fun setAllFilesAsked(context: Context) {
|
||||
prefs(context).edit().putBoolean("allFilesAsked", true).apply()
|
||||
}
|
||||
|
||||
fun bluetoothAsked(context: Context): Boolean = prefs(context).getBoolean("bluetoothAsked", false)
|
||||
|
||||
fun setBluetoothAsked(context: Context) {
|
||||
prefs(context).edit().putBoolean("bluetoothAsked", true).apply()
|
||||
}
|
||||
|
||||
fun setMicAsked(context: Context) {
|
||||
prefs(context).edit().putBoolean("micAsked", true).apply()
|
||||
}
|
||||
@@ -939,7 +997,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("steamGpuCompositing", false).apply()
|
||||
return false
|
||||
}
|
||||
return prefs(context).getBoolean("steamGpuCompositing", false)
|
||||
return prefs(context).getBoolean("steamGpuCompositing", true)
|
||||
}
|
||||
|
||||
fun steamGpuCompositingAllowed(): Boolean =
|
||||
|
||||
@@ -411,6 +411,7 @@ class SessionService : Service() {
|
||||
?.takeIf(GameLaunchLink::validId)
|
||||
?: steamUrlGameId
|
||||
SessionState.gameId = resolvedGameId
|
||||
SessionState.fpsLimit = SessionPrefs.savedFpsLimit(this, SessionPrefs.fpsLimitKey(SessionState.mode, resolvedGameId))
|
||||
SessionPrefs.setActiveScreenEffectsProfile(
|
||||
this,
|
||||
SessionPrefs.screenEffectsProfileId(SessionState.mode, resolvedGameId, SessionState.program),
|
||||
@@ -540,7 +541,7 @@ class SessionService : Service() {
|
||||
}
|
||||
}
|
||||
if (!LinuxRuntime.patchedProot(this)) {
|
||||
if (SessionPrefs.allowStockProot(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)
|
||||
@@ -611,7 +612,7 @@ class SessionService : Service() {
|
||||
stopSession(-1, gen)
|
||||
return
|
||||
}
|
||||
if (steamHere) guest.add("BL_EPIC_APP_ID=" + com.droiddeck.launcher.stores.epic.EpicClient.shortcutAppId)
|
||||
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) }
|
||||
@@ -623,36 +624,36 @@ class SessionService : Service() {
|
||||
val encoder = VideoEncodeBridge(File(filesDir, "venc/venc.sock"))
|
||||
encoder.attach(this)
|
||||
components.add(encoder)
|
||||
guest.add("BL_VENC_SOCKET=" + encoder.socket.absolutePath)
|
||||
guest.add("DD_VENC_SOCKET=" + encoder.socket.absolutePath)
|
||||
}
|
||||
com.droiddeck.launcher.gpu.ClockLogComponent(File(sessionDir, "clocks.log")).let {
|
||||
it.attach(this)
|
||||
components.add(it)
|
||||
}
|
||||
|
||||
guest.add("BL_WIDTH=" + size.first)
|
||||
guest.add("BL_HEIGHT=" + size.second)
|
||||
guest.add("DD_WIDTH=" + size.first)
|
||||
guest.add("DD_HEIGHT=" + size.second)
|
||||
if (noSteamGame()) runCatching {
|
||||
val scope = NoSteamLaunch.scopeOf(SessionState.program, SessionState.programArgs) { NoSteamLaunch.battleNetTitleScope(this, it) }
|
||||
NoSteamLaunch.resolution(GameEnvironmentStore.read(this), scope, size)
|
||||
}.onFailure { Log.w(TAG, "game resolution", it) }.getOrNull()?.let { (w, h) ->
|
||||
guest.add("BL_GAME_WIDTH=$w")
|
||||
guest.add("BL_GAME_HEIGHT=$h")
|
||||
guest.add("DD_GAME_WIDTH=$w")
|
||||
guest.add("DD_GAME_HEIGHT=$h")
|
||||
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)
|
||||
guest.add("BL_FOLLOW_OUTPUT=1")
|
||||
guest.add("DD_FOLLOW_OUTPUT=1")
|
||||
if (SessionState.hdr) {
|
||||
guest.add("BL_HDR=1")
|
||||
guest.add("DD_HDR=1")
|
||||
guest.add("DXVK_HDR=1")
|
||||
Log.i(TAG, "hdr: gamescope --hdr-enabled, DXVK_HDR=1")
|
||||
}
|
||||
guest.add("DROIDDECK_WSI_BYPASS_CHECK_MS=100")
|
||||
guest.add("WINE_OFFSCREEN_CHECK_MS=100")
|
||||
guest.add("BL_REFRESH=" + Math.round(SessionState.refreshHz))
|
||||
guest.add("BL_LOG=" + sessionLog.path)
|
||||
guest.add("BL_DEBUG_DIR=" + sessionDir.path)
|
||||
guest.add("DD_REFRESH=" + Math.round(SessionState.refreshHz))
|
||||
guest.add("DD_LOG=" + sessionLog.path)
|
||||
guest.add("DD_DEBUG_DIR=" + sessionDir.path)
|
||||
if (EnhancedDiagnostics.isActive(this, sessionDir)) guest.add("DROIDDECK_ENHANCED_DIAGNOSTICS=1")
|
||||
|
||||
val fakeInputDir = File(sessionRoot, "dev/input").apply { mkdirs() }
|
||||
@@ -665,7 +666,7 @@ class SessionService : Service() {
|
||||
SessionEvents.step("controller-sync") { SessionState.padBridge?.syncConnectedControllers() }
|
||||
}
|
||||
val noSteamGame = noSteamGame()
|
||||
if (noSteamGame) guest.add("BL_PIN_CORES=0")
|
||||
if (noSteamGame) guest.add("DD_PIN_CORES=0")
|
||||
if ((steamHere || SessionState.program == NoSteamLaunch.EPIC) && com.droiddeck.launcher.stores.epic.EpicClient.read(this).installed) {
|
||||
runCatching { SessionEvents.step("epic-library") { com.droiddeck.launcher.stores.epic.EpicClientLibrary.sync(this) } }
|
||||
.onFailure { Log.w(TAG, "Epic library sync failed", it) }
|
||||
@@ -675,17 +676,19 @@ class SessionService : Service() {
|
||||
if (steamHere || noSteamGame) {
|
||||
val added = SessionEvents.step("added-games-scan") { com.droiddeck.launcher.frontend.AddedGames.scan(this) }
|
||||
val listing = SessionEvents.step("added-games-listing") { com.droiddeck.launcher.frontend.AddedGames.writeListing(this, added) }
|
||||
guest.add("BL_ADDED_GAMES=" + listing.path)
|
||||
if (OfflineMode.enabled(this)) guest.add("BL_STEAM_OFFLINE=1")
|
||||
if (com.droiddeck.launcher.gpu.Lossless.owned(this)) guest.add("BL_LOSSLESS_OWNED=1")
|
||||
guest.add("DD_ADDED_GAMES=" + listing.path)
|
||||
if (OfflineMode.enabled(this)) guest.add("DD_STEAM_OFFLINE=1")
|
||||
if (com.droiddeck.launcher.gpu.Lossless.owned(this)) guest.add("DD_LOSSLESS_OWNED=1")
|
||||
if (added.isNotEmpty()) Log.i(TAG, "added games: " + added.joinToString { "${it.name} (${it.exe.name})" })
|
||||
}
|
||||
guest.add("DD_LAUNCH_DIR=" + sessionRoot.path)
|
||||
// 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("BL_LIBRARY_LABEL=" + it.label.replace('"', ' ')) }
|
||||
if (SessionState.mode == MODE_STEAM && SessionState.steamUi == "desktop") guest.add("BL_STEAM_UI=desktop")
|
||||
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")
|
||||
// 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("BL_GAME_LOGS=1")
|
||||
if (GraphicsReport.detailed(this)) guest.add("DD_GAME_LOGS=1")
|
||||
SessionEvents.step("graphics-report") { GraphicsReport.begin(this, sessionDir, guest) }
|
||||
val shellGuest = ArrayList(guest).apply {
|
||||
add("SHELL=/bin/bash")
|
||||
@@ -872,8 +875,8 @@ class SessionService : Service() {
|
||||
if (!pulse.setSinkSuspended(false)) Log.w(TAG, "could not resume audio sink")
|
||||
if (!pulse.setMicSuspended(false)) Log.w(TAG, "could not resume microphone source")
|
||||
},
|
||||
zramControl = File(filesDir, "${LinuxRuntime.DIR}/tmp/.bl-zram"),
|
||||
clockControl = File(filesDir, "${LinuxRuntime.DIR}/tmp/.bl-clock"),
|
||||
zramControl = File(filesDir, "${LinuxRuntime.DIR}/tmp/.dd-zram"),
|
||||
clockControl = File(filesDir, "${LinuxRuntime.DIR}/tmp/.dd-clock"),
|
||||
mapClockControl = { WaylandCompositor.nativeSetClockControl(it.path) },
|
||||
pagedOut = { processes, unacknowledged, residentKb, swapKb, swapBeforeKb, millis ->
|
||||
Log.i(TAG, "paged out $processes processes ($unacknowledged unacknowledged) in $millis ms: " +
|
||||
@@ -942,16 +945,16 @@ class SessionService : Service() {
|
||||
} else {
|
||||
guest.add("LANG=C.UTF-8")
|
||||
}
|
||||
guest.add("BL_STEAM_LANGUAGE=" + SteamLanguage.forLocale(
|
||||
guest.add("DD_STEAM_LANGUAGE=" + SteamLanguage.forLocale(
|
||||
com.droiddeck.launcher.core.AppLanguage.effective(this),
|
||||
com.droiddeck.launcher.core.AppLanguage.system(this).country,
|
||||
))
|
||||
guest.add("TZ=" + java.util.TimeZone.getDefault().id)
|
||||
if (SessionState.mode == MODE_STEAM) SessionPrefs.pendingShaderPrecache(this)?.let { guest.add("BL_SHADER_PRECACHE=" + if (it) "1" else "0") }
|
||||
if (SessionState.mode == MODE_STEAM) SessionPrefs.pendingShaderPrecache(this)?.let { guest.add("DD_SHADER_PRECACHE=" + if (it) "1" else "0") }
|
||||
guest.add("XDG_RUNTIME_DIR=" + LinuxRuntime.GUEST_RUNTIME_DIR)
|
||||
guest.add("XDG_SESSION_TYPE=wayland")
|
||||
guest.add("WAYLAND_DISPLAY=wayland-0")
|
||||
guest.add("BL_ANDROID_CLIPBOARD=" + File(filesDir, "session/android-clipboard").path)
|
||||
guest.add("DD_ANDROID_CLIPBOARD=" + File(filesDir, "session/android-clipboard").path)
|
||||
guest.add("GAMESCOPE_FORCE_GENERAL_QUEUE=1")
|
||||
guest.add("MESA_LOADER_DRIVER_OVERRIDE=zink")
|
||||
guest.add("GALLIUM_DRIVER=zink")
|
||||
@@ -980,7 +983,7 @@ class SessionService : Service() {
|
||||
guest.add("XWAYLAND_NO_GLAMOR=1")
|
||||
Log.w(TAG, "xwayland: the last session's Xwayland crashed; glamor off for this one (XWAYLAND_NO_GLAMOR=1)")
|
||||
}
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) guest.add("BL_RAISE_NOFILE=1")
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) guest.add("DD_RAISE_NOFILE=1")
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno()) {
|
||||
val kernel = System.getProperty("os.version").orEmpty()
|
||||
val old = kernelBefore(kernel, 6, 6)
|
||||
@@ -994,11 +997,11 @@ class SessionService : Service() {
|
||||
if (SessionPrefs.steamGpuCompositing(this)) {
|
||||
Log.i(TAG, "steam: GPU web compositing (Setup's \"Steam interface: GPU drawing\")")
|
||||
} else {
|
||||
guest.add("BL_STEAM_SOFT_COMPOSITING=1")
|
||||
guest.add("DD_STEAM_SOFT_COMPOSITING=1")
|
||||
Log.i(TAG, "steam: software web compositing for the open driver pair (GPU raster kept)")
|
||||
}
|
||||
guest.add("BL_OPEN_DRIVER=1")
|
||||
LinuxRuntime.gpuStandIn(this)?.takeIf { it == LinuxRuntime.MALI_DEVICE }?.let { guest.add("BL_DRM_STANDIN=$it") }
|
||||
guest.add("DD_OPEN_DRIVER=1")
|
||||
LinuxRuntime.gpuStandIn(this)?.takeIf { it == LinuxRuntime.MALI_DEVICE }?.let { guest.add("DD_DRM_STANDIN=$it") }
|
||||
}
|
||||
val tuOverride = tuDebugOverride()
|
||||
val tuDriver = sysmemDriver(linuxDriverId)
|
||||
@@ -1012,10 +1015,10 @@ class SessionService : Service() {
|
||||
guest.add("MESA_DISK_CACHE_DATABASE=1")
|
||||
guest.addAll(GpuStatsComponent.guestEnv(LinuxRuntime.rootDir(this)))
|
||||
guest.add("GLIBC_TUNABLES=glibc.pthread.rseq=0:glibc.malloc.top_pad=16777216")
|
||||
if (SessionState.mode == MODE_STEAM) guest.add("BL_MANGOAPP=" + (if (SessionPrefs.mangoapp(this)) "1" else "0"))
|
||||
if (SessionState.mode == MODE_STEAM) guest.add("DD_MANGOAPP=" + (if (SessionPrefs.mangoapp(this)) "1" else "0"))
|
||||
SessionState.steamClientArch = if (steamHere) SessionPrefs.steamClientArch(this) else null
|
||||
SessionState.steamClientArch?.let { arch ->
|
||||
guest.add("BL_STEAM_CLIENT_ARCH=$arch")
|
||||
guest.add("DD_STEAM_CLIENT_ARCH=$arch")
|
||||
SessionPaths.current()?.let {
|
||||
SessionArtifacts.recordClient(it, arch)
|
||||
SessionArtifacts.markSteamLogs(it, File(SessionPrefs.steamRoot(this, arch), "logs"))
|
||||
@@ -1023,23 +1026,23 @@ class SessionService : Service() {
|
||||
}
|
||||
FexCatalog.cached(this)?.let { guest.addAll(FexCatalog.environment(it)) }
|
||||
if (SessionState.mode == MODE_STEAM) {
|
||||
guest.add("BL_GAMESCOPE_STRETCH_16X9=" + (if (SessionPrefs.stretch16x9(this)) "1" else "0"))
|
||||
guest.add("DD_GAMESCOPE_STRETCH_16X9=" + (if (SessionPrefs.stretch16x9(this)) "1" else "0"))
|
||||
}
|
||||
if (SessionPrefs.noXalia(this)) guest.add("PROTON_USE_XALIA=0")
|
||||
guest.add("BL_SYNC=" + (if (SessionPrefs.fastSync(this)) "1" else "0"))
|
||||
guest.add("BL_SYNC_FALLBACK=" + (if (SessionPrefs.syncFallback(this)) "1" else "0"))
|
||||
guest.add("BL_FSYNC_FIRST=" + (if (SessionPrefs.fsyncFirst(this)) "1" else "0"))
|
||||
guest.add("BL_PACE_CORES=" + (if (SessionPrefs.paceCores(this)) "1" else "0"))
|
||||
guest.add("BL_GAMESCOPE_REALTIME=" + (if (SessionPrefs.gamescopeRealtime(this)) "1" else "0"))
|
||||
if (SessionPrefs.cursorComposite(this)) guest.add("BL_CURSOR_COMPOSITE=1")
|
||||
guest.add("DD_SYNC=" + (if (SessionPrefs.fastSync(this)) "1" else "0"))
|
||||
guest.add("DD_SYNC_FALLBACK=" + (if (SessionPrefs.syncFallback(this)) "1" else "0"))
|
||||
guest.add("DD_FSYNC_FIRST=" + (if (SessionPrefs.fsyncFirst(this)) "1" else "0"))
|
||||
guest.add("DD_PACE_CORES=" + (if (SessionPrefs.paceCores(this)) "1" else "0"))
|
||||
guest.add("DD_GAMESCOPE_REALTIME=" + (if (SessionPrefs.gamescopeRealtime(this)) "1" else "0"))
|
||||
if (SessionPrefs.cursorComposite(this)) guest.add("DD_CURSOR_COMPOSITE=1")
|
||||
relativeMouseForSession().takeIf { it != 0 }?.let { guest.add("gamescope_relative_mouse=$it") }
|
||||
if (com.droiddeck.launcher.core.ZramSupport.supported()) {
|
||||
guest.add("BL_ZRAM=1")
|
||||
if (steamHere) SessionPrefs.ramCapMb(this).takeIf { it > 0 }?.let { guest.add("BL_RAM_CAP_MB=$it") }
|
||||
if (!SessionPrefs.zramClient(this)) guest.add("BL_ZRAM_CLIENT=0")
|
||||
if (!SessionPrefs.zramIdle(this)) guest.add("BL_ZRAM_IDLE=0")
|
||||
guest.add("DD_ZRAM=1")
|
||||
if (steamHere) SessionPrefs.ramCapMb(this).takeIf { it > 0 }?.let { guest.add("DD_RAM_CAP_MB=$it") }
|
||||
if (!SessionPrefs.zramClient(this)) guest.add("DD_ZRAM_CLIENT=0")
|
||||
if (!SessionPrefs.zramIdle(this)) guest.add("DD_ZRAM_IDLE=0")
|
||||
}
|
||||
SessionPrefs.vramCapMb(this).takeIf { it > 0 }?.let { guest.add("BL_VRAM_MB=$it") }
|
||||
SessionPrefs.vramCapMb(this).takeIf { it > 0 }?.let { guest.add("DD_VRAM_MB=$it") }
|
||||
guest.add("AUDIO_DIRECT_DECAY=0")
|
||||
val extra = extraEnv() + agentEnvironment
|
||||
guest.addAll(TurnipEnvironment.gameEnvironment(tuOverride, tuDriver, SessionPrefs.tuSysmem(this), extra))
|
||||
@@ -1048,10 +1051,10 @@ class SessionService : Service() {
|
||||
com.droiddeck.launcher.gpu.TpUbwcHint.forThisDevice(this)?.let { guest.add("${com.droiddeck.launcher.gpu.TpUbwcHint.ENV}=$it") }
|
||||
val clientPinned = steamHere && SessionPrefs.clientCpusOverride(this)
|
||||
if (clientPinned) {
|
||||
guest.add("BL_CLIENT_CPUS=" + CpuCores.listOrAll(SessionPrefs.clientCpus(this)))
|
||||
guest.add("DD_CLIENT_CPUS=" + CpuCores.listOrAll(SessionPrefs.clientCpus(this)))
|
||||
}
|
||||
CpuCores.gameLaunchList(SessionPrefs.gameCpus(this), clientPinned)
|
||||
.takeIf { it.isNotEmpty() }?.let { guest.add("BL_GAME_CPUS=$it") }
|
||||
.takeIf { it.isNotEmpty() }?.let { guest.add("DD_GAME_CPUS=$it") }
|
||||
}
|
||||
|
||||
private fun startVkBridge(guest: MutableList<String>, sessionDir: File) {
|
||||
@@ -1060,16 +1063,16 @@ class SessionService : Service() {
|
||||
val bridge = com.droiddeck.launcher.gpu.VkBridgeComponent(socket, File(sessionDir, "vkbridge-server.log"))
|
||||
bridge.attach(this)
|
||||
components.add(bridge)
|
||||
guest.add("BL_VKBRIDGE=1")
|
||||
if (SessionPrefs.steamGpuCompositing(this)) guest.add("BL_STEAM_GPU_COMPOSITING=1")
|
||||
guest.add("DD_VKBRIDGE=1")
|
||||
if (SessionPrefs.steamGpuCompositing(this)) guest.add("DD_STEAM_GPU_COMPOSITING=1")
|
||||
SessionPrefs.linuxDriver(this).takeIf { it.isNotEmpty() }
|
||||
?.let { runCatching { LinuxVulkanDriver.resolveIcdPath(this, it) }.getOrNull() }
|
||||
?.let { guest.add("BL_VKBRIDGE_FALLBACK_ICD=$it") }
|
||||
?.let { guest.add("DD_VKBRIDGE_FALLBACK_ICD=$it") }
|
||||
guest.add("VKBRIDGE_SOCKET=" + socket.path)
|
||||
guest.add("VKBRIDGE_CLIENT_LOG=" + File(sessionDir, "vkbridge-client.log").path)
|
||||
guest.add("VKBRIDGE_MODE=" + SessionPrefs.vkBridgeMode(this))
|
||||
LinuxRuntime.gpuStandIn(this)?.let { node ->
|
||||
guest.add("BL_DRM_STANDIN=$node")
|
||||
guest.add("DD_DRM_STANDIN=$node")
|
||||
LinuxRuntime.deviceNumbers(node)?.let { guest.add("VKBRIDGE_DRM_RENDER=$it") }
|
||||
}
|
||||
Log.i(TAG, "vkbridge: on (${com.droiddeck.launcher.core.DeviceSupport.gpuName(this)}, ${SessionPrefs.vkBridgeMode(this)} mode), socket $socket")
|
||||
@@ -1083,7 +1086,7 @@ class SessionService : Service() {
|
||||
SessionPrefs.directAudio(this)
|
||||
val wantsMic = SessionPrefs.micEnabled(this) &&
|
||||
checkSelfPermission(android.Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
|
||||
guest.add("BL_MIC_ENABLED=" + if (wantsMic) "1" else "0")
|
||||
guest.add("DD_MIC_ENABLED=" + if (wantsMic) "1" else "0")
|
||||
guest.add("AUDIO_DIRECT_MIC=" + if (wantsMic) "1" else "0")
|
||||
val audioDir = File(filesDir, "directaudio").apply { mkdirs() }
|
||||
val relaySocket = File(audioDir, "relay.sock")
|
||||
@@ -1111,7 +1114,7 @@ class SessionService : Service() {
|
||||
components.add(relay)
|
||||
}
|
||||
if (wantsDirectAudio) {
|
||||
guest.add("BL_DIRECTAUDIO=/" + SessionFiles.DIRECTAUDIO_DIR)
|
||||
guest.add("DD_DIRECTAUDIO=/" + SessionFiles.DIRECTAUDIO_DIR)
|
||||
guest.add("AUDIO_DIRECT_RELAY=" + relaySocket.absolutePath)
|
||||
val lowLatency = com.droiddeck.launcher.audio.DirectAudioTiming.lowLatencyOutput()
|
||||
val timing = com.droiddeck.launcher.audio.DirectAudioTiming.environment(lowLatency)
|
||||
@@ -1267,9 +1270,9 @@ class SessionService : Service() {
|
||||
)
|
||||
if (device != null) {
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "BL_STORAGE_DIAGNOSTICS=1")
|
||||
guest.add(envAt + 1, "BL_STORAGE_DEVICE=$device")
|
||||
guest.add(envAt + 2, "BL_STORAGE_LOG=${File(sessionDir, "storage.log").absolutePath}")
|
||||
guest.add(envAt, "DD_STORAGE_DIAGNOSTICS=1")
|
||||
guest.add(envAt + 1, "DD_STORAGE_DEVICE=$device")
|
||||
guest.add(envAt + 2, "DD_STORAGE_LOG=${File(sessionDir, "storage.log").absolutePath}")
|
||||
} else {
|
||||
Log.w(TAG, "storage diagnostics: selected library could not be identified; metadata snapshot only")
|
||||
}
|
||||
@@ -1414,7 +1417,7 @@ class SessionService : Service() {
|
||||
val listing = File(filesDir, "session/steam-libraries-x64.json").apply { parentFile?.mkdirs() }
|
||||
listing.writeText(x64Libraries.toString())
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "BL_X64_STEAM_LIBRARIES=" + listing.path)
|
||||
guest.add(envAt, "DD_X64_STEAM_LIBRARIES=" + listing.path)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "x86-64 steam library: the list could not be written; internal storage alone this session", e)
|
||||
}
|
||||
@@ -1424,10 +1427,32 @@ class SessionService : Service() {
|
||||
for ((path, label) in libraries) json.put(org.json.JSONObject().put("path", path).put("label", label.replace('"', ' ').replace('\\', ' ')))
|
||||
listing.writeText(json.toString())
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "BL_STEAM_LIBRARIES=" + listing.path)
|
||||
guest.add(envAt, "DD_STEAM_LIBRARIES=" + listing.path)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "steam library: the list could not be written; the card alone this session", e)
|
||||
}
|
||||
if (SessionState.mode == MODE_DESKTOP) {
|
||||
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, Environment.getExternalStorageDirectory(), 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
|
||||
binds.add(path)
|
||||
room--
|
||||
volumes.put(org.json.JSONObject().put("path", path).put("label", root.label))
|
||||
}
|
||||
listing.writeText(volumes.toString())
|
||||
val envAt = guest.indexOf(LinuxRuntime.SESSION_SCRIPT).takeIf { it >= 0 } ?: guest.size
|
||||
guest.add(envAt, "DD_DESKTOP_VOLUMES=" + listing.path)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "desktop volumes: the list could not be written", e)
|
||||
}
|
||||
}
|
||||
return binds
|
||||
}
|
||||
|
||||
@@ -2325,7 +2350,8 @@ class SessionService : Service() {
|
||||
override fun onTaskRemoved(rootIntent: Intent?) {
|
||||
if (rootIntent?.component?.className in setOf(
|
||||
com.droiddeck.launcher.ui.DualScreenActivity::class.java.name,
|
||||
com.droiddeck.launcher.ui.SessionTypingActivity::class.java.name)) return
|
||||
com.droiddeck.launcher.ui.SessionTypingActivity::class.java.name,
|
||||
KeepTopActivity::class.java.name)) return
|
||||
if (pipTask || xrActivityVisible) {
|
||||
Log.i(TAG, "panel task dismissed - retaining the session under its active surface policy")
|
||||
activityVisible = false
|
||||
|
||||
@@ -286,7 +286,7 @@ internal class SessionSuspendController(
|
||||
}
|
||||
val targets = records.values.filter { record ->
|
||||
try {
|
||||
File(procRoot, "${record.pid}/maps").useLines { lines -> lines.any { it.endsWith("/libblsession.so") } }
|
||||
File(procRoot, "${record.pid}/maps").useLines { lines -> lines.any { it.endsWith("/libddsession.so") } }
|
||||
} catch (_: IOException) {
|
||||
false
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ object SettingsReset {
|
||||
"storesInstallLanguage",
|
||||
"hud", "hudDeck", "hudFps", "hudBattery", "hudGraph", "hudColor", "hudOpacity", "__KEEP_droidDeckHud__", "__KEEP_droidDeckHudPos__", "backHold", "backActionsInverted", "backDoubleTapMs", "touch", "pen", "penButton", "osc", "shape", "steamController",
|
||||
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "unfoldedControlsWithController",
|
||||
"stretch16x9", "picturePosition", "railLabels", "agentTab", "navTabOrder", "navTabShelved", "navTabHidden", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys",
|
||||
"stretch16x9", "picturePosition", "integerScaling", "railLabels", "agentTab", "navTabOrder", "navTabShelved", "navTabHidden", "pcKeyboardSize", "pcKeyboardOpacity", "pcKeyboardHiddenKeys",
|
||||
"gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop",
|
||||
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "paceCores", "ramCapMb", "vramCapMb", "zramClient", "zramIdle",
|
||||
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
|
||||
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "nativeUserland", "cursorComposite",
|
||||
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "enhancedDiagnosticsNext", "storageDiagnostics", "buildWatermark",
|
||||
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
|
||||
"upscaler", "upscaleSharpness", "screenEffects", "blackFrameInsertion", "textureAnisotropy", "textureLodBias",
|
||||
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds", "skipBootMovie",
|
||||
"bootMovieApplyNext", "bootMovieSteamSeen", "bootMovieShuffle",
|
||||
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsHud", "bottomHud", "bottomStripMetrics", "bottomStripTabs", "statsDash", "statsSpeedUnit",
|
||||
|
||||
@@ -115,7 +115,7 @@ internal class SteamDownloadMonitor {
|
||||
val steam = File(home, ".local/share/Steam")
|
||||
val stamped = File(steam, "package/droiddeck-installed").isFile ||
|
||||
File(steam, "package/bannerlator-installed").isFile
|
||||
return !(stamped && File(steam, "steamrtarm64/steam").isFile) || File(home, ".bl-steam-repair").exists()
|
||||
return !(stamped && File(steam, "steamrtarm64/steam").isFile) || File(home, ".dd-steam-repair").exists()
|
||||
}
|
||||
|
||||
internal fun manifests(runtimeRoot: File, mounts: Map<String, File>): List<File> {
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.io.File
|
||||
|
||||
object SteamRepair {
|
||||
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
|
||||
private fun request(context: Context) = File(home(context), ".bl-steam-repair")
|
||||
private fun request(context: Context) = File(home(context), ".dd-steam-repair")
|
||||
private fun unconfirmed(context: Context) = File(home(context), ".local/share/Steam/package/droiddeck-unconfirmed")
|
||||
private fun x64Unconfirmed(context: Context) = File(home(context), ".droiddeck-x64/.local/share/Steam/package/droiddeck-unconfirmed")
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.ComponentCallbacks2
|
||||
|
||||
internal object TopUnderPressure {
|
||||
const val WINDOW_MS = 5_000L
|
||||
|
||||
fun isPressure(level: Int) =
|
||||
level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL || level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW
|
||||
|
||||
fun shouldReclaim(nowMs: Long, pressureAtMs: Long, sessionRunning: Boolean, finishing: Boolean) =
|
||||
sessionRunning && !finishing && pressureAtMs > 0 && nowMs - pressureAtMs in 0..WINDOW_MS
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class VenusComponent(private val logFile: File?) : SessionPart() {
|
||||
// (Steam's GL, Xwayland's glamor) requires robustness2's nullDescriptor, which the
|
||||
// layer stands in for. The session script checks it and falls back to llvmpipe.
|
||||
"DROIDDECK_MALI_COMPAT=1",
|
||||
"BL_VENUS=1",
|
||||
"DD_VENUS=1",
|
||||
// gamescope's composite layout without immutable YCbCr samplers from the start
|
||||
// (patch 0930): a Mali-G615 refused every composite pipeline with them, and testing
|
||||
// that through Venus took the render server down.
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.droiddeck.launcher.stores
|
||||
|
||||
import android.content.Context
|
||||
import java.io.File
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
|
||||
internal object StoreLibraryCache {
|
||||
private fun file(context: Context, store: Store) = File(context.filesDir, "store-library/${store.id}.json")
|
||||
|
||||
fun load(context: Context, store: Store): List<CatalogItem>? {
|
||||
val f = file(context, store)
|
||||
if (!f.isFile) return null
|
||||
return runCatching { decode(store, f.readText()) }.getOrNull()
|
||||
}
|
||||
|
||||
private val locks = Store.entries.associateWith { Any() }
|
||||
|
||||
fun save(context: Context, store: Store, items: List<CatalogItem>, current: () -> Boolean) = synchronized(locks.getValue(store)) {
|
||||
if (!current()) return@synchronized
|
||||
val f = file(context, store)
|
||||
runCatching {
|
||||
f.parentFile?.mkdirs()
|
||||
val tmp = File(f.parentFile, f.name + ".tmp")
|
||||
tmp.writeText(encode(items))
|
||||
if (!tmp.renameTo(f)) { f.delete(); tmp.renameTo(f) }
|
||||
}
|
||||
}
|
||||
|
||||
fun clear(context: Context, store: Store) = synchronized(locks.getValue(store)) {
|
||||
file(context, store).delete()
|
||||
}
|
||||
|
||||
internal fun encode(items: List<CatalogItem>): String {
|
||||
val out = JSONArray()
|
||||
items.forEach { i ->
|
||||
out.put(JSONObject()
|
||||
.put("id", i.id).put("title", i.title)
|
||||
.put("image", i.imageUrl ?: "").put("tall", i.tallImageUrl ?: "").put("logo", i.logoUrl ?: "")
|
||||
.put("tags", i.tags).put("free", i.isFree).put("hasPrice", i.hasPrice)
|
||||
.put("finalPrice", i.finalPrice).put("originalPrice", i.originalPrice).put("discount", i.discountPercent)
|
||||
.put("url", i.storeUrl).put("developer", i.developer).put("publisher", i.publisher)
|
||||
.put("releaseDate", i.releaseDate).put("description", i.description)
|
||||
.put("owned", i.owned).put("size", i.sizeBytes).put("extra", JSONObject(i.extra))
|
||||
.put("mature", i.mature).put("subscription", i.subscription).put("includedWith", i.includedWith))
|
||||
}
|
||||
return out.toString()
|
||||
}
|
||||
|
||||
internal fun decode(store: Store, text: String): List<CatalogItem> {
|
||||
val raw = JSONArray(text)
|
||||
return (0 until raw.length()).mapNotNull { n ->
|
||||
val o = raw.optJSONObject(n) ?: return@mapNotNull null
|
||||
val extra = o.optJSONObject("extra")
|
||||
val map = HashMap<String, String>()
|
||||
extra?.keys()?.forEach { k -> map[k] = extra.optString(k) }
|
||||
CatalogItem(
|
||||
store = store, id = o.optString("id"), title = o.optString("title"),
|
||||
imageUrl = o.optString("image").ifBlank { null }, tallImageUrl = o.optString("tall").ifBlank { null },
|
||||
logoUrl = o.optString("logo").ifBlank { null },
|
||||
tags = o.optString("tags"), isFree = o.optBoolean("free"), hasPrice = o.optBoolean("hasPrice"),
|
||||
finalPrice = o.optString("finalPrice"), originalPrice = o.optString("originalPrice"), discountPercent = o.optInt("discount"),
|
||||
storeUrl = o.optString("url"), developer = o.optString("developer"), publisher = o.optString("publisher"),
|
||||
releaseDate = o.optString("releaseDate"), description = o.optString("description"),
|
||||
owned = o.optBoolean("owned"), sizeBytes = o.optLong("size"), extra = map,
|
||||
mature = o.optBoolean("mature"), subscription = o.optBoolean("subscription"), includedWith = o.optString("includedWith"),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,6 +202,7 @@ object StoresState {
|
||||
backend?.signOut(app)
|
||||
if (store == Store.GOG) com.droiddeck.launcher.stores.gog.GogComet.replaceAccount { StoreAccounts.clear(app, store) }
|
||||
else if (store != Store.XBOX || backend == null) StoreAccounts.clear(app, store)
|
||||
StoreLibraryCache.clear(app, store)
|
||||
if (store == Store.GAMEJOLT) {
|
||||
com.droiddeck.launcher.stores.gamejolt.GameJoltCollections.clear()
|
||||
com.droiddeck.launcher.stores.gamejolt.GameJoltUpdates.clear(app)
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.droiddeck.launcher.stores.StoreFront
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import com.droiddeck.launcher.stores.StoreLoginActivity
|
||||
import com.droiddeck.launcher.stores.StoreShelves
|
||||
import com.droiddeck.launcher.stores.StoreLibraryCache
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import com.droiddeck.launcher.stores.WebCookies
|
||||
import com.droiddeck.launcher.stores.download.DownloadEntry
|
||||
@@ -163,7 +164,16 @@ object RockstarLibrary {
|
||||
post(gen) { StoresState.status.remove(Store.ROCKSTAR); StoresState.problems[Store.ROCKSTAR] = app.getString(R.string.stores_sync_sign_in) }
|
||||
return
|
||||
}
|
||||
if (StoresState.library[Store.ROCKSTAR].isNullOrEmpty()) post(gen) { StoresState.status[Store.ROCKSTAR] = app.getString(R.string.stores_sync_game_list) }
|
||||
val cached = StoreLibraryCache.load(app, Store.ROCKSTAR)
|
||||
post(gen) {
|
||||
if (StoresState.library[Store.ROCKSTAR] == null) {
|
||||
if (cached != null) {
|
||||
StoresState.library[Store.ROCKSTAR] = cached
|
||||
StoresState.shelves[Store.ROCKSTAR]?.let { StoresState.shelves[Store.ROCKSTAR] = StoreFront.markOwned(it, cached, RockstarCatalog::sameGame) }
|
||||
}
|
||||
else StoresState.status[Store.ROCKSTAR] = app.getString(R.string.stores_sync_game_list)
|
||||
}
|
||||
}
|
||||
val account = RockstarApps.fetch(t.ticket) { StoresState.logLine(it) }
|
||||
val games = games(account)
|
||||
owned(account).filter { o -> games.none { it.id == o.id } }.takeIf { it.isNotEmpty() }?.let { elsewhere ->
|
||||
@@ -175,6 +185,7 @@ object RockstarLibrary {
|
||||
StoresState.library[Store.ROCKSTAR] = games
|
||||
StoresState.shelves[Store.ROCKSTAR]?.let { StoresState.shelves[Store.ROCKSTAR] = StoreFront.markOwned(it, games, RockstarCatalog::sameGame) }
|
||||
}
|
||||
StoreLibraryCache.save(app, Store.ROCKSTAR, games) { generation.get() == gen }
|
||||
StoresState.logLine("Rockstar: ${games.size} owned games")
|
||||
} catch (e: Exception) {
|
||||
StoresState.logLine("Rockstar: library sync failed: ${e.javaClass.simpleName} ${e.message.orEmpty().take(300)}")
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import com.droiddeck.launcher.stores.download.DownloadEntry
|
||||
import com.droiddeck.launcher.stores.download.DownloadQueue
|
||||
import com.droiddeck.launcher.stores.StoreLoginActivity
|
||||
import com.droiddeck.launcher.stores.StoreLibraryCache
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import com.droiddeck.launcher.stores.WebCookies
|
||||
import org.json.JSONObject
|
||||
@@ -206,7 +207,16 @@ object UbisoftLibrary {
|
||||
post(gen) { StoresState.status.remove(Store.UBISOFT); StoresState.problems[Store.UBISOFT] = app.getString(R.string.stores_sync_sign_in) }
|
||||
return
|
||||
}
|
||||
if (StoresState.library[Store.UBISOFT].isNullOrEmpty()) post(gen) { StoresState.status[Store.UBISOFT] = app.getString(R.string.stores_sync_game_list) }
|
||||
val cached = StoreLibraryCache.load(app, Store.UBISOFT)
|
||||
post(gen) {
|
||||
if (StoresState.library[Store.UBISOFT] == null) {
|
||||
if (cached != null) {
|
||||
StoresState.library[Store.UBISOFT] = cached
|
||||
StoresState.shelves[Store.UBISOFT]?.let { StoresState.shelves[Store.UBISOFT] = StoreFront.markOwned(it, cached, UbisoftStore::sameGame) }
|
||||
}
|
||||
else StoresState.status[Store.UBISOFT] = app.getString(R.string.stores_sync_game_list)
|
||||
}
|
||||
}
|
||||
val all = ArrayList<CatalogItem>()
|
||||
var offset = 0
|
||||
while (true) {
|
||||
@@ -241,6 +251,7 @@ object UbisoftLibrary {
|
||||
StoresState.library[Store.UBISOFT] = games
|
||||
StoresState.shelves[Store.UBISOFT]?.let { StoresState.shelves[Store.UBISOFT] = StoreFront.markOwned(it, games, UbisoftStore::sameGame) }
|
||||
}
|
||||
StoreLibraryCache.save(app, Store.UBISOFT, games) { generation.get() == gen }
|
||||
StoresState.logLine("Ubisoft: ${games.size} owned games")
|
||||
} catch (e: Exception) {
|
||||
StoresState.logLine("Ubisoft: library sync failed: ${e.javaClass.simpleName} ${e.message.orEmpty().take(200)}")
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
package com.droiddeck.launcher.stores.xbox
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.Button
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.activity.ComponentActivity
|
||||
import com.droiddeck.launcher.R
|
||||
import androidx.webkit.WebViewCompat
|
||||
import androidx.webkit.WebViewFeature
|
||||
import com.droiddeck.launcher.core.AddonPack
|
||||
@@ -24,8 +33,10 @@ import org.json.JSONObject
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class XboxLoginActivity : ComponentActivity() {
|
||||
private lateinit var host: LinearLayout
|
||||
private lateinit var host: FrameLayout
|
||||
private lateinit var status: TextView
|
||||
private lateinit var retry: Button
|
||||
private lateinit var progressBar: ProgressBar
|
||||
private var view: WebView? = null
|
||||
@Volatile private var child: Xodus.Child? = null
|
||||
@Volatile private var session = 0L
|
||||
@@ -37,11 +48,7 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
requestedOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this)
|
||||
host = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL; setBackgroundColor(Color.BLACK) }
|
||||
status = TextView(this).apply { setTextColor(Color.WHITE); text = "Preparing Microsoft sign-in…"; setPadding(24, 16, 24, 16) }
|
||||
host.addView(status)
|
||||
host.addView(Button(this).apply { text = getString(com.droiddeck.launcher.R.string.stores_login_close); setOnClickListener { finish() } })
|
||||
setContentView(host)
|
||||
setContentView(buildChrome())
|
||||
if (android.os.Build.VERSION.SDK_INT < 28 || !WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER) ||
|
||||
!WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
|
||||
status.text = "Update Android System WebView to sign in to Xbox."
|
||||
@@ -148,15 +155,60 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
val failed = step
|
||||
val reason = failure(e)
|
||||
logStep("failed while $failed: $reason")
|
||||
if (e is java.io.IOException) logStep("I/O detail: ${e.message.orEmpty().take(300)}")
|
||||
runOnUiThread {
|
||||
disposeView()
|
||||
val details = if (codes.isEmpty()) "" else "\nDetails: ${codes.joinToString(", ")}"
|
||||
status.text = "Microsoft sign-in did not complete.\nFailed while $failed: $reason$details\nClose this window and try again."
|
||||
status.text = "Microsoft sign-in did not complete.\nFailed while $failed: $reason$details"
|
||||
retry.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}, "xbox-login").start()
|
||||
}
|
||||
|
||||
private fun dp(value: Int): Int = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value.toFloat(), resources.displayMetrics).toInt()
|
||||
|
||||
/** The other stores' sign-in frame: a title bar with close, a load bar, and a centered status. */
|
||||
private fun buildChrome(): View {
|
||||
val root = LinearLayout(this).apply { orientation = LinearLayout.VERTICAL; setBackgroundColor(BACKGROUND) }
|
||||
val bar = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.HORIZONTAL; gravity = Gravity.CENTER_VERTICAL; setBackgroundColor(BAR)
|
||||
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(48))
|
||||
}
|
||||
bar.addView(TextView(this).apply {
|
||||
text = getString(R.string.stores_login_title, Store.XBOX.label)
|
||||
setTextColor(TEXT); textSize = 16f; setPadding(dp(16), 0, dp(8), 0)
|
||||
layoutParams = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f)
|
||||
})
|
||||
bar.addView(ImageButton(this).apply {
|
||||
setImageResource(android.R.drawable.ic_menu_close_clear_cancel); setBackgroundColor(Color.TRANSPARENT)
|
||||
contentDescription = getString(R.string.stores_login_close); layoutParams = LinearLayout.LayoutParams(dp(48), dp(48))
|
||||
setOnClickListener { finish() }
|
||||
})
|
||||
progressBar = ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal).apply {
|
||||
max = 100; visibility = View.GONE
|
||||
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp(3))
|
||||
}
|
||||
host = FrameLayout(this).apply {
|
||||
setBackgroundColor(BACKGROUND)
|
||||
layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f)
|
||||
}
|
||||
val panel = LinearLayout(this).apply {
|
||||
orientation = LinearLayout.VERTICAL; gravity = Gravity.CENTER; setBackgroundColor(BACKGROUND)
|
||||
setPadding(dp(24), dp(24), dp(24), dp(24))
|
||||
}
|
||||
status = TextView(this).apply { setTextColor(TEXT); textSize = 15f; gravity = Gravity.CENTER; text = "Preparing Microsoft sign-in…" }
|
||||
retry = Button(this).apply {
|
||||
text = getString(R.string.stores_login_retry); visibility = View.GONE
|
||||
setOnClickListener { startActivity(Intent(intent)); finish() }
|
||||
}
|
||||
panel.addView(status)
|
||||
panel.addView(retry, LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply { topMargin = dp(16) })
|
||||
host.addView(panel, FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
root.addView(bar); root.addView(progressBar); root.addView(host)
|
||||
return root
|
||||
}
|
||||
|
||||
private fun show(text: String) = runOnUiThread { if (!closed && view == null) status.text = text }
|
||||
|
||||
private fun progress(name: String, text: String) { step = name; show(text) }
|
||||
@@ -191,7 +243,6 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean = !trusted(request.url.toString())
|
||||
override fun onPageFinished(view: WebView, url: String) {
|
||||
if (!trusted(url)) { finish(); return }
|
||||
status.text = "Microsoft sign-in"
|
||||
val uri = Uri.parse(url)
|
||||
if (uri.host == "login.live.com" && uri.path == "/ppsecure/post.srf") {
|
||||
view.evaluateJavascript("JSON.stringify(globalThis.ServerData ?? null)") { raw ->
|
||||
@@ -203,7 +254,14 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
host.addView(web, LinearLayout.LayoutParams(-1, 0, 1f))
|
||||
web.setBackgroundColor(BACKGROUND)
|
||||
web.webChromeClient = object : android.webkit.WebChromeClient() {
|
||||
override fun onProgressChanged(view: WebView?, newProgress: Int) {
|
||||
progressBar.progress = newProgress
|
||||
progressBar.visibility = if (newProgress in 1..99) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
host.addView(web, FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
val headers = frame.getJSONObject("headers")
|
||||
val values = headers.keys().asSequence().associateWith { key ->
|
||||
require(key in allowedHeaders)
|
||||
@@ -212,7 +270,11 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
web.loadUrl(frame.getString("url"), values)
|
||||
}
|
||||
|
||||
private fun disposeView() { view?.let { host.removeView(it); it.stopLoading(); it.destroy() }; view = null }
|
||||
private fun disposeView() {
|
||||
view?.let { host.removeView(it); it.stopLoading(); it.destroy() }
|
||||
view = null
|
||||
if (::progressBar.isInitialized) progressBar.visibility = View.GONE
|
||||
}
|
||||
override fun onDestroy() {
|
||||
closed = true
|
||||
val current = child; child = null
|
||||
@@ -225,6 +287,9 @@ class XboxLoginActivity : ComponentActivity() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "XboxLogin"
|
||||
private const val BACKGROUND = 0xFF0A0B0D.toInt()
|
||||
private const val BAR = 0xFF121417.toInt()
|
||||
private const val TEXT = 0xFFF2F4F7.toInt()
|
||||
|
||||
internal fun failure(e: Exception): String {
|
||||
val message = e.message.orEmpty()
|
||||
|
||||
@@ -61,7 +61,7 @@ internal object XboxRuntime {
|
||||
val view = result.get(90, java.util.concurrent.TimeUnit.SECONDS)
|
||||
check(renew(app, id, token) && synchronized(state) { generation == current }) { "Xbox launch was cancelled" }
|
||||
return JSONObject().put("ok", true).put("socket", socket.path).put("lease", token)
|
||||
.put("exe", view.getString("exe")).put("playfab", view.opt("playfab"))
|
||||
.put("exe", view.getString("exe")).put("playfab", view.opt("playfab")).put("mountRoot", view.opt("mountRoot"))
|
||||
} catch (e: Exception) { released(token); throw e }
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ import androidx.compose.material.icons.outlined.Mic
|
||||
import androidx.compose.material.icons.outlined.Add
|
||||
import androidx.compose.material.icons.outlined.ArrowDownward
|
||||
import androidx.compose.material.icons.outlined.AttachFile
|
||||
import androidx.compose.material.icons.outlined.AutoAwesome
|
||||
import androidx.compose.material.icons.outlined.Terminal
|
||||
import androidx.compose.material.icons.outlined.Build
|
||||
import androidx.compose.material.icons.outlined.Close
|
||||
import androidx.compose.material.icons.outlined.ExpandMore
|
||||
@@ -451,7 +451,7 @@ private fun AgentConversation(modifier: Modifier, list: LazyListState, following
|
||||
}
|
||||
if (AgentHost.entries.isEmpty() && !working) {
|
||||
Column(modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
|
||||
Icon(Icons.Outlined.AutoAwesome, null, tint = pal.primary, modifier = Modifier.size(40.dp))
|
||||
Icon(Icons.Outlined.Terminal, null, tint = pal.primary, modifier = Modifier.size(40.dp))
|
||||
Text(stringResource(R.string.agent_empty), fontSize = 15.sp, color = pal.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center, modifier = Modifier.widthIn(max = 460.dp).padding(top = 12.dp))
|
||||
}
|
||||
@@ -567,7 +567,8 @@ private fun labStage(lab: com.droiddeck.launcher.agent.LabProgress) = when (lab.
|
||||
else -> stringResource(R.string.agent_lab_stage_starting)
|
||||
}
|
||||
|
||||
private fun hasActivity() = AgentHost.lab != null || AgentHost.queue.isNotEmpty() || currentTodo() != null
|
||||
private fun hasActivity() = AgentHost.lab != null || AgentHost.queue.isNotEmpty() || currentTodo() != null ||
|
||||
com.droiddeck.launcher.agent.AgentSetup.problems.isNotEmpty()
|
||||
|
||||
/** The todo item in progress and how many are done, while the agent works through a list. */
|
||||
private fun currentTodo(): String? {
|
||||
@@ -594,6 +595,11 @@ private fun AgentActivity(labOpen: Boolean, onLab: () -> Unit) {
|
||||
Text(todo, fontSize = 12.5.sp, color = pal.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 220.dp))
|
||||
}
|
||||
}
|
||||
val problems = com.droiddeck.launcher.agent.AgentSetup.problems
|
||||
if (problems.isNotEmpty()) AgentChip(warn = true, tag = "agent-tools-missing") {
|
||||
Text(stringResource(R.string.agent_tools_missing, problems.joinToString(", ")), fontSize = 12.5.sp, color = AttentionAmber,
|
||||
maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 260.dp))
|
||||
}
|
||||
for (queued in AgentHost.queue) AgentChip(warn = true) {
|
||||
Text(stringResource(R.string.agent_queued, queued.text), fontSize = 12.5.sp, color = AttentionAmber, maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis, modifier = Modifier.widthIn(max = 180.dp))
|
||||
|
||||
@@ -416,7 +416,7 @@ private fun ToolsRow(title: String, detail: String, action: @Composable () -> Un
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ToolsField(value: String, onValue: (String) -> Unit, hint: String, tag: String) {
|
||||
internal fun ToolsField(value: String, onValue: (String) -> Unit, hint: String, tag: String) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
Box(Modifier.fillMaxWidth().clip(Shape12).background(pal.surfaceVariant).padding(horizontal = 12.dp, vertical = 10.dp)) {
|
||||
|
||||
@@ -96,27 +96,61 @@ internal fun AgentSetupView(modifier: Modifier, onDone: () -> Unit = {}) {
|
||||
) {
|
||||
steps.forEachIndexed { index, step ->
|
||||
val status = AgentSetup.status[step] ?: Status.UNKNOWN
|
||||
val (title, hint) = labels(step, AgentHost.harness.name)
|
||||
val harness = AgentHost.harness
|
||||
// A harness that signs in with a pasted key: the sign-in opens its key page and this field takes the key.
|
||||
val keyed = step == Step.SIGN_IN && harness.keyPage != null
|
||||
var keyOpen by rememberSaveable(harness.id) { mutableStateOf(false) }
|
||||
val (title, hint) = labels(step, harness.name, keyed)
|
||||
val lab = AgentHost.lab?.takeIf { it.prepare && it.running }
|
||||
val detail = if (step == Step.PREPARE && lab != null)
|
||||
stringResource(R.string.agent_prepare_progress, lab.permille / 10, clock(lab.etaSeconds.toLong().coerceAtLeast(0)))
|
||||
else AgentSetup.detail[step] ?: hint
|
||||
val detail = when {
|
||||
step == Step.PREPARE && lab != null ->
|
||||
stringResource(R.string.agent_prepare_progress, lab.permille / 10, clock(lab.etaSeconds.toLong().coerceAtLeast(0)))
|
||||
keyed && status == Status.DONE && !AgentSetup.keySaved -> stringResource(R.string.agent_step_free_models)
|
||||
else -> AgentSetup.detail[step] ?: hint
|
||||
}
|
||||
// Shown while the sign-in is pending, so it is still there after a trip to the browser for the key.
|
||||
val pending = (status == Status.TODO || status == Status.FAILED) && AgentSetup.status[Step.INSTALL] == Status.DONE
|
||||
val showKey = keyed && (keyOpen || pending) && status != Status.WORKING
|
||||
var key by remember(harness.id) { mutableStateOf("") }
|
||||
CheckRow(
|
||||
when (status) {
|
||||
Status.DONE -> CheckState.OK
|
||||
Status.WORKING, Status.UNKNOWN -> CheckState.BUSY
|
||||
Status.TODO, Status.FAILED -> CheckState.WARN
|
||||
},
|
||||
title, detail, divider = index < steps.lastIndex,
|
||||
title, detail, divider = index < steps.lastIndex && !showKey,
|
||||
) {
|
||||
val blocked = (step in setOf(Step.SIGN_IN, Step.GITHUB, Step.BUILD_TOOLS) && AgentSetup.status[Step.INSTALL] != Status.DONE) ||
|
||||
(step == Step.PREPARE && AgentSetup.status[Step.BUILD_TOOLS] != Status.DONE)
|
||||
val openKey = {
|
||||
keyOpen = true
|
||||
AgentSetup.run(context, step)
|
||||
}
|
||||
if ((status == Status.TODO || status == Status.FAILED) && !blocked) {
|
||||
val label = stringResource(if (status == Status.FAILED) R.string.agent_setup_retry else action(step))
|
||||
val run = { if (step == Step.CONNECTION) pair(context) else AgentSetup.run(context, step) }
|
||||
if (step.required) PrimaryButton(label, compact = true, onClick = run) else SecondaryButton(label, compact = true, onClick = run)
|
||||
val run = { if (step == Step.CONNECTION) pair(context) else if (keyed) openKey() else AgentSetup.run(context, step) }
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (keyed && harness.free) SecondaryButton(stringResource(R.string.agent_action_free), compact = true) { AgentSetup.useFree(context) }
|
||||
if (step.required) PrimaryButton(label, compact = true, onClick = run) else SecondaryButton(label, compact = true, onClick = run)
|
||||
}
|
||||
} else if (keyed && status == Status.DONE && !AgentSetup.keySaved && !keyOpen) {
|
||||
SecondaryButton(stringResource(R.string.agent_action_add_key), compact = true, onClick = openKey)
|
||||
}
|
||||
}
|
||||
if (showKey) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp),
|
||||
modifier = Modifier.fillMaxWidth().padding(start = 56.dp, end = 14.dp, bottom = 10.dp),
|
||||
) {
|
||||
Box(Modifier.weight(1f)) { ToolsField(key, { key = it.trim() }, stringResource(R.string.agent_key_hint), "agent-key") }
|
||||
PrimaryButton(stringResource(R.string.agent_key_save), enabled = key.isNotBlank(), compact = true) {
|
||||
keyOpen = false
|
||||
AgentSetup.saveKey(context, key)
|
||||
key = ""
|
||||
}
|
||||
}
|
||||
if (index < steps.lastIndex) Box(Modifier.fillMaxWidth().height(1.dp).background(pal.line))
|
||||
}
|
||||
}
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(horizontal = 2.dp)) {
|
||||
@@ -183,6 +217,7 @@ private fun StorageCard() {
|
||||
private fun storageTitle(item: AgentStorage.Item) = when (item) {
|
||||
AgentStorage.Item.CLAUDE_CODE -> R.string.agent_storage_claude
|
||||
AgentStorage.Item.CODEX -> R.string.agent_storage_codex
|
||||
AgentStorage.Item.OPENCODE -> R.string.agent_storage_opencode
|
||||
AgentStorage.Item.BUILD_TOOLS -> R.string.agent_step_build
|
||||
AgentStorage.Item.SOURCE -> R.string.agent_storage_source
|
||||
AgentStorage.Item.CACHES -> R.string.agent_storage_caches
|
||||
@@ -195,10 +230,10 @@ private fun storageWarning(item: AgentStorage.Item) = when (item) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun labels(step: Step, harness: String): Pair<String, String> = when (step) {
|
||||
private fun labels(step: Step, harness: String, keyed: Boolean = false): Pair<String, String> = when (step) {
|
||||
Step.CONNECTION -> stringResource(R.string.agent_step_connection) to stringResource(R.string.agent_step_connection_hint)
|
||||
Step.INSTALL -> stringResource(R.string.agent_step_install, harness) to stringResource(R.string.agent_step_install_hint)
|
||||
Step.SIGN_IN -> stringResource(R.string.agent_step_sign_in, harness) to stringResource(R.string.agent_step_sign_in_hint)
|
||||
Step.SIGN_IN -> stringResource(R.string.agent_step_sign_in, harness) to stringResource(if (keyed) R.string.agent_step_sign_in_key_hint else R.string.agent_step_sign_in_hint)
|
||||
Step.GITHUB -> stringResource(R.string.agent_step_github) to stringResource(R.string.agent_step_github_hint)
|
||||
Step.BUILD_TOOLS -> stringResource(R.string.agent_step_build) to stringResource(R.string.agent_step_build_hint)
|
||||
Step.PREPARE -> stringResource(R.string.agent_step_prepare) to stringResource(R.string.agent_step_prepare_hint)
|
||||
|
||||
@@ -156,7 +156,10 @@ internal fun DesktopPage(s: FrontEndState, a: FrontEndActions, modifier: Modifie
|
||||
},
|
||||
rows = { tab ->
|
||||
if (tab == SheetTab.FILES) DesktopFiles(s, a)
|
||||
else a.modeSheet(mode, tab, SheetExtras())
|
||||
else a.modeSheet(mode, tab, SheetExtras(
|
||||
performance = { PerformanceLink(a, "desktop", SheetTab.SESSION) },
|
||||
drivers = { summary -> DriversLink(a, summary, "desktop", stringResource(R.string.hop_from_play)) },
|
||||
))
|
||||
},
|
||||
)
|
||||
if (adding && !s.busy) AddAppDialog(s.ready, onDismiss = { adding = false }) { request, label -> UserAppsState.add(ctx, request, label) }
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.expandVertically
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.shrinkVertically
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.positionInRoot
|
||||
import androidx.compose.ui.layout.boundsInRoot
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
internal object DownloadsNav {
|
||||
var showSettings = false
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun DownloadsPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
val live = androidx.compose.runtime.rememberUpdatedState(s)
|
||||
var gearAt by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf<androidx.compose.ui.geometry.Rect?>(null) }
|
||||
val openSettings = { gearAt?.let { StoresMotion.ask(downloadsSettingsStep(it, live, a, pal.signal)) } }
|
||||
androidx.compose.runtime.LaunchedEffect(gearAt != null) {
|
||||
if (gearAt != null && DownloadsNav.showSettings) { DownloadsNav.showSettings = false; openSettings() }
|
||||
}
|
||||
var hostAt by androidx.compose.runtime.remember { androidx.compose.runtime.mutableStateOf(androidx.compose.ui.geometry.Offset.Zero) }
|
||||
androidx.compose.runtime.DisposableEffect(Unit) { val page = Any(); StoresMotion.hosting(page); onDispose { StoresMotion.release(page) } }
|
||||
androidx.activity.compose.BackHandler(enabled = StoresMotion.stepOpen) { StoresMotion.fold() }
|
||||
androidx.compose.foundation.layout.Box(androidx.compose.ui.Modifier.fillMaxSize().onGloballyPositioned { hostAt = it.positionInRoot() }) {
|
||||
Column(modifier.verticalScroll(rememberScrollState()).padding(bottom = 24.dp)) {
|
||||
PageHeader(stringResource(R.string.stores_tab_downloads)) {
|
||||
Spacer(Modifier.weight(1f))
|
||||
androidx.compose.foundation.layout.Box(Modifier.onGloballyPositioned { gearAt = it.boundsInRoot() }) {
|
||||
SmallIconButton(Icons.Filled.Settings, stringResource(R.string.downloads_settings), tint = MaterialTheme.colorScheme.onSurfaceVariant) {
|
||||
openSettings()
|
||||
}
|
||||
}
|
||||
}
|
||||
StoresDownloadsPane(s, a)
|
||||
}
|
||||
StoresMotion.step?.let { ask ->
|
||||
androidx.compose.runtime.key(ask) {
|
||||
StepOut(
|
||||
open = StoresMotion.stepOpen, pill = ask.anchor.translate(-hostAt), preferredSide = ask.side, accent = ask.accent,
|
||||
onDismiss = { StoresMotion.fold() }, onClosed = { StoresMotion.closed(ask) },
|
||||
pillCorner = ask.pillCorner, maxWidth = ask.maxWidth, items = ask.items, handle = ask.handle, content = ask.content,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.slideInHorizontally
|
||||
import androidx.compose.animation.slideOutHorizontally
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.displayCutout
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowLeft
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
private const val HINT_SESSIONS = 3
|
||||
private const val HINT_MS = 6_000L
|
||||
private var hintedSession: Any? = null
|
||||
|
||||
@Composable
|
||||
internal fun DrawerEntryHint(steam: Boolean, inverted: Boolean, onOpen: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
var shown by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(Unit) {
|
||||
val session = com.droiddeck.launcher.session.SessionState.sessionId
|
||||
if (hintedSession == session || SessionPrefs.drawerHintShown(context) >= HINT_SESSIONS) return@LaunchedEffect
|
||||
hintedSession = session
|
||||
SessionPrefs.countDrawerHint(context)
|
||||
shown = true
|
||||
delay(HINT_MS)
|
||||
shown = false
|
||||
}
|
||||
Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.displayCutout), contentAlignment = Alignment.CenterEnd) {
|
||||
AnimatedVisibility(shown, enter = slideInHorizontally { it } + fadeIn(), exit = slideOutHorizontally { it } + fadeOut()) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(topStart = 14.dp, bottomStart = 14.dp))
|
||||
.background(Color(0xE6101216))
|
||||
.clickable(role = Role.Button, onClickLabel = stringResource(R.string.drawer_handle)) { shown = false; onOpen() }
|
||||
.padding(start = 10.dp, end = 14.dp, top = 10.dp, bottom = 10.dp)
|
||||
.widthIn(max = 260.dp)
|
||||
.testTag("drawer-hint"),
|
||||
) {
|
||||
Icon(Icons.AutoMirrored.Filled.KeyboardArrowLeft, null, tint = Color.White, modifier = Modifier.size(20.dp))
|
||||
val bound = remember {
|
||||
com.droiddeck.launcher.input.PhysicalShortcuts.read(context)
|
||||
.filter { it.action == com.droiddeck.launcher.input.PhysicalShortcuts.Action.DROIDDECK }
|
||||
.map { it.button.label }.distinct().joinToString(" / ")
|
||||
}
|
||||
Text(
|
||||
if (bound.isNotEmpty()) stringResource(R.string.drawer_hint_button, bound)
|
||||
else stringResource(if (!steam) R.string.drawer_hint else if (inverted) R.string.drawer_hint_steam_inverted else R.string.drawer_hint_steam),
|
||||
fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = Color.White,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun DrawerCornerTap(onOpen: () -> Unit) {
|
||||
Box(Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.displayCutout), contentAlignment = Alignment.TopEnd) {
|
||||
Box(
|
||||
Modifier.size(64.dp).testTag("drawer-corner")
|
||||
.pointerInput(Unit) { detectTapGestures(onDoubleTap = { onOpen() }) },
|
||||
)
|
||||
}
|
||||
}
|
||||
Loaded 100 of 437 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user