Compare commits
46
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1861bd4b9a | ||
|
|
f8fb1db3c8 | ||
|
|
e6e3673709 | ||
|
|
268dcef559 | ||
|
|
66abf0c707 | ||
|
|
5be04466af | ||
|
|
63ad5a722f | ||
|
|
f896d7fa75 | ||
|
|
995cbc411c | ||
|
|
5045002de1 | ||
|
|
e75505c019 | ||
|
|
264c0fc0f6 | ||
|
|
0f93fd75c4 | ||
|
|
4deff589e5 | ||
|
|
97853d0fde | ||
|
|
2d5061c986 | ||
|
|
6dab2cef17 | ||
|
|
3a4866e2ea | ||
|
|
499b06ff2c | ||
|
|
abca04336a | ||
|
|
5eaa6a76cc | ||
|
|
42df3a78b3 | ||
|
|
30e009a651 | ||
|
|
9e28a11270 | ||
|
|
ed3cfaf9c6 | ||
|
|
082ea000dc | ||
|
|
a251e8cc23 | ||
|
|
60184418ba | ||
|
|
125e39ea9c | ||
|
|
ee8911a382 | ||
|
|
3be85906e9 | ||
|
|
e76592ba4e | ||
|
|
0a07926ef3 | ||
|
|
b63feb5eaa | ||
|
|
d691bcf832 | ||
|
|
583f34fc55 | ||
|
|
88719f25d2 | ||
|
|
ac132a23e2 | ||
|
|
85dd8beae1 | ||
|
|
b07eca3c06 | ||
|
|
6eef0721c9 | ||
|
|
e3c3471d2f | ||
|
|
a81d1a4d4e | ||
|
|
28067b3bbe | ||
|
|
8088e47d14 | ||
|
|
6673a892e2 |
No files matched your search
@@ -274,6 +274,9 @@ jobs:
|
||||
if: steps.comet.outputs.cache-hit != 'true'
|
||||
run: python3 tools/components/prepare.py comet
|
||||
|
||||
- name: Build the DiRT 3 / DiRT Showdown ws2_32 stand-in
|
||||
run: python3 tools/components/prepare.py dirt-ws2
|
||||
|
||||
- name: Prepare graphics driver variants
|
||||
run: python3 tools/quest/build-driver.py "$ANDROID_HOME/ndk/$NDK_VERSION"
|
||||
- name: Record and pack prepared components
|
||||
|
||||
@@ -7,80 +7,148 @@
|
||||
|
||||
DroidDeck brings the SteamOS experience to Android: Valve's Steam client in Big Picture on your Adreno handheld, with Windows games through Valve's ARM64 Proton.
|
||||
|
||||
<p align="center"><a href="https://discord.gg/JRGAvawjsm"><img src="https://img.shields.io/badge/Discord-Join%20the%20community-5865F2?logo=discord&logoColor=white" alt="Join the DroidDeck Discord"></a></p>
|
||||
<p align="center"><b>100% open source. No ads. No telemetry. No source withheld.</b></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.star-history.com/droid-deck/droiddeck"><img src="https://api.star-history.com/badge?repo=Droid-Deck/DroidDeck&type=rank&theme=dark" alt="Star History Rank" /></a>
|
||||
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.6.7/DroidDeck-0.6.7.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.6.7%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.6.7"></a>
|
||||
<a href="https://discord.gg/JRGAvawjsm"><img src="https://img.shields.io/badge/Discord-Join%20us-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join the DroidDeck Discord"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://trendshift.io/repositories/267852?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-267852" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/daily?language=C" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"/></a>
|
||||
<a href="https://trendshift.io/repositories/267852?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-267852" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/daily?language=Kotlin" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"/></a>
|
||||
<a href="https://www.star-history.com/droid-deck/droiddeck"><img src="https://api.star-history.com/badge?repo=Droid-Deck/DroidDeck&type=rank&theme=dark" alt="Star History Rank"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://trendshift.io/repositories/267852?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-267852" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/weekly?language=C" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"/></a>
|
||||
<a href="https://trendshift.io/repositories/267852?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-267852" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/weekly?language=Kotlin" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"/></a>
|
||||
<a href="https://trendshift.io/repositories/267852"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/daily?language=C" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"></a>
|
||||
<a href="https://trendshift.io/repositories/267852"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/daily?language=Kotlin" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"></a>
|
||||
</p>
|
||||
|
||||
<p align="center"><img src="docs/releases/media/0.2.0/launch-into-steam.gif" width="80%" alt="Tapping DroidDeck on the Android home screen and landing in Steam Big Picture"></p>
|
||||
<p align="center"><img src="docs/media/steam-to-desktop.gif" width="100%" alt="On a Retroid Pocket Duo: Play Steam from the DroidDeck launcher, open Pac-Man in Steam Big Picture and play it, exit the game, then Switch to Desktop from the Power menu"></p>
|
||||
|
||||
> Note: DroidDeck does not have a stand-alone website. Do not click on any download links from websites claiming to be the DroidDeck team.
|
||||
> DroidDeck has no website. Only download it from this repository's [Releases](https://github.com/Droid-Deck/DroidDeck/releases).
|
||||
|
||||
## Requirements and install
|
||||
<p align="center">
|
||||
<img src="docs/releases/media/0.6.7/library.gif" width="49%" alt="The Library switching source chips, changing the card size and opening the Filter menu">
|
||||
<img src="docs/releases/media/0.3.0/in-game.gif" width="49%" alt="A Windows game running through Proton with the on-screen controls">
|
||||
<img src="docs/releases/media/0.4.0/multi-controller.gif" width="49%" alt="Two controllers playing split screen on one handheld">
|
||||
<img src="docs/releases/media/0.6.7/ubuntu-desktop-discover.jpg" width="49%" alt="The Kubuntu desktop with Discover open">
|
||||
</p>
|
||||
|
||||
Use Android 9 or newer on a supported Adreno device (730 or newer, or 8xx). Adreno 6xx is experimental: DirectX 11 uses DXVK 2 and may run, and DirectX 12 games can still crash. Mali, Xclipse, PowerVR, and Adreno 710 are unsupported. No root is required. Allow about 3 GB for the runtime and 1.1 GB more for the desktop and emulators. Install the APK from [Releases](https://github.com/Droid-Deck/DroidDeck/releases), install the Linux runtime, then press **Play** and sign in. Steam downloads on first launch. Install **Desktop & apps** to use the desktop and emulators. The **Store** installs Linux apps and games from Flathub (ARM64 builds) with Flatpak; with additional options to install Appimages and set up scripts. **Stores** (Setup › Stores › "Show Stores in the rail") signs in to GOG, Epic Games and Amazon Games and downloads games into the Games storage. Epic keeps its direct API install path. Opening Epic Stores prepares Epic’s official Linux launcher preview. When installed, Epic games launched from DroidDeck use that client, and games installed in the client are imported into DroidDeck’s library and shortcuts. The x86-64 client runs through FEX on ARM and DroidDeck retains its Proton hooks; this preview and ARM setup are outside Epic’s listed Linux support. The cog on a store’s chip row sets its opening tab and download speed tier.
|
||||
## Install
|
||||
|
||||
On Android 14 and newer, before Steam launches, you must turn on **Disable child process restrictions** in Developer options. If this option is not available in developer settings (Android 12 and 13 devices), first launch of Steam will present a "Fix it for me" button, which will help automate the setup process.
|
||||
1. Android 9 or newer on Adreno 730 or newer, or any 8xx. Adreno 6xx is experimental. Mali, Xclipse, PowerVR and Adreno 710 are unsupported. No root needed.
|
||||
2. About 3 GB free for the runtime, plus 1.1 GB for the desktop and emulators.
|
||||
3. Install the [APK](https://github.com/Droid-Deck/DroidDeck/releases/download/0.6.7/DroidDeck-0.6.7.apk), install the Linux runtime, press **Play** and sign in to Steam.
|
||||
4. On Android 14 and newer, turn on **Disable child process restrictions** in Developer options. On Android 12 and 13, Steam's first launch shows a **Fix it for me** button that walks you through it.
|
||||
|
||||
## Physical button shortcuts
|
||||
Smart glasses setup is in the [support matrix](docs/smart-glasses-support.md). Release notes are in [docs/releases](docs/releases).
|
||||
|
||||
Open the launcher's **Controls** settings, **Setup → Controller → Button mapping**, or the session drawer's **Controller** page. Each menu action has one row showing **Custom** or **Default**. Select the current value beside **Steam menu**, **Open Quick Access Menu**, or **DroidDeck menu**, then press and release a physical button. The assignment saves automatically on release; confirmation is only required if the button already opens another menu. Assignments are stored per controller; each action has one assigned button per controller. A mapped button performs the shortcut instead of sending its normal input to the game. Steam shortcuts only apply in Steam sessions, and shortcuts are inactive while loading, suspended, or using the on-screen keyboard or other input dialogs.
|
||||
|
||||
Unassigned buttons keep their existing behavior, including the Back button's single/double-press setting and Select-to-Steam option. While the session drawer is open, A selects the focused item even if it has a shortcut assignment. Select an action's current value and use **Reset** beside an assignment to restore that behavior without changing touch layouts or other controller settings. **Close** exits capture without changing an assignment; it does not undo an assignment already applied. The touchscreen remains available for configuration and recovery.
|
||||
|
||||
Extra buttons such as M1/M2 work only if Android exposes distinct key events to the app. Android Home, volume and other reserved system keys cannot be assigned; making DroidDeck the default launcher retains its existing Home-to-Steam behavior. Firmware that intercepts a button or makes it duplicate another button cannot be overridden here. During capture, the detected device and button name are shown. If a controller disconnects before release, use **Try another button** to restart capture; **Reset** remains available for existing assignments. Capture and shortcut-action diagnostics, including key and scan codes, are included in session logs when capture runs inside a session. If a button is not detected, record its physical label, firmware/controller mode, and whether it leaves the app, then share the session logs.
|
||||
|
||||
## Smart glasses
|
||||
|
||||
Use **Setup → Smart glasses** for app-wide virtual-screen settings across DroidDeck menus, launchers, desktop sessions, and games. Supported VITURE, RayNeo, XREAL, and Rokid connections provide 3DoF; Luma Ultra adds optional experimental 6DoF and stereo-assisted hand/Joy-Con tracking. Model support and SDK requirements differ: see the [smart-glasses support matrix](docs/smart-glasses-support.md) for supported devices, controls, setup, and limitations.
|
||||
|
||||
## Community
|
||||
|
||||
Join the [DroidDeck Discord](https://discord.gg/JRGAvawjsm) for help, Preview builds, and device reports. Bug reports go in its **#bug-reports** forum; attach the zip from **Share logs** (Setup, or the session drawer) so the logs come with it.
|
||||
Help, Preview builds and device reports are on [Discord](https://discord.gg/JRGAvawjsm). For bugs, post in **#bug-reports** with the zip from **Share logs**.
|
||||
|
||||
## Build
|
||||
|
||||
Run `tools/build_local.sh` with Docker, Java 17, the Android SDK/NDK, Rust through rustup, GitHub CLI, Python 3, and `zstd` installed. It prepares the same native libraries, pinned components and audio sinks as CI, then checks the APK's assets, JNI exports and dependencies. The APK is at `app/build/outputs/apk/release/app-release.apk`. Set `DROIDDECK_PA13_SOURCE_DIR` to an existing PulseAudio 13.0 source directory to skip downloading it. Set `DROIDDECK_SIGNING_ENV` to a signing environment file to install over a release build; relative keystore paths resolve beside that file. To install on an attached device, run `tools/deploy_local.sh`.
|
||||
Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, GitHub CLI, Python 3 and `zstd`.
|
||||
|
||||
After preparation, ordinary `./gradlew :app:assembleRelease` builds can reuse the verified inputs. If native sources, component pins or staged files change, packaging stops with instructions to rerun the helper. Generated audio stays under `app/build/`; the tracked base bundle is never modified. `./gradlew -PskipRust=true :app:testDebugUnitTest` needs no native preparation. For an APK without store engines, use `DROIDDECK_SKIP_RUST=1 tools/build_local.sh`; it omits cached engine libraries too.
|
||||
```bash
|
||||
tools/build_local.sh
|
||||
```
|
||||
|
||||
For the prepared Windows checkout, run `./tools/run_windows.ps1` (optionally with `-Serial <adb-serial>`), or select **DroidDeck XR** in Android Studio and run the **app** module on the connected phone. Machine-specific options live in the ignored `local.properties`: `droiddeck.python` selects a Python executable, `droiddeck.skipRust=true` omits the optional store download engines, and `droiddeck.debugApplicationIdSuffix=.xr` installs **DroidDeck XR Dev** alongside the signed release. The development app has its own runtime and Steam login. The local Java selection is in `.gradle/config.properties`.
|
||||
The APK lands in `app/build/outputs/apk/release/`. Install it with `tools/deploy_local.sh`. After the first run, `./gradlew :app:assembleRelease` reuses the prepared inputs. Unit tests run with `./gradlew -PskipRust=true :app:testDebugUnitTest`, and the helper and preload suite with `bash tools/test_local.sh`.
|
||||
|
||||
`python tools/prepare_windows_runtime.py` restores this checkout's audited runtime inputs from the pinned CI APK, three locally rebuilt preload libraries, and the checksum-pinned Gamescope archive in `build/windows-setup/`. Start Docker Desktop's Linux engine first: preparation now rebuilds DroidDeck's ARM64 VR driver and Vulkan layer from current source and runs their native regression tests. The compiler image is built automatically on first use. Vulkan headers come from the NDK beside `--llvm-strip`, or from an explicit `--vk-include <NDK-sysroot-include>` directory.
|
||||
|
||||
To reuse that build, pass `--rebuilt-vr build/windows-setup/vr`. Preparation verifies its `vr-build.json` against the current Git revision, source files, Vulkan headers, output checksums, and ARM64 architecture; missing or stale builds fail instead of falling back to the donor's VR libraries. The script checks the actual donor CI merge tree, still rejects unrelated unaudited runtime changes, and records component provenance in `app/build/windows-runtime-provenance.json`. Preserve these ignored preparation files when rebuilding locally; `clean` removes the prepared assets and their verification manifest.
|
||||
|
||||
Run the helper and preload regression suite with `bash tools/test_local.sh`. On macOS it runs in Linux through Docker, matching the helpers' runtime and CI instead of compiling Linux preloads against macOS headers.
|
||||
On Windows, see `tools/run_windows.ps1` and `tools/prepare_windows_runtime.py`.
|
||||
|
||||
## Limits
|
||||
|
||||
Compatibility and performance vary by device; hardware validation is limited. Desktop compositing uses software rendering. Firefox sandboxing is reduced under proot. Logs are kept app-private (`files/logs/`, the last 30 sessions); **Share logs** packs the newest session, with the stores and tool logs, into one scrubbed zip.
|
||||
Compatibility and performance vary by device. Desktop compositing is software rendered, and Firefox sandboxing is reduced under proot.
|
||||
|
||||
## Credits and licence
|
||||
|
||||
GPL-3.0. Runtime, shim, input, and controller work build on WinNative and Bannerlator (maxjivi05). Epic Games and GOG support build on [Phobos’s](https://github.com/phobos665) adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl), respectively. Battle.net support is [@kayakyakr](https://github.com/kayakyakr)'s: it runs Blizzard's own Battle.net client, downloaded from Blizzard and not included, in Proton, and shows the key art from each game's [Battle.net Shop](https://shop.battle.net) page; without the Steam client its games see DroidDeck's pad as an Xbox 360 controller through `PROTON_SPOOF_STEAMINPUT_VIDPID` in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/winebus.sys`. Its games install from Stores through Blizzard's own Agent and the local HTTP API it serves, driven the way [@barncastle](https://github.com/barncastle)'s [Battle.Net-Installer](https://github.com/barncastle/Battle.Net-Installer) drives it, with the requests described on [wowdev.wiki](https://wowdev.wiki/Agent); how other launchers find, install and start Blizzard games was read in [@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, without taking their code. The registry entries a GOG game's install script (`goggame-<id>.script`) sets are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher)'s GOG setup (GPL-3.0) reads them. LSFG frame generation is from the work of Camille LaVey and the [Eden](https://eden-emu.dev) emulator project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported to WinNative and DroidDeck 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. x86 AppImages, and any whose own runtime cannot unpack them, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence, which also starts the arm64 emulator AppImages whose own runtime cannot run its extractor on Android. x86 AppImages packed with [sharun](https://github.com/VHSgunzo/sharun) by VHSgunzo (MIT) start because DroidDeck's own [FEX](https://github.com/FEX-Emu/FEX) build (MIT) puts the platform name under `AT_PLATFORM`, which sharun's [userland-execve](https://crates.io/crates/userland-execve) loader (MIT) requires; FEX filed it under `AT_BASE_PLATFORM`. The Steam client's audio goes through [@The412Banner](https://github.com/The412Banner)'s [DirectAudio](https://github.com/The412Banner/directaudio) PulseAudio sink (LGPL-2.1-or-later), built from `tools/directaudio/sink` with its request size kept to its ring so clients are not asked to queue 100 ms ahead. The in-game performance HUD is [@The412Banner](https://github.com/The412Banner)'s [FusionHUD](https://github.com/The412Banner/FusionHUD) (GPL-3.0 with an attribution term), Bannerlator's HUD; its frame rate, frame times and readings are taken from the same sources, and worked out the same way, as Valve's [MangoHud](https://github.com/flightlessmango/MangoHud) build (MIT) that runs Steam's performance overlay in a DroidDeck session, with the frame times shared by gamescope patch 0125; when gamescope sends no frames for two seconds, the HUD counts the frames DroidDeck's compositor shows instead, which stop at the screen's refresh rate. mmap ring-buffer controller input was developed by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)). Why the x86-64 Steam client refused the arm64 client's sign-in was checked by reading Steam's saved token with the `ConnectCache` format from [deadlock-api-ingest](https://github.com/deadlock-api/deadlock-api-ingest). x86 programs that link OpenSSL 3 under FEX use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt) platform. Hooks written with `WriteProcessMemory` into code [FEX](https://github.com/FEX-Emu/FEX) has translated go through `/proc/<pid>/mem` again when the kernel refuses `process_vm_writev`, as [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` wrote them before Wine 11. x86 Linux games under FEX get the same `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes into the Steam Linux Runtime, so ALSA plays through PulseAudio. Games render with [Mesa](https://gitlab.freedesktop.org/mesa/mesa) Turnip's own per-render-pass choice between tile memory and system memory, while the Steam client keeps `TU_DEBUG=sysmem`; [FEX](https://github.com/FEX-Emu/FEX)'s code disk cache was checked in its source and isLine truncated
|
||||
DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. VITURE, RayNeo, XREAL, Rokid, REDMAGIC, Nintendo Switch and Joy-Con are trademarks of their owners. This project is not affiliated with any of them.
|
||||
|
||||
XR glasses support builds on WinNative's VITURE glasses work. VITURE protocol details were checked against [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) by [@wheaney](https://github.com/wheaney), including the VITURE protocol header it ships, [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) by [@badicsalex](https://github.com/badicsalex) and the [go-macos/iokit VITURE package](https://pkg.go.dev/github.com/go-macos/iokit/viture); the optional VITURE SDK belongs to VITURE and is not included. RayNeo support adapts [@informalTechCode](https://github.com/informalTechCode)'s [RayNeo-Air-Series-3DoF-Scaffold](https://github.com/informalTechCode/RayNeo-Air-Series-3DoF-Scaffold) (Apache-2.0) and references [@verncat](https://github.com/verncat)'s [RayNeo-Air-3S-Pro-OpenVR](https://github.com/verncat/RayNeo-Air-3S-Pro-OpenVR) (MIT) and [Monado](https://gitlab.freedesktop.org/monado/monado) (BSL-1.0); see [docs/third-party/rayneo](docs/third-party/rayneo/README.md). XREAL 1S support references [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver) and [xrealOneDeviceKit](https://github.com/wheaney/xrealOneDeviceKit) by @wheaney, [xreal_one_driver](https://github.com/rohitsangwan01/xreal_one_driver) by [@rohitsangwan01](https://github.com/rohitsangwan01) (MIT) and [xr-tools](https://github.com/0xcaff/xr-tools) by [@0xcaff](https://github.com/0xcaff). Rokid support follows the Rokid protocol notes in [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) and @badicsalex's [Void Computing write-ups](https://voidcomputing.hu/blog/worse-better-prettier/), and [Monado](https://gitlab.freedesktop.org/monado/monado)'s Rokid driver. The REDMAGIC glasses-display findings draw on [@mekhontsev](https://github.com/mekhontsev)'s [MagicDesk investigation](https://github.com/mekhontsev/magicdesk/blob/main/docs/xr-resolution-fix.md) and [@Coding-BR](https://github.com/Coding-BR)'s [decompiled Nubia kernel](https://github.com/Coding-BR/android_kernel_nubia_sm8850_qwjujube). VITURE, RayNeo, XREAL, Rokid and REDMAGIC are trademarks of their owners; this project is not affiliated with them.
|
||||
<details>
|
||||
<summary><b>Runtime, Wine and Proton</b></summary>
|
||||
|
||||
Joy-Con VR controllers port the arm model of Google's [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk) (Apache-2.0), adapt the hand skeleton of Valve's [OpenVR](https://github.com/ValveSoftware/openvr) `handskeletonsimulation` sample (BSD-3-Clause), which follows Moshi Turner's hand simulation in [Monado](https://gitlab.freedesktop.org/monado/monado), and use the Index controller offsets from Monado's `vive_poses.c` (BSL-1.0). Joy-Con behaviour was researched in Linux's [hid-nintendo](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-nintendo.c) driver by Daniel J. Ogorchock, [@dekuNukem](https://github.com/dekuNukem)'s [Nintendo_Switch_Reverse_Engineering](https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering), [SDL](https://github.com/libsdl-org/SDL) and the Android Open Source Project, and checked against [ALVR](https://github.com/alvr-org/ALVR), [OpenComposite](https://gitlab.com/znixian/OpenOVR), [PSMoveSteamVRBridge](https://github.com/HipsterSloth/PSMoveSteamVRBridge), [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr), [@krnelpan1c](https://github.com/krnelpan1c)'s [Daydream-Controller-SteamVR](https://github.com/krnelpan1c/Daydream-Controller-SteamVR), [@yoyobuae](https://github.com/yoyobuae)'s [joyconvr](https://github.com/yoyobuae/joyconvr), [Moonlight](https://github.com/moonlight-stream/moonlight-android) and [Dolphin](https://github.com/dolphin-emu/dolphin); see [docs/third-party/joycon](docs/third-party/joycon/README.md). Nintendo Switch and Joy-Con are trademarks of Nintendo; this project is not affiliated with Nintendo.
|
||||
- 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.
|
||||
- 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`.
|
||||
- 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).
|
||||
- Games use [Mesa](https://gitlab.freedesktop.org/mesa/mesa) Turnip's per render pass memory choice. The Steam client keeps `TU_DEBUG=sysmem`.
|
||||
- Black Ops III and Dark Souls Remastered start without [umu-protonfixes](https://github.com/Open-Wine-Components/umu-protonfixes) (BSD-2-Clause), whose `311210.py` and `570940.py` fail under ARM64 Proton.
|
||||
- [ReSkate](https://github.com/Dingo-Shenanigans/ReSkate) (GPL-3.0) by Dingo Shenanigans uses the launch option from its README and D3D12 feature level 12_1.
|
||||
- The arm64 client's sign in was checked by reading Steam's saved token with the `ConnectCache` format from [deadlock-api-ingest](https://github.com/deadlock-api/deadlock-api-ingest).
|
||||
|
||||
Camera hand tracking runs Google's [MediaPipe](https://github.com/google-ai-edge/mediapipe) Tasks Vision library with its Pose Landmarker (Lite) model, BlazePose GHUM 3D, and its Hand Landmarker model (all Apache-2.0), on frames from AndroidX [CameraX](https://developer.android.com/jetpack/androidx/releases/camera) (Apache-2.0); MediaPipe's usage reports are switched off. The design was checked against [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr) camera app (MIT), and the short Joy-Con movements follow the accelerometer mode of the [Google VR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk)'s arm model, Eric Foxlin's zero-velocity updates and Frosio, Pedersini and Borghese's accelerometer autocalibration, and the camera and Joy-Con are joined by a Kalman filter (R. E. Kalman, 1960). Bare camera hands take their gestures after [ALVR](https://github.com/alvr-org/ALVR)'s `hand_gestures.rs` (MIT) and Meta Quest's menu pinch, with distances checked on photos from the [HaGRID](https://github.com/hukenovs/hagrid) gesture set (CC BY-SA 4.0, not included), fit the palm with Horn's quaternion method (1987) and smooth it with the 1€ filter (Casiez, Roussel and Vogel, 2012); the white glove model follows Valve's OpenVR render model reference and Index controller poses, is meshed with surface nets (Gibson, 1998; Mikola Lysenko) and blends and shades it with Inigo Quilez's smooth minimum and distance-field ambient occlusion, porting his polygon distance (MIT); see [docs/third-party/handtracking](docs/third-party/handtracking/README.md).
|
||||
</details>
|
||||
|
||||
The Store installs and runs apps with [Flatpak](https://github.com/flatpak/flatpak) (LGPL-2.1). Its sandbox goes through DroidDeck's own bubblewrap shim, which follows how Flatpak hands bwrap its environment. Chromium and Electron apps from Flathub start their browser processes through [zypak](https://github.com/refi64/zypak) by [@refi64](https://github.com/refi64) (BSD-3-Clause); its source was read to see that it always spawns them through Flatpak's spawn portal, which is why DroidDeck starts them directly without Chromium's sandbox instead.
|
||||
<details>
|
||||
<summary><b>Stores</b></summary>
|
||||
|
||||
Remote Play from a PC to the arm64 Steam client goes through a stand-in for the V4L2 decoder and the libdrm dumb buffers that Steam's `streaming_client` expects: each frame is decoded by Android's MediaCodec through the app, or by the [FFmpeg](https://ffmpeg.org) (LGPL-2.1-or-later) that ships in Steam's own runtime, into dma-heap buffers that its Vulkan renderer imports. The Qualcomm low-latency decoder settings follow [Moonlight](https://github.com/moonlight-stream/moonlight-android) (GPL-3.0).
|
||||
- Epic Games and GOG build on [Phobos](https://github.com/phobos665)'s adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl). GOG install script registry entries are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) (GPL-3.0) reads them.
|
||||
- Epic's official Linux launcher preview runs through FEX. That setup is outside Epic's listed Linux support.
|
||||
- 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`.
|
||||
- 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.
|
||||
- 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`. Minecraft's GameInput setup was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinux](https://github.com/Wyze3306/BedrockOnLinux) (MIT).
|
||||
- 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.
|
||||
|
||||
Steam's Browse buttons open a GTK 3 file chooser through PyGObject (LGPL-2.1-or-later). It runs under Steam's own `reaper` with Steam's app ID, which [gamescope](https://github.com/ValveSoftware/gamescope) (BSD-2-Clause) reads from the process tree (`GetAppIdFromReaper` in `src/Utils/Process.cpp`) to show it over Steam.
|
||||
</details>
|
||||
|
||||
Black Ops III and Dark Souls Remastered start without [umu-protonfixes](https://github.com/Open-Wine-Components/umu-protonfixes) (BSD-2-Clause), whose fixes for them (`311210.py` sets ALSA audio, `570940.py` installs VC++ 2017) fail under ARM64 Proton.
|
||||
<details>
|
||||
<summary><b>Audio, video and HUD</b></summary>
|
||||
|
||||
- Steam audio goes through [@The412Banner](https://github.com/The412Banner)'s [DirectAudio](https://github.com/The412Banner/directaudio) PulseAudio sink (LGPL-2.1-or-later), built from `tools/directaudio/sink`.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Desktop</b></summary>
|
||||
|
||||
- The KDE pacman repository snapshots [Arch Linux ARM](https://archlinuxarm.org) and installs with [pacman](https://gitlab.archlinux.org/pacman/pacman) (GPL-2.0-or-later).
|
||||
- [KWin](https://invent.kde.org/plasma/kwin) (GPL-2.0-or-later) is patched to pass on the scroll data its `wayland_backend.cpp` leaves as a TODO.
|
||||
- Read without taking code: [Qt](https://code.qt.io/cgit/qt/qtbase.git)'s `qwaylandinputdevice.cpp` and `qguiapplication.cpp`, [Konsole](https://invent.kde.org/utilities/konsole)'s `TerminalDisplay.cpp`, and [Mesa](https://gitlab.freedesktop.org/mesa/mesa)'s `u_threaded_context.c` and `zink_resource.c`.
|
||||
- The Steam Keyboard window rule follows Valve's `steamdeck-kde-presets` with [Bazzite](https://github.com/ublue-os/bazzite)'s `0001-steam-virtual-keyboard.patch`.
|
||||
- Steam's Browse buttons open a GTK 3 file chooser via PyGObject (LGPL-2.1-or-later), shown over Steam by [gamescope](https://github.com/ValveSoftware/gamescope) (BSD-2-Clause) through `GetAppIdFromReaper`.
|
||||
- The AYN Odin 2 phantom second display was confirmed by [@SapphireRhodonite](https://github.com/SapphireRhodonite)'s [WatermelonDS 0.0.5](https://github.com/SapphireRhodonite/WatermelonDS/releases/tag/0.0.5) notes and [iiSU #363](https://github.com/iisu-network/iiSU/issues/363), without taking their code.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Smart glasses</b></summary>
|
||||
|
||||
- Builds on WinNative's VITURE work. Protocol checked against [@wheaney](https://github.com/wheaney)'s [XRLinuxDriver](https://github.com/wheaney/XRLinuxDriver), [@badicsalex](https://github.com/badicsalex)'s [ar-drivers-rs](https://github.com/badicsalex/ar-drivers-rs) and [go-macos/iokit](https://pkg.go.dev/github.com/go-macos/iokit/viture). The optional VITURE SDK is not included.
|
||||
- RayNeo adapts [@informalTechCode](https://github.com/informalTechCode)'s [RayNeo-Air-Series-3DoF-Scaffold](https://github.com/informalTechCode/RayNeo-Air-Series-3DoF-Scaffold) (Apache-2.0) and references [@verncat](https://github.com/verncat)'s [RayNeo-Air-3S-Pro-OpenVR](https://github.com/verncat/RayNeo-Air-3S-Pro-OpenVR) (MIT) and [Monado](https://gitlab.freedesktop.org/monado/monado) (BSL-1.0). See [docs/third-party/rayneo](docs/third-party/rayneo/README.md).
|
||||
- XREAL 1S references XRLinuxDriver and [xrealOneDeviceKit](https://github.com/wheaney/xrealOneDeviceKit) by @wheaney, [@rohitsangwan01](https://github.com/rohitsangwan01)'s [xreal_one_driver](https://github.com/rohitsangwan01/xreal_one_driver) (MIT) and [@0xcaff](https://github.com/0xcaff)'s [xr-tools](https://github.com/0xcaff/xr-tools).
|
||||
- Rokid follows ar-drivers-rs, @badicsalex's [Void Computing write-ups](https://voidcomputing.hu/blog/worse-better-prettier/) and Monado's Rokid driver.
|
||||
- REDMAGIC display findings draw on [@mekhontsev](https://github.com/mekhontsev)'s [MagicDesk investigation](https://github.com/mekhontsev/magicdesk/blob/main/docs/xr-resolution-fix.md) and [@Coding-BR](https://github.com/Coding-BR)'s [decompiled Nubia kernel](https://github.com/Coding-BR/android_kernel_nubia_sm8850_qwjujube).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>VR, Joy-Con and hand tracking</b></summary>
|
||||
|
||||
- Joy-Con VR ports the arm model from Google's [GVR SDK for Unity](https://github.com/googlevr/gvr-unity-sdk) (Apache-2.0) and adapts the hand skeleton from Valve's [OpenVR](https://github.com/ValveSoftware/openvr) `handskeletonsimulation` sample (BSD-3-Clause), which follows Moshi Turner's work in Monado. Index offsets come from Monado's `vive_poses.c` (BSL-1.0).
|
||||
- Joy-Con research: Linux's [hid-nintendo](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-nintendo.c) by Daniel J. Ogorchock, [@dekuNukem](https://github.com/dekuNukem)'s [Nintendo_Switch_Reverse_Engineering](https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering), [SDL](https://github.com/libsdl-org/SDL) and AOSP. Checked against [ALVR](https://github.com/alvr-org/ALVR), [OpenComposite](https://gitlab.com/znixian/OpenOVR), [PSMoveSteamVRBridge](https://github.com/HipsterSloth/PSMoveSteamVRBridge), [@F8LEFT](https://github.com/F8LEFT)'s [JoyConVr](https://github.com/F8LEFT/JoyConVr), [@krnelpan1c](https://github.com/krnelpan1c)'s [Daydream-Controller-SteamVR](https://github.com/krnelpan1c/Daydream-Controller-SteamVR), [@yoyobuae](https://github.com/yoyobuae)'s [joyconvr](https://github.com/yoyobuae/joyconvr), [Moonlight](https://github.com/moonlight-stream/moonlight-android) and [Dolphin](https://github.com/dolphin-emu/dolphin). See [docs/third-party/joycon](docs/third-party/joycon/README.md).
|
||||
- Camera hand tracking runs Google's [MediaPipe](https://github.com/google-ai-edge/mediapipe) Pose Landmarker (Lite), BlazePose GHUM 3D and Hand Landmarker (Apache-2.0) on [CameraX](https://developer.android.com/jetpack/androidx/releases/camera) frames (Apache-2.0), with usage reports off. Checked against JoyConVr's camera app (MIT).
|
||||
- Tracking math: the GVR arm model's accelerometer mode, Eric Foxlin's zero velocity updates, Frosio, Pedersini and Borghese's accelerometer autocalibration, a Kalman filter (Kalman, 1960), Horn's quaternion method (1987) and the 1€ filter (Casiez, Roussel and Vogel, 2012).
|
||||
- Gestures follow [ALVR](https://github.com/alvr-org/ALVR)'s `hand_gestures.rs` (MIT) and Meta Quest's menu pinch, tuned on [HaGRID](https://github.com/hukenovs/hagrid) photos (CC BY-SA 4.0, not included).
|
||||
- The glove model follows OpenVR's render model reference, is meshed with surface nets (Gibson, 1998; Mikola Lysenko), and uses Inigo Quilez's smooth minimum, distance field ambient occlusion and polygon distance (MIT). See [docs/third-party/handtracking](docs/third-party/handtracking/README.md).
|
||||
|
||||
</details>
|
||||
|
||||
## Star history
|
||||
|
||||
<a href="https://www.star-history.com/#Droid-Deck/DroidDeck&Date">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Droid-Deck/DroidDeck&type=Date&theme=dark">
|
||||
<img alt="Star history chart" src="https://api.star-history.com/svg?repos=Droid-Deck/DroidDeck&type=Date" width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
+2
-4
@@ -134,8 +134,8 @@ android {
|
||||
applicationId "com.droiddeck.launcher"
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 28
|
||||
versionCode 16
|
||||
versionName "0.6.7"
|
||||
versionCode 17
|
||||
versionName "0.6.9"
|
||||
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
|
||||
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
|
||||
buildConfigField "int", "PR_NUMBER", "${prNumber}"
|
||||
@@ -347,8 +347,6 @@ dependencies {
|
||||
implementation 'com.github.luben:zstd-jni:1.5.7-4@aar'
|
||||
implementation 'org.apache.commons:commons-compress:1.27.1'
|
||||
implementation 'org.tukaani:xz:1.10'
|
||||
// dx (Apache-2.0) turns the Samsung performance SDK a user imports into dex on the phone (SamsungPerf).
|
||||
implementation 'com.jakewharton.android.repackaged:dalvik-dx:16.0.1'
|
||||
implementation platform('androidx.compose:compose-bom:2024.02.00')
|
||||
implementation 'androidx.compose.ui:ui'
|
||||
implementation 'androidx.compose.material3:material3'
|
||||
|
||||
@@ -69,6 +69,14 @@
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.accessibilityservice" android:resource="@xml/home_button_service" />
|
||||
</service>
|
||||
<service android:name=".session.BottomNotificationListener"
|
||||
android:label="@string/bottom_notifications_listener"
|
||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.notification.NotificationListenerService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<receiver android:name=".core.ShortcutsListingReceiver" android:exported="false"
|
||||
android:process=":shortcuts_sync">
|
||||
<intent-filter>
|
||||
@@ -105,6 +113,7 @@
|
||||
android:exported="true"
|
||||
android:screenOrientation="user"
|
||||
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density|keyboard|keyboardHidden|navigation">
|
||||
<layout android:defaultWidth="1024dp" android:defaultHeight="640dp" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
@@ -18,6 +18,7 @@ class App : Application() {
|
||||
super.onCreate()
|
||||
com.droiddeck.launcher.ui.Themes.loadGradient(this)
|
||||
com.droiddeck.launcher.ui.BuildWatermark.install(this)
|
||||
HomeApp.trackRecents(this)
|
||||
// Helper processes must not initialize the main USB provider or guest graphics context.
|
||||
val process = if (android.os.Build.VERSION.SDK_INT >= 28) Application.getProcessName()
|
||||
else (getSystemService(ACTIVITY_SERVICE) as android.app.ActivityManager)
|
||||
|
||||
@@ -46,7 +46,6 @@ import com.droiddeck.launcher.session.GameSaves
|
||||
import com.droiddeck.launcher.session.SessionLogShare
|
||||
import com.droiddeck.launcher.session.SessionPaths
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SamsungPerf
|
||||
import com.droiddeck.launcher.session.SteamRepair
|
||||
import com.droiddeck.launcher.core.CpuCores
|
||||
import com.droiddeck.launcher.core.DownloadSource
|
||||
@@ -172,8 +171,6 @@ class FrontEndActivity : ComponentActivity() {
|
||||
private var zramClient by mutableStateOf(true)
|
||||
private var vramCapMb by mutableStateOf(0)
|
||||
private var gpuClockPin by mutableStateOf(false)
|
||||
private var performanceBoost by mutableStateOf(false)
|
||||
private var samsungSdk by mutableStateOf<Boolean?>(null)
|
||||
private var prootNoSeccomp by mutableStateOf(false)
|
||||
private var prootFastPath by mutableStateOf(true)
|
||||
private var cursorComposite by mutableStateOf(false)
|
||||
@@ -257,9 +254,6 @@ class FrontEndActivity : ComponentActivity() {
|
||||
private val pickLossless = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
|
||||
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedFile(r.data)?.let { importLossless(it) }
|
||||
}
|
||||
private val pickSamsungSdk = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
|
||||
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedFile(r.data)?.let { importSamsungSdk(it) }
|
||||
}
|
||||
private val pickSaveZip = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
|
||||
val then = onSavePicked.also { onSavePicked = null } ?: return@registerForActivityResult
|
||||
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedFile(r.data)?.let(then)
|
||||
@@ -401,27 +395,6 @@ class FrontEndActivity : ComponentActivity() {
|
||||
}, "lossless-import").start()
|
||||
}
|
||||
|
||||
private fun importSamsungSdk(source: File) {
|
||||
Thread({
|
||||
val message = getString(
|
||||
when (SamsungPerf.import(this, source)) {
|
||||
SamsungPerf.ImportResult.IMPORTED -> R.string.perf_samsung_sdk_imported
|
||||
SamsungPerf.ImportResult.INVALID -> R.string.perf_samsung_sdk_invalid
|
||||
SamsungPerf.ImportResult.FAILED -> R.string.perf_samsung_sdk_failed
|
||||
},
|
||||
)
|
||||
val imported = SamsungPerf.imported(this)
|
||||
ui.post {
|
||||
samsungSdk = imported
|
||||
android.widget.Toast.makeText(this, message, android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}, "samsung-sdk-import").start()
|
||||
}
|
||||
|
||||
private fun pickSamsungSdk() {
|
||||
pickSamsungSdk.launch(InAppFilePicker.buildIntent(this, listOf("zip", "jar"), getString(R.string.perf_samsung_sdk_pick)))
|
||||
}
|
||||
|
||||
private fun importSaves(name: String, game: () -> GameSaves.Game) {
|
||||
if (SessionState.running) {
|
||||
android.widget.Toast.makeText(this, R.string.main_saves_close_session, android.widget.Toast.LENGTH_LONG).show()
|
||||
@@ -1601,9 +1574,28 @@ class FrontEndActivity : ComponentActivity() {
|
||||
startSession(Intent(this, SessionActivity::class.java).putExtra(SessionActivity.EXTRA_STEAMVR, steamVr), steamSession = true)
|
||||
}
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
override fun startActivityForResult(intent: Intent, requestCode: Int, options: Bundle?) {
|
||||
val outside = com.droiddeck.launcher.ui.DualScreenPanel.shownOn >= 0 &&
|
||||
com.droiddeck.launcher.ui.DualScreenPanel.opensOutside(packageName, intent.component?.packageName ?: intent.`package` ?: intent.resolveActivity(packageManager)?.packageName)
|
||||
if (outside) {
|
||||
com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, true)
|
||||
window.decorView.postDelayed({ if (hasWindowFocus()) com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false) }, 1500)
|
||||
}
|
||||
try {
|
||||
super.startActivityForResult(intent, requestCode, options)
|
||||
} catch (e: RuntimeException) {
|
||||
if (outside) com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
if (hasFocus) applyLauncherFullscreen()
|
||||
if (hasFocus) {
|
||||
com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false)
|
||||
applyLauncherFullscreen()
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyLauncherFullscreen() {
|
||||
@@ -1662,7 +1654,7 @@ class FrontEndActivity : ComponentActivity() {
|
||||
|
||||
override fun onPause() {
|
||||
compatLaunchVisible = false
|
||||
if (android.os.Build.VERSION.SDK_INT >= 29) com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, true)
|
||||
if (android.os.Build.VERSION.SDK_INT >= 29) com.droiddeck.launcher.ui.DualScreenPanel.ownerPaused(taskId, true)
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
@@ -1670,6 +1662,7 @@ class FrontEndActivity : ComponentActivity() {
|
||||
super.onResume()
|
||||
compatLaunchVisible = true
|
||||
com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(taskId, false)
|
||||
com.droiddeck.launcher.ui.DualScreenPanel.ownerPaused(taskId, false)
|
||||
orientation = SessionPrefs.orientation(this)
|
||||
launcherOrientation = com.droiddeck.launcher.core.AppUiPrefs.orientation(this)
|
||||
requestedOrientation = launcherOrientation
|
||||
@@ -2249,7 +2242,6 @@ class FrontEndActivity : ComponentActivity() {
|
||||
fsyncFirst = fsyncFirst,
|
||||
gamescopeRealtime = gamescopeRealtime,
|
||||
gpuClockPin = gpuClockPin,
|
||||
performanceBoost = performanceBoost, samsungSdk = samsungSdk,
|
||||
ramCapMb = ramCapMb, vramCapMb = vramCapMb, zramClient = zramClient,
|
||||
deviceRamMb = (android.app.ActivityManager.MemoryInfo()
|
||||
.also((getSystemService(ACTIVITY_SERVICE) as android.app.ActivityManager)::getMemoryInfo).totalMem / (1024 * 1024)).toInt(),
|
||||
@@ -2267,12 +2259,6 @@ class FrontEndActivity : ComponentActivity() {
|
||||
onFsyncFirst = { on -> SessionPrefs.setFsyncFirst(this, on); fsyncFirst = on },
|
||||
onGamescopeRealtime = { on -> SessionPrefs.setGamescopeRealtime(this, on); gamescopeRealtime = on },
|
||||
onGpuClockPin = { on -> SessionPrefs.setGpuClockPin(this, on); gpuClockPin = on },
|
||||
onPerformanceBoost = { on ->
|
||||
SessionPrefs.setPerformanceBoost(this, on)
|
||||
performanceBoost = on
|
||||
if (on && samsungSdk == false) pickSamsungSdk()
|
||||
},
|
||||
onImportSamsungSdk = { pickSamsungSdk() },
|
||||
onRamCapMb = { mb -> SessionPrefs.setRamCapMb(this, mb); ramCapMb = mb },
|
||||
onZramClient = { on -> SessionPrefs.setZramClient(this, on); zramClient = on },
|
||||
onVramCapMb = { mb -> SessionPrefs.setVramCapMb(this, mb); vramCapMb = mb },
|
||||
@@ -2489,8 +2475,6 @@ class FrontEndActivity : ComponentActivity() {
|
||||
zramClient = SessionPrefs.zramClient(this)
|
||||
vramCapMb = SessionPrefs.vramCapMb(this)
|
||||
gpuClockPin = SessionPrefs.gpuClockPin(this)
|
||||
performanceBoost = SessionPrefs.performanceBoost(this)
|
||||
samsungSdk = if (SamsungPerf.offered(this)) SamsungPerf.imported(this) else null
|
||||
prootNoSeccomp = SessionPrefs.prootNoSeccomp(this)
|
||||
prootFastPath = SessionPrefs.prootFastPath(this)
|
||||
cursorComposite = SessionPrefs.cursorComposite(this)
|
||||
|
||||
@@ -147,8 +147,62 @@ object HomeApp {
|
||||
.getShortcutIconDrawable(info, context.resources.displayMetrics.densityDpi)?.toBitmap(px, px)
|
||||
}.getOrNull()
|
||||
|
||||
fun trackRecents(app: android.app.Application) {
|
||||
app.registerActivityLifecycleCallbacks(object : android.app.Application.ActivityLifecycleCallbacks {
|
||||
override fun onActivityCreated(activity: android.app.Activity, savedInstanceState: android.os.Bundle?) = Unit
|
||||
override fun onActivityStarted(activity: android.app.Activity) = Unit
|
||||
override fun onActivityResumed(activity: android.app.Activity) = syncRecents(activity)
|
||||
override fun onActivityPaused(activity: android.app.Activity) { if (activity is FrontEndActivity) syncRecents(activity) }
|
||||
override fun onActivityStopped(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
|
||||
})
|
||||
}
|
||||
|
||||
private fun syncRecents(activity: android.app.Activity) =
|
||||
keepOutOfRecents(activity, activity is FrontEndActivity && !SessionState.running && isDefault(activity))
|
||||
|
||||
internal enum class RecentsStep { HIDE, SHOW, FORGET, NONE }
|
||||
|
||||
internal fun recentsStep(hidden: Boolean, owned: Boolean, excluded: Boolean): RecentsStep = when {
|
||||
hidden && !excluded -> RecentsStep.HIDE
|
||||
!hidden && owned && excluded -> RecentsStep.SHOW
|
||||
!hidden && owned -> RecentsStep.FORGET
|
||||
else -> RecentsStep.NONE
|
||||
}
|
||||
|
||||
fun keepOutOfRecents(activity: android.app.Activity, hidden: Boolean) {
|
||||
val prefs = activity.getSharedPreferences("home-recents", Context.MODE_PRIVATE)
|
||||
val owned = prefs.getStringSet("tasks", null).orEmpty()
|
||||
val id = activity.taskId.toString()
|
||||
if (!hidden && id !in owned) return
|
||||
runCatching {
|
||||
@Suppress("DEPRECATION")
|
||||
fun idOf(task: android.app.ActivityManager.AppTask) =
|
||||
if (Build.VERSION.SDK_INT >= 29) task.taskInfo.taskId else task.taskInfo.persistentId
|
||||
val tasks = activity.getSystemService(android.app.ActivityManager::class.java).appTasks
|
||||
val task = tasks.firstOrNull { idOf(it) == activity.taskId } ?: return
|
||||
val excluded = task.taskInfo.baseIntent.flags and Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS != 0
|
||||
val step = recentsStep(hidden, id in owned, excluded)
|
||||
if (step == RecentsStep.NONE) return
|
||||
if (step != RecentsStep.FORGET) task.setExcludeFromRecents(step == RecentsStep.HIDE)
|
||||
val live = tasks.map { idOf(it).toString() }.toSet()
|
||||
val next = owned.filter { it in live && it != id }.toMutableSet()
|
||||
if (step == RecentsStep.HIDE) next += id
|
||||
prefs.edit().putStringSet("tasks", next).apply()
|
||||
}
|
||||
}
|
||||
|
||||
fun startShortcut(context: Context, info: ShortcutInfo) {
|
||||
context.getSystemService(LauncherApps::class.java).startShortcut(info, null, null)
|
||||
val task = generateSequence(context) { (it as? android.content.ContextWrapper)?.baseContext }
|
||||
.filterIsInstance<android.app.Activity>().firstOrNull()?.taskId
|
||||
task?.let { com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(it, true) }
|
||||
try {
|
||||
context.getSystemService(LauncherApps::class.java).startShortcut(info, null, null)
|
||||
} catch (e: Exception) {
|
||||
task?.let { com.droiddeck.launcher.ui.DualScreenPanel.yieldTo(it, false) }
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
fun openAppInfo(context: Context, app: LaunchableApp) {
|
||||
|
||||
@@ -92,8 +92,8 @@ import com.droiddeck.launcher.input.TouchscreenGestures
|
||||
import com.droiddeck.launcher.input.ScrollTouchGestures
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.LoadingState
|
||||
import com.droiddeck.launcher.hud.FusionHudConfig
|
||||
import com.droiddeck.launcher.hud.FusionHudHost
|
||||
import com.droiddeck.launcher.hud.DroidDeckHudConfig
|
||||
import com.droiddeck.launcher.hud.DroidDeckHudHost
|
||||
import com.droiddeck.launcher.session.PerfMode
|
||||
import com.droiddeck.launcher.session.SteamRepair
|
||||
import com.droiddeck.launcher.session.GameEnvironmentStore
|
||||
@@ -120,6 +120,10 @@ import com.droiddeck.launcher.ui.LoadingOverlay
|
||||
import com.droiddeck.launcher.ui.SessionDrawer
|
||||
import com.droiddeck.launcher.ui.SessionPausedOverlay
|
||||
import com.droiddeck.launcher.ui.SecondScreenPresentation
|
||||
import com.droiddeck.launcher.ui.BottomDashboard
|
||||
import com.droiddeck.launcher.ui.BottomPage
|
||||
import com.droiddeck.launcher.ui.sessionBottomPages
|
||||
import com.droiddeck.launcher.ui.BottomPageActions
|
||||
import com.droiddeck.launcher.ui.DroidDeckTheme
|
||||
import com.droiddeck.launcher.wayland.CompositorHost
|
||||
import com.droiddeck.launcher.wayland.WaylandCompositor
|
||||
@@ -161,7 +165,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
private lateinit var surfaceView: SurfaceView
|
||||
private lateinit var sessionOverlay: ComposeView
|
||||
private lateinit var loading: LoadingState
|
||||
private lateinit var hud: FusionHudHost
|
||||
private lateinit var hud: DroidDeckHudHost
|
||||
private lateinit var memoryHud: com.droiddeck.launcher.session.MemoryHud
|
||||
private var padBridge: PadBridge? = null
|
||||
private val physicalShortcuts = PhysicalShortcutRouter()
|
||||
@@ -214,6 +218,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
private lateinit var touchscreenGestures: TouchscreenGestures
|
||||
private var gestureConfig = com.droiddeck.launcher.input.TouchGestureConfig()
|
||||
private var gestureGame: String? = null
|
||||
private var gameStarts by mutableIntStateOf(0)
|
||||
private var gestureSettingsOpen by mutableStateOf(false)
|
||||
private var steamImportAsk by mutableStateOf<com.droiddeck.launcher.session.SteamImportPrompt.Ask?>(null)
|
||||
private var steamImportAnswered: String? = null
|
||||
@@ -746,8 +751,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
val needProton = protonUser && com.droiddeck.launcher.runtime.DesktopCatalog.protonSeedNeeded(this)
|
||||
if (needRuntime || needResume || needDesktop || needProton) installThenStart(needRuntime, needDesktop, needProton, needResume)
|
||||
}
|
||||
hud = FusionHudHost(this)
|
||||
hud.onConfigChanged = { hudConfig = FusionHudConfig.load(this) }
|
||||
hud = DroidDeckHudHost(this)
|
||||
hud.onConfigChanged = { hudConfig = DroidDeckHudConfig.load(this) }
|
||||
hud.passesTouchAt = ::controlTakesTouchAt
|
||||
hud.attach(root, root.childCount)
|
||||
memoryHud = com.droiddeck.launcher.session.MemoryHud(this)
|
||||
@@ -927,7 +932,14 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nextGame != gestureGame) { gestureGame = nextGame; refreshGestureConfig() }
|
||||
if (nextGame != gestureGame) {
|
||||
if (nextGame != null) gameStarts++
|
||||
gestureGame = nextGame
|
||||
refreshGestureConfig()
|
||||
}
|
||||
if (secondScreenDisplays.isNotEmpty()) kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) {
|
||||
runCatching { com.droiddeck.launcher.session.TelemetryOutput.applyAutomatic(this@SessionActivity, nextGame) }
|
||||
}
|
||||
}
|
||||
LaunchedEffect(drawerOpen, pcKeyboardOpen, achievementsOpen, gestureSettingsOpen, pipUi, SessionState.suspended) {
|
||||
if (drawerOpen || pcKeyboardOpen || achievementsOpen || gestureSettingsOpen || pipUi || SessionState.suspended) {
|
||||
@@ -1177,11 +1189,12 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
touchAuto = getString(if (usingTouchpad()) R.string.session_touch_auto_touchpad else R.string.session_touch_auto_direct),
|
||||
fexPreset = fexPreset,
|
||||
secondScreenMode = secondScreenMode,
|
||||
dashboardAvailable = bottomPages().isNotEmpty(),
|
||||
secondScreenDisplays = secondScreenDisplays,
|
||||
selectedSecondScreenDisplay = selectedSecondScreenDisplay,
|
||||
onHud = { on -> SessionPrefs.setHudEnabled(this@SessionActivity, on); hudOn = on; hud.refresh() },
|
||||
onHudSetting = { key, value -> hudConfig = FusionHudConfig.set(this@SessionActivity, key, value); hud.applyConfig() },
|
||||
onHudReset = { hudConfig = FusionHudConfig.reset(this@SessionActivity); hud.applyConfig() },
|
||||
onHudSetting = { key, value -> hudConfig = DroidDeckHudConfig.set(this@SessionActivity, key, value); hud.applyConfig() },
|
||||
onHudReset = { hudConfig = DroidDeckHudConfig.reset(this@SessionActivity); hud.applyConfig() },
|
||||
onHudExport = { exportHudDiagnostics() },
|
||||
onUpscaler = { m ->
|
||||
SessionPrefs.setUpscaler(this@SessionActivity, m); upscaler = m
|
||||
@@ -1821,7 +1834,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
unfoldedControlsWithController = SessionPrefs.unfoldedControlsWithController(this)
|
||||
picturePosition = SessionPrefs.picturePosition(this)
|
||||
hudOn = SessionPrefs.hudEnabled(this)
|
||||
hudConfig = FusionHudConfig.load(this)
|
||||
hudConfig = DroidDeckHudConfig.load(this)
|
||||
hudColor = SessionPrefs.hudColor(this)
|
||||
hudOpacity = SessionPrefs.hudOpacity(this)
|
||||
upscaler = SessionPrefs.upscaler(this)
|
||||
@@ -2836,6 +2849,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
override fun onWheel(steps: Int) { sendSceneWheel(steps) }
|
||||
override fun onScroll(dx: Float, dy: Float) = fingerScroll(dx, dy)
|
||||
override fun onScrollEnd() = fingerScrollEnd()
|
||||
override fun onThreeFingerTap(): Boolean {
|
||||
uiHandler.post { togglePcKeyboard() }
|
||||
return true
|
||||
}
|
||||
override fun onZoom(steps: Int) {
|
||||
WaylandCompositor.nativeSendKey(KEY_LEFTCTRL, 1)
|
||||
sendSceneWheel(steps)
|
||||
@@ -3034,7 +3051,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
if (secondScreenDisplays.none { it.id == target.displayId }) return
|
||||
SessionState.secondScreenAutoOpened = true
|
||||
selectedSecondScreenDisplay = target.displayId
|
||||
selectSecondScreenMode(SecondScreenMode.opening(SessionPrefs.secondScreenPanel(this), SessionState.deckPad))
|
||||
selectSecondScreenMode(SecondScreenMode.opening(SessionPrefs.secondScreenPanel(this), SessionState.deckPad, bottomPages().isNotEmpty()))
|
||||
dualControlsProvisional = ::loading.isInitialized && loading.visible
|
||||
}
|
||||
|
||||
@@ -3042,7 +3059,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
if (!dualControlsProvisional || pipUi || !started || (::loading.isInitialized && loading.visible)) return
|
||||
dualControlsProvisional = false
|
||||
if (secondScreenMode == SecondScreenMode.NONE) return
|
||||
val wanted = SecondScreenMode.opening(SessionPrefs.secondScreenPanel(this), SessionState.deckPad)
|
||||
val wanted = SecondScreenMode.opening(SessionPrefs.secondScreenPanel(this), SessionState.deckPad, bottomPages().isNotEmpty())
|
||||
if (wanted != secondScreenMode) selectSecondScreenMode(wanted) else secondScreenPresentation?.retryTerminal()
|
||||
}
|
||||
|
||||
@@ -3112,8 +3129,85 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
menu = {
|
||||
DroidDeckTheme { SessionMenu(docked = true) }
|
||||
},
|
||||
dashboard = if (bottomPages().isEmpty()) null else ({
|
||||
DroidDeckTheme {
|
||||
BottomDashboard(
|
||||
bottomPages(), com.droiddeck.launcher.ui.SessionBottomTab.picked(SessionState.sessionId),
|
||||
gameStarts = gameStarts,
|
||||
onPage = { com.droiddeck.launcher.ui.SessionBottomTab.pick(SessionState.sessionId, it) },
|
||||
onClose = { selectSecondScreenMode(SecondScreenMode.NONE) },
|
||||
onMenu = if (dockDrawer()) ({ drawerOpen = true }) else null,
|
||||
)
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
/** Pages for the bottom-screen dashboard; the dashboard is offered only while at least one exists. */
|
||||
private fun bottomPages(): List<BottomPage> = sessionBottomPages(BottomPageActions(
|
||||
takeScreenshot = ::captureScreenshot,
|
||||
fps = { if (::hud.isInitialized) hud.liveFps else null },
|
||||
openSettings = ::openSettingsBelow,
|
||||
runningGame = { gestureGame },
|
||||
))
|
||||
|
||||
// A settings page opened on the bottom screen sits under the dashboard window, so the dashboard hides
|
||||
// until the setting is on; choosing Dashboard in the menu again shows it sooner.
|
||||
private fun openSettingsBelow(intent: android.content.Intent, done: () -> Boolean) {
|
||||
val presentation = secondScreenPresentation ?: return
|
||||
val options = android.app.ActivityOptions.makeBasic().setLaunchDisplayId(presentation.display.displayId)
|
||||
val opened = listOf(intent, android.content.Intent(android.provider.Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS)).any {
|
||||
runCatching { startActivity(android.content.Intent(it).addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK), options.toBundle()) }
|
||||
.onFailure { e -> Log.w(TAG, "could not open ${it.action} on display ${presentation.display.displayId}", e) }
|
||||
.isSuccess
|
||||
}
|
||||
if (!opened) return
|
||||
presentation.hide()
|
||||
var checks = 0
|
||||
uiHandler.postDelayed(object : Runnable {
|
||||
override fun run() {
|
||||
if (secondScreenPresentation !== presentation || presentation.isShowing) return
|
||||
if (done()) {
|
||||
presentation.show()
|
||||
return
|
||||
}
|
||||
if (++checks < SETTINGS_WATCH_CHECKS) uiHandler.postDelayed(this, SETTINGS_WATCH_MS)
|
||||
}
|
||||
}, SETTINGS_WATCH_MS)
|
||||
}
|
||||
|
||||
/** Copies the game frame (no overlay) at the size it is shown and saves it to Pictures/DroidDeck. */
|
||||
private fun captureScreenshot(onDone: (Boolean) -> Unit) {
|
||||
val width = if (::surfaceView.isInitialized) surfaceView.width else 0
|
||||
val height = if (::surfaceView.isInitialized) surfaceView.height else 0
|
||||
if (width <= 0 || height <= 0 || surfaceView.holder.surface?.isValid != true) {
|
||||
onDone(false)
|
||||
return
|
||||
}
|
||||
val bitmap = try {
|
||||
android.graphics.Bitmap.createBitmap(width, height, android.graphics.Bitmap.Config.ARGB_8888)
|
||||
} catch (_: OutOfMemoryError) {
|
||||
onDone(false)
|
||||
return
|
||||
}
|
||||
try {
|
||||
android.view.PixelCopy.request(surfaceView, bitmap, { result ->
|
||||
if (result != android.view.PixelCopy.SUCCESS) {
|
||||
bitmap.recycle()
|
||||
onDone(false)
|
||||
return@request
|
||||
}
|
||||
Thread {
|
||||
val saved = com.droiddeck.launcher.session.BottomScreenshots.save(applicationContext, bitmap)
|
||||
bitmap.recycle()
|
||||
runOnUiThread { onDone(saved) }
|
||||
}.start()
|
||||
}, uiHandler)
|
||||
} catch (_: IllegalArgumentException) {
|
||||
bitmap.recycle()
|
||||
onDone(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun tapSteamButton() {
|
||||
if (SessionState.mode == SessionService.MODE_STEAM) {
|
||||
padBridge?.applyTouch { st -> st.press(com.droiddeck.launcher.input.PadState.GUIDE, true) }
|
||||
@@ -4509,6 +4603,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
private const val TEXT_FIELD_TAP_MS = 1_000L
|
||||
private const val PAUSED_FRAME_MAX_EDGE = 1920f
|
||||
private const val PAUSED_FRAME_REDRAW_MS = 150L
|
||||
private const val SETTINGS_WATCH_MS = 1_000L
|
||||
private const val SETTINGS_WATCH_CHECKS = 600
|
||||
private const val TAG = "SessionActivity"
|
||||
private var startedScreens = 0
|
||||
@Volatile private var activeInstallWorker: Any? = null
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.droiddeck.launcher.files
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.Settings
|
||||
|
||||
object AllFilesAccess {
|
||||
fun missing(sdk: Int = Build.VERSION.SDK_INT, granted: () -> Boolean = { Environment.isExternalStorageManager() }): Boolean =
|
||||
sdk >= Build.VERSION_CODES.R && !granted()
|
||||
|
||||
fun open(context: Context) {
|
||||
val app = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + context.packageName))
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
runCatching { context.startActivity(app) }.recoverCatching {
|
||||
context.startActivity(Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,6 +498,25 @@ fun FileManagerScreen(
|
||||
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
|
||||
}
|
||||
val drives = remember(storageTick) { StorageRoots.list(context) }
|
||||
var accessDrive by remember { mutableStateOf<String?>(null) }
|
||||
fun unreadable(drive: StorageRoot) {
|
||||
if (AllFilesAccess.missing()) accessDrive = drive.label
|
||||
else Toast.makeText(context, context.getString(R.string.fm_drive_not_readable, drive.label), Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
accessDrive?.let { label ->
|
||||
OutlinedAlertDialog(
|
||||
onDismissRequest = { accessDrive = null },
|
||||
title = { Text(stringResource(R.string.fm_drive_access_title, label)) },
|
||||
text = { Text(stringResource(R.string.fm_drive_access_text)) },
|
||||
confirmButton = {
|
||||
TextButton(onClick = {
|
||||
accessDrive = null
|
||||
AllFilesAccess.open(context)
|
||||
}, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.upd_open_settings)) }
|
||||
},
|
||||
dismissButton = { TextButton(onClick = { accessDrive = null }, modifier = Modifier.focusGlide(CircleShape)) { Text(stringResource(R.string.common_cancel)) } },
|
||||
)
|
||||
}
|
||||
val linuxRoot = remember(storageTick) {
|
||||
com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(context).takeIf { File(it, "usr").isDirectory }
|
||||
}
|
||||
@@ -747,11 +766,7 @@ fun FileManagerScreen(
|
||||
if (drive.readable) {
|
||||
openDrive(drive.dir)
|
||||
} else {
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(R.string.fm_drive_not_readable, drive.label),
|
||||
Toast.LENGTH_SHORT,
|
||||
).show()
|
||||
unreadable(drive)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.focusGlide(),
|
||||
@@ -1072,7 +1087,7 @@ fun FileManagerScreen(
|
||||
add(locItem(stringResource(R.string.fm_drive_internal), Icons.Filled.Smartphone, File("/storage/emulated/0")))
|
||||
drives.filter { it.removable }.forEach { d ->
|
||||
add(RailItem(d.label, Icons.Filled.SdStorage, !showFavorites && currentRoot.absolutePath == d.dir.absolutePath) {
|
||||
showFavorites = false; if (d.readable) openDrive(d.dir)
|
||||
showFavorites = false; if (d.readable) openDrive(d.dir) else unreadable(d)
|
||||
})
|
||||
}
|
||||
linuxRoot?.let { add(locItem(stringResource(R.string.fm_drive_linux), Icons.Filled.Terminal, it)) }
|
||||
|
||||
@@ -287,14 +287,17 @@ object AddedGameArt {
|
||||
var sgdbDown = false
|
||||
var changed = false
|
||||
for (game in games) {
|
||||
if (forgetOtherAppsArt(context, game)) changed = true
|
||||
val cache = cacheDir(context, game)
|
||||
val start = missing(context, game)
|
||||
val again = refetch(cache) intersect start
|
||||
if (again.isEmpty()) File(cache, REFETCH).delete()
|
||||
val full = Slot.COVER in start
|
||||
val allowed = if (full) Slot.values().toSet() else EXTRAS
|
||||
val allowed = if (full) Slot.values().toSet() else EXTRAS + again
|
||||
var need = start intersect allowed
|
||||
if (need.isEmpty() || (need == setOf(Slot.ICON) && sgdbKey.isEmpty())) continue
|
||||
val cache = cacheDir(context, game)
|
||||
val tried = File(cache, EXTRAS_TRIED)
|
||||
if (!full && tried.isFile && tried.lastModified() >= keyChangedAt && System.currentTimeMillis() - tried.lastModified() < RETRY_AFTER_MS) continue
|
||||
if (!full && again.isEmpty() && tried.isFile && tried.lastModified() >= keyChangedAt && System.currentTimeMillis() - tried.lastModified() < RETRY_AFTER_MS) continue
|
||||
cache.mkdirs()
|
||||
if (Slot.LOGO in need && game.source != Library.ADDED && runCatching { sources.storeLogo(game) }.getOrDefault(false)) {
|
||||
changed = true
|
||||
@@ -324,11 +327,42 @@ object AddedGameArt {
|
||||
asked = false
|
||||
}
|
||||
}
|
||||
if ((missing(context, game) intersect EXTRAS).isEmpty()) tried.delete() else if (asked) tried.writeText("")
|
||||
val left = missing(context, game)
|
||||
if (again.isNotEmpty()) keepRefetch(cache, again intersect left)
|
||||
if ((left intersect EXTRAS).isEmpty()) tried.delete() else if (asked) tried.writeText("")
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
internal const val REFETCH = "refetch"
|
||||
|
||||
private fun refetch(cache: File): Set<Slot> =
|
||||
runCatching { File(cache, REFETCH).readText() }.getOrDefault("").split(',').mapNotNull { key -> Slot.values().firstOrNull { it.key == key } }.toSet()
|
||||
|
||||
private fun keepRefetch(cache: File, slots: Set<Slot>) {
|
||||
if (slots.isEmpty()) File(cache, REFETCH).delete() else File(cache, REFETCH).writeText(slots.joinToString(",") { it.key })
|
||||
}
|
||||
|
||||
internal fun forgetOtherAppsArt(context: Context, game: AddedGames.Game): Boolean {
|
||||
val cache = cacheDir(context, game)
|
||||
val recorded = SteamMatch.get(context, game.folder.path)?.takeIf { it.appId != null }
|
||||
val legacy = runCatching { File(cache, "steam-appid").readText().trim().toInt() }.getOrNull()?.takeIf { it > 0 }
|
||||
val before = recorded?.appId ?: legacy ?: return false
|
||||
val identity = runCatching { GameIdentifier.identify(game.exe) }.getOrNull()
|
||||
val now = identity?.appId
|
||||
val fromFiles = recorded?.certainty == SteamMatch.Certainty.FILES || before == GameIdentifier.SPACEWAR
|
||||
if (now == before || (now == null && !fromFiles)) return false
|
||||
SteamMatch.put(context, game.folder.path,
|
||||
if (identity != null && now != null) SteamMatch.Match(now, SteamMatch.Certainty.FILES, identity.source.name.lowercase(), System.currentTimeMillis())
|
||||
else SteamMatch.Match(null, SteamMatch.Certainty.NONE, "", 0))
|
||||
val dropped = Slot.values().filter { File(cache, SteamGridDb.cacheName(it)).delete() }.toSet()
|
||||
Slot.values().forEach { File(cache, SteamGridDb.cacheName(it) + ".src").delete() }
|
||||
listOf("sgdb-id", "steam-appid", EXTRAS_TRIED).forEach { File(cache, it).delete() }
|
||||
keepRefetch(cache, refetch(cache) + dropped)
|
||||
Log.i(TAG, "${game.name}: its files no longer name Steam app $before; its art is fetched again")
|
||||
return dropped.isNotEmpty()
|
||||
}
|
||||
|
||||
internal fun steamMatch(context: Context, game: AddedGames.Game, search: (String) -> Int?): SteamMatch.Match {
|
||||
if (game.source == Store.BATTLENET.id) {
|
||||
val id = game.storeId?.let(BattleNet::title)?.steam
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.io.File
|
||||
object GameIdentifier {
|
||||
|
||||
private const val MAX_PARENT_DEPTH = 6
|
||||
internal const val SPACEWAR = 480
|
||||
|
||||
enum class Source { STEAM_APPID_TXT, STEAM_MANIFEST_ACF, STEAM_EMU_INI, GOG_INFO, PE_VERSION, FILENAME, NONE }
|
||||
enum class Confidence { HIGH, MEDIUM, LOW }
|
||||
@@ -92,7 +93,7 @@ object GameIdentifier {
|
||||
for (candidate in arrayOf(File(dir, "steam_appid.txt"), File(dir, "steam_settings/steam_appid.txt"))) {
|
||||
val id = readSmallTextFile(candidate)?.removePrefix("\uFEFF")?.trim()
|
||||
?.takeWhile { it.isDigit() }?.toIntOrNull()
|
||||
if (id != null && id > 0) return id
|
||||
if (id != null && id > 0 && id != SPACEWAR) return id
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -111,7 +112,7 @@ object GameIdentifier {
|
||||
for (f in candidates) {
|
||||
val text = readSmallTextFile(f) ?: continue
|
||||
val id = re.find(text)?.groupValues?.getOrNull(1)?.toIntOrNull()
|
||||
if (id != null && id > 0) return id
|
||||
if (id != null && id > 0 && id != SPACEWAR) return id
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -133,7 +134,8 @@ object GameIdentifier {
|
||||
val match = manifests.firstOrNull { m ->
|
||||
val text = readSmallTextFile(m) ?: return@firstOrNull false
|
||||
val installdir = vdfValue(text, "installdir")
|
||||
gameFolder != null && installdir != null && installdir.equals(gameFolder, ignoreCase = true)
|
||||
gameFolder != null && installdir != null && installdir.equals(gameFolder, ignoreCase = true) &&
|
||||
vdfValue(text, "appid")?.toIntOrNull() != SPACEWAR
|
||||
} ?: return null
|
||||
|
||||
val text = readSmallTextFile(match) ?: return null
|
||||
|
||||
@@ -101,15 +101,22 @@ object Library {
|
||||
libraries: List<File> = steamLibraries(context).map { it.first },
|
||||
): File? {
|
||||
val ids = listOf(appId.toString(), java.lang.Integer.toString(appId.toInt())).distinct()
|
||||
return prefixRoots(context, libraries, preferredLibrary).asSequence()
|
||||
.flatMap { root -> ids.asSequence().map { id -> File(root, "steamapps/compatdata/$id/pfx") } }
|
||||
.firstOrNull { it.isDirectory }
|
||||
}
|
||||
|
||||
/** Every steamapps/compatdata folder, in the libraries [protonPrefix] searches. */
|
||||
fun compatdataDirs(context: Context, libraries: List<File> = steamLibraries(context).map { it.first }): List<File> =
|
||||
prefixRoots(context, libraries).map { File(it, "steamapps/compatdata") }.filter { it.isDirectory }
|
||||
|
||||
private fun prefixRoots(context: Context, libraries: List<File>, preferredLibrary: File? = null): List<File> {
|
||||
val secondary = libraries.drop(1).mapNotNull { runCatching { it.canonicalPath }.getOrNull() }.toSet()
|
||||
fun prefixRoot(root: File): File = if (runCatching { root.canonicalPath }.getOrNull() in secondary)
|
||||
SecondaryLibrary.privateRoot(context.filesDir, root).takeIf { File(it, "steamapps/compatdata").isDirectory } ?: root
|
||||
else root
|
||||
val roots = (listOfNotNull(preferredLibrary) + libraries).map(::prefixRoot)
|
||||
return (listOfNotNull(preferredLibrary) + libraries).map(::prefixRoot)
|
||||
.distinctBy { runCatching { it.canonicalPath }.getOrDefault(it.absolutePath) }
|
||||
return roots.asSequence()
|
||||
.flatMap { root -> ids.asSequence().map { id -> File(root, "steamapps/compatdata/$id/pfx") } }
|
||||
.firstOrNull { it.isDirectory }
|
||||
}
|
||||
|
||||
fun steamGames(
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.stores.SteamLiveShortcuts
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
object SteamLaunchOptions {
|
||||
private const val TAG = "SteamLaunchOptions"
|
||||
private val STEAM = listOf("UserLocalConfigStore", "Software", "Valve", "Steam")
|
||||
|
||||
fun current(context: Context, appId: Int): String =
|
||||
SteamLiveShortcuts.launchOptions(context, appId.toLong()) ?: steam(SessionPrefs.activeSteamRoot(context), appId).orEmpty()
|
||||
|
||||
enum class Saved { YES, NO, DESKTOP }
|
||||
|
||||
fun set(context: Context, appId: Int, options: String, shown: String): Saved {
|
||||
val value = options.trim()
|
||||
if (SessionState.running && SessionState.mode == SessionService.MODE_DESKTOP) return Saved.DESKTOP
|
||||
if (SessionState.running && SessionState.mode == SessionService.MODE_STEAM) {
|
||||
val live = SteamLiveShortcuts.launchOptions(context, appId.toLong()) ?: return Saved.NO
|
||||
if (live.trim() != shown.trim()) return Saved.NO
|
||||
return if (SteamLiveShortcuts.setLaunchOptions(context, appId.toLong(), value)) Saved.YES else Saved.NO
|
||||
}
|
||||
val home = SessionPrefs.activeSteamRoot(context)
|
||||
if (steam(home, appId).orEmpty().trim() != shown.trim()) return Saved.NO
|
||||
return if (write(home, appId, value)) Saved.YES else Saved.NO
|
||||
}
|
||||
|
||||
internal fun steam(steamHome: File, appId: Int): String? {
|
||||
val config = AddedGames.accountConfig(steamHome) ?: return null
|
||||
val text = runCatching { File(config, "localconfig.vdf").readText() }.getOrNull() ?: return null
|
||||
return launchOptions(text, appId)
|
||||
}
|
||||
|
||||
internal fun write(steamHome: File, appId: Int, options: String): Boolean {
|
||||
val config = AddedGames.accountConfig(steamHome)?.let { File(it, "localconfig.vdf") } ?: return false
|
||||
val text = runCatching { config.readText() }.getOrNull() ?: return false
|
||||
val updated = withLaunchOptions(text, appId, options) ?: return false
|
||||
if (updated == text) return true
|
||||
val staged = File(config.parentFile, config.name + ".staged")
|
||||
return try {
|
||||
staged.writeText(updated)
|
||||
if (config.readText() != text) {
|
||||
staged.delete()
|
||||
return false
|
||||
}
|
||||
Files.move(staged.toPath(), config.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE)
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
staged.delete()
|
||||
Log.w(TAG, "could not write launch options to ${config.path}", e)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
internal fun launchOptions(text: String, appId: Int): String? {
|
||||
val app = section(text, STEAM + "apps" + appId.toString()) ?: return null
|
||||
return entries(text, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals("LaunchOptions", true) }
|
||||
?.let { unescape(text.substring(it.valueStart + 1, it.end)) }
|
||||
}
|
||||
|
||||
internal fun withLaunchOptions(text: String, appId: Int, options: String): String? {
|
||||
val newline = if (text.contains("\r\n")) "\r\n" else "\n"
|
||||
var updated = text
|
||||
var path = STEAM
|
||||
for (key in listOf("apps", appId.toString())) {
|
||||
updated = withSection(updated, section(updated, path) ?: return null, key, newline) ?: return null
|
||||
path = path + key
|
||||
}
|
||||
val app = section(updated, path) ?: return null
|
||||
val value = "\"" + escape(options) + "\""
|
||||
entries(updated, app.valueStart, app.end).firstOrNull { !it.section && it.key.equals("LaunchOptions", true) }?.let {
|
||||
return updated.replaceRange(it.valueStart, it.end + 1, value)
|
||||
}
|
||||
val lineStart = closingLine(updated, app) ?: return null
|
||||
val indent = updated.substring(lineStart, app.end) + "\t"
|
||||
return updated.substring(0, lineStart) + indent + "\"LaunchOptions\"\t\t" + value + newline + updated.substring(lineStart)
|
||||
}
|
||||
|
||||
private class Entry(val key: String, val valueStart: Int, val end: Int, val section: Boolean)
|
||||
|
||||
private fun section(text: String, path: List<String>): Entry? {
|
||||
var found: Entry? = null
|
||||
for (key in path) {
|
||||
found = entries(text, found?.valueStart ?: -1, found?.end ?: text.length)
|
||||
.firstOrNull { it.section && it.key.equals(key, true) } ?: return null
|
||||
}
|
||||
return found
|
||||
}
|
||||
|
||||
private fun entries(text: String, open: Int, close: Int): List<Entry> {
|
||||
val found = ArrayList<Entry>()
|
||||
var key: String? = null
|
||||
var i = open + 1
|
||||
while (i < close) {
|
||||
when {
|
||||
text[i] == '"' -> {
|
||||
val end = stringEnd(text, i) ?: return found
|
||||
if (key == null) key = unescape(text.substring(i + 1, end)) else { found += Entry(key, i, end, false); key = null }
|
||||
i = end + 1
|
||||
}
|
||||
text[i] == '{' -> {
|
||||
val end = sectionEnd(text, i) ?: return found
|
||||
key?.let { found += Entry(it, i, end, true) }
|
||||
key = null
|
||||
i = end + 1
|
||||
}
|
||||
text.startsWith("//", i) -> i = text.indexOf('\n', i).let { if (it < 0) close else it }
|
||||
else -> i++
|
||||
}
|
||||
}
|
||||
return found
|
||||
}
|
||||
|
||||
private fun stringEnd(text: String, open: Int): Int? {
|
||||
var i = open + 1
|
||||
while (i < text.length) {
|
||||
when (text[i]) {
|
||||
'\\' -> i += 2
|
||||
'"' -> return i
|
||||
else -> i++
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun sectionEnd(text: String, open: Int): Int? {
|
||||
var depth = 0
|
||||
var i = open
|
||||
while (i < text.length) {
|
||||
when (text[i]) {
|
||||
'"' -> i = stringEnd(text, i) ?: return null
|
||||
'{' -> depth++
|
||||
'}' -> if (--depth == 0) return i
|
||||
}
|
||||
i++
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun withSection(text: String, parent: Entry, key: String, newline: String): String? {
|
||||
if (entries(text, parent.valueStart, parent.end).any { it.section && it.key.equals(key, true) }) return text
|
||||
val lineStart = closingLine(text, parent) ?: return null
|
||||
val indent = text.substring(lineStart, parent.end) + "\t"
|
||||
return text.substring(0, lineStart) + "$indent\"$key\"$newline$indent{$newline$indent}$newline" + text.substring(lineStart)
|
||||
}
|
||||
|
||||
private fun closingLine(text: String, section: Entry): Int? {
|
||||
val lineStart = text.lastIndexOf('\n', section.end - 1) + 1
|
||||
return lineStart.takeIf { lineStart > section.valueStart && text.substring(lineStart, section.end).all { it == '\t' || it == ' ' } }
|
||||
}
|
||||
|
||||
private fun escape(value: String) = value.replace("\\", "\\\\").replace("\"", "\\\"")
|
||||
|
||||
private fun unescape(value: String) = value.replace(Regex("\\\\(.)"), "$1")
|
||||
}
|
||||
@@ -45,15 +45,15 @@ object SteamMatch {
|
||||
identity?.appId?.let { id ->
|
||||
return Match(id, Certainty.FILES, identity.source.name.lowercase(), now).also { put(context, key, it) }
|
||||
}
|
||||
val known = get(context, key)
|
||||
val known = get(context, key)?.takeUnless { it.appId == GameIdentifier.SPACEWAR }
|
||||
if (known != null && known.certainty == Certainty.NAME) return known
|
||||
if (known != null && known.certainty == Certainty.NONE && now - known.checkedAt < RETRY_AFTER_MS) return known
|
||||
legacy?.takeIf { it.isFile }?.let { runCatching { it.readText().trim().toInt() }.getOrNull() }?.takeIf { it > 0 }?.let { id ->
|
||||
legacy?.takeIf { it.isFile }?.let { runCatching { it.readText().trim().toInt() }.getOrNull() }?.takeIf { it > 0 && it != GameIdentifier.SPACEWAR }?.let { id ->
|
||||
return Match(id, Certainty.NAME, "store search", now).also { put(context, key, it) }
|
||||
}
|
||||
if (search == null) return known?.takeIf { it.certainty != Certainty.FILES } ?: Match(null, Certainty.NONE, "", 0)
|
||||
val id = runCatching { search(name) }.getOrNull()
|
||||
val match = if (id != null && id > 0) Match(id, Certainty.NAME, "store search", now) else Match(null, Certainty.NONE, "", now)
|
||||
val match = if (id != null && id > 0 && id != GameIdentifier.SPACEWAR) Match(id, Certainty.NAME, "store search", now) else Match(null, Certainty.NONE, "", now)
|
||||
put(context, key, match)
|
||||
return match
|
||||
}
|
||||
|
||||
+7
-7
@@ -3,14 +3,14 @@ package com.droiddeck.launcher.hud
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
|
||||
/** FusionHUD's settings as one "key=value,…" string (FusionHudView.applyConfig), stored in SessionPrefs. */
|
||||
internal object FusionHudConfig {
|
||||
/** DroidDeck HUD's settings as one "key=value,…" string (DroidDeckHudView.applyConfig), stored in SessionPrefs. */
|
||||
internal object DroidDeckHudConfig {
|
||||
/**
|
||||
* Bannerlator's Fusion defaults (DeckOverlaySettings), with the FPS graph from the old DroidDeck HUD. The HUD starts
|
||||
* Bannerlator's defaults (DeckOverlaySettings), with the FPS graph from the old DroidDeck HUD. The HUD starts
|
||||
* locked, so like the old HUD it lets touches through until it is unlocked to move it.
|
||||
*/
|
||||
val DEFAULTS: Map<String, String> = linkedMapOf(
|
||||
"hudSize" to "minimal", "hudLocked" to "1", "hudScale" to "100", "hudOpacity" to "80", "hudColor" to "mid",
|
||||
"hudSize" to "minimal", "hudLocked" to "1", "hudScale" to "100", "hudDock" to "none", "hudOpacity" to "80", "hudColor" to "mid",
|
||||
"hudOutline" to "40", "hudOutlineAccent" to "1",
|
||||
"showFPS" to "1", "showFPSGraph" to "1", "showCPUUsage" to "1", "showCPULoad" to "1", "showGPULoad" to "1",
|
||||
"showVram" to "1", "showRAM" to "1", "showPower" to "1", "showTemp" to "1", "showBatteryTemp" to "1",
|
||||
@@ -25,7 +25,7 @@ internal object FusionHudConfig {
|
||||
|
||||
fun load(context: Context): MutableMap<String, String> {
|
||||
val values = LinkedHashMap(DEFAULTS)
|
||||
val stored = SessionPrefs.fusionHudConfig(context)
|
||||
val stored = SessionPrefs.droidDeckHudConfig(context)
|
||||
if (stored == null) {
|
||||
values["showFPS"] = flag(SessionPrefs.hudShowFps(context))
|
||||
values["showFPSGraph"] = flag(SessionPrefs.hudShowGraph(context))
|
||||
@@ -43,12 +43,12 @@ internal object FusionHudConfig {
|
||||
if (key !in DEFAULTS) return values
|
||||
values[key] = value
|
||||
TWINS[key]?.let { values[it] = value }
|
||||
SessionPrefs.setFusionHudConfig(context, encode(values))
|
||||
SessionPrefs.setDroidDeckHudConfig(context, encode(values))
|
||||
return values
|
||||
}
|
||||
|
||||
fun reset(context: Context): Map<String, String> {
|
||||
SessionPrefs.setFusionHudConfig(context, encode(DEFAULTS))
|
||||
SessionPrefs.setDroidDeckHudConfig(context, encode(DEFAULTS))
|
||||
return DEFAULTS
|
||||
}
|
||||
|
||||
+135
-14
@@ -6,26 +6,28 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.Choreographer
|
||||
import android.view.View
|
||||
import android.view.animation.PathInterpolator
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import com.droiddeck.launcher.gpu.FrameGen
|
||||
import com.droiddeck.launcher.gpu.GpuInfo
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.ui.Motion
|
||||
import com.droiddeck.launcher.wayland.WaylandCompositor
|
||||
import java.io.File
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* FusionHUD on the session screen, in place of the old text HUD: the view, the frame feed from gamescope
|
||||
* DroidDeck HUD on the session screen, in place of the old text HUD: the view, the frame feed from gamescope
|
||||
* (MangoHud's frame times) and MangoHud's readings, started with the session's first frame.
|
||||
*/
|
||||
class FusionHudHost(context: Context) {
|
||||
class DroidDeckHudHost(context: Context) {
|
||||
private val context = context.applicationContext
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val feed = GameFrameFeed(File(LinuxRuntime.rootDir(this.context), HudFrames.PATH))
|
||||
private val readings = MangoReadings(File(this.context.filesDir, "session"), LinuxRuntime.rootDir(this.context))
|
||||
private var view: FusionHudView? = null
|
||||
private var view: DroidDeckHudView? = null
|
||||
private var parent: ViewGroup? = null
|
||||
private var running = false
|
||||
private var hidden = false
|
||||
@@ -41,6 +43,9 @@ class FusionHudHost(context: Context) {
|
||||
|
||||
var onPresentingWindowChanged: (() -> Unit)? = null
|
||||
|
||||
/** The frame rate the HUD shows; null while the HUD is off and not counting frames. */
|
||||
val liveFps: Float? get() = if (polling) feed.stats.fps else null
|
||||
|
||||
/** The HUD itself changed a setting: a tap cycles the size, a long press locks it. */
|
||||
var onConfigChanged: (() -> Unit)? = null
|
||||
|
||||
@@ -49,7 +54,7 @@ class FusionHudHost(context: Context) {
|
||||
|
||||
private val listener = object : WaylandCompositor.GameListener {
|
||||
override fun onGameSurface(window: String?, gpuName: String?) {
|
||||
if (!gpuName.isNullOrBlank()) handler.post { this@FusionHudHost.gpuName = cleanGpuName(gpuName) }
|
||||
if (!gpuName.isNullOrBlank()) handler.post { this@DroidDeckHudHost.gpuName = cleanGpuName(gpuName) }
|
||||
if (window != null && window != lastWindow) {
|
||||
lastWindow = window
|
||||
handler.post { onPresentingWindowChanged?.invoke() }
|
||||
@@ -76,20 +81,26 @@ class FusionHudHost(context: Context) {
|
||||
/** Adds the HUD to [root] at [index] (above the game surface, under the session overlay). */
|
||||
fun attach(root: FrameLayout, index: Int) {
|
||||
if (view != null) return
|
||||
val hud = FusionHudView(root.context)
|
||||
val hud = DroidDeckHudView(root.context)
|
||||
hud.setFrameStats(feed.stats)
|
||||
hud.setMangoReadings(readings)
|
||||
hud.setGpuModel(cleanGpuName(GpuInfo.detect().displayName(context)))
|
||||
hud.onRefresh = Runnable { refreshLabels(hud) }
|
||||
hud.setOnMovedListener { x, y ->
|
||||
wantX = x; wantY = y
|
||||
dockEdgeFor(hud)?.let { edge -> setDock(hud, edge); return@setOnMovedListener }
|
||||
keepOnScreen(hud)
|
||||
wantX = hud.x; wantY = hud.y
|
||||
SessionPrefs.setFusionHudPosition(context, hud.x, hud.y)
|
||||
SessionPrefs.setDroidDeckHudPosition(context, hud.x, hud.y)
|
||||
}
|
||||
hud.setOnSizeCycledListener { size -> DroidDeckHudConfig.set(context, "hudSize", size); onConfigChanged?.invoke() }
|
||||
hud.setOnDockChangedListener { token -> setDock(hud, DroidDeckHudDock.from(token)) }
|
||||
hud.setOnScaledListener { percent ->
|
||||
DroidDeckHudConfig.set(context, "hudScale", percent.toString())
|
||||
onConfigChanged?.invoke()
|
||||
}
|
||||
hud.setOnSizeCycledListener { size -> FusionHudConfig.set(context, "hudSize", size); onConfigChanged?.invoke() }
|
||||
hud.setOnLockChangedListener { locked ->
|
||||
FusionHudConfig.set(context, "hudLocked", if (locked) "1" else "0")
|
||||
DroidDeckHudConfig.set(context, "hudLocked", if (locked) "1" else "0")
|
||||
onConfigChanged?.invoke()
|
||||
}
|
||||
hud.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ -> if (!hud.isDragging) keepOnScreen(hud) }
|
||||
@@ -100,14 +111,14 @@ class FusionHudHost(context: Context) {
|
||||
leftMargin = margin
|
||||
topMargin = margin
|
||||
})
|
||||
SessionPrefs.fusionHudPosition(context)?.let { (x, y) -> wantX = x; wantY = y; hud.post { keepOnScreen(hud) } }
|
||||
SessionPrefs.droidDeckHudPosition(context)?.let { (x, y) -> wantX = x; wantY = y; hud.post { keepOnScreen(hud) } }
|
||||
view = hud
|
||||
parent = root
|
||||
applyConfig()
|
||||
}
|
||||
|
||||
fun applyConfig() {
|
||||
view?.applyConfig(FusionHudConfig.encode(FusionHudConfig.load(context)))
|
||||
view?.applyConfig(DroidDeckHudConfig.encode(DroidDeckHudConfig.load(context)))
|
||||
}
|
||||
|
||||
fun refresh() {
|
||||
@@ -157,7 +168,7 @@ class FusionHudHost(context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
/** A sensor report (FusionHUD's diagnostics) in Downloads/DroidDeck; null when it can't be written. */
|
||||
/** A sensor report (DroidDeck HUD's diagnostics) in Downloads/DroidDeck; null when it can't be written. */
|
||||
fun exportDiagnostics(): File? = runCatching {
|
||||
val dir = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "DroidDeck")
|
||||
dir.mkdirs()
|
||||
@@ -180,7 +191,7 @@ class FusionHudHost(context: Context) {
|
||||
file
|
||||
}.getOrNull()
|
||||
|
||||
private fun refreshLabels(hud: FusionHudView) {
|
||||
private fun refreshLabels(hud: DroidDeckHudView) {
|
||||
if (feed.engine.isNotBlank() && !feed.steamFocused) engine = feed.engine
|
||||
hud.setEngineLabel(engine)
|
||||
if (gpuName.isNotBlank()) hud.setGpuModel(gpuName)
|
||||
@@ -203,6 +214,105 @@ class FusionHudHost(context: Context) {
|
||||
return if (stats.size > 3 && stats[3] > 1f) stats[3] else 0f
|
||||
}
|
||||
|
||||
/** The edge the HUD was dropped over, once a good part of it hangs past that edge; null when it stays. */
|
||||
private fun dockEdgeFor(v: View): DroidDeckHudDock? {
|
||||
val p = v.parent as? View ?: return null
|
||||
if (p.width <= 0 || p.height <= 0 || v.width <= 0 || v.height <= 0) return null
|
||||
val over = mapOf(
|
||||
DroidDeckHudDock.LEFT to -v.x / v.width,
|
||||
DroidDeckHudDock.RIGHT to (v.x + v.width - p.width) / v.width,
|
||||
DroidDeckHudDock.TOP to -v.y / v.height,
|
||||
DroidDeckHudDock.BOTTOM to (v.y + v.height - p.height) / v.height,
|
||||
).maxByOrNull { it.value } ?: return null
|
||||
return over.key.takeIf { over.value >= DOCK_OVERHANG }
|
||||
}
|
||||
|
||||
/** Tucks the HUD against [edge] as its FPS tab, or with [DroidDeckHudDock.NONE] brings it back out from where it was docked. */
|
||||
private fun setDock(hud: DroidDeckHudView, edge: DroidDeckHudDock) {
|
||||
if (edge == hud.dock) return
|
||||
animateDock(hud, edge) { commitDock(hud, edge) }
|
||||
}
|
||||
|
||||
private fun commitDock(hud: DroidDeckHudView, edge: DroidDeckHudDock) {
|
||||
if (edge == DroidDeckHudDock.NONE) {
|
||||
when (hud.dock) {
|
||||
DroidDeckHudDock.LEFT -> wantX = 0f
|
||||
DroidDeckHudDock.RIGHT -> wantX = Float.MAX_VALUE
|
||||
DroidDeckHudDock.TOP -> wantY = 0f
|
||||
DroidDeckHudDock.BOTTOM -> wantY = Float.MAX_VALUE
|
||||
DroidDeckHudDock.NONE -> {}
|
||||
}
|
||||
} else {
|
||||
val p = hud.parent as? View
|
||||
if (p != null) {
|
||||
wantX = wantX.coerceIn(0f, p.width.toFloat())
|
||||
wantY = wantY.coerceIn(0f, p.height.toFloat())
|
||||
}
|
||||
SessionPrefs.setDroidDeckHudPosition(context, wantX, wantY)
|
||||
}
|
||||
DroidDeckHudConfig.set(context, "hudDock", edge.token)
|
||||
applyConfig()
|
||||
hud.post { keepOnScreen(hud) }
|
||||
onConfigChanged?.invoke()
|
||||
}
|
||||
|
||||
/**
|
||||
* One shape contracts into the tab, and the tab expands back out to the HUD: the view is scaled onto the
|
||||
* tab's exact rectangle, and the layouts swap at that same size and place. Timing and curve are the
|
||||
* launcher's own ([Motion]), and off when animations are off.
|
||||
*/
|
||||
private fun animateDock(hud: DroidDeckHudView, edge: DroidDeckHudDock, commit: () -> Unit) {
|
||||
hud.animate().cancel()
|
||||
hud.scaleX = 1f; hud.scaleY = 1f; hud.alpha = 1f
|
||||
val p = hud.parent as? View
|
||||
if (Motion.scale == 0f || p == null || !hud.isLaidOut || hud.width <= 0) { commit(); return }
|
||||
if (edge != DroidDeckHudDock.NONE) {
|
||||
val (tabW, tabH) = hud.dockTabSize()
|
||||
val (tabX, tabY) = settled(p, edge, tabW, tabH)
|
||||
val sx = tabW / hud.width; val sy = tabH / hud.height
|
||||
hud.pivotX = pivotFor(hud.x, tabX, sx) - hud.x
|
||||
hud.pivotY = pivotFor(hud.y, tabY, sy) - hud.y
|
||||
hud.animate().scaleX(sx).scaleY(sy).setDuration(Motion.ms(300).toLong()).setInterpolator(EASE)
|
||||
.withEndAction {
|
||||
commit()
|
||||
hud.scaleX = 1f; hud.scaleY = 1f
|
||||
hud.x = tabX; hud.y = tabY
|
||||
hud.alpha = 0.5f
|
||||
hud.animate().alpha(1f).setDuration(Motion.ms(120).toLong()).start()
|
||||
}.start()
|
||||
} else {
|
||||
val tabX = hud.x; val tabY = hud.y
|
||||
val tabW = hud.width.toFloat(); val tabH = hud.height.toFloat()
|
||||
commit()
|
||||
val w = hud.contentWidth; val h = hud.contentHeight
|
||||
val (x, y) = settled(p, DroidDeckHudDock.NONE, w, h)
|
||||
hud.x = x; hud.y = y
|
||||
val sx = tabW / w; val sy = tabH / h
|
||||
hud.pivotX = pivotFor(x, tabX, sx) - x
|
||||
hud.pivotY = pivotFor(y, tabY, sy) - y
|
||||
hud.scaleX = sx; hud.scaleY = sy
|
||||
hud.animate().scaleX(1f).scaleY(1f).setDuration(Motion.ms(360).toLong()).setInterpolator(EASE).start()
|
||||
}
|
||||
}
|
||||
|
||||
/** The pivot, in parent coordinates, that scaling by [scale] takes a span starting at [from] onto one starting at [to]. */
|
||||
private fun pivotFor(from: Float, to: Float, scale: Float): Float =
|
||||
if (scale > 0.999f) from else (to - from * scale) / (1f - scale)
|
||||
|
||||
/** Where a [w] x [h] HUD or tab sits once [keepOnScreen] has settled it against [dock]. */
|
||||
private fun settled(p: View, dock: DroidDeckHudDock, w: Float, h: Float): Pair<Float, Float> {
|
||||
val maxX = (p.width - w).coerceAtLeast(0f); val maxY = (p.height - h).coerceAtLeast(0f)
|
||||
var x = wantX.coerceIn(0f, maxX); var y = wantY.coerceIn(0f, maxY)
|
||||
when (dock) {
|
||||
DroidDeckHudDock.LEFT -> x = 0f
|
||||
DroidDeckHudDock.RIGHT -> x = maxX
|
||||
DroidDeckHudDock.TOP -> y = 0f
|
||||
DroidDeckHudDock.BOTTOM -> y = maxY
|
||||
DroidDeckHudDock.NONE -> {}
|
||||
}
|
||||
return Pair(x, y)
|
||||
}
|
||||
|
||||
// The HUD is clamped from where the user left it (wantX/wantY, set on a drop or restore), not from where
|
||||
// it is drawn: a window that shrinks and grows back (picture-in-picture, a fold) must not leave it in the
|
||||
// corner the small window pushed it to.
|
||||
@@ -212,13 +322,24 @@ class FusionHudHost(context: Context) {
|
||||
if (wantX.isNaN()) { wantX = v.x; wantY = v.y }
|
||||
val maxX = (p.width - v.width).toFloat().coerceAtLeast(0f)
|
||||
val maxY = (p.height - v.height).toFloat().coerceAtLeast(0f)
|
||||
val x = wantX.coerceIn(0f, maxX)
|
||||
val y = wantY.coerceIn(0f, maxY)
|
||||
var x = wantX.coerceIn(0f, maxX)
|
||||
var y = wantY.coerceIn(0f, maxY)
|
||||
when (v.let { it as? DroidDeckHudView }?.dock) {
|
||||
DroidDeckHudDock.LEFT -> x = 0f
|
||||
DroidDeckHudDock.RIGHT -> x = maxX
|
||||
DroidDeckHudDock.TOP -> y = 0f
|
||||
DroidDeckHudDock.BOTTOM -> y = maxY
|
||||
else -> {}
|
||||
}
|
||||
if (v.x != x) v.x = x
|
||||
if (v.y != y) v.y = y
|
||||
}
|
||||
|
||||
companion object {
|
||||
/** How much of the HUD, as a share of its own size, must hang past a screen edge for it to dock there. */
|
||||
private const val DOCK_OVERHANG = 0.4f
|
||||
private val EASE = PathInterpolator(0.2f, 0.8f, 0.2f, 1f)
|
||||
|
||||
/** True while the HUD is on screen; DroidDeck keeps sampling VRAM for it (GpuMemComponent). */
|
||||
@Volatile @JvmStatic var showing = false
|
||||
private set
|
||||
+16
-7
@@ -14,11 +14,11 @@
|
||||
package com.droiddeck.launcher.hud
|
||||
|
||||
/**
|
||||
* Size modes for the Fusion HUD (the 4th selectable in-game overlay style). One shared color-coded
|
||||
* Size modes for the DroidDeck HUD (the 4th selectable in-game overlay style). One shared color-coded
|
||||
* visual language, four amounts of detail — see the approved mockup. The config value is the lower-case
|
||||
* token stored under the `hudSize` key; the label is the user-facing string.
|
||||
*/
|
||||
enum class FusionSize(val token: String, val label: String) {
|
||||
enum class DroidDeckHudSize(val token: String, val label: String) {
|
||||
FULL("full", "Full"),
|
||||
TILES("tiles", "Tiles"),
|
||||
PILL("pill", "Pill"),
|
||||
@@ -26,7 +26,7 @@ enum class FusionSize(val token: String, val label: String) {
|
||||
MEGA("mega", "Mega");
|
||||
|
||||
/** Next size in the tap-cycle: Full → Tiles → Pill → Minimal → Mega → Full. */
|
||||
fun next(): FusionSize {
|
||||
fun next(): DroidDeckHudSize {
|
||||
val all = values()
|
||||
return all[(ordinal + 1) % all.size]
|
||||
}
|
||||
@@ -45,7 +45,7 @@ enum class FusionSize(val token: String, val label: String) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun from(token: String?): FusionSize =
|
||||
fun from(token: String?): DroidDeckHudSize =
|
||||
values().firstOrNull { it.token.equals(token, ignoreCase = true) } ?: FULL
|
||||
|
||||
// Chip-label ids (must match the labels the config UIs build). "Clock" is a small subtle
|
||||
@@ -66,12 +66,21 @@ enum class FusionSize(val token: String, val label: String) {
|
||||
}
|
||||
}
|
||||
|
||||
/** The screen edge the HUD is tucked against, where only its FPS tab shows ([NONE] = floating free). */
|
||||
enum class DroidDeckHudDock(val token: String) {
|
||||
NONE("none"), LEFT("left"), RIGHT("right"), TOP("top"), BOTTOM("bottom");
|
||||
|
||||
companion object {
|
||||
fun from(token: String?): DroidDeckHudDock = values().firstOrNull { it.token == token } ?: NONE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Wayland HDR state the Fusion HUD shows on its own line, directly under the latency · display-server
|
||||
* line (the host sets it with [FusionHudView.setHdrState]). [NONE] = no line at all: every session whose
|
||||
* The Wayland HDR state the DroidDeck HUD shows on its own line, directly under the latency · display-server
|
||||
* line (the host sets it with [DroidDeckHudView.setHdrState]). [NONE] = no line at all: every session whose
|
||||
* HDR gate is closed (X11, SDR screens, HDR off) keeps the HUD exactly as it was.
|
||||
*/
|
||||
object FusionHdr {
|
||||
object DroidDeckHudHdr {
|
||||
const val NONE = 0
|
||||
const val ON = 1 // HDR frames on screen with HDR headroom
|
||||
const val NO_HEADROOM = 2 // HDR frames on screen, but the display gives them no headroom (5 s+)
|
||||
+127
-46
@@ -23,6 +23,7 @@ import android.graphics.Path
|
||||
import android.graphics.RectF
|
||||
import android.graphics.Typeface
|
||||
import android.text.format.DateFormat
|
||||
import android.view.GestureDetector
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.annotation.VisibleForTesting
|
||||
@@ -32,6 +33,7 @@ import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.function.BiConsumer
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.IntConsumer
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
@@ -47,7 +49,7 @@ import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
|
||||
/**
|
||||
* Fusion HUD — the 4th selectable in-game overlay. One color-coded visual language rendered at four
|
||||
* DroidDeck HUD — the 4th selectable in-game overlay. One color-coded visual language rendered at four
|
||||
* SIZE modes (Full / Tiles / Pill / Minimal / Mega), all driven by [FrameStats] (gamescope's frame times
|
||||
* read by MangoHud's rules) + a single cached [HudMetrics.Snapshot]. Pure Canvas drawing.
|
||||
*
|
||||
@@ -60,7 +62,7 @@ import kotlinx.coroutines.withTimeoutOrNull
|
||||
* drag are frozen while locked. A locked HUD lets a touch through where an on-screen control under it
|
||||
* takes it ([passesTouchAt]); everywhere else it keeps the touch, so a long press there unlocks it.
|
||||
*/
|
||||
class FusionHudView(context: Context) : View(context) {
|
||||
class DroidDeckHudView(context: Context) : View(context) {
|
||||
|
||||
private var frames: FrameStats? = null
|
||||
internal fun setFrameStats(stats: FrameStats?) { frames = stats }
|
||||
@@ -78,7 +80,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
private val density = resources.displayMetrics.density
|
||||
|
||||
// ---- Config -----------------------------------------------------------
|
||||
private var size = FusionSize.FULL
|
||||
private var size = DroidDeckHudSize.FULL
|
||||
private var scale = 1f
|
||||
private var bgOpacity = 0.8f
|
||||
private var outlineIntensity = 0.4f
|
||||
@@ -114,7 +116,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
|
||||
private var engineLabel = ""
|
||||
private var displayServer = "" // "X11" / "Wayland": which display server the game runs on
|
||||
private var hdrState = FusionHdr.NONE // Wayland HDR, on its own line under latency · display server
|
||||
private var hdrState = DroidDeckHudHdr.NONE // Wayland HDR, on its own line under latency · display server
|
||||
private var gpuModel = ""
|
||||
// The GPU name a Wayland session reports to games instead of the real adapter ("" = none). It has
|
||||
// to travel separately from gpuModel: Wayland hands the spoof to DXVK and leaves the Vulkan device
|
||||
@@ -146,7 +148,13 @@ class FusionHudView(context: Context) : View(context) {
|
||||
private var headerMark: RectF? = null
|
||||
private var chipRect: RectF? = null
|
||||
|
||||
// Every size sits in the DroidDeck mark's D: a straight left side split by the orb, round on the
|
||||
// Pushed past a screen edge, the HUD shrinks to a tab with the FPS that stays at that edge.
|
||||
var dock = DroidDeckHudDock.NONE
|
||||
private set
|
||||
private var tabRect: RectF? = null
|
||||
private val tabPath = Path()
|
||||
|
||||
// Every size sits in the DroidDeck mark's D: a straight left side, round on the
|
||||
// right. Its fixed layers (fill, header band, watermark, glowing outline) go into a bitmap, because
|
||||
// Android before 9 skips glow on shapes drawn with hardware acceleration.
|
||||
private var dPanel: RectF? = null
|
||||
@@ -213,11 +221,41 @@ class FusionHudView(context: Context) : View(context) {
|
||||
fun setOnMovedListener(l: BiConsumer<Float, Float>?) { onMovedListener = l }
|
||||
fun setOnSizeCycledListener(l: Consumer<String>?) { onSizeCycledListener = l }
|
||||
fun setOnLockChangedListener(l: Consumer<Boolean>?) { onLockChangedListener = l }
|
||||
private var onDockChangedListener: Consumer<String>? = null
|
||||
private var onScaledListener: IntConsumer? = null
|
||||
fun setOnDockChangedListener(l: Consumer<String>?) { onDockChangedListener = l }
|
||||
/** A pinch settled on this size, in percent. */
|
||||
fun setOnScaledListener(l: IntConsumer?) { onScaledListener = l }
|
||||
|
||||
private val lockController = HudLockController(context, this, object : HudLockController.Callbacks {
|
||||
override fun onTap() { cycleSize() }
|
||||
override fun onMoved(x: Float, y: Float) { onMovedListener?.accept(x, y) }
|
||||
override fun onLockChanged(locked: Boolean) { onLockChangedListener?.accept(locked) }
|
||||
override fun onPinch(factor: Float) {
|
||||
val next = (scale * factor).coerceIn(MIN_SCALE, MAX_SCALE)
|
||||
if (next == scale) return
|
||||
scale = next
|
||||
rebuildAndInvalidate()
|
||||
}
|
||||
override fun onPinchEnd() { onScaledListener?.accept((scale * 100f).roundToInt()) }
|
||||
})
|
||||
|
||||
// A docked tab always takes touches, locked or not: a tap or a pull away from the edge brings the HUD back.
|
||||
private val dockDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() {
|
||||
override fun onDown(e: MotionEvent): Boolean = true
|
||||
override fun onSingleTapUp(e: MotionEvent): Boolean { onDockChangedListener?.accept(DroidDeckHudDock.NONE.token); return true }
|
||||
override fun onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean {
|
||||
if (e1 == null) return false
|
||||
val inward = when (dock) {
|
||||
DroidDeckHudDock.LEFT -> e2.rawX - e1.rawX
|
||||
DroidDeckHudDock.RIGHT -> e1.rawX - e2.rawX
|
||||
DroidDeckHudDock.TOP -> e2.rawY - e1.rawY
|
||||
DroidDeckHudDock.BOTTOM -> e1.rawY - e2.rawY
|
||||
DroidDeckHudDock.NONE -> 0f
|
||||
}
|
||||
if (inward > 12f * density) onDockChangedListener?.accept(DroidDeckHudDock.NONE.token)
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
// ---- Public surface (symmetric with the other overlays) ---------------
|
||||
@@ -227,9 +265,9 @@ class FusionHudView(context: Context) : View(context) {
|
||||
* in place of the real model, marked so it can't be read as the chip that is really rendering. */
|
||||
fun setGpuSpoofName(s: String?) { gpuSpoofName = s ?: ""; post { rebuildAndInvalidate() } }
|
||||
fun setDisplayServer(s: String?) { displayServer = s ?: ""; post { rebuildAndInvalidate() } }
|
||||
/** [FusionHdr] code; [FusionHdr.NONE] (the default) draws no HDR line anywhere. Any thread. */
|
||||
/** [DroidDeckHudHdr] code; [DroidDeckHudHdr.NONE] (the default) draws no HDR line anywhere. Any thread. */
|
||||
fun setHdrState(state: Int) {
|
||||
val v = if (state in FusionHdr.ON..FusionHdr.NOT_ON_THIS_SCREEN) state else FusionHdr.NONE
|
||||
val v = if (state in DroidDeckHudHdr.ON..DroidDeckHudHdr.NOT_ON_THIS_SCREEN) state else DroidDeckHudHdr.NONE
|
||||
post { if (v != hdrState) { hdrState = v; rebuildAndInvalidate() } }
|
||||
}
|
||||
fun setWineVersion(s: String?) { if ((s ?: "") != wineVersion) { wineVersion = s ?: ""; post { rebuildAndInvalidate() } } }
|
||||
@@ -255,7 +293,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
if (graphRect != null) invalidate()
|
||||
}
|
||||
|
||||
/** Fusion has no orientation (tap cycles size instead); kept for a symmetric host surface. */
|
||||
/** The HUD has no orientation (tap cycles size instead); kept for a symmetric host surface. */
|
||||
fun setVertical(vertical: Boolean) { /* no-op */ }
|
||||
fun isVertical(): Boolean = false
|
||||
|
||||
@@ -269,7 +307,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
if (configString.isNullOrEmpty()) return
|
||||
val cfg = KeyValueSet(configString)
|
||||
|
||||
size = FusionSize.from(cfg.get("hudSize", "minimal"))
|
||||
size = DroidDeckHudSize.from(cfg.get("hudSize", "minimal"))
|
||||
showFPS = cfg.get("showFPS", "1") == "1"
|
||||
showEngine = cfg.get("showEngine", "1") == "1"
|
||||
showGpuModel = cfg.get("showGpuModel", "1") == "1"
|
||||
@@ -285,7 +323,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
showGraph = cfg.get("showFPSGraph", "0") == "1"
|
||||
showLow001 = cfg.get("showLow001", "1") == "1"
|
||||
fpsDecimal = cfg.get("fpsDecimal", "1") == "1"
|
||||
showClockTime = cfg.get("showClock", "1") == "1" // Fusion clock defaults ON
|
||||
showClockTime = cfg.get("showClock", "1") == "1" // the clock defaults ON
|
||||
showPerCore = cfg.get("showPerCore", "1") == "1"
|
||||
showSwap = cfg.get("showSwap", "1") == "1"
|
||||
showNet = cfg.get("showNet", "1") == "1"
|
||||
@@ -296,6 +334,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
showSession = cfg.get("showSession", "1") == "1"
|
||||
tempDisplay = HudMetrics.TempDisplay.from(cfg)
|
||||
lockController.setLocked(cfg.get("hudLocked", "1") == "1")
|
||||
dock = DroidDeckHudDock.from(cfg.get("hudDock", "none"))
|
||||
|
||||
colorIntensity = when (cfg.get("hudColor", "vivid")) {
|
||||
"soft" -> 0.72f; "mid" -> 0.88f; else -> 1.0f
|
||||
@@ -453,27 +492,27 @@ class FusionHudView(context: Context) : View(context) {
|
||||
private fun glowing(spans: List<Span>): List<Span> =
|
||||
spans.mapIndexed { i, s -> if (i == 0) Span(s.text, s.color, s.sizePx, glow = true) else s }
|
||||
|
||||
// ---- Wayland HDR state (one line of its own; nothing at all for FusionHdr.NONE) ----
|
||||
// ---- Wayland HDR state (one line of its own; nothing at all for DroidDeckHudHdr.NONE) ----
|
||||
/** The state as a full line: "HDR", "HDR (no headroom)", "HDR off", "HDR ready", "HDR tone-mapped",
|
||||
* "HDR not on this screen". */
|
||||
private fun hdrLine(px: Float): List<Span> = when (hdrState) {
|
||||
FusionHdr.ON -> listOf(Span("HDR", colHdr, px))
|
||||
FusionHdr.NO_HEADROOM -> listOf(Span("HDR", colHdr, px), Span(" (no headroom)", colBat, px))
|
||||
FusionHdr.OFF -> listOf(Span("HDR off", colDim, px))
|
||||
FusionHdr.READY -> listOf(Span("HDR ready", colDim, px))
|
||||
FusionHdr.TONEMAPPED -> listOf(Span("HDR", colDim, px), Span(" tone-mapped", colBat, px))
|
||||
FusionHdr.NOT_ON_THIS_SCREEN -> listOf(Span("HDR", colDim, px), Span(" not on this screen", colBat, px))
|
||||
DroidDeckHudHdr.ON -> listOf(Span("HDR", colHdr, px))
|
||||
DroidDeckHudHdr.NO_HEADROOM -> listOf(Span("HDR", colHdr, px), Span(" (no headroom)", colBat, px))
|
||||
DroidDeckHudHdr.OFF -> listOf(Span("HDR off", colDim, px))
|
||||
DroidDeckHudHdr.READY -> listOf(Span("HDR ready", colDim, px))
|
||||
DroidDeckHudHdr.TONEMAPPED -> listOf(Span("HDR", colDim, px), Span(" tone-mapped", colBat, px))
|
||||
DroidDeckHudHdr.NOT_ON_THIS_SCREEN -> listOf(Span("HDR", colDim, px), Span(" not on this screen", colBat, px))
|
||||
else -> emptyList()
|
||||
}
|
||||
/** The value after an "HDR" label (Full / Mega): "on", "no headroom", "off", "ready", "tone-mapped",
|
||||
* "not on this screen". */
|
||||
private fun hdrValue(px: Float): List<Span> = when (hdrState) {
|
||||
FusionHdr.ON -> listOf(Span("on", colHdr, px))
|
||||
FusionHdr.NO_HEADROOM -> listOf(Span("no headroom", colBat, px))
|
||||
FusionHdr.OFF -> listOf(Span("off", colDim, px))
|
||||
FusionHdr.READY -> listOf(Span("ready", colDim, px))
|
||||
FusionHdr.TONEMAPPED -> listOf(Span("tone-mapped", colBat, px))
|
||||
FusionHdr.NOT_ON_THIS_SCREEN -> listOf(Span("not on this screen", colBat, px))
|
||||
DroidDeckHudHdr.ON -> listOf(Span("on", colHdr, px))
|
||||
DroidDeckHudHdr.NO_HEADROOM -> listOf(Span("no headroom", colBat, px))
|
||||
DroidDeckHudHdr.OFF -> listOf(Span("off", colDim, px))
|
||||
DroidDeckHudHdr.READY -> listOf(Span("ready", colDim, px))
|
||||
DroidDeckHudHdr.TONEMAPPED -> listOf(Span("tone-mapped", colBat, px))
|
||||
DroidDeckHudHdr.NOT_ON_THIS_SCREEN -> listOf(Span("not on this screen", colBat, px))
|
||||
else -> emptyList()
|
||||
}
|
||||
private fun hdrText(): String = hdrLine(1f).joinToString("") { it.text }
|
||||
@@ -495,26 +534,65 @@ class FusionHudView(context: Context) : View(context) {
|
||||
// ---- Layout builders --------------------------------------------------
|
||||
private fun rebuild() {
|
||||
glyphs.clear(); tileRects.clear(); graphRect = null
|
||||
headerMark = null; chipRect = null; dPanel = null; dDividerTop = -1f
|
||||
headerMark = null; chipRect = null; dPanel = null; dDividerTop = -1f; tabRect = null
|
||||
val s = snap
|
||||
if (s == null) { contentW = 0f; contentH = 0f; return }
|
||||
if (dock != DroidDeckHudDock.NONE) { buildDockTab(); return }
|
||||
when (size) {
|
||||
FusionSize.FULL -> { buildFull(s); intoPanel(sp(10f), header = true) }
|
||||
FusionSize.TILES -> { buildTiles(s); intoPanel(sp(9f), header = true) }
|
||||
FusionSize.PILL -> { buildPill(s); intoPanel(sp(10f), header = false) }
|
||||
FusionSize.MINIMAL -> buildMinimal(s)
|
||||
FusionSize.MEGA -> { buildMega(s); intoPanel(sp(10f), header = true) }
|
||||
DroidDeckHudSize.FULL -> { buildFull(s); intoPanel(sp(10f), header = true) }
|
||||
DroidDeckHudSize.TILES -> { buildTiles(s); intoPanel(sp(9f), header = true) }
|
||||
DroidDeckHudSize.PILL -> { buildPill(s); intoPanel(sp(10f), header = false) }
|
||||
DroidDeckHudSize.MINIMAL -> buildMinimal(s)
|
||||
DroidDeckHudSize.MEGA -> { buildMega(s); intoPanel(sp(10f), header = true) }
|
||||
}
|
||||
}
|
||||
|
||||
/** The docked tab: the FPS alone, in a box square on the edge it sits against. */
|
||||
private fun buildDockTab() {
|
||||
val numPx = sp(20f)
|
||||
val spans = tabSpans()
|
||||
val padX = sp(9f); val padY = sp(7f)
|
||||
placeRun(padX, padY + capHeight(numPx), spans)
|
||||
val (w, h) = dockTabSize()
|
||||
contentW = w; contentH = h
|
||||
tabRect = RectF(0f, 0f, contentW, contentH)
|
||||
}
|
||||
|
||||
private fun tabSpans() = listOf(Span(one(fpsNow), colValue, sp(20f)), Span("fps", colDim, sp(8.5f)))
|
||||
|
||||
/** The size the docked tab has, so the HUD can contract to exactly that shape before the tab replaces it. */
|
||||
internal fun dockTabSize(): Pair<Float, Float> =
|
||||
Pair(runWidth(tabSpans()) + 2f * sp(9f), capHeight(sp(20f)) + 2f * sp(7f))
|
||||
|
||||
private fun drawTab(canvas: Canvas, rect: RectF) {
|
||||
val r = sp(8f); val stroke = max(outlineWidth(), sp(1.5f)); val h = stroke / 2f
|
||||
val round = floatArrayOf(r, r, r, r, r, r, r, r)
|
||||
val edge = when (dock) {
|
||||
DroidDeckHudDock.LEFT -> intArrayOf(0, 3)
|
||||
DroidDeckHudDock.RIGHT -> intArrayOf(1, 2)
|
||||
DroidDeckHudDock.TOP -> intArrayOf(0, 1)
|
||||
DroidDeckHudDock.BOTTOM -> intArrayOf(2, 3)
|
||||
DroidDeckHudDock.NONE -> intArrayOf()
|
||||
}
|
||||
for (corner in edge) { round[corner * 2] = 0f; round[corner * 2 + 1] = 0f }
|
||||
tabPath.rewind()
|
||||
tabPath.addRoundRect(rect.left + h, rect.top + h, rect.right - h, rect.bottom - h, round, Path.Direction.CW)
|
||||
headerPaint.shader = null
|
||||
headerPaint.color = withAlpha(panelColor(), max(Color.alpha(panelColor()), 200))
|
||||
canvas.drawPath(tabPath, headerPaint)
|
||||
strokePaint.strokeWidth = stroke
|
||||
strokePaint.color = outlineColor()
|
||||
canvas.drawPath(tabPath, strokePaint)
|
||||
}
|
||||
|
||||
// ---- DroidDeck panel, header and chip -----------------------------------
|
||||
/** The clock sits in the header on every size but the Pill, which keeps it under the FPS. */
|
||||
private fun footerClock(): Boolean = showClockTime && size == FusionSize.PILL
|
||||
private fun footerClock(): Boolean = showClockTime && size == DroidDeckHudSize.PILL
|
||||
|
||||
private fun measureSans(text: String, sizePx: Float): Float { wordmarkPaint.textSize = sizePx; return wordmarkPaint.measureText(text) }
|
||||
|
||||
private fun panelInset() = sp(8f) // room for the glow around the panel
|
||||
private fun panelLeft() = sp(13f) // the orb and its glow stick out of the left side
|
||||
private fun panelLeft() = sp(13f) // the outline's glow sticks out of the left side
|
||||
private fun contentLeft() = panelLeft() + sp(16f)
|
||||
|
||||
/** The DroidDeck mark, "DroidDeck" and the clock across the top, starting on [left], with the same
|
||||
@@ -672,7 +750,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
rows.add(HudRow(Span("GPU", colGpu, rowPx), gpuModelSpans(rowPx, colValue)))
|
||||
if (displayServer.isNotBlank())
|
||||
rows.add(HudRow(Span("DISP", colDisp, rowPx), listOf(Span(displayServer, colValue, rowPx))))
|
||||
if (hdrState != FusionHdr.NONE)
|
||||
if (hdrState != DroidDeckHudHdr.NONE)
|
||||
rows.add(HudRow(Span("HDR", colHdr, rowPx), hdrValue(rowPx)))
|
||||
if (showGPU) {
|
||||
val v = ArrayList<Span>()
|
||||
@@ -784,7 +862,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
dxVersion().ifBlank { null }, false))
|
||||
if (displayServer.isNotBlank())
|
||||
tiles.add(Tile("DISPLAY", colDisp, listOf(Span(displayServer, colValue, valPx)),
|
||||
if (hdrState != FusionHdr.NONE) hdrText() else null, false))
|
||||
if (hdrState != DroidDeckHudHdr.NONE) hdrText() else null, false))
|
||||
if (showGpuModel && gpuNameText().isNotBlank())
|
||||
tiles.add(Tile("GPU", colGpu, gpuModelSpans(valPx, colValue), null, true))
|
||||
if (showBattery || showPower || showBatteryTemp) {
|
||||
@@ -893,7 +971,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
}
|
||||
// Wayland HDR state on its OWN line directly under the latency · display-server line (it ran off
|
||||
// the capsule's right edge as "40.3ms · Wayland · HDR (no headroom)"). Only in HDR sessions.
|
||||
if (hdrState != FusionHdr.NONE) stack.add(hdrLine(stkPx))
|
||||
if (hdrState != DroidDeckHudHdr.NONE) stack.add(hdrLine(stkPx))
|
||||
|
||||
var statsW = 0f
|
||||
for (l in stack) statsW = max(statsW, runWidth(l))
|
||||
@@ -963,7 +1041,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
}
|
||||
val footerLabel = listOf(if (showEngine) engineLabel else "", displayServer)
|
||||
.filter { it.isNotBlank() }.joinToString(" · ")
|
||||
val hdr = if (hdrState != FusionHdr.NONE) hdrLine(footPx) else emptyList()
|
||||
val hdr = if (hdrState != DroidDeckHudHdr.NONE) hdrLine(footPx) else emptyList()
|
||||
|
||||
val (headerBottom, headerRight) = addPanelHeader(left, inner)
|
||||
val x = headerRight
|
||||
@@ -1143,7 +1221,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
val band = ArrayList<List<Span>>()
|
||||
if (showResolution) band.add(listOf(Span("RES ", colDim, bandPx), Span(resolutionString(), colValue, bandPx)))
|
||||
if (displayServer.isNotBlank()) band.add(listOf(Span("DISP ", colDim, bandPx), Span(displayServer, colDisp, bandPx)))
|
||||
if (hdrState != FusionHdr.NONE) band.add(listOf(Span("HDR ", colDim, bandPx)) + hdrValue(bandPx))
|
||||
if (hdrState != DroidDeckHudHdr.NONE) band.add(listOf(Span("HDR ", colDim, bandPx)) + hdrValue(bandPx))
|
||||
if (showProton && wineVersion.isNotBlank()) band.add(listOf(Span(wineVersion, colVram, bandPx)))
|
||||
if (showSession) band.add(listOf(Span("elapsed ", colDim, bandPx), Span(elapsedString(), colValue, bandPx)))
|
||||
if (band.isNotEmpty()) {
|
||||
@@ -1204,6 +1282,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
}
|
||||
|
||||
chipRect?.let { drawChip(canvas, it) }
|
||||
tabRect?.let { drawTab(canvas, it) }
|
||||
|
||||
// Text
|
||||
for (g in glyphs) {
|
||||
@@ -1253,19 +1332,17 @@ class FusionHudView(context: Context) : View(context) {
|
||||
Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color))
|
||||
|
||||
/** The D: straight left side with small corners, round on the right with radius [rad] (a half circle
|
||||
* when it is half the height). [split] > 0 leaves that much open above and below the middle of the
|
||||
* left side, where the orb sits. */
|
||||
private fun dShape(l: Float, t: Float, r: Float, b: Float, rad: Float, corner: Float, split: Float): Path {
|
||||
val cy = (t + b) / 2f
|
||||
* when it is half the height). */
|
||||
private fun dShape(l: Float, t: Float, r: Float, b: Float, rad: Float, corner: Float): Path {
|
||||
return Path().apply {
|
||||
if (split > 0f) moveTo(l, cy + split) else moveTo(l, t + corner)
|
||||
moveTo(l, t + corner)
|
||||
lineTo(l, b - corner); quadTo(l, b, l + corner, b)
|
||||
lineTo(r - rad, b)
|
||||
arcTo(r - 2f * rad, b - 2f * rad, r, b, 90f, -90f, false)
|
||||
lineTo(r, t + rad)
|
||||
arcTo(r - 2f * rad, t, r, t + 2f * rad, 0f, -90f, false)
|
||||
lineTo(l + corner, t); quadTo(l, t, l, t + corner)
|
||||
if (split > 0f) lineTo(l, cy - split) else close()
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1285,7 +1362,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
val bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
|
||||
val c = Canvas(bmp)
|
||||
val corner = sp(6f)
|
||||
val body = dShape(panel.left, panel.top, panel.right, panel.bottom, dRadius, corner, 0f)
|
||||
val body = dShape(panel.left, panel.top, panel.right, panel.bottom, dRadius, corner)
|
||||
bgPaint.color = panelColor()
|
||||
c.drawPath(body, bgPaint)
|
||||
c.save()
|
||||
@@ -1307,7 +1384,7 @@ class FusionHudView(context: Context) : View(context) {
|
||||
c.restore()
|
||||
if (stroke > 0f) {
|
||||
val h = stroke / 2f
|
||||
val outline = dShape(panel.left + h, panel.top + h, panel.right - h, panel.bottom - h, dRadius - h, corner, sp(9f))
|
||||
val outline = dShape(panel.left + h, panel.top + h, panel.right - h, panel.bottom - h, dRadius - h, corner)
|
||||
val blur = BlurMaskFilter((sp(3.2f) - 0.5f).coerceAtLeast(0.5f) / 0.57735f, BlurMaskFilter.Blur.NORMAL)
|
||||
glowPaint.strokeWidth = stroke
|
||||
// Two blurred passes under the sharp one, as the 4-in-1 preview's neon.
|
||||
@@ -1315,8 +1392,6 @@ class FusionHudView(context: Context) : View(context) {
|
||||
glowPaint.maskFilter = if (pass < 2) blur else null
|
||||
glowPaint.style = Paint.Style.STROKE; glowPaint.color = outlineColor()
|
||||
c.drawPath(outline, glowPaint)
|
||||
glowPaint.style = Paint.Style.FILL; glowPaint.color = accent
|
||||
c.drawCircle(panel.left + h, panel.centerY(), sp(5.5f), glowPaint)
|
||||
}
|
||||
glowPaint.maskFilter = null
|
||||
}
|
||||
@@ -1358,15 +1433,21 @@ class FusionHudView(context: Context) : View(context) {
|
||||
|
||||
// Declining the down event hands the whole gesture to the views under the HUD.
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
if (dock != DroidDeckHudDock.NONE) return dockDetector.onTouchEvent(event)
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN && lockController.isLocked() &&
|
||||
passesTouchAt?.invoke(event.rawX, event.rawY) == true) return false
|
||||
return lockController.onTouchEvent(event)
|
||||
}
|
||||
|
||||
internal val contentWidth: Float get() = contentW
|
||||
internal val contentHeight: Float get() = contentH
|
||||
|
||||
internal val isDragging: Boolean get() = lockController.isDragging()
|
||||
|
||||
private companion object {
|
||||
const val REFRESH_MS = 500L
|
||||
const val MIN_SCALE = 0.5f
|
||||
const val MAX_SCALE = 2f
|
||||
const val GRAPH_CLIP_MS = 49.9f
|
||||
|
||||
fun parseIntOr(s: String?, d: Int): Int = try { s?.trim()?.toInt() ?: d } catch (e: Exception) { d }
|
||||
@@ -8,7 +8,7 @@ import kotlin.math.roundToInt
|
||||
* overlay.cpp update_hud_info_with_frametime and hud_elements.cpp fps() / frame_timing(). The FPS is the
|
||||
* frames counted over a sampling period of at least 500 ms, the frame time next to it is 1000 / FPS, and
|
||||
* the graph holds the last 200 frame times (zeros until filled) on a fixed 0-50 ms scale, min and max
|
||||
* taken over those 200. Average and lows are FusionHUD's own readouts.
|
||||
* taken over those 200. Average and lows are DroidDeck HUD's own readouts.
|
||||
*/
|
||||
internal class FrameStats {
|
||||
private val graph = FloatArray(GRAPH_FRAMES)
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.graphics.RectF;
|
||||
import android.os.SystemClock;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ScaleGestureDetector;
|
||||
import android.view.View;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
@@ -29,17 +30,17 @@ import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Shared touch + lock behaviour for every in-game performance HUD (classic FrameRating(+Horizontal),
|
||||
* GameHub PerfHudView, GameNative PerformanceHudView, and the Fusion HUD). One place so the four
|
||||
* GameHub PerfHudView, GameNative PerformanceHudView, and the DroidDeck HUD). One place so the four
|
||||
* overlays can't drift:
|
||||
*
|
||||
* <ul>
|
||||
* <li><b>tap</b> → {@link Callbacks#onTap()} (orientation-toggle for the first three; size-cycle for
|
||||
* Fusion) — a no-op that only re-flashes the lock badge while locked.</li>
|
||||
* the DroidDeck HUD) — a no-op that only re-flashes the lock badge while locked.</li>
|
||||
* <li><b>drag</b> → moves the host view and, on release, {@link Callbacks#onMoved} to persist the
|
||||
* position — disabled (frozen) while locked.</li>
|
||||
* <li><b>long-press</b> → toggles {@code hudLocked}, persisted via {@link Callbacks#onLockChanged}
|
||||
* and kept in sync with the "Lock in place" menu chip. Works locked or unlocked (so a long-press
|
||||
* always unlocks); a locked {@code FusionHudView} passes touches on only over on-screen controls.</li>
|
||||
* always unlocks); a locked {@code DroidDeckHudView} passes touches on only over on-screen controls.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>On every lock/unlock (and on a blocked gesture while locked) a small padlock badge fades in →
|
||||
@@ -52,12 +53,16 @@ import java.util.function.Consumer;
|
||||
public class HudLockController {
|
||||
|
||||
public interface Callbacks {
|
||||
/** Unlocked single tap: orientation-toggle (classic/gamehub/gamenative) or size-cycle (fusion). */
|
||||
/** Unlocked single tap: orientation-toggle (classic/gamehub/gamenative) or size-cycle (DroidDeck HUD). */
|
||||
void onTap();
|
||||
/** Drag released (unlocked): persist the new (x, y). */
|
||||
void onMoved(float x, float y);
|
||||
/** Lock toggled by long-press: persist {@code hudLocked} + sync the menu chip. */
|
||||
void onLockChanged(boolean locked);
|
||||
/** Two-finger pinch (unlocked): the change since the previous event, above 1 when the fingers spread. */
|
||||
default void onPinch(float factor) {}
|
||||
/** The fingers came off a pinch: persist the new size. */
|
||||
default void onPinchEnd() {}
|
||||
}
|
||||
|
||||
// Fade timing (ms): in → hold → out. Lock/unlock hold ~1.5 s; a blocked-gesture re-flash is shorter.
|
||||
@@ -70,12 +75,15 @@ public class HudLockController {
|
||||
private final View view;
|
||||
private final Callbacks cb;
|
||||
private final GestureDetector detector;
|
||||
private final ScaleGestureDetector scaleDetector;
|
||||
|
||||
private boolean locked = false;
|
||||
|
||||
// Drag state
|
||||
private float downRawX, downRawY, startX, startY;
|
||||
private boolean dragging = false;
|
||||
// A pinch ends the gesture's drag and tap: the finger left down after it must not move the HUD.
|
||||
private boolean pinched = false;
|
||||
|
||||
// Fade state
|
||||
private long fadeStart = 0;
|
||||
@@ -90,6 +98,8 @@ public class HudLockController {
|
||||
this.cb = cb;
|
||||
this.detector = new GestureDetector(context, new Listener());
|
||||
this.detector.setIsLongpressEnabled(true);
|
||||
this.scaleDetector = new ScaleGestureDetector(context, new PinchListener());
|
||||
this.scaleDetector.setQuickScaleEnabled(false);
|
||||
iconFill.setStyle(Paint.Style.FILL);
|
||||
iconStroke.setStyle(Paint.Style.STROKE);
|
||||
iconStroke.setStrokeCap(Paint.Cap.ROUND);
|
||||
@@ -105,6 +115,7 @@ public class HudLockController {
|
||||
|
||||
/** Feed from the host view's onTouchEvent. Always consumes (mirrors the legacy manual handlers). */
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
scaleDetector.onTouchEvent(event);
|
||||
detector.onTouchEvent(event);
|
||||
int action = event.getActionMasked();
|
||||
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
|
||||
@@ -122,6 +133,7 @@ public class HudLockController {
|
||||
startX = view.getX();
|
||||
startY = view.getY();
|
||||
dragging = false;
|
||||
pinched = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -135,6 +147,7 @@ public class HudLockController {
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapUp(MotionEvent e) {
|
||||
if (pinched) return true;
|
||||
if (locked) {
|
||||
flash(true, HOLD_REFLASH_MS); // intentionally locked — remind the user
|
||||
} else {
|
||||
@@ -145,6 +158,7 @@ public class HudLockController {
|
||||
|
||||
@Override
|
||||
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
||||
if (pinched) return true;
|
||||
if (locked) {
|
||||
if (!dragging) flash(true, HOLD_REFLASH_MS);
|
||||
dragging = true; // mark so the blocked drag doesn't fall through to a tap
|
||||
@@ -157,6 +171,27 @@ public class HudLockController {
|
||||
}
|
||||
}
|
||||
|
||||
private final class PinchListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
|
||||
@Override
|
||||
public boolean onScaleBegin(ScaleGestureDetector d) {
|
||||
if (locked) return false;
|
||||
pinched = true;
|
||||
dragging = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScale(ScaleGestureDetector d) {
|
||||
cb.onPinch(d.getScaleFactor());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScaleEnd(ScaleGestureDetector d) {
|
||||
cb.onPinchEnd();
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Fade badge -------------------------------------------------------
|
||||
private void flash(boolean showLocked, long hold) {
|
||||
fadeShowLocked = showLocked;
|
||||
|
||||
@@ -1006,7 +1006,7 @@ public class HudMetrics {
|
||||
// =======================================================================
|
||||
|
||||
/**
|
||||
* Immutable point-in-time reading of every metric the Fusion HUD draws. Collected in one pass by
|
||||
* Immutable point-in-time reading of every metric the DroidDeck HUD draws. Collected in one pass by
|
||||
* {@link #snapshot()} so the view never touches sysfs / BatteryManager during draw (the user's
|
||||
* explicit ask: one collection pass, cached, so gameplay isn't strained). All numeric fields are
|
||||
* raw (nullable when unreadable); the view formats + colours them.
|
||||
@@ -1268,7 +1268,7 @@ public class HudMetrics {
|
||||
Snapshot s = snapshot();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("DroidDeck FusionHUD diagnostics\n");
|
||||
sb.append("DroidDeck HUD diagnostics\n");
|
||||
sb.append("Generated: ")
|
||||
.append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date())).append('\n');
|
||||
sb.append("Device: ").append(Build.MANUFACTURER).append(' ').append(Build.MODEL).append('\n');
|
||||
|
||||
@@ -11,6 +11,7 @@ class PointerGestures {
|
||||
fun onScroll(dx: Float, dy: Float) {}
|
||||
fun onScrollEnd() {}
|
||||
fun onZoom(steps: Int) {}
|
||||
fun onThreeFingerTap(): Boolean = false
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -9,11 +9,22 @@ enum class SecondScreenMode(val id: String, @StringRes val label: Int) {
|
||||
NONE("none", R.string.second_mode_none),
|
||||
KEYBOARD_TRACKPAD("keyboard-trackpad", R.string.second_mode_keyboard_trackpad),
|
||||
TERMINAL("terminal", R.string.second_mode_terminal),
|
||||
DECK_CONTROLS("deck-controls", R.string.second_mode_deck_controls);
|
||||
DECK_CONTROLS("deck-controls", R.string.second_mode_deck_controls),
|
||||
DASHBOARD("dashboard", R.string.second_mode_dashboard);
|
||||
|
||||
companion object {
|
||||
fun opening(remembered: String?, deckPad: Boolean): SecondScreenMode =
|
||||
entries.firstOrNull { it != NONE && it.id == remembered && (it != DECK_CONTROLS || deckPad) } ?: if (deckPad) DECK_CONTROLS else KEYBOARD_TRACKPAD
|
||||
fun opening(remembered: String?, deckPad: Boolean, dashboard: Boolean = false): SecondScreenMode {
|
||||
entries.firstOrNull {
|
||||
it != NONE && it.id == remembered && (it != DECK_CONTROLS || deckPad) && (it != DASHBOARD || dashboard)
|
||||
}?.let { return it }
|
||||
// No pick yet: the dashboard. A pick that can't open right now keeps the old fallback.
|
||||
val picked = entries.any { it != NONE && it.id == remembered }
|
||||
return when {
|
||||
dashboard && !picked -> DASHBOARD
|
||||
deckPad -> DECK_CONTROLS
|
||||
else -> KEYBOARD_TRACKPAD
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,8 @@ class TouchpadGestures(
|
||||
}
|
||||
if (desktop && scrolled && event.pointerCount == 2) listener.onScrollEnd()
|
||||
if (fingers >= 3) {
|
||||
if (event.pointerCount == 2 && secondWasTap && !scrolled && event.eventTime - downAt < TouchTiming.TAP_MS * 2)
|
||||
if (event.pointerCount == 2 && secondWasTap && !scrolled && event.eventTime - downAt < TouchTiming.TAP_MS * 2 &&
|
||||
!listener.onThreeFingerTap())
|
||||
click(PointerGestures.BTN_MIDDLE)
|
||||
if (event.pointerCount == 2) secondWasTap = false
|
||||
} else if (twoFingers && secondWasTap && event.eventTime - secondDownAt < TouchTiming.TAP_MS && !scrolled) {
|
||||
|
||||
@@ -75,7 +75,10 @@ object BwrapSpawner {
|
||||
}
|
||||
}
|
||||
|
||||
class Plan(val root: File, val binds: List<Bind>, val cwd: String, val argv: List<String>, val env: Map<String, String>)
|
||||
class Plan(
|
||||
val root: File, val binds: List<Bind>, val cwd: String, val argv: List<String>, val env: Map<String, String>,
|
||||
val envTool: String = "/usr/bin/env",
|
||||
)
|
||||
|
||||
data class Bind(val host: String, val guest: String) {
|
||||
val spec: String get() = if (host == guest) host else "$host:$guest"
|
||||
@@ -179,12 +182,13 @@ object BwrapSpawner {
|
||||
val argv = request.getJSONArray("argv").let { a -> (0 until a.length()).map { a.getString(it) } }
|
||||
val env = LinkedHashMap<String, String>()
|
||||
request.optJSONObject("env")?.let { e -> e.keys().forEach { k -> env[k] = e.getString(k) } }
|
||||
if (binds.any { it.guest == "/dev" }) gpu(rootfs, root, env)?.forEach { addBind(it) }
|
||||
val envTool = request.optString("envTool").takeIf { it.startsWith("/") }
|
||||
if (envTool == null && binds.any { it.guest == "/dev" }) gpu(rootfs, root, env)?.forEach { addBind(it) }
|
||||
val libc = listOf("/usr/lib/aarch64-linux-gnu/libc.so.6", "/lib/aarch64-linux-gnu/libc.so.6").map { hostPath(binds, root.path, it) }
|
||||
if (preloadFits(rootfs, libc.firstOrNull { File(it).isFile } ?: libc.first())) preload(session, rootfs, env).forEach { addBind(it) }
|
||||
if (envTool == null && preloadFits(rootfs, libc.firstOrNull { File(it).isFile } ?: libc.first())) preload(session, rootfs, env).forEach { addBind(it) }
|
||||
zypakShims(binds, root, dir).forEach { addBind(it) }
|
||||
browserSandboxes(env)
|
||||
return Plan(root, binds, request.optString("cwd", "/").ifEmpty { "/" }, argv, env)
|
||||
return Plan(root, binds, request.optString("cwd", "/").ifEmpty { "/" }, argv, env, envTool ?: "/usr/bin/env")
|
||||
}
|
||||
|
||||
private const val GPU_DIR = "/run/droiddeck-gpu"
|
||||
@@ -325,7 +329,7 @@ object BwrapSpawner {
|
||||
val verbose = plan.env["DROIDDECK_PROOT_VERBOSE"]?.toIntOrNull()
|
||||
if (verbose != null) { cmd.add(1, "-v"); cmd.add(2, verbose.toString()) }
|
||||
plan.binds.forEach { cmd.add("-b"); cmd.add(it.spec) }
|
||||
cmd.add("/usr/bin/env")
|
||||
cmd.add(plan.envTool)
|
||||
cmd.add("-i")
|
||||
plan.env.forEach { (k, v) -> cmd.add("$k=$v") }
|
||||
cmd.addAll(plan.argv)
|
||||
|
||||
@@ -19,7 +19,7 @@ object FlatpakManager {
|
||||
@Volatile var busy: String? = null
|
||||
private set
|
||||
|
||||
class App(val id: String, val name: String, val icon: File?, val branch: String, val summary: String?)
|
||||
class App(val id: String, val name: String, val icon: File?, val branch: String, val summary: String?, val arch: String = "aarch64")
|
||||
|
||||
fun ready(context: Context): Boolean {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
@@ -33,24 +33,33 @@ object FlatpakManager {
|
||||
else -> "aarch64"
|
||||
}
|
||||
|
||||
internal fun arches(native: String = arch()): List<String> = if (native == "aarch64") listOf("aarch64", "x86_64") else listOf(native)
|
||||
|
||||
internal fun installedBranch(appDir: File, native: String = arch()): Pair<String, File>? =
|
||||
arches(native).firstNotNullOfOrNull { arch ->
|
||||
File(appDir, arch).listFiles()?.firstOrNull { File(it, "active").exists() }?.let { arch to it }
|
||||
}
|
||||
|
||||
fun foreign(app: App, native: String = arch()): Boolean = app.arch != native
|
||||
|
||||
fun launchArgs(app: App, native: String = arch()): List<String> = if (foreign(app, native)) listOf("--arch=${app.arch}", app.id) else listOf(app.id)
|
||||
|
||||
fun installedApps(context: Context): List<App> {
|
||||
val apps = File(LinuxRuntime.rootDir(context), "$USER_DIR/app")
|
||||
val arch = arch()
|
||||
return apps.listFiles()?.mapNotNull { dir ->
|
||||
val id = dir.name
|
||||
val archDir = File(dir, arch)
|
||||
val branch = archDir.listFiles()?.firstOrNull { File(it, "active").exists() } ?: return@mapNotNull null
|
||||
val (arch, branch) = installedBranch(dir) ?: return@mapNotNull null
|
||||
val active = File(branch, "active")
|
||||
val export = File(active, "export/share")
|
||||
val desktop = FileUtils.readString(File(export, "applications/$id.desktop"))
|
||||
val name = desktop?.let { entry(it, "Name") } ?: id.substringAfterLast('.')
|
||||
val summary = desktop?.let { entry(it, "Comment") }
|
||||
App(id, name, icon(export, id), branch.name, summary)
|
||||
App(id, name, icon(export, id), branch.name, summary, arch)
|
||||
}?.sortedBy { it.name.lowercase() } ?: emptyList()
|
||||
}
|
||||
|
||||
fun isInstalled(context: Context, id: String): Boolean =
|
||||
File(LinuxRuntime.rootDir(context), "$USER_DIR/app/$id/${arch()}").listFiles()?.any { File(it, "active").exists() } == true
|
||||
installedBranch(File(LinuxRuntime.rootDir(context), "$USER_DIR/app/$id")) != null
|
||||
|
||||
private fun entry(desktop: String, key: String): String? {
|
||||
var inMain = false
|
||||
@@ -117,7 +126,11 @@ object FlatpakManager {
|
||||
when (o.optString("e")) {
|
||||
"op" -> { step = stage(context, o); onProgress(step, overall(o, 0)) }
|
||||
"progress" -> onProgress(step, overall(o, o.optInt("percent")))
|
||||
"error" -> { error = o.optString("message"); Log.w(TAG, "$verb $id: $error") }
|
||||
"error" -> {
|
||||
error = if (o.optString("code") == "arch") context.getString(R.string.flatpakmgr_wrong_arch, o.optString("id"), o.optString("arch"))
|
||||
else o.optString("message")
|
||||
Log.w(TAG, "$verb $id: ${o.optString("message")}")
|
||||
}
|
||||
"warning" -> Log.w(TAG, "$verb $id: ${o.optString("message")}")
|
||||
"done" -> onDone(o)
|
||||
}
|
||||
|
||||
@@ -97,7 +97,8 @@ object UserApps {
|
||||
App(
|
||||
"flatpak:${app.id}", Kind.FLATPAK, readName(custom) ?: app.name,
|
||||
File(custom, "icon.png").takeIf { it.isFile } ?: app.icon ?: FlathubApi.iconUrl(app.id),
|
||||
app.summary, FlatpakManager.LAUNCHER, listOf(app.id),
|
||||
app.summary, FlatpakManager.LAUNCHER, FlatpakManager.launchArgs(app),
|
||||
arch = app.arch.takeIf { FlatpakManager.foreign(app) },
|
||||
)
|
||||
}
|
||||
return (scripts + images + flatpaks).sortedBy { it.name.lowercase() }
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.app.Notification
|
||||
import android.content.Context
|
||||
import android.service.notification.NotificationListenerService
|
||||
import android.service.notification.StatusBarNotification
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
|
||||
/** One notification for the bottom-screen list. Kept in memory only; never written to disk or logs. */
|
||||
data class BottomNotification(val key: String, val app: String, val title: String, val text: String, val postedAt: Long)
|
||||
|
||||
/**
|
||||
* Notifications from other apps for the bottom screen, so a message can be read without leaving the game.
|
||||
* Works only after the user allows DroidDeck notification access in Android settings.
|
||||
*/
|
||||
object BottomNotifications {
|
||||
val items = mutableStateListOf<BottomNotification>()
|
||||
|
||||
fun granted(context: Context): Boolean =
|
||||
context.packageName in NotificationManagerCompat.getEnabledListenerPackages(context)
|
||||
|
||||
internal fun keep(own: String, pkg: String, ongoing: Boolean, groupSummary: Boolean, title: String, text: String): Boolean =
|
||||
pkg != own && !ongoing && !groupSummary && (title.isNotBlank() || text.isNotBlank())
|
||||
|
||||
internal fun add(list: MutableList<BottomNotification>, item: BottomNotification) {
|
||||
list.removeAll { it.key == item.key }
|
||||
list.add(0, item)
|
||||
while (list.size > MAX_ITEMS) list.removeAt(list.lastIndex)
|
||||
}
|
||||
|
||||
fun clear() = items.clear()
|
||||
|
||||
internal fun post(context: Context, sbn: StatusBarNotification) {
|
||||
val n = sbn.notification ?: return
|
||||
val extras = n.extras
|
||||
val title = extras?.getCharSequence(Notification.EXTRA_TITLE)?.toString().orEmpty()
|
||||
val text = (extras?.getCharSequence(Notification.EXTRA_BIG_TEXT) ?: extras?.getCharSequence(Notification.EXTRA_TEXT))?.toString().orEmpty()
|
||||
if (!keep(context.packageName, sbn.packageName, sbn.isOngoing, (n.flags and Notification.FLAG_GROUP_SUMMARY) != 0, title, text)) return
|
||||
val app = runCatching {
|
||||
val pm = context.packageManager
|
||||
pm.getApplicationLabel(pm.getApplicationInfo(sbn.packageName, 0)).toString()
|
||||
}.getOrDefault(sbn.packageName)
|
||||
add(items, BottomNotification(sbn.key, app, title, text, sbn.postTime))
|
||||
}
|
||||
|
||||
internal fun remove(key: String) {
|
||||
items.removeAll { it.key == key }
|
||||
}
|
||||
|
||||
private const val MAX_ITEMS = 30
|
||||
}
|
||||
|
||||
class BottomNotificationListener : NotificationListenerService() {
|
||||
override fun onListenerConnected() {
|
||||
runCatching { activeNotifications }.getOrNull()?.sortedBy { it.postTime }?.forEach { BottomNotifications.post(this, it) }
|
||||
}
|
||||
|
||||
override fun onNotificationPosted(sbn: StatusBarNotification) = BottomNotifications.post(this, sbn)
|
||||
|
||||
override fun onNotificationRemoved(sbn: StatusBarNotification) = BottomNotifications.remove(sbn.key)
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.ContentValues
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.MediaStore
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
/** A screenshot for the bottom-screen gallery: one DroidDeck took (a MediaStore [uri]) or one Steam saved (a [file]). */
|
||||
data class BottomShot(val uri: Uri?, val file: File?, val takenAt: Long, val steam: Boolean) {
|
||||
val model: Any get() = uri ?: file!!
|
||||
}
|
||||
|
||||
/** Game frames DroidDeck saves to Pictures/DroidDeck, plus the screenshots Steam keeps under userdata. */
|
||||
object BottomScreenshots {
|
||||
private const val FOLDER = "DroidDeck"
|
||||
private const val QUALITY = 95
|
||||
private const val LIMIT = 120
|
||||
|
||||
internal fun fileName(at: Long): String =
|
||||
"DroidDeck_" + SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(Date(at)) + ".jpg"
|
||||
|
||||
fun save(context: Context, bitmap: Bitmap, at: Long = System.currentTimeMillis()): Boolean = runCatching {
|
||||
val name = fileName(at)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
val resolver = context.contentResolver
|
||||
val values = ContentValues().apply {
|
||||
put(MediaStore.Images.Media.DISPLAY_NAME, name)
|
||||
put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
|
||||
put(MediaStore.Images.Media.DATE_TAKEN, at)
|
||||
put(MediaStore.Images.Media.RELATIVE_PATH, "${Environment.DIRECTORY_PICTURES}/$FOLDER")
|
||||
put(MediaStore.Images.Media.IS_PENDING, 1)
|
||||
}
|
||||
val uri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values) ?: return false
|
||||
val written = runCatching {
|
||||
resolver.openOutputStream(uri)?.use { bitmap.compress(Bitmap.CompressFormat.JPEG, QUALITY, it) } == true
|
||||
}.getOrDefault(false)
|
||||
if (!written) {
|
||||
resolver.delete(uri, null, null)
|
||||
return false
|
||||
}
|
||||
resolver.update(uri, ContentValues().apply { put(MediaStore.Images.Media.IS_PENDING, 0) }, null, null)
|
||||
true
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
val dir = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), FOLDER)
|
||||
if (!dir.isDirectory && !dir.mkdirs()) return false
|
||||
val file = File(dir, name)
|
||||
file.outputStream().use { bitmap.compress(Bitmap.CompressFormat.JPEG, QUALITY, it) }
|
||||
android.media.MediaScannerConnection.scanFile(context, arrayOf(file.path), arrayOf("image/jpeg"), null)
|
||||
true
|
||||
}
|
||||
}.getOrDefault(false)
|
||||
|
||||
/** Newest first, at most [LIMIT]. */
|
||||
fun list(context: Context, runtimeRoot: File): List<BottomShot> =
|
||||
(own(context) + steam(runtimeRoot)).sortedByDescending { it.takenAt }.take(LIMIT)
|
||||
|
||||
private fun own(context: Context): List<BottomShot> = runCatching {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
||||
@Suppress("DEPRECATION")
|
||||
val dir = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), FOLDER)
|
||||
return dir.listFiles { f -> f.isFile && f.name.endsWith(".jpg", true) }.orEmpty()
|
||||
.map { BottomShot(null, it, it.lastModified(), steam = false) }
|
||||
}
|
||||
val shots = ArrayList<BottomShot>()
|
||||
context.contentResolver.query(
|
||||
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||
arrayOf(MediaStore.Images.Media._ID, MediaStore.Images.Media.DATE_TAKEN, MediaStore.Images.Media.DATE_ADDED),
|
||||
"${MediaStore.Images.Media.RELATIVE_PATH} = ?", arrayOf("${Environment.DIRECTORY_PICTURES}/$FOLDER/"),
|
||||
"${MediaStore.Images.Media.DATE_ADDED} DESC",
|
||||
)?.use { c ->
|
||||
while (c.moveToNext() && shots.size < LIMIT) {
|
||||
val taken = c.getLong(1).takeIf { it > 0L } ?: (c.getLong(2) * 1000L)
|
||||
shots += BottomShot(android.content.ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, c.getLong(0)),
|
||||
null, taken, steam = false)
|
||||
}
|
||||
}
|
||||
shots
|
||||
}.getOrDefault(emptyList())
|
||||
|
||||
/** The .jpg files in userdata/<account>/760/remote/<app>/screenshots of each Steam home; the thumbnails folder is skipped. */
|
||||
internal fun steam(runtimeRoot: File): List<BottomShot> =
|
||||
SteamDownloadMonitor.STEAM_HOMES.flatMap { home ->
|
||||
File(runtimeRoot, "$home/userdata").listFiles { f -> f.isDirectory }.orEmpty().flatMap { account ->
|
||||
File(account, "760/remote").listFiles { f -> f.isDirectory }.orEmpty().flatMap { app ->
|
||||
File(app, "screenshots").listFiles { f -> f.isFile && f.name.endsWith(".jpg", true) }.orEmpty().toList()
|
||||
}
|
||||
}
|
||||
}.map { BottomShot(null, it, it.lastModified(), steam = true) }
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
|
||||
/** One reading from a racing game's telemetry. Fractions are 0..1; null means the game does not send it. */
|
||||
data class Telemetry(
|
||||
val source: String,
|
||||
val speedKmh: Float? = null,
|
||||
val rpm: Float? = null,
|
||||
val maxRpm: Float? = null,
|
||||
val gear: String? = null,
|
||||
val throttle: Float? = null,
|
||||
val brake: Float? = null,
|
||||
val lap: Int? = null,
|
||||
val laps: Int? = null,
|
||||
val position: Int? = null,
|
||||
val fuel: Float? = null,
|
||||
val currentLapS: Float? = null,
|
||||
val lastLapS: Float? = null,
|
||||
val bestLapS: Float? = null,
|
||||
/** G-force as the game sends it (lateral, longitudinal) and steering from -1 (left) to 1 (right). */
|
||||
val gLat: Float? = null,
|
||||
val gLon: Float? = null,
|
||||
val steer: Float? = null,
|
||||
/** Front left, front right, rear left, rear right. */
|
||||
val tireTempsC: List<Float>? = null,
|
||||
val turboBar: Float? = null,
|
||||
val engineTempC: Float? = null,
|
||||
val oilTempC: Float? = null,
|
||||
/** OutGauge dashboard lights that are on, as GameTelemetry.DL_* bits. */
|
||||
val lights: Int? = null,
|
||||
)
|
||||
|
||||
/**
|
||||
* Racing telemetry games send over UDP to 127.0.0.1. Each format has its own port, the one the game or
|
||||
* its common tools use by default:
|
||||
* - [CODEMASTERS_PORT]: DiRT Rally 1/2, DiRT 4, GRID ("extradata 3" float array), DiRT Showdown (152-byte packet).
|
||||
* - [FORZA_PORT]: Forza Motorsport 7/2023 and Forza Horizon 4/5 "Data Out" (Sled and Dash).
|
||||
* - [OUTGAUGE_PORT]: BeamNG.drive and Live for Speed OutGauge.
|
||||
*/
|
||||
object GameTelemetry {
|
||||
const val CODEMASTERS_PORT = 20777
|
||||
const val FORZA_PORT = 5300
|
||||
const val OUTGAUGE_PORT = 4444
|
||||
val PORTS = listOf(CODEMASTERS_PORT, FORZA_PORT, OUTGAUGE_PORT)
|
||||
|
||||
// Games send to 127.0.0.1; on Android InetAddress.getLoopbackAddress() is ::1, which IPv4 packets never reach.
|
||||
val LISTEN_ADDRESS: java.net.InetAddress = java.net.InetAddress.getByAddress(byteArrayOf(127, 0, 0, 1))
|
||||
|
||||
fun parse(port: Int, data: ByteArray, length: Int): Telemetry? = runCatching {
|
||||
val buf = ByteBuffer.wrap(data, 0, length).order(ByteOrder.LITTLE_ENDIAN)
|
||||
when (port) {
|
||||
CODEMASTERS_PORT -> codemasters(buf, length)
|
||||
FORZA_PORT -> forza(buf, length)
|
||||
OUTGAUGE_PORT -> outGauge(buf, length)
|
||||
else -> null
|
||||
}
|
||||
}.getOrNull()
|
||||
|
||||
private const val MPS_TO_KMH = 3.6f
|
||||
private const val GRAVITY = 9.81f
|
||||
|
||||
// OutGauge DashLights / ShowLights bits (Live for Speed InSim; BeamNG uses the same values).
|
||||
const val DL_SHIFT = 1
|
||||
const val DL_HANDBRAKE = 4
|
||||
const val DL_PITSPEED = 8
|
||||
const val DL_TC = 16
|
||||
const val DL_ABS = 1024
|
||||
|
||||
// Float indexes of the Codemasters packet; engine rpm values are sent divided by 10. Older games
|
||||
// (DiRT Showdown) send only the first 38 floats, so lap count, position, fuel and max rpm are missing there.
|
||||
private const val CM_LAP_TIME = 1
|
||||
private const val CM_SPEED = 7
|
||||
private const val CM_THROTTLE = 29
|
||||
private const val CM_STEER = 30
|
||||
private const val CM_BRAKE = 31
|
||||
private const val CM_GEAR = 33
|
||||
private const val CM_G_LAT = 34
|
||||
private const val CM_G_LON = 35
|
||||
private const val CM_LAP = 36
|
||||
private const val CM_RPM = 37
|
||||
private const val CM_POSITION = 39
|
||||
private const val CM_FUEL = 45
|
||||
private const val CM_FUEL_CAPACITY = 46
|
||||
private const val CM_LAPS = 60
|
||||
private const val CM_LAST_LAP = 62
|
||||
private const val CM_MAX_RPM = 63
|
||||
private const val CM_MIN_FLOATS = 38
|
||||
|
||||
internal fun codemasters(buf: ByteBuffer, length: Int): Telemetry? {
|
||||
if (length < CM_MIN_FLOATS * 4) return null
|
||||
val floats = length / 4
|
||||
fun f(i: Int) = if (i < floats) buf.getFloat(i * 4) else 0f
|
||||
val gear = f(CM_GEAR).toInt()
|
||||
val capacity = f(CM_FUEL_CAPACITY)
|
||||
return Telemetry(
|
||||
source = "Codemasters",
|
||||
speedKmh = f(CM_SPEED) * MPS_TO_KMH,
|
||||
rpm = f(CM_RPM) * 10f,
|
||||
maxRpm = (f(CM_MAX_RPM) * 10f).takeIf { it > 0f },
|
||||
// Neutral is 0; DiRT Rally 2.0 reports reverse as 10, older games as -1.
|
||||
gear = when {
|
||||
gear == 0 -> "N"
|
||||
gear < 0 || gear == 10 -> "R"
|
||||
else -> gear.toString()
|
||||
},
|
||||
throttle = f(CM_THROTTLE).coerceIn(0f, 1f),
|
||||
brake = f(CM_BRAKE).coerceIn(0f, 1f),
|
||||
lap = f(CM_LAP).toInt() + 1,
|
||||
laps = f(CM_LAPS).toInt().takeIf { it > 0 },
|
||||
position = f(CM_POSITION).toInt().takeIf { it > 0 },
|
||||
fuel = if (capacity > 0f) (f(CM_FUEL) / capacity).coerceIn(0f, 1f) else null,
|
||||
currentLapS = f(CM_LAP_TIME).takeIf { it > 0f },
|
||||
lastLapS = f(CM_LAST_LAP).takeIf { it > 0f },
|
||||
gLat = f(CM_G_LAT),
|
||||
gLon = f(CM_G_LON),
|
||||
steer = f(CM_STEER).coerceIn(-1f, 1f),
|
||||
)
|
||||
}
|
||||
|
||||
// Forza "Data Out": Sled is 232 bytes; the Dash block follows it (FM7 311, FM 2023 331). Horizon 4/5 send
|
||||
// 324 bytes with 12 extra bytes before the Dash block.
|
||||
private const val FORZA_SLED = 232
|
||||
private const val FORZA_FM7 = 311
|
||||
private const val FORZA_HORIZON = 324
|
||||
private const val FORZA_FM2023 = 331
|
||||
private const val HORIZON_SHIFT = 12
|
||||
|
||||
internal fun forza(buf: ByteBuffer, length: Int): Telemetry? {
|
||||
if (length < FORZA_SLED) return null
|
||||
val racing = buf.getInt(0) != 0
|
||||
val maxRpm = buf.getFloat(8)
|
||||
val rpm = buf.getFloat(16)
|
||||
val dash = when (length) {
|
||||
FORZA_FM7, FORZA_FM2023 -> FORZA_SLED
|
||||
FORZA_HORIZON -> FORZA_SLED + HORIZON_SHIFT
|
||||
else -> -1
|
||||
}
|
||||
if (dash < 0) return Telemetry(source = "Forza", rpm = rpm, maxRpm = maxRpm.takeIf { it > 0f })
|
||||
if (!racing) return Telemetry(source = "Forza")
|
||||
val gear = buf.get(dash + 75).toInt() and 0xFF
|
||||
// Tire temperatures are read as Fahrenheit, as community Data Out parsers do; not checked on a device.
|
||||
val tiresF = (0 until 4).map { buf.getFloat(dash + 24 + it * 4) }
|
||||
return Telemetry(
|
||||
source = "Forza",
|
||||
speedKmh = buf.getFloat(dash + 12) * MPS_TO_KMH,
|
||||
rpm = rpm,
|
||||
maxRpm = maxRpm.takeIf { it > 0f },
|
||||
gear = if (gear == 0) "R" else gear.toString(),
|
||||
throttle = (buf.get(dash + 71).toInt() and 0xFF) / 255f,
|
||||
brake = (buf.get(dash + 72).toInt() and 0xFF) / 255f,
|
||||
lap = (buf.getShort(dash + 68).toInt() and 0xFFFF) + 1,
|
||||
position = (buf.get(dash + 70).toInt() and 0xFF).takeIf { it > 0 },
|
||||
fuel = buf.getFloat(dash + 44).coerceIn(0f, 1f),
|
||||
currentLapS = buf.getFloat(dash + 60).takeIf { it > 0f },
|
||||
lastLapS = buf.getFloat(dash + 56).takeIf { it > 0f },
|
||||
bestLapS = buf.getFloat(dash + 52).takeIf { it > 0f },
|
||||
gLat = buf.getFloat(20) / GRAVITY,
|
||||
gLon = buf.getFloat(28) / GRAVITY,
|
||||
steer = (buf.get(dash + 76).toFloat() / 127f).coerceIn(-1f, 1f),
|
||||
tireTempsC = tiresF.takeIf { f -> f.any { it > 0f } }?.map { (it - 32f) * 5f / 9f },
|
||||
)
|
||||
}
|
||||
|
||||
// OutGauge: 92 bytes, or 96 with the optional id at the end.
|
||||
private const val OUTGAUGE_SIZE = 92
|
||||
|
||||
internal fun outGauge(buf: ByteBuffer, length: Int): Telemetry? {
|
||||
if (length < OUTGAUGE_SIZE) return null
|
||||
val gear = buf.get(10).toInt() and 0xFF
|
||||
return Telemetry(
|
||||
source = "OutGauge",
|
||||
speedKmh = buf.getFloat(12) * MPS_TO_KMH,
|
||||
rpm = buf.getFloat(16),
|
||||
gear = when (gear) {
|
||||
0 -> "R"
|
||||
1 -> "N"
|
||||
else -> (gear - 1).toString()
|
||||
},
|
||||
throttle = buf.getFloat(48).coerceIn(0f, 1f),
|
||||
brake = buf.getFloat(52).coerceIn(0f, 1f),
|
||||
fuel = buf.getFloat(28).coerceIn(0f, 1f),
|
||||
turboBar = buf.getFloat(20).takeIf { it != 0f },
|
||||
engineTempC = buf.getFloat(24).takeIf { it != 0f },
|
||||
oilTempC = buf.getFloat(36).takeIf { it != 0f },
|
||||
lights = buf.getInt(44).takeIf { buf.getInt(40) != 0 },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** Games that publish their state locally without any setup: War Thunder's web page and Elite Dangerous' Status.json. */
|
||||
object GameStatusFiles {
|
||||
const val WAR_THUNDER_STATE = "http://127.0.0.1:8111/state"
|
||||
private const val ELITE_APP = "359320"
|
||||
private const val ELITE_STATUS = "pfx/drive_c/users/steamuser/Saved Games/Frontier Developments/Elite Dangerous/Status.json"
|
||||
const val WAR_THUNDER_ROWS = 12
|
||||
|
||||
/** War Thunder's own labels (for example "TAS, km/h") with their values, while a match runs. */
|
||||
internal fun warThunder(json: String): List<Pair<String, String>> {
|
||||
val state = org.json.JSONObject(json)
|
||||
if (!state.optBoolean("valid", false)) return emptyList()
|
||||
return state.keys().asSequence().filter { it != "valid" }.mapNotNull { key ->
|
||||
val value = state.opt(key) as? Number ?: return@mapNotNull null
|
||||
key to if (value.toDouble() % 1.0 == 0.0) value.toLong().toString() else "%.1f".format(java.util.Locale.US, value.toDouble())
|
||||
}.toList()
|
||||
}
|
||||
|
||||
fun eliteStatusFile(runtimeRoot: java.io.File, mounts: Map<String, java.io.File>): java.io.File? {
|
||||
val libraries = SteamDownloadMonitor.manifests(runtimeRoot, mounts).mapNotNull { it.parentFile } +
|
||||
SteamDownloadMonitor.STEAM_HOMES.map { java.io.File(runtimeRoot, "$it/steamapps") }
|
||||
return libraries.distinct().map { java.io.File(it, "compatdata/$ELITE_APP/$ELITE_STATUS") }.firstOrNull { it.isFile }
|
||||
}
|
||||
|
||||
data class Elite(val fuelMain: Double?, val fuelReserve: Double?, val cargo: Double?, val pips: List<Int>?, val legal: String?, val balance: Long?)
|
||||
|
||||
/** Null while Elite is at its menus (Status.json then carries only the timestamp and flags). */
|
||||
internal fun elite(json: String): Elite? {
|
||||
val s = org.json.JSONObject(json)
|
||||
val fuel = s.optJSONObject("Fuel")
|
||||
val pips = s.optJSONArray("Pips")?.let { a -> (0 until a.length()).map { a.optInt(it) } }
|
||||
if (fuel == null && pips == null && !s.has("Cargo") && !s.has("Balance")) return null
|
||||
return Elite(
|
||||
fuelMain = fuel?.optDouble("FuelMain")?.takeIf { !it.isNaN() },
|
||||
fuelReserve = fuel?.optDouble("FuelReservoir")?.takeIf { !it.isNaN() },
|
||||
cargo = s.optDouble("Cargo").takeIf { !it.isNaN() },
|
||||
pips = pips,
|
||||
legal = s.optString("LegalState").takeIf { it.isNotEmpty() },
|
||||
balance = if (s.has("Balance")) s.optLong("Balance") else null,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -36,9 +36,6 @@ import kotlin.math.abs
|
||||
* under 90 fps against 2-7% unboosted. A game with no frames (Factorio's benchmark, a loading screen)
|
||||
* or one falling behind the panel is boosted; one holding pace keeps what it has for [PACE_LEAVE_S]
|
||||
* seconds and is then let go.
|
||||
*
|
||||
* Part of the Performance boost switch, on by default only where it was measured ([measuredHere]).
|
||||
* Another phone's HAL may boost differently, or not at all.
|
||||
*/
|
||||
object GameThreadHints {
|
||||
private const val TAG = "GameThreadHints"
|
||||
@@ -49,23 +46,21 @@ object GameThreadHints {
|
||||
private const val LEAVE = 0.15 // a capped game's main thread idles to ~30% on a prime core; under 0.3 it hopped back and forth
|
||||
private const val MAX_THREADS = 2 // one per prime core; a third would be sped up in place instead
|
||||
private const val TOP_PROCESSES = 3
|
||||
internal const val PACE_WINDOW_S = 3
|
||||
internal const val PACE_LEAVE_S = 10
|
||||
private const val PACE_WINDOW_S = 3
|
||||
private const val PACE_LEAVE_S = 10
|
||||
private const val PACE_TOLERANCE = 0.08
|
||||
|
||||
/** Busy, but not the game: the app itself and the Steam client, whose UI would otherwise hold the prime cores. */
|
||||
private val NOT_GAMES = setOf("steam", "steamwebhelper")
|
||||
|
||||
/** The Odin 3 (CQ8725S), where the boost was measured. */
|
||||
val measuredHere: Boolean get() = Build.VERSION.SDK_INT >= 31 && Build.SOC_MODEL == "CQ8725S"
|
||||
|
||||
private var worker: Thread? = null
|
||||
|
||||
/** At a session's start. The line is for the log. */
|
||||
@Synchronized
|
||||
fun start(context: Context): String {
|
||||
if (!SessionPrefs.performanceBoost(context)) return "game thread hints: off"
|
||||
if (Build.VERSION.SDK_INT < 31) return "game thread hints: needs Android 12"
|
||||
if (!SessionPrefs.gameThreadHints(context)) return "game thread hints: off"
|
||||
// Measured on the Odin 3 (CQ8725S) only; another HAL may boost differently, or not at all.
|
||||
if (Build.VERSION.SDK_INT < 31 || Build.SOC_MODEL != "CQ8725S") return "game thread hints: Odin 3 only"
|
||||
val hm = context.getSystemService(PerformanceHintManager::class.java)
|
||||
?: return "game thread hints: no PerformanceHintManager"
|
||||
val pm = context.getSystemService(PowerManager::class.java)
|
||||
|
||||
@@ -21,7 +21,7 @@ class GpuMemComponent(private val file: File, private val root: File) : SessionP
|
||||
thread = Thread({
|
||||
while (running) {
|
||||
try { Thread.sleep(PERIOD_MS) } catch (e: InterruptedException) { break }
|
||||
if (running && (OverlayShown.check(root) || com.droiddeck.launcher.hud.FusionHudHost.showing)) sample()?.let { write(it) }
|
||||
if (running && (OverlayShown.check(root) || com.droiddeck.launcher.hud.DroidDeckHudHost.showing)) sample()?.let { write(it) }
|
||||
}
|
||||
}, "gpu-mem").apply { isDaemon = true; start() }
|
||||
}
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.PowerManager
|
||||
import android.util.Log
|
||||
import com.android.dx.command.dexer.DxContext
|
||||
import com.android.dx.command.dexer.Main
|
||||
import com.droiddeck.launcher.wayland.WaylandCompositor
|
||||
import dalvik.system.DexClassLoader
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.lang.reflect.Method
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
/**
|
||||
* Samsung's Galaxy Performance SDK (com.samsung.sdk.sperf): CPU, GPU and memory-bus clock floors from
|
||||
* Samsung's own service. Its licence does not allow passing the jar on, so a Samsung owner downloads
|
||||
* it from [DOWNLOAD_URL] and imports it; it is turned into dex on the phone and loaded from there.
|
||||
*
|
||||
* The presets are renewed every [RENEW_S] seconds with a [HOLD_MS] timeout, so Samsung's service
|
||||
* lets go on its own if the app dies.
|
||||
*/
|
||||
object SamsungPerf {
|
||||
enum class ImportResult { IMPORTED, INVALID, FAILED }
|
||||
|
||||
private const val TAG = "SamsungPerf"
|
||||
const val DOWNLOAD_URL = "https://developer.samsung.com/galaxy-performance/download.html"
|
||||
private const val SPERF = "com.samsung.sdk.sperf"
|
||||
private val REQUIRED = listOf("SPerf", "PerformanceManager").map { "${SPERF.replace('.', '/')}/$it.class" }
|
||||
private const val PRESETS = 64 or 128 or 256 // PerformanceManager.PRESET_TYPE_CPU | _GPU | _BUS
|
||||
private const val HOLD_MS = 5000
|
||||
private const val RENEW_S = 2
|
||||
|
||||
val samsung: Boolean get() = Build.MANUFACTURER.equals("samsung", ignoreCase = true)
|
||||
|
||||
fun offered(context: Context) = samsung || SessionPrefs.samsungPerfAnyPhone(context)
|
||||
|
||||
fun imported(context: Context) = dexFile(context).isFile
|
||||
|
||||
private fun dir(context: Context) = File(context.filesDir, "samsung-perf")
|
||||
|
||||
private fun dexFile(context: Context) = File(dir(context), "perfsdk.dex.jar")
|
||||
|
||||
@Synchronized
|
||||
fun import(context: Context, source: File): ImportResult {
|
||||
val dir = dir(context).apply { mkdirs() }
|
||||
val jar = File(dir, "perfsdk.jar.staged")
|
||||
val dex = File(dir, "perfsdk.dex.jar.staged")
|
||||
try {
|
||||
if (!extractJar(source, jar)) return ImportResult.INVALID
|
||||
val log = ByteArrayOutputStream()
|
||||
val dx = DxContext(log, log)
|
||||
val args = Main.Arguments(dx).apply {
|
||||
fileNames = arrayOf(jar.path)
|
||||
outName = dex.path
|
||||
jarOutput = true
|
||||
minSdkVersion = 26
|
||||
makeOptionsObjects()
|
||||
}
|
||||
val status = Main(dx).runDx(args)
|
||||
if (status != 0 || !dex.isFile) {
|
||||
Log.w(TAG, "dx exit $status: $log")
|
||||
return ImportResult.FAILED
|
||||
}
|
||||
val target = dexFile(context)
|
||||
target.setWritable(true)
|
||||
target.delete()
|
||||
if (!dex.renameTo(target)) return ImportResult.FAILED
|
||||
target.setReadOnly()
|
||||
sdk = null
|
||||
unusable = false
|
||||
Log.i(TAG, "SDK from $source ready (${target.length()} bytes of dex)")
|
||||
return ImportResult.IMPORTED
|
||||
} catch (t: Throwable) {
|
||||
Log.w(TAG, "could not import $source", t)
|
||||
return ImportResult.FAILED
|
||||
} finally {
|
||||
jar.delete()
|
||||
dex.delete()
|
||||
}
|
||||
}
|
||||
|
||||
/** Samsung's zip also holds the sample app's different perfsdk.jar; Libs/ is the SDK's own. */
|
||||
internal fun extractJar(source: File, target: File): Boolean = try {
|
||||
ZipFile(source).use { zip -> extractJar(zip, source, target) }
|
||||
} catch (_: java.util.zip.ZipException) {
|
||||
false
|
||||
}
|
||||
|
||||
private fun extractJar(zip: ZipFile, source: File, target: File): Boolean {
|
||||
if (REQUIRED.all { zip.getEntry(it) != null }) {
|
||||
source.copyTo(target, overwrite = true)
|
||||
return true
|
||||
}
|
||||
val jars = zip.entries().asSequence()
|
||||
.filter { !it.isDirectory && it.name.endsWith(".jar", ignoreCase = true) }
|
||||
.sortedByDescending { it.name.contains("Libs/") }
|
||||
.toList()
|
||||
for (entry in jars) {
|
||||
zip.getInputStream(entry).use { input -> target.outputStream().use { input.copyTo(it) } }
|
||||
val found = runCatching { ZipFile(target).use { inner -> REQUIRED.all { inner.getEntry(it) != null } } }.getOrDefault(false)
|
||||
if (found) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private class Sdk(val manager: Any, val start: Method, val stop: Method)
|
||||
|
||||
private var sdk: Sdk? = null
|
||||
private var unusable = false
|
||||
|
||||
/** SPerf.initialize is false where Samsung's service is missing. */
|
||||
@Synchronized
|
||||
private fun load(context: Context): Sdk? {
|
||||
sdk?.let { return it }
|
||||
if (unusable || !imported(context)) return null
|
||||
try {
|
||||
val loader = DexClassLoader(dexFile(context).path, context.codeCacheDir.path, null, context.classLoader)
|
||||
val sperf = loader.loadClass("$SPERF.SPerf")
|
||||
runCatching { sperf.getMethod("setDebugModeEnabled", Boolean::class.javaPrimitiveType).invoke(null, false) }
|
||||
if (sperf.getMethod("initialize", Context::class.java).invoke(null, context.applicationContext) != true) {
|
||||
Log.i(TAG, "SDK loaded, but this phone does not support it")
|
||||
unusable = true
|
||||
return null
|
||||
}
|
||||
val pm = loader.loadClass("$SPERF.PerformanceManager")
|
||||
val manager = pm.getMethod("getInstance").invoke(null) ?: return null
|
||||
val int = Int::class.javaPrimitiveType
|
||||
return Sdk(manager, pm.getMethod("start", int, int), pm.getMethod("stop")).also { sdk = it }
|
||||
} catch (t: Throwable) {
|
||||
Log.w(TAG, "SDK not usable", t)
|
||||
unusable = true
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
private var worker: Thread? = null
|
||||
|
||||
/** At a session's start. The line is for the log. */
|
||||
@Synchronized
|
||||
fun start(context: Context): String {
|
||||
if (!offered(context)) return "samsung boost: not a Samsung phone"
|
||||
if (!SessionPrefs.performanceBoost(context)) return "samsung boost: off"
|
||||
if (!imported(context)) return "samsung boost: SDK not imported"
|
||||
val app = context.applicationContext
|
||||
worker?.interrupt()
|
||||
worker = Thread({ run(app) }, "samsung-boost").apply { isDaemon = true; start() }
|
||||
return "samsung boost: watching"
|
||||
}
|
||||
|
||||
/** At a session's end. */
|
||||
@Synchronized
|
||||
fun stop() {
|
||||
worker?.interrupt()
|
||||
worker = null
|
||||
}
|
||||
|
||||
private fun run(context: Context) {
|
||||
val sdk = load(context) ?: return
|
||||
val pm = context.getSystemService(PowerManager::class.java)
|
||||
val frames = ArrayDeque<Long>()
|
||||
var pacedFor = 0
|
||||
var boosting = false
|
||||
var tick = 0
|
||||
try {
|
||||
while (!Thread.currentThread().isInterrupted) {
|
||||
frames.addLast(WaylandCompositor.gameFrameCount())
|
||||
if (frames.size > GameThreadHints.PACE_WINDOW_S + 1) frames.removeFirst()
|
||||
val fps = (frames.last() - frames.first()).toDouble() / (frames.size - 1).coerceAtLeast(1)
|
||||
val paced = frames.size > GameThreadHints.PACE_WINDOW_S && GameThreadHints.holdsPace(fps, SessionState.refreshHz.toDouble())
|
||||
pacedFor = if (paced) pacedFor + 1 else 0
|
||||
val hot = Build.VERSION.SDK_INT >= 29 && pm.currentThermalStatus >= PowerManager.THERMAL_STATUS_SEVERE
|
||||
val want = fps >= 1 && !pm.isPowerSaveMode && !hot && pacedFor < GameThreadHints.PACE_LEAVE_S
|
||||
if (want && (!boosting || tick % RENEW_S == 0)) {
|
||||
val result = sdk.start.invoke(sdk.manager, PRESETS, HOLD_MS)
|
||||
if (!boosting) Log.i(TAG, "boosting (game ${fps.toInt()} fps, start $result)")
|
||||
} else if (!want && boosting) {
|
||||
sdk.stop.invoke(sdk.manager)
|
||||
Log.i(TAG, "let go (game ${fps.toInt()} fps${if (hot) ", hot" else ""}${if (paced) ", holding pace" else ""})")
|
||||
}
|
||||
boosting = want
|
||||
tick++
|
||||
Thread.sleep(1000)
|
||||
}
|
||||
} catch (_: InterruptedException) {
|
||||
} catch (t: Throwable) {
|
||||
Log.w(TAG, "stopped", t)
|
||||
} finally {
|
||||
if (boosting) runCatching { sdk.stop.invoke(sdk.manager) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,6 +170,7 @@ object SessionFiles {
|
||||
"usr/local/lib/droiddeck/uruntime" to "usr/local/lib/droiddeck/uruntime",
|
||||
"usr/local/lib/droiddeck-pipewire.tzst" to "usr/local/lib/droiddeck-pipewire.tzst",
|
||||
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
|
||||
"usr/local/lib/droiddeck-dirt/ws2_32.dll" to "usr/local/lib/droiddeck-dirt/ws2_32.dll",
|
||||
) + mangoapp + msitools.map { it to it } + vr + fexPreloads).filter { (asset, _) ->
|
||||
val dir = asset.substringBeforeLast('/')
|
||||
runCatching { context.assets.list("linuxfs/$dir")?.contains(asset.substringAfterLast('/')) == true }.getOrDefault(false)
|
||||
|
||||
@@ -100,6 +100,38 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("secondScreenPanel", mode).apply()
|
||||
}
|
||||
|
||||
fun statsStrip(context: Context): String? = prefs(context).getString("statsStrip", null)
|
||||
|
||||
fun setStatsStrip(context: Context, id: String) {
|
||||
prefs(context).edit().putString("statsStrip", id).apply()
|
||||
}
|
||||
|
||||
fun statsSpeedUnit(context: Context): String? = prefs(context).getString("statsSpeedUnit", null)
|
||||
|
||||
fun setStatsSpeedUnit(context: Context, id: String) {
|
||||
prefs(context).edit().putString("statsSpeedUnit", id).apply()
|
||||
}
|
||||
|
||||
fun statsDash(context: Context): String? = prefs(context).getString("statsDash", null)
|
||||
|
||||
fun setStatsDash(context: Context, id: String) {
|
||||
prefs(context).edit().putString("statsDash", id).apply()
|
||||
}
|
||||
|
||||
/** In-game stats "Send dashboard data" Automatic: on unless the user switched it off. */
|
||||
fun telemetryAuto(context: Context): Boolean = prefs(context).getBoolean("telemetryAuto", true)
|
||||
|
||||
fun setTelemetryAuto(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("telemetryAuto", on).apply()
|
||||
}
|
||||
|
||||
/** Games the user switched off by hand, as TelemetryOutput keys; Automatic leaves them alone. */
|
||||
fun telemetryOff(context: Context): Set<String> = prefs(context).getStringSet("telemetryOff", null)?.toSet().orEmpty()
|
||||
|
||||
fun setTelemetryOff(context: Context, keys: Set<String>) {
|
||||
prefs(context).edit().putStringSet("telemetryOff", keys.toSet()).apply()
|
||||
}
|
||||
|
||||
fun dualScreenLauncher(context: Context): Boolean = prefs(context).getBoolean("dualScreenLauncher", true)
|
||||
|
||||
fun setDualScreenLauncher(context: Context, on: Boolean) {
|
||||
@@ -286,18 +318,18 @@ object SessionPrefs {
|
||||
prefs(context).edit().putInt("hudOpacity", percent.coerceIn(HUD_OPACITY_RANGE)).apply()
|
||||
}
|
||||
|
||||
fun fusionHudConfig(context: Context): String? = prefs(context).getString("fusionHud", null)
|
||||
fun droidDeckHudConfig(context: Context): String? = prefs(context).getString("__KEEP_droidDeckHud__", null)
|
||||
|
||||
fun setFusionHudConfig(context: Context, config: String) {
|
||||
prefs(context).edit().putString("fusionHud", config).apply()
|
||||
fun setDroidDeckHudConfig(context: Context, config: String) {
|
||||
prefs(context).edit().putString("__KEEP_droidDeckHud__", config).apply()
|
||||
}
|
||||
|
||||
fun fusionHudPosition(context: Context): Pair<Float, Float>? =
|
||||
prefs(context).getString("fusionHudPos", null)?.split(',')?.mapNotNull { it.toFloatOrNull() }
|
||||
fun droidDeckHudPosition(context: Context): Pair<Float, Float>? =
|
||||
prefs(context).getString("__KEEP_droidDeckHudPos__", null)?.split(',')?.mapNotNull { it.toFloatOrNull() }
|
||||
?.takeIf { it.size == 2 }?.let { it[0] to it[1] }
|
||||
|
||||
fun setFusionHudPosition(context: Context, x: Float, y: Float) {
|
||||
prefs(context).edit().putString("fusionHudPos", "$x,$y").apply()
|
||||
fun setDroidDeckHudPosition(context: Context, x: Float, y: Float) {
|
||||
prefs(context).edit().putString("__KEEP_droidDeckHudPos__", "$x,$y").apply()
|
||||
}
|
||||
|
||||
const val HUD_COLOR_MINT = "mint"
|
||||
@@ -615,18 +647,8 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("gpuClockPin", on).apply()
|
||||
}
|
||||
|
||||
/**
|
||||
* The performance boost: the game's busiest threads named to the power HAL (GameThreadHints) and,
|
||||
* on a Samsung phone with Samsung's SDK imported, its clock floors (SamsungPerf).
|
||||
*/
|
||||
fun performanceBoost(context: Context): Boolean = prefs(context).getBoolean("performanceBoost", GameThreadHints.measuredHere)
|
||||
|
||||
fun setPerformanceBoost(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("performanceBoost", on).apply()
|
||||
}
|
||||
|
||||
/** Hidden: offers the Samsung SDK import on any phone, to test the import where there is no Samsung. */
|
||||
fun samsungPerfAnyPhone(context: Context): Boolean = prefs(context).getBoolean("samsungPerfAnyPhone", false)
|
||||
/** Whether the game's busiest threads are named to the power HAL for a boost (GameThreadHints). */
|
||||
fun gameThreadHints(context: Context): Boolean = prefs(context).getBoolean("gameThreadHints", true)
|
||||
|
||||
fun prootNoSeccomp(context: Context): Boolean = prefs(context).getBoolean("prootNoSeccomp", false)
|
||||
|
||||
|
||||
@@ -73,7 +73,9 @@ class SessionService : Service() {
|
||||
private var downloadMonitorTask: Runnable? = null
|
||||
private var downloadActive = false
|
||||
private var clientInstallActive = false
|
||||
@Volatile private var steamLibraryMounts = emptyMap<String, File>()
|
||||
private var steamLibraryMounts: Map<String, File>
|
||||
get() = SessionState.steamLibraryMounts
|
||||
set(value) { SessionState.steamLibraryMounts = value }
|
||||
private var suspendDownloadNow = false
|
||||
private var suspendPolicy = SessionPrefs.SUSPEND_MANUAL
|
||||
private var steamDownloadsInBackground = false
|
||||
@@ -499,7 +501,6 @@ class SessionService : Service() {
|
||||
|
||||
Log.i(TAG, GpuClockPin.start(this))
|
||||
Log.i(TAG, GameThreadHints.start(this))
|
||||
Log.i(TAG, SamsungPerf.start(this))
|
||||
|
||||
val size = SessionState.outputSize
|
||||
val guest = ArrayList<String>()
|
||||
@@ -1812,7 +1813,6 @@ class SessionService : Service() {
|
||||
SessionState.stopRequested = false
|
||||
GpuClockPin.stop(this)
|
||||
GameThreadHints.stop()
|
||||
SamsungPerf.stop()
|
||||
suspendOperationPending = false
|
||||
freezePending = false
|
||||
launchWatcher?.stopWatching()
|
||||
@@ -1893,7 +1893,6 @@ class SessionService : Service() {
|
||||
override fun onDestroy() {
|
||||
stopSession(0)
|
||||
GameThreadHints.stop() // also when the session never got as far as running
|
||||
SamsungPerf.stop()
|
||||
if (screenReceiverRegistered) {
|
||||
unregisterReceiver(screenReceiver)
|
||||
screenReceiverRegistered = false
|
||||
|
||||
@@ -94,6 +94,9 @@ object SessionState {
|
||||
@Volatile var secondScreenAutoOpened = false
|
||||
@Volatile var secondScreenProvisional = false
|
||||
|
||||
/** Guest library paths on removable storage and the host folders they are mounted from, set by SessionService. */
|
||||
@Volatile var steamLibraryMounts: Map<String, java.io.File> = emptyMap()
|
||||
|
||||
@Volatile
|
||||
var mode = "steam"
|
||||
|
||||
|
||||
@@ -15,18 +15,18 @@ object SettingsReset {
|
||||
"dualScreenMode", "dualScreenLauncher", "dualScreenSessionControls",
|
||||
"gameStoresEnabled", "gameStoresSpeedTier", "gameStoresParallel", "storesOpenTab", "storesShowMature",
|
||||
"storesInstallLanguage",
|
||||
"hud", "hudDeck", "hudFps", "hudBattery", "hudGraph", "hudColor", "hudOpacity", "fusionHud", "fusionHudPos", "backActionsInverted", "backDoubleTapMs", "touch", "osc", "shape", "steamController",
|
||||
"hud", "hudDeck", "hudFps", "hudBattery", "hudGraph", "hudColor", "hudOpacity", "__KEEP_droidDeckHud__", "__KEEP_droidDeckHudPos__", "backActionsInverted", "backDoubleTapMs", "touch", "osc", "shape", "steamController",
|
||||
"gamepadLeft", "gamepadRight", "pipAutoEnter", "unfoldedControls", "unfoldedControlsWithController",
|
||||
"stretch16x9", "picturePosition", "railLabels",
|
||||
"gpuDriverMode", "androidDriver", "linuxDriver", "linuxDriver.steam", "linuxDriver.desktop",
|
||||
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "performanceBoost", "gamescopeRealtime", "ramCapMb", "vramCapMb", "zramClient",
|
||||
"tuSysmem", "glThread", "noGlError", "zinkLazy", "mangoapp", "gpuClockPin", "gamescopeRealtime", "ramCapMb", "vramCapMb", "zramClient",
|
||||
"directAudio", "mic", "wifiDiscovery", "clientCpusOverride", "clientCpus", "gameCpus",
|
||||
"noXalia", "fastSync", "fsyncFirst", "syncFallback", "prootNoSeccomp", "prootFastPath", "cursorComposite",
|
||||
"guestHostname", "fexPreset", "forceSsbs", "logs", "gameDebugLogsEnabled", "storageDiagnostics",
|
||||
"upscaler", "upscaleSharpness", "screenEffects", "textureAnisotropy", "textureLodBias",
|
||||
"steamDownloadsInBackground", "steam_offline", "bootMovie", "bootMovieSound", "bootMovieVolume", "bootMovieSeconds",
|
||||
"bootMovieApplyNext", "bootMovieSteamSeen",
|
||||
"questDefaultsV1",
|
||||
"questDefaultsV1", "telemetryAuto", "telemetryOff", "statsStrip", "statsDash", "statsSpeedUnit",
|
||||
)
|
||||
|
||||
internal val SESSION_PREFIXES = listOf(
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
/** The In-game stats page's top strip, picked on the page (tap or the Layout row) and remembered. */
|
||||
enum class StatsStrip(val id: String) {
|
||||
PANEL("panel"), TILES("tiles"), RINGS("rings");
|
||||
|
||||
fun next(): StatsStrip = entries[(ordinal + 1) % entries.size]
|
||||
|
||||
companion object {
|
||||
fun from(id: String?): StatsStrip = entries.firstOrNull { it.id == id } ?: PANEL
|
||||
}
|
||||
}
|
||||
|
||||
/** Speeds on the racing dashes; telemetry arrives in km/h. */
|
||||
enum class SpeedUnit(val id: String, val label: String, val perKmh: Float) {
|
||||
AUTO("auto", "", 1f), KMH("kmh", "km/h", 1f), MPH("mph", "mph", 0.621371f);
|
||||
|
||||
/** Auto is mph where road speed limits are signed in mph, by the device's region, else km/h. */
|
||||
fun resolve(country: String): SpeedUnit = if (this != AUTO) this else if (country.uppercase() in MPH_REGIONS) MPH else KMH
|
||||
|
||||
fun next(): SpeedUnit = entries[(ordinal + 1) % entries.size]
|
||||
|
||||
companion object {
|
||||
/** The United States and its territories, the United Kingdom and its Crown Dependencies, Liberia, the Bahamas, Belize. */
|
||||
private val MPH_REGIONS = setOf("US", "PR", "GU", "VI", "AS", "MP", "GB", "IM", "JE", "GG", "LR", "BS", "BZ")
|
||||
|
||||
fun from(id: String?): SpeedUnit = entries.firstOrNull { it.id == id } ?: AUTO
|
||||
}
|
||||
}
|
||||
|
||||
/** The racing dash under the strip; Auto picks one by the game's data format. */
|
||||
enum class StatsDash(val id: String) {
|
||||
AUTO("auto"), SPEEDOMETER("speedometer"), CIRCUIT("circuit"), TRACE("trace"), DIALS("dials"), GLANCE("glance");
|
||||
|
||||
/** The dash to draw for data from [source] (Telemetry.source). */
|
||||
fun resolve(source: String): StatsDash = if (this != AUTO) this else when (source) {
|
||||
"Forza" -> CIRCUIT
|
||||
"OutGauge" -> DIALS
|
||||
else -> SPEEDOMETER
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val DRAWN = listOf(SPEEDOMETER, CIRCUIT, TRACE, DIALS, GLANCE)
|
||||
|
||||
fun from(id: String?): StatsDash = entries.firstOrNull { it.id == id } ?: AUTO
|
||||
|
||||
/** A tap on the dash moves on from the one on screen, so Auto never looks like a tap did nothing. */
|
||||
fun tapped(shown: StatsDash): StatsDash = DRAWN[(DRAWN.indexOf(shown) + 1).mod(DRAWN.size)]
|
||||
}
|
||||
}
|
||||
@@ -101,34 +101,6 @@ internal class SteamDownloadMonitor {
|
||||
now - lastContentActivityAt <= CONTENT_ACTIVITY_GRACE_MS
|
||||
}
|
||||
|
||||
private fun manifests(runtimeRoot: File, mounts: Map<String, File>): List<File> {
|
||||
val steamRoots = linkedSetOf<File>()
|
||||
for (home in STEAM_HOMES) {
|
||||
val primary = File(runtimeRoot, home)
|
||||
steamRoots += primary
|
||||
val libraryFolders = File(primary, "steamapps/libraryfolders.vdf")
|
||||
runCatching {
|
||||
PATH.findAll(libraryFolders.readText()).forEach { match ->
|
||||
steamRoots += hostPath(runtimeRoot, match.groupValues[1], mounts)
|
||||
}
|
||||
}
|
||||
}
|
||||
return steamRoots.flatMap { root ->
|
||||
File(root, "steamapps").listFiles { file ->
|
||||
file.isFile && file.name.startsWith("appmanifest_") && file.name.endsWith(".acf")
|
||||
}.orEmpty().toList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun hostPath(runtimeRoot: File, guest: String, mounts: Map<String, File>): File {
|
||||
val path = guest.trimEnd('/')
|
||||
for ((mount, host) in mounts) {
|
||||
if (path == mount) return host
|
||||
if (path.startsWith("$mount/")) return File(host, path.removePrefix("$mount/"))
|
||||
}
|
||||
return File(runtimeRoot, path.removePrefix("/"))
|
||||
}
|
||||
|
||||
private fun read(file: File): ManifestState {
|
||||
val text = runCatching { file.readText() }.getOrDefault("")
|
||||
val flags = value(text, "StateFlags")?.toLongOrNull() ?: 0L
|
||||
@@ -137,9 +109,6 @@ internal class SteamDownloadMonitor {
|
||||
return ManifestState(downloaded, flags != 4L && (total <= 0L || downloaded < total))
|
||||
}
|
||||
|
||||
private fun value(text: String, key: String): String? =
|
||||
Regex("\"$key\"\\s+\"([^\"]*)\"").find(text)?.groupValues?.get(1)
|
||||
|
||||
companion object {
|
||||
fun clientInstallPending(runtimeRoot: File): Boolean {
|
||||
val home = File(runtimeRoot, "root")
|
||||
@@ -149,12 +118,43 @@ internal class SteamDownloadMonitor {
|
||||
return !(stamped && File(steam, "steamrtarm64/steam").isFile) || File(home, ".bl-steam-repair").exists()
|
||||
}
|
||||
|
||||
internal fun manifests(runtimeRoot: File, mounts: Map<String, File>): List<File> {
|
||||
val steamRoots = linkedSetOf<File>()
|
||||
for (home in STEAM_HOMES) {
|
||||
val primary = File(runtimeRoot, home)
|
||||
steamRoots += primary
|
||||
val libraryFolders = File(primary, "steamapps/libraryfolders.vdf")
|
||||
runCatching {
|
||||
PATH.findAll(libraryFolders.readText()).forEach { match ->
|
||||
steamRoots += hostPath(runtimeRoot, match.groupValues[1], mounts)
|
||||
}
|
||||
}
|
||||
}
|
||||
return steamRoots.flatMap { root ->
|
||||
File(root, "steamapps").listFiles { file ->
|
||||
file.isFile && file.name.startsWith("appmanifest_") && file.name.endsWith(".acf")
|
||||
}.orEmpty().toList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun hostPath(runtimeRoot: File, guest: String, mounts: Map<String, File>): File {
|
||||
val path = guest.trimEnd('/')
|
||||
for ((mount, host) in mounts) {
|
||||
if (path == mount) return host
|
||||
if (path.startsWith("$mount/")) return File(host, path.removePrefix("$mount/"))
|
||||
}
|
||||
return File(runtimeRoot, path.removePrefix("/"))
|
||||
}
|
||||
|
||||
internal fun value(text: String, key: String): String? =
|
||||
Regex("\"$key\"\\s+\"([^\"]*)\"").find(text)?.groupValues?.get(1)
|
||||
|
||||
private const val MANIFEST_PROGRESS_GRACE_MS = 8_000L
|
||||
private const val CONTENT_ACTIVITY_GRACE_MS = 90_000L
|
||||
private const val MIN_RECEIVE_BYTES_PER_SEC = 64L * 1024L
|
||||
private val PATH = Regex("\"path\"\\s+\"([^\"]+)\"")
|
||||
private val STEAM_HOMES = listOf("root/.local/share/Steam", "root/.droiddeck-x64/.local/share/Steam")
|
||||
private val CONTENT_UPDATE = Regex("""AppID (\d+) (App|Workshop|Shader) update changed : (.*)""")
|
||||
internal val STEAM_HOMES = listOf("root/.local/share/Steam", "root/.droiddeck-x64/.local/share/Steam")
|
||||
internal val CONTENT_UPDATE = Regex("""AppID (\d+) (App|Workshop|Shader) update changed : (.*)""")
|
||||
private val CURRENT_RATE = Regex("""Current download rate: ([\d.]+) Mbps""")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import java.io.File
|
||||
import java.io.RandomAccessFile
|
||||
|
||||
/** A Steam download or update the client is working on. [total] is 0 while Steam has not sized it yet. */
|
||||
data class SteamDownload(
|
||||
val appId: String,
|
||||
val name: String,
|
||||
val done: Long,
|
||||
val total: Long,
|
||||
val shader: Boolean = false,
|
||||
val paused: Boolean = false,
|
||||
)
|
||||
|
||||
/** Reads Steam's own appmanifests and content log, the same files [SteamDownloadMonitor] watches. */
|
||||
object SteamDownloads {
|
||||
fun read(runtimeRoot: File, mounts: Map<String, File> = emptyMap(), client: String? = null): List<SteamDownload> {
|
||||
val names = HashMap<String, String>()
|
||||
val apps = SteamDownloadMonitor.manifests(runtimeRoot, mounts).mapNotNull { file ->
|
||||
val text = runCatching { file.readText() }.getOrNull() ?: return@mapNotNull null
|
||||
val id = SteamDownloadMonitor.value(text, "appid") ?: file.name.removePrefix("appmanifest_").removeSuffix(".acf")
|
||||
val name = SteamDownloadMonitor.value(text, "name") ?: id
|
||||
names[id] = name
|
||||
fromManifest(id, name, text)
|
||||
}
|
||||
val homes = client?.let { listOf(if (it == "x86_64") SteamDownloadMonitor.STEAM_HOMES[1] else SteamDownloadMonitor.STEAM_HOMES[0]) }
|
||||
?: SteamDownloadMonitor.STEAM_HOMES
|
||||
val log = homes.map { File(runtimeRoot, "$it/logs/content_log.txt") }.filter { it.isFile }.maxByOrNull { it.lastModified() }
|
||||
val shaders = log?.let { runningShaderUpdates(tail(it)) }.orEmpty()
|
||||
.map { SteamDownload(it, names[it] ?: it, 0L, 0L, shader = true) }
|
||||
return apps + shaders
|
||||
}
|
||||
|
||||
internal fun fromManifest(id: String, name: String, text: String): SteamDownload? {
|
||||
val flags = SteamDownloadMonitor.value(text, "StateFlags")?.toLongOrNull() ?: 0L
|
||||
if (flags == FULLY_INSTALLED) return null
|
||||
val done = SteamDownloadMonitor.value(text, "BytesDownloaded")?.toLongOrNull() ?: 0L
|
||||
val total = SteamDownloadMonitor.value(text, "BytesToDownload")?.toLongOrNull() ?: 0L
|
||||
if (total > 0L && done >= total) return null
|
||||
if ((flags and UPDATE_REQUIRED) == 0L && total <= 0L) return null
|
||||
return SteamDownload(id, name, done, total, paused = (flags and UPDATE_PAUSED) != 0L)
|
||||
}
|
||||
|
||||
/** App ids whose latest shader-cache line in the content log says the update is still running. */
|
||||
internal fun runningShaderUpdates(lines: Sequence<String>): List<String> {
|
||||
val state = LinkedHashMap<String, Boolean>()
|
||||
for (line in lines) {
|
||||
if ("Client version:" in line) state.clear()
|
||||
val match = SteamDownloadMonitor.CONTENT_UPDATE.find(line) ?: continue
|
||||
if (match.groupValues[2] != "Shader") continue
|
||||
val running = match.groupValues[3].let { "Running Update" in it && "Stopping" !in it }
|
||||
state[match.groupValues[1]] = running
|
||||
}
|
||||
return state.filterValues { it }.keys.toList()
|
||||
}
|
||||
|
||||
private fun tail(file: File): Sequence<String> = runCatching {
|
||||
RandomAccessFile(file, "r").use { raf ->
|
||||
val start = (raf.length() - TAIL_BYTES).coerceAtLeast(0L)
|
||||
raf.seek(start)
|
||||
val bytes = ByteArray((raf.length() - start).toInt())
|
||||
raf.readFully(bytes)
|
||||
String(bytes, Charsets.ISO_8859_1).lineSequence().drop(if (start > 0L) 1 else 0).toList().asSequence()
|
||||
}
|
||||
}.getOrDefault(emptySequence())
|
||||
|
||||
private const val FULLY_INSTALLED = 4L
|
||||
private const val UPDATE_REQUIRED = 2L
|
||||
private const val UPDATE_PAUSED = 512L
|
||||
private const val TAIL_BYTES = 256L * 1024L
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.database.sqlite.SQLiteDatabase
|
||||
import java.io.File
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.SecretKeyFactory
|
||||
import javax.crypto.spec.IvParameterSpec
|
||||
import javax.crypto.spec.PBEKeySpec
|
||||
import javax.crypto.spec.SecretKeySpec
|
||||
|
||||
/** A cookie for one https host, in the form CookieManager.setCookie takes. */
|
||||
data class WebCookie(val host: String, val header: String)
|
||||
|
||||
/**
|
||||
* The web sign-in the Steam client in the session already has, so the bottom-screen chat opens signed in.
|
||||
* Steam's built-in browser keeps it in its Chromium cookie store under config/htmlcache. With no keyring
|
||||
* (SteamOS and DroidDeck) Chromium encrypts values as "v10": AES-128-CBC, key PBKDF2-SHA1("peanuts",
|
||||
* "saltysalt", 1 round), IV of 16 spaces. Values are never logged.
|
||||
*/
|
||||
object SteamWebLogin {
|
||||
val HOSTS = listOf("steamcommunity.com", "steam-chat.com")
|
||||
private const val COOKIES = "config/htmlcache/Default/Cookies"
|
||||
private const val V10 = "v10"
|
||||
// From cookie store version 24 Chromium puts the SHA-256 of the host before each value.
|
||||
private const val HOST_HASH_VERSION = 24
|
||||
private const val HOST_HASH_BYTES = 32
|
||||
|
||||
private val key: SecretKeySpec by lazy {
|
||||
val spec = PBEKeySpec("peanuts".toCharArray(), "saltysalt".toByteArray(), 1, 128)
|
||||
SecretKeySpec(SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1").generateSecret(spec).encoded, "AES")
|
||||
}
|
||||
|
||||
internal fun decrypt(encrypted: ByteArray, hostHashed: Boolean): String? = runCatching {
|
||||
if (encrypted.size <= V10.length || String(encrypted, 0, V10.length, Charsets.US_ASCII) != V10) return null
|
||||
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||
cipher.init(Cipher.DECRYPT_MODE, key, IvParameterSpec(ByteArray(16) { ' '.code.toByte() }))
|
||||
val plain = cipher.doFinal(encrypted, V10.length, encrypted.size - V10.length)
|
||||
val value = if (hostHashed && plain.size >= HOST_HASH_BYTES) plain.copyOfRange(HOST_HASH_BYTES, plain.size) else plain
|
||||
String(value, Charsets.UTF_8)
|
||||
}.getOrNull()
|
||||
|
||||
/** Steam's own pages send the sign-in with its "||" separator percent-encoded. */
|
||||
internal fun header(name: String, value: String, httpOnly: Boolean): String {
|
||||
val v = if (name == "steamLoginSecure") value.replace("||", "%7C%7C") else value
|
||||
return "$name=$v; Path=/; Secure" + if (httpOnly) "; HttpOnly" else ""
|
||||
}
|
||||
|
||||
/** Empty when the client has no web sign-in, for example before the first login. */
|
||||
fun read(runtimeRoot: File, client: String?, scratch: File): List<WebCookie> {
|
||||
val homes = client?.let { listOf(if (it == "x86_64") SteamDownloadMonitor.STEAM_HOMES[1] else SteamDownloadMonitor.STEAM_HOMES[0]) }
|
||||
?: SteamDownloadMonitor.STEAM_HOMES
|
||||
val store = homes.map { File(runtimeRoot, "$it/$COOKIES") }.filter { it.isFile }.maxByOrNull { it.lastModified() }
|
||||
?: return emptyList()
|
||||
// A copy, journal included: Steam keeps the store open and may be in the middle of a write.
|
||||
scratch.deleteRecursively()
|
||||
if (!scratch.mkdirs()) return emptyList()
|
||||
return try {
|
||||
val copy = File(scratch, "Cookies")
|
||||
store.copyTo(copy, overwrite = true)
|
||||
File(store.path + "-journal").takeIf { it.length() > 0L }?.copyTo(File(scratch, "Cookies-journal"), overwrite = true)
|
||||
SQLiteDatabase.openDatabase(copy.path, null, SQLiteDatabase.OPEN_READWRITE).use { db ->
|
||||
val version = db.rawQuery("SELECT value FROM meta WHERE key = 'version'", null).use { if (it.moveToFirst()) it.getString(0).toIntOrNull() else null } ?: 0
|
||||
val marks = HOSTS.joinToString { "?" }
|
||||
db.rawQuery("SELECT host_key, name, value, encrypted_value, is_httponly FROM cookies WHERE host_key IN ($marks)", HOSTS.toTypedArray()).use { c ->
|
||||
val out = ArrayList<WebCookie>()
|
||||
while (c.moveToNext()) {
|
||||
val name = c.getString(1)
|
||||
val value = c.getString(2).takeUnless { it.isNullOrEmpty() }
|
||||
?: decrypt(c.getBlob(3) ?: continue, version >= HOST_HASH_VERSION) ?: continue
|
||||
out += WebCookie(c.getString(0), header(name, value, c.getInt(4) != 0))
|
||||
}
|
||||
out
|
||||
}
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
emptyList()
|
||||
} finally {
|
||||
scratch.deleteRecursively()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Codemasters games keep their UDP / motion output in My Games/<game>/hardwaresettings/hardware_settings_config.xml
|
||||
* inside the game's Proton prefix and read it when the game starts. Turning it on points that element at the
|
||||
* In-game stats listener; the file as it was is kept beside it, and its element is put back when turned off.
|
||||
*/
|
||||
object TelemetryOutput {
|
||||
data class Game(val name: String, val prefixId: String, val file: File, val on: Boolean)
|
||||
|
||||
data class MenuGame(val name: String, val setting: String, val port: Int)
|
||||
|
||||
/** Games whose output is only a setting in the game's own menus, by Steam app id. */
|
||||
val MENU_GAMES: Map<Int, MenuGame> = mapOf(
|
||||
1293830 to MenuGame("Forza Horizon 4", "Data Out", GameTelemetry.FORZA_PORT),
|
||||
1551360 to MenuGame("Forza Horizon 5", "Data Out", GameTelemetry.FORZA_PORT),
|
||||
2440510 to MenuGame("Forza Motorsport", "Data Out", GameTelemetry.FORZA_PORT),
|
||||
284160 to MenuGame("BeamNG.drive", "OutGauge", GameTelemetry.OUTGAUGE_PORT),
|
||||
)
|
||||
|
||||
internal const val ORIGINAL_SUFFIX = ".droiddeck-original"
|
||||
private const val MY_GAMES = "pfx/drive_c/users/steamuser/Documents/My Games"
|
||||
private const val CONFIG = "hardwaresettings/hardware_settings_config.xml"
|
||||
private const val ADDRESS = "127.0.0.1"
|
||||
private const val EXTRADATA = "3"
|
||||
private val TAGS = listOf("udp", "motion")
|
||||
// Byte-for-byte: every byte maps to one char and back, whatever the file's own encoding is.
|
||||
private val BYTES = Charsets.ISO_8859_1
|
||||
|
||||
fun scan(compatdata: List<File>): List<Game> = compatdata.asSequence()
|
||||
.flatMap { root -> root.listFiles { f -> f.isDirectory }.orEmpty().asSequence() }
|
||||
.flatMap { prefix -> File(prefix, MY_GAMES).listFiles { f -> f.isDirectory }.orEmpty().asSequence().map { prefix to it } }
|
||||
.mapNotNull { (prefix, game) ->
|
||||
val file = File(game, CONFIG)
|
||||
val text = runCatching { file.readText(BYTES) }.getOrNull() ?: return@mapNotNull null
|
||||
val element = element(text) ?: return@mapNotNull null
|
||||
Game(game.name, prefix.name, file, pointsHere(element.value))
|
||||
}
|
||||
.sortedBy { it.name.lowercase() }
|
||||
.toList()
|
||||
|
||||
/** Turns the game's output on or off; false when the file could not be read or written. */
|
||||
fun set(game: Game, on: Boolean): Boolean = runCatching {
|
||||
val file = game.file
|
||||
val original = File(file.path + ORIGINAL_SUFFIX)
|
||||
val xml = file.readText(BYTES)
|
||||
val next = if (on) {
|
||||
if (!original.exists()) file.copyTo(original)
|
||||
turnedOn(xml)
|
||||
} else {
|
||||
turnedOff(xml, original.takeIf { it.isFile }?.readText(BYTES))
|
||||
}
|
||||
checkNotNull(next)
|
||||
val tmp = File(file.path + ".droiddeck-tmp")
|
||||
tmp.writeText(next, BYTES)
|
||||
check(tmp.renameTo(file))
|
||||
if (!on) original.delete()
|
||||
true
|
||||
}.getOrDefault(false)
|
||||
|
||||
/** Automatic: turns the output on for every found game the user has not switched off and that is not running. */
|
||||
fun applyAutomatic(context: Context, running: String?) {
|
||||
if (!SessionPrefs.telemetryAuto(context)) return
|
||||
automaticTargets(scan(Library.compatdataDirs(context)), SessionPrefs.telemetryOff(context), running).forEach { set(it, true) }
|
||||
}
|
||||
|
||||
internal fun key(game: Game) = "${game.prefixId}/${game.name}"
|
||||
|
||||
internal fun automaticTargets(games: List<Game>, off: Set<String>, running: String?): List<Game> =
|
||||
games.filter { !it.on && key(it) !in off && !isRunning(it.prefixId, running) }
|
||||
|
||||
/** Games DroidDeck changed, which go back to their own setting when Automatic is switched off. */
|
||||
internal fun restoreTargets(games: List<Game>, running: String?): List<Game> =
|
||||
games.filter { File(it.file.path + ORIGINAL_SUFFIX).isFile && !isRunning(it.prefixId, running) }
|
||||
|
||||
/** Whether [running] (the focused Steam app id, or another key for non-Steam programs) may be the game in [prefixId]. */
|
||||
internal fun isRunning(prefixId: String, running: String?): Boolean {
|
||||
val id = running?.toLongOrNull() ?: return running != null
|
||||
return prefixId == id.toString() || prefixId == id.toInt().toString()
|
||||
}
|
||||
|
||||
internal fun element(xml: String): MatchResult? = TAGS.firstNotNullOfOrNull { tag -> tagRegex(tag).find(xml) }
|
||||
|
||||
internal fun pointsHere(element: String): Boolean =
|
||||
attr(element, "enabled") == "true" && attr(element, "ip") == ADDRESS &&
|
||||
attr(element, "port") == GameTelemetry.CODEMASTERS_PORT.toString() &&
|
||||
(attr(element, "extradata") ?: EXTRADATA) == EXTRADATA
|
||||
|
||||
internal fun turnedOn(xml: String): String? {
|
||||
val element = element(xml) ?: return null
|
||||
var on = withAttr(element.value, "enabled", "true")
|
||||
on = withAttr(on, "ip", ADDRESS)
|
||||
on = withAttr(on, "port", GameTelemetry.CODEMASTERS_PORT.toString())
|
||||
if (attr(on, "extradata") != null) on = withAttr(on, "extradata", EXTRADATA)
|
||||
return xml.replaceRange(element.range, on)
|
||||
}
|
||||
|
||||
internal fun turnedOff(xml: String, original: String?): String? {
|
||||
val element = element(xml) ?: return null
|
||||
val tag = element.value.drop(1).takeWhile { !it.isWhitespace() }
|
||||
val before = original?.let { tagRegex(tag).find(it)?.value }
|
||||
return xml.replaceRange(element.range, before ?: withAttr(element.value, "enabled", "false"))
|
||||
}
|
||||
|
||||
internal fun attr(element: String, name: String): String? =
|
||||
Regex("\\s$name=\"([^\"]*)\"").find(element)?.groupValues?.get(1)
|
||||
|
||||
internal fun withAttr(element: String, name: String, value: String): String {
|
||||
val existing = Regex("(\\s$name=\")[^\"]*\"")
|
||||
if (existing.containsMatchIn(element)) return existing.replace(element) { it.groupValues[1] + value + "\"" }
|
||||
val selfClosing = element.endsWith("/>")
|
||||
val body = element.dropLast(if (selfClosing) 2 else 1).trimEnd()
|
||||
return "$body $name=\"$value\"" + if (selfClosing) " />" else ">"
|
||||
}
|
||||
|
||||
private fun tagRegex(tag: String) = Regex("<$tag\\s[^>]*>")
|
||||
}
|
||||
@@ -92,6 +92,28 @@ object SteamLiveShortcuts {
|
||||
if (evaluate(context, js) != null) Log.i(TAG, "live shortcuts: updated $id")
|
||||
}
|
||||
|
||||
fun launchOptions(context: Context, appId: Long): String? {
|
||||
if (!clientRunning()) return null
|
||||
val js = """
|
||||
new Promise(done => {
|
||||
let handle = null, answer;
|
||||
const finish = d => { clearTimeout(timer); try { handle?.unregister(); } catch (e) {} done(d); };
|
||||
const timer = setTimeout(() => finish(null), 4000);
|
||||
handle = SteamClient.Apps.RegisterForAppDetails(${appId and 0xFFFFFFFFL}, d => { answer = d; if (handle) finish(d); });
|
||||
if (answer !== undefined) finish(answer);
|
||||
}).then(d => typeof d?.strLaunchOptions === 'string' ? d.strLaunchOptions : null)
|
||||
""".trimIndent()
|
||||
return evaluate(context, js)
|
||||
}
|
||||
|
||||
fun setLaunchOptions(context: Context, appId: Long, options: String): Boolean {
|
||||
if (!clientRunning()) return false
|
||||
val id = appId and 0xFFFFFFFFL
|
||||
val done = evaluate(context, "(async () => { SteamClient.Apps.SetAppLaunchOptions($id, ${JSONObject.quote(options)}); return 1; })()") != null
|
||||
if (done) Log.i(TAG, "live: launch options for $id")
|
||||
return done
|
||||
}
|
||||
|
||||
fun setArt(context: Context, appId: Long, assetType: Int?, file: java.io.File?, iconPath: String? = null) {
|
||||
if (!clientRunning()) return
|
||||
val id = appId and 0xFFFFFFFFL
|
||||
|
||||
@@ -68,6 +68,7 @@ import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.frontend.LogoPosition
|
||||
import com.droiddeck.launcher.frontend.SteamGameArt
|
||||
import com.droiddeck.launcher.frontend.SteamGridDb
|
||||
import com.droiddeck.launcher.frontend.SteamLaunchOptions
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -191,7 +192,7 @@ internal fun SteamGameArtEditor(
|
||||
game: com.droiddeck.launcher.frontend.Library.SteamGame, onClose: () -> Unit, onChanged: () -> Unit,
|
||||
) {
|
||||
val target = remember(game.appId) { ArtTarget.of(game) }
|
||||
ArtOnlyEditor(game.name, target, game, { SteamGameArt.describe(it, game) }, onClose, onChanged)
|
||||
ArtOnlyEditor(game.name, target, game, { SteamGameArt.describe(it, game) }, onClose, onChanged, launchAppId = game.appId)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -207,18 +208,25 @@ internal fun StoreGameArtEditor(folder: String, name: String, onClose: () -> Uni
|
||||
@Composable
|
||||
private fun ArtOnlyEditor(
|
||||
name: String, target: ArtTarget?, refresh: Any?, describe: (Context) -> List<AddedGameArt.SlotState>,
|
||||
onClose: () -> Unit, onChanged: () -> Unit,
|
||||
onClose: () -> Unit, onChanged: () -> Unit, launchAppId: Int? = null,
|
||||
) {
|
||||
val app = LocalContext.current.applicationContext
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val scope = rememberCoroutineScope()
|
||||
val shown = rememberShown(onClose)
|
||||
val close = { shown.targetState = false }
|
||||
var version by remember { mutableIntStateOf(0) }
|
||||
var arts by remember { mutableStateOf<List<AddedGameArt.SlotState>>(emptyList()) }
|
||||
var artSlot by remember { mutableStateOf<AddedGameArt.Slot?>(null) }
|
||||
var logoOpen by remember { mutableStateOf(false) }
|
||||
var launchOptions by remember { mutableStateOf<String?>(null) }
|
||||
var launchVersion by remember { mutableIntStateOf(0) }
|
||||
var editingLaunch by remember { mutableStateOf<String?>(null) }
|
||||
var launchSaving by remember { mutableStateOf(false) }
|
||||
var launchError by remember { mutableStateOf<Int?>(null) }
|
||||
val position = rememberLogoPosition(target, version)
|
||||
LaunchedEffect(version, refresh) { if (target != null) arts = withContext(Dispatchers.IO) { describe(app) } }
|
||||
LaunchedEffect(launchAppId, launchVersion) { if (launchAppId != null) launchOptions = withContext(Dispatchers.IO) { SteamLaunchOptions.current(app, launchAppId) } }
|
||||
val first = remember { FocusRequester() }
|
||||
LaunchedEffect(Unit) { focusWithinFrames({ false }) { first } }
|
||||
AppDialog(shown, close, "artEditor", wide = false, maxWidth = 460.dp) {
|
||||
@@ -228,10 +236,19 @@ private fun ArtOnlyEditor(
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier.fillMaxWidth().heightIn(max = maxHeight).verticalScroll(rememberScrollState()),
|
||||
) {
|
||||
Text(stringResource(R.string.edit_artwork), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp, top = 2.dp))
|
||||
if (launchAppId != null) {
|
||||
FieldRow(stringResource(R.string.edit_launch_options), focus = first, onClick = { if (!launchSaving) launchOptions?.let { editingLaunch = it } }) {
|
||||
val options = launchOptions
|
||||
if (options == null || launchSaving) Loading() else ValueText(options.ifEmpty { "—" }, muted = options.isEmpty())
|
||||
}
|
||||
val error = launchError
|
||||
if (error != null) Text(stringResource(error), fontSize = 12.sp, color = colors.error, modifier = Modifier.padding(start = 4.dp))
|
||||
else Text(stringResource(R.string.edit_launch_options_steam_hint), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp))
|
||||
}
|
||||
Text(stringResource(R.string.edit_artwork), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(start = 4.dp, top = if (launchAppId != null) 8.dp else 2.dp))
|
||||
for (slot in AddedGameArt.Slot.values()) key(slot) {
|
||||
val state = arts.firstOrNull { it.slot == slot }
|
||||
FieldRow(slot.label(), focus = if (slot == AddedGameArt.Slot.COVER) first else null, onClick = { if (target != null) artSlot = slot }) {
|
||||
FieldRow(slot.label(), focus = if (slot == AddedGameArt.Slot.COVER && launchAppId == null) first else null, onClick = { if (target != null) artSlot = slot }) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
SlotThumb(slot, state?.file)
|
||||
if (state != null) ValueText(artSourceLabel(state.source), muted = true) else Loading()
|
||||
@@ -241,6 +258,27 @@ private fun ArtOnlyEditor(
|
||||
PickerRow(Icons.Outlined.Tune, stringResource(R.string.art_adjust_logo), logoPositionSummary(position?.value), enabled = target != null && position != null) { logoOpen = true }
|
||||
}
|
||||
}
|
||||
val before = editingLaunch
|
||||
if (before != null && launchAppId != null) TextEntryDialog(stringResource(R.string.edit_launch_options), before, onDismiss = { editingLaunch = null }) { value ->
|
||||
if (launchSaving || value == before.trim()) return@TextEntryDialog
|
||||
launchSaving = true
|
||||
scope.launch {
|
||||
try {
|
||||
val saved = withContext(Dispatchers.IO) { SteamLaunchOptions.set(app, launchAppId, value, before) }
|
||||
launchError = when (saved) {
|
||||
SteamLaunchOptions.Saved.YES -> null
|
||||
SteamLaunchOptions.Saved.DESKTOP -> R.string.edit_launch_options_desktop
|
||||
SteamLaunchOptions.Saved.NO -> R.string.edit_launch_options_not_saved
|
||||
}
|
||||
if (saved == SteamLaunchOptions.Saved.YES) launchOptions = value else {
|
||||
launchOptions = null
|
||||
launchVersion++
|
||||
}
|
||||
} finally {
|
||||
launchSaving = false
|
||||
}
|
||||
}
|
||||
}
|
||||
val chosen = target ?: return
|
||||
artSlot?.let { slot ->
|
||||
ArtChooserDialog(chosen, slot, arts.firstOrNull { it.slot == slot }, onBack = { artSlot = null }, onCloseAll = { artSlot = null; close() }) { version++; onChanged() }
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.media.AudioManager
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.RenderProcessGoneDetail
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
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.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalLifecycleOwner
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.session.SteamWebLogin
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
private const val STEAM_CHAT = "https://steamcommunity.com/chat"
|
||||
private const val CHAT_PAGE_SCALE = 0.75f
|
||||
private val STEAM_HOSTS = listOf("steamcommunity.com", "steam-chat.com", "steampowered.com", "steamstatic.com", "steamcontent.com")
|
||||
|
||||
/** Steam chat stays on Steam's own sites; anything else is not opened on the bottom screen. */
|
||||
internal fun steamChatAllows(host: String?): Boolean =
|
||||
host != null && STEAM_HOSTS.any { host == it || host.endsWith(".$it") }
|
||||
|
||||
/** The desktop chat fits the bottom panel better than the phone site; keep WebView's Chrome version. */
|
||||
internal fun desktopUserAgent(webView: String?): String {
|
||||
val chrome = webView?.let { Regex("Chrome/[\\d.]+").find(it)?.value } ?: "Chrome/127.0.6533.103"
|
||||
return "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) $chrome Safari/537.36"
|
||||
}
|
||||
|
||||
/**
|
||||
* At the panel's own scale Steam's desktop chat gets about 600x300 CSS pixels and its friends list collapses, so the
|
||||
* page is laid out [cssWidth] wide and drawn at [scale]. Steam's site header (the rows before .chat_main_flex; its
|
||||
* class name is generated) is hidden to leave the height to the friends list and the chat. The group chat list keeps
|
||||
* a fixed 114 px height and an empty-list note that cover the online friends, so it shrinks to its rows (at most a
|
||||
* quarter of the panel) and the note is hidden.
|
||||
*/
|
||||
internal fun steamChatFitScript(cssWidth: Int, scale: Float): String {
|
||||
val zoom = "%.2f".format(java.util.Locale.US, scale)
|
||||
return "(function(){var m=document.querySelector('meta[name=viewport]');" +
|
||||
"if(!m){m=document.createElement('meta');m.name='viewport';document.head.appendChild(m);}" +
|
||||
"m.content='width=$cssWidth, initial-scale=$zoom';" +
|
||||
"if(!document.getElementById('dd-chat-fit')){var s=document.createElement('style');s.id='dd-chat-fit';" +
|
||||
"s.textContent='$STEAM_CHAT_FIT_CSS';document.head.appendChild(s);}" +
|
||||
"window.dispatchEvent(new Event('resize'));})()"
|
||||
}
|
||||
|
||||
internal const val STEAM_CHAT_FIT_CSS = ".chat_main>:has(~.chat_main_flex){display:none!important}" +
|
||||
".ChatRoomList_Empty{display:none!important}" +
|
||||
".chatRoomListContainer{height:auto!important;max-height:25vh!important}"
|
||||
|
||||
@Composable
|
||||
fun BottomChatPage() {
|
||||
val context = LocalContext.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
var chatOpen by remember { mutableStateOf(true) }
|
||||
// Set when Android ended the page's renderer; the chat opens again once DroidDeck is back in front.
|
||||
var stopped by remember { mutableStateOf(false) }
|
||||
val lifecycle = LocalLifecycleOwner.current.lifecycle
|
||||
DisposableEffect(lifecycle) {
|
||||
val observer = LifecycleEventObserver { _, event ->
|
||||
if (event == Lifecycle.Event.ON_RESUME && stopped) {
|
||||
stopped = false
|
||||
chatOpen = true
|
||||
}
|
||||
}
|
||||
lifecycle.addObserver(observer)
|
||||
onDispose { lifecycle.removeObserver(observer) }
|
||||
}
|
||||
// null while the Steam client's sign-in is being copied, then whether there was one.
|
||||
var fromSteam by remember { mutableStateOf<Boolean?>(null) }
|
||||
LaunchedEffect(chatOpen) {
|
||||
if (!chatOpen) {
|
||||
fromSteam = null
|
||||
return@LaunchedEffect
|
||||
}
|
||||
val cookies = withContext(Dispatchers.IO) {
|
||||
SteamWebLogin.read(LinuxRuntime.rootDir(context), SessionState.steamClientArch, File(context.cacheDir, "steam-web-login"))
|
||||
}
|
||||
val manager = CookieManager.getInstance()
|
||||
for (c in cookies) suspendCancellableCoroutine { cont -> manager.setCookie("https://${c.host}", c.header) { cont.resume(Unit) } }
|
||||
manager.flush()
|
||||
fromSteam = cookies.any { it.header.startsWith("steamLoginSecure=") }
|
||||
}
|
||||
Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (!chatOpen) {
|
||||
VoiceRow(context)
|
||||
Column(Modifier.weight(1f).fillMaxWidth().padding(24.dp), horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically)) {
|
||||
if (stopped) Text(stringResource(R.string.bottom_chat_stopped), fontSize = 13.sp, color = colors.onSurfaceVariant, textAlign = TextAlign.Center)
|
||||
Text(stringResource(R.string.bottom_chat_why), fontSize = 15.sp, color = colors.onBackground, textAlign = TextAlign.Center)
|
||||
BottomPillButton(stringResource(R.string.bottom_chat_open), "bottom-chat-open") {
|
||||
stopped = false
|
||||
chatOpen = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
VoiceRow(context, onClose = { chatOpen = false },
|
||||
note = if (fromSteam == false) stringResource(R.string.bottom_chat_not_signed_in) else "")
|
||||
Box(Modifier.weight(1f).fillMaxWidth().clip(RoundedCornerShape(14.dp))) {
|
||||
if (fromSteam != null) SteamChatView(onStopped = {
|
||||
stopped = true
|
||||
chatOpen = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** With [onClose] set the chat is open: the row also carries Close and leaves out the long mic hint. */
|
||||
@Composable
|
||||
private fun VoiceRow(context: Context, onClose: (() -> Unit)? = null, note: String = "") {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val audio = remember { context.getSystemService(Context.AUDIO_SERVICE) as AudioManager }
|
||||
val max = remember { audio.getStreamMaxVolume(AudioManager.STREAM_MUSIC).coerceAtLeast(1) }
|
||||
var volume by remember { mutableIntStateOf(audio.getStreamVolume(AudioManager.STREAM_MUSIC)) }
|
||||
fun step(direction: Int) {
|
||||
// No flags: Android's volume panel would cover the game on the main screen.
|
||||
audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, direction, 0)
|
||||
volume = audio.getStreamVolume(AudioManager.STREAM_MUSIC)
|
||||
}
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (onClose != null) BottomPillButton(stringResource(R.string.bottom_chat_close), "bottom-chat-close", onClose)
|
||||
if (SessionState.micAvailable) {
|
||||
val on = SessionState.micEnabled
|
||||
BottomPillButton(stringResource(if (on) R.string.bottom_chat_mic_on else R.string.bottom_chat_mic_off), "bottom-chat-mic") {
|
||||
SessionService.setMicEnabled(context, !on)
|
||||
}
|
||||
}
|
||||
val hint = if (onClose == null && !SessionState.micAvailable) stringResource(R.string.bottom_chat_mic_unavailable) else note
|
||||
Text(hint, fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 3, modifier = Modifier.weight(1f))
|
||||
Text(stringResource(R.string.bottom_chat_volume, volume * 100 / max), fontSize = 14.sp, color = colors.onSurfaceVariant)
|
||||
BottomPillButton("−", "bottom-chat-volume-down") { step(AudioManager.ADJUST_LOWER) }
|
||||
BottomPillButton("+", "bottom-chat-volume-up") { step(AudioManager.ADJUST_RAISE) }
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Composable
|
||||
private fun SteamChatView(onStopped: () -> Unit) {
|
||||
AndroidView(factory = { ctx ->
|
||||
WebView(ctx).apply {
|
||||
// AndroidView's default WRAP_CONTENT height gives the page a 0 px tall viewport, which collapses Steam
|
||||
// chat's full-height layout (measured on the Retroid Pocket Duo: html and every container 0 px).
|
||||
layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||
setBackgroundColor(0xFF0A0B0D.toInt())
|
||||
settings.javaScriptEnabled = true
|
||||
settings.domStorageEnabled = true
|
||||
settings.allowFileAccess = false
|
||||
settings.allowContentAccess = false
|
||||
settings.useWideViewPort = true
|
||||
settings.loadWithOverviewMode = true
|
||||
settings.userAgentString = desktopUserAgent(runCatching { WebSettings.getDefaultUserAgent(ctx) }.getOrNull())
|
||||
CookieManager.getInstance().setAcceptCookie(true)
|
||||
webViewClient = object : WebViewClient() {
|
||||
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean =
|
||||
!steamChatAllows(request.url.host)
|
||||
|
||||
override fun onPageFinished(view: WebView, url: String) {
|
||||
val scale = view.resources.displayMetrics.density * CHAT_PAGE_SCALE
|
||||
if (view.width > 0) view.evaluateJavascript(steamChatFitScript((view.width / scale).roundToInt(), CHAT_PAGE_SCALE), null)
|
||||
}
|
||||
|
||||
// Android ends the page's renderer once DroidDeck goes to picture-in-picture ("isolated not needed"
|
||||
// on the Retroid Pocket Duo); the page cannot come back, so the chat closes and reopens on resume.
|
||||
override fun onRenderProcessGone(view: WebView, detail: RenderProcessGoneDetail): Boolean {
|
||||
onStopped()
|
||||
return true
|
||||
}
|
||||
}
|
||||
loadUrl(STEAM_CHAT)
|
||||
}
|
||||
}, modifier = Modifier.fillMaxSize(), onRelease = { view ->
|
||||
CookieManager.getInstance().flush()
|
||||
view.destroy()
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.BoxWithConstraints
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Close
|
||||
import androidx.compose.material.icons.outlined.Menu
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
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.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
/** A page the bottom screen can show while the game runs on the main screen. */
|
||||
class BottomPage(
|
||||
val id: String,
|
||||
@StringRes val label: Int,
|
||||
val icon: ImageVector,
|
||||
val content: @Composable () -> Unit,
|
||||
)
|
||||
|
||||
internal fun pickBottomPage(remembered: String?, ids: List<String>): String? =
|
||||
ids.firstOrNull { it == remembered } ?: ids.firstOrNull { it == DEFAULT_PAGE } ?: ids.firstOrNull()
|
||||
|
||||
/**
|
||||
* The tab picked during one session. Each Steam session starts with no pick, so the dashboard opens on Chat; reopened
|
||||
* later in the same session it shows the tab picked last.
|
||||
*/
|
||||
internal object SessionBottomTab {
|
||||
private var session: String? = null
|
||||
private var tab: String? = null
|
||||
|
||||
@Synchronized
|
||||
fun picked(sessionId: String?): String? = tab.takeIf { sessionId != null && sessionId == session }
|
||||
|
||||
@Synchronized
|
||||
fun pick(sessionId: String?, id: String) {
|
||||
session = sessionId
|
||||
tab = id
|
||||
}
|
||||
}
|
||||
|
||||
/** The page a game start switches to; not remembered as the user's pick. */
|
||||
internal fun pageForGameStart(ids: List<String>): String? = GAME_PAGE.takeIf { it in ids }
|
||||
|
||||
private const val DEFAULT_PAGE = "chat"
|
||||
private const val GAME_PAGE = "telemetry"
|
||||
|
||||
/** Tabs show their names while every tab still fits at [TAB_WIDTH]; otherwise only the open tab keeps its name. */
|
||||
internal fun bottomTabsWithLabels(widthDp: Float, tabs: Int): Boolean = tabs * TAB_WIDTH + 2 * BAR_BUTTON <= widthDp
|
||||
|
||||
private const val TAB_WIDTH = 132f
|
||||
private const val BAR_BUTTON = 56f
|
||||
|
||||
@Composable
|
||||
fun BottomDashboard(
|
||||
pages: List<BottomPage>,
|
||||
remembered: String?,
|
||||
onPage: (String) -> Unit,
|
||||
onClose: () -> Unit,
|
||||
onMenu: (() -> Unit)?,
|
||||
gameStarts: Int = 0,
|
||||
) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
var current by remember { mutableStateOf(pickBottomPage(remembered, pages.map { it.id })) }
|
||||
val startsWhenOpened = remember { gameStarts }
|
||||
LaunchedEffect(gameStarts) {
|
||||
if (gameStarts != startsWhenOpened) pageForGameStart(pages.map { it.id })?.let { current = it }
|
||||
}
|
||||
val page = pages.firstOrNull { it.id == current } ?: pages.firstOrNull()
|
||||
BoxWithConstraints(Modifier.fillMaxSize().background(colors.background)) {
|
||||
val labels = bottomTabsWithLabels(maxWidth.value, pages.size)
|
||||
Column(Modifier.fillMaxSize().padding(horizontal = 12.dp, vertical = 10.dp), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
Row(Modifier.fillMaxWidth().height(48.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
BarButton(Icons.Outlined.Close, stringResource(R.string.deck_close), "bottom-close", onClose)
|
||||
Row(Modifier.weight(1f).horizontalScroll(rememberScrollState()), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
pages.forEach { p ->
|
||||
PageTab(p, p.id == page?.id, labels) {
|
||||
current = p.id
|
||||
onPage(p.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (onMenu != null) BarButton(Icons.Outlined.Menu, stringResource(R.string.touch_droiddeck_menu), "bottom-menu", onMenu)
|
||||
}
|
||||
Box(Modifier.weight(1f).fillMaxWidth()) {
|
||||
if (page != null) page.content()
|
||||
else Text(stringResource(R.string.bottom_dashboard_empty), fontSize = 15.sp, color = colors.onSurfaceVariant,
|
||||
modifier = Modifier.align(Alignment.Center))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun BarButton(icon: ImageVector, label: String, tag: String, onClick: () -> Unit) {
|
||||
val pal = LocalPalette.current
|
||||
Box(
|
||||
Modifier.size(44.dp).clip(RoundedCornerShape(22.dp)).background(pal.surface).border(1.dp, pal.line, RoundedCornerShape(22.dp))
|
||||
.semantics { contentDescription = label }.clickable(role = Role.Button, onClick = onClick).testTag(tag),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Icon(icon, contentDescription = null, tint = MaterialTheme.colorScheme.onBackground, modifier = Modifier.size(22.dp))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PageTab(page: BottomPage, selected: Boolean, label: Boolean, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val shape = RoundedCornerShape(20.dp)
|
||||
val name = stringResource(page.label)
|
||||
Row(
|
||||
Modifier.height(44.dp).clip(shape)
|
||||
.background(if (selected) pal.signal else Color.Transparent)
|
||||
.border(1.dp, if (selected) pal.signal else pal.line, shape)
|
||||
.semantics { contentDescription = name }
|
||||
.clickable(role = Role.Tab, onClick = onClick).testTag("bottom-page-${page.id}")
|
||||
.padding(horizontal = 14.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
val tint = if (selected) colors.background else colors.onBackground
|
||||
Icon(page.icon, contentDescription = null, tint = tint, modifier = Modifier.size(20.dp))
|
||||
if (label || selected) Text(name, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = tint, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
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.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.session.SteamDownload
|
||||
import com.droiddeck.launcher.session.SteamDownloads
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import com.droiddeck.launcher.stores.download.DownloadState
|
||||
import com.droiddeck.launcher.stores.formatBytes
|
||||
import com.droiddeck.launcher.stores.formatSpeed
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
/** Bytes per second between two reads of the same download; 0 when it did not move or restarted. */
|
||||
internal fun downloadRate(previousDone: Long, previousAt: Long, done: Long, at: Long): Long =
|
||||
if (previousDone < 0L || done <= previousDone || at <= previousAt) 0L else (done - previousDone) * 1000L / (at - previousAt)
|
||||
|
||||
private const val STEAM_POLL_MS = 2_000L
|
||||
|
||||
private class SteamRow(val download: SteamDownload, val rate: Long)
|
||||
|
||||
@Composable
|
||||
fun BottomDownloadsPage() {
|
||||
val context = LocalContext.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
var steam by remember { mutableStateOf<List<SteamRow>>(emptyList()) }
|
||||
LaunchedEffect(Unit) {
|
||||
var last = emptyMap<String, Pair<Long, Long>>()
|
||||
while (true) {
|
||||
val now = System.currentTimeMillis()
|
||||
val read = withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
SteamDownloads.read(LinuxRuntime.rootDir(context), SessionState.steamLibraryMounts, SessionState.steamClientArch)
|
||||
}.getOrDefault(emptyList())
|
||||
}
|
||||
steam = read.map { d ->
|
||||
val before = last[d.appId]
|
||||
SteamRow(d, if (before == null) 0L else downloadRate(before.first, before.second, d.done, now))
|
||||
}
|
||||
last = read.associate { it.appId to (it.done to now) }
|
||||
delay(STEAM_POLL_MS)
|
||||
}
|
||||
}
|
||||
val store = StoresState.downloads.filter { it.isActive }
|
||||
if (steam.isEmpty() && store.isEmpty()) {
|
||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
Text(stringResource(R.string.bottom_downloads_none), fontSize = 15.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
return
|
||||
}
|
||||
LazyColumn(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
items(steam, key = { "steam:${it.download.appId}:${it.download.shader}" }) { row ->
|
||||
val d = row.download
|
||||
val detail = when {
|
||||
d.shader -> stringResource(R.string.bottom_downloads_shader)
|
||||
d.paused -> stringResource(R.string.bottom_downloads_paused)
|
||||
d.total <= 0L -> stringResource(R.string.bottom_downloads_queued)
|
||||
else -> listOf("${formatBytes(d.done)} / ${formatBytes(d.total)}", formatSpeed(row.rate)).filter { it.isNotEmpty() }.joinToString(" · ")
|
||||
}
|
||||
BottomDownloadRow(d.name, stringResource(R.string.bottom_downloads_steam), detail,
|
||||
if (d.total > 0L) (d.done.toFloat() / d.total).coerceIn(0f, 1f) else null)
|
||||
}
|
||||
items(store, key = { "store:${it.key}" }) { entry ->
|
||||
val e = StoresState.download(entry.key) ?: entry
|
||||
val detail = when (e.state) {
|
||||
DownloadState.PAUSED -> stringResource(R.string.bottom_downloads_paused)
|
||||
DownloadState.QUEUED -> stringResource(R.string.bottom_downloads_queued)
|
||||
else -> listOf(
|
||||
if (e.bytesTotal > 0L) "${formatBytes(e.bytesDone)} / ${formatBytes(e.bytesTotal)}" else "",
|
||||
formatSpeed(e.speedBps),
|
||||
).filter { it.isNotEmpty() }.joinToString(" · ")
|
||||
}
|
||||
BottomDownloadRow(e.name, e.store.label, detail, e.stageFraction.takeIf { it >= 0f })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun BottomDownloadRow(name: String, source: String, detail: String, fraction: Float?) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
Column(
|
||||
Modifier.fillMaxWidth().clip(RoundedCornerShape(14.dp)).background(pal.surface).padding(horizontal = 14.dp, vertical = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp),
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(name, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground,
|
||||
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
|
||||
Text(source, fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 1, modifier = Modifier.padding(start = 8.dp))
|
||||
}
|
||||
if (fraction != null) LinearProgressIndicator(progress = { fraction }, modifier = Modifier.fillMaxWidth(), color = pal.signal)
|
||||
else LinearProgressIndicator(modifier = Modifier.fillMaxWidth(), color = pal.signal)
|
||||
if (detail.isNotEmpty()) Text(detail, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.Intent
|
||||
import android.provider.Settings
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
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.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.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.BottomNotifications
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
/** DroidDeck's own switch on Android 11 and later; the list of all apps before that. */
|
||||
internal fun notificationAccessIntent(context: android.content.Context): Intent =
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
|
||||
Intent(Settings.ACTION_NOTIFICATION_LISTENER_DETAIL_SETTINGS).putExtra(
|
||||
Settings.EXTRA_NOTIFICATION_LISTENER_COMPONENT_NAME,
|
||||
android.content.ComponentName(context, com.droiddeck.launcher.session.BottomNotificationListener::class.java).flattenToString(),
|
||||
)
|
||||
} else Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS)
|
||||
|
||||
@Composable
|
||||
fun BottomNotificationsPage(openSettings: ((Intent, () -> Boolean) -> Unit)?) {
|
||||
val context = LocalContext.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
var granted by remember { mutableStateOf(BottomNotifications.granted(context)) }
|
||||
LaunchedEffect(Unit) {
|
||||
while (true) {
|
||||
granted = BottomNotifications.granted(context)
|
||||
delay(2_000L)
|
||||
}
|
||||
}
|
||||
if (!granted) {
|
||||
Column(Modifier.fillMaxSize().padding(24.dp), horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically)) {
|
||||
Text(stringResource(R.string.bottom_notifications_why), fontSize = 15.sp, color = colors.onBackground, textAlign = TextAlign.Center)
|
||||
BottomPillButton(stringResource(R.string.bottom_notifications_allow), "bottom-notifications-allow") {
|
||||
val intent = notificationAccessIntent(context)
|
||||
if (openSettings != null) openSettings(intent) { BottomNotifications.granted(context) }
|
||||
else runCatching { context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) }
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
val shown = BottomNotifications.items
|
||||
if (shown.isEmpty()) {
|
||||
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||
Text(stringResource(R.string.bottom_notifications_none), fontSize = 15.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
return
|
||||
}
|
||||
val timeFormat = remember { android.text.format.DateFormat.getTimeFormat(context) }
|
||||
Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(stringResource(R.string.bottom_notifications_count, shown.size), fontSize = 13.sp, color = colors.onSurfaceVariant,
|
||||
modifier = Modifier.weight(1f))
|
||||
BottomPillButton(stringResource(R.string.bottom_notifications_clear), "bottom-notifications-clear") { BottomNotifications.clear() }
|
||||
}
|
||||
LazyColumn(Modifier.weight(1f).fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
items(shown.toList(), key = { it.key }) { n ->
|
||||
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(14.dp)).background(pal.surface).padding(horizontal = 14.dp, vertical = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(n.app, fontSize = 12.sp, fontWeight = FontWeight.SemiBold, color = pal.signal, maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
|
||||
Text(timeFormat.format(java.util.Date(n.postedAt)), fontSize = 12.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
if (n.title.isNotBlank()) Text(n.title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground,
|
||||
maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
if (n.text.isNotBlank()) Text(n.text, fontSize = 14.sp, color = colors.onBackground, maxLines = 4, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun BottomPillButton(label: String, tag: String, onClick: () -> Unit) {
|
||||
val pal = LocalPalette.current
|
||||
Box(
|
||||
Modifier.height(40.dp).clip(RoundedCornerShape(20.dp)).background(pal.signal.copy(alpha = 0.16f))
|
||||
.clickable(role = Role.Button, onClick = onClick).testTag(tag).padding(horizontal = 16.dp),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text(label, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = pal.signal, maxLines = 1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Download
|
||||
import androidx.compose.material.icons.outlined.Forum
|
||||
import androidx.compose.material.icons.outlined.Speed
|
||||
import androidx.compose.material.icons.outlined.Notifications
|
||||
import androidx.compose.material.icons.outlined.PhotoLibrary
|
||||
import com.droiddeck.launcher.R
|
||||
|
||||
/** What the bottom-screen pages can ask the running session to do. */
|
||||
class BottomPageActions(
|
||||
val takeScreenshot: ((onDone: (Boolean) -> Unit) -> Unit)? = null,
|
||||
val fps: () -> Float? = { null },
|
||||
/** Opens an Android settings page on the bottom screen; the dashboard comes back once [done] is true. */
|
||||
val openSettings: ((intent: android.content.Intent, done: () -> Boolean) -> Unit)? = null,
|
||||
/** The focused game's Steam app id as text (or another key for non-Steam programs); null in the Steam menus. */
|
||||
val runningGame: () -> String? = { null },
|
||||
)
|
||||
|
||||
/** The pages the bottom-screen dashboard offers during a session, in tab order. */
|
||||
fun sessionBottomPages(actions: BottomPageActions): List<BottomPage> = listOf(
|
||||
BottomPage("telemetry", R.string.bottom_page_telemetry, Icons.Outlined.Speed) { BottomTelemetryPage(actions.fps, actions.runningGame) },
|
||||
BottomPage("downloads", R.string.bottom_page_downloads, Icons.Outlined.Download) { BottomDownloadsPage() },
|
||||
BottomPage("notifications", R.string.bottom_page_notifications, Icons.Outlined.Notifications) { BottomNotificationsPage(actions.openSettings) },
|
||||
BottomPage("screenshots", R.string.bottom_page_screenshots, Icons.Outlined.PhotoLibrary) { BottomScreenshotsPage(actions.takeScreenshot) },
|
||||
BottomPage("chat", R.string.bottom_page_chat, Icons.Outlined.Forum) { BottomChatPage() },
|
||||
)
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.grid.GridCells
|
||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||
import androidx.compose.foundation.lazy.grid.items
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
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.layout.ContentScale
|
||||
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.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import coil.compose.AsyncImage
|
||||
import coil.request.ImageRequest
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.BottomScreenshots
|
||||
import com.droiddeck.launcher.session.BottomShot
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
private const val SHOTS_POLL_MS = 5_000L
|
||||
|
||||
@Composable
|
||||
fun BottomScreenshotsPage(takeScreenshot: ((onDone: (Boolean) -> Unit) -> Unit)?) {
|
||||
val context = LocalContext.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
var shots by remember { mutableStateOf<List<BottomShot>>(emptyList()) }
|
||||
var refresh by remember { mutableIntStateOf(0) }
|
||||
var open by remember { mutableStateOf<BottomShot?>(null) }
|
||||
var status by remember { mutableStateOf<Int?>(null) }
|
||||
var busy by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(refresh) {
|
||||
while (true) {
|
||||
shots = withContext(Dispatchers.IO) { BottomScreenshots.list(context, LinuxRuntime.rootDir(context)) }
|
||||
delay(SHOTS_POLL_MS)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(status) {
|
||||
if (status != null) {
|
||||
delay(3_000L)
|
||||
status = null
|
||||
}
|
||||
}
|
||||
open?.let { shot ->
|
||||
Box(Modifier.fillMaxSize().clip(RoundedCornerShape(14.dp)).background(androidx.compose.ui.graphics.Color.Black)
|
||||
.clickable(role = Role.Button) { open = null }.testTag("bottom-shot-full")) {
|
||||
AsyncImage(ImageRequest.Builder(context).data(shot.model).build(), contentDescription = null,
|
||||
contentScale = ContentScale.Fit, modifier = Modifier.fillMaxSize())
|
||||
}
|
||||
return
|
||||
}
|
||||
Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(status?.let { stringResource(it) } ?: stringResource(R.string.bottom_shots_where), fontSize = 13.sp,
|
||||
color = colors.onSurfaceVariant, maxLines = 2, modifier = Modifier.weight(1f).padding(end = 8.dp))
|
||||
if (takeScreenshot != null) BottomPillButton(stringResource(R.string.bottom_shots_take), "bottom-shots-take") {
|
||||
if (!busy) {
|
||||
busy = true
|
||||
takeScreenshot { ok ->
|
||||
busy = false
|
||||
status = if (ok) R.string.bottom_shots_saved else R.string.bottom_shots_failed
|
||||
refresh++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shots.isEmpty()) {
|
||||
Box(Modifier.weight(1f).fillMaxWidth(), contentAlignment = Alignment.Center) {
|
||||
Text(stringResource(R.string.bottom_shots_none), fontSize = 15.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
} else {
|
||||
LazyVerticalGrid(GridCells.Adaptive(150.dp), Modifier.weight(1f).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
items(shots, key = { it.model.toString() }) { shot ->
|
||||
AsyncImage(
|
||||
ImageRequest.Builder(context).data(shot.model).size(480, 270).build(), contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier.fillMaxWidth().aspectRatio(16f / 9f).clip(RoundedCornerShape(10.dp))
|
||||
.background(LocalPalette.current.surface).clickable(role = Role.Button) { open = shot },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,404 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import android.content.res.Resources
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.selection.toggleable
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.SwitchDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.hud.HudMetrics
|
||||
import com.droiddeck.launcher.hud.MangoReadings
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.GameStatusFiles
|
||||
import com.droiddeck.launcher.session.GameTelemetry
|
||||
import com.droiddeck.launcher.input.SteamTouchConfig
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.session.SpeedUnit
|
||||
import com.droiddeck.launcher.session.StatsDash
|
||||
import com.droiddeck.launcher.session.StatsStrip
|
||||
import com.droiddeck.launcher.session.Telemetry
|
||||
import com.droiddeck.launcher.session.TelemetryOutput
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
import java.net.DatagramPacket
|
||||
import java.net.DatagramSocket
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.InetSocketAddress
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.URL
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
private const val DRAW_MS = 66L
|
||||
private const val TELEMETRY_STALE_MS = 3_000L
|
||||
private const val METRICS_MS = 1_000L
|
||||
private const val THUNDER_MS = 500L
|
||||
private const val THUNDER_RETRY_MS = 3_000L
|
||||
private const val ELITE_MS = 1_000L
|
||||
private const val ELITE_SEARCH_MS = 10_000L
|
||||
private const val OUTPUT_SCAN_MS = 3_000L
|
||||
/** Top strip history: one reading a second for 30 s. */
|
||||
private const val PERF_N = 30
|
||||
|
||||
/** What arrives on one telemetry port; written only by that port's listener. */
|
||||
private class PortTraffic {
|
||||
@Volatile var packets = 0L
|
||||
@Volatile var length = 0
|
||||
@Volatile var readable = true
|
||||
}
|
||||
|
||||
private data class UnknownTraffic(val port: Int, val packets: Long, val length: Int)
|
||||
|
||||
@Composable
|
||||
fun BottomTelemetryPage(fps: () -> Float?, runningGame: () -> String? = { null }) {
|
||||
val context = LocalContext.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val scope = rememberCoroutineScope()
|
||||
var outputs by remember { mutableStateOf<List<TelemetryOutput.Game>>(emptyList()) }
|
||||
var menuGames by remember { mutableStateOf<List<TelemetryOutput.MenuGame>>(emptyList()) }
|
||||
var running by remember { mutableStateOf<String?>(null) }
|
||||
var gameName by remember { mutableStateOf<String?>(null) }
|
||||
val steamClient = remember { if (SessionState.mode == SessionService.MODE_STEAM) SessionPrefs.activeSteamClientArch(context) else null }
|
||||
var outputFailed by remember { mutableStateOf<String?>(null) }
|
||||
var rescan by remember { mutableIntStateOf(0) }
|
||||
var auto by remember { mutableStateOf(SessionPrefs.telemetryAuto(context)) }
|
||||
val latest = remember { AtomicReference<Pair<Long, Telemetry>?>(null) }
|
||||
var race by remember { mutableStateOf<Telemetry?>(null) }
|
||||
var fpsNow by remember { mutableStateOf<Float?>(null) }
|
||||
var device by remember { mutableStateOf<HudMetrics.Snapshot?>(null) }
|
||||
var thunder by remember { mutableStateOf<List<Pair<String, String>>>(emptyList()) }
|
||||
var elite by remember { mutableStateOf<GameStatusFiles.Elite?>(null) }
|
||||
var busyPorts by remember { mutableStateOf<Set<Int>>(emptySet()) }
|
||||
val traffic = remember { GameTelemetry.PORTS.associateWith { PortTraffic() } }
|
||||
var unknown by remember { mutableStateOf<List<UnknownTraffic>>(emptyList()) }
|
||||
var strip by remember { mutableStateOf(StatsStrip.from(SessionPrefs.statsStrip(context))) }
|
||||
var dash by remember { mutableStateOf(StatsDash.from(SessionPrefs.statsDash(context))) }
|
||||
var speedUnit by remember { mutableStateOf(SpeedUnit.from(SessionPrefs.statsSpeedUnit(context))) }
|
||||
val shownUnit = speedUnit.resolve(Resources.getSystem().configuration.locales[0].country)
|
||||
val fpsHistory = remember { History(PERF_N) }
|
||||
val cpuHistory = remember { History(PERF_N) }
|
||||
val gpuHistory = remember { History(PERF_N) }
|
||||
val wattsHistory = remember { History(PERF_N) }
|
||||
val throttleTrace = remember { History(TRACE_N) }
|
||||
val brakeTrace = remember { History(TRACE_N) }
|
||||
val speedTrace = remember { History(TRACE_N) }
|
||||
var perfTick by remember { mutableIntStateOf(0) }
|
||||
var traceTick by remember { mutableIntStateOf(0) }
|
||||
var clock by remember { mutableStateOf("") }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
for (port in GameTelemetry.PORTS) launch(Dispatchers.IO) {
|
||||
val socket = runCatching {
|
||||
DatagramSocket(null).apply {
|
||||
reuseAddress = true
|
||||
soTimeout = 500
|
||||
bind(InetSocketAddress(GameTelemetry.LISTEN_ADDRESS, port))
|
||||
}
|
||||
}.getOrNull()
|
||||
if (socket == null) {
|
||||
withContext(Dispatchers.Main) { busyPorts = busyPorts + port }
|
||||
return@launch
|
||||
}
|
||||
val seen = traffic.getValue(port)
|
||||
socket.use {
|
||||
val data = ByteArray(2048)
|
||||
val packet = DatagramPacket(data, data.size)
|
||||
while (isActive) {
|
||||
try {
|
||||
packet.length = data.size
|
||||
it.receive(packet)
|
||||
val t = GameTelemetry.parse(port, data, packet.length)
|
||||
seen.packets++
|
||||
seen.length = packet.length
|
||||
seen.readable = t != null
|
||||
if (t != null) latest.set(System.currentTimeMillis() to t)
|
||||
} catch (_: SocketTimeoutException) {
|
||||
} catch (_: java.io.IOException) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (isActive) {
|
||||
val reading = latest.get()
|
||||
race = reading?.takeIf { System.currentTimeMillis() - it.first < TELEMETRY_STALE_MS }?.second
|
||||
race?.let { r ->
|
||||
throttleTrace.add(r.throttle ?: 0f)
|
||||
brakeTrace.add(r.brake ?: 0f)
|
||||
speedTrace.add(r.speedKmh ?: 0f)
|
||||
traceTick++
|
||||
}
|
||||
fpsNow = fps()
|
||||
unknown = traffic.filter { (_, t) -> t.packets > 0 && !t.readable }.map { (port, t) -> UnknownTraffic(port, t.packets, t.length) }
|
||||
delay(DRAW_MS)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(Unit) {
|
||||
val metrics = HudMetrics(context).apply { setMangoReadings(MangoReadings(File(context.filesDir, "session"), LinuxRuntime.rootDir(context))) }
|
||||
while (isActive) {
|
||||
device = withContext(Dispatchers.IO) { runCatching { metrics.snapshot() }.getOrNull() }
|
||||
fps()?.takeIf { it > 0f }?.let { fpsHistory.add(it) }
|
||||
device?.let { s ->
|
||||
s.cpuPercent?.let { cpuHistory.add(it.toFloat()) }
|
||||
s.gpuPercent?.let { gpuHistory.add(it.toFloat()) }
|
||||
s.battery?.watts?.takeIf { it > 0f }?.let { wattsHistory.add(it) }
|
||||
}
|
||||
clock = java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT).format(java.util.Date())
|
||||
perfTick++
|
||||
delay(METRICS_MS)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(Unit) {
|
||||
while (isActive) {
|
||||
val rows = withContext(Dispatchers.IO) { runCatching { GameStatusFiles.warThunder(httpGet(GameStatusFiles.WAR_THUNDER_STATE)) }.getOrNull() }
|
||||
thunder = rows.orEmpty()
|
||||
delay(if (rows == null) THUNDER_RETRY_MS else THUNDER_MS)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(Unit) {
|
||||
var file: File? = null
|
||||
var searchedAt = 0L
|
||||
while (isActive) {
|
||||
val now = System.currentTimeMillis()
|
||||
if (file == null && now - searchedAt > ELITE_SEARCH_MS) {
|
||||
searchedAt = now
|
||||
file = withContext(Dispatchers.IO) {
|
||||
runCatching { GameStatusFiles.eliteStatusFile(LinuxRuntime.rootDir(context), SessionState.steamLibraryMounts) }.getOrNull()
|
||||
}
|
||||
}
|
||||
val f = file
|
||||
// Status.json changes while Elite runs; one older than a minute belongs to an earlier session.
|
||||
elite = if (f != null && now - f.lastModified() < 60_000L) {
|
||||
withContext(Dispatchers.IO) { runCatching { GameStatusFiles.elite(f.readText()) }.getOrNull() }
|
||||
} else null
|
||||
delay(ELITE_MS)
|
||||
}
|
||||
}
|
||||
LaunchedEffect(Unit) {
|
||||
menuGames = withContext(Dispatchers.IO) {
|
||||
runCatching { Library.steamGames(context).mapNotNull { TelemetryOutput.MENU_GAMES[it.appId] }.distinct() }.getOrDefault(emptyList())
|
||||
}
|
||||
}
|
||||
LaunchedEffect(running) {
|
||||
val id = running?.toLongOrNull()
|
||||
gameName = if (id == null) null
|
||||
else withContext(Dispatchers.IO) { runCatching { SteamTouchConfig.gameName(context, id.toInt()) }.getOrNull() }
|
||||
}
|
||||
LaunchedEffect(rescan) {
|
||||
while (isActive) {
|
||||
outputs = withContext(Dispatchers.IO) { runCatching { TelemetryOutput.scan(Library.compatdataDirs(context)) }.getOrDefault(emptyList()) }
|
||||
running = runningGame()
|
||||
delay(OUTPUT_SCAN_MS)
|
||||
}
|
||||
}
|
||||
|
||||
Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
perfTick.let {
|
||||
StatsStripView(strip, StripData(fpsNow, device, fpsHistory.snapshot(), cpuHistory.snapshot(), gpuHistory.snapshot(), wattsHistory.snapshot(), clock,
|
||||
if (running != null) gameName else steamClient?.let { stringResource(steamClientLabel(it)) })) {
|
||||
strip = strip.next()
|
||||
SessionPrefs.setStatsStrip(context, strip.id)
|
||||
}
|
||||
}
|
||||
race?.let { r ->
|
||||
val shown = dash.resolve(r.source)
|
||||
traceTick.let {
|
||||
RaceDashView(shown, r, TraceData(throttleTrace.snapshot(), brakeTrace.snapshot(), speedTrace.snapshot()), shownUnit) {
|
||||
dash = StatsDash.tapped(shown)
|
||||
SessionPrefs.setStatsDash(context, dash.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (thunder.isNotEmpty()) {
|
||||
if (FlightLabels.drawable(thunder)) FlightDash(thunder)
|
||||
else TelemetryCard(stringResource(R.string.bottom_telemetry_war_thunder)) { ValueGrid(thunder.take(GameStatusFiles.WAR_THUNDER_ROWS)) }
|
||||
}
|
||||
elite?.let { e ->
|
||||
if (e.pips != null || e.fuelMain != null) ShipDash(e)
|
||||
else TelemetryCard(stringResource(R.string.bottom_telemetry_elite)) {
|
||||
ValueGrid(listOfNotNull(
|
||||
e.fuelMain?.let { stringResource(R.string.bottom_telemetry_fuel) to "%.1f t".format(it) },
|
||||
e.cargo?.let { stringResource(R.string.bottom_telemetry_cargo) to "%.0f t".format(it) },
|
||||
e.pips?.takeIf { it.size == 3 }?.let { p ->
|
||||
stringResource(R.string.bottom_telemetry_pips) to p.joinToString(" · ") { "%.1f".format(it / 2f) }
|
||||
},
|
||||
e.legal?.let { stringResource(R.string.bottom_telemetry_legal) to it },
|
||||
e.balance?.let { stringResource(R.string.bottom_telemetry_balance) to "%,d CR".format(it) },
|
||||
))
|
||||
}
|
||||
}
|
||||
if (race == null && thunder.isEmpty() && elite == null) {
|
||||
Text(stringResource(R.string.bottom_telemetry_help),
|
||||
fontSize = 14.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 4.dp))
|
||||
}
|
||||
if (outputs.isNotEmpty() || menuGames.isNotEmpty()) TelemetryCard(stringResource(R.string.bottom_telemetry_send_title)) {
|
||||
if (outputs.isNotEmpty()) SwitchRow(stringResource(R.string.bottom_telemetry_send_auto), stringResource(R.string.bottom_telemetry_send_auto_hint), auto, true) { want ->
|
||||
scope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
SessionPrefs.setTelemetryAuto(context, want)
|
||||
if (want) TelemetryOutput.applyAutomatic(context, running)
|
||||
else TelemetryOutput.restoreTargets(outputs, running).forEach { TelemetryOutput.set(it, false) }
|
||||
}
|
||||
auto = want
|
||||
rescan++
|
||||
}
|
||||
}
|
||||
for (game in outputs) {
|
||||
val locked = TelemetryOutput.isRunning(game.prefixId, running)
|
||||
val hint = if (locked) stringResource(R.string.bottom_telemetry_send_close, game.name) else null
|
||||
SwitchRow(game.name, hint, game.on, !locked) { want ->
|
||||
scope.launch {
|
||||
val ok = withContext(Dispatchers.IO) {
|
||||
val key = TelemetryOutput.key(game)
|
||||
val off = SessionPrefs.telemetryOff(context)
|
||||
SessionPrefs.setTelemetryOff(context, if (want) off - key else off + key)
|
||||
TelemetryOutput.set(game, want)
|
||||
}
|
||||
outputFailed = if (ok) null else game.name
|
||||
rescan++
|
||||
}
|
||||
}
|
||||
}
|
||||
for (game in menuGames) {
|
||||
Text(stringResource(R.string.bottom_telemetry_send_menu, game.name, game.setting, game.port), fontSize = 13.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
if (outputs.isNotEmpty()) Text(stringResource(R.string.bottom_telemetry_send_note), fontSize = 12.sp, color = colors.onSurfaceVariant)
|
||||
outputFailed?.let { Text(stringResource(R.string.bottom_telemetry_send_failed, it), fontSize = 12.sp, color = colors.error) }
|
||||
}
|
||||
for (u in unknown) {
|
||||
Text(stringResource(R.string.bottom_telemetry_unknown_format, u.port, u.packets, u.length), fontSize = 13.sp,
|
||||
color = colors.error, modifier = Modifier.padding(horizontal = 4.dp))
|
||||
}
|
||||
if (busyPorts.isNotEmpty()) {
|
||||
Text(stringResource(R.string.bottom_telemetry_port_busy, busyPorts.sorted().joinToString()), fontSize = 13.sp,
|
||||
color = colors.error, modifier = Modifier.padding(horizontal = 4.dp))
|
||||
}
|
||||
ChoiceRow(stringResource(R.string.stats_speed_units),
|
||||
if (speedUnit == SpeedUnit.AUTO) stringResource(R.string.stats_speed_units_auto, shownUnit.label) else speedUnit.label) {
|
||||
speedUnit = speedUnit.next()
|
||||
SessionPrefs.setStatsSpeedUnit(context, speedUnit.id)
|
||||
}
|
||||
Text(stringResource(R.string.stats_tap_hint), fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 4.dp))
|
||||
}
|
||||
}
|
||||
|
||||
private fun httpGet(url: String): String {
|
||||
val c = URL(url).openConnection() as HttpURLConnection
|
||||
c.connectTimeout = 300
|
||||
c.readTimeout = 500
|
||||
return try {
|
||||
c.inputStream.bufferedReader().use { it.readText() }
|
||||
} finally {
|
||||
c.disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** The Steam client the session runs, shown in the strip's top line while no game runs. */
|
||||
internal fun steamClientLabel(arch: String): Int = if (arch == "x86_64") R.string.stats_steam_client_x86 else R.string.stats_steam_client_arm
|
||||
|
||||
@Composable
|
||||
private fun ChoiceRow(title: String, value: String, onClick: () -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Row(Modifier.fillMaxWidth().clickable(role = Role.Button, onClick = onClick).padding(horizontal = 4.dp, vertical = 6.dp),
|
||||
verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(title, fontSize = 15.sp, color = colors.onBackground, modifier = Modifier.weight(1f))
|
||||
Text(value, fontSize = 15.sp, fontWeight = FontWeight.Bold, color = LocalPalette.current.primary)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SwitchRow(title: String, hint: String?, checked: Boolean, enabled: Boolean, onChange: (Boolean) -> Unit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Row(
|
||||
Modifier.fillMaxWidth().toggleable(checked, enabled = enabled, role = Role.Switch, onValueChange = onChange).padding(vertical = 4.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Column(Modifier.weight(1f).padding(end = 12.dp)) {
|
||||
Text(title, fontSize = 15.sp, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
if (hint != null) Text(hint, fontSize = 12.sp, color = colors.onSurfaceVariant)
|
||||
}
|
||||
val pal = LocalPalette.current
|
||||
Switch(checked, null, enabled = enabled, colors = SwitchDefaults.colors(
|
||||
disabledCheckedTrackColor = pal.primary.copy(alpha = 0.45f),
|
||||
disabledCheckedThumbColor = colors.background,
|
||||
disabledCheckedBorderColor = pal.primary.copy(alpha = 0.45f),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Composable
|
||||
private fun TelemetryCard(title: String, content: @Composable () -> Unit) {
|
||||
val pal = LocalPalette.current
|
||||
Column(Modifier.fillMaxWidth().clip(RoundedCornerShape(14.dp)).background(pal.surface).padding(12.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Text(title, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, color = pal.signal)
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ValueGrid(rows: List<Pair<String, String>>) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
rows.chunked(2).forEach { pair ->
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
pair.forEach { (k, v) ->
|
||||
Row(Modifier.weight(1f)) {
|
||||
Text(k, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
|
||||
Text(v, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1)
|
||||
}
|
||||
}
|
||||
if (pair.size == 1) Box(Modifier.weight(1f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun lapTime(seconds: Float): String {
|
||||
val total = kotlin.math.round(seconds * 1000.0).toLong()
|
||||
return "%d:%02d.%03d".format(total / 60_000, total / 1000 % 60, total % 1000)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+17
-17
@@ -4,11 +4,11 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.hud.FusionSize
|
||||
import com.droiddeck.launcher.hud.DroidDeckHudSize
|
||||
|
||||
/** Bannerlator's Fusion HUD settings (DeckOverlaySettings): one row per key of the HUD's config string. */
|
||||
/** Bannerlator's DroidDeck HUD settings (DeckOverlaySettings): one row per key of the HUD's config string. */
|
||||
@Composable
|
||||
internal fun FusionHudSettings(host: MenuHost, a: DrawerActions, track: (String) -> Modifier) {
|
||||
internal fun DroidDeckHudSettings(host: MenuHost, a: DrawerActions, track: (String) -> Modifier) {
|
||||
val cfg = a.hudConfig
|
||||
fun on(key: String) = cfg[key] == "1"
|
||||
fun int(key: String, fallback: Int) = cfg[key]?.toIntOrNull() ?: fallback
|
||||
@@ -16,14 +16,14 @@ internal fun FusionHudSettings(host: MenuHost, a: DrawerActions, track: (String)
|
||||
SettingsGroup(stringResource(R.string.drawer_hud)) {
|
||||
ToggleRow(host, "hud", stringResource(R.string.drawer_hud), null, a.hudOn, chipModifier = track("hud"), onChange = a.onHud)
|
||||
if (!a.hudOn) return@SettingsGroup
|
||||
val size = FusionSize.from(cfg["hudSize"])
|
||||
val size = DroidDeckHudSize.from(cfg["hudSize"])
|
||||
ChoiceRow(host, "hud-size", stringResource(R.string.hud_size), stringResource(R.string.hud_size_hint),
|
||||
listOf(
|
||||
FusionSize.FULL to stringResource(R.string.hud_size_full),
|
||||
FusionSize.TILES to stringResource(R.string.hud_size_tiles),
|
||||
FusionSize.PILL to stringResource(R.string.hud_size_pill),
|
||||
FusionSize.MINIMAL to stringResource(R.string.hud_size_minimal),
|
||||
FusionSize.MEGA to stringResource(R.string.hud_size_mega),
|
||||
DroidDeckHudSize.FULL to stringResource(R.string.hud_size_full),
|
||||
DroidDeckHudSize.TILES to stringResource(R.string.hud_size_tiles),
|
||||
DroidDeckHudSize.PILL to stringResource(R.string.hud_size_pill),
|
||||
DroidDeckHudSize.MINIMAL to stringResource(R.string.hud_size_minimal),
|
||||
DroidDeckHudSize.MEGA to stringResource(R.string.hud_size_mega),
|
||||
),
|
||||
size, chipModifier = track("hud-size")) { a.onHudSetting("hudSize", it.token) }
|
||||
ToggleRow(host, "hud-locked", stringResource(R.string.hud_locked), stringResource(R.string.hud_locked_hint), on("hudLocked"),
|
||||
@@ -47,7 +47,7 @@ internal fun FusionHudSettings(host: MenuHost, a: DrawerActions, track: (String)
|
||||
if (cfg["hudOutlineAccent"] == "0") "0" else "1", chipModifier = track("hud-outline-color")) { a.onHudSetting("hudOutlineAccent", it) }
|
||||
}
|
||||
|
||||
val size = FusionSize.from(cfg["hudSize"])
|
||||
val size = DroidDeckHudSize.from(cfg["hudSize"])
|
||||
val chips = size.supportedChips() + EXTRA[size].orEmpty()
|
||||
SettingsGroup(stringResource(R.string.hud_group_metrics)) {
|
||||
for (metric in METRICS) {
|
||||
@@ -84,7 +84,7 @@ internal fun FusionHudSettings(host: MenuHost, a: DrawerActions, track: (String)
|
||||
}
|
||||
}
|
||||
|
||||
SettingsGroup(stringResource(R.string.hud_group_more), detail = stringResource(R.string.hud_credit)) {
|
||||
SettingsGroup(stringResource(R.string.hud_group_more)) {
|
||||
ActionRow(stringResource(R.string.hud_export), stringResource(R.string.hud_export_hint),
|
||||
stringResource(R.string.hud_export_button), onClick = a.onHudExport, modifier = track("hud-export"))
|
||||
ActionRow(stringResource(R.string.hud_reset), null, stringResource(R.string.hud_reset_button),
|
||||
@@ -95,11 +95,11 @@ internal fun FusionHudSettings(host: MenuHost, a: DrawerActions, track: (String)
|
||||
private fun flag(on: Boolean) = if (on) "1" else "0"
|
||||
|
||||
// The Pill also draws the battery temperature and watts.
|
||||
private val EXTRA = mapOf(FusionSize.PILL to setOf("Temp", "Power"))
|
||||
private val EXTRA = mapOf(DroidDeckHudSize.PILL to setOf("Temp", "Power"))
|
||||
|
||||
private class HudMetric(val chip: String, val key: String, val label: Int)
|
||||
|
||||
// FusionSize.supportedChips() names; Wrapper and DX version have nothing to show in DroidDeck.
|
||||
// DroidDeckHudSize.supportedChips() names; Wrapper and DX version have nothing to show in DroidDeck.
|
||||
private val METRICS = listOf(
|
||||
HudMetric("FPS", "showFPS", R.string.drawer_hud_fps),
|
||||
HudMetric("FPS graph", "showFPSGraph", R.string.hud_metric_graph),
|
||||
@@ -124,10 +124,10 @@ private val METRICS = listOf(
|
||||
HudMetric("Clock", "showClock", R.string.hud_metric_clock),
|
||||
)
|
||||
|
||||
// Switches a size lists but never draws (FusionHudView): the Pill and Minimal always show the FPS, the
|
||||
// Switches a size lists but never draws (DroidDeckHudView): the Pill and Minimal always show the FPS, the
|
||||
// Pill has no graph, Tiles has no graph and no 0.01% low.
|
||||
private val HIDDEN = mapOf(
|
||||
FusionSize.PILL to setOf("FPS", "FPS graph"),
|
||||
FusionSize.MINIMAL to setOf("FPS"),
|
||||
FusionSize.TILES to setOf("FPS graph", "0.01% low"),
|
||||
DroidDeckHudSize.PILL to setOf("FPS", "FPS graph"),
|
||||
DroidDeckHudSize.MINIMAL to setOf("FPS"),
|
||||
DroidDeckHudSize.TILES to setOf("FPS graph", "0.01% low"),
|
||||
)
|
||||
@@ -70,6 +70,7 @@ object DualScreenPanel {
|
||||
set(value) { field = value; available = value || activity != null }
|
||||
private var ownerTask = -1
|
||||
private var ownerYielded = false
|
||||
private var ownerPaused = false
|
||||
|
||||
var typing by mutableStateOf<TypingRequest?>(null)
|
||||
private set
|
||||
@@ -120,6 +121,7 @@ object DualScreenPanel {
|
||||
displayId = display
|
||||
ownerTask = task
|
||||
ownerYielded = false
|
||||
ownerPaused = false
|
||||
launching = true
|
||||
val intent = Intent(context, DualScreenActivity::class.java)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK or Intent.FLAG_ACTIVITY_NO_ANIMATION)
|
||||
@@ -153,15 +155,29 @@ object DualScreenPanel {
|
||||
if (ownerTask == task) ownerYielded = app
|
||||
}
|
||||
|
||||
internal fun returnFocus(context: Context) {
|
||||
if (ownerYielded) return
|
||||
val task = ownerTask.takeIf { it >= 0 } ?: return
|
||||
fun opensOutside(own: String, target: String?): Boolean = target != null && target != own
|
||||
|
||||
fun ownerPaused(task: Int, paused: Boolean) {
|
||||
if (ownerTask == task) ownerPaused = paused
|
||||
}
|
||||
|
||||
internal fun focusTask(fromPanel: Boolean): Int? {
|
||||
if (ownerYielded || (ownerPaused && !fromPanel)) return null
|
||||
return ownerTask.takeIf { it >= 0 }
|
||||
}
|
||||
|
||||
internal fun tookFocus(fresh: Boolean, touchedAt: Long, now: Long): Boolean =
|
||||
fresh || now - touchedAt in 0..TOUCH_FOCUS_MS
|
||||
|
||||
private const val TOUCH_FOCUS_MS = 1000L
|
||||
|
||||
internal fun returnFocus(context: Context, fromPanel: Boolean = false) {
|
||||
val task = focusTask(fromPanel) ?: return
|
||||
runCatching { (context.getSystemService(Context.ACTIVITY_SERVICE) as android.app.ActivityManager).moveTaskToFront(task, 0) }
|
||||
}
|
||||
|
||||
internal fun reclaimFocus(context: Context) {
|
||||
if (ownerYielded) return
|
||||
val task = ownerTask.takeIf { it >= 0 } ?: return
|
||||
val task = focusTask(false) ?: return
|
||||
val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as android.app.ActivityManager
|
||||
runCatching {
|
||||
manager.appTasks.firstOrNull {
|
||||
@@ -209,10 +225,10 @@ class DualScreenActivity : ComponentActivity() {
|
||||
runCatching { (getSystemService(ACTIVITY_SERVICE) as android.app.ActivityManager).moveTaskToFront(taskId, 0) }
|
||||
} else {
|
||||
unfocusPending = true
|
||||
DualScreenPanel.returnFocus(this)
|
||||
DualScreenPanel.returnFocus(this, fromPanel = true)
|
||||
window.decorView.postDelayed({
|
||||
if (!unfocusPending || DualScreenPanel.typingShown) return@postDelayed
|
||||
if (window.decorView.hasWindowFocus()) DualScreenPanel.returnFocus(this) else dropFocus()
|
||||
if (window.decorView.hasWindowFocus()) DualScreenPanel.returnFocus(this, fromPanel = true) else dropFocus()
|
||||
}, 400)
|
||||
}
|
||||
}
|
||||
@@ -228,9 +244,24 @@ class DualScreenActivity : ComponentActivity() {
|
||||
if (!DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this)
|
||||
}
|
||||
|
||||
private var topResumed = false
|
||||
private var fresh = true
|
||||
private var touchedAt = Long.MIN_VALUE
|
||||
|
||||
override fun onTopResumedActivityChanged(isTopResumedActivity: Boolean) {
|
||||
super.onTopResumedActivityChanged(isTopResumedActivity)
|
||||
if (isTopResumedActivity && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this)
|
||||
topResumed = isTopResumedActivity
|
||||
val took = DualScreenPanel.tookFocus(fresh, touchedAt, android.os.SystemClock.uptimeMillis())
|
||||
fresh = false
|
||||
if (isTopResumedActivity && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this, fromPanel = took)
|
||||
}
|
||||
|
||||
override fun dispatchTouchEvent(event: android.view.MotionEvent): Boolean {
|
||||
if (event.actionMasked == android.view.MotionEvent.ACTION_DOWN) {
|
||||
touchedAt = event.downTime
|
||||
if (topResumed && !DualScreenPanel.typingShown) DualScreenPanel.returnFocus(this, fromPanel = true)
|
||||
}
|
||||
return super.dispatchTouchEvent(event)
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
@@ -251,6 +282,7 @@ class DualScreenActivity : ComponentActivity() {
|
||||
if (event.action == KeyEvent.ACTION_UP && !event.isCanceled) DualScreenPanel.finishTyping()
|
||||
return true
|
||||
}
|
||||
if (topResumed && !DualScreenPanel.typingShown && event.action == KeyEvent.ACTION_DOWN) DualScreenPanel.returnFocus(this, fromPanel = true)
|
||||
return super.dispatchKeyEvent(event)
|
||||
}
|
||||
|
||||
|
||||
@@ -465,7 +465,8 @@ private fun UserAppPage(app: UserApps.App, s: FrontEndState, a: FrontEndActions,
|
||||
val ctx = LocalContext.current
|
||||
val narrow = LocalNarrowPane.current
|
||||
var editing by rememberSaveable(app.key) { mutableStateOf(false) }
|
||||
val x86 = (app.arch == "x86_64" || app.arch == "i386") && app.fex != com.droiddeck.launcher.runtime.LinuxFex.OFF
|
||||
val x86 = (app.arch == "x86_64" || app.arch == "i386") && app.fex != com.droiddeck.launcher.runtime.LinuxFex.OFF &&
|
||||
app.kind != UserApps.Kind.FLATPAK
|
||||
val fexReady by produceState<Boolean?>(null, app.key, x86, s.sessionRunning) {
|
||||
value = if (x86) kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) { com.droiddeck.launcher.runtime.LinuxFex.ready(ctx) } else true
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ fun PerformancePage(
|
||||
fsyncFirst: Boolean,
|
||||
gamescopeRealtime: Boolean,
|
||||
gpuClockPin: Boolean,
|
||||
performanceBoost: Boolean,
|
||||
samsungSdk: Boolean?,
|
||||
ramCapMb: Int,
|
||||
zramClient: Boolean,
|
||||
vramCapMb: Int,
|
||||
@@ -69,8 +67,6 @@ fun PerformancePage(
|
||||
onFsyncFirst: (Boolean) -> Unit,
|
||||
onGamescopeRealtime: (Boolean) -> Unit,
|
||||
onGpuClockPin: (Boolean) -> Unit,
|
||||
onPerformanceBoost: (Boolean) -> Unit,
|
||||
onImportSamsungSdk: () -> Unit,
|
||||
onRamCapMb: (Int) -> Unit,
|
||||
onZramClient: (Boolean) -> Unit,
|
||||
onVramCapMb: (Int) -> Unit,
|
||||
@@ -130,20 +126,6 @@ fun PerformancePage(
|
||||
gamescopeRealtime, onChange = onGamescopeRealtime,
|
||||
)
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.perf_boost_group)) {
|
||||
ToggleRow(
|
||||
host, "boost", stringResource(R.string.perf_boost),
|
||||
stringResource(R.string.perf_boost_hint),
|
||||
performanceBoost, onChange = onPerformanceBoost,
|
||||
)
|
||||
if (samsungSdk != null) {
|
||||
ActionRow(
|
||||
stringResource(R.string.perf_samsung_sdk),
|
||||
stringResource(if (samsungSdk) R.string.perf_samsung_sdk_ready else R.string.perf_samsung_sdk_missing),
|
||||
stringResource(R.string.perf_samsung_sdk_import), onClick = onImportSamsungSdk,
|
||||
)
|
||||
}
|
||||
}
|
||||
SettingsGroup(stringResource(R.string.perf_gpu)) {
|
||||
ToggleRow(
|
||||
host, "gpuclock", stringResource(R.string.perf_gpuclock),
|
||||
|
||||
@@ -56,9 +56,11 @@ class SecondScreenPresentation(
|
||||
private val onKeyboardClosed: () -> Unit = {},
|
||||
private val onMenu: (() -> Unit)? = null,
|
||||
private val menu: (@androidx.compose.runtime.Composable () -> Unit)? = null,
|
||||
private val dashboard: (@androidx.compose.runtime.Composable () -> Unit)? = null,
|
||||
) : Presentation(sessionActivity, display) {
|
||||
private val frame = FrameLayout(context)
|
||||
private var menuView: androidx.compose.ui.platform.ComposeView? = null
|
||||
private var dashboardView: androidx.compose.ui.platform.ComposeView? = null
|
||||
var menuShown = false
|
||||
private set
|
||||
private val root = LinearLayout(context).apply {
|
||||
@@ -155,12 +157,7 @@ class SecondScreenPresentation(
|
||||
menuShown = on
|
||||
if (on) {
|
||||
keyboardHost?.takeIf { it.shown }?.hide()
|
||||
window?.decorView?.let { decor ->
|
||||
decor.setViewTreeLifecycleOwner(sessionActivity)
|
||||
decor.setViewTreeViewModelStoreOwner(sessionActivity)
|
||||
decor.setViewTreeSavedStateRegistryOwner(sessionActivity)
|
||||
decor.setViewTreeOnBackPressedDispatcherOwner(sessionActivity)
|
||||
}
|
||||
ownComposeViews()
|
||||
val view = menuView ?: androidx.compose.ui.platform.ComposeView(context).apply {
|
||||
isFocusable = true
|
||||
isFocusableInTouchMode = true
|
||||
@@ -179,12 +176,22 @@ class SecondScreenPresentation(
|
||||
}
|
||||
}
|
||||
|
||||
private fun ownComposeViews() {
|
||||
window?.decorView?.let { decor ->
|
||||
decor.setViewTreeLifecycleOwner(sessionActivity)
|
||||
decor.setViewTreeViewModelStoreOwner(sessionActivity)
|
||||
decor.setViewTreeSavedStateRegistryOwner(sessionActivity)
|
||||
decor.setViewTreeOnBackPressedDispatcherOwner(sessionActivity)
|
||||
}
|
||||
}
|
||||
|
||||
fun focusMenu(): Boolean = menuView?.requestFocus() == true
|
||||
|
||||
fun dispatchMenuKey(event: KeyEvent): Boolean = menuView?.dispatchKeyEvent(event) == true
|
||||
|
||||
fun closeControls() {
|
||||
showMenu(false)
|
||||
closeDashboard()
|
||||
closeTerminal()
|
||||
keyboardHost?.hide()
|
||||
keyboardHost = null
|
||||
@@ -192,7 +199,8 @@ class SecondScreenPresentation(
|
||||
}
|
||||
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
val forward = menuShown || currentMode != SecondScreenMode.TERMINAL || PadBridge.isControllerKeyEvent(event)
|
||||
val ownKeys = currentMode == SecondScreenMode.TERMINAL || currentMode == SecondScreenMode.DASHBOARD
|
||||
val forward = menuShown || !ownKeys || PadBridge.isControllerKeyEvent(event)
|
||||
if (forward && sessionActivity.dispatchKeyEvent(event)) return true
|
||||
return super.dispatchKeyEvent(event)
|
||||
}
|
||||
@@ -218,19 +226,37 @@ class SecondScreenPresentation(
|
||||
keyboardButton = null
|
||||
keyboardPending = false
|
||||
closeTerminal()
|
||||
closeDashboard()
|
||||
root.removeAllViews()
|
||||
val mode = if (currentMode == SecondScreenMode.DECK_CONTROLS && !SessionState.deckPad) SecondScreenMode.NONE
|
||||
else currentMode
|
||||
val mode = when {
|
||||
currentMode == SecondScreenMode.DECK_CONTROLS && !SessionState.deckPad -> SecondScreenMode.NONE
|
||||
currentMode == SecondScreenMode.DASHBOARD && dashboard == null -> SecondScreenMode.NONE
|
||||
else -> currentMode
|
||||
}
|
||||
if (mode == SecondScreenMode.NONE) return
|
||||
|
||||
when (mode) {
|
||||
SecondScreenMode.KEYBOARD_TRACKPAD -> renderKeyboardAndTrackpad()
|
||||
SecondScreenMode.TERMINAL -> renderTerminal()
|
||||
SecondScreenMode.DECK_CONTROLS -> root.addView(DeckControlsPanel(context, onClose, onSteamMenu, onQam, pad, onMenu = onMenu), weightParams())
|
||||
SecondScreenMode.DASHBOARD -> renderDashboard()
|
||||
SecondScreenMode.NONE -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderDashboard() {
|
||||
val content = dashboard ?: return
|
||||
ownComposeViews()
|
||||
val view = androidx.compose.ui.platform.ComposeView(context).apply { setContent { content() } }
|
||||
dashboardView = view
|
||||
root.addView(view, weightParams())
|
||||
}
|
||||
|
||||
private fun closeDashboard() {
|
||||
dashboardView?.disposeComposition()
|
||||
dashboardView = null
|
||||
}
|
||||
|
||||
private fun renderKeyboardAndTrackpad() {
|
||||
val panel = FrameLayout(context)
|
||||
panel.addView(trackpadView(), FrameLayout.LayoutParams(-1, -1))
|
||||
|
||||
@@ -31,6 +31,7 @@ import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.material.icons.outlined.Close
|
||||
import androidx.compose.material.icons.outlined.Terminal
|
||||
import androidx.compose.material.icons.outlined.Dashboard
|
||||
import androidx.compose.material.icons.outlined.Keyboard
|
||||
import androidx.compose.material.icons.outlined.AutoFixHigh
|
||||
import androidx.compose.material.icons.outlined.ExpandMore
|
||||
@@ -240,6 +241,7 @@ class DrawerActions(
|
||||
val textureAnisotropy: Int? = 0,
|
||||
val textureLodBias: String? = TextureFiltering.LOD_BIAS_OFF,
|
||||
val secondScreenMode: SecondScreenMode,
|
||||
val dashboardAvailable: Boolean = false,
|
||||
val secondScreenDisplays: List<SecondScreenDisplay>,
|
||||
val selectedSecondScreenDisplay: Int,
|
||||
val onHud: (Boolean) -> Unit,
|
||||
@@ -533,7 +535,7 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
modifier = Modifier.weight(1f).fillMaxWidth().verticalScroll(pageScroll.getValue(page)),
|
||||
) { CompositionLocalProvider(LocalChipMinWidth provides 96.dp, LocalCompactSettings provides true) {
|
||||
when (page) {
|
||||
SessionDrawerPage.HUD -> FusionHudSettings(host, a) { key -> focus.track(page, key) }
|
||||
SessionDrawerPage.HUD -> DroidDeckHudSettings(host, a) { key -> focus.track(page, key) }
|
||||
SessionDrawerPage.DISPLAY -> {
|
||||
SettingsGroup(stringResource(R.string.drawer_page_display)) {
|
||||
val fgOpen = host.open == "fg"
|
||||
@@ -893,6 +895,7 @@ private fun BottomScreenModes(a: DrawerActions, modifier: Modifier, onPick: () -
|
||||
if (com.droiddeck.launcher.session.SessionState.deckPad) add(SecondScreenMode.DECK_CONTROLS to Icons.Outlined.SportsEsports)
|
||||
add(SecondScreenMode.KEYBOARD_TRACKPAD to Icons.Outlined.Keyboard)
|
||||
add(SecondScreenMode.TERMINAL to Icons.Outlined.Terminal)
|
||||
if (a.dashboardAvailable) add(SecondScreenMode.DASHBOARD to Icons.Outlined.Dashboard)
|
||||
}
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
@@ -1190,7 +1193,8 @@ private fun SecondScreenGroup(host: MenuHost, a: DrawerActions, track: (String)
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val modes = listOf(SecondScreenMode.NONE, SecondScreenMode.KEYBOARD_TRACKPAD, SecondScreenMode.TERMINAL) +
|
||||
if (com.droiddeck.launcher.session.SessionState.deckPad) listOf(SecondScreenMode.DECK_CONTROLS) else emptyList()
|
||||
(if (com.droiddeck.launcher.session.SessionState.deckPad) listOf(SecondScreenMode.DECK_CONTROLS) else emptyList()) +
|
||||
(if (a.dashboardAvailable) listOf(SecondScreenMode.DASHBOARD) else emptyList())
|
||||
SettingsGroup(stringResource(R.string.drawer_second_screen_mode)) {
|
||||
Column(Modifier.fillMaxWidth().selectableGroup()) {
|
||||
modes.forEach { mode ->
|
||||
|
||||
@@ -0,0 +1,588 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.StrokeCap
|
||||
import androidx.compose.ui.graphics.StrokeJoin
|
||||
import androidx.compose.ui.graphics.drawscope.DrawScope
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextMeasurer
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.drawText
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.rememberTextMeasurer
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.GameStatusFiles
|
||||
import com.droiddeck.launcher.session.GameTelemetry
|
||||
import com.droiddeck.launcher.session.SpeedUnit
|
||||
import com.droiddeck.launcher.session.StatsDash
|
||||
import com.droiddeck.launcher.session.Telemetry
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.floor
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.math.sin
|
||||
|
||||
private val DASH_H = 290.dp
|
||||
/** Pedal and speed trace length: 150 readings at the page's 66 ms draw rate, about 10 s. */
|
||||
internal const val TRACE_N = 150
|
||||
|
||||
internal class TraceData(val throttle: List<Float>, val brake: List<Float>, val speed: List<Float>)
|
||||
|
||||
/** The racing dash in [style] with speeds in [unit] (km/h or mph); a tap moves to the next one. */
|
||||
@Composable
|
||||
internal fun RaceDashView(style: StatsDash, t: Telemetry, trace: TraceData, unit: SpeedUnit, onTap: () -> Unit) {
|
||||
Box(Modifier.fillMaxWidth().clickable(onClick = onTap)) {
|
||||
when (style) {
|
||||
StatsDash.AUTO, StatsDash.SPEEDOMETER -> SpeedometerDash(t, unit)
|
||||
StatsDash.CIRCUIT -> CircuitDash(t, unit)
|
||||
StatsDash.TRACE -> TraceDash(t, trace, unit)
|
||||
StatsDash.DIALS -> DialsDash(t, unit)
|
||||
StatsDash.GLANCE -> GlanceDash(t, unit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun polar(cx: Float, cy: Float, r: Float, deg: Float): Offset {
|
||||
val a = Math.toRadians((deg - 90f).toDouble())
|
||||
return Offset(cx + r * cos(a).toFloat(), cy + r * sin(a).toFloat())
|
||||
}
|
||||
|
||||
private const val DIAL_START = -125f
|
||||
private const val DIAL_SWEEP = 250f
|
||||
|
||||
private fun dialAngle(v: Float, max: Float) = DIAL_START + DIAL_SWEEP * (v / max).coerceIn(0f, 1f)
|
||||
|
||||
/** A 250° dial face: track, optional red zone from [red], ticks and numbers every [major]. */
|
||||
private fun DrawScope.dialFace(
|
||||
cx: Float, cy: Float, r: Float, max: Float, major: Float, label: (Float) -> String,
|
||||
measurer: TextMeasurer, labelStyle: TextStyle, tick: Color, minor: Color, track: Color, red: Float?, redColor: Color,
|
||||
) {
|
||||
val box = Size(2 * r, 2 * r)
|
||||
val tl = Offset(cx - r, cy - r)
|
||||
drawArc(track, DIAL_START - 90f, DIAL_SWEEP, false, topLeft = tl, size = box, style = Stroke(6.dp.toPx(), cap = StrokeCap.Round))
|
||||
if (red != null && red < max) {
|
||||
drawArc(redColor, dialAngle(red, max) - 90f, dialAngle(max, max) - dialAngle(red, max), false, topLeft = tl, size = box, style = Stroke(6.dp.toPx()))
|
||||
}
|
||||
val steps = (max / (major / 2f)).roundToInt()
|
||||
for (i in 0..steps) {
|
||||
val v = i * major / 2f
|
||||
val isMajor = i % 2 == 0
|
||||
val deg = dialAngle(v, max)
|
||||
drawLine(if (isMajor) tick else minor, polar(cx, cy, r - (if (isMajor) 14.dp else 7.dp).toPx(), deg), polar(cx, cy, r - 2.dp.toPx(), deg),
|
||||
strokeWidth = (if (isMajor) 2.5f else 1.2f).dp.toPx())
|
||||
if (isMajor) {
|
||||
val layout = measurer.measure(label(v), labelStyle)
|
||||
val p = polar(cx, cy, r - 27.dp.toPx(), deg)
|
||||
drawText(layout, topLeft = Offset(p.x - layout.size.width / 2f, p.y - layout.size.height / 2f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun DrawScope.needle(cx: Float, cy: Float, len: Float, deg: Float, color: Color, hub: Color) {
|
||||
drawLine(color, Offset(cx, cy), polar(cx, cy, len, deg), strokeWidth = 4.dp.toPx(), cap = StrokeCap.Round)
|
||||
drawCircle(hub, radius = 7.dp.toPx(), center = Offset(cx, cy))
|
||||
}
|
||||
|
||||
private fun speedValue(t: Telemetry, unit: SpeedUnit): Float = (t.speedKmh ?: 0f) * unit.perKmh
|
||||
|
||||
private fun speedScale(speed: Float, unit: SpeedUnit): Float =
|
||||
if (unit == SpeedUnit.MPH) (if (speed > 130f) 200f else 140f) else (if (speed > 210f) 320f else 220f)
|
||||
|
||||
private fun rpmScale(t: Telemetry): Float = max(t.maxRpm ?: 9000f, t.rpm ?: 0f)
|
||||
|
||||
private fun speedText(t: Telemetry, unit: SpeedUnit) = t.speedKmh?.let { "%.0f".format(it * unit.perKmh) } ?: "–"
|
||||
|
||||
@Composable
|
||||
private fun unitAndGear(t: Telemetry, unit: SpeedUnit) = "${unit.label} · ${stringResource(R.string.stats_gear)} ${t.gear ?: "–"}"
|
||||
|
||||
@Composable
|
||||
private fun SpeedometerDash(t: Telemetry, unit: SpeedUnit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val accent = LocalPalette.current.primary
|
||||
Row(Modifier.fillMaxWidth().height(DASH_H), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(stringResource(R.string.stats_speed), Modifier.weight(1.55f).fillMaxHeight()) {
|
||||
Box(Modifier.fillMaxWidth().weight(1f)) {
|
||||
SpeedDial(t, unit, Modifier.fillMaxSize())
|
||||
Column(Modifier.align(Alignment.BottomCenter), horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(speedText(t, unit), fontSize = 44.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = accent)
|
||||
Text(unitAndGear(t, unit), fontSize = 16.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = colors.onBackground)
|
||||
Text(t.rpm?.let { "%,.0f rpm".format(it) } ?: "", fontSize = 11.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
}
|
||||
Column(Modifier.weight(1f).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(stringResource(R.string.stats_pedals), Modifier.fillMaxWidth().weight(1f)) { Pedals(t, Modifier.fillMaxWidth().weight(1f)) }
|
||||
if (t.gLat != null && t.gLon != null) {
|
||||
StatsCard(stringResource(R.string.stats_gforce), Modifier.fillMaxWidth().weight(1f)) { GForce(t, Modifier.fillMaxWidth().weight(1f)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SpeedDial(t: Telemetry, unit: SpeedUnit, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val measurer = rememberTextMeasurer()
|
||||
val labelStyle = TextStyle(color = colors.onSurfaceVariant, fontSize = 11.sp, fontFamily = FontFamily.Monospace)
|
||||
val speed = speedValue(t, unit)
|
||||
val vmax = speedScale(speed, unit)
|
||||
val rpmFraction = ((t.rpm ?: 0f) / rpmScale(t)).coerceIn(0f, 1f)
|
||||
Canvas(modifier) {
|
||||
val r = min(size.width * 0.42f, size.height * 0.47f)
|
||||
val cx = size.width / 2f
|
||||
val cy = r + 12.dp.toPx()
|
||||
dialFace(cx, cy, r, vmax, 20f, { "%.0f".format(it) }, measurer, labelStyle, colors.onBackground, colors.onSurfaceVariant, pal.line, null, StatsColors.brake)
|
||||
val rr = r + 9.dp.toPx()
|
||||
val box = Size(2 * rr, 2 * rr)
|
||||
val tl = Offset(cx - rr, cy - rr)
|
||||
drawArc(pal.line, DIAL_START - 90f, DIAL_SWEEP, false, topLeft = tl, size = box, style = Stroke(5.dp.toPx(), cap = StrokeCap.Round))
|
||||
if (rpmFraction > 0f) drawArc(if (rpmFraction > 0.9f) StatsColors.brake else pal.primary, DIAL_START - 90f, DIAL_SWEEP * rpmFraction, false,
|
||||
topLeft = tl, size = box, style = Stroke(5.dp.toPx(), cap = StrokeCap.Round))
|
||||
needle(cx, cy, r - 16.dp.toPx(), dialAngle(speed, vmax), colors.onBackground, pal.primary)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Pedals(t: Telemetry, modifier: Modifier) {
|
||||
Row(modifier, horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||
PedalBar("THR", t.throttle, StatsColors.throttle)
|
||||
PedalBar("BRK", t.brake, StatsColors.brake)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PedalBar(label: String, value: Float?, color: Color) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Column(Modifier.fillMaxHeight(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(3.dp)) {
|
||||
Text(value?.let { "${(it * 100).roundToInt()}%" } ?: "–", fontSize = 11.sp, fontFamily = FontFamily.Monospace, color = colors.onBackground)
|
||||
Box(Modifier.weight(1f).width(26.dp).clip(RoundedCornerShape(6.dp)).background(pal.line)) {
|
||||
Box(Modifier.fillMaxWidth().fillMaxHeight((value ?: 0f).coerceIn(0f, 1f)).align(Alignment.BottomCenter).background(color))
|
||||
}
|
||||
Text(label, fontSize = 11.sp, fontWeight = FontWeight.Bold, color = colors.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun GForce(t: Telemetry, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val g = kotlin.math.hypot(t.gLat ?: 0f, t.gLon ?: 0f)
|
||||
Box(modifier) {
|
||||
Canvas(Modifier.fillMaxSize()) {
|
||||
val steerH = if (t.steer != null) 10.dp.toPx() else 0f
|
||||
val r = min(size.width / 2f, (size.height - steerH) / 2f) - 2.dp.toPx()
|
||||
val cx = size.width / 2f
|
||||
val cy = (size.height - steerH) / 2f
|
||||
for (k in listOf(1f, 0.62f, 0.24f)) drawCircle(pal.line, radius = r * k, center = Offset(cx, cy), style = Stroke(1.dp.toPx()))
|
||||
drawLine(pal.line, Offset(cx - r, cy), Offset(cx + r, cy), strokeWidth = 1.dp.toPx())
|
||||
drawLine(pal.line, Offset(cx, cy - r), Offset(cx, cy + r), strokeWidth = 1.dp.toPx())
|
||||
val gx = (t.gLat ?: 0f).coerceIn(-2f, 2f) / 2f * r
|
||||
val gy = (t.gLon ?: 0f).coerceIn(-2f, 2f) / 2f * r
|
||||
drawCircle(colors.onBackground, radius = 6.dp.toPx(), center = Offset(cx + gx, cy - gy))
|
||||
t.steer?.let { s ->
|
||||
val y = size.height - 3.dp.toPx()
|
||||
drawLine(pal.line, Offset(cx - r, y), Offset(cx + r, y), strokeWidth = 5.dp.toPx(), cap = StrokeCap.Round)
|
||||
drawLine(pal.primary, Offset(cx, y), Offset(cx + s * r, y), strokeWidth = 5.dp.toPx(), cap = StrokeCap.Round)
|
||||
}
|
||||
}
|
||||
Text("%.1f G".format(g), fontSize = 11.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant, modifier = Modifier.align(Alignment.TopEnd))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun CircuitDash(t: Telemetry, unit: SpeedUnit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val accent = LocalPalette.current.primary
|
||||
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(null, Modifier.fillMaxWidth()) { ShiftLights(t, Modifier.fillMaxWidth().height(20.dp)) }
|
||||
Row(Modifier.fillMaxWidth().height(DASH_H - 48.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(stringResource(R.string.stats_timing), Modifier.weight(1f).fillMaxHeight()) {
|
||||
KvRow(stringResource(R.string.bottom_telemetry_lap), t.lap?.let { lap -> t.laps?.let { "$lap / $it" } ?: "$lap" } ?: "–")
|
||||
KvRow(stringResource(R.string.bottom_telemetry_position), t.position?.let { "P$it" } ?: "–")
|
||||
KvRow(stringResource(R.string.bottom_telemetry_this_lap), t.currentLapS?.let { lapTime(it) } ?: "–")
|
||||
KvRow(stringResource(R.string.bottom_telemetry_last_lap), t.lastLapS?.let { lapTime(it) } ?: "–")
|
||||
t.bestLapS?.let { KvRow(stringResource(R.string.stats_best_lap), lapTime(it), accent) }
|
||||
}
|
||||
StatsCard("", Modifier.weight(1.2f).fillMaxHeight()) {
|
||||
Column(Modifier.fillMaxWidth().weight(1f), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
|
||||
Text(speedText(t, unit), fontSize = 72.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = accent)
|
||||
Text(unitAndGear(t, unit), fontSize = 24.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = colors.onBackground)
|
||||
Text(t.rpm?.let { rpm -> t.maxRpm?.let { "%,.0f / %,.0f rpm".format(rpm, it) } ?: "%,.0f rpm".format(rpm) } ?: "",
|
||||
fontSize = 12.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
val fuel = t.fuel
|
||||
val tires = t.tireTempsC?.takeIf { it.size == 4 }
|
||||
if (fuel != null || tires != null) Column(Modifier.weight(0.9f).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (fuel != null) StatsCard(stringResource(R.string.bottom_telemetry_fuel), Modifier.fillMaxWidth().weight(1f)) {
|
||||
Bar(fuel, colors.onBackground, Modifier.fillMaxWidth().height(14.dp))
|
||||
Text("${(fuel * 100).roundToInt()}%", fontSize = 13.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant)
|
||||
}
|
||||
if (tires != null) StatsCard(stringResource(R.string.stats_tires), Modifier.fillMaxWidth().weight(1.3f)) { Tires(tires, Modifier.fillMaxWidth().weight(1f)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ShiftLights(t: Telemetry, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
val ratio = ((t.rpm ?: 0f) / rpmScale(t)).coerceIn(0f, 1f)
|
||||
val lit = (((ratio - 0.6f) / 0.35f).coerceIn(0f, 1f) * 15).roundToInt()
|
||||
val flash = ratio > 0.95f && (System.currentTimeMillis() / 120) % 2 == 0L
|
||||
Canvas(modifier) {
|
||||
val step = size.width / 15f
|
||||
val r = min(size.height / 2f, step / 2f - 2.dp.toPx())
|
||||
for (i in 0 until 15) {
|
||||
val c = when {
|
||||
flash -> pal.primary
|
||||
i >= lit -> pal.line
|
||||
i < 5 -> StatsColors.shiftGreen
|
||||
i < 10 -> StatsColors.warn
|
||||
i < 13 -> StatsColors.brake
|
||||
else -> pal.primary
|
||||
}
|
||||
drawCircle(c, radius = r, center = Offset(step * i + step / 2f, size.height / 2f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun KvRow(label: String, value: String, valueColor: Color = MaterialTheme.colorScheme.onBackground) {
|
||||
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(label, fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.weight(1f), maxLines = 1)
|
||||
Text(value, fontSize = 15.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = valueColor, maxLines = 1)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Bar(fraction: Float, color: Color, modifier: Modifier) {
|
||||
Box(modifier.clip(RoundedCornerShape(5.dp)).background(LocalPalette.current.line)) {
|
||||
Box(Modifier.fillMaxWidth(fraction.coerceIn(0f, 1f)).fillMaxHeight().background(color))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Tires(tires: List<Float>, modifier: Modifier) {
|
||||
Column(modifier, verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
Row(Modifier.fillMaxWidth().weight(1f), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
TireBox(tires[0], Modifier.weight(1f).fillMaxHeight())
|
||||
TireBox(tires[1], Modifier.weight(1f).fillMaxHeight())
|
||||
}
|
||||
Row(Modifier.fillMaxWidth().weight(1f), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
TireBox(tires[2], Modifier.weight(1f).fillMaxHeight())
|
||||
TireBox(tires[3], Modifier.weight(1f).fillMaxHeight())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TireBox(c: Float, modifier: Modifier) {
|
||||
val bg = when {
|
||||
c > 100f -> Color(0xFF5A2A2C)
|
||||
c < 70f -> Color(0xFF1D3550)
|
||||
else -> Color(0xFF23352B)
|
||||
}
|
||||
Box(modifier.clip(RoundedCornerShape(6.dp)).background(bg), contentAlignment = Alignment.Center) {
|
||||
Text("%.0f".format(c), fontSize = 13.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = MaterialTheme.colorScheme.onBackground)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TraceDash(t: Telemetry, trace: TraceData, unit: SpeedUnit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(stringResource(R.string.stats_trace), Modifier.fillMaxWidth().height(168.dp)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(14.dp)) {
|
||||
Legend(StatsColors.throttle, "${stringResource(R.string.stats_throttle)} ${t.throttle?.let { (it * 100).roundToInt() } ?: 0}%")
|
||||
Legend(StatsColors.brake, "${stringResource(R.string.stats_brake)} ${t.brake?.let { (it * 100).roundToInt() } ?: 0}%")
|
||||
}
|
||||
TraceChart(listOf(trace.throttle to StatsColors.throttle, trace.brake to StatsColors.brake), 1f, Modifier.fillMaxWidth().weight(1f))
|
||||
}
|
||||
val speeds = trace.speed.map { it * unit.perKmh }
|
||||
val top = max(if (unit == SpeedUnit.MPH) 125f else 200f, (speeds.maxOrNull() ?: 0f) * 1.1f)
|
||||
StatsCard(stringResource(R.string.stats_speed_chart, unit.label), Modifier.fillMaxWidth().height(114.dp)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(14.dp)) {
|
||||
Legend(StatsColors.speed, "${stringResource(R.string.stats_speed)} ${speedText(t, unit)}")
|
||||
Text("0 – %.0f".format(top), fontSize = 11.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant)
|
||||
}
|
||||
TraceChart(listOf(speeds to StatsColors.speed), top, Modifier.fillMaxWidth().weight(1f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Legend(color: Color, text: String) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(5.dp)) {
|
||||
Box(Modifier.size(8.dp).clip(CircleShape).background(color))
|
||||
Text(text, fontSize = 12.sp, fontFamily = FontFamily.Monospace, color = MaterialTheme.colorScheme.onBackground, maxLines = 1)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TraceChart(series: List<Pair<List<Float>, Color>>, max: Float, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
Canvas(modifier) {
|
||||
for (k in listOf(0f, 0.5f, 1f)) {
|
||||
val y = size.height - k * size.height
|
||||
drawLine(pal.line, Offset(0f, y), Offset(size.width, y), strokeWidth = 1.dp.toPx())
|
||||
}
|
||||
for ((values, color) in series) {
|
||||
if (values.size < 2) continue
|
||||
val path = Path()
|
||||
val offset = TRACE_N - values.size
|
||||
values.forEachIndexed { i, v ->
|
||||
val x = (i + offset) / (TRACE_N - 1f) * size.width
|
||||
val y = size.height - (v / max).coerceIn(0f, 1f) * size.height
|
||||
if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
|
||||
}
|
||||
drawPath(path, color, style = Stroke(width = 2.dp.toPx(), cap = StrokeCap.Round, join = StrokeJoin.Round))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DialsDash(t: Telemetry, unit: SpeedUnit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val rpmMax = (rpmScale(t) / 1000f).let { kotlin.math.ceil(it) * 1000f }
|
||||
val hasExtras = t.lights != null || t.turboBar != null || t.engineTempC != null || t.oilTempC != null
|
||||
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Row(Modifier.fillMaxWidth().height(if (hasExtras) DASH_H - 56.dp else DASH_H), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard("", Modifier.weight(1f).fillMaxHeight()) {
|
||||
val speed = speedValue(t, unit)
|
||||
ArcDial(speed, speedScale(speed, unit), if (unit == SpeedUnit.MPH) 20f else 40f, { "%.0f".format(it) }, null,
|
||||
speedText(t, unit), unit.label, Modifier.fillMaxWidth().weight(1f))
|
||||
}
|
||||
StatsCard("", Modifier.weight(1f).fillMaxHeight()) {
|
||||
ArcDial(t.rpm ?: 0f, rpmMax, 1000f, { "%.0f".format(it / 1000f) }, t.maxRpm?.let { it * 0.9f },
|
||||
t.rpm?.let { "%,.0f".format(it) } ?: "–", "rpm × 1000 · ${t.gear ?: "–"}", Modifier.fillMaxWidth().weight(1f))
|
||||
}
|
||||
}
|
||||
if (hasExtras) StatsCard(stringResource(R.string.stats_lights), Modifier.fillMaxWidth()) {
|
||||
Row(Modifier.horizontalScroll(rememberScrollState()), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
t.lights?.let { on ->
|
||||
Lamp(stringResource(R.string.stats_lamp_shift), on and GameTelemetry.DL_SHIFT != 0, LocalPalette.current.primary)
|
||||
Lamp(stringResource(R.string.stats_lamp_handbrake), on and GameTelemetry.DL_HANDBRAKE != 0, StatsColors.brake)
|
||||
Lamp(stringResource(R.string.stats_lamp_pit), on and GameTelemetry.DL_PITSPEED != 0, StatsColors.warn)
|
||||
Lamp(stringResource(R.string.stats_lamp_tc), on and GameTelemetry.DL_TC != 0, StatsColors.warn)
|
||||
Lamp(stringResource(R.string.stats_lamp_abs), on and GameTelemetry.DL_ABS != 0, StatsColors.warn)
|
||||
}
|
||||
t.turboBar?.let { Lamp(stringResource(R.string.stats_turbo, "%.1f".format(it)), false, colors.onBackground) }
|
||||
t.engineTempC?.let { Lamp(stringResource(R.string.stats_engine_temp, "%.0f".format(it)), false, colors.onBackground) }
|
||||
t.oilTempC?.let { Lamp(stringResource(R.string.stats_oil_temp, "%.0f".format(it)), false, colors.onBackground) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ArcDial(value: Float, max: Float, major: Float, label: (Float) -> String, red: Float?, readout: String, unit: String, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val measurer = rememberTextMeasurer()
|
||||
val labelStyle = TextStyle(color = colors.onSurfaceVariant, fontSize = 11.sp, fontFamily = FontFamily.Monospace)
|
||||
Box(modifier) {
|
||||
Canvas(Modifier.fillMaxSize()) {
|
||||
val r = min(size.width * 0.46f, size.height * 0.5f)
|
||||
val cx = size.width / 2f
|
||||
val cy = r + 6.dp.toPx()
|
||||
dialFace(cx, cy, r, max, major, label, measurer, labelStyle, colors.onBackground, colors.onSurfaceVariant, pal.line, red, StatsColors.brake)
|
||||
needle(cx, cy, r - 18.dp.toPx(), dialAngle(value, max), colors.onBackground, pal.primary)
|
||||
}
|
||||
Column(Modifier.align(Alignment.BottomCenter), horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(readout, fontSize = 22.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = colors.onBackground)
|
||||
Text(unit, fontSize = 11.sp, color = colors.onSurfaceVariant, maxLines = 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Lamp(label: String, on: Boolean, color: Color) {
|
||||
val pal = LocalPalette.current
|
||||
val shape = RoundedCornerShape(8.dp)
|
||||
Text(label, fontSize = 12.sp, fontFamily = FontFamily.Monospace, fontWeight = if (on) FontWeight.Bold else FontWeight.Normal,
|
||||
color = if (on) MaterialTheme.colorScheme.background else MaterialTheme.colorScheme.onSurfaceVariant, maxLines = 1,
|
||||
modifier = Modifier.clip(shape).background(if (on) color else Color.Transparent).border(1.dp, if (on) color else pal.line, shape)
|
||||
.padding(horizontal = 10.dp, vertical = 4.dp))
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun GlanceDash(t: Telemetry, unit: SpeedUnit) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val accent = LocalPalette.current.primary
|
||||
val ratio = ((t.rpm ?: 0f) / rpmScale(t)).coerceIn(0f, 1f)
|
||||
Row(Modifier.fillMaxWidth().height(DASH_H), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
EdgeBar(t.throttle, StatsColors.throttle)
|
||||
StatsCard("", Modifier.weight(1f).fillMaxHeight()) {
|
||||
Bar(ratio, if (ratio > 0.9f) StatsColors.brake else accent, Modifier.fillMaxWidth().height(14.dp))
|
||||
Column(Modifier.fillMaxWidth().weight(1f), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
|
||||
Text(speedText(t, unit), fontSize = 110.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = accent, lineHeight = 112.sp)
|
||||
Text(unitAndGear(t, unit), fontSize = 34.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = colors.onBackground)
|
||||
}
|
||||
}
|
||||
EdgeBar(t.brake, StatsColors.brake)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun EdgeBar(value: Float?, color: Color) {
|
||||
Box(Modifier.width(14.dp).fillMaxHeight().clip(RoundedCornerShape(5.dp)).background(LocalPalette.current.line)) {
|
||||
Box(Modifier.fillMaxWidth().fillMaxHeight((value ?: 0f).coerceIn(0f, 1f)).align(Alignment.BottomCenter).background(color))
|
||||
}
|
||||
}
|
||||
|
||||
/** War Thunder's own labels the Flight layout places; others stay in the list. */
|
||||
internal object FlightLabels {
|
||||
const val IAS = "IAS, km/h"
|
||||
const val ALTITUDE = "H, m"
|
||||
const val G = "Ny"
|
||||
const val FUEL = "Mfuel, kg"
|
||||
const val THROTTLE = "throttle 1, %"
|
||||
|
||||
fun drawable(rows: List<Pair<String, String>>): Boolean = rows.any { it.first == IAS || it.first == ALTITUDE }
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun FlightDash(rows: List<Pair<String, String>>) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val v = rows.toMap()
|
||||
fun num(key: String) = v[key]?.toFloatOrNull()
|
||||
Row(Modifier.fillMaxWidth().height(DASH_H), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(FlightLabels.IAS, Modifier.weight(1f).fillMaxHeight()) {
|
||||
num(FlightLabels.IAS)?.let { Tape(it, 10f, 50f, Modifier.fillMaxWidth().weight(1f)) } ?: Text("–", color = colors.onSurfaceVariant)
|
||||
}
|
||||
Column(Modifier.weight(1.3f).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(FlightLabels.THROTTLE, Modifier.fillMaxWidth().weight(1f)) {
|
||||
val thr = num(FlightLabels.THROTTLE)
|
||||
Bar((thr ?: 0f) / 110f, StatsColors.throttle, Modifier.fillMaxWidth().height(16.dp))
|
||||
Text(thr?.let { "%.0f%%".format(it) } ?: "–", fontSize = 13.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant)
|
||||
}
|
||||
StatsCard(FlightLabels.G, Modifier.fillMaxWidth().weight(1f)) {
|
||||
Text(num(FlightLabels.G)?.let { "%.1f".format(it) } ?: "–", fontSize = 34.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace,
|
||||
color = colors.onBackground)
|
||||
num(FlightLabels.FUEL)?.let { Text("${FlightLabels.FUEL} %.0f".format(it), fontSize = 12.sp, color = colors.onSurfaceVariant) }
|
||||
}
|
||||
}
|
||||
StatsCard(FlightLabels.ALTITUDE, Modifier.weight(1f).fillMaxHeight()) {
|
||||
num(FlightLabels.ALTITUDE)?.let { Tape(it, 100f, 500f, Modifier.fillMaxWidth().weight(1f)) } ?: Text("–", color = colors.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Tape(value: Float, step: Float, every: Float, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val measurer = rememberTextMeasurer()
|
||||
val small = TextStyle(color = colors.onSurfaceVariant, fontSize = 11.sp, fontFamily = FontFamily.Monospace)
|
||||
val big = TextStyle(color = colors.onBackground, fontSize = 18.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace)
|
||||
Canvas(modifier) {
|
||||
val cy = size.height / 2f
|
||||
val px = (size.height / 2f) / (step * 4f)
|
||||
val boxH = 32.dp.toPx()
|
||||
var m = floor((value - step * 5f) / step) * step
|
||||
while (m < value + step * 6f) {
|
||||
val y = cy - (m - value) * px
|
||||
if (y in 0f..size.height) {
|
||||
val labelled = abs((m / every).roundToInt() * every - m) < 0.01f
|
||||
drawLine(colors.onSurfaceVariant, Offset(size.width * 0.74f, y), Offset(size.width, y), strokeWidth = (if (labelled) 2.5f else 1f).dp.toPx())
|
||||
if (labelled && abs(y - cy) > boxH * 0.75f) {
|
||||
val layout = measurer.measure("%.0f".format(m), small)
|
||||
drawText(layout, topLeft = Offset(size.width * 0.70f - layout.size.width, y - layout.size.height / 2f))
|
||||
}
|
||||
}
|
||||
m += step
|
||||
}
|
||||
drawRoundRect(pal.primary, topLeft = Offset(1.dp.toPx(), cy - boxH / 2f), size = Size(size.width - 2.dp.toPx(), boxH),
|
||||
cornerRadius = CornerRadius(8.dp.toPx()), style = Stroke(2.dp.toPx()))
|
||||
val layout = measurer.measure("%.0f".format(value), big)
|
||||
drawText(layout, topLeft = Offset(size.width / 2f - layout.size.width / 2f, cy - layout.size.height / 2f))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun ShipDash(e: GameStatusFiles.Elite) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Row(Modifier.fillMaxWidth().height(210.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(stringResource(R.string.stats_power), Modifier.weight(1.2f).fillMaxHeight()) {
|
||||
e.pips?.takeIf { it.size == 3 }?.let { Pips(it, Modifier.fillMaxWidth().weight(1f)) } ?: Text("–", color = colors.onSurfaceVariant)
|
||||
}
|
||||
Column(Modifier.weight(1f).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
StatsCard(stringResource(R.string.stats_fuel_t), Modifier.fillMaxWidth().weight(1f)) {
|
||||
e.fuelMain?.let { Text(stringResource(R.string.stats_fuel_main, "%.1f".format(it)), fontSize = 15.sp, fontWeight = FontWeight.Bold,
|
||||
fontFamily = FontFamily.Monospace, color = colors.onBackground) }
|
||||
e.fuelReserve?.let { Text(stringResource(R.string.stats_fuel_reserve, "%.2f".format(it)), fontSize = 12.sp, color = colors.onSurfaceVariant) }
|
||||
}
|
||||
StatsCard("", Modifier.fillMaxWidth().weight(1f)) {
|
||||
e.cargo?.let { KvRow(stringResource(R.string.bottom_telemetry_cargo), "%.0f t".format(it)) }
|
||||
e.legal?.let { KvRow(stringResource(R.string.bottom_telemetry_legal), it, if (it == "Clean") StatsColors.gpu else StatsColors.warn) }
|
||||
e.balance?.let { KvRow(stringResource(R.string.bottom_telemetry_balance), "%,d CR".format(it)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Pips(pips: List<Int>, modifier: Modifier) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val measurer = rememberTextMeasurer()
|
||||
val style = TextStyle(color = colors.onSurfaceVariant, fontSize = 12.sp, fontWeight = FontWeight.Bold)
|
||||
val names = listOf("SYS", "ENG", "WEP")
|
||||
Canvas(modifier) {
|
||||
val colW = size.width / 3f
|
||||
val pipW = colW * 0.62f
|
||||
val labelH = 18.dp.toPx()
|
||||
val pipH = (size.height - labelH) / 4f - 4.dp.toPx()
|
||||
for (col in 0 until 3) {
|
||||
val x = col * colW + (colW - pipW) / 2f
|
||||
// Status.json counts half pips: 0..8 per system.
|
||||
val value = pips[col] / 2f
|
||||
for (i in 0 until 4) {
|
||||
val y = size.height - labelH - (i + 1) * (pipH + 4.dp.toPx())
|
||||
drawRoundRect(pal.line, topLeft = Offset(x, y), size = Size(pipW, pipH), cornerRadius = CornerRadius(4.dp.toPx()))
|
||||
val fill = (value - i).coerceIn(0f, 1f)
|
||||
if (fill > 0f) drawRoundRect(pal.primary, topLeft = Offset(x, y), size = Size(pipW * fill, pipH), cornerRadius = CornerRadius(4.dp.toPx()))
|
||||
}
|
||||
val layout = measurer.measure(names[col], style)
|
||||
drawText(layout, topLeft = Offset(col * colW + colW / 2f - layout.size.width / 2f, size.height - layout.size.height))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.StrokeCap
|
||||
import androidx.compose.ui.graphics.StrokeJoin
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
|
||||
import androidx.compose.ui.graphics.lerp
|
||||
import androidx.compose.ui.graphics.nativeCanvas
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.hud.DroidDeckMark
|
||||
import com.droiddeck.launcher.hud.HudMetrics
|
||||
import com.droiddeck.launcher.session.StatsStrip
|
||||
import kotlin.math.max
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/** FusionHUD's metric colors, so the bottom screen reads like the HUD on the top screen. */
|
||||
internal object StatsColors {
|
||||
val cpu = Color(0xFF58A6FF)
|
||||
val gpu = Color(0xFF5EE08A)
|
||||
val ram = Color(0xFFFF7BC0)
|
||||
val bat = Color(0xFFFFAB5E)
|
||||
// Throttle and brake stay apart for red-green colour blindness (checked against the dark surface).
|
||||
val throttle = Color(0xFF14A39A)
|
||||
val brake = Color(0xFFE5484D)
|
||||
val speed = Color(0xFF2E8FD6)
|
||||
val warn = Color(0xFFF2C94C)
|
||||
val shiftGreen = Color(0xFF2FB36A)
|
||||
val badge = Color(0xFF0B0D10)
|
||||
}
|
||||
|
||||
/** The last [capacity] readings, oldest first. */
|
||||
internal class History(private val capacity: Int) {
|
||||
private val values = ArrayDeque<Float>(capacity)
|
||||
fun add(v: Float) {
|
||||
if (values.size == capacity) values.removeFirst()
|
||||
values.addLast(v)
|
||||
}
|
||||
fun snapshot(): List<Float> = values.toList()
|
||||
}
|
||||
|
||||
private val MARK_RATIO = DroidDeckMark.widthFor(1f)
|
||||
|
||||
/** The DroidDeck mark (the split D with the blue orb), the same artwork the HUD draws. */
|
||||
@Composable
|
||||
internal fun DroidDeckLogo(height: Dp, modifier: Modifier = Modifier, body: Color = Color.White, orb: Color = LocalPalette.current.primary) {
|
||||
Canvas(modifier.size(height * MARK_RATIO, height)) {
|
||||
val b = body.toArgb()
|
||||
val o = orb.toArgb()
|
||||
drawIntoCanvas { DroidDeckMark.draw(it.nativeCanvas, 0f, 0f, size.height, b, o) }
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun LogoBadge(size: Dp) {
|
||||
val shape = RoundedCornerShape(size * 0.22f)
|
||||
Box(Modifier.size(size).clip(shape).background(StatsColors.badge).border(2.dp, LocalPalette.current.primary, shape), contentAlignment = Alignment.Center) {
|
||||
DroidDeckLogo(size * 0.62f)
|
||||
}
|
||||
}
|
||||
|
||||
/** The mark and "DroidDeck" on the left, the running game's name in the middle, the clock on the right. */
|
||||
@Composable
|
||||
private fun LogoHeader(clock: String, game: String?) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Row(Modifier.fillMaxWidth().padding(horizontal = 2.dp), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
DroidDeckLogo(16.dp)
|
||||
Text("DroidDeck", fontSize = 13.sp, fontWeight = FontWeight.Bold, color = colors.onBackground)
|
||||
Text(game.orEmpty(), fontSize = 13.sp, fontWeight = FontWeight.Bold, color = colors.onBackground, textAlign = TextAlign.Center,
|
||||
maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.weight(1f))
|
||||
if (clock.isNotEmpty()) Text(clock, fontSize = 12.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun Sparkline(values: List<Float>, min: Float, max: Float, color: Color, modifier: Modifier) {
|
||||
Canvas(modifier) {
|
||||
if (values.size < 2 || max <= min) return@Canvas
|
||||
val path = Path()
|
||||
values.forEachIndexed { i, v ->
|
||||
val x = i / (values.size - 1f) * size.width
|
||||
val y = size.height - ((v - min) / (max - min)).coerceIn(0f, 1f) * (size.height - 2f) - 1f
|
||||
if (i == 0) path.moveTo(x, y) else path.lineTo(x, y)
|
||||
}
|
||||
drawPath(path, color, style = Stroke(width = 2.dp.toPx(), cap = StrokeCap.Round, join = StrokeJoin.Round))
|
||||
}
|
||||
}
|
||||
|
||||
/** A readout card: dark surface, a thin accent edge and the DroidDeck mark before the title ("" = mark only). */
|
||||
@Composable
|
||||
internal fun StatsCard(title: String?, modifier: Modifier = Modifier, content: @Composable ColumnScope.() -> Unit) {
|
||||
val pal = LocalPalette.current
|
||||
val shape = RoundedCornerShape(14.dp)
|
||||
Column(
|
||||
modifier.clip(shape).background(pal.surface).border(1.dp, pal.primary.copy(alpha = 0.22f), shape).padding(horizontal = 12.dp, vertical = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp),
|
||||
) {
|
||||
if (title != null) Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
DroidDeckLogo(12.dp, body = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
if (title.isNotEmpty()) Text(title.uppercase(), fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = pal.primary, letterSpacing = 0.6.sp,
|
||||
maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
||||
/** What the top strip shows; histories hold one reading a second, oldest first. */
|
||||
internal class StripData(
|
||||
val fps: Float?,
|
||||
val device: HudMetrics.Snapshot?,
|
||||
val fpsHistory: List<Float>,
|
||||
val cpuHistory: List<Float>,
|
||||
val gpuHistory: List<Float>,
|
||||
val wattsHistory: List<Float>,
|
||||
val clock: String,
|
||||
val game: String? = null,
|
||||
)
|
||||
|
||||
private fun percentTemp(percent: Int?, temp: Int?): String =
|
||||
listOfNotNull(percent?.let { "$it%" }, temp?.let { "$it°" }).joinToString(" · ").ifEmpty { "–" }
|
||||
|
||||
private fun batteryText(s: HudMetrics.Snapshot?): String =
|
||||
listOfNotNull(s?.battery?.percent?.let { "$it%" }, s?.battery?.watts?.takeIf { it > 0f }?.let { "%.1f W".format(it) }).joinToString(" · ").ifEmpty { "–" }
|
||||
|
||||
private fun fpsText(fps: Float?): String = fps?.takeIf { it > 0f }?.let { "%.1f".format(it) } ?: "–"
|
||||
|
||||
/** The top strip; a tap moves to the next style. */
|
||||
@Composable
|
||||
internal fun StatsStripView(style: StatsStrip, d: StripData, onTap: () -> Unit) {
|
||||
Box(Modifier.fillMaxWidth().clickable(onClick = onTap)) {
|
||||
when (style) {
|
||||
StatsStrip.PANEL -> PanelStrip(d)
|
||||
StatsStrip.TILES -> TilesStrip(d)
|
||||
StatsStrip.RINGS -> RingsStrip(d)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun PanelStrip(d: StripData) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val accent = pal.primary
|
||||
val shape = RoundedCornerShape(18.dp)
|
||||
Row(
|
||||
Modifier.fillMaxWidth().clip(shape).background(pal.surface).border(2.dp, accent, shape).padding(horizontal = 12.dp, vertical = 10.dp),
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
) {
|
||||
LogoBadge(40.dp)
|
||||
Column(Modifier.widthIn(min = 84.dp)) {
|
||||
Row(verticalAlignment = Alignment.Bottom) {
|
||||
Text(fpsText(d.fps), fontSize = 30.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = accent, maxLines = 1)
|
||||
Text(" fps", fontSize = 12.sp, color = colors.onSurfaceVariant, modifier = Modifier.padding(bottom = 4.dp))
|
||||
}
|
||||
Text(d.fps?.takeIf { it > 0f }?.let { "%.1f ms".format(1000f / it) } ?: stringResource(R.string.stats_fps_needs_hud),
|
||||
fontSize = 12.sp, fontFamily = FontFamily.Monospace, color = colors.onSurfaceVariant, maxLines = 1)
|
||||
}
|
||||
Sparkline(d.fpsHistory.map { 1000f / max(it, 1f) }, 8f, 34f, lerp(accent, Color.White, 0.3f), Modifier.weight(1f).height(44.dp))
|
||||
Column(verticalArrangement = Arrangement.spacedBy(1.dp)) {
|
||||
MetricRow("CPU", percentTemp(d.device?.cpuPercent, d.device?.cpuTempC), StatsColors.cpu)
|
||||
MetricRow("GPU", percentTemp(d.device?.gpuPercent, d.device?.gpuTempC), StatsColors.gpu)
|
||||
MetricRow("RAM", d.device?.let { "${it.ramPercent.roundToInt()}%" } ?: "–", StatsColors.ram)
|
||||
MetricRow("BAT", batteryText(d.device), StatsColors.bat)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MetricRow(label: String, value: String, color: Color) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(label, fontSize = 11.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = color, modifier = Modifier.width(36.dp))
|
||||
Text(value, fontSize = 13.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = MaterialTheme.colorScheme.onBackground, maxLines = 1)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun TilesStrip(d: StripData) {
|
||||
val accent = LocalPalette.current.primary
|
||||
val s = d.device
|
||||
val gpuPercent: Int? = s?.gpuPercent
|
||||
val gpuTemp: Int? = s?.gpuTempC
|
||||
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
LogoHeader(d.clock, d.game)
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
HistoryTile("FPS", accent, fpsText(d.fps), "fps", d.fpsHistory, 75f)
|
||||
HistoryTile("CPU", StatsColors.cpu, s?.cpuPercent?.let { "$it%" } ?: "–", s?.cpuTempC?.let { "$it°" } ?: "", d.cpuHistory, 100f)
|
||||
HistoryTile("GPU", StatsColors.gpu, gpuPercent?.let { "$it%" } ?: gpuTemp?.let { "$it°" } ?: "–",
|
||||
if (gpuPercent != null) gpuTemp?.let { "$it°" } ?: "" else "", d.gpuHistory, 100f)
|
||||
HistoryTile(stringResource(R.string.bottom_telemetry_battery).uppercase(), StatsColors.bat, s?.battery?.percent?.let { "$it%" } ?: "–",
|
||||
s?.battery?.watts?.takeIf { it > 0f }?.let { "%.1fW".format(it) } ?: "", d.wattsHistory, 10f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RowScope.HistoryTile(label: String, color: Color, value: String, unit: String, history: List<Float>, max: Float) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Column(
|
||||
Modifier.weight(1f).clip(RoundedCornerShape(12.dp)).background(pal.surface)
|
||||
.drawBehind { drawRect(color, topLeft = Offset.Zero, size = Size(size.width, 3.dp.toPx())) }
|
||||
.padding(start = 10.dp, end = 10.dp, top = 9.dp, bottom = 6.dp),
|
||||
) {
|
||||
Text(label, fontSize = 11.sp, fontWeight = FontWeight.Bold, color = color, letterSpacing = 0.8.sp, maxLines = 1)
|
||||
Row(verticalAlignment = Alignment.Bottom) {
|
||||
Text(value, fontSize = 22.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = colors.onBackground, maxLines = 1)
|
||||
if (unit.isNotEmpty()) Text(" $unit", fontSize = 11.sp, color = colors.onSurfaceVariant, maxLines = 1, modifier = Modifier.padding(bottom = 3.dp))
|
||||
}
|
||||
Sparkline(history, 0f, max, color, Modifier.fillMaxWidth().height(24.dp))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RingsStrip(d: StripData) {
|
||||
val s = d.device
|
||||
val gpuPercent: Int? = s?.gpuPercent
|
||||
val gpuTemp: Int? = s?.gpuTempC
|
||||
Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
LogoHeader(d.clock, d.game)
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
RingTile("CPU", StatsColors.cpu, s?.cpuPercent?.let { it / 100f }, s?.cpuPercent?.let { "$it%" } ?: "–", s?.cpuTempC?.let { "$it °C" } ?: "")
|
||||
RingTile("GPU", StatsColors.gpu, gpuPercent?.let { it / 100f }, gpuPercent?.let { "$it%" } ?: gpuTemp?.let { "$it°" } ?: "–",
|
||||
if (gpuPercent != null) gpuTemp?.let { "$it °C" } ?: "" else "")
|
||||
RingTile("RAM", StatsColors.ram, s?.ramPercent?.let { it / 100f }, s?.let { "${it.ramPercent.roundToInt()}%" } ?: "–",
|
||||
s?.let { "%.1f of %.1f GB".format(it.ramUsedBytes / 1e9, it.ramTotalBytes / 1e9) } ?: "")
|
||||
RingTile(stringResource(R.string.bottom_telemetry_battery).uppercase(), StatsColors.bat, s?.battery?.percent?.let { it / 100f },
|
||||
s?.battery?.percent?.let { "$it%" } ?: "–", s?.battery?.watts?.takeIf { it > 0f }?.let { "%.1f W".format(it) } ?: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RowScope.RingTile(label: String, color: Color, fraction: Float?, center: String, sub: String) {
|
||||
val pal = LocalPalette.current
|
||||
val colors = MaterialTheme.colorScheme
|
||||
Row(
|
||||
Modifier.weight(1f).clip(RoundedCornerShape(12.dp)).background(pal.surface).padding(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
Box(Modifier.size(52.dp), contentAlignment = Alignment.Center) {
|
||||
Canvas(Modifier.fillMaxSize()) {
|
||||
val w = 6.dp.toPx()
|
||||
val tl = Offset(w / 2, w / 2)
|
||||
val sz = Size(size.width - w, size.height - w)
|
||||
drawArc(pal.line, 0f, 360f, false, topLeft = tl, size = sz, style = Stroke(width = w))
|
||||
if (fraction != null) drawArc(color, -90f, (fraction.coerceIn(0f, 1f) * 360f).coerceAtLeast(1f), false, topLeft = tl, size = sz,
|
||||
style = Stroke(width = w, cap = StrokeCap.Round))
|
||||
}
|
||||
Text(center, fontSize = 12.sp, fontWeight = FontWeight.Bold, fontFamily = FontFamily.Monospace, color = colors.onBackground, maxLines = 1)
|
||||
}
|
||||
Column {
|
||||
Text(label, fontSize = 11.sp, fontWeight = FontWeight.Bold, color = color, letterSpacing = 0.8.sp, maxLines = 1)
|
||||
if (sub.isNotEmpty()) Text(sub, fontSize = 11.sp, color = colors.onSurfaceVariant, maxLines = 1, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -709,7 +709,6 @@
|
||||
<string name="hud_export_failed">تعذّر حفظ تقرير HUD.</string>
|
||||
<string name="hud_reset">إعادة ضبط إعدادات HUD</string>
|
||||
<string name="hud_reset_button">إعادة ضبط</string>
|
||||
<string name="hud_credit">FusionHUD من The412Banner، github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">وضع التحجيم</string>
|
||||
<string name="drawer_scaling_sharpness">حدة التحجيم</string>
|
||||
<string name="drawer_effects">مؤثرات الشاشة</string>
|
||||
@@ -1783,6 +1782,8 @@
|
||||
<string name="fm_accept">موافق</string>
|
||||
<string name="fm_decline">رفض</string>
|
||||
<string name="fm_drive_not_readable">تم تركيب %1$s لكن تتعذّر قراءته حاليًا</string>
|
||||
<string name="fm_drive_access_title">السماح بالوصول إلى %1$s</string>
|
||||
<string name="fm_drive_access_text">يتيح Android لتطبيق DroidDeck رؤية محرك الأقراص هذا دون قراءته. فعّل الوصول إلى جميع الملفات لتطبيق DroidDeck ثم عُد.</string>
|
||||
<string name="fm_list_view">عرض القائمة</string>
|
||||
<string name="fm_grid_view">عرض الشبكة</string>
|
||||
<string name="fm_search">بحث</string>
|
||||
@@ -1892,6 +1893,7 @@
|
||||
<string name="flatpakmgr_not_ready">أعِدّ Flatpak أولاً</string>
|
||||
<string name="flatpakmgr_starting">جارٍ البدء</string>
|
||||
<string name="flatpakmgr_exit_status">خرج Flatpak بالحالة %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">تم بناء %1$s لمعمارية %2$s، ولا يستطيع DroidDeck تشغيلها. تحتاج تطبيقات Flatpak هنا إلى إصدار لمعمارية ARM64 أو x86_64.</string>
|
||||
<string name="flatpakmgr_installing">جارٍ تثبيت %1$s</string>
|
||||
<string name="flatpakmgr_updating">جارٍ تحديث %1$s</string>
|
||||
<string name="flatpakmgr_removing">جارٍ إزالة %1$s</string>
|
||||
@@ -2471,6 +2473,9 @@
|
||||
<string name="edit_target">الهدف</string>
|
||||
<string name="edit_start_in">بدء التشغيل في</string>
|
||||
<string name="edit_launch_options">خيارات التشغيل</string>
|
||||
<string name="edit_launch_options_steam_hint">مشتركة مع خصائص Steam: أي تغيير في أحدهما يظهر في كليهما.</string>
|
||||
<string name="edit_launch_options_not_saved">تعذّر حفظ خيارات التشغيل في Steam. حاول مرة أخرى.</string>
|
||||
<string name="edit_launch_options_desktop">قد يكون Steam مفتوحًا في جلسة سطح المكتب. غيّر خيارات التشغيل من خصائصه، أو أغلق الجلسة أولًا.</string>
|
||||
<string name="edit_artwork">الصور الفنية</string>
|
||||
<string name="edit_other_exe">ملف exe آخر…</string>
|
||||
<string name="edit_remove">إزالة</string>
|
||||
|
||||
@@ -703,7 +703,6 @@
|
||||
<string name="hud_export_failed">No se pudo guardar el informe del HUD.</string>
|
||||
<string name="hud_reset">Restablecer ajustes del HUD</string>
|
||||
<string name="hud_reset_button">Restablecer</string>
|
||||
<string name="hud_credit">FusionHUD de The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Modo de escalado</string>
|
||||
<string name="drawer_scaling_sharpness">Nitidez del escalado</string>
|
||||
<string name="drawer_effects">Efectos de pantalla</string>
|
||||
@@ -1784,6 +1783,8 @@
|
||||
<string name="fm_accept">Aceptar</string>
|
||||
<string name="fm_decline">Rechazar</string>
|
||||
<string name="fm_drive_not_readable">%1$s está montado, pero ahora mismo no se puede leer</string>
|
||||
<string name="fm_drive_access_title">Permitir acceso a %1$s</string>
|
||||
<string name="fm_drive_access_text">Android deja que DroidDeck vea esta unidad, pero no que la lea. Activa Acceso a todos los archivos para DroidDeck y vuelve.</string>
|
||||
<string name="fm_list_view">Vista de lista</string>
|
||||
<string name="fm_grid_view">Vista de cuadrícula</string>
|
||||
<string name="fm_search">Buscar</string>
|
||||
@@ -1884,6 +1885,7 @@
|
||||
<string name="flatpakmgr_not_ready">Configura Flatpak primero</string>
|
||||
<string name="flatpakmgr_starting">Iniciando</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak terminó con el código %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s está compilado para %2$s, que DroidDeck no puede ejecutar. Aquí las apps Flatpak necesitan una versión para ARM64 o x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Instalando %1$s</string>
|
||||
<string name="flatpakmgr_updating">Actualizando %1$s</string>
|
||||
<string name="flatpakmgr_removing">Quitando %1$s</string>
|
||||
@@ -2420,6 +2422,9 @@
|
||||
<string name="edit_target">Destino</string>
|
||||
<string name="edit_start_in">Iniciar en</string>
|
||||
<string name="edit_launch_options">Opciones de lanzamiento</string>
|
||||
<string name="edit_launch_options_steam_hint">Se comparten con las Propiedades de Steam: un cambio en cualquiera de los dos se ve en ambos.</string>
|
||||
<string name="edit_launch_options_not_saved">No se pudieron guardar las opciones de lanzamiento en Steam. Inténtalo de nuevo.</string>
|
||||
<string name="edit_launch_options_desktop">Es posible que Steam esté abierto en la sesión de escritorio. Cambia las opciones de lanzamiento en sus Propiedades o cierra primero la sesión.</string>
|
||||
<string name="edit_artwork">Ilustraciones</string>
|
||||
<string name="edit_other_exe">Otro exe…</string>
|
||||
<string name="edit_remove">Quitar</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">Отчетът за HUD не можа да бъде записан.</string>
|
||||
<string name="hud_reset">Нулиране на настройките на HUD</string>
|
||||
<string name="hud_reset_button">Нулиране</string>
|
||||
<string name="hud_credit">FusionHUD от The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Режим на мащабиране</string>
|
||||
<string name="drawer_scaling_sharpness">Острота на мащабиране</string>
|
||||
<string name="drawer_effects">Ефекти на екрана</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">Приемам</string>
|
||||
<string name="fm_decline">Отказвам</string>
|
||||
<string name="fm_drive_not_readable">%1$s е монтирано, но в момента не може да се прочете</string>
|
||||
<string name="fm_drive_access_title">Разрешаване на достъп до %1$s</string>
|
||||
<string name="fm_drive_access_text">Android позволява на DroidDeck да вижда това устройство, но не и да го чете. Включете Достъп до всички файлове за DroidDeck и се върнете.</string>
|
||||
<string name="fm_list_view">Изглед като списък</string>
|
||||
<string name="fm_grid_view">Изглед като мрежа</string>
|
||||
<string name="fm_search">Търсене</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">Настрой Flatpak първо</string>
|
||||
<string name="flatpakmgr_starting">Стартиране</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak приключи със код %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s е създадено за %2$s, което DroidDeck не може да изпълнява. Приложенията Flatpak тук трябва да са за ARM64 или x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Инсталиране на %1$s</string>
|
||||
<string name="flatpakmgr_updating">Актуализиране на %1$s</string>
|
||||
<string name="flatpakmgr_removing">Премахване на %1$s</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">Цел</string>
|
||||
<string name="edit_start_in">Старт в</string>
|
||||
<string name="edit_launch_options">Настройки за стартиране</string>
|
||||
<string name="edit_launch_options_steam_hint">Общи са със „Свойства“ в Steam: промяна на едното място се вижда и на двете.</string>
|
||||
<string name="edit_launch_options_not_saved">Настройките за стартиране не можаха да бъдат запазени в Steam. Опитайте отново.</string>
|
||||
<string name="edit_launch_options_desktop">Steam може да е отворен в сесията на работния плот. Променете настройките за стартиране в неговите „Свойства“ или първо затворете сесията.</string>
|
||||
<string name="edit_artwork">Визия</string>
|
||||
<string name="edit_other_exe">Друг exe…</string>
|
||||
<string name="edit_remove">Премахни</string>
|
||||
|
||||
@@ -705,7 +705,6 @@
|
||||
<string name="hud_export_failed">Zprávu HUD se nepodařilo uložit.</string>
|
||||
<string name="hud_reset">Obnovit nastavení HUD</string>
|
||||
<string name="hud_reset_button">Obnovit</string>
|
||||
<string name="hud_credit">FusionHUD od The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Režim škálování</string>
|
||||
<string name="drawer_scaling_sharpness">Ostrost škálování</string>
|
||||
<string name="drawer_effects">Efekty obrazovky</string>
|
||||
@@ -1741,6 +1740,8 @@
|
||||
<string name="fm_accept">Přijmout</string>
|
||||
<string name="fm_decline">Odmítnout</string>
|
||||
<string name="fm_drive_not_readable">%1$s je připojeno, ale momentálně není čitelné</string>
|
||||
<string name="fm_drive_access_title">Povolit přístup k %1$s</string>
|
||||
<string name="fm_drive_access_text">Android umožňuje aplikaci DroidDeck tento disk vidět, ale ne číst. Zapněte pro DroidDeck Přístup ke všem souborům a pak se vraťte.</string>
|
||||
<string name="fm_list_view">Zobrazení seznamu</string>
|
||||
<string name="fm_grid_view">Zobrazení mřížky</string>
|
||||
<string name="fm_search">Hledat</string>
|
||||
@@ -1846,6 +1847,7 @@
|
||||
<string name="flatpakmgr_not_ready">Nejprve nastavte Flatpak</string>
|
||||
<string name="flatpakmgr_starting">Spouštění</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak skončil s návratovým kódem %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s je sestaveno pro %2$s, které DroidDeck neumí spustit. Aplikace Flatpak zde potřebují verzi pro ARM64 nebo x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Instalování %1$s</string>
|
||||
<string name="flatpakmgr_updating">Aktualizování %1$s</string>
|
||||
<string name="flatpakmgr_removing">Odstraňování %1$s</string>
|
||||
@@ -2425,6 +2427,9 @@
|
||||
<string name="edit_target">Cíl</string>
|
||||
<string name="edit_start_in">Spustit v</string>
|
||||
<string name="edit_launch_options">Možnosti spuštění</string>
|
||||
<string name="edit_launch_options_steam_hint">Sdíleno s Vlastnostmi ve Steamu: změna na jednom místě se projeví na obou.</string>
|
||||
<string name="edit_launch_options_not_saved">Možnosti spuštění se nepodařilo uložit do Steamu. Zkuste to znovu.</string>
|
||||
<string name="edit_launch_options_desktop">Steam může být otevřený v relaci Plochy. Změňte možnosti spuštění v jeho Vlastnostech, nebo nejdřív relaci ukončete.</string>
|
||||
<string name="edit_artwork">Grafika</string>
|
||||
<string name="edit_other_exe">Jiný exe…</string>
|
||||
<string name="edit_remove">Odstranit</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">HUD-rapporten kunne ikke gemmes.</string>
|
||||
<string name="hud_reset">Nulstil HUD-indstillinger</string>
|
||||
<string name="hud_reset_button">Nulstil</string>
|
||||
<string name="hud_credit">FusionHUD af The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Skaleringstilstand</string>
|
||||
<string name="drawer_scaling_sharpness">Skaleringsskarphed</string>
|
||||
<string name="drawer_effects">Skærmeffekter</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">Accepter</string>
|
||||
<string name="fm_decline">Afvis</string>
|
||||
<string name="fm_drive_not_readable">%1$s er monteret, men kan ikke læses lige nu</string>
|
||||
<string name="fm_drive_access_title">Giv adgang til %1$s</string>
|
||||
<string name="fm_drive_access_text">Android lader DroidDeck se dette drev, men ikke læse det. Slå Adgang til alle filer til for DroidDeck, og kom så tilbage.</string>
|
||||
<string name="fm_list_view">Listevisning</string>
|
||||
<string name="fm_grid_view">Gittervisning</string>
|
||||
<string name="fm_search">Søg</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">Opsæt Flatpak først</string>
|
||||
<string name="flatpakmgr_starting">Starter</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak afsluttede med status %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s er bygget til %2$s, som DroidDeck ikke kan køre. Flatpak-apps her skal være bygget til ARM64 eller x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Installerer %1$s</string>
|
||||
<string name="flatpakmgr_updating">Opdaterer %1$s</string>
|
||||
<string name="flatpakmgr_removing">Fjerner %1$s</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">Mål</string>
|
||||
<string name="edit_start_in">Start i</string>
|
||||
<string name="edit_launch_options">Startindstillinger</string>
|
||||
<string name="edit_launch_options_steam_hint">Delt med Egenskaber i Steam: en ændring det ene sted vises begge steder.</string>
|
||||
<string name="edit_launch_options_not_saved">Startindstillingerne kunne ikke gemmes i Steam. Prøv igen.</string>
|
||||
<string name="edit_launch_options_desktop">Steam kan være åben i skrivebordssessionen. Skift startindstillingerne under dens Egenskaber, eller luk sessionen først.</string>
|
||||
<string name="edit_artwork">Grafik</string>
|
||||
<string name="edit_other_exe">Anden exe…</string>
|
||||
<string name="edit_remove">Fjern</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">Der HUD-Bericht konnte nicht gespeichert werden.</string>
|
||||
<string name="hud_reset">HUD-Einstellungen zurücksetzen</string>
|
||||
<string name="hud_reset_button">Zurücksetzen</string>
|
||||
<string name="hud_credit">FusionHUD von The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Skalierungsmodus</string>
|
||||
<string name="drawer_scaling_sharpness">Skalierungsschärfe</string>
|
||||
<string name="drawer_effects">Bildschirmeffekte</string>
|
||||
@@ -1691,6 +1690,8 @@
|
||||
<string name="fm_accept">Akzeptieren</string>
|
||||
<string name="fm_decline">Ablehnen</string>
|
||||
<string name="fm_drive_not_readable">%1$s ist eingebunden, aber derzeit nicht lesbar</string>
|
||||
<string name="fm_drive_access_title">Zugriff auf %1$s erlauben</string>
|
||||
<string name="fm_drive_access_text">Android lässt DroidDeck dieses Laufwerk sehen, aber nicht lesen. Aktiviere für DroidDeck den Zugriff auf alle Dateien und komm dann zurück.</string>
|
||||
<string name="fm_list_view">Listenansicht</string>
|
||||
<string name="fm_grid_view">Rasteransicht</string>
|
||||
<string name="fm_search">Suchen</string>
|
||||
@@ -1792,6 +1793,7 @@
|
||||
<string name="flatpakmgr_not_ready">Richte zuerst Flatpak ein</string>
|
||||
<string name="flatpakmgr_starting">Wird gestartet</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak wurde mit Status %1$d beendet</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s wurde für %2$s gebaut, das DroidDeck nicht ausführen kann. Flatpak-Apps brauchen hier eine ARM64- oder x86_64-Version.</string>
|
||||
<string name="flatpakmgr_installing">%1$s wird installiert</string>
|
||||
<string name="flatpakmgr_updating">%1$s wird aktualisiert</string>
|
||||
<string name="flatpakmgr_removing">%1$s wird entfernt</string>
|
||||
@@ -2368,6 +2370,9 @@
|
||||
<string name="edit_target">Ziel</string>
|
||||
<string name="edit_start_in">Ausführen in</string>
|
||||
<string name="edit_launch_options">Startoptionen</string>
|
||||
<string name="edit_launch_options_steam_hint">Gemeinsam mit den Eigenschaften in Steam: Eine Änderung an einer Stelle gilt für beide.</string>
|
||||
<string name="edit_launch_options_not_saved">Die Startoptionen konnten nicht in Steam gespeichert werden. Versuche es erneut.</string>
|
||||
<string name="edit_launch_options_desktop">Steam ist eventuell in der Desktop-Sitzung geöffnet. Ändere die Startoptionen dort in den Eigenschaften oder beende zuerst die Sitzung.</string>
|
||||
<string name="edit_artwork">Grafiken</string>
|
||||
<string name="edit_other_exe">Andere EXE…</string>
|
||||
<string name="edit_remove">Entfernen</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">Δεν ήταν δυνατή η αποθήκευση της αναφοράς HUD.</string>
|
||||
<string name="hud_reset">Επαναφορά ρυθμίσεων HUD</string>
|
||||
<string name="hud_reset_button">Επαναφορά</string>
|
||||
<string name="hud_credit">FusionHUD από The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Λειτουργία κλιμάκωσης</string>
|
||||
<string name="drawer_scaling_sharpness">Οξύτητα κλιμάκωσης</string>
|
||||
<string name="drawer_effects">Εφέ οθόνης</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">Αποδοχή</string>
|
||||
<string name="fm_decline">Απόρριψη</string>
|
||||
<string name="fm_drive_not_readable">Το %1$s είναι προσαρτημένο αλλά δεν είναι αναγνώσιμο αυτή τη στιγμή</string>
|
||||
<string name="fm_drive_access_title">Να επιτραπεί η πρόσβαση στο %1$s</string>
|
||||
<string name="fm_drive_access_text">Το Android επιτρέπει στο DroidDeck να βλέπει αυτόν τον δίσκο αλλά όχι να τον διαβάζει. Ενεργοποιήστε την Πρόσβαση σε όλα τα αρχεία για το DroidDeck και επιστρέψτε.</string>
|
||||
<string name="fm_list_view">Προβολή λίστας</string>
|
||||
<string name="fm_grid_view">Προβολή πλέγματος</string>
|
||||
<string name="fm_search">Αναζήτηση</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">Ρυθμίστε πρώτα το Flatpak</string>
|
||||
<string name="flatpakmgr_starting">Γίνεται εκκίνηση</string>
|
||||
<string name="flatpakmgr_exit_status">Το Flatpak έκλεισε με κατάσταση %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">Το %1$s είναι φτιαγμένο για %2$s, που το DroidDeck δεν μπορεί να εκτελέσει. Οι εφαρμογές Flatpak εδώ χρειάζονται έκδοση για ARM64 ή x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Εγκατάσταση %1$s</string>
|
||||
<string name="flatpakmgr_updating">Ενημέρωση %1$s</string>
|
||||
<string name="flatpakmgr_removing">Κατάργηση %1$s</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">Προορισμός</string>
|
||||
<string name="edit_start_in">Εκκίνηση σε</string>
|
||||
<string name="edit_launch_options">Επιλογές εκκίνησης</string>
|
||||
<string name="edit_launch_options_steam_hint">Κοινές με τις Ιδιότητες του Steam: μια αλλαγή στο ένα σημείο εμφανίζεται και στα δύο.</string>
|
||||
<string name="edit_launch_options_not_saved">Δεν ήταν δυνατή η αποθήκευση των επιλογών εκκίνησης στο Steam. Δοκιμάστε ξανά.</string>
|
||||
<string name="edit_launch_options_desktop">Το Steam μπορεί να είναι ανοιχτό στη συνεδρία επιφάνειας εργασίας. Αλλάξτε τις επιλογές εκκίνησης από τις Ιδιότητές του ή κλείστε πρώτα τη συνεδρία.</string>
|
||||
<string name="edit_artwork">Γραφικά</string>
|
||||
<string name="edit_other_exe">Άλλο exe…</string>
|
||||
<string name="edit_remove">Κατάργηση</string>
|
||||
|
||||
@@ -703,7 +703,6 @@
|
||||
<string name="hud_export_failed">No se ha podido guardar el informe del HUD.</string>
|
||||
<string name="hud_reset">Restablecer ajustes del HUD</string>
|
||||
<string name="hud_reset_button">Restablecer</string>
|
||||
<string name="hud_credit">FusionHUD de The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Modo de escalado</string>
|
||||
<string name="drawer_scaling_sharpness">Nitidez del escalado</string>
|
||||
<string name="drawer_effects">Efectos de pantalla</string>
|
||||
@@ -1720,6 +1719,8 @@
|
||||
<string name="fm_accept">Aceptar</string>
|
||||
<string name="fm_decline">Rechazar</string>
|
||||
<string name="fm_drive_not_readable">%1$s está montado, pero ahora mismo no se puede leer</string>
|
||||
<string name="fm_drive_access_title">Permitir acceso a %1$s</string>
|
||||
<string name="fm_drive_access_text">Android deja que DroidDeck vea esta unidad, pero no que la lea. Activa Acceso a todos los archivos para DroidDeck y vuelve.</string>
|
||||
<string name="fm_list_view">Vista de lista</string>
|
||||
<string name="fm_grid_view">Vista de cuadrícula</string>
|
||||
<string name="fm_search">Buscar</string>
|
||||
@@ -1823,6 +1824,7 @@
|
||||
<string name="flatpakmgr_not_ready">Configura Flatpak primero</string>
|
||||
<string name="flatpakmgr_starting">Iniciando</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak terminó con el código %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s está compilado para %2$s, que DroidDeck no puede ejecutar. Aquí las apps Flatpak necesitan una versión para ARM64 o x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Instalando %1$s</string>
|
||||
<string name="flatpakmgr_updating">Actualizando %1$s</string>
|
||||
<string name="flatpakmgr_removing">Quitando %1$s</string>
|
||||
@@ -2399,6 +2401,9 @@
|
||||
<string name="edit_target">Destino</string>
|
||||
<string name="edit_start_in">Iniciar en</string>
|
||||
<string name="edit_launch_options">Opciones de lanzamiento</string>
|
||||
<string name="edit_launch_options_steam_hint">Se comparten con las Propiedades de Steam: un cambio en cualquiera de los dos se ve en ambos.</string>
|
||||
<string name="edit_launch_options_not_saved">No se pudieron guardar las opciones de lanzamiento en Steam. Inténtalo de nuevo.</string>
|
||||
<string name="edit_launch_options_desktop">Puede que Steam esté abierto en la sesión de escritorio. Cambia las opciones de lanzamiento en sus Propiedades o cierra antes la sesión.</string>
|
||||
<string name="edit_artwork">Ilustraciones</string>
|
||||
<string name="edit_other_exe">Otro exe…</string>
|
||||
<string name="edit_remove">Quitar</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">HUD-raporttia ei voitu tallentaa.</string>
|
||||
<string name="hud_reset">Palauta HUD-asetukset</string>
|
||||
<string name="hud_reset_button">Palauta</string>
|
||||
<string name="hud_credit">FusionHUD, tekijä The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Skaalaustila</string>
|
||||
<string name="drawer_scaling_sharpness">Skaalauksen terävyys</string>
|
||||
<string name="drawer_effects">Näyttötehosteet</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">Hyväksy</string>
|
||||
<string name="fm_decline">Hylkää</string>
|
||||
<string name="fm_drive_not_readable">%1$s on liitetty, mutta ei ole luettavissa juuri nyt</string>
|
||||
<string name="fm_drive_access_title">Salli pääsy kohteeseen %1$s</string>
|
||||
<string name="fm_drive_access_text">Android antaa DroidDeckin nähdä tämän aseman mutta ei lukea sitä. Ota DroidDeckille käyttöön Pääsy kaikkiin tiedostoihin ja palaa sitten takaisin.</string>
|
||||
<string name="fm_list_view">Luettelonäkymä</string>
|
||||
<string name="fm_grid_view">Ruudukkonäkymä</string>
|
||||
<string name="fm_search">Hae</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">Asenna Flatpak ensin</string>
|
||||
<string name="flatpakmgr_starting">Käynnistetään</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak sulkeutui tilakoodilla %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s on tehty alustalle %2$s, jota DroidDeck ei pysty ajamaan. Flatpak-sovelluksista tarvitaan täällä ARM64- tai x86_64-versio.</string>
|
||||
<string name="flatpakmgr_installing">Asennetaan %1$s</string>
|
||||
<string name="flatpakmgr_updating">Päivitetään %1$s</string>
|
||||
<string name="flatpakmgr_removing">Poistetaan %1$s</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">Kohde</string>
|
||||
<string name="edit_start_in">Käynnistyskansio</string>
|
||||
<string name="edit_launch_options">Käynnistysasetukset</string>
|
||||
<string name="edit_launch_options_steam_hint">Jaettu Steamin Ominaisuuksien kanssa: muutos jommassakummassa näkyy molemmissa.</string>
|
||||
<string name="edit_launch_options_not_saved">Käynnistysasetuksia ei voitu tallentaa Steamiin. Yritä uudelleen.</string>
|
||||
<string name="edit_launch_options_desktop">Steam voi olla auki työpöytäistunnossa. Muuta käynnistysasetuksia sen Ominaisuuksista tai sulje istunto ensin.</string>
|
||||
<string name="edit_artwork">Kuvitus</string>
|
||||
<string name="edit_other_exe">Toinen exe…</string>
|
||||
<string name="edit_remove">Poista</string>
|
||||
|
||||
@@ -703,7 +703,6 @@
|
||||
<string name="hud_export_failed">Impossible d\'enregistrer le rapport du HUD.</string>
|
||||
<string name="hud_reset">Réinitialiser les paramètres du HUD</string>
|
||||
<string name="hud_reset_button">Réinitialiser</string>
|
||||
<string name="hud_credit">FusionHUD par The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Mode de mise à l\'échelle</string>
|
||||
<string name="drawer_scaling_sharpness">Netteté de la mise à l\'échelle</string>
|
||||
<string name="drawer_effects">Effets d\'écran</string>
|
||||
@@ -1720,6 +1719,8 @@
|
||||
<string name="fm_accept">Accepter</string>
|
||||
<string name="fm_decline">Refuser</string>
|
||||
<string name="fm_drive_not_readable">%1$s est monté, mais illisible pour le moment</string>
|
||||
<string name="fm_drive_access_title">Autoriser l\'accès à %1$s</string>
|
||||
<string name="fm_drive_access_text">Android permet à DroidDeck de voir ce lecteur, mais pas de le lire. Activez l\'accès à tous les fichiers pour DroidDeck, puis revenez.</string>
|
||||
<string name="fm_list_view">Vue en liste</string>
|
||||
<string name="fm_grid_view">Vue en grille</string>
|
||||
<string name="fm_search">Rechercher</string>
|
||||
@@ -1823,6 +1824,7 @@
|
||||
<string name="flatpakmgr_not_ready">Configurez d\'abord Flatpak</string>
|
||||
<string name="flatpakmgr_starting">Démarrage</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak s\'est arrêté avec le code %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s est compilée pour %2$s, que DroidDeck ne peut pas exécuter. Ici, les applis Flatpak doivent exister en version ARM64 ou x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Installation : %1$s</string>
|
||||
<string name="flatpakmgr_updating">Mise à jour : %1$s</string>
|
||||
<string name="flatpakmgr_removing">Suppression : %1$s</string>
|
||||
@@ -2399,6 +2401,9 @@
|
||||
<string name="edit_target">Cible</string>
|
||||
<string name="edit_start_in">Démarrer dans</string>
|
||||
<string name="edit_launch_options">Options de lancement</string>
|
||||
<string name="edit_launch_options_steam_hint">Partagées avec les Propriétés de Steam : une modification d’un côté apparaît des deux.</string>
|
||||
<string name="edit_launch_options_not_saved">Impossible d’enregistrer les options de lancement dans Steam. Réessayez.</string>
|
||||
<string name="edit_launch_options_desktop">Steam est peut-être ouvert dans la session Bureau. Modifiez les options de lancement dans ses Propriétés, ou fermez d’abord la session.</string>
|
||||
<string name="edit_artwork">Illustrations</string>
|
||||
<string name="edit_other_exe">Autre exe…</string>
|
||||
<string name="edit_remove">Retirer</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">HUD रिपोर्ट सेव नहीं हो सकी।</string>
|
||||
<string name="hud_reset">HUD सेटिंग रीसेट करें</string>
|
||||
<string name="hud_reset_button">रीसेट करें</string>
|
||||
<string name="hud_credit">The412Banner का FusionHUD, github.com/The412Banner/FusionHUD (GPL-3.0)।</string>
|
||||
<string name="drawer_scaling">स्केलिंग मोड</string>
|
||||
<string name="drawer_scaling_sharpness">स्केलिंग शार्पनेस</string>
|
||||
<string name="drawer_effects">स्क्रीन इफ़ेक्ट</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">स्वीकार करें</string>
|
||||
<string name="fm_decline">अस्वीकार करें</string>
|
||||
<string name="fm_drive_not_readable">%1$s माउंट है लेकिन अभी पढ़ा नहीं जा सकता</string>
|
||||
<string name="fm_drive_access_title">%1$s तक पहुँच दें</string>
|
||||
<string name="fm_drive_access_text">Android, DroidDeck को यह ड्राइव दिखाता है पर पढ़ने नहीं देता। DroidDeck के लिए सभी फ़ाइलों का ऐक्सेस चालू करें, फिर वापस आएँ।</string>
|
||||
<string name="fm_list_view">लिस्ट व्यू</string>
|
||||
<string name="fm_grid_view">ग्रिड व्यू</string>
|
||||
<string name="fm_search">सर्च</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">पहले Flatpak सेट करें</string>
|
||||
<string name="flatpakmgr_starting">शुरू हो रहा है</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak status %1$d के साथ बंद हुआ</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s %2$s के लिए बना है, जिसे DroidDeck नहीं चला सकता। यहाँ Flatpak ऐप ARM64 या x86_64 के लिए बने होने चाहिए।</string>
|
||||
<string name="flatpakmgr_installing">%1$s इंस्टॉल हो रहा है</string>
|
||||
<string name="flatpakmgr_updating">%1$s अपडेट हो रहा है</string>
|
||||
<string name="flatpakmgr_removing">%1$s हटाया जा रहा है</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">टार्गेट</string>
|
||||
<string name="edit_start_in">यहां शुरू करें</string>
|
||||
<string name="edit_launch_options">लॉन्च विकल्प</string>
|
||||
<string name="edit_launch_options_steam_hint">Steam की Properties के साथ साझा: किसी एक जगह किया गया बदलाव दोनों में दिखता है।</string>
|
||||
<string name="edit_launch_options_not_saved">लॉन्च विकल्प Steam में सहेजे नहीं जा सके। फिर से कोशिश करें।</string>
|
||||
<string name="edit_launch_options_desktop">Steam डेस्कटॉप सेशन में खुला हो सकता है। लॉन्च विकल्प उसकी Properties में बदलें, या पहले सेशन बंद करें।</string>
|
||||
<string name="edit_artwork">आर्टवर्क</string>
|
||||
<string name="edit_other_exe">दूसरा exe…</string>
|
||||
<string name="edit_remove">हटाएं</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">Nem sikerült menteni a HUD-jelentést.</string>
|
||||
<string name="hud_reset">HUD-beállítások visszaállítása</string>
|
||||
<string name="hud_reset_button">Visszaállítás</string>
|
||||
<string name="hud_credit">FusionHUD, készítette: The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Méretezési mód</string>
|
||||
<string name="drawer_scaling_sharpness">Méretezési élesség</string>
|
||||
<string name="drawer_effects">Képernyőeffektek</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">Elfogadom</string>
|
||||
<string name="fm_decline">Elutasítom</string>
|
||||
<string name="fm_drive_not_readable">A %1$s csatolva van, de jelenleg nem olvasható</string>
|
||||
<string name="fm_drive_access_title">Hozzáférés engedélyezése: %1$s</string>
|
||||
<string name="fm_drive_access_text">Az Android látni engedi a DroidDecknek ezt a meghajtót, de olvasni nem. Kapcsold be a DroidDecknél az Összes fájlhoz való hozzáférést, majd gyere vissza.</string>
|
||||
<string name="fm_list_view">Listanézet</string>
|
||||
<string name="fm_grid_view">Rácsnézet</string>
|
||||
<string name="fm_search">Keresés</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">Előbb állítsa be a Flatpakot</string>
|
||||
<string name="flatpakmgr_starting">Indítás</string>
|
||||
<string name="flatpakmgr_exit_status">A Flatpak %1$d állapotkóddal lépett ki</string>
|
||||
<string name="flatpakmgr_wrong_arch">A(z) %1$s %2$s rendszerre készült, ezt a DroidDeck nem tudja futtatni. Az itteni Flatpak-alkalmazásoknak ARM64- vagy x86_64-változat kell.</string>
|
||||
<string name="flatpakmgr_installing">%1$s telepítése</string>
|
||||
<string name="flatpakmgr_updating">%1$s frissítése</string>
|
||||
<string name="flatpakmgr_removing">%1$s eltávolítása</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">Cél</string>
|
||||
<string name="edit_start_in">Indítás innen</string>
|
||||
<string name="edit_launch_options">Indítási beállítások</string>
|
||||
<string name="edit_launch_options_steam_hint">Közös a Steam Tulajdonságaival: az egyik helyen végzett módosítás mindkettőben megjelenik.</string>
|
||||
<string name="edit_launch_options_not_saved">Az indítási beállításokat nem sikerült menteni a Steambe. Próbáld újra.</string>
|
||||
<string name="edit_launch_options_desktop">Lehet, hogy a Steam nyitva van az asztali munkamenetben. Módosítsd az indítási beállításokat a Tulajdonságaiban, vagy előbb zárd be a munkamenetet.</string>
|
||||
<string name="edit_artwork">Illusztráció</string>
|
||||
<string name="edit_other_exe">Másik exe…</string>
|
||||
<string name="edit_remove">Eltávolítás</string>
|
||||
|
||||
@@ -699,7 +699,6 @@
|
||||
<string name="hud_export_failed">Tidak dapat menyimpan laporan HUD.</string>
|
||||
<string name="hud_reset">Setel ulang setelan HUD</string>
|
||||
<string name="hud_reset_button">Setel ulang</string>
|
||||
<string name="hud_credit">FusionHUD oleh The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Mode penskalaan</string>
|
||||
<string name="drawer_scaling_sharpness">Ketajaman penskalaan</string>
|
||||
<string name="drawer_effects">Efek layar</string>
|
||||
@@ -1678,6 +1677,8 @@
|
||||
<string name="fm_accept">Terima</string>
|
||||
<string name="fm_decline">Tolak</string>
|
||||
<string name="fm_drive_not_readable">%1$s terpasang tetapi tidak dapat dibaca saat ini</string>
|
||||
<string name="fm_drive_access_title">Izinkan akses ke %1$s</string>
|
||||
<string name="fm_drive_access_text">Android mengizinkan DroidDeck melihat drive ini tetapi tidak membacanya. Aktifkan Akses semua file untuk DroidDeck, lalu kembali.</string>
|
||||
<string name="fm_list_view">Tampilan daftar</string>
|
||||
<string name="fm_grid_view">Tampilan kisi</string>
|
||||
<string name="fm_search">Cari</string>
|
||||
@@ -1777,6 +1778,7 @@
|
||||
<string name="flatpakmgr_not_ready">Siapkan Flatpak terlebih dahulu</string>
|
||||
<string name="flatpakmgr_starting">Memulai</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak keluar dengan status %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s dibuat untuk %2$s, yang tidak dapat dijalankan DroidDeck. Aplikasi Flatpak di sini memerlukan versi ARM64 atau x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Menginstal %1$s</string>
|
||||
<string name="flatpakmgr_updating">Memperbarui %1$s</string>
|
||||
<string name="flatpakmgr_removing">Menghapus %1$s</string>
|
||||
@@ -2356,6 +2358,9 @@
|
||||
<string name="edit_target">Target</string>
|
||||
<string name="edit_start_in">Mulai di</string>
|
||||
<string name="edit_launch_options">Opsi peluncuran</string>
|
||||
<string name="edit_launch_options_steam_hint">Dibagikan dengan Properti Steam: perubahan di salah satunya muncul di keduanya.</string>
|
||||
<string name="edit_launch_options_not_saved">Tidak dapat menyimpan opsi peluncuran ke Steam. Coba lagi.</string>
|
||||
<string name="edit_launch_options_desktop">Steam mungkin terbuka di sesi desktop. Ubah opsi peluncuran di Properti Steam, atau tutup sesinya terlebih dahulu.</string>
|
||||
<string name="edit_artwork">Artwork</string>
|
||||
<string name="edit_other_exe">Exe lain…</string>
|
||||
<string name="edit_remove">Hapus</string>
|
||||
|
||||
@@ -703,7 +703,6 @@
|
||||
<string name="hud_export_failed">Impossibile salvare il rapporto dell\'HUD.</string>
|
||||
<string name="hud_reset">Ripristina impostazioni HUD</string>
|
||||
<string name="hud_reset_button">Ripristina</string>
|
||||
<string name="hud_credit">FusionHUD di The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Modalità di ridimensionamento</string>
|
||||
<string name="drawer_scaling_sharpness">Nitidezza del ridimensionamento</string>
|
||||
<string name="drawer_effects">Effetti schermo</string>
|
||||
@@ -1712,6 +1711,8 @@
|
||||
<string name="fm_accept">Accetta</string>
|
||||
<string name="fm_decline">Rifiuta</string>
|
||||
<string name="fm_drive_not_readable">%1$s: montata ma al momento non leggibile</string>
|
||||
<string name="fm_drive_access_title">Consenti l\'accesso a %1$s</string>
|
||||
<string name="fm_drive_access_text">Android permette a DroidDeck di vedere questa unità ma non di leggerla. Attiva Accesso a tutti i file per DroidDeck, poi torna qui.</string>
|
||||
<string name="fm_list_view">Visualizzazione elenco</string>
|
||||
<string name="fm_grid_view">Visualizzazione griglia</string>
|
||||
<string name="fm_search">Cerca</string>
|
||||
@@ -1815,6 +1816,7 @@
|
||||
<string name="flatpakmgr_not_ready">Configura prima Flatpak</string>
|
||||
<string name="flatpakmgr_starting">Avvio</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak è terminato con stato %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s è compilata per %2$s, che DroidDeck non può eseguire. Qui le app Flatpak richiedono una versione per ARM64 o x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Installazione di %1$s</string>
|
||||
<string name="flatpakmgr_updating">Aggiornamento di %1$s</string>
|
||||
<string name="flatpakmgr_removing">Rimozione di %1$s</string>
|
||||
@@ -2391,6 +2393,9 @@
|
||||
<string name="edit_target">Destinazione</string>
|
||||
<string name="edit_start_in">Avvia in</string>
|
||||
<string name="edit_launch_options">Opzioni di avvio</string>
|
||||
<string name="edit_launch_options_steam_hint">Condivise con le Proprietà di Steam: una modifica in uno dei due punti compare in entrambi.</string>
|
||||
<string name="edit_launch_options_not_saved">Impossibile salvare le opzioni di avvio in Steam. Riprova.</string>
|
||||
<string name="edit_launch_options_desktop">Steam potrebbe essere aperto nella sessione desktop. Cambia le opzioni di avvio nelle sue Proprietà o chiudi prima la sessione.</string>
|
||||
<string name="edit_artwork">Illustrazioni</string>
|
||||
<string name="edit_other_exe">Altro exe…</string>
|
||||
<string name="edit_remove">Rimuovi</string>
|
||||
|
||||
@@ -688,7 +688,6 @@
|
||||
<string name="hud_export_failed">HUDレポートを保存できませんでした。</string>
|
||||
<string name="hud_reset">HUD設定をリセット</string>
|
||||
<string name="hud_reset_button">リセット</string>
|
||||
<string name="hud_credit">FusionHUD 作者:The412Banner、github.com/The412Banner/FusionHUD (GPL-3.0)。</string>
|
||||
<string name="drawer_scaling">スケーリングモード</string>
|
||||
<string name="drawer_scaling_sharpness">スケーリングのシャープネス</string>
|
||||
<string name="drawer_effects">画面エフェクト</string>
|
||||
@@ -1649,6 +1648,8 @@
|
||||
<string name="fm_accept">承諾</string>
|
||||
<string name="fm_decline">拒否</string>
|
||||
<string name="fm_drive_not_readable">%1$sはマウントされていますが、現在読み取れません</string>
|
||||
<string name="fm_drive_access_title">%1$sへのアクセスを許可</string>
|
||||
<string name="fm_drive_access_text">Android では DroidDeck がこのドライブを表示できますが、読み取れません。DroidDeck の「全ファイルへのアクセス」をオンにしてから戻ってください。</string>
|
||||
<string name="fm_list_view">リスト表示</string>
|
||||
<string name="fm_grid_view">グリッド表示</string>
|
||||
<string name="fm_search">検索</string>
|
||||
@@ -1748,6 +1749,7 @@
|
||||
<string name="flatpakmgr_not_ready">先にFlatpakをセットアップしてください</string>
|
||||
<string name="flatpakmgr_starting">開始中</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpakがステータス%1$dで終了しました</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s は DroidDeck で実行できない %2$s 向けにビルドされています。ここでは Flatpak アプリに ARM64 または x86_64 版が必要です。</string>
|
||||
<string name="flatpakmgr_installing">%1$sをインストール中</string>
|
||||
<string name="flatpakmgr_updating">%1$sを更新中</string>
|
||||
<string name="flatpakmgr_removing">%1$sを削除中</string>
|
||||
@@ -2323,6 +2325,9 @@
|
||||
<string name="edit_target">ターゲット</string>
|
||||
<string name="edit_start_in">開始フォルダ</string>
|
||||
<string name="edit_launch_options">起動オプション</string>
|
||||
<string name="edit_launch_options_steam_hint">Steam のプロパティと共通です。どちらかで変更すると両方に反映されます。</string>
|
||||
<string name="edit_launch_options_not_saved">起動オプションを Steam に保存できませんでした。もう一度お試しください。</string>
|
||||
<string name="edit_launch_options_desktop">デスクトップのセッションで Steam が開いている可能性があります。Steam のプロパティで起動オプションを変更するか、先にセッションを終了してください。</string>
|
||||
<string name="edit_artwork">アートワーク</string>
|
||||
<string name="edit_other_exe">別の exe…</string>
|
||||
<string name="edit_remove">削除</string>
|
||||
|
||||
@@ -699,7 +699,6 @@
|
||||
<string name="hud_export_failed">HUD 보고서를 저장할 수 없습니다.</string>
|
||||
<string name="hud_reset">HUD 설정 초기화</string>
|
||||
<string name="hud_reset_button">초기화</string>
|
||||
<string name="hud_credit">FusionHUD 제작: The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">스케일링 모드</string>
|
||||
<string name="drawer_scaling_sharpness">스케일링 선명도</string>
|
||||
<string name="drawer_effects">화면 효과</string>
|
||||
@@ -1678,6 +1677,8 @@
|
||||
<string name="fm_accept">수락</string>
|
||||
<string name="fm_decline">거절</string>
|
||||
<string name="fm_drive_not_readable">%1$s이(가) 마운트되었지만 지금은 읽을 수 없습니다</string>
|
||||
<string name="fm_drive_access_title">%1$s 액세스 허용</string>
|
||||
<string name="fm_drive_access_text">Android에서 DroidDeck이 이 드라이브를 볼 수는 있지만 읽을 수는 없습니다. DroidDeck의 모든 파일 액세스를 켠 다음 돌아오세요.</string>
|
||||
<string name="fm_list_view">목록 보기</string>
|
||||
<string name="fm_grid_view">격자 보기</string>
|
||||
<string name="fm_search">검색</string>
|
||||
@@ -1777,6 +1778,7 @@
|
||||
<string name="flatpakmgr_not_ready">먼저 Flatpak을 설정하세요</string>
|
||||
<string name="flatpakmgr_starting">시작 중</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak이 종료되었습니다(상태 %1$d)</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s은(는) DroidDeck이 실행할 수 없는 %2$s용으로 빌드되었습니다. 여기서 Flatpak 앱은 ARM64 또는 x86_64 빌드여야 합니다.</string>
|
||||
<string name="flatpakmgr_installing">%1$s 설치 중</string>
|
||||
<string name="flatpakmgr_updating">%1$s 업데이트 중</string>
|
||||
<string name="flatpakmgr_removing">%1$s 제거 중</string>
|
||||
@@ -2356,6 +2358,9 @@
|
||||
<string name="edit_target">대상</string>
|
||||
<string name="edit_start_in">시작 위치</string>
|
||||
<string name="edit_launch_options">실행 옵션</string>
|
||||
<string name="edit_launch_options_steam_hint">Steam 속성과 공유됩니다. 어느 한쪽에서 바꾸면 양쪽에 모두 반영됩니다.</string>
|
||||
<string name="edit_launch_options_not_saved">실행 옵션을 Steam에 저장하지 못했습니다. 다시 시도하세요.</string>
|
||||
<string name="edit_launch_options_desktop">데스크톱 세션에서 Steam이 열려 있을 수 있습니다. Steam 속성에서 실행 옵션을 바꾸거나 먼저 세션을 닫으세요.</string>
|
||||
<string name="edit_artwork">아트워크</string>
|
||||
<string name="edit_other_exe">다른 exe…</string>
|
||||
<string name="edit_remove">제거</string>
|
||||
|
||||
@@ -699,7 +699,6 @@
|
||||
<string name="hud_export_failed">Tidak dapat menyimpan laporan HUD.</string>
|
||||
<string name="hud_reset">Set semula tetapan HUD</string>
|
||||
<string name="hud_reset_button">Set semula</string>
|
||||
<string name="hud_credit">FusionHUD oleh The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Mod penskalaan</string>
|
||||
<string name="drawer_scaling_sharpness">Ketajaman penskalaan</string>
|
||||
<string name="drawer_effects">Kesan skrin</string>
|
||||
@@ -1678,6 +1677,8 @@
|
||||
<string name="fm_accept">Terima</string>
|
||||
<string name="fm_decline">Tolak</string>
|
||||
<string name="fm_drive_not_readable">%1$s dilekapkan tetapi tidak dapat dibaca sekarang</string>
|
||||
<string name="fm_drive_access_title">Benarkan akses kepada %1$s</string>
|
||||
<string name="fm_drive_access_text">Android membenarkan DroidDeck melihat pemacu ini tetapi tidak membacanya. Hidupkan Akses semua fail untuk DroidDeck, kemudian kembali.</string>
|
||||
<string name="fm_list_view">Paparan senarai</string>
|
||||
<string name="fm_grid_view">Paparan grid</string>
|
||||
<string name="fm_search">Cari</string>
|
||||
@@ -1777,6 +1778,7 @@
|
||||
<string name="flatpakmgr_not_ready">Sediakan Flatpak dahulu</string>
|
||||
<string name="flatpakmgr_starting">Memulakan</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak keluar dengan status %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s dibina untuk %2$s, yang tidak dapat dijalankan oleh DroidDeck. Apl Flatpak di sini memerlukan binaan ARM64 atau x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Memasang %1$s</string>
|
||||
<string name="flatpakmgr_updating">Mengemas kini %1$s</string>
|
||||
<string name="flatpakmgr_removing">Mengalih keluar %1$s</string>
|
||||
@@ -2356,6 +2358,9 @@
|
||||
<string name="edit_target">Sasaran</string>
|
||||
<string name="edit_start_in">Mula dalam</string>
|
||||
<string name="edit_launch_options">Pilihan pelancaran</string>
|
||||
<string name="edit_launch_options_steam_hint">Dikongsi dengan Properties dalam Steam: perubahan di salah satu tempat dipaparkan di kedua-duanya.</string>
|
||||
<string name="edit_launch_options_not_saved">Tidak dapat menyimpan pilihan pelancaran ke Steam. Cuba lagi.</string>
|
||||
<string name="edit_launch_options_desktop">Steam mungkin terbuka dalam sesi desktop. Tukar pilihan pelancaran dalam Properties Steam, atau tutup sesi itu dahulu.</string>
|
||||
<string name="edit_artwork">Seni</string>
|
||||
<string name="edit_other_exe">Exe lain…</string>
|
||||
<string name="edit_remove">Alih keluar</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">Kunne ikke lagre HUD-rapporten.</string>
|
||||
<string name="hud_reset">Tilbakestill HUD-innstillinger</string>
|
||||
<string name="hud_reset_button">Tilbakestill</string>
|
||||
<string name="hud_credit">FusionHUD av The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Skaleringsmodus</string>
|
||||
<string name="drawer_scaling_sharpness">Skaleringsskarphet</string>
|
||||
<string name="drawer_effects">Skjermeffekter</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">Godta</string>
|
||||
<string name="fm_decline">Avslå</string>
|
||||
<string name="fm_drive_not_readable">%1$s er montert, men ikke lesbar akkurat nå</string>
|
||||
<string name="fm_drive_access_title">Gi tilgang til %1$s</string>
|
||||
<string name="fm_drive_access_text">Android lar DroidDeck se denne stasjonen, men ikke lese den. Slå på Tilgang til alle filer for DroidDeck, og kom så tilbake.</string>
|
||||
<string name="fm_list_view">Listevisning</string>
|
||||
<string name="fm_grid_view">Rutenettvisning</string>
|
||||
<string name="fm_search">Søk</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">Sett opp Flatpak først</string>
|
||||
<string name="flatpakmgr_starting">Starter</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak avsluttet med status %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s er bygget for %2$s, som DroidDeck ikke kan kjøre. Flatpak-apper her trenger en ARM64- eller x86_64-versjon.</string>
|
||||
<string name="flatpakmgr_installing">Installerer %1$s</string>
|
||||
<string name="flatpakmgr_updating">Oppdaterer %1$s</string>
|
||||
<string name="flatpakmgr_removing">Fjerner %1$s</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">Mål</string>
|
||||
<string name="edit_start_in">Start i</string>
|
||||
<string name="edit_launch_options">Startalternativer</string>
|
||||
<string name="edit_launch_options_steam_hint">Delt med Egenskaper i Steam: en endring det ene stedet vises begge steder.</string>
|
||||
<string name="edit_launch_options_not_saved">Kunne ikke lagre startalternativene i Steam. Prøv igjen.</string>
|
||||
<string name="edit_launch_options_desktop">Steam kan være åpent i skrivebordssesjonen. Endre startalternativene under Egenskaper der, eller lukk sesjonen først.</string>
|
||||
<string name="edit_artwork">Grafikk</string>
|
||||
<string name="edit_other_exe">Annen exe…</string>
|
||||
<string name="edit_remove">Fjern</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">Kan het HUD-rapport niet opslaan.</string>
|
||||
<string name="hud_reset">HUD-instellingen resetten</string>
|
||||
<string name="hud_reset_button">Resetten</string>
|
||||
<string name="hud_credit">FusionHUD door The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Schaalmodus</string>
|
||||
<string name="drawer_scaling_sharpness">Schaalscherpte</string>
|
||||
<string name="drawer_effects">Schermeffecten</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">Accepteren</string>
|
||||
<string name="fm_decline">Weigeren</string>
|
||||
<string name="fm_drive_not_readable">%1$s is gekoppeld, maar nu niet leesbaar</string>
|
||||
<string name="fm_drive_access_title">Toegang tot %1$s toestaan</string>
|
||||
<string name="fm_drive_access_text">Android laat DroidDeck deze schijf zien, maar niet lezen. Zet Toegang tot alle bestanden aan voor DroidDeck en kom daarna terug.</string>
|
||||
<string name="fm_list_view">Lijstweergave</string>
|
||||
<string name="fm_grid_view">Rasterweergave</string>
|
||||
<string name="fm_search">Zoeken</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">Stel eerst Flatpak in</string>
|
||||
<string name="flatpakmgr_starting">Starten</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak is gestopt met status %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s is gebouwd voor %2$s, wat DroidDeck niet kan draaien. Flatpak-apps hebben hier een ARM64- of x86_64-versie nodig.</string>
|
||||
<string name="flatpakmgr_installing">%1$s installeren</string>
|
||||
<string name="flatpakmgr_updating">%1$s updaten</string>
|
||||
<string name="flatpakmgr_removing">%1$s verwijderen</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">Doel</string>
|
||||
<string name="edit_start_in">Beginnen in</string>
|
||||
<string name="edit_launch_options">Opstartopties</string>
|
||||
<string name="edit_launch_options_steam_hint">Gedeeld met de Eigenschappen in Steam: een wijziging op de ene plek is op beide te zien.</string>
|
||||
<string name="edit_launch_options_not_saved">De opstartopties konden niet in Steam worden opgeslagen. Probeer het opnieuw.</string>
|
||||
<string name="edit_launch_options_desktop">Steam is misschien geopend in de desktopsessie. Wijzig de opstartopties daar in de Eigenschappen, of sluit eerst de sessie.</string>
|
||||
<string name="edit_artwork">Artwork</string>
|
||||
<string name="edit_other_exe">Andere exe…</string>
|
||||
<string name="edit_remove">Verwijderen</string>
|
||||
|
||||
@@ -705,7 +705,6 @@
|
||||
<string name="hud_export_failed">Nie udało się zapisać raportu HUD.</string>
|
||||
<string name="hud_reset">Zresetuj ustawienia HUD</string>
|
||||
<string name="hud_reset_button">Resetuj</string>
|
||||
<string name="hud_credit">FusionHUD autorstwa The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Tryb skalowania</string>
|
||||
<string name="drawer_scaling_sharpness">Ostrość skalowania</string>
|
||||
<string name="drawer_effects">Efekty ekranowe</string>
|
||||
@@ -1741,6 +1740,8 @@
|
||||
<string name="fm_accept">Akceptuj</string>
|
||||
<string name="fm_decline">Odrzuć</string>
|
||||
<string name="fm_drive_not_readable">%1$s: zamontowano, ale obecnie nie można odczytać</string>
|
||||
<string name="fm_drive_access_title">Zezwól na dostęp do %1$s</string>
|
||||
<string name="fm_drive_access_text">Android pozwala DroidDeck widzieć ten dysk, ale nie odczytywać go. Włącz dla DroidDeck dostęp do wszystkich plików, a potem wróć.</string>
|
||||
<string name="fm_list_view">Widok listy</string>
|
||||
<string name="fm_grid_view">Widok siatki</string>
|
||||
<string name="fm_search">Szukaj</string>
|
||||
@@ -1846,6 +1847,7 @@
|
||||
<string name="flatpakmgr_not_ready">Najpierw skonfiguruj Flatpak</string>
|
||||
<string name="flatpakmgr_starting">Rozpoczynanie</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak zakończył działanie z kodem %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s zbudowano dla %2$s, czego DroidDeck nie potrafi uruchomić. Aplikacje Flatpak potrzebują tu wersji dla ARM64 lub x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Instalowanie %1$s</string>
|
||||
<string name="flatpakmgr_updating">Aktualizowanie %1$s</string>
|
||||
<string name="flatpakmgr_removing">Usuwanie %1$s</string>
|
||||
@@ -2425,6 +2427,9 @@
|
||||
<string name="edit_target">Element docelowy</string>
|
||||
<string name="edit_start_in">Uruchom w</string>
|
||||
<string name="edit_launch_options">Opcje uruchamiania</string>
|
||||
<string name="edit_launch_options_steam_hint">Wspólne z Właściwościami w Steam: zmiana w jednym miejscu jest widoczna w obu.</string>
|
||||
<string name="edit_launch_options_not_saved">Nie udało się zapisać opcji uruchamiania w Steam. Spróbuj ponownie.</string>
|
||||
<string name="edit_launch_options_desktop">Steam może być otwarty w sesji pulpitu. Zmień opcje uruchamiania w jego Właściwościach albo najpierw zamknij sesję.</string>
|
||||
<string name="edit_artwork">Grafika</string>
|
||||
<string name="edit_other_exe">Inny plik exe…</string>
|
||||
<string name="edit_remove">Usuń</string>
|
||||
|
||||
@@ -703,7 +703,6 @@
|
||||
<string name="hud_export_failed">Não foi possível guardar o relatório do HUD.</string>
|
||||
<string name="hud_reset">Repor definições do HUD</string>
|
||||
<string name="hud_reset_button">Repor</string>
|
||||
<string name="hud_credit">FusionHUD por The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Modo de escala</string>
|
||||
<string name="drawer_scaling_sharpness">Nitidez da escala</string>
|
||||
<string name="drawer_effects">Efeitos de ecrã</string>
|
||||
@@ -1712,6 +1711,8 @@
|
||||
<string name="fm_accept">Aceitar</string>
|
||||
<string name="fm_decline">Recusar</string>
|
||||
<string name="fm_drive_not_readable">%1$s está montado, mas não é possível lê-lo de momento</string>
|
||||
<string name="fm_drive_access_title">Permitir acesso a %1$s</string>
|
||||
<string name="fm_drive_access_text">O Android deixa o DroidDeck ver esta unidade, mas não lê-la. Ative o Acesso a todos os ficheiros para o DroidDeck e volte.</string>
|
||||
<string name="fm_list_view">Vista de lista</string>
|
||||
<string name="fm_grid_view">Vista de grelha</string>
|
||||
<string name="fm_search">Pesquisar</string>
|
||||
@@ -1815,6 +1816,7 @@
|
||||
<string name="flatpakmgr_not_ready">Configure primeiro o Flatpak</string>
|
||||
<string name="flatpakmgr_starting">A iniciar</string>
|
||||
<string name="flatpakmgr_exit_status">O Flatpak terminou com o código %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s foi compilado para %2$s, que o DroidDeck não consegue executar. Aqui as apps Flatpak precisam de uma versão para ARM64 ou x86_64.</string>
|
||||
<string name="flatpakmgr_installing">A instalar %1$s</string>
|
||||
<string name="flatpakmgr_updating">A atualizar %1$s</string>
|
||||
<string name="flatpakmgr_removing">A remover %1$s</string>
|
||||
@@ -2391,6 +2393,9 @@
|
||||
<string name="edit_target">Destino</string>
|
||||
<string name="edit_start_in">Iniciar em</string>
|
||||
<string name="edit_launch_options">Opções de arranque</string>
|
||||
<string name="edit_launch_options_steam_hint">Partilhadas com as Propriedades do Steam: uma alteração num dos locais aparece em ambos.</string>
|
||||
<string name="edit_launch_options_not_saved">Não foi possível guardar as opções de arranque no Steam. Tenta novamente.</string>
|
||||
<string name="edit_launch_options_desktop">O Steam pode estar aberto na sessão do ambiente de trabalho. Altera as opções de arranque nas Propriedades dele, ou fecha primeiro a sessão.</string>
|
||||
<string name="edit_artwork">Imagens</string>
|
||||
<string name="edit_other_exe">Outro exe…</string>
|
||||
<string name="edit_remove">Remover</string>
|
||||
|
||||
@@ -703,7 +703,6 @@
|
||||
<string name="hud_export_failed">Não foi possível salvar o relatório do HUD.</string>
|
||||
<string name="hud_reset">Redefinir configurações do HUD</string>
|
||||
<string name="hud_reset_button">Redefinir</string>
|
||||
<string name="hud_credit">FusionHUD por The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Modo de escala</string>
|
||||
<string name="drawer_scaling_sharpness">Nitidez da escala</string>
|
||||
<string name="drawer_effects">Efeitos de tela</string>
|
||||
@@ -1712,6 +1711,8 @@
|
||||
<string name="fm_accept">Aceitar</string>
|
||||
<string name="fm_decline">Recusar</string>
|
||||
<string name="fm_drive_not_readable">%1$s está montado, mas não pode ser lido agora</string>
|
||||
<string name="fm_drive_access_title">Permitir acesso a %1$s</string>
|
||||
<string name="fm_drive_access_text">O Android deixa o DroidDeck ver esta unidade, mas não ler. Ative o Acesso a todos os arquivos para o DroidDeck e volte.</string>
|
||||
<string name="fm_list_view">Visualização em lista</string>
|
||||
<string name="fm_grid_view">Visualização em grade</string>
|
||||
<string name="fm_search">Pesquisar</string>
|
||||
@@ -1815,6 +1816,7 @@
|
||||
<string name="flatpakmgr_not_ready">Configure o Flatpak primeiro</string>
|
||||
<string name="flatpakmgr_starting">Iniciando</string>
|
||||
<string name="flatpakmgr_exit_status">O Flatpak terminou com o código %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s foi compilado para %2$s, que o DroidDeck não consegue executar. Aqui os apps Flatpak precisam de uma versão para ARM64 ou x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Instalando %1$s</string>
|
||||
<string name="flatpakmgr_updating">Atualizando %1$s</string>
|
||||
<string name="flatpakmgr_removing">Removendo %1$s</string>
|
||||
@@ -2391,6 +2393,9 @@
|
||||
<string name="edit_target">Destino</string>
|
||||
<string name="edit_start_in">Iniciar em</string>
|
||||
<string name="edit_launch_options">Opções de inicialização</string>
|
||||
<string name="edit_launch_options_steam_hint">Compartilhadas com as Propriedades da Steam: uma alteração em um dos lugares aparece nos dois.</string>
|
||||
<string name="edit_launch_options_not_saved">Não foi possível salvar as opções de inicialização na Steam. Tente novamente.</string>
|
||||
<string name="edit_launch_options_desktop">A Steam pode estar aberta na sessão da área de trabalho. Altere as opções de inicialização nas Propriedades dela ou feche a sessão primeiro.</string>
|
||||
<string name="edit_artwork">Artes</string>
|
||||
<string name="edit_other_exe">Outro exe…</string>
|
||||
<string name="edit_remove">Remover</string>
|
||||
|
||||
@@ -703,7 +703,6 @@
|
||||
<string name="hud_export_failed">Raportul HUD nu a putut fi salvat.</string>
|
||||
<string name="hud_reset">Resetează setările HUD</string>
|
||||
<string name="hud_reset_button">Resetează</string>
|
||||
<string name="hud_credit">FusionHUD de The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Mod de scalare</string>
|
||||
<string name="drawer_scaling_sharpness">Claritatea scalării</string>
|
||||
<string name="drawer_effects">Efecte de ecran</string>
|
||||
@@ -1720,6 +1719,8 @@
|
||||
<string name="fm_accept">Acceptă</string>
|
||||
<string name="fm_decline">Refuză</string>
|
||||
<string name="fm_drive_not_readable">%1$s este montat, dar nu poate fi citit acum</string>
|
||||
<string name="fm_drive_access_title">Permite accesul la %1$s</string>
|
||||
<string name="fm_drive_access_text">Android permite DroidDeck să vadă această unitate, dar nu să o citească. Activează Acces la toate fișierele pentru DroidDeck, apoi revino.</string>
|
||||
<string name="fm_list_view">Vizualizare listă</string>
|
||||
<string name="fm_grid_view">Vizualizare grilă</string>
|
||||
<string name="fm_search">Căutare</string>
|
||||
@@ -1823,6 +1824,7 @@
|
||||
<string name="flatpakmgr_not_ready">Configurează mai întâi Flatpak</string>
|
||||
<string name="flatpakmgr_starting">Se pornește</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak s-a închis cu starea %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s este construită pentru %2$s, pe care DroidDeck nu o poate rula. Aici aplicațiile Flatpak au nevoie de o versiune pentru ARM64 sau x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Se instalează %1$s</string>
|
||||
<string name="flatpakmgr_updating">Se actualizează %1$s</string>
|
||||
<string name="flatpakmgr_removing">Se elimină %1$s</string>
|
||||
@@ -2402,6 +2404,9 @@
|
||||
<string name="edit_target">Țintă</string>
|
||||
<string name="edit_start_in">Pornește în</string>
|
||||
<string name="edit_launch_options">Opțiuni de lansare</string>
|
||||
<string name="edit_launch_options_steam_hint">Comune cu Proprietățile din Steam: o modificare într-unul dintre locuri apare în ambele.</string>
|
||||
<string name="edit_launch_options_not_saved">Opțiunile de lansare nu au putut fi salvate în Steam. Încearcă din nou.</string>
|
||||
<string name="edit_launch_options_desktop">Steam poate fi deschis în sesiunea desktop. Schimbă opțiunile de lansare din Proprietățile lui sau închide mai întâi sesiunea.</string>
|
||||
<string name="edit_artwork">Grafică</string>
|
||||
<string name="edit_other_exe">Alt exe…</string>
|
||||
<string name="edit_remove">Elimină</string>
|
||||
|
||||
@@ -705,7 +705,6 @@
|
||||
<string name="hud_export_failed">Не удалось сохранить отчет HUD.</string>
|
||||
<string name="hud_reset">Сбросить настройки HUD</string>
|
||||
<string name="hud_reset_button">Сбросить</string>
|
||||
<string name="hud_credit">FusionHUD от The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Режим масштабирования</string>
|
||||
<string name="drawer_scaling_sharpness">Резкость масштабирования</string>
|
||||
<string name="drawer_effects">Экранные эффекты</string>
|
||||
@@ -1741,6 +1740,8 @@
|
||||
<string name="fm_accept">Принять</string>
|
||||
<string name="fm_decline">Отклонить</string>
|
||||
<string name="fm_drive_not_readable">%1$s: подключено, но сейчас недоступно для чтения</string>
|
||||
<string name="fm_drive_access_title">Разрешить доступ к %1$s</string>
|
||||
<string name="fm_drive_access_text">Android позволяет DroidDeck видеть этот диск, но не читать его. Включите для DroidDeck доступ ко всем файлам и вернитесь.</string>
|
||||
<string name="fm_list_view">Список</string>
|
||||
<string name="fm_grid_view">Сетка</string>
|
||||
<string name="fm_search">Поиск</string>
|
||||
@@ -1846,6 +1847,7 @@
|
||||
<string name="flatpakmgr_not_ready">Сначала настройте Flatpak</string>
|
||||
<string name="flatpakmgr_starting">Запуск</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak завершился с кодом %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s собрано для %2$s, а DroidDeck не может это запустить. Приложениям Flatpak здесь нужна сборка для ARM64 или x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Установка %1$s</string>
|
||||
<string name="flatpakmgr_updating">Обновление %1$s</string>
|
||||
<string name="flatpakmgr_removing">Удаление %1$s</string>
|
||||
@@ -2422,6 +2424,9 @@
|
||||
<string name="edit_target">Объект</string>
|
||||
<string name="edit_start_in">Рабочая папка</string>
|
||||
<string name="edit_launch_options">Параметры запуска</string>
|
||||
<string name="edit_launch_options_steam_hint">Общие со «Свойствами» Steam: изменение в одном месте видно в обоих.</string>
|
||||
<string name="edit_launch_options_not_saved">Не удалось сохранить параметры запуска в Steam. Попробуйте ещё раз.</string>
|
||||
<string name="edit_launch_options_desktop">Steam может быть открыт в сессии рабочего стола. Измените параметры запуска в его «Свойствах» или сначала закройте сессию.</string>
|
||||
<string name="edit_artwork">Обложки</string>
|
||||
<string name="edit_other_exe">Другой exe…</string>
|
||||
<string name="edit_remove">Убрать</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">Det gick inte att spara HUD-rapporten.</string>
|
||||
<string name="hud_reset">Återställ HUD-inställningar</string>
|
||||
<string name="hud_reset_button">Återställ</string>
|
||||
<string name="hud_credit">FusionHUD av The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Skalningsläge</string>
|
||||
<string name="drawer_scaling_sharpness">Skalningsskärpa</string>
|
||||
<string name="drawer_effects">Skärmeffekter</string>
|
||||
@@ -1699,6 +1698,8 @@
|
||||
<string name="fm_accept">Acceptera</string>
|
||||
<string name="fm_decline">Avböj</string>
|
||||
<string name="fm_drive_not_readable">%1$s är monterad men inte läsbar just nu</string>
|
||||
<string name="fm_drive_access_title">Tillåt åtkomst till %1$s</string>
|
||||
<string name="fm_drive_access_text">Android låter DroidDeck se den här enheten men inte läsa den. Slå på Åtkomst till alla filer för DroidDeck och kom sedan tillbaka.</string>
|
||||
<string name="fm_list_view">Listvy</string>
|
||||
<string name="fm_grid_view">Rutnätsvy</string>
|
||||
<string name="fm_search">Sök</string>
|
||||
@@ -1800,6 +1801,7 @@
|
||||
<string name="flatpakmgr_not_ready">Konfigurera Flatpak först</string>
|
||||
<string name="flatpakmgr_starting">Startar</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak avslutades med status %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s är byggd för %2$s, som DroidDeck inte kan köra. Flatpak-appar här behöver en ARM64- eller x86_64-version.</string>
|
||||
<string name="flatpakmgr_installing">Installerar %1$s</string>
|
||||
<string name="flatpakmgr_updating">Uppdaterar %1$s</string>
|
||||
<string name="flatpakmgr_removing">Tar bort %1$s</string>
|
||||
@@ -2379,6 +2381,9 @@
|
||||
<string name="edit_target">Mål</string>
|
||||
<string name="edit_start_in">Starta i</string>
|
||||
<string name="edit_launch_options">Startalternativ</string>
|
||||
<string name="edit_launch_options_steam_hint">Delas med Egenskaper i Steam: en ändring på det ena stället syns på båda.</string>
|
||||
<string name="edit_launch_options_not_saved">Det gick inte att spara startalternativen i Steam. Försök igen.</string>
|
||||
<string name="edit_launch_options_desktop">Steam kan vara öppet i skrivbordssessionen. Ändra startalternativen under Egenskaper där, eller stäng sessionen först.</string>
|
||||
<string name="edit_artwork">Bildmaterial</string>
|
||||
<string name="edit_other_exe">Annan exe…</string>
|
||||
<string name="edit_remove">Ta bort</string>
|
||||
|
||||
@@ -699,7 +699,6 @@
|
||||
<string name="hud_export_failed">บันทึกรายงาน HUD ไม่ได้</string>
|
||||
<string name="hud_reset">รีเซ็ตการตั้งค่า HUD</string>
|
||||
<string name="hud_reset_button">รีเซ็ต</string>
|
||||
<string name="hud_credit">FusionHUD โดย The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0)</string>
|
||||
<string name="drawer_scaling">โหมดการปรับขนาด</string>
|
||||
<string name="drawer_scaling_sharpness">ความคมชัดของการปรับขนาด</string>
|
||||
<string name="drawer_effects">เอฟเฟกต์หน้าจอ</string>
|
||||
@@ -1678,6 +1677,8 @@
|
||||
<string name="fm_accept">ยอมรับ</string>
|
||||
<string name="fm_decline">ปฏิเสธ</string>
|
||||
<string name="fm_drive_not_readable">%1$s ติดตั้งอยู่แต่อ่านไม่ได้ในขณะนี้</string>
|
||||
<string name="fm_drive_access_title">อนุญาตให้เข้าถึง %1$s</string>
|
||||
<string name="fm_drive_access_text">Android ให้ DroidDeck เห็นไดรฟ์นี้แต่อ่านไม่ได้ เปิดสิทธิ์เข้าถึงไฟล์ทั้งหมดให้ DroidDeck แล้วกลับมาที่นี่</string>
|
||||
<string name="fm_list_view">มุมมองรายการ</string>
|
||||
<string name="fm_grid_view">มุมมองตาราง</string>
|
||||
<string name="fm_search">ค้นหา</string>
|
||||
@@ -1777,6 +1778,7 @@
|
||||
<string name="flatpakmgr_not_ready">ตั้งค่า Flatpak ก่อน</string>
|
||||
<string name="flatpakmgr_starting">กำลังเริ่ม</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak ออกด้วยสถานะ %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s สร้างมาสำหรับ %2$s ซึ่ง DroidDeck เรียกใช้ไม่ได้ แอป Flatpak ที่นี่ต้องเป็นเวอร์ชัน ARM64 หรือ x86_64</string>
|
||||
<string name="flatpakmgr_installing">กำลังติดตั้ง %1$s</string>
|
||||
<string name="flatpakmgr_updating">กำลังอัปเดต %1$s</string>
|
||||
<string name="flatpakmgr_removing">กำลังลบ %1$s</string>
|
||||
@@ -2356,6 +2358,9 @@
|
||||
<string name="edit_target">เป้าหมาย</string>
|
||||
<string name="edit_start_in">เริ่มที่</string>
|
||||
<string name="edit_launch_options">ตัวเลือกการเปิด</string>
|
||||
<string name="edit_launch_options_steam_hint">ใช้ร่วมกับคุณสมบัติใน Steam: เปลี่ยนที่ใดที่หนึ่งก็จะแสดงในทั้งสองที่</string>
|
||||
<string name="edit_launch_options_not_saved">บันทึกตัวเลือกการเปิดลงใน Steam ไม่ได้ ลองอีกครั้ง</string>
|
||||
<string name="edit_launch_options_desktop">Steam อาจเปิดอยู่ในเซสชันเดสก์ท็อป เปลี่ยนตัวเลือกการเปิดในคุณสมบัติของ Steam หรือปิดเซสชันก่อน</string>
|
||||
<string name="edit_artwork">ภาพปก</string>
|
||||
<string name="edit_other_exe">exe อื่น…</string>
|
||||
<string name="edit_remove">ลบ</string>
|
||||
|
||||
@@ -701,7 +701,6 @@
|
||||
<string name="hud_export_failed">HUD raporu kaydedilemedi.</string>
|
||||
<string name="hud_reset">HUD ayarlarını sıfırla</string>
|
||||
<string name="hud_reset_button">Sıfırla</string>
|
||||
<string name="hud_credit">FusionHUD, yapımcı: The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Ölçekleme modu</string>
|
||||
<string name="drawer_scaling_sharpness">Ölçekleme keskinliği</string>
|
||||
<string name="drawer_effects">Ekran efektleri</string>
|
||||
@@ -1691,6 +1690,8 @@
|
||||
<string name="fm_accept">Kabul et</string>
|
||||
<string name="fm_decline">Reddet</string>
|
||||
<string name="fm_drive_not_readable">%1$s bağlı ancak şu anda okunamıyor</string>
|
||||
<string name="fm_drive_access_title">%1$s erişimine izin ver</string>
|
||||
<string name="fm_drive_access_text">Android, DroidDeck\'in bu sürücüyü görmesine izin veriyor ama okumasına izin vermiyor. DroidDeck için Tüm dosyalara erişimi açın, sonra geri dönün.</string>
|
||||
<string name="fm_list_view">Liste görünümü</string>
|
||||
<string name="fm_grid_view">Izgara görünümü</string>
|
||||
<string name="fm_search">Ara</string>
|
||||
@@ -1792,6 +1793,7 @@
|
||||
<string name="flatpakmgr_not_ready">Önce Flatpak\'i kurun</string>
|
||||
<string name="flatpakmgr_starting">Başlatılıyor</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak %1$d durum koduyla çıktı</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s, DroidDeck\'in çalıştıramadığı %2$s için derlenmiş. Buradaki Flatpak uygulamalarının ARM64 veya x86_64 sürümü olmalı.</string>
|
||||
<string name="flatpakmgr_installing">%1$s yükleniyor</string>
|
||||
<string name="flatpakmgr_updating">%1$s güncelleniyor</string>
|
||||
<string name="flatpakmgr_removing">%1$s kaldırılıyor</string>
|
||||
@@ -2368,6 +2370,9 @@
|
||||
<string name="edit_target">Hedef</string>
|
||||
<string name="edit_start_in">Başlangıç yeri</string>
|
||||
<string name="edit_launch_options">Başlatma seçenekleri</string>
|
||||
<string name="edit_launch_options_steam_hint">Steam Özellikleri ile ortaktır: birinde yapılan değişiklik ikisinde de görünür.</string>
|
||||
<string name="edit_launch_options_not_saved">Başlatma seçenekleri Steam\'e kaydedilemedi. Tekrar deneyin.</string>
|
||||
<string name="edit_launch_options_desktop">Steam masaüstü oturumunda açık olabilir. Başlatma seçeneklerini Steam Özellikleri\'nden değiştirin veya önce oturumu kapatın.</string>
|
||||
<string name="edit_artwork">Görsel</string>
|
||||
<string name="edit_other_exe">Diğer exe…</string>
|
||||
<string name="edit_remove">Kaldır</string>
|
||||
|
||||
@@ -705,7 +705,6 @@
|
||||
<string name="hud_export_failed">Не вдалося зберегти звіт HUD.</string>
|
||||
<string name="hud_reset">Скинути налаштування HUD</string>
|
||||
<string name="hud_reset_button">Скинути</string>
|
||||
<string name="hud_credit">FusionHUD від The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Режим масштабування</string>
|
||||
<string name="drawer_scaling_sharpness">Чіткість масштабування</string>
|
||||
<string name="drawer_effects">Ефекти екрана</string>
|
||||
@@ -1741,6 +1740,8 @@
|
||||
<string name="fm_accept">Прийняти</string>
|
||||
<string name="fm_decline">Відхилити</string>
|
||||
<string name="fm_drive_not_readable">%1$s: підключено, але читання зараз недоступне</string>
|
||||
<string name="fm_drive_access_title">Дозволити доступ до %1$s</string>
|
||||
<string name="fm_drive_access_text">Android дозволяє DroidDeck бачити цей диск, але не читати його. Увімкніть для DroidDeck доступ до всіх файлів і поверніться.</string>
|
||||
<string name="fm_list_view">Список</string>
|
||||
<string name="fm_grid_view">Сітка</string>
|
||||
<string name="fm_search">Пошук</string>
|
||||
@@ -1846,6 +1847,7 @@
|
||||
<string name="flatpakmgr_not_ready">Спершу налаштуйте Flatpak</string>
|
||||
<string name="flatpakmgr_starting">Запуск</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak завершився з кодом %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s зібрано для %2$s, а DroidDeck не може це запустити. Застосункам Flatpak тут потрібна збірка для ARM64 або x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Встановлення %1$s</string>
|
||||
<string name="flatpakmgr_updating">Оновлення %1$s</string>
|
||||
<string name="flatpakmgr_removing">Видалення %1$s</string>
|
||||
@@ -2425,6 +2427,9 @@
|
||||
<string name="edit_target">Ціль</string>
|
||||
<string name="edit_start_in">Робоча папка</string>
|
||||
<string name="edit_launch_options">Параметри запуску</string>
|
||||
<string name="edit_launch_options_steam_hint">Спільні з «Властивостями» Steam: зміна в одному місці видна в обох.</string>
|
||||
<string name="edit_launch_options_not_saved">Не вдалося зберегти параметри запуску в Steam. Спробуйте ще раз.</string>
|
||||
<string name="edit_launch_options_desktop">Steam може бути відкритий у сеансі робочого столу. Змініть параметри запуску в його «Властивостях» або спершу закрийте сеанс.</string>
|
||||
<string name="edit_artwork">Графіка</string>
|
||||
<string name="edit_other_exe">Інший exe…</string>
|
||||
<string name="edit_remove">Вилучити</string>
|
||||
|
||||
@@ -699,7 +699,6 @@
|
||||
<string name="hud_export_failed">Không thể lưu báo cáo HUD.</string>
|
||||
<string name="hud_reset">Đặt lại thiết lập HUD</string>
|
||||
<string name="hud_reset_button">Đặt lại</string>
|
||||
<string name="hud_credit">FusionHUD của The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Chế độ chia tỷ lệ</string>
|
||||
<string name="drawer_scaling_sharpness">Độ sắc nét khi chia tỷ lệ</string>
|
||||
<string name="drawer_effects">Hiệu ứng màn hình</string>
|
||||
@@ -1678,6 +1677,8 @@
|
||||
<string name="fm_accept">Chấp nhận</string>
|
||||
<string name="fm_decline">Từ chối</string>
|
||||
<string name="fm_drive_not_readable">%1$s đã được gắn nhưng hiện không đọc được</string>
|
||||
<string name="fm_drive_access_title">Cho phép truy cập %1$s</string>
|
||||
<string name="fm_drive_access_text">Android cho DroidDeck thấy ổ này nhưng không đọc được. Hãy bật Quyền truy cập mọi tệp cho DroidDeck rồi quay lại.</string>
|
||||
<string name="fm_list_view">Xem dạng danh sách</string>
|
||||
<string name="fm_grid_view">Xem dạng lưới</string>
|
||||
<string name="fm_search">Tìm kiếm</string>
|
||||
@@ -1777,6 +1778,7 @@
|
||||
<string name="flatpakmgr_not_ready">Thiết lập Flatpak trước</string>
|
||||
<string name="flatpakmgr_starting">Đang khởi động</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak đã thoát với mã %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s được dựng cho %2$s, DroidDeck không chạy được. Ứng dụng Flatpak ở đây cần bản ARM64 hoặc x86_64.</string>
|
||||
<string name="flatpakmgr_installing">Đang cài %1$s</string>
|
||||
<string name="flatpakmgr_updating">Đang cập nhật %1$s</string>
|
||||
<string name="flatpakmgr_removing">Đang gỡ %1$s</string>
|
||||
@@ -2356,6 +2358,9 @@
|
||||
<string name="edit_target">Đích</string>
|
||||
<string name="edit_start_in">Khởi chạy trong</string>
|
||||
<string name="edit_launch_options">Tùy chọn khởi chạy</string>
|
||||
<string name="edit_launch_options_steam_hint">Dùng chung với Thuộc tính của Steam: thay đổi ở một nơi sẽ hiện ở cả hai.</string>
|
||||
<string name="edit_launch_options_not_saved">Không thể lưu tùy chọn khởi chạy vào Steam. Hãy thử lại.</string>
|
||||
<string name="edit_launch_options_desktop">Steam có thể đang mở trong phiên desktop. Hãy đổi tùy chọn khởi chạy trong Thuộc tính của Steam, hoặc đóng phiên trước.</string>
|
||||
<string name="edit_artwork">Hình ảnh</string>
|
||||
<string name="edit_other_exe">Exe khác…</string>
|
||||
<string name="edit_remove">Xóa</string>
|
||||
|
||||
@@ -688,7 +688,6 @@
|
||||
<string name="hud_export_failed">无法保存 HUD 报告。</string>
|
||||
<string name="hud_reset">重置 HUD 设置</string>
|
||||
<string name="hud_reset_button">重置</string>
|
||||
<string name="hud_credit">FusionHUD,作者 The412Banner,github.com/The412Banner/FusionHUD (GPL-3.0)。</string>
|
||||
<string name="drawer_scaling">缩放模式</string>
|
||||
<string name="drawer_scaling_sharpness">缩放锐度</string>
|
||||
<string name="drawer_effects">屏幕效果</string>
|
||||
@@ -1726,6 +1725,8 @@
|
||||
<string name="fm_accept">接受</string>
|
||||
<string name="fm_decline">拒绝</string>
|
||||
<string name="fm_drive_not_readable">%1$s 已挂载,但当前无法读取</string>
|
||||
<string name="fm_drive_access_title">允许访问 %1$s</string>
|
||||
<string name="fm_drive_access_text">Android 允许 DroidDeck 看到此驱动器,但不允许读取。请为 DroidDeck 开启“所有文件访问权限”,然后返回。</string>
|
||||
<string name="fm_list_view">列表视图</string>
|
||||
<string name="fm_grid_view">网格视图</string>
|
||||
<string name="fm_search">搜索</string>
|
||||
@@ -1825,6 +1826,7 @@
|
||||
<string name="flatpakmgr_not_ready">请先配置 Flatpak</string>
|
||||
<string name="flatpakmgr_starting">启动中</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak 已退出,状态码 %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s 是为 %2$s 构建的,DroidDeck 无法运行。这里的 Flatpak 应用需要 ARM64 或 x86_64 版本。</string>
|
||||
<string name="flatpakmgr_installing">正在安装 %1$s</string>
|
||||
<string name="flatpakmgr_updating">正在更新 %1$s</string>
|
||||
<string name="flatpakmgr_removing">正在移除 %1$s</string>
|
||||
@@ -2398,6 +2400,9 @@
|
||||
<string name="edit_target">目标</string>
|
||||
<string name="edit_start_in">起始位置</string>
|
||||
<string name="edit_launch_options">启动选项</string>
|
||||
<string name="edit_launch_options_steam_hint">与 Steam 的“属性”共用:在任一处更改,两处都会更新。</string>
|
||||
<string name="edit_launch_options_not_saved">无法将启动选项保存到 Steam。请重试。</string>
|
||||
<string name="edit_launch_options_desktop">Steam 可能正在桌面会话中运行。请在 Steam 的“属性”中更改启动选项,或先关闭该会话。</string>
|
||||
<string name="edit_artwork">美术图</string>
|
||||
<string name="edit_other_exe">其他 exe…</string>
|
||||
<string name="edit_remove">移除</string>
|
||||
|
||||
@@ -688,7 +688,6 @@
|
||||
<string name="hud_export_failed">無法儲存 HUD 報告。</string>
|
||||
<string name="hud_reset">重設 HUD 設定</string>
|
||||
<string name="hud_reset_button">重設</string>
|
||||
<string name="hud_credit">FusionHUD,作者 The412Banner,github.com/The412Banner/FusionHUD (GPL-3.0)。</string>
|
||||
<string name="drawer_scaling">縮放模式</string>
|
||||
<string name="drawer_scaling_sharpness">縮放銳利度</string>
|
||||
<string name="drawer_effects">畫面效果</string>
|
||||
@@ -1649,6 +1648,8 @@
|
||||
<string name="fm_accept">接受</string>
|
||||
<string name="fm_decline">拒絕</string>
|
||||
<string name="fm_drive_not_readable">%1$s 已掛載,但目前無法讀取</string>
|
||||
<string name="fm_drive_access_title">允許存取 %1$s</string>
|
||||
<string name="fm_drive_access_text">Android 允許 DroidDeck 看到此磁碟,但不允許讀取。請為 DroidDeck 開啟「所有檔案存取權」,然後返回。</string>
|
||||
<string name="fm_list_view">清單檢視</string>
|
||||
<string name="fm_grid_view">格狀檢視</string>
|
||||
<string name="fm_search">搜尋</string>
|
||||
@@ -1748,6 +1749,7 @@
|
||||
<string name="flatpakmgr_not_ready">請先設定 Flatpak</string>
|
||||
<string name="flatpakmgr_starting">正在開始</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak 已結束,狀態為 %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s 是為 %2$s 建置的,DroidDeck 無法執行。這裡的 Flatpak 應用程式需要 ARM64 或 x86_64 版本。</string>
|
||||
<string name="flatpakmgr_installing">正在安裝 %1$s</string>
|
||||
<string name="flatpakmgr_updating">正在更新 %1$s</string>
|
||||
<string name="flatpakmgr_removing">正在移除 %1$s</string>
|
||||
@@ -2324,6 +2326,9 @@
|
||||
<string name="edit_target">目標</string>
|
||||
<string name="edit_start_in">開始位置</string>
|
||||
<string name="edit_launch_options">啟動選項</string>
|
||||
<string name="edit_launch_options_steam_hint">與 Steam 的「內容」共用:在任一處更改,兩處都會更新。</string>
|
||||
<string name="edit_launch_options_not_saved">無法將啟動選項儲存到 Steam。請再試一次。</string>
|
||||
<string name="edit_launch_options_desktop">Steam 可能正在桌面會話中執行。請在 Steam 的「內容」中更改啟動選項,或先關閉該會話。</string>
|
||||
<string name="edit_artwork">圖片</string>
|
||||
<string name="edit_other_exe">其他 exe…</string>
|
||||
<string name="edit_remove">移除</string>
|
||||
|
||||
@@ -688,7 +688,6 @@
|
||||
<string name="hud_export_failed">無法儲存 HUD 報告。</string>
|
||||
<string name="hud_reset">重設 HUD 設定</string>
|
||||
<string name="hud_reset_button">重設</string>
|
||||
<string name="hud_credit">FusionHUD,作者 The412Banner,github.com/The412Banner/FusionHUD (GPL-3.0)。</string>
|
||||
<string name="drawer_scaling">縮放模式</string>
|
||||
<string name="drawer_scaling_sharpness">縮放銳利度</string>
|
||||
<string name="drawer_effects">畫面效果</string>
|
||||
@@ -1649,6 +1648,8 @@
|
||||
<string name="fm_accept">接受</string>
|
||||
<string name="fm_decline">拒絕</string>
|
||||
<string name="fm_drive_not_readable">%1$s 已掛載,但目前無法讀取</string>
|
||||
<string name="fm_drive_access_title">允許存取 %1$s</string>
|
||||
<string name="fm_drive_access_text">Android 允許 DroidDeck 看到這個磁碟,但不允許讀取。請為 DroidDeck 開啟「所有檔案存取權」,然後返回。</string>
|
||||
<string name="fm_list_view">清單檢視</string>
|
||||
<string name="fm_grid_view">格狀檢視</string>
|
||||
<string name="fm_search">搜尋</string>
|
||||
@@ -1748,6 +1749,7 @@
|
||||
<string name="flatpakmgr_not_ready">請先設定 Flatpak</string>
|
||||
<string name="flatpakmgr_starting">正在啟動</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak 已結束,狀態碼 %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s 是為 %2$s 建置的,DroidDeck 無法執行。這裡的 Flatpak 應用程式需要 ARM64 或 x86_64 版本。</string>
|
||||
<string name="flatpakmgr_installing">正在安裝 %1$s</string>
|
||||
<string name="flatpakmgr_updating">正在更新 %1$s</string>
|
||||
<string name="flatpakmgr_removing">正在移除 %1$s</string>
|
||||
@@ -2324,6 +2326,9 @@
|
||||
<string name="edit_target">目標</string>
|
||||
<string name="edit_start_in">開始位置</string>
|
||||
<string name="edit_launch_options">啟動選項</string>
|
||||
<string name="edit_launch_options_steam_hint">與 Steam 的「內容」共用:在任一處變更,兩處都會更新。</string>
|
||||
<string name="edit_launch_options_not_saved">無法將啟動選項儲存至 Steam。請再試一次。</string>
|
||||
<string name="edit_launch_options_desktop">Steam 可能正在桌面工作階段中執行。請在 Steam 的「內容」中變更啟動選項,或先關閉該工作階段。</string>
|
||||
<string name="edit_artwork">圖片</string>
|
||||
<string name="edit_other_exe">其他 exe…</string>
|
||||
<string name="edit_remove">移除</string>
|
||||
|
||||
@@ -597,17 +597,6 @@
|
||||
<string name="perf_noglerror_hint">Turns off per-call GL validation.</string>
|
||||
<string name="perf_gsrealtime">gamescope: realtime GPU queue</string>
|
||||
<string name="perf_gsrealtime_hint">Prioritizes the compositor\'s GPU work. Can smooth frame pacing at some cost to games.</string>
|
||||
<string name="perf_boost_group">Boost</string>
|
||||
<string name="perf_boost">Performance boost</string>
|
||||
<string name="perf_boost_hint">Asks the phone to run the game\'s busiest threads on its fastest cores while the game falls behind. Lets go when the game keeps up, the phone is hot or battery saver is on. Android 12 or newer. More battery use and heat.</string>
|
||||
<string name="perf_samsung_sdk">Samsung performance SDK</string>
|
||||
<string name="perf_samsung_sdk_missing">With the boost on, Samsung phones can also raise their CPU, GPU and memory clocks. Download the SDK from developer.samsung.com/galaxy-performance (free Samsung account) and import the zip.</string>
|
||||
<string name="perf_samsung_sdk_ready">Imported. With the boost on, Samsung\'s CPU, GPU and memory clocks are raised too.</string>
|
||||
<string name="perf_samsung_sdk_import">Import</string>
|
||||
<string name="perf_samsung_sdk_pick">Choose PerformanceSDK_v1.0.0.zip from Samsung</string>
|
||||
<string name="perf_samsung_sdk_imported">Samsung performance SDK imported</string>
|
||||
<string name="perf_samsung_sdk_invalid">That file is not Samsung\'s Galaxy Performance SDK</string>
|
||||
<string name="perf_samsung_sdk_failed">Could not import the Samsung performance SDK</string>
|
||||
<string name="perf_gpu">GPU</string>
|
||||
<string name="perf_memory">Memory</string>
|
||||
<string name="perf_cap_off">Off</string>
|
||||
@@ -736,7 +725,6 @@
|
||||
<string name="hud_export_failed">Couldn\'t save the HUD report.</string>
|
||||
<string name="hud_reset">Reset HUD settings</string>
|
||||
<string name="hud_reset_button">Reset</string>
|
||||
<string name="hud_credit">FusionHUD by The412Banner, github.com/The412Banner/FusionHUD (GPL-3.0).</string>
|
||||
<string name="drawer_scaling">Scaling mode</string>
|
||||
<string name="drawer_scaling_sharpness">Scaling sharpness</string>
|
||||
<string name="drawer_effects">Screen effects</string>
|
||||
@@ -1803,6 +1791,8 @@
|
||||
<string name="fm_accept">Accept</string>
|
||||
<string name="fm_decline">Decline</string>
|
||||
<string name="fm_drive_not_readable">%1$s is mounted but not readable right now</string>
|
||||
<string name="fm_drive_access_title">Allow access to %1$s</string>
|
||||
<string name="fm_drive_access_text">Android lets DroidDeck see this drive but not read it. Turn on All files access for DroidDeck, then come back.</string>
|
||||
<string name="fm_list_view">List view</string>
|
||||
<string name="fm_grid_view">Grid view</string>
|
||||
<string name="fm_search">Search</string>
|
||||
@@ -1885,6 +1875,93 @@
|
||||
<string name="second_mode_keyboard_trackpad">Keyboard + trackpad</string>
|
||||
<string name="second_mode_terminal">Terminal</string>
|
||||
<string name="second_mode_deck_controls">Deck grips + trackpads</string>
|
||||
<string name="second_mode_dashboard">Dashboard</string>
|
||||
<string name="bottom_dashboard_empty">Nothing to show here yet.</string>
|
||||
<string name="bottom_page_downloads">Downloads</string>
|
||||
<string name="bottom_downloads_none">No downloads running.</string>
|
||||
<string name="bottom_downloads_steam">Steam</string>
|
||||
<string name="bottom_downloads_shader">Downloading shader cache</string>
|
||||
<string name="bottom_downloads_paused">Paused</string>
|
||||
<string name="bottom_downloads_queued">Waiting to start</string>
|
||||
<string name="bottom_page_notifications">Notifications</string>
|
||||
<string name="bottom_notifications_listener">DroidDeck bottom screen</string>
|
||||
<string name="bottom_notifications_why">Show messages and other notifications here while you play. They stay on this screen only and are not saved. Android asks once: its notification access page opens on this screen; turn DroidDeck on there and this page comes back by itself.</string>
|
||||
<string name="bottom_notifications_allow">Allow notification access</string>
|
||||
<string name="bottom_notifications_none">No notifications.</string>
|
||||
<string name="bottom_notifications_count">%1$d notifications</string>
|
||||
<string name="bottom_notifications_clear">Clear</string>
|
||||
<string name="bottom_page_screenshots">Screenshots</string>
|
||||
<string name="stats_fps_needs_hud">FPS needs the HUD on</string>
|
||||
<string name="stats_speed">Speed</string>
|
||||
<string name="stats_pedals">Pedals</string>
|
||||
<string name="stats_gforce">G-force</string>
|
||||
<string name="stats_timing">Timing</string>
|
||||
<string name="stats_best_lap">Best lap</string>
|
||||
<string name="stats_tires">Tires °C</string>
|
||||
<string name="stats_trace">Throttle and brake, last 10 s</string>
|
||||
<string name="stats_speed_chart">Speed, %1$s</string>
|
||||
<string name="stats_gear">Gear</string>
|
||||
<string name="stats_speed_units">Speed units</string>
|
||||
<string name="stats_speed_units_auto">Automatic (%1$s)</string>
|
||||
<string name="stats_steam_client_arm">Steam Client ARM</string>
|
||||
<string name="stats_steam_client_x86">Steam Client x86</string>
|
||||
<string name="stats_throttle">Throttle</string>
|
||||
<string name="stats_brake">Brake</string>
|
||||
<string name="stats_lights">Dashboard</string>
|
||||
<string name="stats_lamp_shift">Shift</string>
|
||||
<string name="stats_lamp_handbrake">Handbrake</string>
|
||||
<string name="stats_lamp_pit">Pit limiter</string>
|
||||
<string name="stats_lamp_tc">TC</string>
|
||||
<string name="stats_lamp_abs">ABS</string>
|
||||
<string name="stats_turbo">Turbo %1$s bar</string>
|
||||
<string name="stats_engine_temp">Engine %1$s °C</string>
|
||||
<string name="stats_oil_temp">Oil %1$s °C</string>
|
||||
<string name="stats_power">Power distributor</string>
|
||||
<string name="stats_fuel_t">Fuel, t</string>
|
||||
<string name="stats_fuel_main">Main %1$s t</string>
|
||||
<string name="stats_fuel_reserve">Reserve %1$s t</string>
|
||||
<string name="stats_tap_hint">Tap the top strip or the dash to change its style.</string>
|
||||
<string name="bottom_telemetry_send_title">Send dashboard data</string>
|
||||
<string name="bottom_telemetry_send_auto">Automatic</string>
|
||||
<string name="bottom_telemetry_send_auto_hint">Turns it on for every game listed here, including games found later. Games you switch off stay off.</string>
|
||||
<string name="bottom_telemetry_send_note">This changes the game\'s own data output setting. It takes effect the next time the game starts; turning it off puts the old setting back.</string>
|
||||
<string name="bottom_telemetry_send_close">Close %1$s to change this.</string>
|
||||
<string name="bottom_telemetry_send_failed">Could not change the settings of %1$s.</string>
|
||||
<string name="bottom_telemetry_send_menu">%1$s: turn on %2$s in the game\'s settings with IP 127.0.0.1 and port %3$d.</string>
|
||||
<string name="bottom_shots_where">Saved to Pictures/DroidDeck. Steam screenshots show here too.</string>
|
||||
<string name="bottom_shots_take">Take screenshot</string>
|
||||
<string name="bottom_shots_saved">Screenshot saved.</string>
|
||||
<string name="bottom_shots_failed">Could not take a screenshot.</string>
|
||||
<string name="bottom_shots_none">No screenshots yet.</string>
|
||||
<string name="bottom_page_chat">Chat & voice</string>
|
||||
<string name="bottom_chat_why">Read and answer Steam chat here while the game keeps running on the main screen. It uses the account Steam is signed in with.</string>
|
||||
<string name="bottom_chat_not_signed_in">Steam has no web sign-in to share yet, so sign in here once.</string>
|
||||
<string name="bottom_chat_stopped">Android closed the chat page while DroidDeck was in the background. It opens again when you come back to DroidDeck.</string>
|
||||
<string name="bottom_chat_open">Open Steam Chat</string>
|
||||
<string name="bottom_chat_close">Close chat</string>
|
||||
<string name="bottom_chat_mic_on">Mic on</string>
|
||||
<string name="bottom_chat_mic_off">Mic off</string>
|
||||
<string name="bottom_chat_mic_unavailable">Mic is off for this game. To talk, turn on Microphone in DroidDeck\'s Steam settings (Audio) and start the game again.</string>
|
||||
<string name="bottom_chat_volume">Volume %1$d%%</string>
|
||||
<string name="bottom_page_telemetry">In-game stats</string>
|
||||
<string name="bottom_telemetry_fps">FPS</string>
|
||||
<string name="bottom_telemetry_cpu">CPU</string>
|
||||
<string name="bottom_telemetry_gpu">GPU</string>
|
||||
<string name="bottom_telemetry_battery">Battery</string>
|
||||
<string name="bottom_telemetry_lap">Lap</string>
|
||||
<string name="bottom_telemetry_position">Position</string>
|
||||
<string name="bottom_telemetry_this_lap">This lap</string>
|
||||
<string name="bottom_telemetry_last_lap">Last lap</string>
|
||||
<string name="bottom_telemetry_fuel">Fuel</string>
|
||||
<string name="bottom_telemetry_cargo">Cargo</string>
|
||||
<string name="bottom_telemetry_pips">Pips SYS · ENG · WEP</string>
|
||||
<string name="bottom_telemetry_legal">Legal state</string>
|
||||
<string name="bottom_telemetry_balance">Balance</string>
|
||||
<string name="bottom_telemetry_war_thunder">War Thunder</string>
|
||||
<string name="bottom_telemetry_elite">Elite Dangerous</string>
|
||||
<string name="bottom_telemetry_help">Turn on a racing game\'s data output (often called telemetry or UDP) to see a live dash here. It stays on this device.</string>
|
||||
<string name="bottom_telemetry_unknown_format">Port %1$d receives data (%2$d packets of %3$d bytes), but in a format this page cannot read yet.</string>
|
||||
<string name="bottom_telemetry_port_busy">Another program already uses port %1$s, so that game cannot show here.</string>
|
||||
|
||||
<string name="rtinst_removing">Removing Linux runtime</string>
|
||||
<plurals name="rtinst_removing_entries">
|
||||
@@ -1915,6 +1992,7 @@
|
||||
<string name="flatpakmgr_not_ready">Set up Flatpak first</string>
|
||||
<string name="flatpakmgr_starting">Starting</string>
|
||||
<string name="flatpakmgr_exit_status">Flatpak exited with status %1$d</string>
|
||||
<string name="flatpakmgr_wrong_arch">%1$s is built for %2$s, which DroidDeck can\'t run. Flatpak apps here need an ARM64 or x86_64 build.</string>
|
||||
<string name="flatpakmgr_installing">Installing %1$s</string>
|
||||
<string name="flatpakmgr_updating">Updating %1$s</string>
|
||||
<string name="flatpakmgr_removing">Removing %1$s</string>
|
||||
@@ -2517,6 +2595,9 @@
|
||||
<string name="edit_target">Target</string>
|
||||
<string name="edit_start_in">Start in</string>
|
||||
<string name="edit_launch_options">Launch options</string>
|
||||
<string name="edit_launch_options_steam_hint">Shared with Steam\'s Properties: a change in either one shows in both.</string>
|
||||
<string name="edit_launch_options_not_saved">Could not save the launch options to Steam. Try again.</string>
|
||||
<string name="edit_launch_options_desktop">Steam may be open in the desktop session. Change the launch options in its Properties, or close the session first.</string>
|
||||
<string name="edit_artwork">Artwork</string>
|
||||
<string name="edit_other_exe">Other exe…</string>
|
||||
<string name="edit_remove">Remove</string>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.droiddeck.launcher
|
||||
|
||||
import com.droiddeck.launcher.HomeApp.RecentsStep
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class HomeRecentsTest {
|
||||
@Test fun theLauncherHidesAVisibleTaskAndTakesItOver() {
|
||||
assertEquals(RecentsStep.HIDE, HomeApp.recentsStep(hidden = true, owned = false, excluded = false))
|
||||
}
|
||||
|
||||
@Test fun aTaskSomeoneElseExcludedIsNeverClaimedOrShown() {
|
||||
assertEquals(RecentsStep.NONE, HomeApp.recentsStep(hidden = true, owned = false, excluded = true))
|
||||
assertEquals(RecentsStep.NONE, HomeApp.recentsStep(hidden = false, owned = false, excluded = true))
|
||||
}
|
||||
|
||||
@Test fun onlyATaskTheLauncherHidItselfIsShownAgain() {
|
||||
assertEquals(RecentsStep.SHOW, HomeApp.recentsStep(hidden = false, owned = true, excluded = true))
|
||||
assertEquals(RecentsStep.FORGET, HomeApp.recentsStep(hidden = false, owned = true, excluded = false))
|
||||
assertEquals(RecentsStep.NONE, HomeApp.recentsStep(hidden = true, owned = true, excluded = true))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.droiddeck.launcher.files
|
||||
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class AllFilesAccessTest {
|
||||
@Test
|
||||
fun androidTenAndOlderNeverAsks() {
|
||||
assertFalse(AllFilesAccess.missing(sdk = 29) { false })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun androidElevenAsksUntilGranted() {
|
||||
assertTrue(AllFilesAccess.missing(sdk = 30) { false })
|
||||
assertFalse(AllFilesAccess.missing(sdk = 30) { true })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun newerAndroidAsksUntilGranted() {
|
||||
assertTrue(AllFilesAccess.missing(sdk = 35) { false })
|
||||
assertFalse(AllFilesAccess.missing(sdk = 35) { true })
|
||||
}
|
||||
}
|
||||
@@ -154,6 +154,98 @@ class AddedGameArtFillTest {
|
||||
assertFalse(File(AddedGameArt.cacheDir(app, second), AddedGameArt.EXTRAS_TRIED).exists())
|
||||
}
|
||||
|
||||
private fun steamFrom(asked: MutableList<String>, bytes: Byte, search: Int? = null, slotsAsked: MutableList<Set<Slot>> = ArrayList()) = AddedGameArt.Sources(
|
||||
storeLogo = { false },
|
||||
steamSearch = { if (search == null) fail("searched although the game names its appid"); search },
|
||||
steam = { id, cache, slots ->
|
||||
asked += id
|
||||
slotsAsked += slots
|
||||
slots.forEach { File(cache, steamNames.getValue(it)).writeBytes(byteArrayOf(bytes)) }
|
||||
slots.isNotEmpty()
|
||||
},
|
||||
sgdbGame = { _, _, _ -> null },
|
||||
sgdb = { _, _, _, _ -> false },
|
||||
)
|
||||
|
||||
@Test fun artOfTheAppTheFilesNamedBeforeIsFetchedAgain() {
|
||||
val g = game("Peak", 0x8100000AL, cover = false)
|
||||
File(g.folder, "steam_appid.txt").writeText("1029210")
|
||||
val asked = ArrayList<String>()
|
||||
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 1)))
|
||||
File(g.folder, "steam_appid.txt").writeText("3527290")
|
||||
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2)))
|
||||
assertEquals(listOf("1029210", "3527290"), asked)
|
||||
assertArrayEquals(byteArrayOf(2), File(AddedGameArt.cacheDir(app, g), "p.jpg").readBytes())
|
||||
assertFalse(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 3)))
|
||||
assertEquals(2, asked.size)
|
||||
}
|
||||
|
||||
@Test fun aPictureTheUserChoseOutlivesTheChange() {
|
||||
val g = game("Peak", 0x8100000BL, cover = false)
|
||||
File(g.folder, "steam_appid.txt").writeText("1029210")
|
||||
AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(ArrayList(), 1))
|
||||
val picked = File(tmp.root, "mine.jpg").apply { writeBytes(byteArrayOf(7)) }
|
||||
assertTrue(AddedGameArt.store(AddedGameArt.cacheDir(app, g), Slot.COVER, AddedGameArt.Option(AddedGameArt.FILE, picked.path, picked.path)))
|
||||
File(g.folder, "steam_appid.txt").writeText("3527290")
|
||||
val asked = ArrayList<String>()
|
||||
val slots = ArrayList<Set<Slot>>()
|
||||
AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2, slotsAsked = slots))
|
||||
assertArrayEquals(byteArrayOf(7), AddedGameArt.resolve(app, g).portrait!!.readBytes())
|
||||
assertEquals(listOf("3527290"), asked)
|
||||
assertEquals(listOf(setOf(Slot.WIDE, Slot.BACKGROUND, Slot.LOGO)), slots)
|
||||
val cache = AddedGameArt.cacheDir(app, g)
|
||||
assertArrayEquals(byteArrayOf(2), File(cache, "header.jpg").readBytes())
|
||||
assertArrayEquals(byteArrayOf(2), File(cache, "hero.jpg").readBytes())
|
||||
assertFalse(File(cache, AddedGameArt.REFETCH).exists())
|
||||
}
|
||||
|
||||
private fun olderBuildsArt(g: AddedGames.Game, marker: String): File = AddedGameArt.cacheDir(app, g).apply {
|
||||
mkdirs()
|
||||
File(this, "steam-appid").writeText(marker)
|
||||
steamNames.values.forEach { File(this, it).writeBytes(byteArrayOf(1)) }
|
||||
}
|
||||
|
||||
@Test fun anOlderBuildsSpacewarMarkerGoesWithItsArt() {
|
||||
val g = game("Peak", 0x8100000DL, cover = false)
|
||||
File(g.folder, "steam_appid.txt").writeText("480")
|
||||
val cache = olderBuildsArt(g, "480")
|
||||
val asked = ArrayList<String>()
|
||||
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2, search = 3527290)))
|
||||
assertEquals(listOf("3527290"), asked)
|
||||
assertArrayEquals(byteArrayOf(2), File(cache, "p.jpg").readBytes())
|
||||
assertFalse(File(cache, "steam-appid").exists())
|
||||
}
|
||||
|
||||
@Test fun anOlderBuildsMatchStaysWhileTheFilesNameNoApp() {
|
||||
val g = game("Hades", 0x8100000EL, cover = false)
|
||||
File(g.folder, "steam_appid.txt").delete()
|
||||
val cache = olderBuildsArt(g, "1145360")
|
||||
assertFalse(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(ArrayList(), 2)))
|
||||
assertEquals("1145360", File(cache, "steam-appid").readText())
|
||||
assertArrayEquals(byteArrayOf(1), File(cache, "p.jpg").readBytes())
|
||||
}
|
||||
|
||||
@Test fun anOlderBuildsMatchGivesWayToTheAppTheFilesName() {
|
||||
val g = game("Peak", 0x8100000FL, cover = false)
|
||||
File(g.folder, "steam_appid.txt").writeText("3527290")
|
||||
val cache = olderBuildsArt(g, "1029210")
|
||||
val asked = ArrayList<String>()
|
||||
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2)))
|
||||
assertEquals(listOf("3527290"), asked)
|
||||
assertArrayEquals(byteArrayOf(2), File(cache, "p.jpg").readBytes())
|
||||
assertFalse(File(cache, "steam-appid").exists())
|
||||
}
|
||||
|
||||
@Test fun filesThatStopNamingAnAppFallBackToTheGamesName() {
|
||||
val g = game("Peak", 0x8100000CL, cover = false)
|
||||
File(g.folder, "steam_appid.txt").writeText("1029210")
|
||||
val asked = ArrayList<String>()
|
||||
AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 1))
|
||||
File(g.folder, "steam_appid.txt").writeText("480")
|
||||
assertTrue(AddedGameArt.fetchMissing(app, listOf(g), "", steamFrom(asked, 2, search = 3527290)))
|
||||
assertEquals(listOf("1029210", "3527290"), asked)
|
||||
}
|
||||
|
||||
@Test fun nothingIsFetchedWhenArtIsOff() {
|
||||
SessionPrefs.setAddedGamesArt(app, false)
|
||||
val calls = Calls()
|
||||
|
||||
@@ -66,6 +66,29 @@ class AddedGameArtLookupTest {
|
||||
assertEquals(SteamMatch.Certainty.NAME, match.certainty)
|
||||
}
|
||||
|
||||
@Test fun anEarlierBuildsSpacewarLookupIsNotAMatch() {
|
||||
val dir = tmp.newFolder("Peak")
|
||||
val exe = File(dir, "PEAK.exe").apply { writeText("x") }
|
||||
val legacy = File(tmp.newFolder(), "steam-appid").apply { writeText("480") }
|
||||
assertEquals(3527290, SteamMatch.resolve(app, dir.path, exe, "PEAK", legacy = legacy) { 3527290 }.appId)
|
||||
}
|
||||
|
||||
@Test fun aSavedSpacewarMatchIsNotAMatch() {
|
||||
val dir = tmp.newFolder("Peak")
|
||||
val exe = File(dir, "PEAK.exe").apply { writeText("x") }
|
||||
SteamMatch.put(app, dir.path, SteamMatch.Match(480, SteamMatch.Certainty.NAME, "store search", System.currentTimeMillis()))
|
||||
assertNull(SteamMatch.resolve(app, dir.path, exe, "PEAK").appId)
|
||||
assertEquals(3527290, SteamMatch.resolve(app, dir.path, exe, "PEAK") { 3527290 }.appId)
|
||||
}
|
||||
|
||||
@Test fun aStoreSearchAnsweringSpacewarIsNoMatch() {
|
||||
val dir = tmp.newFolder("Spacewar Fan Remake")
|
||||
val exe = File(dir, "game.exe").apply { writeText("x") }
|
||||
val match = SteamMatch.resolve(app, dir.path, exe, "Spacewar Fan Remake") { 480 }
|
||||
assertNull(match.appId)
|
||||
assertEquals(SteamMatch.Certainty.NONE, match.certainty)
|
||||
}
|
||||
|
||||
@Test fun aStoreResultIsTakenOnlyWhenItsNameMatches() {
|
||||
assertNull(AddedGameArt.pickStoreResult("My Obscure Game", listOf("10" to "Totally Different", "11" to "Another One")))
|
||||
assertEquals("20", AddedGameArt.pickStoreResult("Hades", listOf("19" to "Hades II Soundtrack Bundle Extra", "20" to "Hades")))
|
||||
|
||||
@@ -31,8 +31,25 @@ class GameIdentifierTest {
|
||||
fun steamAppIdTxt_inSteamSettingsSubdir_isFound() {
|
||||
val dir = tmp.newFolder("Game")
|
||||
File(dir, "steam_settings").mkdirs()
|
||||
File(dir, "steam_settings/steam_appid.txt").writeText("480")
|
||||
assertEquals(480, GameIdentifier.identify(exeIn(dir)).appId)
|
||||
File(dir, "steam_settings/steam_appid.txt").writeText("3527290")
|
||||
assertEquals(3527290, GameIdentifier.identify(exeIn(dir)).appId)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun spacewarAppId_namesNoGame() {
|
||||
val dir = tmp.newFolder("PEAK")
|
||||
File(dir, "steam_appid.txt").writeText("480")
|
||||
File(dir, "steam_emu.ini").writeText("[Settings]\nAppId=480\n")
|
||||
assertNull(GameIdentifier.identify(exeIn(dir)).appId)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun spacewarAppId_fallsThroughToTheGamesOwnId() {
|
||||
val dir = tmp.newFolder("PEAK")
|
||||
File(dir, "steam_appid.txt").writeText("480")
|
||||
File(dir, "steam_settings").mkdirs()
|
||||
File(dir, "steam_settings/steam_appid.txt").writeText("3527290")
|
||||
assertEquals(3527290, GameIdentifier.identify(exeIn(dir)).appId)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -44,6 +61,30 @@ class GameIdentifierTest {
|
||||
assertEquals(GameIdentifier.Source.STEAM_EMU_INI, id.source)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun spacewarManifest_namesNoGame() {
|
||||
val steamapps = tmp.newFolder("steamapps")
|
||||
File(steamapps, "appmanifest_480.acf").writeText(""""AppState" { "appid" "480" "name" "Spacewar" "installdir" "PEAK" }""")
|
||||
val game = File(steamapps, "common/PEAK").apply { mkdirs() }
|
||||
File(game, "steam_appid.txt").writeText("3527290")
|
||||
val id = GameIdentifier.identify(exeIn(game, "PEAK.exe"))
|
||||
assertEquals(3527290, id.appId)
|
||||
assertEquals(GameIdentifier.Source.STEAM_APPID_TXT, id.source)
|
||||
assertTrue(id.name != "Spacewar")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun spacewarManifest_leavesTheGamesOwnManifestForTheSameFolder() {
|
||||
val steamapps = tmp.newFolder("steamapps")
|
||||
File(steamapps, "appmanifest_480.acf").writeText(""""AppState" { "appid" "480" "name" "Spacewar" "installdir" "PEAK" }""")
|
||||
File(steamapps, "appmanifest_3527290.acf").writeText(""""AppState" { "appid" "3527290" "name" "PEAK" "installdir" "PEAK" }""")
|
||||
val game = File(steamapps, "common/PEAK").apply { mkdirs() }
|
||||
val id = GameIdentifier.identify(exeIn(game, "PEAK.exe"))
|
||||
assertEquals(3527290, id.appId)
|
||||
assertEquals("PEAK", id.name)
|
||||
assertEquals(GameIdentifier.Source.STEAM_MANIFEST_ACF, id.source)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun steamManifestAcf_matchedByInstalldir_givesAppIdAndName() {
|
||||
val steamapps = tmp.newFolder("steamapps")
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import java.io.File
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class SteamLaunchOptionsTest {
|
||||
@get:Rule val tmp = TemporaryFolder()
|
||||
|
||||
private fun config(apps: String) = listOf(
|
||||
"\"UserLocalConfigStore\"", "{", "\t\"Software\"", "\t{", "\t\t\"Valve\"", "\t\t{", "\t\t\t\"Steam\"", "\t\t\t{",
|
||||
apps, "\t\t\t}", "\t\t}", "\t}", "\t\"WebStorage\"", "\t{", "\t\t\"x\"\t\t\"1\"", "\t}", "}", "",
|
||||
).joinToString("\n")
|
||||
|
||||
private fun apps(vararg lines: String) = (listOf("\t\t\t\t\"apps\"", "\t\t\t\t{") + lines + "\t\t\t\t}").joinToString("\n")
|
||||
|
||||
private val sparking = arrayOf(
|
||||
"\t\t\t\t\t\"1790600\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"LastPlayed\"\t\t\"1761897600\"", "\t\t\t\t\t\t\"LaunchOptions\"\t\t\"-dx11\"", "\t\t\t\t\t}",
|
||||
)
|
||||
|
||||
@Test fun replacesTheOptionsSteamHas() {
|
||||
val text = config(apps(*sparking))
|
||||
val updated = SteamLaunchOptions.withLaunchOptions(text, 1790600, "-dx12")!!
|
||||
assertEquals(text.replace("\"-dx11\"", "\"-dx12\""), updated)
|
||||
assertEquals("-dx12", SteamLaunchOptions.launchOptions(updated, 1790600))
|
||||
}
|
||||
|
||||
@Test fun addsOptionsToAGameThatHasNone() {
|
||||
val text = config(apps("\t\t\t\t\t\"1790600\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"LastPlayed\"\t\t\"1761897600\"", "\t\t\t\t\t}"))
|
||||
assertEquals(config(apps(*sparking)).replace("-dx11", "-vulkan"), SteamLaunchOptions.withLaunchOptions(text, 1790600, "-vulkan"))
|
||||
}
|
||||
|
||||
@Test fun addsTheGameAndTheAppsSectionWhenSteamHasNeither() {
|
||||
val updated = SteamLaunchOptions.withLaunchOptions(config("\t\t\t\t\"language\"\t\t\"english\""), 1790600, "-dx11")!!
|
||||
assertEquals(
|
||||
config(
|
||||
"\t\t\t\t\"language\"\t\t\"english\"\n" +
|
||||
apps("\t\t\t\t\t\"1790600\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"LaunchOptions\"\t\t\"-dx11\"", "\t\t\t\t\t}"),
|
||||
),
|
||||
updated,
|
||||
)
|
||||
assertEquals("-dx11", SteamLaunchOptions.launchOptions(updated, 1790600))
|
||||
}
|
||||
|
||||
@Test fun quotesAndBackslashesAreEscapedAndReadBack() {
|
||||
val options = "PROTON_LOG=1 %command% -path \"C:\\Games\\DB\""
|
||||
val updated = SteamLaunchOptions.withLaunchOptions(config(apps(*sparking)), 1790600, options)!!
|
||||
assertEquals(true, updated.contains("\"PROTON_LOG=1 %command% -path \\\"C:\\\\Games\\\\DB\\\"\""))
|
||||
assertEquals(options, SteamLaunchOptions.launchOptions(updated, 1790600))
|
||||
}
|
||||
|
||||
@Test fun emptyOptionsClearSteams() {
|
||||
val updated = SteamLaunchOptions.withLaunchOptions(config(apps(*sparking)), 1790600, "")!!
|
||||
assertEquals("", SteamLaunchOptions.launchOptions(updated, 1790600))
|
||||
}
|
||||
|
||||
@Test fun windowsLineEndsAreKept() {
|
||||
val text = config("\t\t\t\t\"language\"\t\t\"english\"").replace("\n", "\r\n")
|
||||
val updated = SteamLaunchOptions.withLaunchOptions(text, 1790600, "-dx11")!!
|
||||
assertEquals(false, updated.replace("\r\n", "").contains('\n'))
|
||||
assertEquals("-dx11", SteamLaunchOptions.launchOptions(updated, 1790600))
|
||||
}
|
||||
|
||||
@Test fun onlyTheGamesOwnSectionChanges() {
|
||||
val other = arrayOf(
|
||||
"\t\t\t\t\t\"7\"", "\t\t\t\t\t{", "\t\t\t\t\t\t\"1790600\"", "\t\t\t\t\t\t{", "\t\t\t\t\t\t\t\"LaunchOptions\"\t\t\"keep\"", "\t\t\t\t\t\t}", "\t\t\t\t\t}",
|
||||
)
|
||||
val updated = SteamLaunchOptions.withLaunchOptions(config(apps(*other, *sparking)), 1790600, "-dx12")!!
|
||||
assertEquals(true, updated.contains("\"keep\""))
|
||||
assertEquals("-dx12", SteamLaunchOptions.launchOptions(updated, 1790600))
|
||||
assertNull(SteamLaunchOptions.launchOptions(config(apps(*other)), 1790600))
|
||||
}
|
||||
|
||||
@Test fun otherFilesAreLeftAlone() {
|
||||
assertNull(SteamLaunchOptions.withLaunchOptions("\"InstallConfigStore\"\n{\n}\n", 1790600, "-dx11"))
|
||||
assertNull(SteamLaunchOptions.withLaunchOptions("", 1790600, "-dx11"))
|
||||
assertNull(SteamLaunchOptions.launchOptions("", 1790600))
|
||||
}
|
||||
|
||||
private fun steamHome(home: File = tmp.newFolder("Steam")): File = home.also {
|
||||
File(home, "config").mkdirs()
|
||||
File(home, "config/loginusers.vdf").writeText(
|
||||
"\"users\"\n{\n\t\"76561198021239924\"\n\t{\n\t\t\"AccountName\"\t\t\"a\"\n\t\t\"MostRecent\"\t\t\"1\"\n\t}\n}\n")
|
||||
}
|
||||
|
||||
private fun localConfig(home: File, account: String) = File(home, "userdata/$account/config/localconfig.vdf").apply { parentFile!!.mkdirs() }
|
||||
|
||||
@Test fun aChangeGoesToTheSignedInAccountOnly() {
|
||||
val home = steamHome()
|
||||
val signedIn = localConfig(home, "60974196").apply { writeText(config(apps(*sparking))) }
|
||||
val other = localConfig(home, "123").apply { writeText(config("\t\t\t\t\"language\"\t\t\"english\"")) }
|
||||
val untouched = other.readText()
|
||||
assertTrue(SteamLaunchOptions.write(home, 1790600, "-dx12"))
|
||||
assertEquals("-dx12", SteamLaunchOptions.launchOptions(signedIn.readText(), 1790600))
|
||||
assertEquals(untouched, other.readText())
|
||||
assertFalse(File(signedIn.parentFile, "localconfig.vdf.staged").exists())
|
||||
}
|
||||
|
||||
@Test fun whatSteamWroteLastIsWhatTheGameHas() {
|
||||
val home = steamHome()
|
||||
val config = localConfig(home, "60974196").apply { writeText(config(apps(*sparking))) }
|
||||
assertTrue(SteamLaunchOptions.write(home, 1790600, "-dx12"))
|
||||
config.writeText(SteamLaunchOptions.withLaunchOptions(config.readText(), 1790600, "-vulkan")!!)
|
||||
assertEquals("-vulkan", SteamLaunchOptions.steam(home, 1790600))
|
||||
assertNull(SteamLaunchOptions.steam(home, 400))
|
||||
}
|
||||
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
private val written = ArrayList<File>()
|
||||
|
||||
private fun sessionConfig(): File {
|
||||
val home = steamHome(SessionPrefs.activeSteamRoot(app))
|
||||
return localConfig(home, "60974196").apply { writeText(config(apps(*sparking))) }
|
||||
.also { written += it; written += File(home, "config/loginusers.vdf") }
|
||||
}
|
||||
|
||||
@After fun noSession() {
|
||||
SessionState.running = false
|
||||
SessionState.mode = SessionService.MODE_STEAM
|
||||
written.forEach { it.delete() }
|
||||
}
|
||||
|
||||
@Test fun aValueChangedInSteamSinceItWasShownIsNotOverwritten() {
|
||||
val config = sessionConfig()
|
||||
assertEquals(SteamLaunchOptions.Saved.NO, SteamLaunchOptions.set(app, 1790600, "-dx12", shown = "-vulkan"))
|
||||
assertEquals("-dx11", SteamLaunchOptions.launchOptions(config.readText(), 1790600))
|
||||
assertEquals(SteamLaunchOptions.Saved.YES, SteamLaunchOptions.set(app, 1790600, "-dx12", shown = "-dx11"))
|
||||
assertEquals("-dx12", SteamLaunchOptions.launchOptions(config.readText(), 1790600))
|
||||
}
|
||||
|
||||
@Test fun aDesktopSessionLeavesTheFileToItsClient() {
|
||||
val config = sessionConfig()
|
||||
val before = config.readText()
|
||||
SessionState.running = true
|
||||
SessionState.mode = SessionService.MODE_DESKTOP
|
||||
assertEquals(SteamLaunchOptions.Saved.DESKTOP, SteamLaunchOptions.set(app, 1790600, "-dx12", shown = "-dx11"))
|
||||
assertEquals(before, config.readText())
|
||||
}
|
||||
|
||||
@Test fun nothingIsWrittenWithoutASignedInAccountsConfig() {
|
||||
assertFalse(SteamLaunchOptions.write(tmp.newFolder("NoSteam"), 1790600, "-dx11"))
|
||||
val home = steamHome()
|
||||
assertFalse(SteamLaunchOptions.write(home, 1790600, "-dx11"))
|
||||
localConfig(home, "60974196").writeText("\"InstallConfigStore\"\n{\n}\n")
|
||||
assertFalse(SteamLaunchOptions.write(home, 1790600, "-dx11"))
|
||||
}
|
||||
}
|
||||
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user