Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b600955f53 | ||
|
|
bed037509f | ||
|
|
07f2dc8e8f | ||
|
|
0f924aebb0 | ||
|
|
8ec499ae3f | ||
|
|
53c1933ac8 | ||
|
|
4df3f775e1 | ||
|
|
6b570c573b | ||
|
|
d164749a7f | ||
|
|
50c5fd79f7 | ||
|
|
c6169cba80 | ||
|
|
017c1c6b31 | ||
|
|
a8df9a7ae1 | ||
|
|
d38fd373f0 | ||
|
|
a6fe10d8ff | ||
|
|
953549704a | ||
|
|
19d8819137 | ||
|
|
1b80b506cb | ||
|
|
4b289a4802 | ||
|
|
238ef76c5c | ||
|
|
906e66e3cf | ||
|
|
c0d14f9632 | ||
|
|
70bda85dd5 | ||
|
|
9e6f81540f | ||
|
|
3e1fc3e60e | ||
|
|
826853fff5 | ||
|
|
9be131cf6d | ||
|
|
5ed97915c7 | ||
|
|
d8654ae1be | ||
|
|
8f4744398d | ||
|
|
8f4cefd3bd | ||
|
|
01dc415f10 | ||
|
|
af1fe6c61c | ||
|
|
7bf75af8a1 | ||
|
|
c08952dff9 | ||
|
|
58430cd393 | ||
|
|
46d42f9ca9 | ||
|
|
43ff1db06b | ||
|
|
f934feb457 | ||
|
|
79d41b29ad | ||
|
|
bb6523cd9c | ||
|
|
925e9743a8 | ||
|
|
049c4be6e5 | ||
|
|
e36cf24ba9 | ||
|
|
1772291da7 |
No files matched your search
@@ -0,0 +1,35 @@
|
||||
name: Build bionic runtime pack and DroidDeck-Bionic tool
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'tools/bionic-runtime/**'
|
||||
- 'tools/gamescope/patches/0117-wsi-cache-present-bypass-check.patch'
|
||||
- 'tools/gamescope/patches/0119-wsi-default-images-under-limiter.patch'
|
||||
- 'app/src/main/cpp/fakeinput_steam.cpp'
|
||||
- 'tools/gpuload/**'
|
||||
- '.github/workflows/build-bionic-runtime.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Host tools
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq --no-install-recommends libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev \
|
||||
libxcb1-dev libxcb-composite0-dev libglm-dev zstd
|
||||
- name: Build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
|
||||
export BUILD_NUMBER=${{ github.run_number }}
|
||||
tools/bionic-runtime/build.sh "$RUNNER_TEMP/bionic-runtime" "$PWD/out"
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: droiddeck-bionic-runtime-${{ github.sha }}
|
||||
path: out/*
|
||||
@@ -754,12 +754,17 @@ jobs:
|
||||
ln -sfn "$(cd "$jars" && pwd)" "$m2"
|
||||
echo "cache=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Cache Robolectric's Android jars
|
||||
- name: Restore Robolectric's Android jars
|
||||
id: robolectric-cache
|
||||
if: steps.robolectric-jars.outputs.cache == 'true'
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ../robolectric-jars
|
||||
key: robolectric-android-all-v2-${{ steps.robolectric.outputs.version }}
|
||||
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
|
||||
restore-keys: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-
|
||||
- name: Count the restored Robolectric jars
|
||||
if: steps.robolectric-jars.outputs.cache == 'true'
|
||||
run: echo "ROBOLECTRIC_JARS_BEFORE=$(find "$GITHUB_WORKSPACE/../robolectric-jars" -name '*.jar' | wc -l)" >> "$GITHUB_ENV"
|
||||
- name: Unit tests
|
||||
id: unit-tests
|
||||
env:
|
||||
@@ -770,6 +775,34 @@ jobs:
|
||||
mkdir -p app/build
|
||||
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log
|
||||
|
||||
# actions/cache only saves when the job succeeds, so a run whose tests died on a Maven 429 never filled the cache.
|
||||
# Save the complete jars even after a failed test step, when this run added some; a partial download is dropped first.
|
||||
- name: Save Robolectric's Android jars
|
||||
id: robolectric-jars-final
|
||||
if: always() && steps.robolectric-jars.outputs.cache == 'true'
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import glob, os, zipfile
|
||||
root = os.path.join(os.environ['GITHUB_WORKSPACE'], '..', 'robolectric-jars')
|
||||
for f in glob.glob(os.path.join(root, '**', '*'), recursive=True):
|
||||
if not os.path.isfile(f):
|
||||
continue
|
||||
try:
|
||||
ok = f.endswith('.jar') and zipfile.ZipFile(f).testzip() is None
|
||||
except Exception:
|
||||
ok = False
|
||||
if not ok:
|
||||
os.remove(f)
|
||||
PY
|
||||
after=$(find "$GITHUB_WORKSPACE/../robolectric-jars" -name '*.jar' | wc -l)
|
||||
[ "$after" -gt "${ROBOLECTRIC_JARS_BEFORE:-0}" ] && echo "save=true" >> "$GITHUB_OUTPUT" || true
|
||||
- name: Store Robolectric's Android jars
|
||||
if: always() && steps.robolectric-jars-final.outputs.save == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ../robolectric-jars
|
||||
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
|
||||
|
||||
- name: Upload unit test diagnostics
|
||||
id: unit-test-diagnostics
|
||||
if: always() && steps.unit-tests.outcome != 'skipped'
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linux desktop, integration with GOG, Epic Games, Xbox, and other storefronts, Steam VR, and more!
|
||||
|
||||
<p align="center"><b>100% open source. No ads. No telemetry. No proprietary components. No source withheld.</b></p>
|
||||
<p align="center"><b>100% open source. No ads. No Subscriptions. No telemetry. No proprietary components. No source withheld.</b></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.1/DroidDeck-0.7.1.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.1%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.1"></a>
|
||||
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.11%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.11"></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>
|
||||
|
||||
@@ -23,7 +23,7 @@ DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linu
|
||||
<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/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>
|
||||
<p align="center"><a href="https://www.youtube.com/watch?v=ruaTSm_7a2c"><img src="docs/media/droiddeck-showcase.gif" width="60%" alt="A table of handhelds and phones all running DroidDeck, one waking to the Steam menu, the AYN Thor's bottom screen used as a touchpad, and scrolling around Steam on a phone before swiping to the home screen. Footage from Cyber Dopamine's video, linked."></a></p>
|
||||
|
||||
> The official website is [droid-deck.dev](https://droid-deck.dev). Only download DroidDeck from this repository's [Releases](https://github.com/Droid-Deck/DroidDeck/releases).
|
||||
|
||||
@@ -38,7 +38,7 @@ DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linu
|
||||
|
||||
1. Android 9 or newer on Adreno 730 or newer, or any 8xx. Adreno 6xx, Mali, Xclipse and PowerVR are experimental. Adreno 710 is currently unsupported. No root needed.
|
||||
2. About 3 GB free for the runtime, plus 1.1 GB for the desktop and emulators.
|
||||
3. Install the [APK](https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.1/DroidDeck-0.7.1.apk), install the Linux runtime, press **Play** and sign in to Steam.
|
||||
3. Install the [APK](https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk), install the Linux runtime, press **Play** and sign in to Steam.
|
||||
4. On Android 14 and newer, turn on **Disable child process restrictions** in Developer options. On Android 12 and 13, Steam's first launch shows a **Fix it for me** button that walks you through it.
|
||||
|
||||
Smart glasses setup is in the [support matrix](docs/smart-glasses-support.md). Release notes are in [docs/releases](docs/releases).
|
||||
@@ -57,9 +57,6 @@ The APK lands in `app/build/outputs/apk/release/`. Install it with `tools/deploy
|
||||
|
||||
On Windows, see `tools/run_windows.ps1` and `tools/prepare_windows_runtime.py`.
|
||||
|
||||
## Limits
|
||||
|
||||
Compatibility and performance vary by device. Desktop compositing is software rendered, and Firefox sandboxing is reduced under proot.
|
||||
|
||||
## Credits and licence
|
||||
|
||||
@@ -72,6 +69,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
|
||||
- mmap ring buffer controller input by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)).
|
||||
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT), and its GL thunk hands X errors to the program's own error handler. FEX's code disk cache was checked in its source. The fix for host stack left behind when a program leaves a signal handler without returning follows the approach suggested in [FEX-Emu/FEX#2487](https://github.com/FEX-Emu/FEX/issues/2487). The host stack fix for system calls that end a block is a backport of Ryan Houdek's [FEX-Emu/FEX#6122](https://github.com/FEX-Emu/FEX/pull/6122).
|
||||
- x86 AppImages, and arm64 ones whose runtime can't unpack on Android, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence.
|
||||
- DwarFS AppImages are unpacked without proot by `dwarfsextract` from [DwarFS](https://github.com/mhx/dwarfs) by Marcus Holland-Moritz (MIT), the release binary uruntime embeds, taken out of its self-extracting wrapper and shipped with its licence.
|
||||
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
|
||||
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
|
||||
- Windows programs on noexec storage get executable copies of their image pages, following [@yujikaido](https://github.com/yujikaido)'s finding in [droiddeck-rp4pro](https://github.com/yujikaido/droiddeck-rp4pro) that Wine's own processes need the noexec shim.
|
||||
|
||||
@@ -132,8 +132,8 @@ android {
|
||||
applicationId "com.droiddeck.launcher"
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 34
|
||||
versionCode 19
|
||||
versionName "0.7.1"
|
||||
versionCode 20
|
||||
versionName "0.7.11"
|
||||
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
|
||||
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
|
||||
buildConfigField "int", "PR_NUMBER", "${prNumber}"
|
||||
|
||||
@@ -58,6 +58,59 @@
|
||||
|
||||
#define EXPORT extern "C" __attribute__((visibility("default")))
|
||||
|
||||
struct SymbolSlot {
|
||||
std::atomic<void *> fn{nullptr};
|
||||
std::atomic<bool> resolved{false};
|
||||
};
|
||||
|
||||
template <typename Fn> static Fn resolved_symbol(SymbolSlot &slot, void *handle, const char *name) {
|
||||
if (!slot.resolved.load(std::memory_order_acquire)) {
|
||||
slot.fn.store(dlsym(handle, name), std::memory_order_relaxed);
|
||||
slot.resolved.store(true, std::memory_order_release);
|
||||
}
|
||||
return reinterpret_cast<Fn>(slot.fn.load(std::memory_order_relaxed));
|
||||
}
|
||||
|
||||
enum class Next : size_t {
|
||||
open,
|
||||
openat,
|
||||
close,
|
||||
write,
|
||||
ioctl,
|
||||
poll,
|
||||
ppoll,
|
||||
select,
|
||||
stat,
|
||||
stat64,
|
||||
fstat,
|
||||
fstat64,
|
||||
xstat,
|
||||
xstat64,
|
||||
fxstat,
|
||||
fxstat64,
|
||||
statx,
|
||||
statfs,
|
||||
fstatfs,
|
||||
access,
|
||||
faccessat,
|
||||
opendir,
|
||||
scandir,
|
||||
inotify_add_watch,
|
||||
count
|
||||
};
|
||||
|
||||
static const char *const next_names[] = {"open", "openat", "close", "write", "ioctl", "poll", "ppoll", "select", "stat", "stat64", "fstat", "fstat64", "__xstat", "__xstat64", "__fxstat", "__fxstat64", "statx", "statfs", "fstatfs", "access", "faccessat", "opendir", "scandir", "inotify_add_watch"};
|
||||
static_assert(sizeof(next_names) / sizeof(next_names[0]) == static_cast<size_t>(Next::count), "next_names");
|
||||
static SymbolSlot next_slots[static_cast<size_t>(Next::count)];
|
||||
|
||||
template <typename Fn> static Fn next_symbol(Next which) {
|
||||
return resolved_symbol<Fn>(next_slots[static_cast<size_t>(which)], RTLD_NEXT, next_names[static_cast<size_t>(which)]);
|
||||
}
|
||||
|
||||
static void resolve_next_symbols() {
|
||||
for (size_t i = 0; i < static_cast<size_t>(Next::count); i++) next_symbol<void *>(static_cast<Next>(i));
|
||||
}
|
||||
|
||||
#ifdef __GLIBC__
|
||||
typedef unsigned long ioctl_request_t;
|
||||
#else
|
||||
@@ -205,6 +258,11 @@ static void controller_fork_prepare();
|
||||
static void controller_fork_parent();
|
||||
static void controller_fork_child();
|
||||
|
||||
// bionic: libc's own start-up calls hooked functions (access) before environ is set. Settings read
|
||||
// then would be empty and cached for good, so until environ exists hooks see defaults, uncached.
|
||||
extern "C" char **environ;
|
||||
static bool env_ready() { return environ != nullptr; }
|
||||
|
||||
struct FakeConfig {
|
||||
const char *hook_dir;
|
||||
const char *udev_data_dir;
|
||||
@@ -218,6 +276,10 @@ struct FakeConfig {
|
||||
// would throw a recursive-init error there, so the fields are filled without allocating, and a
|
||||
// reentry on the initializing thread gets them while other threads wait for the fork handlers.
|
||||
static FakeConfig &config() {
|
||||
if (!env_ready()) {
|
||||
static FakeConfig early = {"/data/data/com.termux/files/home/fake-input", nullptr, false, false, false};
|
||||
return early;
|
||||
}
|
||||
static FakeConfig cfg;
|
||||
static std::atomic<int> state{0};
|
||||
static __thread bool initializing __attribute__((tls_model("initial-exec")));
|
||||
@@ -433,6 +495,7 @@ void log(const char *message, ...) {
|
||||
}
|
||||
|
||||
__attribute__((constructor)) static void library_init() {
|
||||
resolve_next_symbols();
|
||||
config();
|
||||
controller_mutex();
|
||||
controller_map();
|
||||
@@ -587,7 +650,7 @@ get_fake_input_rdev(const char *event) {
|
||||
|
||||
__attribute__((visibility("hidden"))) static void load_ring_paths() {
|
||||
std::lock_guard<std::recursive_mutex> guard(controller_mutex());
|
||||
if (ring_paths_loaded)
|
||||
if (ring_paths_loaded || !env_ready())
|
||||
return;
|
||||
|
||||
const char *spec = getenv("FAKE_EVDEV_MEMFD_PATHS");
|
||||
@@ -724,7 +787,7 @@ open_fake_input_ring(const char *event, int flags) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
|
||||
int fd = my_open(ring_path.c_str(), O_RDWR | (flags & (O_NONBLOCK | O_CLOEXEC)));
|
||||
if (fd < 0)
|
||||
@@ -807,12 +870,25 @@ __attribute__((visibility("hidden"))) static bool is_steam_client() {
|
||||
__attribute__((visibility("hidden"))) static bool presents_steam_virtual() {
|
||||
static int known;
|
||||
if (known == 0) {
|
||||
if (!env_ready()) return false;
|
||||
const char *enabled = getenv("FAKE_EVDEV_STEAM_VIRTUAL");
|
||||
known = enabled && atoi(enabled) && !is_steam_client() ? 1 : -1;
|
||||
}
|
||||
return known == 1;
|
||||
}
|
||||
|
||||
// The bionic Proton layer's winebus has no udev bus, and its SDL bus skips 28de:11ff (Proton reads Steam's virtual
|
||||
// pad through udev/evdev), so with FAKE_EVDEV_STEAM_PAD_AS_X360=1 other processes see that pad as a plain Xbox 360 pad.
|
||||
__attribute__((visibility("hidden"))) static bool steam_pad_as_x360() {
|
||||
static int known;
|
||||
if (known == 0) {
|
||||
if (!env_ready()) return false;
|
||||
const char *v = getenv("FAKE_EVDEV_STEAM_PAD_AS_X360");
|
||||
known = v && atoi(v) && !is_steam_client() ? 1 : -1;
|
||||
}
|
||||
return known == 1;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static bool
|
||||
presents_xbox_triggers(const FakeController &fake) {
|
||||
return fake.uinput || !is_steam_client();
|
||||
@@ -978,7 +1054,7 @@ __attribute__((visibility("hidden"))) static void unpublish_uinput(UinputWriter
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static int claim_uinput_node(int *fd_out) {
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
for (int node = UINPUT_EVENT_BASE; node < UINPUT_EVENT_LIMIT; node++) {
|
||||
std::string path = uinput_ring_path(node);
|
||||
int fd = my_open(path.c_str(), O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC, 0644);
|
||||
@@ -1005,7 +1081,7 @@ __attribute__((visibility("hidden"))) static int claim_uinput_node(int *fd_out)
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static int publish_uinput(UinputWriter &w) {
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
int fd = -1;
|
||||
int node = claim_uinput_node(&fd);
|
||||
if (node < 0) return -1;
|
||||
@@ -1391,6 +1467,7 @@ static std::unordered_map<int, std::shared_ptr<DeckHidraw>> &deck_map() {
|
||||
|
||||
static bool fake_deck_enabled() {
|
||||
static int enabled = -1;
|
||||
if (enabled < 0 && !env_ready()) return false;
|
||||
if (enabled < 0) enabled = getenv("FAKE_EVDEV_DECK") && atoi(getenv("FAKE_EVDEV_DECK")) ? 1 : 0;
|
||||
return enabled == 1;
|
||||
}
|
||||
@@ -1398,6 +1475,7 @@ static bool fake_deck_enabled() {
|
||||
__attribute__((visibility("hidden"))) static uint32_t session_pad_type() {
|
||||
static int type = -1;
|
||||
if (type < 0) {
|
||||
if (!env_ready()) return PAD_TYPE_DECK;
|
||||
const char *env = getenv("FAKE_EVDEV_PAD_TYPE");
|
||||
type = env && !strcmp(env, "steamcontroller") ? PAD_TYPE_STEAM
|
||||
: env && !strcmp(env, "xbox360") ? PAD_TYPE_XBOX
|
||||
@@ -1416,7 +1494,7 @@ __attribute__((visibility("hidden"))) static const uint8_t *ring_blocks() {
|
||||
std::lock_guard<std::mutex> guard(lock);
|
||||
if ((mapped = block.load(std::memory_order_acquire))) return mapped;
|
||||
tries.fetch_add(1, std::memory_order_relaxed);
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
std::string path = get_ring_path_for_slot(0);
|
||||
int fd = path.empty() ? -1 : my_open(path.c_str(), O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) return nullptr;
|
||||
@@ -1470,6 +1548,7 @@ __attribute__((visibility("hidden"))) static uint64_t monotonic_us() {
|
||||
|
||||
static bool fake_triton_enabled() {
|
||||
static int enabled = -1;
|
||||
if (enabled < 0 && !env_ready()) return false;
|
||||
if (enabled < 0)
|
||||
enabled = fake_deck_enabled() && getenv("FAKE_EVDEV_TRITON") && atoi(getenv("FAKE_EVDEV_TRITON")) ? 1 : 0;
|
||||
return enabled == 1;
|
||||
@@ -1768,7 +1847,7 @@ __attribute__((visibility("hidden"))) static void *sony_report_thread(void *arg)
|
||||
|
||||
__attribute__((visibility("hidden"))) static int open_deck_hidraw(int flags, uint8_t sony = 0) {
|
||||
const char *path = sony == 4 ? DS4_HIDRAW_PATH : sony == 5 ? DUALSENSE_HIDRAW_PATH : DECK_HIDRAW_PATH;
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
if (!process_reads_pads()) {
|
||||
Logger::log("deck: %s refused: not the Steam client\n", path);
|
||||
errno = ENOENT;
|
||||
@@ -1977,7 +2056,7 @@ __attribute__((visibility("hidden"))) static void *triton_pad_thread(void *arg)
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static int open_triton_hidraw(int flags, bool emulated) {
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
if (!process_reads_pads()) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
@@ -2091,11 +2170,12 @@ static_assert(sizeof(TouchRingFile) <= TOUCH_RING_SIZE, "TouchRingFile layout");
|
||||
|
||||
__attribute__((visibility("hidden"))) static TouchRingFile *touch_ring() {
|
||||
static TouchRingFile *ring = nullptr;
|
||||
if (!env_ready()) return nullptr;
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [] {
|
||||
const char *path = getenv("FAKE_TOUCHCTL_RING");
|
||||
if (!path || !*path || !fake_deck_enabled()) return;
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
int fd = my_open(path, O_RDWR | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
Logger::log("touch: %s not openable (%s)\n", path, strerror(errno));
|
||||
@@ -2312,7 +2392,8 @@ __attribute__((visibility("hidden"))) static int inject_uevent(const char *actio
|
||||
const char *subsystem, const char *devname,
|
||||
unsigned major, unsigned minor) {
|
||||
using inject_fn = int (*)(const char *, const char *, const char *, const char *, unsigned, unsigned);
|
||||
static auto inject = reinterpret_cast<inject_fn>(dlsym(RTLD_DEFAULT, "dd_udevmon_inject"));
|
||||
static SymbolSlot inject_slot;
|
||||
const auto inject = resolved_symbol<inject_fn>(inject_slot, RTLD_DEFAULT, "dd_udevmon_inject");
|
||||
return inject ? inject(action, devpath, subsystem, devname, major, minor) : -1;
|
||||
}
|
||||
|
||||
@@ -2434,6 +2515,7 @@ __attribute__((constructor)) static void start_touch_controller() {
|
||||
static constexpr long SYSFS_FS_MAGIC = 0x62656572;
|
||||
|
||||
__attribute__((visibility("hidden"))) static const char *deck_listing_dir() {
|
||||
if (!env_ready()) return nullptr;
|
||||
static const char *dir = getenv("FAKE_DECK_SYSFS_LISTING");
|
||||
return dir && *dir ? dir : nullptr;
|
||||
}
|
||||
@@ -2469,7 +2551,7 @@ __attribute__((visibility("hidden"))) static void note_deck_sysfs(const char *ho
|
||||
}
|
||||
|
||||
EXPORT int fstatfs(int fd, struct statfs *buf) {
|
||||
static auto real = reinterpret_cast<int (*)(int, struct statfs *)>(dlsym(RTLD_NEXT, "fstatfs"));
|
||||
const auto real = next_symbol<int (*)(int, struct statfs *)>(Next::fstatfs);
|
||||
int result = real(fd, buf);
|
||||
if (fake_deck_enabled() && is_deck_sysfs_fd(fd)) {
|
||||
note_deck_sysfs("fstatfs", result);
|
||||
@@ -2479,7 +2561,7 @@ EXPORT int fstatfs(int fd, struct statfs *buf) {
|
||||
}
|
||||
|
||||
EXPORT int statfs(const char *path, struct statfs *buf) {
|
||||
static auto real = reinterpret_cast<int (*)(const char *, struct statfs *)>(dlsym(RTLD_NEXT, "statfs"));
|
||||
const auto real = next_symbol<int (*)(const char *, struct statfs *)>(Next::statfs);
|
||||
int result = real(path, buf);
|
||||
if (fake_deck_enabled() && is_deck_sysfs_path(path)) {
|
||||
note_deck_sysfs(path, result);
|
||||
@@ -2528,7 +2610,7 @@ __attribute__((visibility("hidden"))) static int deck_imu_mode_change(const uint
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static void publish_imu_mode(const DeckHidraw &deck, int mode) {
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
if (deck.mapping_size < FAKE_INPUT_RING_SIZE + DECK_IMU_BLOCK_SIZE) return;
|
||||
std::string path = get_ring_path_for_slot(0);
|
||||
int fd = path.empty() ? -1 : my_open(path.c_str(), O_WRONLY | O_CLOEXEC);
|
||||
@@ -3037,7 +3119,7 @@ static int real_fstat(int fd, struct stat *buf);
|
||||
|
||||
__attribute__((visibility("hidden"))) static bool deck_mount_id_from_fdinfo(
|
||||
int dirfd, const char *path, int flags, struct statx *buf) {
|
||||
static auto real_openat = reinterpret_cast<decltype(&::openat)>(dlsym(RTLD_NEXT, "openat"));
|
||||
const auto real_openat = next_symbol<decltype(&::openat)>(Next::openat);
|
||||
int target;
|
||||
if (!path || !*path) {
|
||||
if (!(flags & AT_EMPTY_PATH)) return false;
|
||||
@@ -3075,7 +3157,7 @@ __attribute__((visibility("hidden"))) static bool deck_mount_id_from_fdinfo(
|
||||
}
|
||||
|
||||
EXPORT int statx(int dirfd, const char *path, int flags, unsigned mask, struct statx *buf) {
|
||||
static auto real = reinterpret_cast<decltype(&::statx)>(dlsym(RTLD_NEXT, "statx"));
|
||||
const auto real = next_symbol<decltype(&::statx)>(Next::statx);
|
||||
int result = real(dirfd, path, flags, mask, buf);
|
||||
int saved_errno = errno;
|
||||
constexpr unsigned unique_mount_id = 0x4000;
|
||||
@@ -3096,7 +3178,7 @@ EXPORT int statx(int dirfd, const char *path, int flags, unsigned mask, struct s
|
||||
#endif
|
||||
|
||||
EXPORT DIR *opendir(const char *name) {
|
||||
static auto real = reinterpret_cast<DIR *(*)(const char *)>(dlsym(RTLD_NEXT, "opendir"));
|
||||
const auto real = next_symbol<DIR *(*)(const char *)>(Next::opendir);
|
||||
DIR *dir = real(name);
|
||||
if (!dir) {
|
||||
note_sys_failure(AT_FDCWD, name);
|
||||
@@ -3126,7 +3208,7 @@ EXPORT int open(const char *pathname, int flags, ...) {
|
||||
|
||||
va_end(va);
|
||||
|
||||
static auto my_open = reinterpret_cast<int (*)(const char *, int, ...)>(dlsym(RTLD_NEXT, "open"));
|
||||
const auto my_open = next_symbol<int (*)(const char *, int, ...)>(Next::open);
|
||||
|
||||
if (fake_uinput_enabled() && is_uinput_path(pathname)) return open_uinput(flags);
|
||||
if (is_deck_hidraw_path(pathname)) return open_deck_hidraw(flags);
|
||||
@@ -3204,7 +3286,7 @@ EXPORT int openat(int dirfd, const char *pathname, int flags, ...) {
|
||||
|
||||
va_end(va);
|
||||
|
||||
static auto my_openat = reinterpret_cast<int (*)(int, const char *, int, ...)>(dlsym(RTLD_NEXT, "openat"));
|
||||
const auto my_openat = next_symbol<int (*)(int, const char *, int, ...)>(Next::openat);
|
||||
|
||||
if (fake_uinput_enabled() && is_uinput_path(pathname)) return open_uinput(flags);
|
||||
if (is_deck_hidraw_path(pathname)) return open_deck_hidraw(flags);
|
||||
@@ -3363,10 +3445,10 @@ static int fake_stat_fd(int fd, S *buf, Real real) {
|
||||
}
|
||||
|
||||
static int real_stat(const char *pathname, struct stat *statbuf) {
|
||||
static auto fn = reinterpret_cast<int (*)(const char *, struct stat *)>(dlsym(RTLD_NEXT, "stat"));
|
||||
const auto fn = next_symbol<int (*)(const char *, struct stat *)>(Next::stat);
|
||||
if (fn) return fn(pathname, statbuf);
|
||||
#ifdef _STAT_VER
|
||||
static auto xfn = reinterpret_cast<int (*)(int, const char *, struct stat *)>(dlsym(RTLD_NEXT, "__xstat"));
|
||||
const auto xfn = next_symbol<int (*)(int, const char *, struct stat *)>(Next::xstat);
|
||||
if (xfn) return xfn(_STAT_VER, pathname, statbuf);
|
||||
#endif
|
||||
errno = ENOSYS;
|
||||
@@ -3374,10 +3456,10 @@ static int real_stat(const char *pathname, struct stat *statbuf) {
|
||||
}
|
||||
|
||||
static int real_fstat(int fd, struct stat *buf) {
|
||||
static auto fn = reinterpret_cast<int (*)(int, struct stat *)>(dlsym(RTLD_NEXT, "fstat"));
|
||||
const auto fn = next_symbol<int (*)(int, struct stat *)>(Next::fstat);
|
||||
if (fn) return fn(fd, buf);
|
||||
#ifdef _STAT_VER
|
||||
static auto xfn = reinterpret_cast<int (*)(int, int, struct stat *)>(dlsym(RTLD_NEXT, "__fxstat"));
|
||||
const auto xfn = next_symbol<int (*)(int, int, struct stat *)>(Next::fxstat);
|
||||
if (xfn) return xfn(_STAT_VER, fd, buf);
|
||||
#endif
|
||||
errno = ENOSYS;
|
||||
@@ -3393,7 +3475,7 @@ EXPORT int fstat(int fd, struct stat *buf) {
|
||||
}
|
||||
|
||||
EXPORT int access(const char *pathname, int mode) {
|
||||
static auto my_access = reinterpret_cast<decltype(&::access)>(dlsym(RTLD_NEXT, "access"));
|
||||
const auto my_access = next_symbol<decltype(&::access)>(Next::access);
|
||||
if (fake_uinput_enabled() && is_uinput_path(pathname)) return 0;
|
||||
if (is_deck_hidraw_path(pathname) && process_reads_pads()) return 0;
|
||||
if ((is_triton_hidraw_path(pathname) || is_triton_pad_path(pathname) || sony_pad_path(pathname)) &&
|
||||
@@ -3434,7 +3516,7 @@ EXPORT int access(const char *pathname, int mode) {
|
||||
}
|
||||
|
||||
EXPORT int faccessat(int dirfd, const char *pathname, int mode, int flags) {
|
||||
static auto my_faccessat = reinterpret_cast<decltype(&::faccessat)>(dlsym(RTLD_NEXT, "faccessat"));
|
||||
const auto my_faccessat = next_symbol<decltype(&::faccessat)>(Next::faccessat);
|
||||
if (fake_uinput_enabled() && is_uinput_path(pathname)) return 0;
|
||||
if (is_deck_hidraw_path(pathname) && process_reads_pads()) return 0;
|
||||
if ((is_triton_hidraw_path(pathname) || is_triton_pad_path(pathname) || sony_pad_path(pathname)) &&
|
||||
@@ -3478,7 +3560,7 @@ EXPORT int scandir(const char *dirp, struct dirent ***namelist,
|
||||
int (*filter)(const struct dirent *),
|
||||
int (*compar)(const struct dirent **,
|
||||
const struct dirent **)) {
|
||||
static auto my_scandir = reinterpret_cast<decltype(&::scandir)>(dlsym(RTLD_NEXT, "scandir"));
|
||||
const auto my_scandir = next_symbol<decltype(&::scandir)>(Next::scandir);
|
||||
|
||||
if (dirp) {
|
||||
if (!strcmp(dirp, "/dev/input")) {
|
||||
@@ -3492,7 +3574,7 @@ EXPORT int scandir(const char *dirp, struct dirent ***namelist,
|
||||
}
|
||||
|
||||
EXPORT int inotify_add_watch(int fd, const char *pathname, uint32_t mask) {
|
||||
static auto my_inotify_add_watch = reinterpret_cast<decltype(&::inotify_add_watch)>(dlsym(RTLD_NEXT, "inotify_add_watch"));
|
||||
const auto my_inotify_add_watch = next_symbol<decltype(&::inotify_add_watch)>(Next::inotify_add_watch);
|
||||
|
||||
char *fake_path = nullptr;
|
||||
if (pathname) {
|
||||
@@ -3631,7 +3713,7 @@ static bool wait_snapshot(std::shared_ptr<FakeController> fake,
|
||||
|
||||
static int forward_ioctl(int fd, ioctl_request_t op, void *argp) {
|
||||
using ioctl_fn = int (*)(int, ioctl_request_t, ...);
|
||||
static const auto next = reinterpret_cast<ioctl_fn>(dlsym(RTLD_NEXT, "ioctl"));
|
||||
const auto next = next_symbol<ioctl_fn>(Next::ioctl);
|
||||
return next ? next(fd, op, argp) : static_cast<int>(syscall(SYS_ioctl, fd, op, argp));
|
||||
}
|
||||
|
||||
@@ -3689,6 +3771,10 @@ EXPORT int ioctl(int fd, ioctl_request_t op, ...) {
|
||||
id.bustype = 0x03;
|
||||
if (made) {
|
||||
id = made->id;
|
||||
if (steam_pad_as_x360() && id.vendor == STEAM_VIRTUAL_VENDOR_ID && id.product == STEAM_VIRTUAL_PRODUCT_ID) {
|
||||
id.vendor = X360_VENDOR_ID;
|
||||
id.product = X360_PRODUCT_ID;
|
||||
}
|
||||
} else if (presents_steam_virtual()) {
|
||||
id.vendor = STEAM_VIRTUAL_VENDOR_ID;
|
||||
id.product = STEAM_VIRTUAL_PRODUCT_ID;
|
||||
@@ -3866,7 +3952,7 @@ EXPORT int ioctl(int fd, ioctl_request_t op, ...) {
|
||||
}
|
||||
|
||||
EXPORT int close(int fd) {
|
||||
static auto my_close = reinterpret_cast<decltype(&::close)>(dlsym(RTLD_NEXT, "close"));
|
||||
const auto my_close = next_symbol<decltype(&::close)>(Next::close);
|
||||
|
||||
if (!watched(fd)) return my_close(fd);
|
||||
close_uinput(fd);
|
||||
@@ -4054,7 +4140,7 @@ EXPORT ssize_t readv(int fd, const struct iovec *iov, int iovcnt) {
|
||||
}
|
||||
|
||||
EXPORT ssize_t write(int fd, const void *buf, size_t count) {
|
||||
static auto my_write = reinterpret_cast<decltype(&::write)>(dlsym(RTLD_NEXT, "write"));
|
||||
const auto my_write = next_symbol<decltype(&::write)>(Next::write);
|
||||
|
||||
if (!watched(fd)) return my_write(fd, buf, count);
|
||||
std::unique_lock<std::recursive_mutex> guard(controller_mutex());
|
||||
@@ -4129,8 +4215,8 @@ EXPORT ssize_t writev(int fd, const struct iovec *iov, int iovcnt) {
|
||||
|
||||
static int poll_fake(struct pollfd *fds, nfds_t nfds, int timeout,
|
||||
const sigset_t *sigmask) {
|
||||
static auto my_poll = reinterpret_cast<decltype(&::poll)>(dlsym(RTLD_NEXT, "poll"));
|
||||
static auto my_ppoll = reinterpret_cast<decltype(&::ppoll)>(dlsym(RTLD_NEXT, "ppoll"));
|
||||
const auto my_poll = next_symbol<decltype(&::poll)>(Next::poll);
|
||||
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
|
||||
|
||||
nfds_t first = 0;
|
||||
while (first < nfds && !watched(fds[first].fd)) first++;
|
||||
@@ -4234,7 +4320,7 @@ EXPORT int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
|
||||
|
||||
EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
const struct timespec *timeout, const sigset_t *sigmask) {
|
||||
static auto my_ppoll = reinterpret_cast<decltype(&::ppoll)>(dlsym(RTLD_NEXT, "ppoll"));
|
||||
const auto my_ppoll = next_symbol<decltype(&::ppoll)>(Next::ppoll);
|
||||
if (timeout && (timeout->tv_sec < 0 || timeout->tv_nsec < 0 || timeout->tv_nsec >= 1000000000L)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
@@ -4261,7 +4347,7 @@ EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
|
||||
EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout) {
|
||||
static auto my_select = reinterpret_cast<decltype(&::select)>(dlsym(RTLD_NEXT, "select"));
|
||||
const auto my_select = next_symbol<decltype(&::select)>(Next::select);
|
||||
|
||||
fd_set original_readfds;
|
||||
fd_set original_writefds;
|
||||
@@ -4423,10 +4509,10 @@ EXPORT int openat64(int dirfd, const char *pathname, int flags, ...) {
|
||||
}
|
||||
|
||||
static int real_stat64(const char *pathname, struct stat64 *statbuf) {
|
||||
static auto fn = reinterpret_cast<int (*)(const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "stat64"));
|
||||
const auto fn = next_symbol<int (*)(const char *, struct stat64 *)>(Next::stat64);
|
||||
if (fn) return fn(pathname, statbuf);
|
||||
#ifdef _STAT_VER
|
||||
static auto xfn = reinterpret_cast<int (*)(int, const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "__xstat64"));
|
||||
const auto xfn = next_symbol<int (*)(int, const char *, struct stat64 *)>(Next::xstat64);
|
||||
if (xfn) return xfn(_STAT_VER, pathname, statbuf);
|
||||
#endif
|
||||
errno = ENOSYS;
|
||||
@@ -4434,10 +4520,10 @@ static int real_stat64(const char *pathname, struct stat64 *statbuf) {
|
||||
}
|
||||
|
||||
static int real_fstat64(int fd, struct stat64 *buf) {
|
||||
static auto fn = reinterpret_cast<int (*)(int, struct stat64 *)>(dlsym(RTLD_NEXT, "fstat64"));
|
||||
const auto fn = next_symbol<int (*)(int, struct stat64 *)>(Next::fstat64);
|
||||
if (fn) return fn(fd, buf);
|
||||
#ifdef _STAT_VER
|
||||
static auto xfn = reinterpret_cast<int (*)(int, int, struct stat64 *)>(dlsym(RTLD_NEXT, "__fxstat64"));
|
||||
const auto xfn = next_symbol<int (*)(int, int, struct stat64 *)>(Next::fxstat64);
|
||||
if (xfn) return xfn(_STAT_VER, fd, buf);
|
||||
#endif
|
||||
errno = ENOSYS;
|
||||
@@ -4453,27 +4539,27 @@ EXPORT int fstat64(int fd, struct stat64 *buf) {
|
||||
}
|
||||
|
||||
EXPORT int __xstat(int version, const char *pathname, struct stat *statbuf) {
|
||||
static auto real = reinterpret_cast<int (*)(int, const char *, struct stat *)>(dlsym(RTLD_NEXT, "__xstat"));
|
||||
const auto real = next_symbol<int (*)(int, const char *, struct stat *)>(Next::xstat);
|
||||
if (!real) return stat(pathname, statbuf);
|
||||
return fake_stat_path(pathname, statbuf, [version](const char *path, struct stat *buf) { return real(version, path, buf); });
|
||||
return fake_stat_path(pathname, statbuf, [version, real](const char *path, struct stat *buf) { return real(version, path, buf); });
|
||||
}
|
||||
|
||||
EXPORT int __xstat64(int version, const char *pathname, struct stat64 *statbuf) {
|
||||
static auto real = reinterpret_cast<int (*)(int, const char *, struct stat64 *)>(dlsym(RTLD_NEXT, "__xstat64"));
|
||||
const auto real = next_symbol<int (*)(int, const char *, struct stat64 *)>(Next::xstat64);
|
||||
if (!real) return stat64(pathname, statbuf);
|
||||
return fake_stat_path(pathname, statbuf, [version](const char *path, struct stat64 *buf) { return real(version, path, buf); });
|
||||
return fake_stat_path(pathname, statbuf, [version, real](const char *path, struct stat64 *buf) { return real(version, path, buf); });
|
||||
}
|
||||
|
||||
EXPORT int __fxstat(int version, int fd, struct stat *buf) {
|
||||
static auto real = reinterpret_cast<int (*)(int, int, struct stat *)>(dlsym(RTLD_NEXT, "__fxstat"));
|
||||
const auto real = next_symbol<int (*)(int, int, struct stat *)>(Next::fxstat);
|
||||
if (!real) return fstat(fd, buf);
|
||||
return fake_stat_fd(fd, buf, [version](int f, struct stat *b) { return real(version, f, b); });
|
||||
return fake_stat_fd(fd, buf, [version, real](int f, struct stat *b) { return real(version, f, b); });
|
||||
}
|
||||
|
||||
EXPORT int __fxstat64(int version, int fd, struct stat64 *buf) {
|
||||
static auto real = reinterpret_cast<int (*)(int, int, struct stat64 *)>(dlsym(RTLD_NEXT, "__fxstat64"));
|
||||
const auto real = next_symbol<int (*)(int, int, struct stat64 *)>(Next::fxstat64);
|
||||
if (!real) return fstat64(fd, buf);
|
||||
return fake_stat_fd(fd, buf, [version](int f, struct stat64 *b) { return real(version, f, b); });
|
||||
return fake_stat_fd(fd, buf, [version, real](int f, struct stat64 *b) { return real(version, f, b); });
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
@@ -4487,18 +4573,37 @@ static const char *const interposed_names[] = {
|
||||
};
|
||||
|
||||
static dlsym_fn next_dlsym() {
|
||||
static const dlsym_fn fn = [] {
|
||||
static std::atomic<dlsym_fn> fn{nullptr};
|
||||
static std::atomic<bool> resolved{false};
|
||||
if (!resolved.load(std::memory_order_acquire)) {
|
||||
#ifdef __x86_64__
|
||||
const char *base = "GLIBC_2.2.5";
|
||||
#else
|
||||
const char *base = "GLIBC_2.0";
|
||||
#endif
|
||||
dlsym_fn found{};
|
||||
for (const char *version : {base, "GLIBC_2.34"}) {
|
||||
if (auto found = reinterpret_cast<dlsym_fn>(dlvsym(RTLD_NEXT, "dlsym", version))) return found;
|
||||
if ((found = reinterpret_cast<dlsym_fn>(dlvsym(RTLD_NEXT, "dlsym", version)))) break;
|
||||
}
|
||||
return dlsym_fn{};
|
||||
}();
|
||||
return fn;
|
||||
fn.store(found, std::memory_order_relaxed);
|
||||
resolved.store(true, std::memory_order_release);
|
||||
}
|
||||
return fn.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
static void *libc_handle() {
|
||||
static std::atomic<void *> handle{nullptr};
|
||||
static std::atomic<bool> resolved{false};
|
||||
if (!resolved.load(std::memory_order_acquire)) {
|
||||
handle.store(dlopen(LIBC_SO, RTLD_LAZY | RTLD_NOLOAD), std::memory_order_relaxed);
|
||||
resolved.store(true, std::memory_order_release);
|
||||
}
|
||||
return handle.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
__attribute__((constructor)) static void resolve_dlsym_targets() {
|
||||
next_dlsym();
|
||||
libc_handle();
|
||||
}
|
||||
|
||||
static void *global_dlsym(void *, const char *name) { return next_dlsym()(RTLD_DEFAULT, name); }
|
||||
@@ -4516,8 +4621,7 @@ extern "C" __attribute__((visibility("hidden"), used)) void *fakeinput_dlsym_tar
|
||||
dlsym_fn next = next_dlsym();
|
||||
if (!next) return reinterpret_cast<void *>(missing_dlsym);
|
||||
if (handle == RTLD_DEFAULT || handle == RTLD_NEXT || name == nullptr) return reinterpret_cast<void *>(next);
|
||||
static void *const libc = dlopen(LIBC_SO, RTLD_LAZY | RTLD_NOLOAD);
|
||||
if (handle != libc || !interposed(name)) return reinterpret_cast<void *>(next);
|
||||
if (handle != libc_handle() || !interposed(name)) return reinterpret_cast<void *>(next);
|
||||
return reinterpret_cast<void *>(global_dlsym);
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var glThread by mutableStateOf(true)
|
||||
private var noGlError by mutableStateOf(true)
|
||||
private var returnAfterGame by mutableStateOf(true)
|
||||
private var valveProtonOnDemand by mutableStateOf(true)
|
||||
private var shaderPrecache by mutableStateOf<Boolean?>(null)
|
||||
private var steamRepairQueued by mutableStateOf(false)
|
||||
private var mangoapp by mutableStateOf(true)
|
||||
@@ -190,7 +191,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private var prootNoSeccomp by mutableStateOf(false)
|
||||
private var prootFastPath by mutableStateOf(true)
|
||||
private var nativeUserland by mutableStateOf(true)
|
||||
private var cursorComposite by mutableStateOf(false)
|
||||
private var cursorComposite by mutableStateOf(true)
|
||||
private var guestHostname by mutableStateOf(SessionPrefs.DEFAULT_GUEST_HOSTNAME)
|
||||
private var phantomWarning by mutableStateOf<String?>(null)
|
||||
private var phantomProcessStatus by mutableStateOf(PhantomProcessStatus.NOT_APPLICABLE)
|
||||
@@ -2170,6 +2171,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
if (!triggerKeys.synthesizing && triggerKeys.nativeKey(event)) return true
|
||||
val tabStep = com.droiddeck.launcher.ui.dualPageStep(event)
|
||||
val tabs = com.droiddeck.launcher.ui.MainTabSteps.handler
|
||||
if (tabStep == null && event.action == KeyEvent.ACTION_DOWN) com.droiddeck.launcher.ui.MainTabSteps.otherKeys++
|
||||
if (tabStep != null && tabs != null) {
|
||||
if (controllerHaptics) com.droiddeck.launcher.ui.ControllerHaptics.onKey(this, event)
|
||||
if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) tabs(tabStep)
|
||||
@@ -2383,6 +2385,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
homeScreenEnabled = HomeApp.isHomeScreenEnabled(this)
|
||||
homeAppSelected = homeScreenEnabled && HomeApp.isDefault(this)
|
||||
defaultHomeLabel = HomeApp.defaultLabel(this)
|
||||
com.droiddeck.launcher.ui.NavTabs.syncHomeApps(this, homeAppSelected)
|
||||
refreshAndroidApps()
|
||||
integrationState = readIntegration()
|
||||
}
|
||||
@@ -2783,6 +2786,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
steamClientArch = if (mode == SessionService.MODE_STEAM) steamClientArch else null,
|
||||
returnAfterGame = if (mode == SessionService.MODE_STEAM) returnAfterGame else null,
|
||||
shaderPrecache = if (mode == SessionService.MODE_STEAM) shaderPrecache else null,
|
||||
valveProtonOnDemand = if (mode == SessionService.MODE_STEAM) valveProtonOnDemand else null,
|
||||
steamRepairQueued = steamRepairQueued,
|
||||
mangoapp = mangoapp,
|
||||
steamController = if (mode == SessionService.MODE_STEAM) steamController else null,
|
||||
@@ -2890,6 +2894,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onMangoapp = { on -> SessionPrefs.setMangoapp(this, on); mangoapp = on },
|
||||
onReturnAfterGame = { on -> SessionPrefs.setReturnAfterGame(this, on); returnAfterGame = on },
|
||||
onShaderPrecache = { on -> SessionPrefs.setShaderPrecache(this, on); shaderPrecache = on },
|
||||
onValveProtonOnDemand = { on -> SessionPrefs.setValveProtonOnDemand(this, on); valveProtonOnDemand = on },
|
||||
onSteamController = { id -> SessionPrefs.setSteamController(this, id); steamController = id },
|
||||
onStartupSession = { id ->
|
||||
SessionPrefs.setStartupSession(this, id)
|
||||
@@ -3162,6 +3167,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
steamRepairQueued = SteamRepair.queued(this)
|
||||
mangoapp = SessionPrefs.mangoapp(this)
|
||||
returnAfterGame = SessionPrefs.returnAfterGame(this)
|
||||
valveProtonOnDemand = SessionPrefs.valveProtonOnDemand(this)
|
||||
loadShaderPrecache(mode)
|
||||
steamController = SessionPrefs.steamController(this)
|
||||
startupSession = SessionPrefs.startupSession(this)
|
||||
|
||||
@@ -49,7 +49,7 @@ internal class ProtonMenu(
|
||||
@VisibleForTesting internal var latestCheck: (Boolean) -> Boolean = { force -> ProtonExtras.checkLatest(activity, force) }
|
||||
@VisibleForTesting internal var experimentalRefresh: () -> List<ExperimentalProtons.Release>? = { ExperimentalProtons.refresh(activity) }
|
||||
@VisibleForTesting internal var installer: (ProtonExtras.Tool, (String, Int) -> Unit) -> String? =
|
||||
{ tool, progress -> ProtonExtras.install(activity, tool, progress) }
|
||||
{ tool, progress -> ProtonExtras.install(activity, tool, onProgress = progress) }
|
||||
|
||||
fun installProton(id: String, automatic: Boolean = false) {
|
||||
val tool = ProtonExtras.tools.firstOrNull { it.id == id } ?: return
|
||||
@@ -156,7 +156,7 @@ internal class ProtonMenu(
|
||||
|
||||
fun refreshProtons() {
|
||||
refreshExperimental()
|
||||
protonRows = ProtonExtras.tools.map {
|
||||
protonRows = ProtonExtras.offered(activity).map {
|
||||
val all = ProtonExtras.installedAll(activity, it)
|
||||
ProtonRow(it.id, it.name, all.lastOrNull(), ProtonExtras.queued(activity, it), all, ProtonExtras.update(activity, it))
|
||||
}
|
||||
|
||||
@@ -2834,6 +2834,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
|
||||
private fun installProton(): String? {
|
||||
uiHandler.post { loading.percent = -1; loading.say(getString(PROTON_LINES.downloading), PROTON_LINES.topic, readable = true) }
|
||||
if (com.droiddeck.launcher.session.SessionPrefs.ownProtonFirst(this)) return installOwnProton()
|
||||
val catalog = com.droiddeck.launcher.runtime.DesktopCatalog
|
||||
val cancellation = com.droiddeck.launcher.core.Downloader.Cancellation { SessionState.stopRequested }
|
||||
SessionState.installCancellation = cancellation
|
||||
@@ -2846,6 +2847,24 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}
|
||||
}
|
||||
|
||||
private fun installOwnProton(): String? {
|
||||
val extras = com.droiddeck.launcher.session.ProtonExtras
|
||||
while ((extras.prefetching || extras.installInProgress) && !SessionState.stopRequested) {
|
||||
try { Thread.sleep(250) } catch (_: InterruptedException) { Thread.currentThread().interrupt(); return "interrupted" }
|
||||
}
|
||||
if (SessionState.stopRequested) return "cancelled"
|
||||
if (!com.droiddeck.launcher.runtime.DesktopCatalog.ownProtonMissing(this)) return null
|
||||
val cancellation = com.droiddeck.launcher.core.Downloader.Cancellation { SessionState.stopRequested }
|
||||
SessionState.installCancellation = cancellation
|
||||
return try {
|
||||
extras.install(this, extras.tools.first { it.id == extras.OWN }, cancellation) { label, percent ->
|
||||
uiHandler.post { loading.percent = percent; loading.say(label, PROTON_LINES.topic, readable = true) }
|
||||
}.also { if (it == null) com.droiddeck.launcher.session.Onboarding.recheck(this) }
|
||||
} finally {
|
||||
if (SessionState.installCancellation === cancellation) SessionState.installCancellation = null
|
||||
}
|
||||
}
|
||||
|
||||
override fun surfaceCreated(holder: SurfaceHolder) {
|
||||
if (holder !== outputHolder()) return
|
||||
if (installingRuntime || SessionState.stopRequested || ended) return
|
||||
@@ -3395,8 +3414,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (status == 0) SessionState.takeRelaunch()?.let { next ->
|
||||
next.putExtra(EXTRA_RETURN_HOME, intent.getBooleanExtra(EXTRA_RETURN_HOME, false))
|
||||
next.putExtra(EXTRA_LINK_TASK, intent.getIntExtra(EXTRA_LINK_TASK, -1))
|
||||
setIntent(next)
|
||||
recreate()
|
||||
relaunch(next)
|
||||
return@runOnUiThread
|
||||
}
|
||||
showEnded(status, hint)
|
||||
@@ -3404,6 +3422,16 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
}, "session-end-hint").start()
|
||||
}
|
||||
|
||||
// recreate() keeps this window, and Compose content added to it afterwards never recomposes, so the
|
||||
// loading screen of the next session stays up over a running session. A new instance gets its own window.
|
||||
// This instance finishes first because the activity is singleTask and would otherwise take the intent itself.
|
||||
private fun relaunch(next: Intent) {
|
||||
closeAtOnce = true
|
||||
super.finish()
|
||||
startActivity(next)
|
||||
overridePendingTransition(0, 0)
|
||||
}
|
||||
|
||||
private fun showEnded(status: Int, hint: EndHint?) {
|
||||
if (status == 0 && hint?.evenOnSuccess != true) {
|
||||
finish()
|
||||
@@ -5158,10 +5186,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var sessionTouchDown = false
|
||||
private var screenTapsClick = true
|
||||
|
||||
private fun onScreenMouseButtonShown(): Boolean = listOfNotNull(
|
||||
private fun onScreenLeftMouseButtonShown(): Boolean = listOfNotNull(
|
||||
onScreenControls?.inputSurface, bottomInputControls?.inputSurface, unfoldedPanel?.inputSurface, unfoldedDeckSurface,
|
||||
secondScreenPresentation?.controlsView, swappedInputSurface,
|
||||
).any { it.isShown && inputProfile.showsMouseButton(it.inputRole, it.shownElements, stockInputProfile) }
|
||||
).any { it.isShown && inputProfile.showsLeftMouseButton(it.inputRole, it.shownElements, stockInputProfile) }
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean = inSurfaceSpace(event) { handleTouch(event) }
|
||||
|
||||
@@ -5197,7 +5225,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
val snapshot = fingerTouchSnapshot(uiBlocking)
|
||||
val route = com.droiddeck.launcher.input.TouchRouter.decide(snapshot)
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||
screenTapsClick = !onScreenMouseButtonShown()
|
||||
screenTapsClick = !onScreenLeftMouseButtonShown()
|
||||
if (::touchpad.isInitialized) touchpad.clicks = screenTapsClick
|
||||
if (::scrollTouch.isInitialized) scrollTouch.clicks = screenTapsClick
|
||||
}
|
||||
@@ -6031,8 +6059,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
Log.w(TAG, "ignoring agent start while session phase is ${SessionState.phase}")
|
||||
return
|
||||
}
|
||||
setIntent(intent)
|
||||
recreate()
|
||||
relaunch(android.content.Intent(intent).setClass(this, SessionActivity::class.java))
|
||||
return
|
||||
}
|
||||
if (this.intent.getBooleanExtra(EXTRA_RETURN_HOME, false)) intent.putExtra(EXTRA_RETURN_HOME, true)
|
||||
|
||||
@@ -293,6 +293,7 @@ object DeviceReport {
|
||||
k("Stretch 16:9 to panel", SessionPrefs.stretch16x9(context))
|
||||
k("Avoid notch", SessionPrefs.avoidNotch(context))
|
||||
k("Return to launcher after a game", SessionPrefs.returnAfterGame(context))
|
||||
k("Valve Proton only when needed", SessionPrefs.valveProtonOnDemand(context))
|
||||
k("Microphone", SessionPrefs.micEnabled(context))
|
||||
k("On-screen controls", SessionPrefs.oscMode(context))
|
||||
k("Touch mode", SessionPrefs.touchMode(context))
|
||||
|
||||
@@ -31,6 +31,7 @@ object AddedGames {
|
||||
val exeUncertain: Boolean = false,
|
||||
val launchOptions: String = "",
|
||||
val single: Boolean = false,
|
||||
val steamProgram: Boolean = true,
|
||||
) {
|
||||
fun folderName(): String = folder.name
|
||||
}
|
||||
@@ -238,6 +239,7 @@ object AddedGames {
|
||||
for (entry in AddedExes.list(context)) {
|
||||
val folder = File(entry.folder)
|
||||
if (folder.path in removed || !folder.isDirectory) continue
|
||||
if (StoreGameSidecar.read(folder)?.isInstalled == false) continue
|
||||
scanGame(context, folder, out, single = entry, reuse = true)
|
||||
}
|
||||
for (folder in libraryDepotInstalls(context)) if (folder.path !in removed) scanGame(context, folder, out, reuse = true)
|
||||
@@ -336,7 +338,11 @@ object AddedGames {
|
||||
val owner = ownerFolder(app, exe)
|
||||
if (owner != null && owner.path !in SessionPrefs.removedAddedGames(app)) {
|
||||
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let {
|
||||
if (guestPath(app, exe) != null) AddedExes.put(app, AddedExes.Entry(owner.path, exe.path))
|
||||
val keep = listOf(it.exe, exe).firstOrNull { f -> guestPath(app, f) != null }
|
||||
if (keep != null) {
|
||||
SessionPrefs.setAddedGameExe(app, owner.path, keep.path)
|
||||
AddedExes.put(app, AddedExes.Entry(owner.path, keep.path))
|
||||
}
|
||||
return AddResult.Existing(it)
|
||||
}
|
||||
}
|
||||
@@ -442,9 +448,9 @@ object AddedGames {
|
||||
val chosen = picked.takeIf { it.isNotEmpty() }?.let { File(it) }?.takeIf { it.isFile }
|
||||
?: single?.takeIf { it.picked }?.let { File(it.exe) }?.takeIf { it.isFile }
|
||||
val found = chosen ?: sidecar?.exeFile(folder)?.takeIf { it.isFile } ?: candidates.firstOrNull() ?: return
|
||||
val epicLauncher = sidecar?.takeIf { it.store == Store.EPIC && (chosen == null || canonical(chosen) == canonical(it.exeFile(folder))) }
|
||||
val storeLauncher = sidecar?.takeIf { chosen == null || canonical(chosen) == canonical(it.exeFile(folder)) }
|
||||
?.launcherFile(folder)?.takeIf { it.isFile }
|
||||
val launch = epicLauncher ?: if (chosen == null) sidecar?.launcherFile(folder)?.takeIf { it.isFile } ?: found else found
|
||||
val launch = storeLauncher ?: found
|
||||
val foundGuest = guestPath(context, launch)
|
||||
if (foundGuest == null) { Log.w(TAG, "${folder.name}: the session cannot see ${launch.path}"); return }
|
||||
val autoName = sidecar?.title ?: identifiedName(folder, found) ?: folder.name
|
||||
@@ -470,7 +476,13 @@ object AddedGames {
|
||||
val guestDir = SessionPrefs.addedGameStartIn(context, folder.path).takeIf { sidecar == null && it.isNotEmpty() }
|
||||
?: sidecarDir
|
||||
?: guestPath(context, (if (adopted != null) adopted else launch).parentFile ?: folder) ?: return
|
||||
val steamId = config?.let { steamRoute(it, appId) }
|
||||
if (adopted == null && SessionPrefs.addedGameAdopted(context, folder.path, "Exe") == null &&
|
||||
guestPath(context, folder)?.let { steamEditedTo(it, record, guestExe) } == true) {
|
||||
SessionPrefs.setAddedGameAdopted(context, folder.path, "Exe", exe.path)
|
||||
}
|
||||
val steamProgram = candidates.firstOrNull()?.let { canonical(it) == canonical(exe) } ?: true ||
|
||||
SessionPrefs.addedGameAdopted(context, folder.path, "Exe")?.let { canonical(File(it)) == canonical(exe) } == true
|
||||
val steamId = config?.takeIf { steamProgram }?.let { steamRoute(it, appId) }
|
||||
out.add(Game(folder, name, exe, guestExe, guestDir, appId,
|
||||
steamId?.toLong() ?: ((appId shl 32) or 0x02000000L), candidates, steamId,
|
||||
source = sidecar?.store?.id ?: Library.ADDED, storeId = sidecar?.id,
|
||||
@@ -480,7 +492,7 @@ object AddedGames {
|
||||
sidecar.store == Store.UBISOFT -> com.droiddeck.launcher.stores.ubisoft.UbisoftConnect.launchOptions(context)
|
||||
else -> ""
|
||||
},
|
||||
single = single != null))
|
||||
single = single != null, steamProgram = steamProgram))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,6 +532,11 @@ object AddedGames {
|
||||
return file.takeIf { inside && it.isFile }
|
||||
}
|
||||
|
||||
internal fun steamEditedTo(folderGuest: String, record: JSONObject?, guestExe: String): Boolean {
|
||||
val steam = unquote(record?.optJSONObject("steam")?.optString("Exe"))
|
||||
return steam == guestExe && steam != unquote(record?.optJSONObject("app")?.optString("Exe")) && steam.startsWith("$folderGuest/")
|
||||
}
|
||||
|
||||
private fun unquote(value: String?): String = value.orEmpty().trim().trim('"')
|
||||
|
||||
internal fun adoptSteamEdits(context: Context, folder: File, record: JSONObject) {
|
||||
@@ -568,6 +585,7 @@ object AddedGames {
|
||||
.append(",\"seen\":").append(SessionPrefs.addedGameExeSeen(context, g.folder.path))
|
||||
if (g.launchOptions.isNotEmpty()) json.append(",\"launch\":").append(quote(g.launchOptions))
|
||||
if (g.source != Library.ADDED) json.append(",\"store\":").append(quote(g.source))
|
||||
if (!g.steamProgram) json.append(",\"route\":false")
|
||||
val art = AddedGameArt.resolve(context, g)
|
||||
val pieces = listOf("p" to art.portrait, "header" to art.header, "hero" to art.hero, "logo" to art.logo, "icon" to art.icon)
|
||||
.mapNotNull { (k, f) -> f?.let { file -> artGuestPath(context, file)?.let { k to it } } }
|
||||
|
||||
@@ -13,6 +13,7 @@ object GamesFolderMigration {
|
||||
|
||||
@Synchronized
|
||||
fun run(context: Context) {
|
||||
repathInternalGuest(context)
|
||||
val dirs = SessionPrefs.addedGamesDirs(context)
|
||||
if (dirs.isEmpty()) return
|
||||
val roots = legacyRoots(SessionPrefs.gameFolderBinds(context).map { it.first } + dirs)
|
||||
@@ -58,12 +59,30 @@ object GamesFolderMigration {
|
||||
SessionPrefs.setGamesFoldersMigrated(context)
|
||||
}
|
||||
|
||||
private fun repathInternalGuest(context: Context) {
|
||||
val binds = SessionPrefs.gameFolderBinds(context)
|
||||
if (binds.none { it.second == StoreInstallRoot.INTERNAL_GUEST }) return
|
||||
val hosts = binds.map { it.first }
|
||||
val roots = legacyRoots(hosts).associateBy { it.host.path }
|
||||
val taken = binds.map { it.second }.filter { it != StoreInstallRoot.INTERNAL_GUEST }.toMutableSet()
|
||||
SessionPrefs.setGameFolderBinds(context, binds.map { (host, guest) ->
|
||||
if (guest != StoreInstallRoot.INTERNAL_GUEST) return@map host to guest
|
||||
val base = roots.getValue(host).guest
|
||||
var next = base
|
||||
var n = 2
|
||||
while (next in taken) next = "$base-${n++}"
|
||||
taken.add(next)
|
||||
host to next
|
||||
})
|
||||
}
|
||||
|
||||
internal fun legacyRoots(paths: List<String>): List<AddedGames.Root> {
|
||||
val hosts = paths.distinct().map { File(it) }
|
||||
val names = hosts.groupingBy { it.name.lowercase() }.eachCount()
|
||||
return hosts.map { host ->
|
||||
val name = host.name.ifEmpty { "games" }
|
||||
val guestName = if ((names[name.lowercase()] ?: 0) > 1) name + "-" + "%08x".format(CRC32().apply { update(host.path.toByteArray()) }.value).take(4) else name
|
||||
val clash = (names[name.lowercase()] ?: 0) > 1 || "${AddedGames.GUEST_DIR}/$name" == StoreInstallRoot.INTERNAL_GUEST
|
||||
val guestName = if (clash) name + "-" + "%08x".format(CRC32().apply { update(host.path.toByteArray()) }.value).take(4) else name
|
||||
AddedGames.Root(host, "${AddedGames.GUEST_DIR}/$guestName")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,13 @@ object SocNames {
|
||||
fun name(model: String, platform: String = GpuInfo.systemProperty("ro.board.platform")): String? =
|
||||
MODELS[normalizedModel(model)] ?: PLATFORMS[platform.lowercase()]?.let { "$it family" }
|
||||
|
||||
// Without label's platform-family guess: a rebadged chip such as the Duo's CQ7790S reports a platform it is not.
|
||||
fun plainName(model: String = model(), maker: String = manufacturer()): String =
|
||||
MODELS[normalizedModel(model)]?.let { "$it ($model)" } ?: "$maker $model".trim()
|
||||
|
||||
private fun manufacturer(): String =
|
||||
if (Build.VERSION.SDK_INT >= 31) Build.SOC_MANUFACTURER.takeIf { it != Build.UNKNOWN }.orEmpty() else ""
|
||||
|
||||
fun label(model: String = model(), platform: String = GpuInfo.systemProperty("ro.board.platform")): String {
|
||||
val name = name(model, platform)
|
||||
return when {
|
||||
|
||||
@@ -53,14 +53,14 @@ data class InputProfile(
|
||||
fun elementClickAction(role: InputRole, element: InputSurfaceElement): InputAction = clicks[role]?.get(element.id)
|
||||
?: defaultElementClick(element, elementAction(role, element.id, element.control)) { action(role, it) }
|
||||
|
||||
fun showsMouseButton(role: InputRole, shown: List<InputSurfaceElement>, stock: InputProfile): Boolean = shown.any { element ->
|
||||
fun showsLeftMouseButton(role: InputRole, shown: List<InputSurfaceElement>, stock: InputProfile): Boolean = shown.any { element ->
|
||||
val action = elementAction(role, element.id, element.control).takeIf {
|
||||
elements[role]?.get(element.id) != stock.elements[role]?.get(element.id) || it != stock.elementAction(role, element.id, element.control)
|
||||
}
|
||||
val click = elementClickAction(role, element).takeIf {
|
||||
clicks[role]?.get(element.id) != stock.clicks[role]?.get(element.id) || it != stock.elementClickAction(role, element)
|
||||
}
|
||||
listOfNotNull(action, click).any { it is InputAction.MouseButton && it.validFor(element.control) }
|
||||
listOfNotNull(action, click).any { it is InputAction.MouseButton && it.code == PointerGestures.BTN_LEFT }
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -207,7 +207,8 @@ object BattleNet {
|
||||
val taken = HashSet<File>()
|
||||
fun options(title: Title, folder: File) = listOfNotNull(folder, title.flavor?.let { File(folder, it) }?.takeIf { it.isDirectory })
|
||||
for ((code, game) in games) {
|
||||
val keep = saved[code]?.let(::File)?.takeIf { it in options(game.first, game.second) && it !in taken } ?: continue
|
||||
val want = saved[code]?.let { runCatching { File(it).canonicalFile }.getOrNull() } ?: continue
|
||||
val keep = options(game.first, game.second).firstOrNull { runCatching { it.canonicalFile }.getOrNull() == want }?.takeIf { it !in taken } ?: continue
|
||||
out[code] = keep
|
||||
taken.add(keep)
|
||||
}
|
||||
@@ -244,6 +245,14 @@ object BattleNet {
|
||||
"/" + rootfs.relativize(resolved).joinToString("/")
|
||||
}
|
||||
}.trimEnd('/')
|
||||
if (mapped?.startsWith("/") == true) {
|
||||
val rootfs = LinuxRuntime.rootDir(context)
|
||||
runCatching {
|
||||
val home = rootfs.canonicalFile.toPath()
|
||||
val host = File("$target/$relative").canonicalFile.toPath()
|
||||
if (host.startsWith(home)) File(rootfs, home.relativize(host).toString()) else null
|
||||
}.getOrNull()?.let { return it }
|
||||
}
|
||||
return com.droiddeck.launcher.frontend.AddedGames.hostPath(context, "$target/$relative")
|
||||
}
|
||||
|
||||
|
||||
@@ -436,6 +436,7 @@ object BwrapSpawner {
|
||||
"DDNATV_ROOT" to sandbox,
|
||||
"DDNATV_EXEC" to NativeGuest.execLoader.orEmpty(),
|
||||
"DDNATV_LINK_ROOT" to rootfs.path,
|
||||
"DDNATV_REAL_EXE" to program.path,
|
||||
"DDNATV_BINDS" to plan.binds.joinToString("|") { "${it.host}:${it.guest}" },
|
||||
"DDNATV_HOSTNAME" to SessionPrefs.guestHostname(context),
|
||||
"LD_LIBRARY_PATH" to SANDBOX_LIB_DIRS.map(::host).filter { it.isDirectory }.joinToString(":") { it.path },
|
||||
|
||||
@@ -109,9 +109,15 @@ object DesktopCatalog {
|
||||
FileUtils.readString(marker(context, id))?.trim()?.takeIf { it.isNotEmpty() }
|
||||
|
||||
fun protonSeedNeeded(context: Context): Boolean =
|
||||
installed(context, PROTON_SEED_ID) == null &&
|
||||
if (com.droiddeck.launcher.session.SessionPrefs.ownProtonFirst(context)) ownProtonMissing(context)
|
||||
else installed(context, PROTON_SEED_ID) == null &&
|
||||
!File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/appmanifest_4427310.acf").isFile
|
||||
|
||||
fun ownProtonMissing(context: Context): Boolean {
|
||||
val extras = com.droiddeck.launcher.session.ProtonExtras
|
||||
return extras.installedAll(context, extras.tools.first { it.id == extras.OWN }).isEmpty()
|
||||
}
|
||||
|
||||
const val DESKTOP_ID = "desktop-kde"
|
||||
const val EMULATORS_ID = "emulators"
|
||||
private const val EMULATORS_SCRIPT = "/usr/local/bin/droiddeck-emulators"
|
||||
|
||||
@@ -73,9 +73,10 @@ object NativeGuest {
|
||||
fun libraryPath(root: File): String = LIB_DIRS.joinToString(":") { File(root, it).path }
|
||||
|
||||
/** Environment every native process starts with; a guest `env -i` is re-seeded by the hook. */
|
||||
fun environment(root: File, preload: List<String> = emptyList()): Map<String, String> = linkedMapOf(
|
||||
fun environment(root: File, program: String, preload: List<String> = emptyList()): Map<String, String> = linkedMapOf(
|
||||
"DDNATV_ROOT" to root.path,
|
||||
"DDNATV_EXEC" to execLoader.orEmpty(),
|
||||
"DDNATV_REAL_EXE" to hostProgram(root, program).path,
|
||||
"LD_PRELOAD" to (preload.map { File(root, it.removePrefix("/")).path } + hook(root).path).joinToString(":"),
|
||||
).filterValues { it.isNotEmpty() }
|
||||
|
||||
@@ -85,17 +86,20 @@ object NativeGuest {
|
||||
*/
|
||||
fun command(root: File, program: String, args: List<String>, libraryPath: String = libraryPath(root)): List<String> {
|
||||
val loader = checkNotNull(loader(root)) { "no glibc loader in ${root.path}" }
|
||||
val host = File(root, program.removePrefix("/"))
|
||||
val host = hostProgram(root, program)
|
||||
val launch = listOf(loader.path, "--library-path", libraryPath, "--argv0", host.name, host.path) + args
|
||||
return simulator(root)?.let { it + launch } ?: (execPrefix(loader.path) + launch)
|
||||
}
|
||||
|
||||
private fun hostProgram(root: File, program: String): File = File(root, program.removePrefix("/"))
|
||||
|
||||
/** The environment of the session process: the hook's root, the mounts proot used to make, the preload list. */
|
||||
fun sessionEnvironment(root: File, binds: List<String>, hostname: String? = null): Map<String, String> {
|
||||
fun sessionEnvironment(root: File, binds: List<String>, program: String, hostname: String? = null): Map<String, String> {
|
||||
val preload = preloadList(root)
|
||||
return linkedMapOf(
|
||||
"DDNATV_ROOT" to root.path,
|
||||
"DDNATV_EXEC" to execLoader.orEmpty(),
|
||||
"DDNATV_REAL_EXE" to hostProgram(root, program).path,
|
||||
"DDNATV_HOSTNAME" to hostname.orEmpty(),
|
||||
"DDNATV_BINDS" to binds.joinToString("|") { if (it.contains(':')) it else "$it:$it" },
|
||||
"DDNATV_PRELOAD" to preload.joinToString(":"),
|
||||
@@ -114,7 +118,7 @@ object NativeGuest {
|
||||
.also { builder ->
|
||||
builder.environment().apply {
|
||||
remove("LD_AUDIT")
|
||||
putAll(sessionEnvironment(root, binds, SessionPrefs.guestHostname(context)))
|
||||
putAll(sessionEnvironment(root, binds, guest.first(), SessionPrefs.guestHostname(context)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +282,7 @@ object NativeGuest {
|
||||
builder.directory(File(root, cwd.removePrefix("/")).takeIf { it.isDirectory } ?: root)
|
||||
builder.environment().apply {
|
||||
clear()
|
||||
putAll(environment(root, preload))
|
||||
putAll(environment(root, program, preload))
|
||||
putAll(env)
|
||||
}
|
||||
return builder
|
||||
|
||||
@@ -22,7 +22,7 @@ class RuntimeInstallService : Service() {
|
||||
if (intent?.action == ACTION_PACKAGE) return holdPackage(startId)
|
||||
val removal = intent?.action == ACTION_REMOVE
|
||||
val release = intent?.let(::releaseFrom)
|
||||
startForeground(NOTIFICATION_ID, notification(getString(if (LinuxRuntimeInstaller.isMaintaining()) R.string.desktop_removing else if (removal) R.string.rtinst_removing else R.string.user_apps_starting), -1))
|
||||
val foreground = enterForeground(notification(getString(if (LinuxRuntimeInstaller.isMaintaining()) R.string.desktop_removing else if (removal) R.string.rtinst_removing else R.string.user_apps_starting), -1))
|
||||
if (release == null && !removal) {
|
||||
stopSelf(startId)
|
||||
return START_NOT_STICKY
|
||||
@@ -31,7 +31,7 @@ class RuntimeInstallService : Service() {
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
var shown = ""
|
||||
val progress = LinuxRuntimeInstaller.ProgressListener { stage, percent ->
|
||||
if ("$stage:$percent" != shown) {
|
||||
if (foreground && "$stage:$percent" != shown) {
|
||||
shown = "$stage:$percent"
|
||||
manager?.notify(NOTIFICATION_ID, notification(stage, percent))
|
||||
}
|
||||
@@ -46,7 +46,10 @@ class RuntimeInstallService : Service() {
|
||||
}
|
||||
|
||||
private fun holdPackage(startId: Int): Int {
|
||||
startForeground(NOTIFICATION_ID, notification(packageStage, packagePercent, packageTitle))
|
||||
if (!enterForeground(notification(packageStage, packagePercent, packageTitle))) {
|
||||
stopSelf(startId)
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
Thread({
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
var shown = ""
|
||||
@@ -65,6 +68,15 @@ class RuntimeInstallService : Service() {
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
/** Android 12+ refuses a foreground start while the app is in the background; the work then goes on without the notification. */
|
||||
private fun enterForeground(notification: Notification): Boolean = try {
|
||||
startForeground(NOTIFICATION_ID, notification)
|
||||
true
|
||||
} catch (e: IllegalStateException) {
|
||||
android.util.Log.w("RuntimeInstallService", "running without a foreground service: $e")
|
||||
false
|
||||
}
|
||||
|
||||
private fun notification(stage: String, percent: Int, title: String? = null): Notification {
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
manager?.createNotificationChannel(NotificationChannel(CHANNEL_ID, getString(R.string.setup_runtime),
|
||||
|
||||
@@ -328,7 +328,7 @@ object BottomDesktop {
|
||||
LinuxRuntime.commandWithBinds(context, current.root, binds, guest)
|
||||
}
|
||||
val environment = if (current.nativeUserland) {
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, SessionPrefs.guestHostname(context))
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(current.root, binds, guest.first(), SessionPrefs.guestHostname(context))
|
||||
.map { (k, v) -> "$k=$v" }.toTypedArray()
|
||||
} else current.hostEnvironment
|
||||
val line = command.joinToString(" ") { it.replace("\\", "\\\\").replace(" ", "\\ ") }
|
||||
|
||||
@@ -88,8 +88,8 @@ object ComponentUpdater {
|
||||
logLines(context).mapNotNull { STAMP.find(it)?.groupValues?.get(1) }.maxOrNull() ?: "0"
|
||||
|
||||
private fun lineOf(context: Context, state: JSONObject, p: ComponentsManager.Proton, comp: String): ComponentUpdates.Line? {
|
||||
if (!ComponentUpdates.follows(p) || !ComponentsManager.supports(p, comp)) return null
|
||||
if (comp == "fex") return ComponentUpdates.line("fex", false)
|
||||
if (!ComponentUpdates.autoFollows(p, comp) || !ComponentsManager.supports(p, comp)) return null
|
||||
if (comp == "fex") return ComponentUpdates.fexLine(p)
|
||||
val key = "${p.id}|${p.version}"
|
||||
val flavors = state.obj("flavors").obj(key)
|
||||
val arm64ec = if (flavors.has(comp)) flavors.optBoolean(comp) else ComponentsManager.arm64ec(context, p, comp)?.also { flavors.put(comp, it) }
|
||||
|
||||
@@ -13,7 +13,7 @@ object ComponentUpdates {
|
||||
const val BOOTED_SECONDS = 60L
|
||||
const val FAILED_BOOTS_BEFORE_ROLLBACK = 2
|
||||
|
||||
data class Line(val key: String, val comp: String, val prefix: String)
|
||||
data class Line(val key: String, val comp: String, val prefix: String, val release: String = ComponentsManager.DD_NIGHTLY)
|
||||
|
||||
val LINES = listOf(
|
||||
Line("dxvk", "dxvk", "DD-dxvk-"),
|
||||
@@ -21,12 +21,19 @@ object ComponentUpdates {
|
||||
Line("vkd3d", "vkd3d", "DD-vkd3d-proton-"),
|
||||
Line("vkd3d-arm64ec", "vkd3d", "DD-vkd3d-proton-arm64ec-"),
|
||||
Line("fex", "fex", "DD-FEXCore-"),
|
||||
Line("fex-bionic", "fex", "FEXCore-", ComponentsManager.DD_BIONIC),
|
||||
)
|
||||
|
||||
private val OWN_PREFIX = ProtonExtras.tools.first { it.id == ProtonExtras.OWN }.prefix
|
||||
|
||||
fun follows(p: ComponentsManager.Proton): Boolean = !p.valve && p.dir.name.startsWith(OWN_PREFIX)
|
||||
|
||||
fun autoFollows(p: ComponentsManager.Proton, comp: String): Boolean =
|
||||
follows(p) || (comp == "fex" && !p.valve && ComponentsManager.bionicTool(p.dir.name))
|
||||
|
||||
fun fexLine(p: ComponentsManager.Proton): Line =
|
||||
if (ComponentsManager.bionicTool(p.dir.name)) LINES.first { it.release == ComponentsManager.DD_BIONIC } else line("fex", false)
|
||||
|
||||
fun ownId(protonId: String): Boolean = protonId.startsWith(ComponentsManager.safeName(OWN_PREFIX))
|
||||
|
||||
fun strays(
|
||||
@@ -34,8 +41,8 @@ object ComponentUpdates {
|
||||
choices: Map<String, Map<String, ComponentsManager.Choice>>,
|
||||
placed: Set<String>,
|
||||
): List<Pair<ComponentsManager.Proton, String>> =
|
||||
protons.filterNot(::follows).flatMap { p ->
|
||||
choices[p.id].orEmpty().filter { (_, c) -> !c.auto && c.protonVersion == p.version && c.file in placed }.keys.map { p to it }
|
||||
protons.flatMap { p ->
|
||||
choices[p.id].orEmpty().filter { (comp, c) -> !autoFollows(p, comp) && !c.auto && c.protonVersion == p.version && c.file in placed }.keys.map { p to it }
|
||||
}
|
||||
|
||||
fun unseen(
|
||||
@@ -53,13 +60,14 @@ object ComponentUpdates {
|
||||
|
||||
fun pick(items: List<ComponentsManager.CatalogItem>, line: Line, bad: Set<String>): ComponentsManager.CatalogItem? {
|
||||
val newestBad = bad.filter { belongs(it, line) }.maxWithOrNull { a, b -> ProtonExtras.compareVersions(a, b) }
|
||||
return items.filter { it.release == ComponentsManager.DD_NIGHTLY && it.comp == line.comp && belongs(it.file, line) }
|
||||
return items.filter { it.release == line.release && it.comp == line.comp && belongs(it.file, line) }
|
||||
.filter { newestBad == null || ProtonExtras.compareVersions(it.file, newestBad) > 0 }
|
||||
.maxWithOrNull { a, b -> ProtonExtras.compareVersions(a.file, b.file) }
|
||||
}
|
||||
|
||||
fun belongs(file: String, line: Line): Boolean =
|
||||
file.startsWith(line.prefix) && file.removePrefix(line.prefix).firstOrNull()?.isDigit() == true
|
||||
file.startsWith(line.prefix) && file.removePrefix(line.prefix).firstOrNull()?.isDigit() == true &&
|
||||
(line.comp != "fex" || ComponentsManager.bionicFex(file) == (line.release == ComponentsManager.DD_BIONIC))
|
||||
|
||||
fun arm64ec(pe: ByteArray): Boolean? = runCatching {
|
||||
val b = ByteBuffer.wrap(pe).order(ByteOrder.LITTLE_ENDIAN)
|
||||
@@ -161,7 +169,7 @@ object ComponentUpdates {
|
||||
fun stale(line: Line?, owned: Set<String>, stored: List<String>, keep: Set<String>, current: String, bad: Set<String> = emptySet()): List<String> {
|
||||
val ranked = line?.takeIf { belongs(current, it) }
|
||||
fun newer(file: String) = ranked != null && belongs(file, ranked) && ProtonExtras.compareVersions(file, current) > 0
|
||||
return (owned + stored.filter { ranked != null && belongs(it, ranked) })
|
||||
return (owned + stored.filter { ranked != null && ranked.release == ComponentsManager.DD_NIGHTLY && belongs(it, ranked) })
|
||||
.filter { it !in keep && ((it in bad && it in owned) || !newer(it)) }.distinct()
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ object ComponentsManager {
|
||||
private const val NIGHTLIES = "The412Banner/Nightlies"
|
||||
private const val DD_COMPONENTS = "Droid-Deck/DroidDeck-Components"
|
||||
internal const val DD_NIGHTLY = "linux-nightly"
|
||||
internal const val DD_BIONIC = "bionic-stable"
|
||||
private val RELEASES = linkedMapOf(
|
||||
"FexCore-Linux" to "fex",
|
||||
"Dxvk-Linux" to "dxvk",
|
||||
@@ -37,9 +38,9 @@ object ComponentsManager {
|
||||
"Vkd3d-proton-Linux" to "vkd3d",
|
||||
)
|
||||
private val NIGHTLY_PREFIXES = linkedMapOf("DD-dxvk-" to "dxvk", "DD-vkd3d-proton-" to "vkd3d", "DD-FEXCore-" to "fex")
|
||||
private val SOURCES = RELEASES.keys.map { NIGHTLIES to it } + (DD_COMPONENTS to DD_NIGHTLY)
|
||||
private val SOURCES = RELEASES.keys.map { NIGHTLIES to it } + (DD_COMPONENTS to DD_NIGHTLY) + (DD_COMPONENTS to DD_BIONIC)
|
||||
private val DOWNLOAD_REPOS = listOf(NIGHTLIES, DD_COMPONENTS)
|
||||
private val TYPES = mapOf("FEXCore-Linux" to "fex", "DXVK-Linux" to "dxvk", "VKD3D-Linux" to "vkd3d")
|
||||
private val TYPES = mapOf("FEXCore-Linux" to "fex", "FEXCore-Bionic" to "fex", "DXVK-Linux" to "dxvk", "VKD3D-Linux" to "vkd3d")
|
||||
private val TYPE_OF = mapOf("fex" to "FEXCore-Linux", "dxvk" to "DXVK-Linux", "vkd3d" to "VKD3D-Linux")
|
||||
val COMPONENTS = listOf("fex", "dxvk", "vkd3d")
|
||||
val LABEL = mapOf("fex" to "FEX", "dxvk" to "DXVK", "vkd3d" to "VKD3D-Proton")
|
||||
@@ -201,8 +202,34 @@ object ComponentsManager {
|
||||
COMPONENTS.mapNotNull { comp -> profile.optString(comp).takeIf(String::isNotEmpty)?.let { comp to it } }.toMap()
|
||||
}
|
||||
|
||||
fun setGameComponent(context: Context, scope: String, comp: String, file: String?) =
|
||||
fun setGameComponent(context: Context, scope: String, comp: String, file: String?) {
|
||||
setGameComponent(context, scope, comp, file) { runtimeManaged(context, it) }
|
||||
if (comp == "fex" && file != null) fetchFexTwin(context, safeName(file))
|
||||
}
|
||||
|
||||
// Twin downloads in flight: one worker per name, so two profile changes cannot share one partial download.
|
||||
private val twinDownloads = HashSet<String>()
|
||||
|
||||
private fun fetchFexTwin(context: Context, file: String) {
|
||||
val twin = fexTwin(file) ?: return
|
||||
if (protons(context).all { fexFits(it.dir.name, file) }) return
|
||||
synchronized(lock) { if (isStored(context, twin) || !twinDownloads.add(twin)) return }
|
||||
val app = context.applicationContext
|
||||
Thread({
|
||||
try {
|
||||
runCatching {
|
||||
val item = catalogItem(app, twin, if (bionicFex(twin)) DD_BIONIC else "FexCore-Linux")
|
||||
if (item == null) Log.i(TAG, "$twin is not listed")
|
||||
else {
|
||||
download(app, item) {}
|
||||
republish(app)
|
||||
}
|
||||
}.onFailure { Log.w(TAG, "download $twin", it) }
|
||||
} finally {
|
||||
synchronized(lock) { twinDownloads.remove(twin) }
|
||||
}
|
||||
}, "fex-twin").start()
|
||||
}
|
||||
|
||||
internal fun setGameComponent(context: Context, scope: String, comp: String, file: String?, managed: (String) -> Boolean) = synchronized(lock) {
|
||||
require(scope.matches(Regex("[1-9][0-9]{0,9}")) && scope.toLong() <= 4294967295L)
|
||||
@@ -413,7 +440,7 @@ object ComponentsManager {
|
||||
}
|
||||
}
|
||||
require(File(staged, "files").isDirectory) { "${wcp.name} has no files/" }
|
||||
if (comp == "fex") FEX_FILES.filter { it.endsWith(".so") && !File(staged, it).isFile }.forEach { File(dir, it).delete() }
|
||||
if (comp == "fex" && !bionicTool(dir.name)) FEX_FILES.filter { it.endsWith(".so") && !File(staged, it).isFile }.forEach { File(dir, it).delete() }
|
||||
COMP_DIR[comp]?.let { compDir ->
|
||||
for (arch in PE_ARCHES) {
|
||||
val target = File(dir, "$compDir/$arch")
|
||||
@@ -603,7 +630,9 @@ object ComponentsManager {
|
||||
File(base, "files").walkTopDown().filter { it.isFile }.map { it.relativeTo(base).invariantSeparatorsPath }
|
||||
.filter { owned(comp, it) }.associateWith { File(base, it) }
|
||||
}
|
||||
for (rel in managed(comp) - files.keys) {
|
||||
// A bionic tool never loses a FEX file: its launch.sh would put the whole bundled FEX back.
|
||||
val removed = if (comp == "fex" && bionicTool(p.dir.name)) emptySet() else managed(comp) - files.keys
|
||||
for (rel in removed) {
|
||||
lines.append(scope).append('\t').append(p.dir.name).append('\t').append(p.version).append('\t').append(comp)
|
||||
.append('\t').append(rel).append("\t-\t-\n")
|
||||
}
|
||||
@@ -620,7 +649,8 @@ object ComponentsManager {
|
||||
val version = safeName(file.removePrefix("original "))
|
||||
"original-${p.id}-$version-$comp" to File(originalsDir(context), "${p.id}/$version/$comp.wcp")
|
||||
} else {
|
||||
safeName(file.removeSuffix(".wcp")) to File(packagesDir(context), file)
|
||||
val fit = (if (comp == "fex") launchFex(p.dir.name, file) { File(packagesDir(context), it).isFile } else file) ?: return null
|
||||
safeName(fit.removeSuffix(".wcp")) to File(packagesDir(context), fit)
|
||||
}.takeIf { it.second.isFile }
|
||||
}
|
||||
|
||||
@@ -651,12 +681,14 @@ object ComponentsManager {
|
||||
for (scope in profiles.keys()) {
|
||||
val profile = profiles.optJSONObject(scope) ?: continue
|
||||
for (comp in COMPONENTS) {
|
||||
val file = profile.optString(comp)
|
||||
if (file.isEmpty()) continue
|
||||
val wcp = File(packagesDir(context), file)
|
||||
if (!wcp.isFile) continue
|
||||
val key = safeName(file.removeSuffix(".wcp"))
|
||||
for (p in all) append(scope, p, comp, key, wcp)
|
||||
val chosen = profile.optString(comp)
|
||||
if (chosen.isEmpty()) continue
|
||||
for (p in all) {
|
||||
val file = (if (comp == "fex") launchFex(p.dir.name, chosen) { File(packagesDir(context), it).isFile } else chosen) ?: continue
|
||||
val wcp = File(packagesDir(context), file)
|
||||
if (!wcp.isFile) continue
|
||||
append(scope, p, comp, safeName(file.removeSuffix(".wcp")), wcp)
|
||||
}
|
||||
}
|
||||
}
|
||||
return PreparedLaunchState(lines.toString(), keep)
|
||||
@@ -677,6 +709,7 @@ object ComponentsManager {
|
||||
val wcp = File(packagesDir(context), safeName(file))
|
||||
val info = packageInfo(context, wcp)
|
||||
requireSelectable(context, info.comp)
|
||||
requireFits(p, info)
|
||||
val state = loadState(context)
|
||||
if (inUse(context, p)) {
|
||||
state.sub("queued").sub(p.id).put(info.comp, JSONObject().put("kind", "package").put("file", wcp.name).put("label", info.version)
|
||||
@@ -690,7 +723,11 @@ object ComponentsManager {
|
||||
context.getString(R.string.cmgr_swap_done, LABEL[info.comp], info.version, p.name)
|
||||
}
|
||||
|
||||
private fun requireFits(p: Proton, info: Package) =
|
||||
check(info.comp != "fex" || fexFits(p.dir.name, info.file)) { "${info.file} is not a FEX build for ${p.name}" }
|
||||
|
||||
private fun applyPackage(context: Context, p: Proton, info: Package, wcp: File, state: JSONObject, auto: Boolean = false) {
|
||||
requireFits(p, info)
|
||||
ensureOriginal(context, p, info.comp, state)
|
||||
val hashes = installFiles(context, p.dir, info.comp, wcp)
|
||||
state.sub("active").sub(p.id).put(info.comp, JSONObject()
|
||||
@@ -803,6 +840,18 @@ object ComponentsManager {
|
||||
internal fun liveOnAny(key: String, entry: JSONObject, installs: List<Proton>?): Boolean =
|
||||
installs?.any { liveSelection(key, entry, it) } == true
|
||||
|
||||
// An installed tool that launches with `name` as the stored twin of a game's FEX choice (a Linux choice on
|
||||
// DroidDeck-Bionic, a -bionic one on another Proton): deleting the twin would drop that choice for that tool.
|
||||
internal fun twinUser(state: JSONObject, installed: List<Proton>, name: String): Proton? {
|
||||
val profiles = state.optJSONObject("profiles") ?: return null
|
||||
for (scope in profiles.keys()) {
|
||||
val chosen = profiles.optJSONObject(scope)?.optString("fex")?.takeIf { it.isNotEmpty() } ?: continue
|
||||
if (fexTwin(chosen) != name) continue
|
||||
installed.firstOrNull { !fexFits(it.dir.name, chosen) }?.let { return it }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
internal fun packagesInUse(state: JSONObject, installed: List<Proton>): Set<String> {
|
||||
val byId = installed.groupBy { it.id }
|
||||
val names = HashSet<String>()
|
||||
@@ -819,7 +868,11 @@ object ComponentsManager {
|
||||
val profiles = state.optJSONObject("profiles")
|
||||
for (scope in profiles?.keys() ?: emptyList<String>().iterator()) {
|
||||
val profile = profiles?.optJSONObject(scope) ?: continue
|
||||
COMPONENTS.forEach { comp -> profile.optString(comp).takeIf { it.isNotEmpty() }?.let(names::add) }
|
||||
COMPONENTS.forEach { comp ->
|
||||
val file = profile.optString(comp).takeIf { it.isNotEmpty() } ?: return@forEach
|
||||
names.add(file)
|
||||
if (comp == "fex" && installed.any { !fexFits(it.dir.name, file) }) fexTwin(file)?.let(names::add)
|
||||
}
|
||||
}
|
||||
return names
|
||||
}
|
||||
@@ -890,6 +943,7 @@ object ComponentsManager {
|
||||
val queued = state.sub("queued").sub(target.id)
|
||||
var changed = false
|
||||
wanted.forEach { (comp, entry) ->
|
||||
if (comp == "fex" && !fexFits(target.dir.name, entry.optString("file"))) return@forEach
|
||||
if (active?.has(comp) != true && !queued.has(comp)) {
|
||||
queued.put(comp, entry)
|
||||
changed = true
|
||||
@@ -970,6 +1024,8 @@ object ComponentsManager {
|
||||
fun deletePackage(context: Context, file: String): String = synchronized(lock) {
|
||||
val name = safeName(file)
|
||||
val state = loadState(context)
|
||||
val twinTool = twinUser(state, protons(context), name)
|
||||
check(twinTool == null) { context.getString(R.string.cmgr_package_in_use, name, twinTool?.name ?: "") }
|
||||
val installed = protons(context).groupBy { it.id }
|
||||
var changed = false
|
||||
for (key in listOf("queued", "active")) {
|
||||
@@ -1066,8 +1122,11 @@ object ComponentsManager {
|
||||
return Catalog(items, o.optLong("fetchedAt"))
|
||||
}
|
||||
|
||||
internal fun assetComp(release: String, name: String): String? =
|
||||
RELEASES[release] ?: if (release == DD_NIGHTLY) NIGHTLY_PREFIXES.entries.firstOrNull { name.startsWith(it.key) }?.value else null
|
||||
internal fun assetComp(release: String, name: String): String? = RELEASES[release] ?: when (release) {
|
||||
DD_NIGHTLY -> NIGHTLY_PREFIXES.entries.firstOrNull { name.startsWith(it.key) }?.value
|
||||
DD_BIONIC -> "fex"
|
||||
else -> null
|
||||
}
|
||||
|
||||
internal val CATALOG_ORDER: Comparator<CatalogItem> =
|
||||
compareBy<CatalogItem> { it.comp }.thenBy { it.release == DD_NIGHTLY }.then(newestFirst { it.file })
|
||||
@@ -1155,6 +1214,25 @@ object ComponentsManager {
|
||||
return runCatching { readWcpEntry(original, rel) }.getOrNull()
|
||||
}
|
||||
|
||||
// DroidDeck-Bionic loads only Android builds of FEX's unix libraries; other Protons only glibc builds.
|
||||
internal fun bionicTool(dirName: String?): Boolean = dirName?.startsWith("DroidDeck-Bionic") == true
|
||||
|
||||
internal fun bionicFex(file: String): Boolean = file.endsWith("-bionic.wcp", ignoreCase = true)
|
||||
|
||||
internal fun fexFits(toolDir: String?, file: String): Boolean = bionicTool(toolDir) == bionicFex(file)
|
||||
|
||||
internal fun fexTwin(file: String): String? = when {
|
||||
file.endsWith("-linux.wcp", ignoreCase = true) -> file.dropLast("-linux.wcp".length) + "-bionic.wcp"
|
||||
file.endsWith("-bionic.wcp", ignoreCase = true) -> file.dropLast("-bionic.wcp".length) + "-linux.wcp"
|
||||
else -> null
|
||||
}
|
||||
|
||||
internal fun launchFex(toolDir: String, file: String, stored: (String) -> Boolean): String? =
|
||||
if (fexFits(toolDir, file)) file else fexTwin(file)?.takeIf(stored)
|
||||
|
||||
internal fun <T> forTool(comp: String, toolDir: String?, items: List<T>, selected: String? = null, file: (T) -> String): List<T> =
|
||||
if (comp != "fex") items else items.filter { file(it) == selected || fexFits(toolDir, file(it)) }
|
||||
|
||||
fun supports(p: Proton, comp: String): Boolean =
|
||||
if (comp == "fex") File(p.dir, FEX_FILES.first()).isFile else File(p.dir, "${COMP_DIR.getValue(comp)}/aarch64-windows").isDirectory
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.stores.StoreInstalls
|
||||
import java.io.File
|
||||
|
||||
object CpuCacheSysfs {
|
||||
private const val TAG = "SessionService"
|
||||
private val FEX_CPUID_SIZE_KB = mapOf(1 to 32, 2 to 512, 3 to 8192)
|
||||
|
||||
private val PROCESS = java.util.UUID.randomUUID().toString()
|
||||
private val STARTS = java.util.concurrent.atomic.AtomicInteger()
|
||||
|
||||
fun binds(root: File, start: Int = STARTS.incrementAndGet(), host: File = File("/sys/devices/system/cpu"), process: String = PROCESS): List<String> = try {
|
||||
root.listFiles()?.forEach { old -> if (old.name != process) StoreInstalls.deleteTree(old) }
|
||||
val dir = File(root, "$process/$start")
|
||||
StoreInstalls.deleteTree(dir)
|
||||
val cpus = host.list { _, name -> name.matches(Regex("cpu\\d+")) }?.sorted().orEmpty()
|
||||
val binds = cpus.mapNotNull { cpu ->
|
||||
val staged = try {
|
||||
stage(File(host, "$cpu/cache"), File(dir, cpu))
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "cpu cache: could not stage $cpu: $e")
|
||||
false
|
||||
}
|
||||
if (staged) File(dir, cpu).path + ":" + File(host, "$cpu/cache").path else null
|
||||
}
|
||||
Log.i(TAG, "cpu cache: ${binds.size} of ${cpus.size} cores report the sizes the x86 CPUID reports")
|
||||
binds
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "cpu cache: could not stage the core caches: $e")
|
||||
emptyList()
|
||||
}
|
||||
|
||||
private fun stage(cache: File, out: File): Boolean {
|
||||
val indexes = cache.listFiles { f -> f.isDirectory && f.name.matches(Regex("index\\d+")) } ?: return false
|
||||
var staged = false
|
||||
for (index in indexes) {
|
||||
val target = File(out, index.name).apply { mkdirs() }
|
||||
val kb = runCatching { File(index, "level").readText().trim().toInt() }.getOrNull()?.let { FEX_CPUID_SIZE_KB[it] }
|
||||
val files = index.listFiles { f -> f.isFile } ?: throw java.io.IOException("cannot list $index")
|
||||
for (f in files) {
|
||||
if (kb != null && f.name == "size") continue
|
||||
File(target, f.name).writeText(f.readText())
|
||||
}
|
||||
if (kb == null) continue
|
||||
File(target, "size").writeText("${kb}K\n")
|
||||
staged = true
|
||||
}
|
||||
return staged
|
||||
}
|
||||
}
|
||||
@@ -937,7 +937,7 @@ internal object EnhancedSessionLogShare {
|
||||
val value = entry.lowercase(Locale.US)
|
||||
if (value.startsWith("battlenet/") || value.startsWith("stores/") || value.startsWith("tools/") || value.startsWith("rpcs3/") ||
|
||||
value.contains("droiddeck-esync/") || GAME_LOG.matches(value.substringAfterLast('/')) ||
|
||||
listOf("proton", "wine", "dxvk", "vkd3d", "battle.net", "game-debug").any(value::contains)) return Category.GAMES
|
||||
listOf("proton", "wine", "dxvk", "vkd3d", "battle.net", "game-debug", "bionic").any(value::contains)) return Category.GAMES
|
||||
if (listOf("wayland", "gamescope", "xwayland", "vulkan", "gpu", "mesa", "egl", "glx", "drm", "compositor", "frame-trace").any(value::contains)) return Category.GRAPHICS
|
||||
return Category.SESSION
|
||||
}
|
||||
@@ -948,7 +948,7 @@ internal object EnhancedSessionLogShare {
|
||||
"droiddeck", "droiddeck-esync", "session.log", "app.log", "wayland.log", "audio.log",
|
||||
"device.txt", "network.txt", "events.jsonl", "memory.csv", "capture.json", "crash.log",
|
||||
"frame-trace.log", "process-trace.log", "game-lifecycle.log", "launches.log", "tools.tsv", "wanted.tsv", "prefixes.json",
|
||||
"battlenet.log", "spawned.log", "flatpak-install.log", "cef_log.txt", "cef_log.previous.txt",
|
||||
"battlenet.log", "spawned.log", "flatpak-install.log", "cef_log.txt", "cef_log.previous.txt", "droiddeck-bionic.log",
|
||||
"console_log.txt", "webhelper_js.txt", "controller_support.txt", "systemperfmanager.txt",
|
||||
"rpcs3", "RPCS3.log",
|
||||
)
|
||||
|
||||
@@ -74,10 +74,16 @@ object ExperimentalProtons {
|
||||
return PREFIX + base + (tag?.let { "-$it" } ?: "")
|
||||
}
|
||||
|
||||
/** DroidDeck-Bionic test builds are prereleases of the same repository and have their own row in the Proton list. */
|
||||
internal fun listed(assets: List<ProtonExtras.Asset>): List<ProtonExtras.Asset> {
|
||||
val bionic = ProtonExtras.tools.first { it.id == ProtonExtras.BIONIC }
|
||||
return assets.filterNot { bionic.assetPattern.containsMatchIn(it.name) }
|
||||
}
|
||||
|
||||
fun refresh(context: Context): List<Release>? {
|
||||
val tool = ProtonExtras.tools.first { it.id == ProtonExtras.OWN }
|
||||
val fetched = ProtonExtras.releasesForRemoval(tool) ?: return null
|
||||
val assets = ProtonExtras.assets(tool, fetched.releases, prerelease = true)
|
||||
val assets = listed(ProtonExtras.assets(tool, fetched.releases, prerelease = true))
|
||||
val rows = assets.map { Release(it.tag, it.name, it.url, it.sha512, it.size, it.releaseName) }.distinctBy { it.tag }
|
||||
if (!SessionState.running) {
|
||||
reconcile(context, fetched)
|
||||
|
||||
@@ -14,7 +14,8 @@ object ProtonDefault {
|
||||
|
||||
data class Tool(val name: String, val display: String, val dir: String, val valve: Boolean)
|
||||
data class Request(val seq: Long, val valve: Boolean, val dir: String)
|
||||
data class State(val default: String?, val applied: Long, val live: Boolean, val pending: String?, val tools: List<Tool>)
|
||||
data class State(val default: String?, val applied: Long, val live: Boolean, val pending: String?, val tools: List<Tool>,
|
||||
val source: String? = null)
|
||||
data class GameChoice(val valve: Boolean, val dir: String)
|
||||
|
||||
enum class Outcome { LIVE, NEXT_START, NOT_RUNNABLE }
|
||||
@@ -34,6 +35,7 @@ object ProtonDefault {
|
||||
Tool(t.optString("name"), t.optString("display"), t.optString("dir"), t.optBoolean("valve"))
|
||||
}?.takeIf { it.name.isNotEmpty() }
|
||||
},
|
||||
source = o.optString("source").ifEmpty { null },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -99,7 +101,13 @@ object ProtonDefault {
|
||||
if (!runnable(state, proton)) return Outcome.NOT_RUNNABLE
|
||||
val d = dir(context)
|
||||
val seq = nextSeq(System.currentTimeMillis(), state, parseRequest(read(File(d, "request.json"))))
|
||||
val body = JSONObject().put("seq", seq).put("valve", proton.valve).put("dir", proton.dir.name).toString(1) + "\n"
|
||||
writeRequest(d, Request(seq, proton.valve, proton.dir.name))
|
||||
val tool = state.tools.firstOrNull { it.valve == proton.valve && it.dir == proton.dir.name }
|
||||
return if (SessionState.running && state.live && (tool == null || state.pending != tool.name)) Outcome.LIVE else Outcome.NEXT_START
|
||||
}
|
||||
|
||||
private fun writeRequest(d: File, request: Request) {
|
||||
val body = JSONObject().put("seq", request.seq).put("valve", request.valve).put("dir", request.dir).toString(1) + "\n"
|
||||
val staged = File(d, "request.json.staged")
|
||||
try {
|
||||
d.mkdirs()
|
||||
@@ -110,8 +118,45 @@ object ProtonDefault {
|
||||
Log.w(TAG, "could not write the Proton request", e)
|
||||
throw e
|
||||
}
|
||||
val tool = state.tools.firstOrNull { it.valve == proton.valve && it.dir == proton.dir.name }
|
||||
return if (SessionState.running && state.live && (tool == null || state.pending != tool.name)) Outcome.LIVE else Outcome.NEXT_START
|
||||
}
|
||||
|
||||
// The default that names a tool an update replaces moves to the new one, as the per-game picks do: otherwise the guest
|
||||
// no longer finds it and falls back to DroidDeck-Proton.
|
||||
internal fun movedDefault(state: State, request: Request?, from: Set<String>, to: String, now: Long): Request? {
|
||||
val (valve, dir) = chosen(state, request) ?: return null
|
||||
if (valve || dir !in from) return null
|
||||
return Request(nextSeq(now, state, request), false, to)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun moveDefault(context: Context, from: Set<String>, to: String) {
|
||||
val d = dir(context)
|
||||
val moved = movedDefault(state(context), parseRequest(read(File(d, "request.json"))), from, to, System.currentTimeMillis()) ?: return
|
||||
writeRequest(d, moved)
|
||||
}
|
||||
|
||||
// DroidDeck-Bionic keeps one build. A default naming another one moves to the installed build: an app from before
|
||||
// updates carried the default over left it, or the guest fell back to its own tool when that build was gone (the
|
||||
// request the app last wrote still names it).
|
||||
internal fun bionicDefault(state: State, request: Request?, prefix: String, newest: String, now: Long): Request? {
|
||||
val current = chosen(state, request)
|
||||
val stale = when {
|
||||
current != null && !current.first && current.second.startsWith(prefix) -> current.second
|
||||
state.source == "fallback" && request != null && !request.valve && request.dir.startsWith(prefix) -> request.dir
|
||||
else -> return null
|
||||
}
|
||||
return if (stale == newest) null else Request(nextSeq(now, state, request), false, newest)
|
||||
}
|
||||
|
||||
/** The default and the per-game picks that name a DroidDeck-Bionic build other than [newest] move to it. */
|
||||
@Synchronized
|
||||
fun keepBionicCurrent(context: Context, prefix: String, newest: String) {
|
||||
val d = dir(context)
|
||||
bionicDefault(state(context), parseRequest(read(File(d, "request.json"))), prefix, newest, System.currentTimeMillis())
|
||||
?.let { writeRequest(d, it) }
|
||||
val games = parseGames(read(File(d, GAMES)))
|
||||
val stale = games.values.filterNotNull().filter { !it.valve && it.dir.startsWith(prefix) && it.dir != newest }.map { it.dir }.toSet()
|
||||
if (stale.isNotEmpty()) movedGames(games, stale, newest)?.let { writeGames(d, it) }
|
||||
}
|
||||
|
||||
internal fun movedGames(choices: Map<String, GameChoice?>, from: Set<String>, to: String): Map<String, GameChoice?>? {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.util.Log
|
||||
import com.droiddeck.launcher.core.Downloader
|
||||
import com.droiddeck.launcher.core.FileUtils
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.runtime.NativeGuest
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
import org.json.JSONArray
|
||||
@@ -32,20 +33,27 @@ object ProtonExtras {
|
||||
@Volatile
|
||||
private var replacing = false
|
||||
|
||||
class Tool(val id: String, val name: String, val prefix: String, val repo: String, val assetPattern: Regex)
|
||||
class Tool(val id: String, val name: String, val prefix: String, val repo: String, val assetPattern: Regex,
|
||||
val prereleases: Boolean = false)
|
||||
|
||||
internal data class Asset(val tag: String, val name: String, val url: String, val sha512: String?, val size: Long,
|
||||
val sha256: String? = null, val releaseName: String = tag)
|
||||
internal data class ReleaseFetch(val releases: JSONArray, val complete: Boolean)
|
||||
|
||||
const val OWN = "droiddeck"
|
||||
const val BIONIC = "bionic"
|
||||
|
||||
val tools = listOf(
|
||||
Tool("ge", "GE-Proton", "GE-Proton", "GloriousEggroll/proton-ge-custom", Regex("aarch64\\.tar\\.(gz|xz)$")),
|
||||
Tool("cachyos", "proton-cachyos", "proton-cachyos", "CachyOS/proton-cachyos", Regex("arm64\\.tar\\.(gz|xz)$")),
|
||||
Tool("droiddeck", "DroidDeck-Proton", "DroidDeck-Proton", "Droid-Deck/DroidDeck-Proton", Regex("aarch64\\.tar\\.(gz|xz)$")),
|
||||
Tool("droiddeck", "DroidDeck-Proton", "DroidDeck-Proton", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Proton-.*aarch64\\.tar\\.(gz|xz)$")),
|
||||
// Bionic (Android libc) Proton started outside the Linux userland; test builds are prereleases. No-proot only.
|
||||
Tool(BIONIC, "DroidDeck-Bionic", "DroidDeck-Bionic", "Droid-Deck/DroidDeck-Proton", Regex("^DroidDeck-Bionic-.*aarch64\\.tar\\.(gz|xz)$"), prereleases = true),
|
||||
)
|
||||
|
||||
/** The sources offered on this device: DroidDeck-Bionic only with Run without proot on. */
|
||||
fun offered(context: Context): List<Tool> = tools.filter { it.id != BIONIC || NativeGuest.enabled(context) }
|
||||
|
||||
private fun home(context: Context) = File(LinuxRuntime.rootDir(context), "root")
|
||||
private fun requests(context: Context) = File(home(context), ".dd-proton-extra")
|
||||
private fun toolsDir(context: Context) = File(home(context), ".local/share/Steam/compatibilitytools.d")
|
||||
@@ -120,10 +128,11 @@ object ProtonExtras {
|
||||
private var lastAttempt = 0L
|
||||
|
||||
fun checkLatest(context: Context, force: Boolean = false, now: Long = System.currentTimeMillis()): Boolean {
|
||||
keepBionicCurrent(context)
|
||||
synchronized(checkLock) {
|
||||
val file = latestFile(context)
|
||||
val cache = readJson(file)
|
||||
val due = tools.filter { tool ->
|
||||
val due = offered(context).filter { tool ->
|
||||
val at = cache.optJSONObject(tool.id)?.optLong("at", 0L) ?: 0L
|
||||
force || (now - at) !in 0 until CHECK_EVERY_MS
|
||||
}
|
||||
@@ -173,15 +182,32 @@ object ProtonExtras {
|
||||
|
||||
fun remove(context: Context, tool: Tool, dir: String? = null) {
|
||||
val name = if (dir != null) dir.takeIf { it in installedAll(context, tool) } ?: return else installed(context, tool) ?: return
|
||||
if (File(toolsDir(context), name).deleteRecursively()) ComponentsManager.forgetProton(context, name)
|
||||
if (deleteTool(context, name)) ComponentsManager.forgetProton(context, name)
|
||||
}
|
||||
|
||||
// A tool folder can hold links that point out of it (a prefix template's dosdevices/z: -> /), and
|
||||
// File.deleteRecursively() follows links into directories: remove each link itself, never what it points to.
|
||||
private fun deleteTool(context: Context, name: String): Boolean {
|
||||
val dir = File(toolsDir(context), name)
|
||||
FileUtils.delete(dir)
|
||||
return !dir.exists() && !java.nio.file.Files.isSymbolicLink(dir.toPath())
|
||||
}
|
||||
|
||||
fun removeOlder(context: Context, tool: Tool) {
|
||||
installedAll(context, tool).dropLast(1).forEach {
|
||||
if (File(toolsDir(context), it).deleteRecursively()) ComponentsManager.forgetProton(context, it)
|
||||
if (deleteTool(context, it)) ComponentsManager.forgetProton(context, it)
|
||||
}
|
||||
}
|
||||
|
||||
// DroidDeck-Bionic: the default and the game picks name the installed build, also when they were left on one an
|
||||
// older app deleted without moving them.
|
||||
private fun keepBionicCurrent(context: Context) {
|
||||
if (SessionState.running) return
|
||||
val tool = tools.firstOrNull { it.id == BIONIC } ?: return
|
||||
val newest = installedAll(context, tool).lastOrNull() ?: return
|
||||
runCatching { ProtonDefault.keepBionicCurrent(context, tool.prefix, newest) }.onFailure { Log.w(TAG, "bionic default and picks", it) }
|
||||
}
|
||||
|
||||
private fun replaceOlder(context: Context, tool: Tool) {
|
||||
val all = installedAll(context, tool)
|
||||
val newest = all.lastOrNull() ?: return
|
||||
@@ -194,7 +220,9 @@ object ProtonExtras {
|
||||
if (runCatching { ComponentsManager.carryOver(context, old, newest) }.onFailure { Log.w(TAG, "components of $old", it) }.isFailure) continue
|
||||
if (runCatching { keepUserSettings(context, old, newest) }.onFailure { Log.w(TAG, "user settings of $old", it) }.isFailure) continue
|
||||
if (runCatching { ProtonDefault.moveGames(context, setOf(old), newest) }.onFailure { Log.w(TAG, "per-game picks of $old", it) }.isFailure) continue
|
||||
if (File(toolsDir(context), old).deleteRecursively()) ComponentsManager.forgetProton(context, old)
|
||||
// DroidDeck-Bionic only: the guest finds no default for a deleted Bionic build and falls back to DroidDeck-Proton
|
||||
if (tool.id == BIONIC && runCatching { ProtonDefault.moveDefault(context, setOf(old), newest) }.onFailure { Log.w(TAG, "default pick of $old", it) }.isFailure) continue
|
||||
if (deleteTool(context, old)) ComponentsManager.forgetProton(context, old)
|
||||
else Log.w(TAG, "could not remove $old")
|
||||
}
|
||||
} finally {
|
||||
@@ -221,21 +249,24 @@ object ProtonExtras {
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun install(context: Context, tool: Tool, onProgress: (String, Int) -> Unit): String? {
|
||||
fun install(context: Context, tool: Tool, cancelled: java.util.function.BooleanSupplier? = null,
|
||||
onProgress: (String, Int) -> Unit): String? {
|
||||
if (installInProgress || prefetching) return context.getString(R.string.pextra_busy)
|
||||
installInProgress = true
|
||||
return try { installNow(context, tool, onProgress) } finally { installInProgress = false }
|
||||
return try { installNow(context, tool, cancelled, onProgress) } finally { installInProgress = false }
|
||||
}
|
||||
|
||||
private fun fetchArchive(context: Context, tool: Tool, asset: Asset, archive: File, onProgress: (String, Int) -> Unit): String? {
|
||||
private fun fetchArchive(context: Context, tool: Tool, asset: Asset, archive: File, onProgress: (String, Int) -> Unit,
|
||||
cancelled: java.util.function.BooleanSupplier? = null): String? {
|
||||
val downloading = context.getString(R.string.pextra_downloading, tool.name, asset.tag)
|
||||
onProgress(downloading, 0)
|
||||
var downloaded = false
|
||||
for (attempt in 0 until 5) {
|
||||
downloaded = Downloader.downloadFile(asset.url, archive, true, asset.sha256) { fraction ->
|
||||
downloaded = Downloader.downloadFile(asset.url, archive, true, asset.sha256, cancelled) { fraction ->
|
||||
onProgress(downloading, if (fraction < 0) -1 else (fraction * 100f).toInt().coerceIn(0, 100))
|
||||
}
|
||||
if (downloaded) break
|
||||
if (cancelled?.asBoolean == true) return context.getString(R.string.pextra_interrupted)
|
||||
if (attempt < 4) {
|
||||
onProgress(context.getString(R.string.pextra_retrying, attempt + 2, 5), -1)
|
||||
try { Thread.sleep(3_000) } catch (_: InterruptedException) {
|
||||
@@ -269,7 +300,8 @@ object ProtonExtras {
|
||||
return problem
|
||||
}
|
||||
|
||||
private fun installNow(context: Context, tool: Tool, onProgress: (String, Int) -> Unit): String? {
|
||||
private fun installNow(context: Context, tool: Tool, cancelled: java.util.function.BooleanSupplier?,
|
||||
onProgress: (String, Int) -> Unit): String? {
|
||||
if (SessionState.running) return context.getString(R.string.pextra_stop_session)
|
||||
if (!LinuxRuntime.isInstalled(context)) return context.getString(R.string.user_apps_runtime_required)
|
||||
|
||||
@@ -284,7 +316,7 @@ object ProtonExtras {
|
||||
|
||||
val checked = asset.sha256 != null && asset.size > 0 && checkedArchive == fingerprint(archive) &&
|
||||
checkedDigest.equals(asset.sha256, ignoreCase = true)
|
||||
if (!checked) fetchArchive(context, tool, asset, archive, onProgress)?.let { return it }
|
||||
if (!checked) fetchArchive(context, tool, asset, archive, onProgress, cancelled)?.let { return it }
|
||||
if (asset.size > 0 && archive.length() != asset.size) {
|
||||
if (archive.length() > asset.size) {
|
||||
archive.delete()
|
||||
@@ -342,7 +374,7 @@ object ProtonExtras {
|
||||
archive.delete()
|
||||
unqueue(context, tool)
|
||||
record(context, tool, placed, asset.tag)
|
||||
if (tool.id == OWN) replaceOlder(context, tool)
|
||||
if (tool.id == OWN || tool.id == BIONIC) replaceOlder(context, tool)
|
||||
if (EsyncPacks.enabled(context)) {
|
||||
onProgress(context.getString(R.string.esync_fetching), -1)
|
||||
try {
|
||||
@@ -427,7 +459,7 @@ object ProtonExtras {
|
||||
internal fun pickAsset(tool: Tool, array: JSONArray): Asset? {
|
||||
val candidates = (0 until array.length()).asSequence()
|
||||
.mapNotNull { array.optJSONObject(it) }
|
||||
.filter { !it.optBoolean("draft", false) && !it.optBoolean("prerelease", false) }
|
||||
.filter { !it.optBoolean("draft", false) && (tool.prereleases || !it.optBoolean("prerelease", false)) }
|
||||
return candidates.firstNotNullOfOrNull { assetOf(tool, it) }
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,14 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-bottom-desktop" to "usr/local/bin/droiddeck-bottom-desktop",
|
||||
"usr/local/bin/droiddeck-gpu" to "usr/local/bin/droiddeck-gpu",
|
||||
"usr/local/bin/droiddeck-desktop-gpu" to "usr/local/bin/droiddeck-desktop-gpu",
|
||||
"usr/local/bin/droiddeck-device-info" to "usr/local/bin/droiddeck-device-info",
|
||||
"usr/local/bin/droiddeck-desktop-window-rules" to "usr/local/bin/droiddeck-desktop-window-rules",
|
||||
"usr/local/bin/droiddeck-library-perms" to "usr/local/bin/droiddeck-library-perms",
|
||||
"usr/local/bin/droiddeck-ime" to "usr/local/bin/droiddeck-ime",
|
||||
"usr/local/bin/kwin_wayland_wrapper" to "usr/local/bin/kwin_wayland_wrapper",
|
||||
"usr/lib/firefox/defaults/pref/droiddeck.js" to "usr/lib/firefox/defaults/pref/droiddeck.js",
|
||||
"etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop",
|
||||
"etc/xdg/fastfetch/config.jsonc" to "etc/xdg/fastfetch/config.jsonc",
|
||||
)
|
||||
|
||||
private val SERVICE_PACKS = mapOf(
|
||||
@@ -143,6 +145,7 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-proton-extra" to "usr/local/bin/droiddeck-proton-extra",
|
||||
"usr/local/bin/droiddeck-netmanager" to "usr/local/bin/droiddeck-netmanager",
|
||||
"usr/local/bin/droiddeck-login1" to "usr/local/bin/droiddeck-login1",
|
||||
"usr/local/bin/droiddeck-documents" to "usr/local/bin/droiddeck-documents",
|
||||
"usr/local/bin/droiddeck-steam-launch" to "usr/local/bin/droiddeck-steam-launch",
|
||||
"usr/local/bin/droiddeck-desktop-games" to "usr/local/bin/droiddeck-desktop-games",
|
||||
"usr/local/bin/droiddeck-desktop-programs" to "usr/local/bin/droiddeck-desktop-programs",
|
||||
@@ -154,6 +157,7 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-emulators" to "usr/local/bin/droiddeck-emulators",
|
||||
"usr/local/bin/droiddeck-snap-run" to "usr/local/bin/droiddeck-snap-run",
|
||||
"usr/local/bin/droiddeck-snap-confine" to "usr/local/bin/droiddeck-snap-confine",
|
||||
"usr/local/bin/droiddeck-diversion-stub" to "usr/local/bin/droiddeck-diversion-stub",
|
||||
"usr/local/bin/droiddeck-snapctl" to "usr/local/bin/droiddeck-snapctl",
|
||||
"usr/local/bin/droiddeck-systemd-run" to "usr/local/bin/systemd-run",
|
||||
"usr/local/bin/droiddeck-snap-cli" to "usr/local/bin/snap",
|
||||
@@ -263,7 +267,9 @@ object SessionFiles {
|
||||
"usr/local/share/vkbridge/droidbridge_icd.json" to "usr/local/share/vkbridge/droidbridge_icd.json",
|
||||
"usr/local/bin/droiddeck-vkbridge-smoke" to "usr/local/bin/droiddeck-vkbridge-smoke",
|
||||
"usr/local/lib/droiddeck/uruntime" to "usr/local/lib/droiddeck/uruntime",
|
||||
"usr/local/lib/droiddeck/dwarfsextract" to "usr/local/lib/droiddeck/dwarfsextract",
|
||||
"usr/local/lib/droiddeck-pipewire.tzst" to "usr/local/lib/droiddeck-pipewire.tzst",
|
||||
"usr/local/share/licenses/dwarfs/LICENSE" to "usr/local/share/licenses/dwarfs/LICENSE",
|
||||
"usr/local/share/licenses/uruntime/LICENSE" to "usr/local/share/licenses/uruntime/LICENSE",
|
||||
) + mangoapp + xclipse.map { it to it } + maliCompat + msitools.map { it to it } + vr + gpuLoad + fexPreloads).filter { (asset, _) ->
|
||||
val dir = asset.substringBeforeLast('/')
|
||||
|
||||
@@ -448,6 +448,13 @@ object SessionPrefs {
|
||||
prefs(context).edit().putString("navTabHidden", keys.joinToString(",")).apply()
|
||||
}
|
||||
|
||||
fun appsTabHomeSeen(context: Context): Boolean? =
|
||||
prefs(context).takeIf { it.contains("appsTabHomeSeen") }?.getBoolean("appsTabHomeSeen", false)
|
||||
|
||||
fun setAppsTabHomeSeen(context: Context, seen: Boolean) {
|
||||
prefs(context).edit().putBoolean("appsTabHomeSeen", seen).apply()
|
||||
}
|
||||
|
||||
private fun idList(raw: String?): List<String> = raw.orEmpty().split(',').map { it.trim() }.filter { it.isNotEmpty() }
|
||||
|
||||
val STORES_SORTS = listOf("lastPlayed", "recentlyInstalled", "titleAsc", "titleDesc", "sizeDesc", "sizeAsc", "releaseDateDesc")
|
||||
@@ -838,6 +845,15 @@ object SessionPrefs {
|
||||
|
||||
fun returnAfterGame(context: Context): Boolean = prefs(context).getBoolean("returnAfterGame", true)
|
||||
|
||||
fun valveProtonOnDemand(context: Context): Boolean = prefs(context).getBoolean("valveProtonOnDemand", true)
|
||||
|
||||
fun setValveProtonOnDemand(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("valveProtonOnDemand", on).apply()
|
||||
}
|
||||
|
||||
/** DroidDeck-Proton is the Proton placed before the client starts; Valve's ARM64 Proton waits for a title that needs it. */
|
||||
fun ownProtonFirst(context: Context): Boolean = valveProtonOnDemand(context) && !ProtonExtras.declined(context)
|
||||
|
||||
fun setReturnAfterGame(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("returnAfterGame", on).apply()
|
||||
}
|
||||
@@ -1042,7 +1058,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("prootFastPath", on).apply()
|
||||
}
|
||||
|
||||
fun cursorComposite(context: Context): Boolean = prefs(context).getBoolean("cursorComposite", false)
|
||||
fun cursorComposite(context: Context): Boolean = prefs(context).getBoolean("cursorComposite", true)
|
||||
|
||||
fun setCursorComposite(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("cursorComposite", on).apply()
|
||||
@@ -1562,7 +1578,7 @@ object SessionPrefs {
|
||||
fun adoptAddedGameExe(context: Context, folderPath: String, expected: String, path: String, seen: Int): Boolean =
|
||||
synchronized(addedGameLock) {
|
||||
val unchanged = addedGameExe(context, folderPath) == expected
|
||||
if (unchanged) prefs(context).edit().putString("addedExe:$folderPath", path).putInt("addedExeSeen:$folderPath", seen).apply()
|
||||
if (unchanged) prefs(context).edit().putString("addedExe:$folderPath", path).putString("addedAdopted:Exe:$folderPath", path).putInt("addedExeSeen:$folderPath", seen).apply()
|
||||
unchanged
|
||||
}
|
||||
|
||||
|
||||
@@ -669,6 +669,8 @@ class SessionService : Service() {
|
||||
guest.add("DROIDDECK_WSI_BYPASS_CHECK_MS=100")
|
||||
guest.add("WINE_OFFSCREEN_CHECK_MS=100")
|
||||
guest.add("DD_REFRESH=" + Math.round(SessionState.refreshHz))
|
||||
guest.add("DD_DEVICE_NAME=" + android.os.Build.MODEL)
|
||||
com.droiddeck.launcher.gpu.SocNames.plainName().takeIf { it.isNotEmpty() }?.let { guest.add("DD_SOC_NAME=$it") }
|
||||
guest.add("DD_LOG=" + sessionLog.path)
|
||||
guest.add("DD_DEBUG_DIR=" + sessionDir.path)
|
||||
if (EnhancedDiagnostics.isActive(this, sessionDir)) guest.add("DROIDDECK_ENHANCED_DIAGNOSTICS=1")
|
||||
@@ -784,7 +786,7 @@ class SessionService : Service() {
|
||||
if (drives > 0) Log.i(TAG, "$drives Wine drive links given their guest paths back")
|
||||
val hostEnv = if (nativeUserland) HostEnvironment().also { env ->
|
||||
Log.i(TAG, "native userland: no proot (${sessionBindSpecs.size} mounts)")
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, SessionPrefs.guestHostname(this))
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionEnvironment(root, sessionBindSpecs, guest.first(), SessionPrefs.guestHostname(this))
|
||||
.forEach { (k, v) -> env[k] = v }
|
||||
} else prootEnv
|
||||
|
||||
@@ -1002,6 +1004,7 @@ class SessionService : Service() {
|
||||
))
|
||||
guest.add("TZ=" + java.util.TimeZone.getDefault().id)
|
||||
if (SessionState.mode == MODE_STEAM) SessionPrefs.pendingShaderPrecache(this)?.let { guest.add("DD_SHADER_PRECACHE=" + if (it) "1" else "0") }
|
||||
guest.add("DD_VALVE_PROTON=" + if (SessionPrefs.ownProtonFirst(this)) "0" else "1")
|
||||
guest.add("XDG_RUNTIME_DIR=" + LinuxRuntime.GUEST_RUNTIME_DIR)
|
||||
guest.add("XDG_SESSION_TYPE=wayland")
|
||||
guest.add("WAYLAND_DISPLAY=wayland-0")
|
||||
@@ -1033,6 +1036,9 @@ class SessionService : Service() {
|
||||
)
|
||||
(if (bridge || venus) null else LinuxVulkanDriver.resolveIcdPath(this, linuxDriverId))
|
||||
?.let { guest.add(LinuxVulkanDriver.ENV + "=" + it) }
|
||||
// DroidDeck-Bionic games load an Android driver build; this is the one the display uses, for a runtime driver
|
||||
// that has none.
|
||||
guest.add("DROIDDECK_DISPLAY_DRIVER=" + com.droiddeck.launcher.gpu.TurnipDriver(this).effectiveId())
|
||||
if (!com.droiddeck.launcher.core.DeviceSupport.adreno() && lastXwaylandCrashed()) {
|
||||
guest.add("XWAYLAND_NO_GLAMOR=1")
|
||||
Log.w(TAG, "xwayland: the last session's Xwayland crashed; glamor off for this one (XWAYLAND_NO_GLAMOR=1)")
|
||||
@@ -1264,6 +1270,7 @@ class SessionService : Service() {
|
||||
components.add(hwmon)
|
||||
binds.add(hwmon.dir.path + ":/sys/class/hwmon")
|
||||
}
|
||||
binds.addAll(CpuCacheSysfs.binds(File(filesDir, "session/sys/cpu-cache")))
|
||||
val cpuStat = CpuStatComponent(File(filesDir, "session/proc-stat"))
|
||||
if (cpuStat.prepare()) {
|
||||
cpuStat.attach(this)
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.droiddeck.launcher.stores
|
||||
import android.content.Context
|
||||
import android.os.StatFs
|
||||
import android.os.storage.StorageManager
|
||||
import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.GameStorage
|
||||
import com.droiddeck.launcher.session.SecondaryLibrary
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import java.util.zip.CRC32
|
||||
@@ -12,6 +14,7 @@ import java.util.zip.CRC32
|
||||
object StoreInstallRoot {
|
||||
const val SPACE_UNKNOWN = -1L
|
||||
private const val INTERNAL = "root/Games/Stores"
|
||||
const val INTERNAL_GUEST = "/$INTERNAL"
|
||||
private const val ON_VOLUME = "Games"
|
||||
const val GUEST_EXTERNAL = "/mnt/droiddeck-stores"
|
||||
|
||||
@@ -179,6 +182,24 @@ object StoreInstallRoot {
|
||||
fun externalBindSpecsForXodus(context: Context): List<String> =
|
||||
externalBindSpecs(externalRootsForXodus(context), LinuxRuntime.rootDir(context))
|
||||
|
||||
fun guestBinds(context: Context): List<String> {
|
||||
val out = ArrayList<String>(externalBindSpecs(context))
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
GameStorage.effective(context)?.takeIf { File(it.path).isDirectory }?.let { library ->
|
||||
val content = SecondaryLibrary.contentPath(File(library.path)).path
|
||||
for (guest in SecondaryLibrary.CARD_GUESTS) {
|
||||
File(root, guest.removePrefix("/")).mkdirs()
|
||||
out += "$content:$guest"
|
||||
}
|
||||
}
|
||||
for (folder in AddedGames.roots(context)) {
|
||||
if (!folder.host.isDirectory || !folder.host.canRead()) continue
|
||||
File(root, folder.guest.removePrefix("/")).mkdirs()
|
||||
out += folder.host.path + ":" + folder.guest
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
internal fun externalBindSpecs(roots: List<Pair<File, String>>, guestRoot: File): List<String> =
|
||||
roots.mapNotNull { (host, guest) ->
|
||||
if (!host.isDirectory || !host.canRead()) return@mapNotNull null
|
||||
|
||||
@@ -12,8 +12,11 @@ object StoreLaunch {
|
||||
const val EPIC_CODE = ".droiddeck-epic-code"
|
||||
const val EPIC_ARGS = ".droiddeck-epic-args"
|
||||
const val UBISOFT_LAUNCH = ".droiddeck-ubisoft.json"
|
||||
private const val UBISOFT_SERVICE = "Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe"
|
||||
const val EPIC_PARENT = "Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe"
|
||||
/** DroidDeck-Bionic's Wine has Android's root on Z:; that tool sets this to the guest's root as its Wine names it. */
|
||||
const val GUEST_ROOT = "DROIDDECK_GUEST_ROOT"
|
||||
private const val ROOT_VAR = "DD_R"
|
||||
private const val UBISOFT_SERVICE = "%$ROOT_VAR%\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe"
|
||||
const val EPIC_PARENT = "%$ROOT_VAR%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe"
|
||||
/** Per-game environment switch: 1 starts any Epic game under [EPIC_PARENT], 0 never does. */
|
||||
const val EPIC_PARENT_SWITCH = "DD_EPIC_PARENT"
|
||||
/** Epic app names whose launchers treat the game as unowned unless a process named EpicGamesLauncher.exe started it. */
|
||||
@@ -47,6 +50,10 @@ object StoreLaunch {
|
||||
for ((k, v) in sidecar.env) if (ENV_NAME.matches(k)) lines += "set \"$k=${v.replace("\"", "")}\""
|
||||
val args = sidecar.args.joinToString(" ") { if (sidecar.store == Store.ROCKSTAR) batchArg(it) else quoteArg(it) }
|
||||
val run = "\"%~dp0$exe\"" + (if (args.isNotEmpty()) " $args" else "")
|
||||
if (sidecar.store == Store.EPIC || sidecar.store == Store.UBISOFT) {
|
||||
lines += "set \"$ROOT_VAR=Z:\""
|
||||
lines += "if defined $GUEST_ROOT set \"$ROOT_VAR=%$GUEST_ROOT%\""
|
||||
}
|
||||
if (sidecar.store == Store.EPIC) {
|
||||
lines += "set \"$PARENT_VAR=${if (sidecar.id in EPIC_PARENT_TITLES) "1" else ""}\""
|
||||
lines += "if \"%$EPIC_PARENT_SWITCH%\"==\"1\" set \"$PARENT_VAR=1\""
|
||||
@@ -137,7 +144,6 @@ object StoreLaunch {
|
||||
if (sidecar.store !in listOf(Store.UBISOFT, Store.ROCKSTAR) || !sidecar.isInstalled) return sidecar
|
||||
if (sidecar.store == Store.ROCKSTAR && java.nio.file.Files.isSymbolicLink(File(folder, LAUNCHER).toPath())) return sidecar.copy(launcher = null)
|
||||
val wrongExe = !sidecar.exeFile(folder).isFile || sidecar.exe.contains("installer", ignoreCase = true) || sidecar.exe.contains("autorun", ignoreCase = true)
|
||||
if (sidecar.store == Store.UBISOFT && sidecar.launcher == LAUNCHER && !wrongExe) return sidecar
|
||||
val metadataExe = if (sidecar.store == Store.ROCKSTAR) com.droiddeck.launcher.stores.rockstar.RockstarMetadata.find(folder)?.exe
|
||||
?.takeIf { File(folder, it).isFile && File(folder, it).canonicalPath.startsWith(folder.canonicalPath + File.separator) } else null
|
||||
val exe = metadataExe ?: if (wrongExe) StoreExe.pick(folder, null, sidecar.title).ifEmpty { sidecar.exe } else sidecar.exe
|
||||
|
||||
@@ -7,9 +7,7 @@ import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.runtime.BattleNet
|
||||
import com.droiddeck.launcher.runtime.GuestCommand
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.GameStorage
|
||||
import com.droiddeck.launcher.session.SecondaryLibrary
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.InstalledStoreGame
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
@@ -75,22 +73,10 @@ object BattleNetInstall {
|
||||
}
|
||||
|
||||
internal fun binds(context: Context): List<String> {
|
||||
val out = ArrayList<String>(StoreInstallRoot.externalBindSpecs(context))
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
GameStorage.effective(context)?.let { library ->
|
||||
if (!File(library.path).isDirectory) throw IllegalStateException(context.getString(R.string.game_sync_err_game_storage))
|
||||
val content = SecondaryLibrary.contentPath(File(library.path)).path
|
||||
for (guest in SecondaryLibrary.CARD_GUESTS) {
|
||||
File(root, guest.removePrefix("/")).mkdirs()
|
||||
out += "$content:$guest"
|
||||
}
|
||||
}
|
||||
for (folder in AddedGames.roots(context)) {
|
||||
if (!folder.host.isDirectory || !folder.host.canRead()) continue
|
||||
File(root, folder.guest.removePrefix("/")).mkdirs()
|
||||
out += folder.host.path + ":" + folder.guest
|
||||
}
|
||||
return out
|
||||
return StoreInstallRoot.guestBinds(context)
|
||||
}
|
||||
|
||||
internal fun run(context: Context, args: List<String>, cancelled: AtomicBoolean?, onLine: (String) -> Unit): Int =
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.droiddeck.launcher.frontend.AddedGames;
|
||||
import com.droiddeck.launcher.runtime.GuestCommand;
|
||||
import com.droiddeck.launcher.stores.StoreLanguage;
|
||||
import com.droiddeck.launcher.stores.StoreLog;
|
||||
import com.droiddeck.launcher.stores.download.StoreDownloadTier;
|
||||
@@ -271,11 +270,10 @@ public final class GogDownloadManager {
|
||||
long planned = 0;
|
||||
boolean sized = true;
|
||||
for (InstallerPart part : parts) { planned += part.size; if (part.size <= 0) sized = false; }
|
||||
if (sized) {
|
||||
long usable = com.droiddeck.launcher.stores.StoreInstallRoot.availableBytes(installPath);
|
||||
if (com.droiddeck.launcher.stores.StoreInstallRoot.insufficientSpace(planned, usable)) {
|
||||
throw new InstallException("Not enough free space: need " + formatBytes(planned) + ", only " + formatBytes(usable) + " free");
|
||||
}
|
||||
long needed = installerBytesNeeded(knownPartBytes(parts), GogLibrary.INSTANCE.sizeOf(ctx, game.gameId));
|
||||
long usable = com.droiddeck.launcher.stores.StoreInstallRoot.availableBytes(installPath);
|
||||
if (com.droiddeck.launcher.stores.StoreInstallRoot.insufficientSpace(needed, usable)) {
|
||||
throw new InstallException("Not enough free space: need " + formatBytes(needed) + ", only " + formatBytes(usable) + " free");
|
||||
}
|
||||
long total = 0;
|
||||
for (InstallerPart part : parts) {
|
||||
@@ -327,10 +325,7 @@ public final class GogDownloadManager {
|
||||
cb.onProgress("Extracting installer…", 95);
|
||||
int rc;
|
||||
try {
|
||||
rc = GuestCommand.INSTANCE.run(ctx, Arrays.asList(
|
||||
"/usr/local/bin/droiddeck-innoextract", "--gog", "--silent",
|
||||
"-d", guestDir, guestSetup),
|
||||
false, "gog-innoextract", null, null, false, cancelled, null,
|
||||
rc = GogInnoextract.extract(ctx, guestSetup, guestDir, "gog-innoextract", cancelled,
|
||||
line -> { cb.onLog("gog innoextract: " + line); return kotlin.Unit.INSTANCE; });
|
||||
} catch (Exception e) {
|
||||
throw new InstallException("The installer could not be extracted: " + e.getClass().getSimpleName());
|
||||
@@ -339,6 +334,16 @@ public final class GogDownloadManager {
|
||||
if (rc != 0) throw new InstallException("The installer could not be extracted (innoextract exit " + rc + ")");
|
||||
}
|
||||
|
||||
static long knownPartBytes(List<InstallerPart> parts) {
|
||||
long known = 0;
|
||||
for (InstallerPart part : parts) if (part.size > 0) known += part.size;
|
||||
return known;
|
||||
}
|
||||
|
||||
static long installerBytesNeeded(long downloadBytes, long installedBytes) {
|
||||
return Math.max(0, downloadBytes) + Math.max(0, installedBytes);
|
||||
}
|
||||
|
||||
static final class InstallerPart {
|
||||
final String url;
|
||||
final String filename;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.droiddeck.launcher.stores.gog
|
||||
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.runtime.GuestCommand
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
internal object GogInnoextract {
|
||||
private const val PROGRAM = "/usr/local/bin/droiddeck-innoextract"
|
||||
|
||||
@JvmStatic
|
||||
fun extract(context: Context, setup: String, target: String, logName: String, cancelled: AtomicBoolean, onLine: (String) -> Unit): Int =
|
||||
GuestCommand.run(context, argv(setup, target), logName = logName,
|
||||
extraBinds = StoreInstallRoot.guestBinds(context), cancelled = cancelled, onLine = onLine)
|
||||
|
||||
internal fun argv(setup: String, target: String): List<String> = listOf(PROGRAM, "--gog", "--silent", "-d", target, setup)
|
||||
}
|
||||
@@ -3,11 +3,9 @@ package com.droiddeck.launcher.stores.gog
|
||||
import android.content.Context
|
||||
import com.droiddeck.launcher.agent.AgentGuest
|
||||
import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.runtime.GuestCommand
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.stores.StoreGameSidecar
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import com.droiddeck.launcher.stores.download.DownloadQueue
|
||||
import com.droiddeck.launcher.stores.download.DownloadStage
|
||||
import org.json.JSONArray
|
||||
@@ -71,8 +69,7 @@ internal object GogOffline {
|
||||
val source = AddedGames.guestPath(context, installer) ?: error("The GOG installer is not visible to Linux")
|
||||
val target = AddedGames.guestPath(context, extracted) ?: error("The GOG staging folder is not visible to Linux")
|
||||
handle.stage(DownloadStage.INSTALL, "Extracting the full offline installer")
|
||||
val rc = GuestCommand.run(context, listOf("/usr/local/bin/droiddeck-innoextract", "--gog", "--silent", "-d", target, source),
|
||||
extraBinds = StoreInstallRoot.externalBindSpecs(context), cancelled = stop, logName = "gog-refresh", onLine = handle::log)
|
||||
val rc = GogInnoextract.extract(context, source, target, "gog-refresh", stop, handle::log)
|
||||
if (stop.get()) return
|
||||
check(rc == 0) { "GOG installer extraction failed (exit $rc)" }
|
||||
applyRefresh(proposal, extracted, handle, stop)
|
||||
|
||||
@@ -526,11 +526,11 @@ fun ComponentsPage(
|
||||
val availableTitle: @Composable (String) -> String = { l ->
|
||||
when (l) {
|
||||
PROTON_TAB -> stringResource(R.string.comp_available_count, protons.rows.count(ProtonRow::available))
|
||||
else -> stringResource(R.string.comp_nightlies_count, availableRows(l, catalog, snapshot).size)
|
||||
else -> stringResource(R.string.comp_nightlies_count, availableRows(l, catalog, snapshot, view?.proton?.dir?.name).size)
|
||||
}
|
||||
}
|
||||
val followed = view?.proton?.let(ComponentUpdates::follows) == true
|
||||
val moded: (String) -> Boolean = { followed && it in compModes && it !in compAutoHeld && !ComponentsManager.runtimeManaged(it, gpu.systemPowerVr) }
|
||||
val followed: (String) -> Boolean = { l -> view?.proton?.let { ComponentUpdates.autoFollows(it, l) } == true }
|
||||
val moded: (String) -> Boolean = { followed(it) && it in compModes && it !in compAutoHeld && !ComponentsManager.runtimeManaged(it, gpu.systemPowerVr) }
|
||||
val automatic: (String) -> Boolean = { moded(it) && compModes[it] == ComponentUpdates.AUTO }
|
||||
val installedRows: @Composable ColumnScope.(String, Boolean) -> Unit = { l, right ->
|
||||
when (l) {
|
||||
@@ -614,7 +614,7 @@ fun ComponentsPage(
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
val available = availableRows(l, catalog, snapshot)
|
||||
val available = availableRows(l, catalog, snapshot, view?.proton?.dir?.name)
|
||||
if (available.isEmpty()) EmptyLine(if (catalogAt == 0L) stringResource(R.string.comp_refresh_to_list) else stringResource(R.string.comp_nothing_new))
|
||||
for ((stable, nightly) in available) {
|
||||
val d = if (nightly != null && nightlyPicked[stable.file] == true) nightly else stable
|
||||
@@ -974,18 +974,18 @@ private fun installedFor(l: String, view: ComponentsManager.ProtonView?, snapsho
|
||||
o.label.substringAfterLast(" · ", "").ifEmpty { o.label }.let { if (isCurrent) stringResource(R.string.comp_this_build, it) else stringResource(R.string.comp_earlier_build, it) },
|
||||
"ORIGINAL", activeIsOriginal && isCurrent, !isCurrent, null, o.protonVersion,
|
||||
)
|
||||
} + (snapshot?.packages ?: emptyList()).filter { it.comp == l }.map { s ->
|
||||
} + ComponentsManager.forTool(l, view.proton.dir.name, (snapshot?.packages ?: emptyList()).filter { it.comp == l }, st.activeFile) { it.file }.map { s ->
|
||||
InstalledItem(s.version, stringResource(R.string.common_size_mb, s.size / 1048576.0), "STORED", !runtimeManaged && s.file == st.activeFile, true, s.file, null)
|
||||
}
|
||||
}
|
||||
|
||||
private fun availableFor(l: String, catalog: List<CatalogItem>, snapshot: Snapshot?): List<CatalogItem> {
|
||||
private fun availableFor(l: String, catalog: List<CatalogItem>, snapshot: Snapshot?, toolDir: String?): List<CatalogItem> {
|
||||
val stored = (snapshot?.packages ?: emptyList()).map { it.file }.toSet()
|
||||
return catalog.filter { it.comp == l && ComponentsManager.safeName(it.file) !in stored }
|
||||
return ComponentsManager.forTool(l, toolDir, catalog.filter { it.comp == l && ComponentsManager.safeName(it.file) !in stored }) { it.file }
|
||||
}
|
||||
|
||||
private fun availableRows(l: String, catalog: List<CatalogItem>, snapshot: Snapshot?): List<Pair<CatalogItem, CatalogItem?>> {
|
||||
val available = availableFor(l, catalog, snapshot)
|
||||
private fun availableRows(l: String, catalog: List<CatalogItem>, snapshot: Snapshot?, toolDir: String?): List<Pair<CatalogItem, CatalogItem?>> {
|
||||
val available = availableFor(l, catalog, snapshot, toolDir)
|
||||
val pairs = ComponentsManager.nightlyPairs(available)
|
||||
val paired = pairs.values.toSet()
|
||||
return available.filter { it !in paired }.map { it to pairs[it] }
|
||||
@@ -1201,7 +1201,7 @@ private fun GameComponentOverrides(
|
||||
}
|
||||
GamePackageRow(
|
||||
comp = "fex",
|
||||
packages = packages,
|
||||
packages = ComponentsManager.forTool("fex", protonChoice?.dir ?: generalProton?.dir?.name, packages, componentChoices["fex"]) { it.file },
|
||||
selectedFile = componentChoices["fex"],
|
||||
open = componentMenu == "fex",
|
||||
busy = busy,
|
||||
|
||||
@@ -58,6 +58,7 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.snapshotFlow
|
||||
import androidx.compose.runtime.withFrameNanos
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.flow.first
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
@@ -764,12 +765,31 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
focusManager.clearFocus(force = true)
|
||||
onRailSelect(key)
|
||||
}, a)
|
||||
val stepScope = androidx.compose.runtime.rememberCoroutineScope()
|
||||
val pageKeyNow = androidx.compose.runtime.rememberUpdatedState(s.pageKey)
|
||||
var railHold by remember { mutableStateOf<kotlinx.coroutines.Job?>(null) }
|
||||
val tabStep = androidx.compose.runtime.rememberUpdatedState { step: Int ->
|
||||
if (!processSettingsPageVisible) {
|
||||
val keys = navigationKeys(s)
|
||||
keys.getOrNull(keys.indexOf(railSelectionNow.value) + step)?.let { key ->
|
||||
PageSwipe.direction = step
|
||||
onRailSelect(key)
|
||||
if (s.dualScreen) { onRailSelect(key); return@let }
|
||||
showRailPage(key, false)
|
||||
if (inputModeManager.inputMode != InputMode.Keyboard) inputModeManager.requestInputMode(InputMode.Keyboard)
|
||||
val since = MainTabSteps.otherKeys
|
||||
val owner = selected
|
||||
val ownPage = if (key == "components") "components" else null
|
||||
railHold?.cancel()
|
||||
// Pages focus their own first control as they appear; the ring stays on the rail until another key moves it.
|
||||
railHold = stepScope.launch {
|
||||
var pageShown = false
|
||||
repeat(RAIL_HOLD_FRAMES) {
|
||||
withFrameNanos { }
|
||||
if (MainTabSteps.otherKeys != since || selected != owner) return@launch
|
||||
if (pageKeyNow.value == ownPage) pageShown = true else if (pageShown) return@launch
|
||||
if (frontFocus.focusedRail != key) runCatching { frontFocus.railFor(key).requestFocus() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -900,4 +920,7 @@ internal object ChildProcessSetup {
|
||||
|
||||
internal object MainTabSteps {
|
||||
@Volatile var handler: ((Int) -> Unit)? = null
|
||||
@Volatile var otherKeys = 0
|
||||
}
|
||||
|
||||
private const val RAIL_HOLD_FRAMES = 60
|
||||
@@ -38,8 +38,10 @@ import com.droiddeck.launcher.input.InputButtonShape
|
||||
import com.droiddeck.launcher.input.InputButtonImages
|
||||
import com.droiddeck.launcher.input.PadBridge
|
||||
import com.droiddeck.launcher.input.PadKit
|
||||
import com.droiddeck.launcher.input.ThrottledRedraw
|
||||
import com.droiddeck.launcher.input.pcKeyLabel
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.atan2
|
||||
import kotlin.math.hypot
|
||||
import kotlin.math.min
|
||||
@@ -581,6 +583,10 @@ class InputSurfaceView(
|
||||
private var originY = 0f
|
||||
private var knobX = 0f
|
||||
private var knobY = 0f
|
||||
private var drawnX = 0f
|
||||
private var drawnY = 0f
|
||||
private var atRim = false
|
||||
private val redraw = ThrottledRedraw(this, STICK_REDRAW_MS)
|
||||
private val ring = Paint(Paint.ANTI_ALIAS_FLAG).apply { style = Paint.Style.STROKE }
|
||||
private val knob = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
|
||||
@@ -663,6 +669,7 @@ class InputSurfaceView(
|
||||
MotionEvent.ACTION_MOVE -> follow(event.getX(0), event.getY(0), r)
|
||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
||||
touching = false
|
||||
atRim = false
|
||||
val cancelled = event.actionMasked == MotionEvent.ACTION_CANCEL || event.flags and MotionEvent.FLAG_CANCELED != 0
|
||||
travel = maxOf(travel, hypot(event.x - downX, event.y - downY))
|
||||
lastUp = if (!clicking && !cancelled && event.eventTime - downAt <= STICK_TAP_MS && travel <= tapSlop) event.eventTime else 0L
|
||||
@@ -678,15 +685,27 @@ class InputSurfaceView(
|
||||
var dx = x - originX
|
||||
var dy = y - originY
|
||||
val length = hypot(dx, dy)
|
||||
if (length > r) { dx *= r / length; dy *= r / length }
|
||||
if (force || dx != knobX || dy != knobY) move(dx, dy, r)
|
||||
val rim = length > r
|
||||
if (rim) { dx *= r / length; dy *= r / length }
|
||||
val reachedRim = rim && !atRim
|
||||
atRim = rim
|
||||
if (force || dx != knobX || dy != knobY) move(dx, dy, r, throttled = !force && !reachedRim, rim = rim)
|
||||
}
|
||||
|
||||
private fun move(dx: Float, dy: Float, r: Float) {
|
||||
private fun move(dx: Float, dy: Float, r: Float, throttled: Boolean = false, rim: Boolean = false) {
|
||||
knobX = dx
|
||||
knobY = dy
|
||||
source?.update(dx / r, dy / r)
|
||||
invalidate()
|
||||
if (!throttled) {
|
||||
redraw.cancel()
|
||||
drawnX = dx
|
||||
drawnY = dy
|
||||
invalidate()
|
||||
} else if (rim || abs(dx - drawnX) >= MIN_STICK_MOVE_PX || abs(dy - drawnY) >= MIN_STICK_MOVE_PX) {
|
||||
drawnX = dx
|
||||
drawnY = dy
|
||||
redraw.request()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setClick(down: Boolean) {
|
||||
@@ -699,6 +718,7 @@ class InputSurfaceView(
|
||||
override fun onDetachedFromWindow() {
|
||||
setClick(false)
|
||||
if (knobX != 0f || knobY != 0f) move(0f, 0f, 1f)
|
||||
redraw.cancel()
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
}
|
||||
@@ -766,6 +786,8 @@ class InputSurfaceView(
|
||||
companion object {
|
||||
private const val CLICK_MS = 300L
|
||||
private const val STICK_TAP_MS = 200L
|
||||
private const val STICK_REDRAW_MS = 33L
|
||||
private const val MIN_STICK_MOVE_PX = 1f
|
||||
private const val CLASSIC_REACH = 0.5f
|
||||
private const val PANEL_REACH = 0.30f
|
||||
private const val HIT_SLACK = 0.25f
|
||||
|
||||
@@ -93,6 +93,7 @@ class ModeSettings(
|
||||
val steamClientArch: String? = null,
|
||||
val returnAfterGame: Boolean? = null,
|
||||
val shaderPrecache: Boolean? = null,
|
||||
val valveProtonOnDemand: Boolean? = null,
|
||||
val steamRepairQueued: Boolean = false,
|
||||
val mangoapp: Boolean = true,
|
||||
val steamController: String? = null,
|
||||
@@ -158,6 +159,7 @@ class ModeSettingsActions(
|
||||
val onMangoapp: (Boolean) -> Unit = {},
|
||||
val onReturnAfterGame: (Boolean) -> Unit = {},
|
||||
val onShaderPrecache: (Boolean) -> Unit = {},
|
||||
val onValveProtonOnDemand: (Boolean) -> Unit = {},
|
||||
val onSteamController: (String) -> Unit = {},
|
||||
val onUnfoldedControls: (Boolean) -> Unit = {},
|
||||
val onUnfoldedControlsWithController: (Boolean) -> Unit = {},
|
||||
@@ -534,6 +536,10 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
stringResource(R.string.mode_shader_precache_hint),
|
||||
s.shaderPrecache, onChange = a.onShaderPrecache,
|
||||
)
|
||||
if (s.valveProtonOnDemand != null) ToggleRow(
|
||||
host, "valveprotonondemand", stringResource(R.string.mode_valve_proton_on_demand), null,
|
||||
s.valveProtonOnDemand, onChange = a.onValveProtonOnDemand,
|
||||
)
|
||||
SettingsRow(
|
||||
stringResource(R.string.mode_steam_repair),
|
||||
stringResource(if (s.steamRepairQueued) R.string.mode_steam_repair_queued else R.string.mode_steam_repair_hint),
|
||||
|
||||
@@ -27,9 +27,9 @@ internal object DeveloperTools {
|
||||
internal object NavTabs {
|
||||
const val MORE = "more"
|
||||
val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
|
||||
val DEFAULT_SHELVED = setOf("soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
|
||||
val DEFAULT_SHELVED = setOf("soundtracks", "components", "storage", "sync", "decky", "boot-movies", "agent")
|
||||
val DEFAULT_HIDDEN = setOf("android-apps", "agent")
|
||||
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "decky", "boot-movies", "android-apps", "agent")
|
||||
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "decky", "boot-movies", "agent")
|
||||
private val OLD_ORDER = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates")
|
||||
private val OLD_SHELVED = setOf("soundtracks", "agent", "storage", "sync")
|
||||
private const val LAYOUT_VERSION = 2
|
||||
@@ -95,6 +95,15 @@ internal object NavTabs {
|
||||
else -> true
|
||||
}
|
||||
|
||||
// Apps only has content when DroidDeck is the home app, so it follows that state on each change and
|
||||
// otherwise stays wherever the user put it.
|
||||
fun syncHomeApps(context: Context, homeSelected: Boolean) {
|
||||
val seen = SessionPrefs.appsTabHomeSeen(context)
|
||||
SessionPrefs.setAppsTabHomeSeen(context, homeSelected)
|
||||
if (seen == homeSelected || (seen == null && !homeSelected)) return
|
||||
setHidden(context, "android-apps", !homeSelected)
|
||||
}
|
||||
|
||||
fun hideable(key: String) = key != "setup"
|
||||
|
||||
fun place(s: FrontEndState, key: String): TabPlace = when {
|
||||
|
||||
@@ -1787,12 +1787,15 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
|
||||
chipModifier = track("cmp-proton"),
|
||||
onPick = { id -> a.onGameProton(gameProfile.appId, id) },
|
||||
)
|
||||
val gameTool = snap.protons.firstOrNull { it.proton.id == gameProfile.protonId }?.proton?.dir?.name
|
||||
for (comp in ComponentsManager.COMPONENTS) {
|
||||
val value = gameProfile.components.getValue(comp)
|
||||
val managedDxvk = ComponentsManager.runtimeManaged(comp, a.systemPowerVr)
|
||||
val options: List<Pair<String?, String>> =
|
||||
listOf(null to stringResource(R.string.comp_game_use_general)) +
|
||||
if (managedDxvk) emptyList() else snap.packages.filter { it.comp == comp }.map { it.file to it.version }
|
||||
if (managedDxvk) emptyList() else ComponentsManager.forTool(
|
||||
comp, gameTool, snap.packages.filter { it.comp == comp }, gameProfile.componentFiles[comp],
|
||||
) { it.file }.map { it.file to it.version }
|
||||
DrawerStackedChoice(
|
||||
host = host,
|
||||
key = "game-cmp-$comp",
|
||||
@@ -1875,7 +1878,7 @@ private fun ComponentsDrawerPage(host: MenuHost, a: DrawerActions, track: (Strin
|
||||
val managedDxvk = ComponentsManager.runtimeManaged(comp, a.systemPowerVr)
|
||||
val originals = view.originals.filter { it.comp == comp }
|
||||
val options = originals.map { "orig:${it.protonVersion}" to (if (it.protonVersion == build) originalLabel else stringResource(R.string.comp_original, it.protonVersion)) } +
|
||||
snap.packages.filter { it.comp == comp }.map { it.file to it.version }
|
||||
ComponentsManager.forTool(comp, p.dir.name, snap.packages.filter { it.comp == comp }, st.activeFile) { it.file }.map { it.file to it.version }
|
||||
if (options.isEmpty() && !managedDxvk) continue
|
||||
val current = st.activeFile ?: "orig:$build"
|
||||
val shown = options.firstOrNull { it.first == current }?.second
|
||||
|
||||
@@ -383,6 +383,7 @@
|
||||
<string name="mode_return_after_game">Return to DroidDeck after a game</string>
|
||||
<string name="mode_return_after_game_hint">When a game you started from DroidDeck or another launcher closes, Steam exits cleanly (cloud saves finish first) and you go back there. Off: stay in Steam.</string>
|
||||
<string name="mode_shader_precache">Shader pre-caching</string>
|
||||
<string name="mode_valve_proton_on_demand">Valve Proton only when needed</string>
|
||||
<string name="mode_shader_precache_hint">Steam downloads shaders prebuilt for your games and processes them in the background, so games stutter less. Off saves data, storage and battery; games build shaders as they play instead. The same setting as Steam’s Downloads > Shader Pre-Caching. Applies next session.</string>
|
||||
<string name="mode_steam_repair">Repair Steam client</string>
|
||||
<string name="mode_steam_repair_hint">Downloads the Steam client again the next time Steam starts. Use it if Steam stays on its loading screen. Games, sign-in and settings are kept.</string>
|
||||
@@ -672,7 +673,7 @@
|
||||
<string name="perf_fastpath_needs_seccomp">Needs proot\'s seccomp filter.</string>
|
||||
<string name="perf_fastpath_hint">Faster file lookups and less stutter. Turn off if a program can\'t find its files.</string>
|
||||
<string name="perf_cursor_composite">Draw the cursor inside gamescope</string>
|
||||
<string name="perf_cursor_composite_hint">Gamescope paints the pointer itself instead of handing it to Android. Turn on for a controller-driven cursor. Off is faster on a phone. Applies next session.</string>
|
||||
<string name="perf_cursor_composite_hint">Gamescope paints the pointer itself instead of handing it to Android. Applies next session.</string>
|
||||
<string name="perf_identity">Session identity</string>
|
||||
<string name="perf_hostname">Host name</string>
|
||||
<string name="perf_hostname_hint">The name Steam sees for this device. Blank restores %1$s.</string>
|
||||
|
||||
@@ -64,11 +64,19 @@ impl Done {
|
||||
}
|
||||
|
||||
pub fn safe_path(root: &Path, name: &str) -> Result<PathBuf, String> {
|
||||
let rel = Path::new(name.trim_start_matches('/'));
|
||||
if rel.components().any(|c| !matches!(c, Component::Normal(_))) {
|
||||
return Err(format!("The manifest names an unsafe path: {name}"));
|
||||
let unsafe_path = || format!("The manifest names an unsafe path: {name}");
|
||||
let mut out = root.to_path_buf();
|
||||
for component in Path::new(name.trim_start_matches('/')).components() {
|
||||
match component {
|
||||
Component::Normal(part) => out.push(part),
|
||||
Component::CurDir => {}
|
||||
_ => return Err(unsafe_path()),
|
||||
}
|
||||
}
|
||||
Ok(root.join(rel))
|
||||
if out == root {
|
||||
return Err(unsafe_path());
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
fn sha1(b: &[u8]) -> Vec<u8> {
|
||||
@@ -393,6 +401,23 @@ mod tests {
|
||||
assert!(safe_path(root, "../evil").is_err());
|
||||
assert!(safe_path(root, "a/../../evil").is_err());
|
||||
assert_eq!(safe_path(root, "/bin/game.exe").unwrap(), root.join("bin/game.exe"));
|
||||
assert!(safe_path(root, "./../evil").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn accepts_names_that_start_in_the_current_folder() {
|
||||
let root = Path::new("/games/x");
|
||||
assert_eq!(safe_path(root, "./alut.dll").unwrap(), root.join("alut.dll"));
|
||||
assert_eq!(safe_path(root, "./bin/./game.exe").unwrap(), root.join("bin/game.exe"));
|
||||
assert_eq!(safe_path(root, "alut.dll").unwrap(), root.join("alut.dll"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refuses_names_without_a_file_name() {
|
||||
let root = Path::new("/games/x");
|
||||
for name in [".", "./", "/./", "", "/"] {
|
||||
assert!(safe_path(root, name).is_err(), "{name:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.droiddeck.launcher
|
||||
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class SessionRelaunchTest {
|
||||
// recreate() keeps the window, and Compose content set on it afterwards never recomposes (#2668):
|
||||
// a session relaunched that way kept its loading screen up over a running desktop.
|
||||
@Test fun sessionAndLauncherActivitiesNeverRecreateThemselves() {
|
||||
listOf("SessionActivity.kt", "FrontEndActivity.kt").forEach { name ->
|
||||
val code = File("src/main/java/com/droiddeck/launcher/$name").readLines()
|
||||
.map { it.substringBefore("//") }
|
||||
val calls = code.withIndex().filter { (_, line) -> Regex("""\brecreate\(\)""").containsMatchIn(line) }
|
||||
assertTrue("$name calls recreate() at line(s) ${calls.map { it.index + 1 }}", calls.isEmpty())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.frontend
|
||||
import com.droiddeck.launcher.assumeFilePermissionsEnforced
|
||||
import android.os.Environment
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import java.io.File
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
@@ -92,6 +93,38 @@ class AddedExesTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun reselectingTheCurrentExeKeepsItWhenTheRankingChanges() {
|
||||
val storage = tmp.newFolder("Ranked")
|
||||
exe(File(storage, "Example/Example.exe"))
|
||||
exe(File(storage, "Example/Other.exe"))
|
||||
SessionPrefs.setAddedGamesDirs(app, emptyList())
|
||||
SessionPrefs.setGameStorage(app, storage.path, "Card")
|
||||
val folder = File(storage, "Example")
|
||||
val current = AddedGames.scan(app).single { it.folder == folder }.exe
|
||||
val other = listOf("Example.exe", "Other.exe").map { File(folder, it) }.single { it.path != current.path }
|
||||
val existing = AddedGames.addExe(app, current)
|
||||
assertTrue(existing is AddedGames.AddResult.Existing)
|
||||
assertEquals(current.path, SessionPrefs.addedGameExe(app, folder.path))
|
||||
File(folder, "MicrosoftGame.config").writeText("<Executable Name=\"${other.name}\" />")
|
||||
assertEquals(other.path, AddedGames.rank(folder).exes.first().path)
|
||||
assertEquals(current.path, AddedGames.scan(app).single { it.folder == folder }.exe.path)
|
||||
}
|
||||
|
||||
@Test fun reselectingASteamInstallsExeThroughAnAliasStoresTheReachablePath() {
|
||||
val storage = tmp.newFolder("Aliased")
|
||||
val pick = exe(File(storage, "steamapps/common/Example/Example.exe"))
|
||||
File(storage, "steamapps/appmanifest_123.acf").writeText("\"installdir\" \"Example\"")
|
||||
SessionPrefs.setAddedGamesDirs(app, emptyList())
|
||||
SessionPrefs.setGameStorage(app, storage.path, "Card")
|
||||
val alias = File(tmp.newFolder("Links"), "Example.exe")
|
||||
java.nio.file.Files.createSymbolicLink(alias.toPath(), pick.toPath())
|
||||
assertTrue(AddedGames.addExe(app, alias) is AddedGames.AddResult.Existing)
|
||||
assertEquals(pick.path, AddedExes.list(app).single { it.folder == pick.parentFile!!.path }.exe)
|
||||
assertEquals(pick.path, SessionPrefs.addedGameExe(app, pick.parentFile!!.path))
|
||||
assertEquals(pick.path, AddedGames.scan(app).single { it.folder == pick.parentFile }.exe.path)
|
||||
AddedExes.drop(app, pick.parentFile!!.path)
|
||||
}
|
||||
|
||||
@Test fun anotherExeInTheSameGameSwitchesItsExe() {
|
||||
noGamesFolders()
|
||||
val first = onStorage("Games2/Hades/Hades.exe")
|
||||
@@ -297,6 +330,39 @@ class AddedExesTest {
|
||||
assertEquals(listOf(other.path), AddedGames.scan(app).map { it.exe.path })
|
||||
}
|
||||
|
||||
private fun routeEveryGameTo(steamApp: Int) {
|
||||
val config = File(SessionPrefs.activeSteamRoot(app), "userdata/123/config").apply { mkdirs() }
|
||||
val routes = org.json.JSONObject()
|
||||
AddedGames.scan(app).forEach { routes.put(it.appId.toString(), steamApp) }
|
||||
File(config, ".droiddeck-routes.json").writeText(routes.toString())
|
||||
}
|
||||
|
||||
@Test fun anotherProgramOfASteamInstallIsNotRoutedToTheSteamApp() {
|
||||
noGamesFolders()
|
||||
val main = onStorage("Games2/The Binding of Isaac Rebirth/isaac-ng.exe")
|
||||
val launcher = onStorage("Games2/The Binding of Isaac Rebirth/REPENTOGONLauncher.exe")
|
||||
AddedExes.put(app, AddedExes.Entry(main.parent!!, launcher.path))
|
||||
routeEveryGameTo(250900)
|
||||
val game = AddedGames.scan(app).single()
|
||||
assertEquals(launcher.path, game.exe.path)
|
||||
assertEquals(main.path, game.candidates.first().path)
|
||||
assertNull(game.steamAppId)
|
||||
assertTrue(!game.steamProgram)
|
||||
assertTrue(File(AddedGames.writeListing(app, listOf(game), emptyList()).path).readText().contains("\"route\":false"))
|
||||
}
|
||||
|
||||
@Test fun theSteamAppsOwnProgramStillRoutesToTheSteamApp() {
|
||||
noGamesFolders()
|
||||
val main = onStorage("Games2/The Binding of Isaac Rebirth/isaac-ng.exe")
|
||||
onStorage("Games2/The Binding of Isaac Rebirth/REPENTOGONLauncher.exe")
|
||||
AddedExes.put(app, AddedExes.Entry(main.parent!!, main.path))
|
||||
routeEveryGameTo(250900)
|
||||
val game = AddedGames.scan(app).single()
|
||||
assertEquals(250900, game.steamAppId)
|
||||
assertTrue(game.steamProgram)
|
||||
assertTrue(!File(AddedGames.writeListing(app, listOf(game), emptyList()).path).readText().contains("route"))
|
||||
}
|
||||
|
||||
@Test fun aDifferentGameWithANumberedNameIsNotTakenAsAnotherBuild() {
|
||||
noGamesFolders()
|
||||
val held = onStorage("Games2/id/Doom/Doom.exe")
|
||||
@@ -396,6 +462,15 @@ class AddedExesTest {
|
||||
assertEquals("$clash-2", guests.last())
|
||||
}
|
||||
|
||||
@Test fun aFolderNamedStoresIsNotBoundOverTheInternalStoreRoot() {
|
||||
noGamesFolders()
|
||||
val stores = File(tmp.newFolder("card"), "Stores").apply { exe(File(this, "One/One.exe")) }
|
||||
val result = AddedGames.addFolder(app, stores)
|
||||
val guest = SessionPrefs.gameFolderBinds(app).single().second
|
||||
assertTrue(guest != StoreInstallRoot.INTERNAL_GUEST && guest.startsWith("${AddedGames.GUEST_DIR}/Stores-"))
|
||||
assertEquals("$guest/One/One.exe", result.added.single().guestExe)
|
||||
}
|
||||
|
||||
@Test fun aRemovedSingleExeGameStaysOffUntilPickedAgain() {
|
||||
noGamesFolders()
|
||||
val pick = onStorage("Download/Celeste/Celeste.exe")
|
||||
|
||||
@@ -47,6 +47,11 @@ class AddedGamesSteamEditsTest {
|
||||
.writeText(JSONObject().put("games", JSONObject().put(appId.toString(), game)).toString())
|
||||
}
|
||||
|
||||
private fun legacyAdoption(exe: File, seen: Int) {
|
||||
context.getSharedPreferences("session", Context.MODE_PRIVATE).edit()
|
||||
.putString("addedExe:${folder.path}", exe.path).putInt("addedExeSeen:${folder.path}", seen).commit()
|
||||
}
|
||||
|
||||
private fun scanned() = AddedGames.scan(context).single { it.folder == folder }
|
||||
|
||||
@Test fun aTargetChangedInSteamBecomesTheAppsChoiceOnce() {
|
||||
@@ -68,6 +73,65 @@ class AddedGamesSteamEditsTest {
|
||||
assertEquals(main.path, SessionPrefs.addedGameExe(context, folder.path))
|
||||
}
|
||||
|
||||
@Test fun aTargetChosenInSteamKeepsTheSteamAppsRouteBeforeAndAfterItIsAdopted() {
|
||||
val first = scanned()
|
||||
val routes = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/userdata/123/config/.droiddeck-routes.json")
|
||||
routes.writeText(JSONObject().put(first.appId.toString(), 250900).toString())
|
||||
assertEquals(250900, scanned().steamAppId)
|
||||
|
||||
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/bin/Other.exe", 1)
|
||||
val adopted = scanned()
|
||||
assertEquals(other, adopted.exe)
|
||||
assertEquals(250900, adopted.steamAppId)
|
||||
assertTrue(adopted.steamProgram)
|
||||
|
||||
val later = scanned()
|
||||
assertEquals(other, later.exe)
|
||||
assertEquals(250900, later.steamAppId)
|
||||
assertTrue(later.steamProgram)
|
||||
}
|
||||
|
||||
@Test fun aTargetAdoptedBeforeTheMarkerExistedKeepsTheSteamAppsRoute() {
|
||||
val first = scanned()
|
||||
val routes = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/userdata/123/config/.droiddeck-routes.json")
|
||||
routes.writeText(JSONObject().put(first.appId.toString(), 250900).toString())
|
||||
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/bin/Other.exe", 1)
|
||||
legacyAdoption(other, 1)
|
||||
assertNull(SessionPrefs.addedGameAdopted(context, folder.path, "Exe"))
|
||||
val legacy = scanned()
|
||||
assertEquals(other, legacy.exe)
|
||||
assertEquals(250900, legacy.steamAppId)
|
||||
assertTrue(legacy.steamProgram)
|
||||
assertEquals(other.path, SessionPrefs.addedGameAdopted(context, folder.path, "Exe"))
|
||||
}
|
||||
|
||||
@Test fun aProgramPickedInDroidDeckThatSteamNeverEditedStaysOutOfTheRoute() {
|
||||
val first = scanned()
|
||||
val routes = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/userdata/123/config/.droiddeck-routes.json")
|
||||
routes.writeText(JSONObject().put(first.appId.toString(), 250900).toString())
|
||||
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/Example.exe", 1)
|
||||
legacyAdoption(other, 1)
|
||||
val picked = scanned()
|
||||
assertEquals(other, picked.exe)
|
||||
assertNull(picked.steamAppId)
|
||||
assertTrue(!picked.steamProgram)
|
||||
}
|
||||
|
||||
@Test fun aProgramChosenInDroidDeckAfterASteamEditLeavesTheSteamAppsRoute() {
|
||||
val first = scanned()
|
||||
val routes = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/userdata/123/config/.droiddeck-routes.json")
|
||||
routes.writeText(JSONObject().put(first.appId.toString(), 250900).toString())
|
||||
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/bin/Other.exe", 1)
|
||||
assertEquals(other, scanned().exe)
|
||||
|
||||
val third = File(folder, "Third.exe").apply { writeBytes(ByteArray(4)) }
|
||||
SessionPrefs.setAddedGameExe(context, folder.path, third.path)
|
||||
val chosen = scanned()
|
||||
assertEquals(third, chosen.exe)
|
||||
assertNull(chosen.steamAppId)
|
||||
assertTrue(!chosen.steamProgram)
|
||||
}
|
||||
|
||||
@Test fun theListingTellsTheSessionWhichSteamEditTheAppHasTaken() {
|
||||
val first = scanned()
|
||||
record(first.appId, "/root/Games/PC/Example/Example.exe", "/root/Games/PC/Example/bin/Other.exe", 3)
|
||||
|
||||
@@ -66,6 +66,27 @@ class AddedGamesStoreScanTest {
|
||||
assertTrue(game.guestExe.endsWith("/Tools/Editor.exe"))
|
||||
}
|
||||
|
||||
@Test fun everyStoreKeepsItsLauncherWhenItsOwnExeIsReselected() {
|
||||
for (store in listOf(Store.GOG, Store.AMAZON, Store.EPIC)) {
|
||||
val folder = install(store, "own-${store.id}", "Own ${store.label}", "Binaries/Game.exe", launcher = true)
|
||||
val own = File(folder, "Binaries/Game.exe")
|
||||
val before = AddedGames.scan(app).single { it.folder.absolutePath == folder.absolutePath }
|
||||
assertTrue(AddedGames.addExe(app, own) is AddedGames.AddResult.Existing)
|
||||
val game = AddedGames.scan(app).single { it.folder.absolutePath == folder.absolutePath }
|
||||
assertEquals(own.path, game.exe.path)
|
||||
assertTrue(game.guestExe.endsWith("/" + StoreLaunch.LAUNCHER))
|
||||
assertEquals(before.appId, game.appId)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun aDifferentPickedExeOnAnyStoreGameIsRunDirectly() {
|
||||
val folder = install(Store.GOG, "tool", "Tool GOG", "Binaries/Game.exe", launcher = true)
|
||||
val tool = File(folder, "Tools/Editor.exe").apply { parentFile!!.mkdirs(); writeText("tool") }
|
||||
AddedExes.put(app, AddedExes.Entry(folder.path, tool.path, picked = true))
|
||||
val game = AddedGames.scan(app).single { it.folder.absolutePath == folder.absolutePath }
|
||||
assertTrue(game.guestExe.endsWith("/Tools/Editor.exe"))
|
||||
}
|
||||
|
||||
@Test fun anOlderSidecarsSteamSwitchIsIgnoredEveryInstallIsListed() {
|
||||
val folder = install(Store.AMAZON, "amzn1.adg.product.x", "Yakuza 0", "Yakuza0.exe")
|
||||
val file = StoreGameSidecar.file(folder)
|
||||
@@ -116,4 +137,30 @@ class AddedGamesStoreScanTest {
|
||||
val game = AddedGames.scan(app).single { it.folder.absolutePath == folder.absolutePath }
|
||||
assertEquals("/root/Games/Stores/GOG/Witcher Game", game.guestDir)
|
||||
}
|
||||
|
||||
@Test fun aStoreGameThatIsUpdatingIsNotListedThroughItsSavedExe() {
|
||||
val folder = install(Store.GOG, "upd", "Updating GOG", "Binaries/Game.exe", launcher = true)
|
||||
val own = File(folder, "Binaries/Game.exe")
|
||||
assertTrue(AddedGames.addExe(app, own) is AddedGames.AddResult.Existing)
|
||||
assertTrue(AddedGames.scan(app).any { it.folder.absolutePath == folder.absolutePath })
|
||||
StoreGameSidecar.read(folder)!!.copy(state = StoreGameSidecar.STATE_UPDATING).write(folder)
|
||||
assertTrue(AddedGames.scan(app).none { it.folder.absolutePath == folder.absolutePath })
|
||||
}
|
||||
|
||||
@Test fun reselectingTheMappedExeReplacesAnUnmappedAliasOfIt() {
|
||||
val folder = install(Store.EPIC, "alias", "Alias Epic", "Binaries/Game.exe", launcher = true)
|
||||
val own = File(folder, "Binaries/Game.exe")
|
||||
val alias = File(java.nio.file.Files.createTempDirectory("alias").toFile(), "bin")
|
||||
try {
|
||||
java.nio.file.Files.createSymbolicLink(alias.toPath(), File(folder, "Binaries").toPath())
|
||||
} catch (e: Exception) {
|
||||
org.junit.Assume.assumeNoException(e)
|
||||
}
|
||||
val aliased = File(alias, "Game.exe")
|
||||
assertNull(AddedGames.guestPath(app, aliased))
|
||||
SessionPrefs.setAddedGameExe(app, folder.path, aliased.path)
|
||||
assertTrue(AddedGames.addExe(app, own) is AddedGames.AddResult.Existing)
|
||||
assertEquals(own.path, SessionPrefs.addedGameExe(app, folder.path))
|
||||
assertEquals(own.path, AddedExes.list(app).single { it.folder == folder.path }.exe)
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.frontend
|
||||
import com.droiddeck.launcher.session.GameStorage
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.stores.StoreGameSidecar
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import java.io.File
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
@@ -182,6 +183,41 @@ class GamesFolderMigrationTest {
|
||||
assertEquals(listOf(pc.path to AddedGames.GUEST_DIR + "/PC"), binds)
|
||||
}
|
||||
|
||||
@Test fun aMigratedFolderNamedStoresDoesNotTakeTheInternalStoreGuest() {
|
||||
val stores = File(tmp.newFolder("card"), "Stores").apply { exe(this, "One/One.exe") }
|
||||
val pc = tmp.newFolder("PC").apply { exe(this, "Two/Two.exe") }
|
||||
SessionPrefs.setAddedGamesDirs(app, listOf(stores.path, pc.path))
|
||||
GamesFolderMigration.run(app)
|
||||
val binds = SessionPrefs.gameFolderBinds(app).toMap()
|
||||
assertTrue(binds.getValue(stores.path) != StoreInstallRoot.INTERNAL_GUEST)
|
||||
assertEquals(AddedGames.GUEST_DIR + "/PC", binds.getValue(pc.path))
|
||||
val games = AddedGames.scan(app).associateBy { it.name }
|
||||
assertEquals(binds.getValue(stores.path) + "/One/One.exe", games.getValue("One").guestExe)
|
||||
}
|
||||
|
||||
@Test fun aSavedBindAtTheInternalStoreGuestIsRepathed() {
|
||||
val stores = File(tmp.newFolder("card"), "Stores").apply { exe(this, "One/One.exe") }
|
||||
val pc = tmp.newFolder("PC").apply { exe(this, "Two/Two.exe") }
|
||||
SessionPrefs.setGameFolderBinds(
|
||||
app,
|
||||
listOf(stores.path to StoreInstallRoot.INTERNAL_GUEST, pc.path to AddedGames.GUEST_DIR + "/PC"),
|
||||
)
|
||||
GamesFolderMigration.run(app)
|
||||
val binds = SessionPrefs.gameFolderBinds(app).toMap()
|
||||
assertTrue(binds.getValue(stores.path) != StoreInstallRoot.INTERNAL_GUEST)
|
||||
assertTrue(binds.getValue(stores.path).startsWith("${AddedGames.GUEST_DIR}/Stores-"))
|
||||
assertEquals(AddedGames.GUEST_DIR + "/PC", binds.getValue(pc.path))
|
||||
assertTrue(binds.values.none { it == StoreInstallRoot.INTERNAL_GUEST })
|
||||
assertEquals(binds.getValue(stores.path) + "/One/One.exe", AddedGames.guestPath(app, File(stores, "One/One.exe")))
|
||||
val installer = File(stores, "GOG/Game/setup_1.exe").apply { parentFile?.mkdirs(); writeText("MZ") }
|
||||
val guestInstaller = AddedGames.guestPath(app, installer)!!
|
||||
val extractorBinds = StoreInstallRoot.guestBinds(app).map { it.substringBeforeLast(':') to it.substringAfterLast(':') }
|
||||
val covering = extractorBinds.filter { (_, mount) -> guestInstaller.startsWith("$mount/") }.maxByOrNull { it.second.length }!!
|
||||
assertEquals(installer.canonicalFile, File(covering.first + guestInstaller.removePrefix(covering.second)).canonicalFile)
|
||||
val internalInstaller = "${StoreInstallRoot.INTERNAL_GUEST}/GOG/Game/setup_1.exe"
|
||||
assertTrue(extractorBinds.none { (_, mount) -> internalInstaller == mount || internalInstaller.startsWith("$mount/") })
|
||||
}
|
||||
|
||||
@Test fun twoFoldersOfOneNameKeepTheirOwnGuestPaths() {
|
||||
val a = File(tmp.newFolder("a"), "Games").apply { mkdirs() }
|
||||
val b = File(tmp.newFolder("b"), "Games").apply { mkdirs() }
|
||||
|
||||
@@ -32,4 +32,9 @@ class SocNamesTest {
|
||||
assertNull(SocNames.name("SM8975-PRO", ""))
|
||||
assertNull(SocNames.name("Qualcomm SM8975", ""))
|
||||
}
|
||||
@Test fun plainNameNeverGuessesFromThePlatform() {
|
||||
assertEquals("Snapdragon 8 Gen 2 (SM8550)", SocNames.plainName("SM8550", "QTI"))
|
||||
assertEquals("Moorechip CQ7790S", SocNames.plainName("CQ7790S", "Moorechip"))
|
||||
assertEquals("CQ7790S", SocNames.plainName("CQ7790S", ""))
|
||||
}
|
||||
}
|
||||
@@ -694,22 +694,22 @@ class InputLibraryTest {
|
||||
for (desktop in listOf(false, true)) for (panel in listOf(null, InputStockLayouts.TRACKPAD) + DeckPanel.entries.map { it.bindings }) {
|
||||
val shown = library.panelLayout(desktop, panel)!!.elements
|
||||
assertTrue(shown.isNotEmpty())
|
||||
assertFalse(library.compileActive(desktop, panel).showsMouseButton(InputRole.SECONDARY, shown, library.compileStock(desktop, panel)))
|
||||
assertFalse(library.compileActive(desktop, panel).showsLeftMouseButton(InputRole.SECONDARY, shown, library.compileStock(desktop, panel)))
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun userBoundSecondScreenMouseButtonIsDetected() {
|
||||
@Test fun userBoundSecondScreenLeftMouseButtonIsDetected() {
|
||||
val stock = InputLibraries.read(context)
|
||||
val grips = DeckPanel.GRIPS.bindings
|
||||
val button = stock.panelLayout(false, grips)!!.elements.first { it.control.dimensions == 1 }
|
||||
val bound = stock.withPreset(stock.preset(grips).copy(elements = mapOf(button.id to InputAction.MouseButton(272))))
|
||||
for (desktop in listOf(false, true)) {
|
||||
assertTrue(bound.compileActive(desktop, grips).showsMouseButton(InputRole.SECONDARY, listOf(button), bound.compileStock(desktop, grips)))
|
||||
assertFalse(bound.compileActive(desktop, grips).showsMouseButton(InputRole.PRIMARY, listOf(button), bound.compileStock(desktop, grips)))
|
||||
assertTrue(bound.compileActive(desktop, grips).showsLeftMouseButton(InputRole.SECONDARY, listOf(button), bound.compileStock(desktop, grips)))
|
||||
assertFalse(bound.compileActive(desktop, grips).showsLeftMouseButton(InputRole.PRIMARY, listOf(button), bound.compileStock(desktop, grips)))
|
||||
}
|
||||
val pad = stock.panelLayout(true, InputStockLayouts.TRACKPAD)!!.elements.single()
|
||||
val rebound = stock.withPreset(stock.preset(InputStockLayouts.TRACKPAD).let { it.copy(clicks = it.clicks + (pad.id to InputAction.MouseButton(273))) })
|
||||
assertTrue(rebound.compileActive(true).showsMouseButton(InputRole.SECONDARY, listOf(pad), rebound.compileStock(true)))
|
||||
assertFalse(rebound.compileActive(true).showsLeftMouseButton(InputRole.SECONDARY, listOf(pad), rebound.compileStock(true)))
|
||||
}
|
||||
|
||||
@Test fun copiedStockPanelsKeepTapsClickingUntilAMouseButtonIsAdded() {
|
||||
@@ -720,13 +720,13 @@ class InputLibraryTest {
|
||||
val layout = copied.activeLayout(desktop, InputRole.SECONDARY)!!
|
||||
assertNotEquals(source.id, layout.id)
|
||||
assertEquals(source.id, layout.origin)
|
||||
assertFalse(copied.compileActive(desktop).showsMouseButton(InputRole.SECONDARY, layout.elements, copied.compileStock(desktop)))
|
||||
assertFalse(copied.compileActive(desktop).showsLeftMouseButton(InputRole.SECONDARY, layout.elements, copied.compileStock(desktop)))
|
||||
val added = InputSurfaceElement(InputControl.A, .4f, .4f, .1f, .1f, id = "custom:added")
|
||||
val grown = copied.withLayout(layout.copy(elements = layout.elements + added))
|
||||
val bindings = grown.activePart(desktop, InputRole.SECONDARY).bindings
|
||||
val bound = grown.withPreset(grown.preset(bindings).let { it.copy(elements = it.elements + (added.id to InputAction.MouseButton(272))) })
|
||||
assertTrue(bound.compileActive(desktop).showsMouseButton(InputRole.SECONDARY, layout.elements + added, bound.compileStock(desktop)))
|
||||
assertFalse(bound.compileActive(desktop).showsMouseButton(InputRole.SECONDARY, layout.elements, bound.compileStock(desktop)))
|
||||
assertTrue(bound.compileActive(desktop).showsLeftMouseButton(InputRole.SECONDARY, layout.elements + added, bound.compileStock(desktop)))
|
||||
assertFalse(bound.compileActive(desktop).showsLeftMouseButton(InputRole.SECONDARY, layout.elements, bound.compileStock(desktop)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,57 +15,73 @@ class OnScreenMouseButtonTest {
|
||||
private fun profile(vararg elements: Pair<String, InputAction>, clicks: Map<String, InputAction> = emptyMap(), base: InputProfile = game) =
|
||||
base.copy(elements = mapOf(InputRole.PRIMARY to elements.toMap()), clicks = mapOf(InputRole.PRIMARY to clicks))
|
||||
|
||||
@Test fun shownButtonBoundToAMouseButtonIsDetected() {
|
||||
listOf(272, 273, 274).forEach { code ->
|
||||
assertTrue(profile(button.id to InputAction.MouseButton(code)).showsMouseButton(InputRole.PRIMARY, listOf(stick, button), game))
|
||||
@Test fun shownButtonBoundToTheLeftMouseButtonIsDetected() {
|
||||
assertTrue(profile(button.id to InputAction.MouseButton(272)).showsLeftMouseButton(InputRole.PRIMARY, listOf(stick, button), game))
|
||||
}
|
||||
|
||||
@Test fun rightOrMiddleMouseButtonAloneKeepsTapsClicking() {
|
||||
listOf(273, 274, 275, 276).forEach { code ->
|
||||
assertFalse(profile(button.id to InputAction.MouseButton(code)).showsLeftMouseButton(InputRole.PRIMARY, listOf(stick, button), game))
|
||||
val stickClick = profile(stick.id to InputAction.Native(), clicks = mapOf(stick.id to InputAction.MouseButton(code)))
|
||||
assertFalse(stickClick.showsLeftMouseButton(InputRole.PRIMARY, listOf(stick), game))
|
||||
assertFalse(game.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(code)).showsLeftMouseButton(InputRole.PRIMARY, listOf(legacyA), game))
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun rightButtonNextToALeftButtonStillStopsTapClicks() {
|
||||
val right = InputSurfaceElement(InputControl.B, .7f, .6f, .1f, .1f, id = "custom:right")
|
||||
val both = profile(button.id to InputAction.MouseButton(272), right.id to InputAction.MouseButton(273))
|
||||
assertTrue(both.showsLeftMouseButton(InputRole.PRIMARY, listOf(button, right), game))
|
||||
assertFalse(both.showsLeftMouseButton(InputRole.PRIMARY, listOf(right), game))
|
||||
}
|
||||
|
||||
@Test fun stickClickBoundToAMouseButtonIsDetected() {
|
||||
val profile = profile(stick.id to InputAction.Native(), clicks = mapOf(stick.id to InputAction.MouseButton(272)))
|
||||
assertTrue(profile.showsMouseButton(InputRole.PRIMARY, listOf(stick), game))
|
||||
assertTrue(profile.showsLeftMouseButton(InputRole.PRIMARY, listOf(stick), game))
|
||||
}
|
||||
|
||||
@Test fun legacyButtonUsesItsRoleBinding() {
|
||||
val profile = game.withBinding(InputRole.PRIMARY, InputControl.A, InputAction.MouseButton(272))
|
||||
assertTrue(profile.showsMouseButton(InputRole.PRIMARY, listOf(legacyA), game))
|
||||
assertFalse(profile.showsMouseButton(InputRole.SECONDARY, listOf(legacyA), game))
|
||||
assertTrue(profile.showsLeftMouseButton(InputRole.PRIMARY, listOf(legacyA), game))
|
||||
assertFalse(profile.showsLeftMouseButton(InputRole.SECONDARY, listOf(legacyA), game))
|
||||
}
|
||||
|
||||
@Test fun stockDesktopOverlayKeepsTapsClicking() {
|
||||
assertFalse(desktop.showsMouseButton(InputRole.PRIMARY, overlay, desktop))
|
||||
assertFalse(desktop.showsLeftMouseButton(InputRole.PRIMARY, overlay, desktop))
|
||||
}
|
||||
|
||||
@Test fun userBoundMouseButtonInDesktopIsDetected() {
|
||||
val rebound = desktop.withBinding(InputRole.PRIMARY, InputControl.X, InputAction.MouseButton(272))
|
||||
assertTrue(rebound.showsMouseButton(InputRole.PRIMARY, overlay, desktop))
|
||||
val stickClick = desktop.withBinding(InputRole.PRIMARY, InputControl.L3, InputAction.MouseButton(274))
|
||||
assertTrue(stickClick.showsMouseButton(InputRole.PRIMARY, overlay, desktop))
|
||||
assertTrue(profile(button.id to InputAction.MouseButton(272), base = desktop).showsMouseButton(InputRole.PRIMARY, overlay + button, desktop))
|
||||
assertTrue(rebound.showsLeftMouseButton(InputRole.PRIMARY, overlay, desktop))
|
||||
val stickClick = desktop.withBinding(InputRole.PRIMARY, InputControl.L3, InputAction.MouseButton(272))
|
||||
assertTrue(stickClick.showsLeftMouseButton(InputRole.PRIMARY, overlay, desktop))
|
||||
val middleStickClick = desktop.withBinding(InputRole.PRIMARY, InputControl.L3, InputAction.MouseButton(274))
|
||||
assertFalse(middleStickClick.showsLeftMouseButton(InputRole.PRIMARY, overlay, desktop))
|
||||
assertTrue(profile(button.id to InputAction.MouseButton(272), base = desktop).showsLeftMouseButton(InputRole.PRIMARY, overlay + button, desktop))
|
||||
}
|
||||
|
||||
@Test fun desktopBindingsOnAGameBaseProfileAreUserPicked() {
|
||||
val copied = desktop.copy(id = "custom")
|
||||
assertTrue(copied.showsMouseButton(InputRole.PRIMARY, overlay, game))
|
||||
assertTrue(copied.showsLeftMouseButton(InputRole.PRIMARY, overlay, game))
|
||||
}
|
||||
|
||||
@Test fun layoutWithoutAMouseButtonKeepsTapsClicking() {
|
||||
val profile = profile(button.id to InputAction.Keys(listOf(57)), stick.id to InputAction.Pointer())
|
||||
assertFalse(profile.showsMouseButton(InputRole.PRIMARY, listOf(stick, button), game))
|
||||
assertFalse(game.showsMouseButton(InputRole.PRIMARY, listOf(legacyA, stick) + overlay, game))
|
||||
assertFalse(profile.showsLeftMouseButton(InputRole.PRIMARY, listOf(stick, button), game))
|
||||
assertFalse(game.showsLeftMouseButton(InputRole.PRIMARY, listOf(legacyA, stick) + overlay, game))
|
||||
}
|
||||
|
||||
@Test fun hiddenMouseButtonDoesNotCount() {
|
||||
assertFalse(profile(button.id to InputAction.MouseButton(272)).showsMouseButton(InputRole.PRIMARY, listOf(stick), game))
|
||||
assertFalse(profile(button.id to InputAction.MouseButton(272)).showsMouseButton(InputRole.PRIMARY, emptyList(), game))
|
||||
assertFalse(profile(button.id to InputAction.MouseButton(272)).showsLeftMouseButton(InputRole.PRIMARY, listOf(stick), game))
|
||||
assertFalse(profile(button.id to InputAction.MouseButton(272)).showsLeftMouseButton(InputRole.PRIMARY, emptyList(), game))
|
||||
}
|
||||
|
||||
@Test fun physicalMouseBindingsDoNotCount() {
|
||||
val profile = game.withBinding(InputRole.PHYSICAL, InputControl.A, InputAction.MouseButton(272))
|
||||
assertFalse(profile.showsMouseButton(InputRole.PRIMARY, listOf(legacyA), game))
|
||||
assertFalse(profile.showsLeftMouseButton(InputRole.PRIMARY, listOf(legacyA), game))
|
||||
}
|
||||
|
||||
@Test fun invalidMouseCodeDoesNotCount() {
|
||||
assertFalse(profile(button.id to InputAction.MouseButton(1)).showsMouseButton(InputRole.PRIMARY, listOf(button), game))
|
||||
assertFalse(profile(button.id to InputAction.MouseButton(1)).showsLeftMouseButton(InputRole.PRIMARY, listOf(button), game))
|
||||
}
|
||||
}
|
||||
@@ -216,6 +216,41 @@ class BattleNetTest {
|
||||
assertNull(BattleNet.hostFolder(context, "G:\\etc\\passwd"))
|
||||
}
|
||||
|
||||
@Test fun aDriveAtTheAppDataFolderHoldingTheRuntimeListsTheGamesInside() {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
val data = context.filesDir.parentFile!!
|
||||
val pfx = File(BattleNet.prefix(context), "pfx")
|
||||
val devices = File(pfx, "dosdevices").apply { mkdirs() }
|
||||
java.nio.file.Files.createSymbolicLink(File(devices, "d:").toPath(), data.absoluteFile.toPath())
|
||||
java.nio.file.Files.createSymbolicLink(File(devices, "e:").toPath(), java.nio.file.Paths.get("/root/Games/Card"))
|
||||
val wow = File(root, "root/Games/Stores/Battle.net/World of Warcraft").apply { mkdirs() }
|
||||
File(wow, "_forever_").mkdirs()
|
||||
val drive = "D:/" + data.absoluteFile.toPath().relativize(wow.absoluteFile.toPath()).joinToString("/")
|
||||
File(pfx, "drive_c/ProgramData/Battle.net/Agent").mkdirs()
|
||||
File(pfx, "drive_c/ProgramData/Battle.net/Agent/product.db").writeBytes(message(
|
||||
field(1, message(field(1, "wowf"), field(2, "wowf"), field(3, message(field(1, drive))))),
|
||||
))
|
||||
assertEquals(wow, BattleNet.hostFolder(context, drive))
|
||||
assertEquals(wow, BattleNet.games(context).single().folder)
|
||||
assertEquals(File(root, "root/Games/Card/Battle.net/X"), BattleNet.hostFolder(context, "E:\\Battle.net\\X"))
|
||||
assertNull(BattleNet.hostFolder(context, "D:\\..\\etc"))
|
||||
}
|
||||
|
||||
@Test fun aDriveAtAnAliasOfTheAppDataFolderListsTheGameUnderTheRuntimePath() {
|
||||
val root = LinuxRuntime.rootDir(context)
|
||||
val data = context.filesDir.parentFile!!
|
||||
val alias = File(data.parentFile, "alias-" + data.name)
|
||||
java.nio.file.Files.createSymbolicLink(alias.toPath(), data.absoluteFile.toPath())
|
||||
try {
|
||||
val devices = File(BattleNet.prefix(context), "pfx/dosdevices").apply { mkdirs() }
|
||||
java.nio.file.Files.createSymbolicLink(File(devices, "d:").toPath(), alias.absoluteFile.toPath())
|
||||
val game = File(root, "root/Games/Stores/Battle.net/StarCraft").apply { mkdirs() }
|
||||
val drive = "D:\\" + data.absoluteFile.toPath().relativize(game.absoluteFile.toPath()).joinToString("\\")
|
||||
assertEquals(game.path, BattleNet.hostFolder(context, drive)?.path)
|
||||
} finally {
|
||||
java.nio.file.Files.delete(alias.toPath())
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun wowForeverIsListedBesideRetailInTheSharedWorldOfWarcraftFolder() {
|
||||
val pfx = File(BattleNet.prefix(context), "pfx").apply { mkdirs() }
|
||||
@@ -274,6 +309,21 @@ class BattleNetTest {
|
||||
assertEquals(mapOf("WoWF" to root), BattleNet.ownFolders(mapOf("WoWF" to (forever to root)), mapOf("WoWF" to "/elsewhere")))
|
||||
}
|
||||
|
||||
@Test fun aFolderSavedThroughAnAliasOfTheAppDataFolderIsKept() {
|
||||
val data = context.filesDir.parentFile!!
|
||||
val root = File(context.filesDir, "World of Warcraft").apply { mkdirs() }
|
||||
val foreverDir = File(root, "_forever_").apply { mkdirs() }
|
||||
val forever = BattleNet.title("wow_forever")!!
|
||||
val alias = File(data.parentFile, "alias-" + data.name)
|
||||
java.nio.file.Files.createSymbolicLink(alias.toPath(), data.absoluteFile.toPath())
|
||||
try {
|
||||
val saved = File(alias, data.absoluteFile.toPath().relativize(foreverDir.absoluteFile.toPath()).toString()).path
|
||||
assertEquals(mapOf("WoWF" to foreverDir), BattleNet.ownFolders(mapOf("WoWF" to (forever to root)), mapOf("WoWF" to saved)))
|
||||
} finally {
|
||||
java.nio.file.Files.delete(alias.toPath())
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun theListedFolderIsRememberedAcrossScans() {
|
||||
val pfx = File(BattleNet.prefix(context), "pfx").apply { mkdirs() }
|
||||
val wow = File(pfx, "drive_c/Program Files (x86)/World of Warcraft").apply { mkdirs() }
|
||||
|
||||
@@ -61,9 +61,11 @@ class BwrapSpawnerTest {
|
||||
"DDNATV_ROOT" to rootfs, "DDNATV_BINDS" to "/dev:/dev", "HOME" to "/root",
|
||||
"SPA_PLUGIN_DIR" to "/usr/local/lib/droiddeck-pipewire/lib/spa-0.2",
|
||||
"LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so:$rootfs/usr/local/lib/libddsession.so:$rootfs/usr/lib/libddnatv-hook.so",
|
||||
"DROIDDECK_FDS" to "droiddeck-fds-1",
|
||||
)
|
||||
BwrapSpawner.withoutRootfsSettings(env, rootfs)
|
||||
assertEquals(mapOf("HOME" to "/root", "LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so"), env)
|
||||
assertEquals(mapOf("HOME" to "/root", "LD_PRELOAD" to "/run/droiddeck-preload/libddsession.so",
|
||||
"DROIDDECK_FDS" to "droiddeck-fds-1"), env)
|
||||
val onlySession = mutableMapOf("LD_PRELOAD" to "$rootfs/usr/lib/libddnatv-hook.so")
|
||||
BwrapSpawner.withoutRootfsSettings(onlySession, rootfs)
|
||||
assertTrue(onlySession.isEmpty())
|
||||
|
||||
@@ -45,7 +45,7 @@ class NativeGuestTest {
|
||||
val command = NativeGuest.command(root, "/usr/bin/env", listOf("-i", "A=1"))
|
||||
assertEquals(File(root, "usr/lib/ld-linux-aarch64.so.1").path, command[0])
|
||||
assertEquals(listOf("--library-path", NativeGuest.libraryPath(root), "--argv0", "env", File(root, "usr/bin/env").path, "-i", "A=1"), command.drop(1))
|
||||
assertTrue("LD_LIBRARY_PATH" !in NativeGuest.environment(root))
|
||||
assertTrue("LD_LIBRARY_PATH" !in NativeGuest.environment(root, "/usr/bin/env"))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -79,13 +79,22 @@ class NativeGuestTest {
|
||||
@Test
|
||||
fun mountsWithoutADestinationMapToThemselves() {
|
||||
val root = rootWithLoader()
|
||||
val env = NativeGuest.sessionEnvironment(root, listOf("/dev", "/a:/b"))
|
||||
val env = NativeGuest.sessionEnvironment(root, listOf("/dev", "/a:/b"), "/usr/bin/env")
|
||||
assertEquals("/dev:/dev|/a:/b", env["DDNATV_BINDS"])
|
||||
assertEquals(root.path, env["DDNATV_ROOT"])
|
||||
assertTrue("LD_LIBRARY_PATH" !in env)
|
||||
assertTrue(env.getValue("LD_PRELOAD").replace(File.separatorChar, '/').endsWith("usr/lib/libddnatv-hook.so"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theProgramTheLoaderRunsIsNamedInItsEnvironment() {
|
||||
val root = rootWithLoader()
|
||||
val program = NativeGuest.command(root, "/usr/bin/env", listOf("-i"))[5]
|
||||
assertEquals(program, NativeGuest.sessionEnvironment(root, listOf("/dev"), "/usr/bin/env")["DDNATV_REAL_EXE"])
|
||||
assertEquals(program, NativeGuest.environment(root, "/usr/bin/env")["DDNATV_REAL_EXE"])
|
||||
assertEquals(program, NativeGuest.builder(root, "/", listOf("/usr/bin/env", "-i"), emptyMap()).environment()["DDNATV_REAL_EXE"])
|
||||
}
|
||||
|
||||
private val linkRoot = "/data/user/0/app/files/linuxfs"
|
||||
private val sdBinds = listOf(
|
||||
"/mnt/media_rw/CARD/files/steam:/mnt/droiddeck-sd",
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28], manifest = Config.NONE)
|
||||
class ComponentsBionicFexTest {
|
||||
private val bionicTool = "DroidDeck-Bionic-12.8-r24"
|
||||
private val ownTool = "DroidDeck-Proton-11-12.8"
|
||||
|
||||
private fun proton(dir: String, valve: Boolean = false) =
|
||||
ComponentsManager.Proton(dir, dir, File("/steam/compatibilitytools.d/$dir"), "/p/$dir", "$dir-1", valve)
|
||||
|
||||
private fun item(file: String, release: String) = ComponentsManager.CatalogItem(file, "fex", release, "", 1, "")
|
||||
|
||||
@Test fun onlyBionicNamedPackagesFitDroidDeckBionic() {
|
||||
assertTrue(ComponentsManager.bionicFex("FEXCore-2611.1-bionic.wcp"))
|
||||
assertTrue(ComponentsManager.bionicFex("FEXCore-2611.1-PPA-BIONIC.WCP"))
|
||||
assertFalse(ComponentsManager.bionicFex("FEXCore-2611.1-linux.wcp"))
|
||||
assertFalse(ComponentsManager.bionicFex("DD-FEXCore-2611+51-nightly.wcp"))
|
||||
assertFalse(ComponentsManager.bionicFex("bionic-FEXCore-2611.wcp"))
|
||||
assertTrue(ComponentsManager.bionicTool(bionicTool))
|
||||
assertFalse(ComponentsManager.bionicTool(ownTool))
|
||||
assertFalse(ComponentsManager.bionicTool("GE-Proton10-25"))
|
||||
assertFalse(ComponentsManager.bionicTool(null))
|
||||
assertTrue(ComponentsManager.fexFits(bionicTool, "FEXCore-2611-bionic.wcp"))
|
||||
assertFalse(ComponentsManager.fexFits(bionicTool, "FEXCore-2611-linux.wcp"))
|
||||
assertFalse(ComponentsManager.fexFits(bionicTool, "DD-FEXCore-2611+51-nightly.wcp"))
|
||||
assertTrue(ComponentsManager.fexFits(ownTool, "DD-FEXCore-2611+51-nightly.wcp"))
|
||||
assertTrue(ComponentsManager.fexFits(ownTool, "FEXCore-2611-linux.wcp"))
|
||||
assertFalse(ComponentsManager.fexFits(ownTool, "FEXCore-2611-bionic.wcp"))
|
||||
assertFalse(ComponentsManager.fexFits(null, "FEXCore-2611-bionic.wcp"))
|
||||
}
|
||||
|
||||
@Test fun aTwinSwapsTheLinuxAndBionicEnding() {
|
||||
assertEquals("FEXCore-2611.1-bionic.wcp", ComponentsManager.fexTwin("FEXCore-2611.1-linux.wcp"))
|
||||
assertEquals("FEXCore-2611.1-linux.wcp", ComponentsManager.fexTwin("FEXCore-2611.1-bionic.wcp"))
|
||||
assertEquals("FEXCore-2611-PPA-bionic.wcp", ComponentsManager.fexTwin("FEXCore-2611-PPA-linux.wcp"))
|
||||
assertNull(ComponentsManager.fexTwin("DD-FEXCore-2611+51-nightly.wcp"))
|
||||
assertNull(ComponentsManager.fexTwin("my-fex.wcp"))
|
||||
}
|
||||
|
||||
@Test fun aLaunchTakesTheChoiceOrItsStoredTwinForEachFlavor() {
|
||||
val stored = setOf("FEXCore-2611.1-linux.wcp", "FEXCore-2611.1-bionic.wcp", "FEXCore-2610-linux.wcp")
|
||||
val has: (String) -> Boolean = { it in stored }
|
||||
assertEquals("FEXCore-2611.1-bionic.wcp", ComponentsManager.launchFex(bionicTool, "FEXCore-2611.1-linux.wcp", has))
|
||||
assertEquals("FEXCore-2611.1-bionic.wcp", ComponentsManager.launchFex(bionicTool, "FEXCore-2611.1-bionic.wcp", has))
|
||||
assertEquals("FEXCore-2611.1-linux.wcp", ComponentsManager.launchFex(ownTool, "FEXCore-2611.1-bionic.wcp", has))
|
||||
assertEquals("FEXCore-2610-linux.wcp", ComponentsManager.launchFex(ownTool, "FEXCore-2610-linux.wcp", has))
|
||||
assertEquals("DD-FEXCore-2611+51-nightly.wcp", ComponentsManager.launchFex(ownTool, "DD-FEXCore-2611+51-nightly.wcp", has))
|
||||
assertNull(ComponentsManager.launchFex(bionicTool, "FEXCore-2610-linux.wcp", has))
|
||||
assertNull(ComponentsManager.launchFex(bionicTool, "DD-FEXCore-2611+51-nightly.wcp", has))
|
||||
}
|
||||
|
||||
@Test fun fexListsShowTheProtonsFlavorAndTheCurrentChoice() {
|
||||
val files = listOf("FEXCore-2611.1-linux.wcp", "FEXCore-2611.1-bionic.wcp", "DD-FEXCore-2611+51-nightly.wcp", "FEXCore-2610-bionic.wcp")
|
||||
assertEquals(listOf("FEXCore-2611.1-bionic.wcp", "FEXCore-2610-bionic.wcp"), ComponentsManager.forTool("fex", bionicTool, files) { it })
|
||||
assertEquals(listOf("FEXCore-2611.1-linux.wcp", "DD-FEXCore-2611+51-nightly.wcp"), ComponentsManager.forTool("fex", ownTool, files) { it })
|
||||
assertEquals(listOf("FEXCore-2611.1-linux.wcp", "DD-FEXCore-2611+51-nightly.wcp"), ComponentsManager.forTool("fex", null, files) { it })
|
||||
assertEquals(listOf("FEXCore-2611.1-linux.wcp", "FEXCore-2611.1-bionic.wcp", "FEXCore-2610-bionic.wcp"),
|
||||
ComponentsManager.forTool("fex", bionicTool, files, selected = "FEXCore-2611.1-linux.wcp") { it })
|
||||
assertEquals(files, ComponentsManager.forTool("dxvk", bionicTool, files) { it })
|
||||
}
|
||||
|
||||
@Test fun bionicStableAssetsAreFex() {
|
||||
assertEquals("fex", ComponentsManager.assetComp(ComponentsManager.DD_BIONIC, "FEXCore-2611.1-bionic.wcp"))
|
||||
assertEquals("fex", ComponentsManager.assetComp(ComponentsManager.DD_BIONIC, "FEXCore-2610-PPA-bionic.wcp"))
|
||||
assertEquals("fex", ComponentsManager.assetComp("FexCore-Linux", "FEXCore-2611.1-linux.wcp"))
|
||||
}
|
||||
|
||||
@Test fun aGameFexChoiceKeepsItsTwinInUseWhileTheOtherFlavorIsInstalled() {
|
||||
val state = JSONObject().put("profiles", JSONObject().put("42", JSONObject().put("fex", "FEXCore-2611.1-linux.wcp")))
|
||||
assertEquals(setOf("FEXCore-2611.1-linux.wcp"), ComponentsManager.packagesInUse(state, listOf(proton(ownTool))))
|
||||
assertEquals(setOf("FEXCore-2611.1-linux.wcp", "FEXCore-2611.1-bionic.wcp"),
|
||||
ComponentsManager.packagesInUse(state, listOf(proton(ownTool), proton(bionicTool))))
|
||||
}
|
||||
|
||||
@Test fun aTwinAGameChoiceStillNeedsCannotBeDeletedAsUnused() {
|
||||
val state = JSONObject().put("profiles", JSONObject().put("42", JSONObject().put("fex", "FEXCore-2611.1-linux.wcp")))
|
||||
assertEquals(bionicTool, ComponentsManager.twinUser(state, listOf(proton(ownTool), proton(bionicTool)), "FEXCore-2611.1-bionic.wcp")?.dir?.name)
|
||||
assertEquals(null, ComponentsManager.twinUser(state, listOf(proton(ownTool)), "FEXCore-2611.1-bionic.wcp"))
|
||||
assertEquals(null, ComponentsManager.twinUser(state, listOf(proton(ownTool), proton(bionicTool)), "FEXCore-2610-bionic.wcp"))
|
||||
assertEquals(null, ComponentsManager.twinUser(JSONObject(), listOf(proton(bionicTool)), "FEXCore-2611.1-bionic.wcp"))
|
||||
}
|
||||
|
||||
@Test fun droidDeckBionicFollowsTheNewestBionicFexAndNothingElse() {
|
||||
val bionic = proton(bionicTool)
|
||||
val own = proton(ownTool)
|
||||
assertTrue(ComponentUpdates.autoFollows(bionic, "fex"))
|
||||
assertFalse(ComponentUpdates.autoFollows(bionic, "dxvk"))
|
||||
assertFalse(ComponentUpdates.autoFollows(bionic, "vkd3d"))
|
||||
assertFalse(ComponentUpdates.autoFollows(proton(bionicTool, valve = true), "fex"))
|
||||
assertFalse(ComponentUpdates.follows(bionic))
|
||||
assertTrue(ComponentUpdates.autoFollows(own, "dxvk"))
|
||||
assertFalse(ComponentUpdates.autoFollows(proton("GE-Proton10-25"), "fex"))
|
||||
assertEquals("fex-bionic", ComponentUpdates.fexLine(bionic).key)
|
||||
assertEquals("fex", ComponentUpdates.fexLine(own).key)
|
||||
assertEquals("fex", ComponentUpdates.line("fex", false).key)
|
||||
|
||||
val catalog = listOf(
|
||||
item("DD-FEXCore-2611+51-nightly.wcp", ComponentsManager.DD_NIGHTLY),
|
||||
item("DD-FEXCore-2611+52-bionic.wcp", ComponentsManager.DD_NIGHTLY),
|
||||
item("FEXCore-2611.1-linux.wcp", "FexCore-Linux"),
|
||||
item("FEXCore-2610-bionic.wcp", ComponentsManager.DD_BIONIC),
|
||||
item("FEXCore-2611-PPA-bionic.wcp", ComponentsManager.DD_BIONIC),
|
||||
item("FEXCore-2611.1-bionic.wcp", ComponentsManager.DD_BIONIC),
|
||||
)
|
||||
assertEquals("FEXCore-2611.1-bionic.wcp", ComponentUpdates.pick(catalog, ComponentUpdates.fexLine(bionic), emptySet())?.file)
|
||||
assertNull(ComponentUpdates.pick(catalog, ComponentUpdates.fexLine(bionic), setOf("FEXCore-2611.1-bionic.wcp")))
|
||||
assertEquals("DD-FEXCore-2611+51-nightly.wcp", ComponentUpdates.pick(catalog, ComponentUpdates.fexLine(own), emptySet())?.file)
|
||||
}
|
||||
|
||||
@Test fun pruningTheBionicLineKeepsBionicPackagesTheUserDownloaded() {
|
||||
val line = ComponentUpdates.fexLine(proton(bionicTool))
|
||||
val current = "FEXCore-2611.1-bionic.wcp"
|
||||
val stored = listOf("FEXCore-2610-bionic.wcp", "FEXCore-2611-PPA-bionic.wcp", current, "FEXCore-2610-linux.wcp")
|
||||
assertEquals(listOf("FEXCore-2610-bionic.wcp"),
|
||||
ComponentUpdates.stale(line, setOf("FEXCore-2610-bionic.wcp", current), stored, setOf(current), current))
|
||||
}
|
||||
|
||||
@Test fun aBionicProtonsOwnFexChoiceIsNotHandedBack() {
|
||||
val bionic = proton(bionicTool)
|
||||
val choices = mapOf(bionic.id to mapOf(
|
||||
"fex" to ComponentsManager.Choice("FEXCore-2611.1-bionic.wcp", false, bionic.version),
|
||||
"dxvk" to ComponentsManager.Choice("DD-dxvk-3.1.1+190-nightly.wcp", false, bionic.version),
|
||||
))
|
||||
assertEquals(listOf(bionic to "dxvk"),
|
||||
ComponentUpdates.strays(listOf(bionic), choices, setOf("FEXCore-2611.1-bionic.wcp", "DD-dxvk-3.1.1+190-nightly.wcp")))
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertThrows
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
@@ -23,6 +24,7 @@ class ComponentsRepublishTest {
|
||||
private val fex = "FEXCore-2610-d2rfix28-linux.wcp"
|
||||
private val scope = "2596113170"
|
||||
private val dll = "files/lib/wine/aarch64-windows/libwow64fex.dll"
|
||||
private val so = "files/lib/wine/aarch64-unix/libwow64fex.so"
|
||||
private lateinit var context: Context
|
||||
|
||||
@Before fun setUp() {
|
||||
@@ -48,6 +50,61 @@ class ComponentsRepublishTest {
|
||||
assertEquals(fex, ComponentsManager.gameComponents(context, scope)["fex"])
|
||||
}
|
||||
|
||||
@Test fun aGlibcGameFexChoiceWithoutItsTwinLeavesDroidDeckBionicOnItsOwnFex() {
|
||||
proton("DroidDeck-Proton 11-12.8", "DroidDeck-Proton-11-12.8")
|
||||
proton("DroidDeck-Bionic-12.8-r6", "DroidDeck-Bionic-12.8-r6")
|
||||
packageFile()
|
||||
ComponentsManager.setGameComponent(context, scope, "fex", fex) { false }
|
||||
assertEquals(setOf("DroidDeck-Proton 11-12.8"), scopedTools())
|
||||
val bionic = rows().filter { it[1] == "DroidDeck-Bionic-12.8-r6" && it[3] == "fex" }
|
||||
assertTrue(bionic.isNotEmpty())
|
||||
assertTrue(bionic.all { it[0] == "*" && "/store/original-DroidDeck-Bionic-12.8-r6-" in it[6] })
|
||||
}
|
||||
|
||||
@Test fun aGameFexChoiceReachesEachProtonAsTheBuildOfItsFlavor() {
|
||||
proton("DroidDeck-Proton-11-12.8", "DroidDeck-Proton-11-12.8")
|
||||
proton("DroidDeck-Bionic-12.8-r24", "DroidDeck-Bionic-12.8-r24")
|
||||
val linux = "FEXCore-2611.1-linux.wcp"
|
||||
val bionic = "FEXCore-2611.1-bionic.wcp"
|
||||
packageFile(linux, "FEXCore-Linux", "glibc wow64")
|
||||
packageFile(bionic, "FEXCore-Bionic", "android wow64")
|
||||
|
||||
for (choice in listOf(linux, bionic)) {
|
||||
ComponentsManager.setGameComponent(context, scope, "fex", choice) { false }
|
||||
val scoped = rows().filter { it[0] == scope && it[3] == "fex" }
|
||||
val own = scoped.single { it[1] == "DroidDeck-Proton-11-12.8" && it[4] == dll }
|
||||
val android = scoped.single { it[1] == "DroidDeck-Bionic-12.8-r24" && it[4] == dll }
|
||||
assertEquals("glibc wow64", File(LinuxRuntime.rootDir(context), own[6].removePrefix("/")).readText())
|
||||
assertEquals("android wow64", File(LinuxRuntime.rootDir(context), android[6].removePrefix("/")).readText())
|
||||
assertTrue(scoped.any { it[1] == "DroidDeck-Proton-11-12.8" && it[6] == "-" })
|
||||
assertTrue(scoped.none { it[1] == "DroidDeck-Bionic-12.8-r24" && it[6] == "-" })
|
||||
assertEquals(choice, ComponentsManager.gameComponents(context, scope)["fex"])
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun aProtonsFexIsOnlyEverSwappedToABuildOfItsFlavor() {
|
||||
proton("DroidDeck-Proton-11-12.8", "DroidDeck-Proton-11-12.8")
|
||||
proton("DroidDeck-Bionic-12.8-r24", "DroidDeck-Bionic-12.8-r24")
|
||||
val linux = "FEXCore-2611.1-linux.wcp"
|
||||
val bionic = "FEXCore-2611.1-bionic.wcp"
|
||||
packageFile(linux, "FEXCore-Linux", "glibc wow64")
|
||||
packageFile(bionic, "FEXCore-Bionic", "android wow64")
|
||||
val bionicDll = File(protonDir("DroidDeck-Bionic-12.8-r24"), dll)
|
||||
val ownDll = File(protonDir("DroidDeck-Proton-11-12.8"), dll)
|
||||
|
||||
assertThrows(IllegalStateException::class.java) { ComponentsManager.swap(context, "DroidDeck-Bionic-12.8-r24", linux) }
|
||||
assertThrows(IllegalStateException::class.java) { ComponentsManager.swap(context, "DroidDeck-Proton-11-12.8", bionic) }
|
||||
assertEquals("bundled FEX DroidDeck-Bionic-12.8-r24", bionicDll.readText())
|
||||
assertEquals("bundled FEX DroidDeck-Proton-11-12.8", ownDll.readText())
|
||||
|
||||
ComponentsManager.swap(context, "DroidDeck-Bionic-12.8-r24", bionic)
|
||||
ComponentsManager.swap(context, "DroidDeck-Proton-11-12.8", linux)
|
||||
assertEquals("android wow64", bionicDll.readText())
|
||||
assertEquals("glibc wow64", ownDll.readText())
|
||||
assertTrue(File(protonDir("DroidDeck-Bionic-12.8-r24"), so).isFile)
|
||||
assertTrue(rows().none { it[1] == "DroidDeck-Bionic-12.8-r24" && it[3] == "fex" && it[6] == "-" })
|
||||
}
|
||||
|
||||
@Test fun nothingIsRewrittenWhileTheToolsAreUnchanged() {
|
||||
proton("DroidDeck-Proton 11-11.8", "DroidDeck-Proton-11-11.8")
|
||||
packageFile()
|
||||
@@ -117,18 +174,21 @@ class ComponentsRepublishTest {
|
||||
|
||||
private fun launchState() = File(LinuxRuntime.rootDir(context), "root/.local/share/droiddeck-components/desired.tsv")
|
||||
|
||||
private fun protonDir(name: String) = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/common/$name")
|
||||
|
||||
private fun proton(name: String, version: String) {
|
||||
val dir = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/common/$name")
|
||||
val dir = protonDir(name)
|
||||
File(dir, "files/lib/wine").mkdirs()
|
||||
File(dir, "proton").writeText("#!/bin/sh\n")
|
||||
File(dir, "version").writeText("1 $version\n")
|
||||
File(dir, dll).apply { parentFile!!.mkdirs(); writeText("bundled FEX $version") }
|
||||
File(dir, so).apply { parentFile!!.mkdirs(); writeText("bundled unix FEX $version") }
|
||||
}
|
||||
|
||||
private fun packageFile() {
|
||||
val out = File(context.filesDir, "components/packages/$fex").apply { parentFile!!.mkdirs() }
|
||||
val profile = JSONObject().put("type", "FEXCore-Linux").put("versionName", "2610-d2rfix28").toString().toByteArray()
|
||||
val body = "d2rfix28 wow64".toByteArray()
|
||||
private fun packageFile(name: String = fex, type: String = "FEXCore-Linux", text: String = "d2rfix28 wow64") {
|
||||
val out = File(context.filesDir, "components/packages/$name").apply { parentFile!!.mkdirs() }
|
||||
val profile = JSONObject().put("type", type).put("versionName", name.removeSuffix(".wcp")).toString().toByteArray()
|
||||
val body = text.toByteArray()
|
||||
TarArchiveOutputStream(ZstdOutputStream(out.outputStream())).use { tar ->
|
||||
tar.putArchiveEntry(TarArchiveEntry("profile.json").apply { size = profile.size.toLong() })
|
||||
tar.write(profile)
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import java.io.File
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.LinkOption
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Assume.assumeFalse
|
||||
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.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28], manifest = Config.NONE)
|
||||
class CpuCacheSysfsTest {
|
||||
@get:Rule val tmp = TemporaryFolder()
|
||||
|
||||
private fun cache(host: File, cpu: Int, vararg levels: Pair<Int, String?>) {
|
||||
levels.forEachIndexed { i, (level, size) ->
|
||||
val index = File(host, "cpu$cpu/cache/index$i").apply { mkdirs() }
|
||||
File(index, "level").writeText("$level\n")
|
||||
File(index, "type").writeText(if (level == 1) "Data\n" else "Unified\n")
|
||||
File(index, "shared_cpu_list").writeText("$cpu\n")
|
||||
if (size != null) File(index, "size").writeText(size)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun everyLevelReportsTheSizeTheEmulatedCpuidReports() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 1 to null, 2 to null, 3 to null)
|
||||
val root = tmp.newFolder("out")
|
||||
val out = File(root, "p/1")
|
||||
val binds = CpuCacheSysfs.binds(root, 1, host, "p")
|
||||
assertEquals(listOf(File(out, "cpu0").path + ":" + File(host, "cpu0/cache").path), binds)
|
||||
assertEquals("32K\n", File(out, "cpu0/index0/size").readText())
|
||||
assertEquals("512K\n", File(out, "cpu0/index1/size").readText())
|
||||
assertEquals("8192K\n", File(out, "cpu0/index2/size").readText())
|
||||
assertEquals("2\n", File(out, "cpu0/index1/level").readText())
|
||||
assertEquals("Unified\n", File(out, "cpu0/index1/type").readText())
|
||||
}
|
||||
|
||||
@Test fun aKernelSizeThatDisagreesWithTheEmulatedCpuidIsReplaced() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to "12288K\n")
|
||||
val root = tmp.newFolder("out")
|
||||
val out = File(root, "p/1")
|
||||
CpuCacheSysfs.binds(root, 1, host, "p")
|
||||
assertEquals("512K\n", File(out, "cpu0/index0/size").readText())
|
||||
assertEquals("12288K\n", File(host, "cpu0/cache/index0/size").readText())
|
||||
}
|
||||
|
||||
@Test fun everyCoreIsBoundAndACoreWithoutCacheInfoIsLeftAlone() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
cache(host, 1, 2 to null)
|
||||
File(host, "cpu2").mkdirs()
|
||||
File(host, "cpufreq").mkdirs()
|
||||
val root = tmp.newFolder("out")
|
||||
val out = File(root, "p/1")
|
||||
val binds = CpuCacheSysfs.binds(root, 1, host, "p")
|
||||
assertEquals(2, binds.size)
|
||||
assertFalse(File(out, "cpu2").exists())
|
||||
assertTrue(binds.none { it.contains("cpufreq") })
|
||||
}
|
||||
|
||||
@Test fun aLevelOutsideTheEmulatedCpuidIsNotGivenASize() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 4 to null)
|
||||
val root = tmp.newFolder("out")
|
||||
val out = File(root, "p/1")
|
||||
assertEquals(emptyList<String>(), CpuCacheSysfs.binds(root, 1, host, "p"))
|
||||
assertFalse(File(out, "cpu0/index0/size").exists())
|
||||
}
|
||||
|
||||
@Test fun stalePreviousSessionFilesAreRemoved() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
val root = tmp.newFolder("out")
|
||||
val out = File(root, "p/1")
|
||||
File(out, "cpu7/index0").mkdirs()
|
||||
CpuCacheSysfs.binds(root, 1, host, "p")
|
||||
assertFalse(File(out, "cpu7").exists())
|
||||
}
|
||||
|
||||
@Test fun aLinkLeftInTheStagedFolderIsRemovedWithoutTouchingItsTarget() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
val kept = tmp.newFolder("kept")
|
||||
File(kept, "file").writeText("x")
|
||||
val root = tmp.newFolder("out")
|
||||
val out = File(root, "p/1")
|
||||
File(out, "cpu0").mkdirs()
|
||||
Files.createSymbolicLink(File(out, "cpu0/link").toPath(), kept.toPath())
|
||||
CpuCacheSysfs.binds(root, 1, host, "p")
|
||||
assertFalse(Files.exists(File(out, "cpu0/link").toPath(), LinkOption.NOFOLLOW_LINKS))
|
||||
assertEquals("x", File(kept, "file").readText())
|
||||
}
|
||||
|
||||
@Test fun anUnreadableHostLeavesNoBinds() {
|
||||
assertEquals(emptyList<String>(), CpuCacheSysfs.binds(tmp.newFolder("out"), 1, File(tmp.root, "missing"), "p"))
|
||||
}
|
||||
|
||||
@Test fun earlierProcessesAndTheFlatLayoutAreRemoved() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
val root = tmp.newFolder("out")
|
||||
listOf("cpu0", "7", "old/1").forEach { File(root, "$it/cpu0/index0").mkdirs() }
|
||||
val binds = CpuCacheSysfs.binds(root, 3, host, "p")
|
||||
assertEquals(listOf(File(root, "p/3/cpu0").path + ":" + File(host, "cpu0/cache").path), binds)
|
||||
assertEquals(listOf("p"), root.list()!!.toList())
|
||||
}
|
||||
|
||||
@Test fun aDelayedEarlierStartKeepsTheNewerStartsSources() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
val root = tmp.newFolder("out")
|
||||
CpuCacheSysfs.binds(root, 2, host, "p")
|
||||
CpuCacheSysfs.binds(root, 1, host, "p")
|
||||
assertEquals("512K\n", File(root, "p/2/cpu0/index0/size").readText())
|
||||
assertEquals("512K\n", File(root, "p/1/cpu0/index0/size").readText())
|
||||
}
|
||||
|
||||
@Test fun aNewerStartKeepsTheEarlierStartsSources() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
val root = tmp.newFolder("out")
|
||||
CpuCacheSysfs.binds(root, 1, host, "p")
|
||||
CpuCacheSysfs.binds(root, 2, host, "p")
|
||||
assertEquals("512K\n", File(root, "p/1/cpu0/index0/size").readText())
|
||||
assertEquals("512K\n", File(root, "p/2/cpu0/index0/size").readText())
|
||||
}
|
||||
|
||||
@Test fun startsInOneProcessNeverShareAStagingFolder() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
val root = tmp.newFolder("out")
|
||||
val first = CpuCacheSysfs.binds(root, host = host, process = "p").single().substringBefore(':')
|
||||
val second = CpuCacheSysfs.binds(root, host = host, process = "p").single().substringBefore(':')
|
||||
assertTrue(first != second)
|
||||
assertEquals("512K\n", File(first, "index0/size").readText())
|
||||
assertEquals("512K\n", File(second, "index0/size").readText())
|
||||
}
|
||||
|
||||
@Test fun aDelayedWorkerFromARecreatedServiceKeepsItsOwnFolder() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
val root = tmp.newFolder("out")
|
||||
val ready = java.util.concurrent.CountDownLatch(2)
|
||||
val pool = java.util.concurrent.Executors.newFixedThreadPool(2)
|
||||
try {
|
||||
val starts = List(2) {
|
||||
pool.submit<String> {
|
||||
ready.countDown()
|
||||
ready.await()
|
||||
CpuCacheSysfs.binds(root, host = host, process = "p").single().substringBefore(':')
|
||||
}
|
||||
}.map { it.get(10, java.util.concurrent.TimeUnit.SECONDS) }
|
||||
assertEquals(2, starts.toSet().size)
|
||||
starts.forEach { assertEquals("512K\n", File(it, "index0/size").readText()) }
|
||||
} finally {
|
||||
pool.shutdownNow()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun aCoreWhoseMetadataCannotBeCopiedIsSkippedAndTheOthersStayBound() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to null)
|
||||
cache(host, 1, 2 to null, 4 to "1024K\n")
|
||||
val locked = File(host, "cpu1/cache/index1/size")
|
||||
locked.setReadable(false)
|
||||
assumeFalse(locked.canRead())
|
||||
val root = tmp.newFolder("out")
|
||||
val binds = CpuCacheSysfs.binds(root, 1, host, "p")
|
||||
assertEquals(listOf(File(root, "p/1/cpu0").path + ":" + File(host, "cpu0/cache").path), binds)
|
||||
}
|
||||
|
||||
@Test fun anUnreadableKernelSizeForAnEmulatedLevelIsStillReplaced() {
|
||||
val host = tmp.newFolder("host")
|
||||
cache(host, 0, 2 to "12288K\n")
|
||||
val locked = File(host, "cpu0/cache/index0/size")
|
||||
locked.setReadable(false)
|
||||
assumeFalse(locked.canRead())
|
||||
val root = tmp.newFolder("out")
|
||||
assertEquals(1, CpuCacheSysfs.binds(root, 1, host, "p").size)
|
||||
assertEquals("512K\n", File(root, "p/1/cpu0/index0/size").readText())
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,22 @@ class EnhancedSessionLogShareTest {
|
||||
SessionLogShare.clear(app)
|
||||
}
|
||||
|
||||
@Test fun aBionicGameLogIsSharedWithTheGamesUnderItsName() {
|
||||
val session = tmp.newFolder("2026-11-22-09-steam")
|
||||
session.resolve("session.log").writeText("startup ok\n")
|
||||
val launch = session.resolve("games/2026-11-22-201105-bionic-341940").apply { mkdirs() }
|
||||
launch.resolve("droiddeck-bionic.log").writeText("20:11:05 waitforexitandrun Hatred.exe\n")
|
||||
|
||||
val games = EnhancedSessionLogShare.create(app, session).single { it.name.endsWith("-games.zip") }
|
||||
|
||||
ZipFile(games).use { archive ->
|
||||
val entry = archive.getEntry("${session.name}/games/2026-11-22-201105-bionic-341940/droiddeck-bionic.log")
|
||||
assertTrue(entry != null)
|
||||
assertEquals("20:11:05 waitforexitandrun Hatred.exe\n", archive.getInputStream(entry).bufferedReader().readText())
|
||||
}
|
||||
SessionLogShare.clear(app)
|
||||
}
|
||||
|
||||
@Test fun oversizedFilesKeepBoundedBeginningAndTailAndDeclareTruncation() {
|
||||
val session = tmp.newFolder("2026-11-04-02-game")
|
||||
session.resolve("steam-7.log").writeText("begin\n" + "middle\n".repeat(100) + "tail\n")
|
||||
|
||||
@@ -68,6 +68,19 @@ class ExperimentalProtonsTest {
|
||||
assertEquals(listOf("pre"), ProtonExtras.assets(tool, releases, true).map { it.tag })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bionicBuildsKeepTheirOwnRow() {
|
||||
val tool = ProtonExtras.tools.first { it.id == ProtonExtras.OWN }
|
||||
val releases = JSONArray("""
|
||||
[{"tag_name":"DroidDeck-Proton-11-12.8","prerelease":false,"published_at":"2026-11-14T00:00:00Z","assets":[{"name":"DroidDeck-Proton-11-12.8-aarch64.tar.gz","browser_download_url":"https://example/stable"}]},
|
||||
{"tag_name":"DroidDeck-Bionic-12.8-r37","prerelease":true,"published_at":"2026-11-19T00:00:00Z","assets":[{"name":"DroidDeck-Bionic-12.8-r37-aarch64.tar.xz","browser_download_url":"https://example/bionic"}]},
|
||||
{"tag_name":"DroidDeck-Proton-11-12.9-test1","prerelease":true,"published_at":"2026-11-19T01:00:00Z","assets":[{"name":"DroidDeck-Proton-11-12.9-test1-aarch64.tar.xz","browser_download_url":"https://example/test"}]}]
|
||||
""".trimIndent())
|
||||
val assets = ProtonExtras.assets(tool, releases, true)
|
||||
assertEquals(listOf("DroidDeck-Bionic-12.8-r37", "DroidDeck-Proton-11-12.9-test1"), assets.map { it.tag })
|
||||
assertEquals(listOf("DroidDeck-Proton-11-12.9-test1"), ExperimentalProtons.listed(assets).map { it.tag })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun markerRoundTripKeepsReleaseTag() {
|
||||
val dir = File(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(activity), "root/.local/share/Steam/compatibilitytools.d/Experimental-pre").apply { mkdirs() }
|
||||
|
||||
@@ -127,4 +127,90 @@ class ProtonDefaultTest {
|
||||
assertTrue(games.containsKey("43"))
|
||||
assertNull(games["43"])
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anUpdateMovesTheDefaultThatNamesTheReplacedTool() {
|
||||
val bionic = """
|
||||
{"default": "DroidDeck-Bionic-12.8-r30-Proton", "applied": 7, "live": false,
|
||||
"tools": [{"name": "DroidDeck-Bionic-12.8-r30-Proton", "display": "r30", "dir": "DroidDeck-Bionic-12.8-r30", "valve": false},
|
||||
{"name": "DroidDeck-Proton-11-12.8", "display": "DD", "dir": "DroidDeck-Proton 11-12.8", "valve": false}]}
|
||||
""".trimIndent()
|
||||
val parsed = ProtonDefault.parseState(bionic)
|
||||
val from = setOf("DroidDeck-Bionic-12.8-r30")
|
||||
// applied default, no request yet
|
||||
assertEquals(ProtonDefault.Request(100, false, "DroidDeck-Bionic-12.8-r31"),
|
||||
ProtonDefault.movedDefault(parsed, null, from, "DroidDeck-Bionic-12.8-r31", 100))
|
||||
// a pending request for the replaced tool wins over the applied default and the new seq is above both
|
||||
assertEquals(ProtonDefault.Request(51, false, "DroidDeck-Bionic-12.8-r31"),
|
||||
ProtonDefault.movedDefault(parsed, ProtonDefault.Request(50, false, "DroidDeck-Bionic-12.8-r30"), from, "DroidDeck-Bionic-12.8-r31", 3))
|
||||
// a default on another tool stays as it is
|
||||
assertNull(ProtonDefault.movedDefault(parsed, ProtonDefault.Request(50, false, "DroidDeck-Proton 11-12.8"), from, "DroidDeck-Bionic-12.8-r31", 100))
|
||||
assertNull(ProtonDefault.movedDefault(ProtonDefault.parseState(state), null, from, "DroidDeck-Bionic-12.8-r31", 100))
|
||||
// an applied request (seq not above "applied") no longer decides: the applied default does
|
||||
assertEquals("DroidDeck-Bionic-12.8-r31",
|
||||
ProtonDefault.movedDefault(parsed, ProtonDefault.Request(7, false, "DroidDeck-Proton 11-12.8"), from, "DroidDeck-Bionic-12.8-r31", 1)?.dir)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aBionicDefaultOnAnotherBuildMovesToTheInstalledOne() {
|
||||
val r37 = "DroidDeck-Bionic-12.8-r37"
|
||||
val applied = ProtonDefault.parseState("""{"default": "DroidDeck-Bionic-12.8-r30-Proton", "applied": 7,
|
||||
"tools": [{"name": "DroidDeck-Bionic-12.8-r30-Proton", "display": "r30", "dir": "DroidDeck-Bionic-12.8-r30", "valve": false},
|
||||
{"name": "droiddeck-proton-arm64", "display": "Proton ARM64", "dir": "Proton Experimental (ARM64)", "valve": true}]}""")
|
||||
// the applied default is an older build
|
||||
assertEquals(ProtonDefault.Request(100, false, r37), ProtonDefault.bionicDefault(applied, null, "DroidDeck-Bionic", r37, 100))
|
||||
// the guest fell back to its own tool because the requested build was gone: the request still names it
|
||||
val fallback = ProtonDefault.parseState("""{"default": "droiddeck-proton-arm64", "applied": 50, "source": "fallback",
|
||||
"tools": [{"name": "droiddeck-proton-arm64", "display": "Proton ARM64", "dir": "Proton Experimental (ARM64)", "valve": true}]}""")
|
||||
assertEquals(ProtonDefault.Request(51, false, r37),
|
||||
ProtonDefault.bionicDefault(fallback, ProtonDefault.Request(50, false, "DroidDeck-Bionic-12.8-r24"), "DroidDeck-Bionic", r37, 3))
|
||||
// already the installed build, another tool, or a fallback the request did not cause: left as it is
|
||||
assertNull(ProtonDefault.bionicDefault(fallback, ProtonDefault.Request(50, false, r37), "DroidDeck-Bionic", r37, 3))
|
||||
assertNull(ProtonDefault.bionicDefault(fallback, ProtonDefault.Request(50, false, "DroidDeck-Proton 11-12.8"), "DroidDeck-Bionic", r37, 3))
|
||||
assertNull(ProtonDefault.bionicDefault(ProtonDefault.parseState(state), null, "DroidDeck-Bionic", r37, 100))
|
||||
val steam = ProtonDefault.parseState("""{"default": "droiddeck-proton-arm64", "applied": 50, "source": "steam",
|
||||
"tools": [{"name": "droiddeck-proton-arm64", "display": "Proton ARM64", "dir": "Proton Experimental (ARM64)", "valve": true}]}""")
|
||||
assertNull(ProtonDefault.bionicDefault(steam, ProtonDefault.Request(50, false, "DroidDeck-Bionic-12.8-r24"), "DroidDeck-Bionic", r37, 3))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun keepingBionicCurrentRewritesTheDefaultAndThePicks() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val d = File(LinuxRuntime.rootDir(context), "root/.local/share/droiddeck-compat").apply { deleteRecursively(); mkdirs() }
|
||||
File(d, "state.json").writeText("""{"default": "droiddeck-proton-arm64", "applied": 9, "source": "fallback",
|
||||
"tools": [{"name": "droiddeck-proton-arm64", "display": "Proton ARM64", "dir": "Proton Experimental (ARM64)", "valve": true}]}""")
|
||||
File(d, "request.json").writeText("""{"seq": 9, "valve": false, "dir": "DroidDeck-Bionic-12.8-r24"}""")
|
||||
ProtonDefault.requestGame(context, "42", proton("DroidDeck-Bionic-12.8-r29", false))
|
||||
ProtonDefault.requestGame(context, "43", proton("DroidDeck-Proton 11-12.8", false))
|
||||
ProtonDefault.requestGame(context, "44", null)
|
||||
ProtonDefault.keepBionicCurrent(context, "DroidDeck-Bionic", "DroidDeck-Bionic-12.8-r37")
|
||||
val request = ProtonDefault.parseRequest(File(d, "request.json").readText())
|
||||
assertEquals("DroidDeck-Bionic-12.8-r37", request?.dir)
|
||||
assertTrue(request!!.seq > 9)
|
||||
val games = ProtonDefault.parseGames(File(d, "games.json").readText())
|
||||
assertEquals(ProtonDefault.GameChoice(false, "DroidDeck-Bionic-12.8-r37"), games["42"])
|
||||
assertEquals(ProtonDefault.GameChoice(false, "DroidDeck-Proton 11-12.8"), games["43"])
|
||||
assertTrue(games.containsKey("44"))
|
||||
assertNull(games["44"])
|
||||
val before = File(d, "request.json").readText() + File(d, "games.json").readText()
|
||||
ProtonDefault.keepBionicCurrent(context, "DroidDeck-Bionic", "DroidDeck-Bionic-12.8-r37")
|
||||
assertEquals(before, File(d, "request.json").readText() + File(d, "games.json").readText())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun moveDefaultRewritesTheRequestFile() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val d = File(LinuxRuntime.rootDir(context), "root/.local/share/droiddeck-compat").apply { mkdirs() }
|
||||
File(d, "state.json").writeText("""{"default": "DroidDeck-Bionic-12.8-r30-Proton", "applied": 7,
|
||||
"tools": [{"name": "DroidDeck-Bionic-12.8-r30-Proton", "display": "r30", "dir": "DroidDeck-Bionic-12.8-r30", "valve": false}]}""")
|
||||
File(d, "request.json").delete()
|
||||
ProtonDefault.moveDefault(context, setOf("DroidDeck-Bionic-12.8-r30"), "DroidDeck-Bionic-12.8-r31")
|
||||
val written = ProtonDefault.parseRequest(File(d, "request.json").readText())
|
||||
assertEquals("DroidDeck-Bionic-12.8-r31", written?.dir)
|
||||
assertFalse(written!!.valve)
|
||||
assertTrue(written.seq > 7)
|
||||
val before = File(d, "request.json").readText()
|
||||
ProtonDefault.moveDefault(context, setOf("DroidDeck-Bionic-12.8-r29"), "DroidDeck-Bionic-12.8-r31")
|
||||
assertEquals(before, File(d, "request.json").readText())
|
||||
}
|
||||
}
|
||||
@@ -77,8 +77,8 @@ class ProtonExtrasTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theThreeSourcesInOrder() {
|
||||
assertEquals(listOf("ge", "cachyos", "droiddeck"), ProtonExtras.tools.map { it.id })
|
||||
fun theSourcesInOrder() {
|
||||
assertEquals(listOf("ge", "cachyos", "droiddeck", "bionic"), ProtonExtras.tools.map { it.id })
|
||||
val droiddeck = tool("droiddeck")
|
||||
assertEquals("DroidDeck-Proton", droiddeck.name)
|
||||
assertEquals("DroidDeck-Proton", droiddeck.prefix)
|
||||
@@ -90,6 +90,29 @@ class ProtonExtrasTest {
|
||||
assertFalse(tool("cachyos").assetPattern.containsMatchIn("proton-cachyos-11.0-20261005-slr-x86_64.tar.xz"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bionicAndDroidDeckProtonShareTheReleasesButNotTheirArchives() {
|
||||
val bionic = tool("bionic")
|
||||
assertEquals("DroidDeck-Bionic", bionic.prefix)
|
||||
assertEquals("Droid-Deck/DroidDeck-Proton", bionic.repo)
|
||||
assertTrue(bionic.assetPattern.containsMatchIn("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz"))
|
||||
assertFalse(bionic.assetPattern.containsMatchIn("DroidDeck-Proton-11-12.8-aarch64.tar.gz"))
|
||||
assertFalse(bionic.assetPattern.containsMatchIn("DroidDeck-Bionic-12.8-r3-aarch64.sha512sum"))
|
||||
assertFalse(tool("droiddeck").assetPattern.containsMatchIn("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bionicTakesItsPrereleaseAndDroidDeckProtonSkipsIt() {
|
||||
val releases = JSONArray()
|
||||
.put(release("DroidDeck-Bionic-12.8-r3", asset("DroidDeck-Bionic-12.8-r3-aarch64.sha512sum"),
|
||||
asset("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz"), prerelease = true))
|
||||
.put(droiddeckRelease("11-12.8"))
|
||||
val bionic = ProtonExtras.pickAsset(tool("bionic"), releases)!!
|
||||
assertEquals("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz", bionic.name)
|
||||
assertTrue(bionic.sha512!!.endsWith("DroidDeck-Bionic-12.8-r3-aarch64.sha512sum"))
|
||||
assertEquals("DroidDeck-Proton-11-12.8-aarch64.tar.gz", ProtonExtras.pickAsset(tool("droiddeck"), releases)!!.name)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theTarballAndItsSha512FileArePicked() {
|
||||
val picked = ProtonExtras.pickAsset(tool("droiddeck"), JSONArray().put(droiddeckRelease("11-7.5")))!!
|
||||
@@ -206,6 +229,22 @@ class ProtonExtrasTest {
|
||||
assertNull(ProtonExtras.update(context, tool("droiddeck")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removingDeletesLinksButNeverWhatTheyPointTo() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val tools = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/compatibilitytools.d")
|
||||
val outside = temp.newFolder("outside").apply { File(this, "keep.txt").writeText("x") }
|
||||
for (name in listOf("DroidDeck-Bionic-12.8-r3", "DroidDeck-Bionic-12.8-r5")) {
|
||||
val dosdevices = File(installTool(tools, name), "files/default_pfx/dosdevices").apply { mkdirs() }
|
||||
java.nio.file.Files.createSymbolicLink(File(dosdevices, "z:").toPath(), outside.toPath())
|
||||
}
|
||||
ProtonExtras.removeOlder(context, tool("bionic"))
|
||||
ProtonExtras.remove(context, tool("bionic"), "DroidDeck-Bionic-12.8-r5")
|
||||
assertFalse(File(tools, "DroidDeck-Bionic-12.8-r3").exists())
|
||||
assertFalse(File(tools, "DroidDeck-Bionic-12.8-r5").exists())
|
||||
assertTrue(File(outside, "keep.txt").isFile)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removingDeletesOneBuildOrEveryOlderOne() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
|
||||
@@ -168,8 +168,8 @@ class StoreGameSidecarTest {
|
||||
"if \"%DD_EPIC_PARENT%\"==\"1\" set \"DD_P=1\"",
|
||||
"if \"%DD_EPIC_PARENT%\"==\"0\" set \"DD_P=\"",
|
||||
"if defined DD_P set \"SteamAppId=\"",
|
||||
"if defined DD_P if not exist \"Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\" set \"DD_P=\"",
|
||||
"if defined DD_P set DD_P=\"Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\"",
|
||||
"if defined DD_P if not exist \"%DD_R%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\" set \"DD_P=\"",
|
||||
"if defined DD_P set DD_P=\"%DD_R%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\"",
|
||||
)
|
||||
|
||||
@Test fun epicTitlesThatCheckTheirParentStartUnderTheStandIn() {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.droiddeck.launcher.stores.gog
|
||||
|
||||
import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.session.SecondaryLibrary
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import java.io.File
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class GogInnoextractTest {
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
@Before @After fun resetStorage() {
|
||||
SessionPrefs.setDefaultStorageFolder(app, "", "")
|
||||
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
|
||||
}
|
||||
|
||||
private fun installer(folder: File, names: List<String>) = names.map { File(folder, it).apply { parentFile?.mkdirs(); writeText("MZ") } }
|
||||
|
||||
private fun hostOf(guest: String, binds: List<String>): File? = binds
|
||||
.map { it.substringBeforeLast(':') to it.substringAfterLast(':') }
|
||||
.filter { (_, mount) -> guest == mount || guest.startsWith("$mount/") }
|
||||
.maxByOrNull { it.second.length }
|
||||
?.let { (host, mount) -> File(host + guest.removePrefix(mount)) }
|
||||
|
||||
private fun assertExtractorSeesEveryPart(folder: File, parts: List<String>) {
|
||||
val files = installer(folder, parts)
|
||||
val guestDir = AddedGames.guestPath(app, folder)
|
||||
assertNotNull(guestDir)
|
||||
val argv = GogInnoextract.argv("$guestDir/${parts.first()}", guestDir!!)
|
||||
assertEquals("$guestDir/${parts.first()}", argv.last())
|
||||
assertEquals(guestDir, argv[argv.indexOf("-d") + 1])
|
||||
assertTrue(argv.contains("--gog"))
|
||||
val binds = StoreInstallRoot.guestBinds(app)
|
||||
assertEquals(folder.canonicalFile, hostOf(guestDir, binds)?.canonicalFile)
|
||||
for (file in files) assertEquals(file.canonicalFile, hostOf("$guestDir/${file.name}", binds)?.canonicalFile)
|
||||
assertNull(hostOf("$guestDir/${parts.first()}", emptyList()))
|
||||
}
|
||||
|
||||
@Test fun singleFileAndMultiPartInstallersOnAChosenFolderAreVisibleToTheExtractor() {
|
||||
val drive = File(app.filesDir, "usb/SSD").apply { mkdirs() }
|
||||
SessionPrefs.setDefaultStorageFolder(app, drive.path, "SSD")
|
||||
val single = File(drive, "Games/GOG/Single")
|
||||
assertTrue(AddedGames.guestPath(app, single)!!.startsWith(StoreInstallRoot.GUEST_EXTERNAL + "/"))
|
||||
assertExtractorSeesEveryPart(single, listOf("setup_1207658930.exe"))
|
||||
assertExtractorSeesEveryPart(File(drive, "Games/GOG/Multi Part"), listOf("setup_1207658931.exe", "setup_1207658931-1.bin", "setup_1207658931-2.bin"))
|
||||
}
|
||||
|
||||
@Test fun installersOnTheGameStorageCardAreVisibleToTheExtractor() {
|
||||
val card = File(app.filesDir, "card/steam").apply { mkdirs() }
|
||||
SessionPrefs.setGameStorage(app, card.path, "Card")
|
||||
val folder = File(card, "Games/GOG/Multi Part")
|
||||
assertTrue(SecondaryLibrary.CARD_GUESTS.any { AddedGames.guestPath(app, folder)!!.startsWith("$it/") })
|
||||
assertExtractorSeesEveryPart(folder, listOf("setup_1207658932.exe", "setup_1207658932-1.bin"))
|
||||
}
|
||||
|
||||
@Test fun anUnpluggedGameStorageCardDoesNotStopAnInternalExtraction() {
|
||||
SessionPrefs.setGameStorage(app, File(app.filesDir, "unplugged/steam").path, "Card")
|
||||
val folder = File(StoreInstallRoot.internalRoot(app), "GOG/Internal")
|
||||
installer(folder, listOf("setup_1207658933.exe"))
|
||||
val binds = StoreInstallRoot.guestBinds(app)
|
||||
assertTrue(binds.none { bind -> SecondaryLibrary.CARD_GUESTS.any { bind.endsWith(":$it") } })
|
||||
assertTrue(AddedGames.guestPath(app, folder)!!.startsWith("/root/Games/Stores/GOG/"))
|
||||
}
|
||||
|
||||
@Test fun anAddedFolderNamedStoresIsMountedWithoutHidingTheInternalInstallRoot() {
|
||||
val drive = File(app.filesDir, "usb/Stores").apply { mkdirs() }
|
||||
AddedGames.bindFolder(app, drive)
|
||||
val guest = AddedGames.guestPath(app, drive)!!
|
||||
assertTrue(guest != StoreInstallRoot.INTERNAL_GUEST && !guest.startsWith(StoreInstallRoot.INTERNAL_GUEST + "/"))
|
||||
SessionPrefs.setDefaultStorageFolder(app, drive.path, "Stores")
|
||||
val chosen = File(drive, "Games/GOG/Chosen")
|
||||
assertTrue(AddedGames.guestPath(app, chosen)!!.startsWith("$guest/"))
|
||||
assertExtractorSeesEveryPart(chosen, listOf("setup_1207658934.exe", "setup_1207658934-1.bin"))
|
||||
val internal = File(StoreInstallRoot.internalRoot(app), "GOG/Internal")
|
||||
installer(internal, listOf("setup_1207658935.exe"))
|
||||
val internalGuest = AddedGames.guestPath(app, internal)!!
|
||||
assertTrue(internalGuest.startsWith(StoreInstallRoot.INTERNAL_GUEST + "/GOG/"))
|
||||
assertNull(hostOf("$internalGuest/setup_1207658935.exe", StoreInstallRoot.guestBinds(app)))
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.droiddeck.launcher.stores.gog
|
||||
|
||||
import com.droiddeck.launcher.stores.StoreInstallRoot
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.nio.file.Files
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertThrows
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
@@ -83,6 +85,42 @@ class GogInstallerPartsTest {
|
||||
}
|
||||
}
|
||||
|
||||
private val gib = 1024L * 1024 * 1024
|
||||
|
||||
@Test fun anInstallerThatFitsOnlyBeforeExtractionIsRefusedBeforeItDownloads() {
|
||||
val download = 1_048_576L + 17 * (7 * gib / 2)
|
||||
val installed = 699 * gib / 10
|
||||
val free = 944 * gib / 10
|
||||
assertFalse(StoreInstallRoot.insufficientSpace(download, free))
|
||||
val needed = GogDownloadManager.installerBytesNeeded(download, installed)
|
||||
assertEquals(download + installed, needed)
|
||||
assertTrue(StoreInstallRoot.insufficientSpace(needed, free))
|
||||
}
|
||||
|
||||
@Test fun anInstallerThatFitsWithItsExtractedFilesIsAllowed() {
|
||||
val download = 1_048_576L + 3_786_407_936L
|
||||
assertFalse(StoreInstallRoot.insufficientSpace(GogDownloadManager.installerBytesNeeded(download, 6 * gib), 944 * gib / 10))
|
||||
}
|
||||
|
||||
@Test fun anUnknownInstalledSizeKeepsTheDownloadOnlyCheck() {
|
||||
val download = 1_048_576L + 3_786_407_936L
|
||||
assertEquals(download, GogDownloadManager.installerBytesNeeded(download, 0L))
|
||||
assertEquals(download, GogDownloadManager.installerBytesNeeded(download, -1L))
|
||||
assertEquals(5 * gib, GogDownloadManager.installerBytesNeeded(0L, 5 * gib))
|
||||
assertEquals(0L, GogDownloadManager.installerBytesNeeded(0L, -1L))
|
||||
}
|
||||
|
||||
@Test fun aPartWithoutASizeStillCountsTheKnownBytesOfTheOthers() {
|
||||
val parts = listOf(
|
||||
GogDownloadManager.InstallerPart("u0", "setup.exe", 0L),
|
||||
GogDownloadManager.InstallerPart("u1", "setup-1.bin", 60 * gib),
|
||||
)
|
||||
val needed = GogDownloadManager.installerBytesNeeded(GogDownloadManager.knownPartBytes(parts), 70 * gib)
|
||||
assertEquals(130 * gib, needed)
|
||||
assertTrue(StoreInstallRoot.insufficientSpace(needed, 95 * gib))
|
||||
assertEquals(0L, GogDownloadManager.knownPartBytes(emptyList()))
|
||||
}
|
||||
|
||||
@Test fun anotherPlatformOrNoDownloadsAddsNothing() {
|
||||
assertEquals(0, GogDownloadManager.installerParts(downloads("""{"installers":[{"os":"linux","manualUrl":"https://example.invalid/x"}]}"""), "1").size)
|
||||
assertEquals(0, GogDownloadManager.installerParts(downloads("{}"), "1").size)
|
||||
|
||||
@@ -105,11 +105,28 @@ class UbisoftTest {
|
||||
val text = StoreLaunch.launcherText(StoreGameSidecar(Store.UBISOFT, "space-sc", "Splinter Cell", "system/SplinterCell.exe"))
|
||||
val lines = text.trimEnd().split("\r\n")
|
||||
assertTrue(lines.contains("if not exist \"%~dp0.droiddeck-ubisoft.json\" goto direct"))
|
||||
assertTrue(lines.contains("\"Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" \"%~dp0.droiddeck-ubisoft.json\""))
|
||||
val service = lines.indexOf("\"%DD_R%\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" \"%~dp0.droiddeck-ubisoft.json\"")
|
||||
assertTrue(service in 0 until lines.indexOf(":direct"))
|
||||
assertTrue(lines.indexOf("set \"DD_R=Z:\"") in 0 until lines.indexOf("if defined DROIDDECK_GUEST_ROOT set \"DD_R=%DROIDDECK_GUEST_ROOT%\""))
|
||||
assertTrue(lines.indexOf("if defined DROIDDECK_GUEST_ROOT set \"DD_R=%DROIDDECK_GUEST_ROOT%\"") < service)
|
||||
assertEquals("\"%~dp0system\\SplinterCell.exe\"", lines.last())
|
||||
assertTrue(lines.indexOf(":direct") < lines.lastIndex)
|
||||
}
|
||||
|
||||
@Test fun anInstalledGamesOlderLauncherIsRewritten() {
|
||||
val folder = java.nio.file.Files.createTempDirectory("ubisoft-adopt").toFile()
|
||||
try {
|
||||
File(folder, "system").mkdirs()
|
||||
File(folder, "system/SplinterCell.exe").writeText("exe")
|
||||
val sidecar = StoreGameSidecar(Store.UBISOFT, "space-sc", "Splinter Cell", "system/SplinterCell.exe", launcher = StoreLaunch.LAUNCHER)
|
||||
File(folder, StoreLaunch.LAUNCHER).writeText("@echo off\r\nif not exist \"Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" goto direct\r\n")
|
||||
StoreLaunch.adopt(folder, sidecar)
|
||||
assertEquals(StoreLaunch.launcherText(sidecar), File(folder, StoreLaunch.LAUNCHER).readText())
|
||||
} finally {
|
||||
folder.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun activationPayloadsSurviveTheHexHop() {
|
||||
val bytes = byteArrayOf(0, 1, 0x7f, -1, -128, 42)
|
||||
assertEquals("00017fff802a", UbisoftActivation.hex(bytes))
|
||||
|
||||
@@ -48,6 +48,21 @@ class NavTabsTest {
|
||||
assertTrue(NavTabs.isDefault())
|
||||
}
|
||||
|
||||
@Test fun appsFollowsTheHomeAppOnEachChangeAndOtherwiseKeepsTheUsersChoice() {
|
||||
NavTabs.syncHomeApps(ctx, false)
|
||||
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "android-apps"))
|
||||
NavTabs.syncHomeApps(ctx, true)
|
||||
assertEquals(TabPlace.BAR, NavTabs.place(state(), "android-apps"))
|
||||
NavTabs.setHidden(ctx, "android-apps", true)
|
||||
NavTabs.syncHomeApps(ctx, true)
|
||||
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "android-apps"))
|
||||
NavTabs.syncHomeApps(ctx, false)
|
||||
NavTabs.syncHomeApps(ctx, true)
|
||||
assertEquals(TabPlace.BAR, NavTabs.place(state(), "android-apps"))
|
||||
NavTabs.syncHomeApps(ctx, false)
|
||||
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "android-apps"))
|
||||
}
|
||||
|
||||
@Test fun showingMusicOnceKeepsItShownAfterReload() {
|
||||
place("soundtracks", TabPlace.BAR)
|
||||
NavTabs.load(ctx)
|
||||
@@ -219,12 +234,12 @@ class NavTabsTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
val last = navigationKeys(state()).last { it != NavTabs.MORE }
|
||||
val last = NavTabs.listed(state()).last { it !in NavTabs.shelved }
|
||||
compose.onNodeWithTag("tab-row-$last").requestFocus()
|
||||
compose.onNodeWithTag("tab-row-$last").performKeyPress(pad(android.view.KeyEvent.KEYCODE_BUTTON_Y))
|
||||
compose.onNodeWithTag("tab-row-$last").performKeyPress(pad(android.view.KeyEvent.KEYCODE_DPAD_DOWN))
|
||||
compose.onNodeWithTag("tab-row-$last").performKeyPress(pad(android.view.KeyEvent.KEYCODE_BUTTON_Y))
|
||||
compose.runOnIdle { assertEquals(last, NavTabs.more(state()).first()) }
|
||||
compose.runOnIdle { assertTrue(last in NavTabs.shelved) }
|
||||
compose.onNodeWithTag("tab-shown-desktop").performClick()
|
||||
compose.runOnIdle { assertFalse("desktop" in navigationKeys(state())) }
|
||||
compose.onNodeWithTag("tab-shown-setup").performClick()
|
||||
|
||||
@@ -212,6 +212,12 @@ more, so its fix removes both variables, also from its launch options, and sets
|
||||
`vk_x11_strict_image_count=true`, the option Mesa's driconf gives the game. A
|
||||
per-game value in the environment editor still wins.
|
||||
|
||||
Dragon Quest Monsters 4 does not draw slime bodies at its default monster mesh
|
||||
detail, leaving only their tips. Before each launch, DroidDeck sets
|
||||
`r.SkeletalMeshLODBias=-4` and `r.SkeletalMeshLODRadiusScale=0.25` under
|
||||
`[SystemSettings]` in the game's `Engine.ini`. It does this every time because the
|
||||
game ignores `-ini:` overrides and deletes a writable `Engine.ini` after reading it.
|
||||
|
||||
## Defaults and available suggestions
|
||||
|
||||
The initial configuration enables Mesa shader caching with
|
||||
|
||||
@@ -215,6 +215,15 @@ Still to check by hand: pasting Android text into a game.
|
||||
Force fullscreen is still unsafe without a matching Game Resolution: with the default (native),
|
||||
a game drawing at another size fights it as in run 4. It stays off by default.
|
||||
|
||||
## Stretch 16:9 with two Xwayland servers
|
||||
|
||||
With "Stretch 16:9 to panel" the games' server starts at the 16:9 nested size, but the client sets it
|
||||
to the output size at every launch (run 7), so games saw a near-square screen and letterboxed
|
||||
themselves. While stretching, the session script rewrites a `GAMESCOPE_XWAYLAND_MODE_CONTROL` that
|
||||
sizes the game server (`1`) to exactly the output into the nested size with `allow_super_res` set,
|
||||
since gamescope otherwise clamps it to the output. A Game Resolution chosen in Steam is a different
|
||||
size and is kept.
|
||||
|
||||
## Force fullscreen removed (`feat/remove-force-fullscreen`)
|
||||
|
||||
With games on their own Xwayland server, FlatOut 2 no longer shrinks under the QAM, which was the
|
||||
|
||||
@@ -60,7 +60,9 @@ missing prefix is removed first, and nothing is copied.
|
||||
|
||||
The account's `.droiddeck-routes.json` maps shortcut IDs to real Steam app IDs so the
|
||||
Android launcher uses the same title and Proton prefix as Steam. Other accounts do not
|
||||
inherit those routes. Managed shortcuts are replaced; user-created shortcuts and
|
||||
inherit those routes. A program chosen in DroidDeck other than the folder's default executable (for example a mod
|
||||
launcher beside the game's own executable) is never routed: it stays its own shortcut and tile.
|
||||
A target set in the Steam shortcut's properties keeps the route. Managed shortcuts are replaced; user-created shortcuts and
|
||||
unreadable shortcut files are preserved. Both routes use the existing ARM64 Proton
|
||||
registration.
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 4.1 MiB |
|
Before Width: | Height: | Size: 9.0 MiB |
@@ -0,0 +1,239 @@
|
||||
# DroidDeck 0.7.11
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.11%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.11"></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>
|
||||
|
||||
|
||||
**DroidDeck is 100% open source. No ads. No subscriptions. No telemetry. No proprietary components. No source withheld.**
|
||||
|
||||
Since 0.7.1: **42 contributors** | **467 pull requests** | **111 of them from 39 outside contributors**. We are so grateful for you all!
|
||||
|
||||
0.7.11 is the convenience store release. **EA, Ubisoft Connect and Rockstar Games** join the Stores tab, with no launchers to install and cloud saves for EA and Ubisoft. Steam, games, the desktop and the Terminal now **run directly on Android with no proot**, which cuts CPU overhead and gives much better 1% lows. **Zero-copy presentation** sends frames straight to the display and brings real HDR. Games on a memory card start about 4X faster. Around those sit a rebuilt Library, a tab bar you can rearrange, Settings with search, a smoother first run, and many smaller conveniences. The details are below.
|
||||
|
||||
### Features
|
||||
|
||||
- **A new foundation.** 0.7.11 reworks the stack that runs your games, from how Linux runs on Android to how frames reach the screen:
|
||||
- **No proot by default.** Steam, Proton games, the desktop and the Terminal run directly on Android, with lower CPU overhead and much better 1% lows. (@xXJSONDeruloXx, @maxjivi05, @K11MCH1, [#2300](https://github.com/Droid-Deck/DroidDeck/pull/2300), [#2522](https://github.com/Droid-Deck/DroidDeck/pull/2522), [#2560](https://github.com/Droid-Deck/DroidDeck/pull/2560), [#3041](https://github.com/Droid-Deck/DroidDeck/pull/3041))
|
||||
- **Zero-copy presentation** With DD-Turnip v0.9.0 or newer, frames reach the display without an extra copy: improving frametimes, frame pacing, and drastically reducing cases of dropped frames. (@maxjivi05, [#2905](https://github.com/Droid-Deck/DroidDeck/pull/2905))
|
||||
- **DroidDeck-Bionic**, a new test build that runs the game itself on Android’s own libc, with lower memory use, better compatibility and, in some games, better performance. (@The412Banner, [#3037](https://github.com/Droid-Deck/DroidDeck/pull/3037))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/new-foundation.png" width="85%" alt="Four charts. Native execution without proot: process launches 4.2 times faster, tar 3.6, recursive listing 2.6, find 2.4, Python stat walk 1.4 and a CPU-only hash 1.1, with Steam starting in 8.7 s instead of 11 to 14 s on a Retroid Pocket Duo. SD card game starts: cold session start plus launch for eight games fell from 37, 122, 19, 65, 177, 192, 50 and 174 seconds on 0.7.1 to 35, 19, 18, 34, 26, 23, 26 and 24 seconds on 0.7.11, an average of 104 s down to 26 s. Zero-copy presentation: compositor work per frame down from 8.25, 3.3 and 4 ms to 1.25, 0.18 and 0.22 ms on three handhelds, and missed refreshes from 229 to 3 in 60 s on one. DroidDeck-Bionic: D3D8 up 50.3%, OpenGL up 17.5%, D3D7 up 10.4%, Vulkan up 3.3%, D3D11 down 1.3%, D3D10 down 1.4%, D3D9 down 3.5% and D3D12 down 7.5%, with about 400 MB less RAM"></p>
|
||||
|
||||
- Added **EA, Ubisoft Connect and Rockstar Games** stores: sign in, browse, download and launch without their launchers. EA and Ubisoft get cloud saves. (@xXJSONDeruloXx, @K11MCH1, @maxjivi05, [#2259](https://github.com/Droid-Deck/DroidDeck/pull/2259), [#2527](https://github.com/Droid-Deck/DroidDeck/pull/2527), [#2521](https://github.com/Droid-Deck/DroidDeck/pull/2521), [#2438](https://github.com/Droid-Deck/DroidDeck/pull/2438), [#2440](https://github.com/Droid-Deck/DroidDeck/pull/2440), [#2486](https://github.com/Droid-Deck/DroidDeck/pull/2486), [#2322](https://github.com/Droid-Deck/DroidDeck/pull/2322), [#2436](https://github.com/Droid-Deck/DroidDeck/pull/2436), [#2450](https://github.com/Droid-Deck/DroidDeck/pull/2450), [#2460](https://github.com/Droid-Deck/DroidDeck/pull/2460), [#2865](https://github.com/Droid-Deck/DroidDeck/pull/2865), [#2824](https://github.com/Droid-Deck/DroidDeck/pull/2824), [#2537](https://github.com/Droid-Deck/DroidDeck/pull/2537), [#2547](https://github.com/Droid-Deck/DroidDeck/pull/2547), [#2590](https://github.com/Droid-Deck/DroidDeck/pull/2590))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/new-stores.gif" width="60%" alt="Touching through the Library’s store chips from left to right: Rockstar with GTA III, San Andreas and Vice City, EA with Battlefield, Dead Space, GRID Legends, Mass Effect, Need for Speed Heat and skate., then Ubisoft with five Assassin’s Creed titles, Immortals Fenyx Rising and Splinter Cell"></p>
|
||||
|
||||
- Added **black frame insertion** for screens of 100 Hz and up: the game runs at half the refresh rate, for example 60 fps on 120 Hz. (@xXJSONDeruloXx, [#2653](https://github.com/Droid-Deck/DroidDeck/pull/2653))
|
||||
|
||||
- **Controller-specific on-screen controls**: kits for the Steam Deck, Steam Controller, Xbox 360, DualShock 4 and DualSense, restyled after the real pads. The editor restores deleted controls, moves and resizes the D-pad as one control and allows sizes above 100%. Layouts keep separate portrait and landscape edits, and the floating overlays get switches for rear buttons and trackpads. (@xXJSONDeruloXx, @maxjivi05, [#2966](https://github.com/Droid-Deck/DroidDeck/pull/2966), [#2988](https://github.com/Droid-Deck/DroidDeck/pull/2988), [#2996](https://github.com/Droid-Deck/DroidDeck/pull/2996), [#3013](https://github.com/Droid-Deck/DroidDeck/pull/3013), [#3019](https://github.com/Droid-Deck/DroidDeck/pull/3019))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/controller-kits.png" width="60%" alt="The portrait on-screen controls for four of the kits: Steam, Xbox 360, DualShock 4 and DualSense, each with its shoulder buttons, D-pad, face buttons, sticks and a bottom row of menu buttons"></p>
|
||||
|
||||
<p align="center"><img src="media/0.7.11/steam-deck-buttons.jpg" width="50%" alt="Steam’s game mode with the restyled Steam Deck on-screen controls: shoulder buttons, a D-pad, A B X Y, rear buttons, trackpads, sticks and the Steam, keyboard and menu buttons along the bottom"></p>
|
||||
|
||||
- Added a **CurseForge source** to the addon browser. DroidDeck installs the CurseForge app, updates addons per game and no longer reads whole files to list them. (@maxjivi05, [#3028](https://github.com/Droid-Deck/DroidDeck/pull/3028), [#2986](https://github.com/Droid-Deck/DroidDeck/pull/2986), [#3042](https://github.com/Droid-Deck/DroidDeck/pull/3042), [#3056](https://github.com/Droid-Deck/DroidDeck/pull/3056), [#3057](https://github.com/Droid-Deck/DroidDeck/pull/3057), [#3060](https://github.com/Droid-Deck/DroidDeck/pull/3060), [#3081](https://github.com/Droid-Deck/DroidDeck/pull/3081))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/curseforge-addons.jpg" width="50%" alt="The addon browser on the CurseForge source, sorted by Popular: Questie, Auctionator, Details! Damage Meter, DBM and others, each with an Install button"></p>
|
||||
|
||||
- The **file manager has a plain text editor**, and the **Updates icon shows the build you’re on**: stable, Preview, a test build or a local build. (@Dantalian-dev, @xXJSONDeruloXx, [#2980](https://github.com/Droid-Deck/DroidDeck/pull/2980), [#3064](https://github.com/Droid-Deck/DroidDeck/pull/3064))
|
||||
|
||||
- **Frontends can launch any DroidDeck game** with Steam IDs, `steam://` and `droiddeck://` links, Daijisho templates, `.url` shortcuts, store game files or `.exe` paths, and store games export as `.epic`, `.gog`, `.xbox` and similar files. (@xXJSONDeruloXx, [#2872](https://github.com/Droid-Deck/DroidDeck/pull/2872))
|
||||
|
||||
- The **Storage manager names every prefix and store game** and can select and remove them, instead of one large “Kept” total, and launcher prefixes and Linux system caches can be removed too. (@xXJSONDeruloXx, [#2565](https://github.com/Droid-Deck/DroidDeck/pull/2565), [#2867](https://github.com/Droid-Deck/DroidDeck/pull/2867))
|
||||
|
||||
- The **Updates tab lists every kept Preview build**, so you can go back to an earlier one, links each build to its pull request and commit, and flags stale test builds. (@xXJSONDeruloXx, [#2624](https://github.com/Droid-Deck/DroidDeck/pull/2624))
|
||||
|
||||
- Components > Proton lists **DroidDeck-Proton prerelease builds under Experimental**, each with Install now, and removes them once they become a stable release. **Install from file** takes zip, 7z and tar archives, for everyone. (@maxjivi05, @FryMcNugget, [#2831](https://github.com/Droid-Deck/DroidDeck/pull/2831), [#2864](https://github.com/Droid-Deck/DroidDeck/pull/2864), [#2889](https://github.com/Droid-Deck/DroidDeck/pull/2889))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/proton-experimental.jpg" width="50%" alt="Components page with DroidDeck-Proton 11-12.8 selected and an Experimental builds section offering a DroidDeck-Bionic 12.8 r34 test build with Install now and an Install from file button"></p>
|
||||
|
||||
- **Steam picks up game folders found in an added library** without pressing Install on each game, and a Games folder that is not a Steam library yet is offered as one. (@maxjivi05, @xXJSONDeruloXx, [#2317](https://github.com/Droid-Deck/DroidDeck/pull/2317), [#2432](https://github.com/Droid-Deck/DroidDeck/pull/2432))
|
||||
|
||||
- Added **per-game frame generation and screen effects**: pick DD-FG 2x, 3x, 4x, Lossless Scaling or none for each game, from the Library or the in-game menu, with a default for the rest. Upscaling and sharpening stay at full screen size with frame generation on. (@EnzoDLofi, @xXJSONDeruloXx, [#2473](https://github.com/Droid-Deck/DroidDeck/pull/2473), [#2472](https://github.com/Droid-Deck/DroidDeck/pull/2472), [#2728](https://github.com/Droid-Deck/DroidDeck/pull/2728))
|
||||
|
||||
- Added **integer scaling** for pixel art and 2D games, and **SMAA** anti-aliasing. Nearest is the new default filter; a filter you already picked stays. (@EnzoDLofi, [#2620](https://github.com/Droid-Deck/DroidDeck/pull/2620), [#2690](https://github.com/Droid-Deck/DroidDeck/pull/2690), [#2708](https://github.com/Droid-Deck/DroidDeck/pull/2708), [#2760](https://github.com/Droid-Deck/DroidDeck/pull/2760))
|
||||
|
||||
- A **pen works as a mouse**: hover moves the pointer, the tip clicks and the side button right-clicks. (@alien2003, [#2625](https://github.com/Droid-Deck/DroidDeck/pull/2625))
|
||||
|
||||
- Added **head tracking for XREAL One, One Pro, One Pro+ and Aura** glasses, with One Pro+ tracking corrected. (@mhaye20, @informalTechCode, [#2532](https://github.com/Droid-Deck/DroidDeck/pull/2532), [#2680](https://github.com/Droid-Deck/DroidDeck/pull/2680))
|
||||
|
||||
- DroidDeck’s **virtual pads reach programs outside Steam**, such as Firefox, Chromium and SDL games. (@kingokksa, [#1593](https://github.com/Droid-Deck/DroidDeck/pull/1593))
|
||||
|
||||
- Added **On-Device Lab builds** for contributors: build and run your own DroidDeck build on the device from the **Dev Harness** tab, which stays hidden until you show it in Edit tabs. (@xXJSONDeruloXx, @KeegantheVeganat0r, @SlicelessBread, @FryMcNugget, [#2375](https://github.com/Droid-Deck/DroidDeck/pull/2375), [#2494](https://github.com/Droid-Deck/DroidDeck/pull/2494), [#2512](https://github.com/Droid-Deck/DroidDeck/pull/2512), [#2667](https://github.com/Droid-Deck/DroidDeck/pull/2667), [#2550](https://github.com/Droid-Deck/DroidDeck/pull/2550), [#2744](https://github.com/Droid-Deck/DroidDeck/pull/2744), [#2862](https://github.com/Droid-Deck/DroidDeck/pull/2862))
|
||||
|
||||
- **Also new:** a **Game resolution** choice for games started without Steam; **per-game Steam Input** choices: Steam’s default, on or off; **Steam Remote Play** with the controller set to Steam Deck or Steam Controller mode and with touch controls; rounded ends on the game page’s **LB and RB keys**; **icon packs**, per-app icons and an Appearance panel on the Apps page; a **Home button** choice, **three presses of Back to exit the launcher** and an optional **Hide launcher from Recents while idle**; **Shuffle** and **Skip boot movie** switches; the game can move to a **clip-on second screen** that reports as an external display; **Quest headsets** get steps for turning off the child-process limit with SideQuest; a **Clear** key in the bottom-screen terminal, which keeps its shell when another app covers that screen; Steam’s first-run defaults show the **battery percentage**, download rates in bytes and the library sorted by recent (@xXJSONDeruloXx, @vinegh4, @2-Shar, @measlesbagel, @DeathKhan, @kingokksa, @maxjivi05, [#2520](https://github.com/Droid-Deck/DroidDeck/pull/2520), [#2407](https://github.com/Droid-Deck/DroidDeck/pull/2407), [#2033](https://github.com/Droid-Deck/DroidDeck/pull/2033), [#2856](https://github.com/Droid-Deck/DroidDeck/pull/2856), [#2207](https://github.com/Droid-Deck/DroidDeck/pull/2207), [#2493](https://github.com/Droid-Deck/DroidDeck/pull/2493), [#1599](https://github.com/Droid-Deck/DroidDeck/pull/1599), [#2579](https://github.com/Droid-Deck/DroidDeck/pull/2579), [#2462](https://github.com/Droid-Deck/DroidDeck/pull/2462), [#2577](https://github.com/Droid-Deck/DroidDeck/pull/2577), [#2350](https://github.com/Droid-Deck/DroidDeck/pull/2350), [#2306](https://github.com/Droid-Deck/DroidDeck/pull/2306), [#2368](https://github.com/Droid-Deck/DroidDeck/pull/2368), [#2366](https://github.com/Droid-Deck/DroidDeck/pull/2366), [#2599](https://github.com/Droid-Deck/DroidDeck/pull/2599))
|
||||
|
||||
### Design and organization
|
||||
|
||||
DroidDeck is easier to find your way around: tabs you arrange yourself, a Library that puts installed games first, and one home for every setting.
|
||||
|
||||
- **One editor to show, hide and reorder** the launcher tabs, the Library’s stores and the in-game menu pages. **Edit tabs** reorders with drag handles and shelves tabs under **More** or hides them, **Manage stores** does the same for store chips, Favorites and Hidden, and the in-game menu gets **Arrange pages** and its own **More** tab. On a controller, grab a row with Y and move it with the D-pad. The in-game menu can also be **resized**, and the width is kept. (@xXJSONDeruloXx, @FX192, [#2569](https://github.com/Droid-Deck/DroidDeck/pull/2569), [#2627](https://github.com/Droid-Deck/DroidDeck/pull/2627), [#2791](https://github.com/Droid-Deck/DroidDeck/pull/2791), [#2798](https://github.com/Droid-Deck/DroidDeck/pull/2798), [#2809](https://github.com/Droid-Deck/DroidDeck/pull/2809), [#2811](https://github.com/Droid-Deck/DroidDeck/pull/2811), [#2812](https://github.com/Droid-Deck/DroidDeck/pull/2812), [#2558](https://github.com/Droid-Deck/DroidDeck/pull/2558), [#2894](https://github.com/Droid-Deck/DroidDeck/pull/2894), [#2897](https://github.com/Droid-Deck/DroidDeck/pull/2897), [#2920](https://github.com/Droid-Deck/DroidDeck/pull/2920), [#2989](https://github.com/Droid-Deck/DroidDeck/pull/2989), [#3084](https://github.com/Droid-Deck/DroidDeck/pull/3084), [#3080](https://github.com/Droid-Deck/DroidDeck/pull/3080))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/edit-tabs.jpg" width="19%" alt="The launcher’s Edit tabs sheet in portrait, with a drag handle and a switch for Steam, Desktop, Library, Downloads, Settings, Updates and Stores, then a More divider above Boot movies, Decky, Apps and Syncthing"> <img src="media/0.7.11/manage-stores.jpg" width="38%" alt="The Library’s Manage stores sheet with a drag handle and a switch for Favorites, Battle.net, Xbox, Rockstar Games, EA, Ubisoft Connect and itch.io, with a Grab Y hint on the Xbox row being moved"> <img src="media/0.7.11/session-menu-arrange.jpg" width="38%" alt="The widened in-game menu showing Arrange pages with Performance HUD, Effects, Games and Session above a More divider and VR below it"></p>
|
||||
|
||||
- **The Library is rebuilt.** Installed games come first, and games you own but haven’t installed fold into one **Not installed** row linked to their store. It gets the Stores tab’s chips and toolbar and a **Custom games** tab. (@xXJSONDeruloXx, @FX192, [#2894](https://github.com/Droid-Deck/DroidDeck/pull/2894), [#2897](https://github.com/Droid-Deck/DroidDeck/pull/2897), [#2920](https://github.com/Droid-Deck/DroidDeck/pull/2920))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/library-installed.jpg" width="50%" alt="The Library with store chips (All, Steam, Epic, EA, Xbox, GOG, Rockstar, itch.io), a toolbar, an Installed row of Steam, EA, Ubisoft and GOG games with their sizes, and a Not installed row of 746 games below"></p>
|
||||
|
||||
- **Settings are rebuilt.** Setup is now **Settings**, Performance has its own page, every setting has one home, and search finds settings by everyday words such as fps, logs or ram. Storage, Syncthing and Downloads are tabs of their own. (@xXJSONDeruloXx, [#2569](https://github.com/Droid-Deck/DroidDeck/pull/2569), [#2627](https://github.com/Droid-Deck/DroidDeck/pull/2627), [#2791](https://github.com/Droid-Deck/DroidDeck/pull/2791), [#2798](https://github.com/Droid-Deck/DroidDeck/pull/2798), [#2809](https://github.com/Droid-Deck/DroidDeck/pull/2809), [#2811](https://github.com/Droid-Deck/DroidDeck/pull/2811), [#2812](https://github.com/Droid-Deck/DroidDeck/pull/2812), [#2558](https://github.com/Droid-Deck/DroidDeck/pull/2558))
|
||||
|
||||
- Added **Favorites** with a heart on the game page, a **Hidden** tab synced with Steam, and a **Soundtracks tab with a music player** with favorites, collections and Android’s media controls. (@FX192, [#2613](https://github.com/Droid-Deck/DroidDeck/pull/2613), [#2803](https://github.com/Droid-Deck/DroidDeck/pull/2803), [#2389](https://github.com/Droid-Deck/DroidDeck/pull/2389), [#2835](https://github.com/Droid-Deck/DroidDeck/pull/2835))
|
||||
|
||||
- **Decky and Boot movies get their own tabs**, shelved under More. Decky has Installed, **Store** and From ZIP pages; the store lists plugins by downloads with search, checks each download’s SHA-256 and updates what you have installed. (@xXJSONDeruloXx, [#3068](https://github.com/Droid-Deck/DroidDeck/pull/3068))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/more-tab.jpg" width="45%" alt="The More page with Storage, Syncthing, Decky, Boot movies, Music and Dev Harness, and the Updates tab’s L icon for a local build on the rail"> <img src="media/0.7.11/decky-store.jpg" width="45%" alt="Decky’s Store page with a plugin search box and SteamGridDB and CSS Loader, each with an Install button"></p>
|
||||
|
||||
- **One screen picker for the bottom screen**: a dropdown next to X switches between the DroidDeck menu and the panels, replacing the D button and the Second screen tab. Every panel gets the swap button, and the menu’s tabs get Steam Deck style icons. (@xXJSONDeruloXx, [#2912](https://github.com/Droid-Deck/DroidDeck/pull/2912), [#2900](https://github.com/Droid-Deck/DroidDeck/pull/2900))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/screen-picker.jpg" width="40%" alt="The bottom-screen picker open on a Dashboard, listing DroidDeck menu, Keyboard + trackpad, Terminal, Profile controls and Dashboard"></p>
|
||||
|
||||
- **The in-game menu works better on a dual-screen handheld.** It is now a bottom-screen mode, and a docked menu is touch only so the controller stays with the game, unless you turn on **Physical controls can use bottom screen**. **Dual screen sessions** can be set from the Display page, and Pause shows its screen at once, with a real last frame under Zero-copy. (@xXJSONDeruloXx, [#3001](https://github.com/Droid-Deck/DroidDeck/pull/3001), [#3080](https://github.com/Droid-Deck/DroidDeck/pull/3080))
|
||||
|
||||
- Added the **True black** theme for OLED screens with a highlight color you pick, and a **Custom theme** where you set every color. Inner gamer works with launcher animations off. (@DeathKhan, @EnzoDLofi, [#2541](https://github.com/Droid-Deck/DroidDeck/pull/2541), [#2542](https://github.com/Droid-Deck/DroidDeck/pull/2542), [#2850](https://github.com/Droid-Deck/DroidDeck/pull/2850))
|
||||
|
||||
- The **DroidDeck HUD** gets a switch and row order for every reading, an **estimated battery runtime** and a **long press to collapse or expand**, and locking is optional. **Hold the GPU at its top clock** can be switched from the in-game menu and applies right away, and a new switch shows the HUD only while a game runs. (@kingokksa, @EnzoDLofi, @xXJSONDeruloXx, @maxjivi05, [#2454](https://github.com/Droid-Deck/DroidDeck/pull/2454), [#2573](https://github.com/Droid-Deck/DroidDeck/pull/2573), [#2723](https://github.com/Droid-Deck/DroidDeck/pull/2723), [#2882](https://github.com/Droid-Deck/DroidDeck/pull/2882), [#2970](https://github.com/Droid-Deck/DroidDeck/pull/2970))
|
||||
|
||||
- **Launcher controller and gesture settings:** LT and RT step between main tabs on every layout, a light **haptic tick** follows controller navigation, and **Swipe between pages** can be turned off, with edge swipes in landscape left to Android. (@2-Shar, @xXJSONDeruloXx, [#3035](https://github.com/Droid-Deck/DroidDeck/pull/3035), [#3039](https://github.com/Droid-Deck/DroidDeck/pull/3039), [#2993](https://github.com/Droid-Deck/DroidDeck/pull/2993), [#2924](https://github.com/Droid-Deck/DroidDeck/pull/2924))
|
||||
|
||||
- **A smoother first run.** The runtime, DroidDeck-Proton and Steam’s package cache download in the background, one setup card and a progress chip show every step, and the first Play no longer waits on Steam, which already has its client update applied. Bluetooth is asked from the setup card, and Steam starts with big art and the bouncing logo screensaver. (@xXJSONDeruloXx, [#3091](https://github.com/Droid-Deck/DroidDeck/pull/3091), [#3114](https://github.com/Droid-Deck/DroidDeck/pull/3114), [#3087](https://github.com/Droid-Deck/DroidDeck/pull/3087), [#3152](https://github.com/Droid-Deck/DroidDeck/pull/3152))
|
||||
|
||||
### Improvements
|
||||
|
||||
- **Much faster games on a memory card.** DroidDeck no longer walks every game folder on the card at each session start and launch. A cold session start that took 7 to 170 s on 0.7.1 now takes 7 to 9 s, and across eight games cold start plus launch fell from an average of 104 s to 25 s. Steam’s file checks on the card are answered from a cache, so a 3,800-file install went from 261 s to 183.5 s. Reserving space, verifying and installing no longer drop to a slow path after one unsupported call. (@maxjivi05, [#2533](https://github.com/Droid-Deck/DroidDeck/pull/2533), [#2881](https://github.com/Droid-Deck/DroidDeck/pull/2881), [#2553](https://github.com/Droid-Deck/DroidDeck/pull/2553), [#2509](https://github.com/Droid-Deck/DroidDeck/pull/2509), [#2379](https://github.com/Droid-Deck/DroidDeck/pull/2379), [#2504](https://github.com/Droid-Deck/DroidDeck/pull/2504))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/sd-card-game-start.png" width="45%" alt="Bar chart of a cold session start plus game launch from the SD card for eight games, average of two runs: 37, 122, 19, 65, 177, 192, 50 and 174 seconds on 0.7.1, 35, 19, 18, 34, 26, 23, 26 and 24 seconds on 0.7.11"> <img src="media/0.7.11/sd-card-install-steps.png" width="45%" alt="Bar chart of SD card library steps before and after: reserving space 68.9 to 27.5 seconds, commit 150.9 to 104.0, whole install 261.0 to 183.5, move from internal to card 156.8 to 121.7, reserving space for a second program 33.9 to 12.5, and uninstall 12.3 to 9.2"></p>
|
||||
|
||||
- **Memory is managed automatically.** Sessions reclaim memory from what Android actually reports, react to a fast fall on large-RAM devices before Android kills the session, and no longer compress Steam after every game start. This fixes sessions killed with gigabytes free, such as a 15 GB AYN Thor Max with 5.3 GB available, and 5 to 10 s freezes every 30 s on 11 to 12 GB devices. The four manual memory settings under Performance are removed. (@maxjivi05, @xXJSONDeruloXx, [#2853](https://github.com/Droid-Deck/DroidDeck/pull/2853), [#2382](https://github.com/Droid-Deck/DroidDeck/pull/2382), [#2754](https://github.com/Droid-Deck/DroidDeck/pull/2754), [#2335](https://github.com/Droid-Deck/DroidDeck/pull/2335), [#2347](https://github.com/Droid-Deck/DroidDeck/pull/2347), [#2758](https://github.com/Droid-Deck/DroidDeck/pull/2758))
|
||||
- **Steam’s shader pre-caching is on by default**, so games get Valve’s prebuilt shaders and stutter less on first play. (@xXJSONDeruloXx, [#2888](https://github.com/Droid-Deck/DroidDeck/pull/2888))
|
||||
- **Landscape and portrait resolutions are set separately**, each able to follow the other, and an **Avoid notch** switch in Steam’s Display options keeps the picture out of the camera cutout. (@FX192, @The412Banner, [#2990](https://github.com/Droid-Deck/DroidDeck/pull/2990), [#2983](https://github.com/Droid-Deck/DroidDeck/pull/2983), [#3124](https://github.com/Droid-Deck/DroidDeck/pull/3124))
|
||||
|
||||
<p align="center"><img src="media/0.7.11/display-resolutions.jpg" width="50%" alt="Steam Settings > Display with a Landscape resolution of 1280×720 and a Portrait resolution that follows landscape at 720×1280"></p>
|
||||
|
||||
- **Play Protect installs DroidDeck without a warning**: the app targets Android 14, and the shortcut accessibility service moved into an optional companion. (@xXJSONDeruloXx, [#2683](https://github.com/Droid-Deck/DroidDeck/pull/2683), [#2654](https://github.com/Droid-Deck/DroidDeck/pull/2654), [#2764](https://github.com/Droid-Deck/DroidDeck/pull/2764), [#2774](https://github.com/Droid-Deck/DroidDeck/pull/2774))
|
||||
- **Cooler steady games:** a game holding 30 fps or more for 3 s moves off the fastest cores, and the busiest game threads get a boost on every Snapdragon 8 Elite phone, not only the Odin 3. (@xXJSONDeruloXx, @Tapuuk, @xlulx, [#2572](https://github.com/Droid-Deck/DroidDeck/pull/2572), [#2608](https://github.com/Droid-Deck/DroidDeck/pull/2608), [#2914](https://github.com/Droid-Deck/DroidDeck/pull/2914))
|
||||
- **Turnip system-memory rendering** now reaches games and apps, not only the Steam client, and Steam’s interface uses GPU compositing where the driver supports it. (@maxjivi05, [#2338](https://github.com/Droid-Deck/DroidDeck/pull/2338), [#2660](https://github.com/Droid-Deck/DroidDeck/pull/2660))
|
||||
- **Mali:** MaliBridge 0.5.5.4, with the RE6 benchmark at about 25 fps on a Galaxy Tab S10+ and fewer hangs; DXVK runs on Mali GPUs without dual-source blending; and the x86-64 Steam client starts on Venus. (@ASEbrahim, @maxjivi05, [#2704](https://github.com/Droid-Deck/DroidDeck/pull/2704), [#2293](https://github.com/Droid-Deck/DroidDeck/pull/2293), [#2601](https://github.com/Droid-Deck/DroidDeck/pull/2601))
|
||||
- **Programs that need no proot.** Without proot, AppImages, Electron and Chromium apps, Flatpaks, Go programs, scripts without a shebang line and package updates that set file capabilities start as they do with proot, and x86 programs under FEX see the session’s identity, Unix sockets, locales and GL libraries. FEX follows the latest release, and Plasma and Firefox draw on the system PowerVR driver. (@maxjivi05, @The412Banner, @JMLambo, [#3096](https://github.com/Droid-Deck/DroidDeck/pull/3096), [#3097](https://github.com/Droid-Deck/DroidDeck/pull/3097), [#3098](https://github.com/Droid-Deck/DroidDeck/pull/3098), [#3099](https://github.com/Droid-Deck/DroidDeck/pull/3099), [#3103](https://github.com/Droid-Deck/DroidDeck/pull/3103), [#3104](https://github.com/Droid-Deck/DroidDeck/pull/3104), [#3106](https://github.com/Droid-Deck/DroidDeck/pull/3106), [#3108](https://github.com/Droid-Deck/DroidDeck/pull/3108), [#3112](https://github.com/Droid-Deck/DroidDeck/pull/3112), [#3120](https://github.com/Droid-Deck/DroidDeck/pull/3120), [#3121](https://github.com/Droid-Deck/DroidDeck/pull/3121), [#3147](https://github.com/Droid-Deck/DroidDeck/pull/3147), [#3151](https://github.com/Droid-Deck/DroidDeck/pull/3151), [#3154](https://github.com/Droid-Deck/DroidDeck/pull/3154), [#3155](https://github.com/Droid-Deck/DroidDeck/pull/3155), [#3157](https://github.com/Droid-Deck/DroidDeck/pull/3157), [#3158](https://github.com/Droid-Deck/DroidDeck/pull/3158), [#3159](https://github.com/Droid-Deck/DroidDeck/pull/3159), [#3161](https://github.com/Droid-Deck/DroidDeck/pull/3161), [#3162](https://github.com/Droid-Deck/DroidDeck/pull/3162), [#3171](https://github.com/Droid-Deck/DroidDeck/pull/3171), [#3077](https://github.com/Droid-Deck/DroidDeck/pull/3077), [#3059](https://github.com/Droid-Deck/DroidDeck/pull/3059), [#3054](https://github.com/Droid-Deck/DroidDeck/pull/3054), [#3055](https://github.com/Droid-Deck/DroidDeck/pull/3055), [#3074](https://github.com/Droid-Deck/DroidDeck/pull/3074), [#3094](https://github.com/Droid-Deck/DroidDeck/pull/3094), [#3105](https://github.com/Droid-Deck/DroidDeck/pull/3105), [#3110](https://github.com/Droid-Deck/DroidDeck/pull/3110), [#3070](https://github.com/Droid-Deck/DroidDeck/pull/3070), [#3052](https://github.com/Droid-Deck/DroidDeck/pull/3052), [#3040](https://github.com/Droid-Deck/DroidDeck/pull/3040), [#3020](https://github.com/Droid-Deck/DroidDeck/pull/3020), [#3026](https://github.com/Droid-Deck/DroidDeck/pull/3026), [#2836](https://github.com/Droid-Deck/DroidDeck/pull/2836), [#2839](https://github.com/Droid-Deck/DroidDeck/pull/2839))
|
||||
- **A first launch with nothing to unpack:** setup applies Steam’s client update itself, so the first Steam start skips about 30 s of unpacking and its restart, and a failed package claim now fails the install instead of leaving it half done. (@xXJSONDeruloXx, [#3152](https://github.com/Droid-Deck/DroidDeck/pull/3152), [#3145](https://github.com/Droid-Deck/DroidDeck/pull/3145), [#3149](https://github.com/Droid-Deck/DroidDeck/pull/3149))
|
||||
- **Pressing Play on a launcher-run game** shows Starting until it launches, instead of sitting on Play for 12 to 24 s. (@maxjivi05, [#2586](https://github.com/Droid-Deck/DroidDeck/pull/2586))
|
||||
- **A session that fails to start says why**, and stopping a session while it starts undoes the start-up work. (@Tapuuk, [#2841](https://github.com/Droid-Deck/DroidDeck/pull/2841), [#2840](https://github.com/Droid-Deck/DroidDeck/pull/2840))
|
||||
- **Battle.net** keeps the launch behavior you chose, shows its own reason when it refuses a game folder, lists its games under the runtime path, and a download that stops moving ends with Retry. (@xXJSONDeruloXx, @visail, @maxjivi05, [#2750](https://github.com/Droid-Deck/DroidDeck/pull/2750), [#1661](https://github.com/Droid-Deck/DroidDeck/pull/1661), [#2602](https://github.com/Droid-Deck/DroidDeck/pull/2602), [#3188](https://github.com/Droid-Deck/DroidDeck/pull/3188))
|
||||
- **On-screen stick knobs redraw at about 30 fps** instead of on every move, and **Gamescope draws its cursor by default**. (@Tapuuk, @xXJSONDeruloXx, [#2842](https://github.com/Droid-Deck/DroidDeck/pull/2842), [#3187](https://github.com/Droid-Deck/DroidDeck/pull/3187))
|
||||
- **The agent’s setup install retries** on transient source errors and no longer accepts a held-back package. (@xXJSONDeruloXx, [#2904](https://github.com/Droid-Deck/DroidDeck/pull/2904))
|
||||
- **Translations** cover the missing strings, including the input settings, in every language. (@kingokksa, [#2556](https://github.com/Droid-Deck/DroidDeck/pull/2556))
|
||||
- **Clearer logs** for bug reports: runtime install failures, GPU driver lines, GOG cloud sync failures, device restarts, guest start steps, errors from Windows programs started from the desktop, GPU clock holds, and RPCS3’s own log in Share logs. (@maxjivi05, @The412Banner, @xXJSONDeruloXx, [#2591](https://github.com/Droid-Deck/DroidDeck/pull/2591), [#2593](https://github.com/Droid-Deck/DroidDeck/pull/2593), [#2596](https://github.com/Droid-Deck/DroidDeck/pull/2596), [#2752](https://github.com/Droid-Deck/DroidDeck/pull/2752), [#2502](https://github.com/Droid-Deck/DroidDeck/pull/2502), [#2695](https://github.com/Droid-Deck/DroidDeck/pull/2695), [#2343](https://github.com/Droid-Deck/DroidDeck/pull/2343), [#2893](https://github.com/Droid-Deck/DroidDeck/pull/2893), [#3130](https://github.com/Droid-Deck/DroidDeck/pull/3130))
|
||||
- Building and testing: local builds work on x86_64 Linux, source builds start on storage without hard links, test tools for pens and two-screen phones, preview renders of the Library and in-game menu, and steadier CI. (@xXJSONDeruloXx, @maxjivi05, @alien2003, @Tapuuk, [#2807](https://github.com/Droid-Deck/DroidDeck/pull/2807), [#2639](https://github.com/Droid-Deck/DroidDeck/pull/2639), [#2628](https://github.com/Droid-Deck/DroidDeck/pull/2628), [#2844](https://github.com/Droid-Deck/DroidDeck/pull/2844), [#2469](https://github.com/Droid-Deck/DroidDeck/pull/2469), [#2483](https://github.com/Droid-Deck/DroidDeck/pull/2483), [#2672](https://github.com/Droid-Deck/DroidDeck/pull/2672), [#2635](https://github.com/Droid-Deck/DroidDeck/pull/2635), [#2908](https://github.com/Droid-Deck/DroidDeck/pull/2908), [#2899](https://github.com/Droid-Deck/DroidDeck/pull/2899), [#2938](https://github.com/Droid-Deck/DroidDeck/pull/2938))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed **games failing to start since 0.7.1** in ARM64 prefixes, such as Unreal Engine games asking for the Visual C++ arm64 redistributable and Red Dead Redemption 2 missing `vulkan-1.dll`. (@xXJSONDeruloXx, @maxjivi05, [#2442](https://github.com/Droid-Deck/DroidDeck/pull/2442), [#2647](https://github.com/Droid-Deck/DroidDeck/pull/2647))
|
||||
- Fixed **Windows games on Android shared storage** crashing at launch, and 32-bit games such as Spore, Terraria and Borderlands 2 hanging at launch after that fix. (@maxjivi05, @xXJSONDeruloXx, [#2594](https://github.com/Droid-Deck/DroidDeck/pull/2594), [#2706](https://github.com/Droid-Deck/DroidDeck/pull/2706))
|
||||
- Fixed **digital triggers** on handhelds such as the AYN Thor no longer responding since 0.7.0, **right sticks reported on other axes** never reaching the game, and the app closing when a controller disconnects mid-press. (@maxjivi05, [#2291](https://github.com/Droid-Deck/DroidDeck/pull/2291), [#2333](https://github.com/Droid-Deck/DroidDeck/pull/2333), [#2369](https://github.com/Droid-Deck/DroidDeck/pull/2369))
|
||||
- Fixed **driver picks on non-Adreno and smaller Adreno GPUs**: Auto no longer gives Adreno 710, 720 and 722 a display driver that finds no GPU, gives Xclipse 540 a working driver pair instead of a black Steam at about 1 fps, never loads an Adreno-only driver elsewhere, lets Auto-installed display drivers fall back to the system driver, and handles the Mali bridge switch correctly. (@maxjivi05, @unixenon, @The412Banner, [#2356](https://github.com/Droid-Deck/DroidDeck/pull/2356), [#2337](https://github.com/Droid-Deck/DroidDeck/pull/2337), [#2588](https://github.com/Droid-Deck/DroidDeck/pull/2588), [#2406](https://github.com/Droid-Deck/DroidDeck/pull/2406), [#2684](https://github.com/Droid-Deck/DroidDeck/pull/2684), [#2977](https://github.com/Droid-Deck/DroidDeck/pull/2977))
|
||||
- Fixed **Steam flickering on the Mali bridge** and **stalling on Venus** with a Dimensity 9300. (@rainleee, @The412Banner, @xXJSONDeruloXx, [#2506](https://github.com/Droid-Deck/DroidDeck/pull/2506), [#2721](https://github.com/Droid-Deck/DroidDeck/pull/2721), [#2441](https://github.com/Droid-Deck/DroidDeck/pull/2441))
|
||||
- Fixed **Epic’s Install** failing for everyone after Epic stopped publishing its Linux launcher download, and Epic now says which launcher installs a third-party game. (@maxjivi05, [#2281](https://github.com/Droid-Deck/DroidDeck/pull/2281), [#2344](https://github.com/Droid-Deck/DroidDeck/pull/2344))
|
||||
- Fixed **Game Pass downloads and launches** failing with HTTP 401, and Xbox games reporting the account service unavailable. (@maxjivi05, @Zeratullo, [#2598](https://github.com/Droid-Deck/DroidDeck/pull/2598), [#2751](https://github.com/Droid-Deck/DroidDeck/pull/2751))
|
||||
- Fixed **Xbox games that use PlayFab Game Saves**, such as Forza Horizon 6, stopping at “Initialization Failed”, and **older Xbox games** not installing: they now install through Windows Update or from their content boxes, with Nexus backend 0.2.15 and DLC mounting. Xbox sign-in also looks like the other stores’. (@l4nr3, @xXJSONDeruloXx, @The412Banner, [#2662](https://github.com/Droid-Deck/DroidDeck/pull/2662), [#2718](https://github.com/Droid-Deck/DroidDeck/pull/2718), [#2825](https://github.com/Droid-Deck/DroidDeck/pull/2825), [#2851](https://github.com/Droid-Deck/DroidDeck/pull/2851), [#2696](https://github.com/Droid-Deck/DroidDeck/pull/2696))
|
||||
- Fixed **game-specific crashes**: Death Stranding running out of memory on 39-bit kernels, Godot games with Sentry or UI Automation crashing, Final Fantasy VII Rebirth and Kingdom Come: Deliverance II at the D3D12 level they need, a game’s own DLL overrides replacing DroidDeck’s, and Call of Duty: Black Ops II starting through Steam. (@KeegantheVeganat0r, @Kobtul, @maxjivi05, @xXJSONDeruloXx, @Drik0, [#2641](https://github.com/Droid-Deck/DroidDeck/pull/2641), [#2644](https://github.com/Droid-Deck/DroidDeck/pull/2644), [#2605](https://github.com/Droid-Deck/DroidDeck/pull/2605), [#2595](https://github.com/Droid-Deck/DroidDeck/pull/2595), [#2289](https://github.com/Droid-Deck/DroidDeck/pull/2289), [#2787](https://github.com/Droid-Deck/DroidDeck/pull/2787), [#2332](https://github.com/Droid-Deck/DroidDeck/pull/2332), [#2892](https://github.com/Droid-Deck/DroidDeck/pull/2892))
|
||||
- Fixed **the Desktop session**: it draws again and Sunshine can capture it, Windows games started from Steam no longer close after a second, Flatpak apps get the GPU and working file dialogs, and removable drives show in Dolphin. (@xXJSONDeruloXx, @maxjivi05, [#2780](https://github.com/Droid-Deck/DroidDeck/pull/2780), [#2446](https://github.com/Droid-Deck/DroidDeck/pull/2446), [#2597](https://github.com/Droid-Deck/DroidDeck/pull/2597), [#2699](https://github.com/Droid-Deck/DroidDeck/pull/2699), [#2671](https://github.com/Droid-Deck/DroidDeck/pull/2671), [#3190](https://github.com/Droid-Deck/DroidDeck/pull/3190))
|
||||
- Fixed **audio not coming back** after a long sleep, and **the HUD and game clocks** reading wrong after sleep and wake. (@maxjivi05, @xXJSONDeruloXx, [#2396](https://github.com/Droid-Deck/DroidDeck/pull/2396), [#2821](https://github.com/Droid-Deck/DroidDeck/pull/2821), [#2393](https://github.com/Droid-Deck/DroidDeck/pull/2393), [#2552](https://github.com/Droid-Deck/DroidDeck/pull/2552))
|
||||
- Fixed **Epic games that check for Epic’s launcher**, such as GTA V, quitting at start (they now also get the Rockstar SDK they need), and the **itch.io browse grid** staying empty on the default filters. (@K11MCH1, @FX192, [#2932](https://github.com/Droid-Deck/DroidDeck/pull/2932), [#2918](https://github.com/Droid-Deck/DroidDeck/pull/2918))
|
||||
- Fixed **other apps reaching DroidDeck’s private folders** through the system folder picker. (@Tapuuk, [#2846](https://github.com/Droid-Deck/DroidDeck/pull/2846))
|
||||
- Fixed **input and controls**: the on-screen controls editor drawing layouts squashed and overlapping, and saving a Steam touch layout for a game with no touch config; touch stopping after overlapping touches, taps clicking while an on-screen mouse button shows, and System Back turning into a right-click; a USB mouse in REDMAGIC cast mode stopping at the screen edge, held keys dropping when pointer capture ends, and rumble that kept going after a crash; controller navigation on the Apps page, B closing the page behind the on-screen keyboard, and the file manager toolbar after a drive change; a DualShock or DualSense picked mid-session not reattaching to Steam; SDL 3 games and apps that reload libudev crashing on the virtual pads, hardware Escape reaching Back late, and the nested mouse not moving with touch Disabled; launcher focus ring and navigation glitches, including the game page’s main action and tabs (@maxjivi05, @kingokksa, @OmarAlTaki1, @KvFxKaido, @zdennisz, @Tapuuk, @DeathKhan, @Dantalian-dev, @xXJSONDeruloXx, @Necomer0920, @0use-TE, @The412Banner, @xlulx, @2-Shar, [#2339](https://github.com/Droid-Deck/DroidDeck/pull/2339), [#2783](https://github.com/Droid-Deck/DroidDeck/pull/2783), [#2580](https://github.com/Droid-Deck/DroidDeck/pull/2580), [#2528](https://github.com/Droid-Deck/DroidDeck/pull/2528), [#2465](https://github.com/Droid-Deck/DroidDeck/pull/2465), [#2323](https://github.com/Droid-Deck/DroidDeck/pull/2323), [#2298](https://github.com/Droid-Deck/DroidDeck/pull/2298), [#2666](https://github.com/Droid-Deck/DroidDeck/pull/2666), [#2779](https://github.com/Droid-Deck/DroidDeck/pull/2779), [#2614](https://github.com/Droid-Deck/DroidDeck/pull/2614), [#2492](https://github.com/Droid-Deck/DroidDeck/pull/2492), [#2499](https://github.com/Droid-Deck/DroidDeck/pull/2499), [#2534](https://github.com/Droid-Deck/DroidDeck/pull/2534), [#2544](https://github.com/Droid-Deck/DroidDeck/pull/2544), [#2545](https://github.com/Droid-Deck/DroidDeck/pull/2545), [#2543](https://github.com/Droid-Deck/DroidDeck/pull/2543), [#2498](https://github.com/Droid-Deck/DroidDeck/pull/2498), [#2564](https://github.com/Droid-Deck/DroidDeck/pull/2564), [#2567](https://github.com/Droid-Deck/DroidDeck/pull/2567), [#2963](https://github.com/Droid-Deck/DroidDeck/pull/2963), [#2915](https://github.com/Droid-Deck/DroidDeck/pull/2915), [#3180](https://github.com/Droid-Deck/DroidDeck/pull/3180), [#2976](https://github.com/Droid-Deck/DroidDeck/pull/2976), [#2902](https://github.com/Droid-Deck/DroidDeck/pull/2902), [#3008](https://github.com/Droid-Deck/DroidDeck/pull/3008), [#2961](https://github.com/Droid-Deck/DroidDeck/pull/2961), [#3036](https://github.com/Droid-Deck/DroidDeck/pull/3036), [#3039](https://github.com/Droid-Deck/DroidDeck/pull/3039), [#2906](https://github.com/Droid-Deck/DroidDeck/pull/2906), [#2909](https://github.com/Droid-Deck/DroidDeck/pull/2909), [#3082](https://github.com/Droid-Deck/DroidDeck/pull/3082), [#2994](https://github.com/Droid-Deck/DroidDeck/pull/2994), [#2973](https://github.com/Droid-Deck/DroidDeck/pull/2973), [#2929](https://github.com/Droid-Deck/DroidDeck/pull/2929), [#3017](https://github.com/Droid-Deck/DroidDeck/pull/3017))
|
||||
- Fixed **Steam, stores and the Library**: x86-64 Steam store shortcuts that closed within a second, x86-64 Linux games missing libraries under FEX, and 32-bit games such as Left 4 Dead 2 aborting; Steam coming back empty after aborting a black-screen game, and an OpenGL game going black after a level; Return to DroidDeck ending the session at Steam’s install-script step, and Steam’s saved scaling mode not applying; Steam’s frame limits following Game Mode’s FPS override instead of the screen; cloud saves missing for a Steam game launched as an added game; GOG installs hanging on Finishing for games with thousands of files; GOG space checks and cloud saves, an Epic sign-in loop, EA touchup retries, Xbox bundles, and Battle.net games vanishing after a native session; Steam-install and Add game picker oddities, plus a warning when game storage is FAT32; launch requests now handled one at a time, and FEX or AppImage extraction hanging at start-up; Remote Play failing to connect with the virtual pads present, and fullscreen streams cropped to a corner (@maxjivi05, @xXJSONDeruloXx, @The412Banner, @KvFxKaido, @moronigranja, @zdennisz, @visail, @guohaomin1995-dev, [#2336](https://github.com/Droid-Deck/DroidDeck/pull/2336), [#2334](https://github.com/Droid-Deck/DroidDeck/pull/2334), [#2484](https://github.com/Droid-Deck/DroidDeck/pull/2484), [#2592](https://github.com/Droid-Deck/DroidDeck/pull/2592), [#2426](https://github.com/Droid-Deck/DroidDeck/pull/2426), [#2600](https://github.com/Droid-Deck/DroidDeck/pull/2600), [#2562](https://github.com/Droid-Deck/DroidDeck/pull/2562), [#2732](https://github.com/Droid-Deck/DroidDeck/pull/2732), [#2681](https://github.com/Droid-Deck/DroidDeck/pull/2681), [#2717](https://github.com/Droid-Deck/DroidDeck/pull/2717), [#2463](https://github.com/Droid-Deck/DroidDeck/pull/2463), [#2367](https://github.com/Droid-Deck/DroidDeck/pull/2367), [#2419](https://github.com/Droid-Deck/DroidDeck/pull/2419), [#2720](https://github.com/Droid-Deck/DroidDeck/pull/2720), [#3025](https://github.com/Droid-Deck/DroidDeck/pull/3025), [#2421](https://github.com/Droid-Deck/DroidDeck/pull/2421), [#2505](https://github.com/Droid-Deck/DroidDeck/pull/2505), [#3172](https://github.com/Droid-Deck/DroidDeck/pull/3172), [#3175](https://github.com/Droid-Deck/DroidDeck/pull/3175), [#3003](https://github.com/Droid-Deck/DroidDeck/pull/3003), [#3029](https://github.com/Droid-Deck/DroidDeck/pull/3029), [#3148](https://github.com/Droid-Deck/DroidDeck/pull/3148), [#3075](https://github.com/Droid-Deck/DroidDeck/pull/3075), [#2742](https://github.com/Droid-Deck/DroidDeck/pull/2742), [#2411](https://github.com/Droid-Deck/DroidDeck/pull/2411), [#2818](https://github.com/Droid-Deck/DroidDeck/pull/2818), [#3177](https://github.com/Droid-Deck/DroidDeck/pull/3177), [#3123](https://github.com/Droid-Deck/DroidDeck/pull/3123), [#2883](https://github.com/Droid-Deck/DroidDeck/pull/2883), [#3044](https://github.com/Droid-Deck/DroidDeck/pull/3044), [#3070](https://github.com/Droid-Deck/DroidDeck/pull/3070), [#2651](https://github.com/Droid-Deck/DroidDeck/pull/2651), [#2946](https://github.com/Droid-Deck/DroidDeck/pull/2946), [#2968](https://github.com/Droid-Deck/DroidDeck/pull/2968), [#3095](https://github.com/Droid-Deck/DroidDeck/pull/3095))
|
||||
- Fixed **display and drivers**: broken pictures on GPUs such as the Adreno 710 whose driver lists no buffer layouts; display and Steam window sizes after Steam resizes the game screen; the Mali bridge switch, Zink on Mali-G610 and shaders the phone’s compiler rejected (@The412Banner, @xXJSONDeruloXx, @LarzVader, @maxjivi05, [#2927](https://github.com/Droid-Deck/DroidDeck/pull/2927), [#2738](https://github.com/Droid-Deck/DroidDeck/pull/2738), [#3124](https://github.com/Droid-Deck/DroidDeck/pull/3124), [#2985](https://github.com/Droid-Deck/DroidDeck/pull/2985), [#3076](https://github.com/Droid-Deck/DroidDeck/pull/3076), [#3164](https://github.com/Droid-Deck/DroidDeck/pull/3164), [#3102](https://github.com/Droid-Deck/DroidDeck/pull/3102), [#3101](https://github.com/Droid-Deck/DroidDeck/pull/3101), [#2587](https://github.com/Droid-Deck/DroidDeck/pull/2587))
|
||||
- Fixed **a few more things**: a session freezing while a program waits for a browser sign-in, and picture-in-picture leaving no way back; the bottom screen ignoring touch during a game, and launching a running game again asking Steam twice; the app closing when opening Game environment from the second screen; the Stores tab moving under More, apps opening on the wrong screen, and the launcher freezing after a language change; game starts for Hades II, Dragon’s Dogma 2, Dragon Quest Monsters 4, Mount & Blade: Warband, Don’t Starve Together and Europa Universalis IV; x86 Steam stopping at Installing update under FEX, Battle.net unable to repair ProgramData folders a stale Windows owner locked, Windows programs reading the wrong CPU cache sizes, RetroArch’s packaged assets and cores, and non-Adreno graphics logs turning on Wine debug tracing; the desktop panel layout and KDE language packs; Decky Loader’s menu, Electron Node helpers, a Bluetooth controller that fails to disconnect closing the app, and per-game Turnip debug settings. Dual screen sessions also gets **On, game on second screen**, for a phone driving a monitor or TV (@maxjivi05, @xXJSONDeruloXx, @albert-carreras, @The412Banner, @xlulx, @Tapuuk, @zdennisz, @coffeemeist3r, [#2615](https://github.com/Droid-Deck/DroidDeck/pull/2615), [#2559](https://github.com/Droid-Deck/DroidDeck/pull/2559), [#2910](https://github.com/Droid-Deck/DroidDeck/pull/2910), [#2937](https://github.com/Droid-Deck/DroidDeck/pull/2937), [#2919](https://github.com/Droid-Deck/DroidDeck/pull/2919), [#2940](https://github.com/Droid-Deck/DroidDeck/pull/2940), [#2452](https://github.com/Droid-Deck/DroidDeck/pull/2452), [#3115](https://github.com/Droid-Deck/DroidDeck/pull/3115), [#3093](https://github.com/Droid-Deck/DroidDeck/pull/3093), [#3163](https://github.com/Droid-Deck/DroidDeck/pull/3163), [#2855](https://github.com/Droid-Deck/DroidDeck/pull/2855), [#3011](https://github.com/Droid-Deck/DroidDeck/pull/3011), [#2847](https://github.com/Droid-Deck/DroidDeck/pull/2847), [#3092](https://github.com/Droid-Deck/DroidDeck/pull/3092), [#2998](https://github.com/Droid-Deck/DroidDeck/pull/2998), [#3173](https://github.com/Droid-Deck/DroidDeck/pull/3173), [#2845](https://github.com/Droid-Deck/DroidDeck/pull/2845), [#2481](https://github.com/Droid-Deck/DroidDeck/pull/2481), [#2418](https://github.com/Droid-Deck/DroidDeck/pull/2418), [#2670](https://github.com/Droid-Deck/DroidDeck/pull/2670), [#2254](https://github.com/Droid-Deck/DroidDeck/pull/2254), [#2327](https://github.com/Droid-Deck/DroidDeck/pull/2327), [#2703](https://github.com/Droid-Deck/DroidDeck/pull/2703), [#2549](https://github.com/Droid-Deck/DroidDeck/pull/2549), [#2808](https://github.com/Droid-Deck/DroidDeck/pull/2808), [#2781](https://github.com/Droid-Deck/DroidDeck/pull/2781), [#2178](https://github.com/Droid-Deck/DroidDeck/pull/2178), [#2197](https://github.com/Droid-Deck/DroidDeck/pull/2197), [#3193](https://github.com/Droid-Deck/DroidDeck/pull/3193), [#3194](https://github.com/Droid-Deck/DroidDeck/pull/3194), [#2705](https://github.com/Droid-Deck/DroidDeck/pull/2705), [#2451](https://github.com/Droid-Deck/DroidDeck/pull/2451), [#2730](https://github.com/Droid-Deck/DroidDeck/pull/2730))
|
||||
|
||||
### DroidDeck-Proton and drivers
|
||||
|
||||
These ship outside the app and reach you through Components. DroidDeck 0.7.1 had DroidDeck-Proton 11-12.3 and DD-Turnip v0.5.0; 0.7.11 brings DroidDeck-Proton 11-14.1 and DD-Turnip v0.9.1.
|
||||
|
||||
- **Faster game starts, most of all from a memory card** (DroidDeck-Proton 11-12.5 to 11-12.7). Closing an event no longer stops every other thread while wineserver answers, events come back ready to wait on, closed private events are reused, and file lookups skip extended-attribute queries and folder scans a memory card can’t answer. World of Warcraft’s start fell from 111 s to 60 s. (@maxjivi05, [Proton#17](https://github.com/Droid-Deck/DroidDeck-Proton/pull/17), [Proton#19](https://github.com/Droid-Deck/DroidDeck-Proton/pull/19), [Proton#26](https://github.com/Droid-Deck/DroidDeck-Proton/pull/26))
|
||||
- Fixed **games that debug a copy of themselves**, such as Metal Gear Solid V: Ground Zeroes, stuck on the same breakpoint at start, and **old Steam DRM games failing with error 55**. (@xXJSONDeruloXx, [Proton#16](https://github.com/Droid-Deck/DroidDeck-Proton/pull/16), [Proton#12](https://github.com/Droid-Deck/DroidDeck-Proton/pull/12))
|
||||
- Fixed **intro videos that never end**, such as Burnout Paradise Remastered waiting forever on the last frame of its first intro. (@K11MCH1, [Proton#13](https://github.com/Droid-Deck/DroidDeck-Proton/pull/13), [Proton#14](https://github.com/Droid-Deck/DroidDeck-Proton/pull/14))
|
||||
- **DroidDeck-Proton 11-14.1 moves to GE-Proton11-14**, Valve’s Wine from 21 November and FEX-2611-68, with DXVK v3.1.1, VKD3D-Proton v3.1 and about 25 video playback fixes. Games that use D3D8 or 32-bit DirectDraw stay on wined3d, as in 11-12, unless you set `PROTON_DXVK_D3D8=1` or `PROTON_USE_D7VK=1`.
|
||||
- Fixed **games freezing after a thread is stopped mid-wait**, such as the Forza Horizon 6 loading screen, **Crash Bandicoot N. Sane Trilogy** closing seconds after its title screen, **Death Stranding Director’s Cut** crashing when a graphics setting is applied, **Call of Duty: Black Ops III** crashing about 20 seconds after start, and hooking libraries that couldn’t patch relocated 32-bit DLLs. (@l4nr3, @66sam, @KeegantheVeganat0r, @FryMcNugget, @maxjivi05, [Proton#30](https://github.com/Droid-Deck/DroidDeck-Proton/pull/30), [Proton#24](https://github.com/Droid-Deck/DroidDeck-Proton/pull/24), [Proton#31](https://github.com/Droid-Deck/DroidDeck-Proton/pull/31), [Proton#34](https://github.com/Droid-Deck/DroidDeck-Proton/pull/34), [Proton#40](https://github.com/Droid-Deck/DroidDeck-Proton/pull/40))
|
||||
- **DD-Turnip v0.6.0 to v0.9.1** follow Mesa main (more than 1,300 upstream commits). The GPU can clock down again when there is little to draw, so it runs cooler and saves battery, and game frames can go straight to the compositor’s display buffers for Zero-copy presentation. (@xXJSONDeruloXx, @maxjivi05, [Drivers#22](https://github.com/Droid-Deck/Drivers/pull/22), [Drivers#26](https://github.com/Droid-Deck/Drivers/pull/26), [Drivers#20](https://github.com/Droid-Deck/Drivers/pull/20), [Drivers#27](https://github.com/Droid-Deck/Drivers/pull/27))
|
||||
- **DD-Turnip-Emu**, the Android driver packaged for emulators, is now published with every DD-Turnip release. (@maxjivi05, [Drivers#31](https://github.com/Droid-Deck/Drivers/pull/31))
|
||||
- Fixed **invisible game menus after a descriptor pool reset**, such as the Scaleform UI in Detroit: Become Human on Adreno 840, and made **subgroup shuffles** cost one step instead of one per thread. (@l4nr3, [Drivers#12](https://github.com/Droid-Deck/Drivers/pull/12), [Drivers#10](https://github.com/Droid-Deck/Drivers/pull/10))
|
||||
|
||||
### Community
|
||||
|
||||
DroidDeck is built in the open by the people who use it. These are everyone whose code is in 0.7.11:
|
||||
|
||||
| Contributor | Pull requests |
|
||||
|---|---|
|
||||
| @xXJSONDeruloXx | 192: stores, run without proot, tabs and Settings, Library, screen picker, first run, Decky store and more |
|
||||
| @maxjivi05 | 141: zero-copy and HDR, memory card speed, memory management, CurseForge, on-screen controls, drivers and more |
|
||||
| @The412Banner | 23: DroidDeck-Bionic, Xbox backend, AppImages and Flatpaks without proot, Mali bridge |
|
||||
| @DeathKhan | 12: True black theme, Apps page, Home button |
|
||||
| @Tapuuk | 10: 8 Elite thread boost, start-up errors, HUD, CI |
|
||||
| @KeegantheVeganat0r | 9: Lab builds, Death Stranding fix |
|
||||
| @EnzoDLofi | 9: per-game frame generation, integer scaling, SMAA, Custom theme |
|
||||
| @2-Shar | 9: LT and RT tab stepping, page swipes, focus ring |
|
||||
| @FX192 | 8: Soundtracks, Favorites, Hidden tab, Manage stores, resolutions |
|
||||
| @kingokksa | 5: virtual pads outside Steam, HUD, translations |
|
||||
| @K11MCH1 | 4: Ubisoft launches, Epic launcher check |
|
||||
| @zdennisz | 4: held keys, FAT32 warning |
|
||||
| @alien2003 | 3: pen as a mouse, pen test tool, two-screen screenshots |
|
||||
| @Dantalian-dev | 3: file manager toolbar and Back, plain text editor |
|
||||
| @FryMcNugget | 3: Proton from a .zip, Lab build memory |
|
||||
| @xlulx | 3: SM8750P thread hints, nested mouse with touch disabled, native shader compilers for three games |
|
||||
| @JMLambo | 2: Plasma and Firefox on the system PowerVR driver |
|
||||
| @KvFxKaido | 2: Back gesture with controllers that bring a mouse, Xbox bundle packaging files |
|
||||
| @LarzVader | 2: Zink on Mali-G610, Mali layer map growth |
|
||||
| @visail | 2: Battle.net folder errors, launch request coordinator |
|
||||
| @0use-TE | 1: hardware Escape before Back |
|
||||
| @albert-carreras | 1: Dragon Quest Monsters 4 |
|
||||
| @ASEbrahim | 1: MaliBridge 0.5.5.4 |
|
||||
| @coffeemeist3r | 1: Mesa sampler fix |
|
||||
| @Drik0 | 1: per-game DLL overrides |
|
||||
| @guohaomin1995-dev | 1: arm64 Steam update progress in every language |
|
||||
| @informalTechCode | 1: XREAL One Pro+ tracking |
|
||||
| @JanPokorny | 1: Dev Harness focus fix |
|
||||
| @Kobtul | 1: Godot games with Sentry |
|
||||
| @l4nr3 | 1: Xbox PlayFab Game Saves |
|
||||
| @measlesbagel | 1: icon packs |
|
||||
| @mhaye20 | 1: XREAL One and Aura head tracking |
|
||||
| @moronigranja | 1: Steam target whose file is gone |
|
||||
| @Necomer0920 | 1: SDL 3 games and the virtual pads’ udev devices |
|
||||
| @OmarAlTaki1 | 1: USB mouse in cast mode |
|
||||
| @pablogonz12 | 1: payload shebangs |
|
||||
| @rainleee | 1: Mali bridge flicker |
|
||||
| @SlicelessBread | 1: Lab builds on 8 GB devices |
|
||||
| @unixenon | 1: Mali (Venus) switch after restart |
|
||||
| @vinegh4 | 1: Remote Play controllers |
|
||||
| @Zeratullo | 1: Xbox launch folder |
|
||||
| @66sam | 1: Crash Bandicoot fix in DroidDeck-Proton |
|
||||
|
||||
### New contributors
|
||||
|
||||
- @vinegh4 made their first contribution in [#2033](https://github.com/Droid-Deck/DroidDeck/pull/2033).
|
||||
- @measlesbagel made their first contribution in [#2207](https://github.com/Droid-Deck/DroidDeck/pull/2207).
|
||||
- @Drik0 made their first contribution in [#2332](https://github.com/Droid-Deck/DroidDeck/pull/2332).
|
||||
- @DeathKhan made their first contribution in [#2492](https://github.com/Droid-Deck/DroidDeck/pull/2492).
|
||||
- @rainleee made their first contribution in [#2506](https://github.com/Droid-Deck/DroidDeck/pull/2506).
|
||||
- @zdennisz made their first contribution in [#2524](https://github.com/Droid-Deck/DroidDeck/pull/2524).
|
||||
- @mhaye20 made their first contribution in [#2532](https://github.com/Droid-Deck/DroidDeck/pull/2532).
|
||||
- @Tapuuk made their first contribution in [#2607](https://github.com/Droid-Deck/DroidDeck/pull/2607).
|
||||
- @alien2003 made their first contribution in [#2625](https://github.com/Droid-Deck/DroidDeck/pull/2625).
|
||||
- @guohaomin1995-dev made their first contribution in [#2651](https://github.com/Droid-Deck/DroidDeck/pull/2651).
|
||||
- @KvFxKaido made their first contribution in [#2666](https://github.com/Droid-Deck/DroidDeck/pull/2666).
|
||||
- @SlicelessBread made their first contribution in [#2667](https://github.com/Droid-Deck/DroidDeck/pull/2667).
|
||||
- @unixenon made their first contribution in [#2684](https://github.com/Droid-Deck/DroidDeck/pull/2684).
|
||||
- @Zeratullo made their first contribution in [#2751](https://github.com/Droid-Deck/DroidDeck/pull/2751).
|
||||
- @JanPokorny made their first contribution in [#2769](https://github.com/Droid-Deck/DroidDeck/pull/2769).
|
||||
- @JMLambo made their first contribution in [#2836](https://github.com/Droid-Deck/DroidDeck/pull/2836).
|
||||
- @albert-carreras made their first contribution in [#2847](https://github.com/Droid-Deck/DroidDeck/pull/2847).
|
||||
- @2-Shar made their first contribution in [#2856](https://github.com/Droid-Deck/DroidDeck/pull/2856).
|
||||
- @FryMcNugget made their first contribution in [#2864](https://github.com/Droid-Deck/DroidDeck/pull/2864).
|
||||
- @xlulx made their first contribution in [#2914](https://github.com/Droid-Deck/DroidDeck/pull/2914).
|
||||
- @Necomer0920 made their first contribution in [#2915](https://github.com/Droid-Deck/DroidDeck/pull/2915).
|
||||
- @pablogonz12 made their first contribution in [#2930](https://github.com/Droid-Deck/DroidDeck/pull/2930).
|
||||
- @0use-TE made their first contribution in [#2976](https://github.com/Droid-Deck/DroidDeck/pull/2976).
|
||||
- @LarzVader made their first contribution in [#3101](https://github.com/Droid-Deck/DroidDeck/pull/3101).
|
||||
- @66sam made their first contribution in [Proton#24](https://github.com/Droid-Deck/DroidDeck-Proton/pull/24).
|
||||
|
||||
[Full changelog](https://github.com/Droid-Deck/DroidDeck/compare/0.7.1...0.7.11)
|
||||
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 139 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 160 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 255 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 109 KiB |
@@ -0,0 +1,45 @@
|
||||
DroidDeck bionic runtime pack: sources, credits and licences
|
||||
|
||||
Built by DroidDeck's CI with tools/bionic-runtime/build.sh (GPL-3.0, like DroidDeck). Exact pins and the
|
||||
sha256 of every file are in MANIFEST.txt.
|
||||
|
||||
Built from source in this pack:
|
||||
- layer/libVkLayer_FROG_gamescope_wsi_aarch64.so: gamescope's Vulkan WSI layer (Valve Corporation, BSD-2-Clause,
|
||||
https://github.com/ValveSoftware/gamescope) at the pinned tag with DroidDeck's patches 0117 and 0119
|
||||
(tools/gamescope/patches), using vkroots by Joshua Ashton (vkroots.h: Apache-2.0 OR MIT,
|
||||
https://github.com/Joshua-Ashton/vkroots) and the Khronos Vulkan-Headers (Apache-2.0 / MIT).
|
||||
- preload/libfakeinput.so: DroidDeck's app/src/main/cpp/fakeinput_steam.cpp, taken from WinNative by maxjivi05
|
||||
(GPL-3.0, https://github.com/WinNative-Emu/WinNative), mmap ring controller input by ribbit384 (WinNative #345).
|
||||
- preload/libnotag.so, bin/gstag: DroidDeck (GPL-3.0).
|
||||
- layer/libVkLayer_droiddeck_gpuload.so: DroidDeck's HUD GPU-load Vulkan layer (tools/gpuload, GPL-3.0), built for the
|
||||
bionic userland.
|
||||
|
||||
Taken unchanged from The412Banner's Bannerlator (GPL-3.0, https://github.com/The412Banner/Bannerlator):
|
||||
- lib/: Android builds of open-source libraries from Bannerlator's base imagefs
|
||||
(https://github.com/The412Banner/winlator-contents, release base-assets-v1), among them X.Org libX11/libXext/...
|
||||
and libxcb (MIT/X11), Wayland (MIT), SDL2 (zlib), GStreamer and its plugins, GLib, PulseAudio, GnuTLS, libsndfile,
|
||||
alsa-lib, libiconv (LGPL-2.1 or later), FreeType (FTL or GPL-2.0), Fontconfig (MIT), libxml2 (MIT), libffi (MIT),
|
||||
PCRE2 (BSD-3-Clause), zlib (zlib), and FFmpeg 8 libraries (LGPL-2.1 or later) from Bannerlator's ffmpeg8.tzst.
|
||||
share/X11 and etc/ (fonts, tls) come from the same imagefs.
|
||||
|
||||
From The412Banner/Banners-Turnip (https://github.com/The412Banner/Banners-Turnip, release
|
||||
fastgl-x11egl-mesa-d8cfbe8-r1):
|
||||
- egl/: Mesa (MIT, https://gitlab.freedesktop.org/mesa/mesa) EGL, GLX and Gallium with Zink at Mesa main d8cfbe82766,
|
||||
built for the bionic userland with the x11 and wayland platforms (branch fix/fastgl-zink-readback, the
|
||||
exp/egl-x11-platform recipe that builds Bannerlator's Fast OpenGL set), with libwayland-client (MIT) and libarchive
|
||||
(BSD-2-Clause); egl/x11egl.json records the build. Newer Mesa brings Zink's kopper front-buffer readback fixes by
|
||||
Mike Blumenkrantz.
|
||||
|
||||
From The412Banner/bionic-vulkan-wrapper (https://github.com/The412Banner/bionic-vulkan-wrapper, release
|
||||
wayland-adapter-placed-export-r1):
|
||||
- adapter/libvulkan_wrapper.so: the Wayland adapter Bannerlator ships (branch banner/wayland-wsi-bgra-native) plus
|
||||
placed-mapping fixes for 32-bit OpenGL / WineD3D (branch banner/wayland-wsi-placed-export), a Mesa tree (MIT) in
|
||||
the line of Pipetto-crypto's wrapper and leegao's bionic Vulkan wrapper. adapter/adapter.json records the build.
|
||||
|
||||
Taken unchanged from DroidDeck-Proton (https://github.com/Droid-Deck/DroidDeck-Proton, release DroidDeck-Proton-11-12.8):
|
||||
- d7vk/ddraw.dll: D7VK by WinterSnowfall (zlib, https://github.com/WinterSnowfall/d7vk, commit 06656b9e), Direct3D 7
|
||||
and older on Vulkan, based on DXVK by Philip Rebohle and contributors (zlib, https://github.com/doitsujin/dxvk);
|
||||
32-bit build from DroidDeck-Proton's CI.
|
||||
|
||||
Not in this pack: the bionic DroidDeck-Proton layer (The412Banner/proton-wine releases), GPU drivers, DXVK/VKD3D
|
||||
and FEX (DroidDeck components).
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"file_format_version" : "1.0.0",
|
||||
"layer" : {
|
||||
"name": "VK_LAYER_FROG_gamescope_wsi_aarch64",
|
||||
"type": "GLOBAL",
|
||||
"api_version": "1.3.221",
|
||||
"library_path": "./libVkLayer_FROG_gamescope_wsi_aarch64.so",
|
||||
"implementation_version": "1",
|
||||
"description": "Gamescope WSI (XWayland Bypass) Layer (aarch64), bionic build",
|
||||
"functions": { "vkNegotiateLoaderLayerInterfaceVersion": "vkNegotiateLoaderLayerInterfaceVersion" },
|
||||
"enable_environment": { "ENABLE_GAMESCOPE_WSI": "1" },
|
||||
"disable_environment": { "DISABLE_GAMESCOPE_WSI": "1" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// glibc's program_invocation_name is __progname in Android's libc (exported, set from argv[0]).
|
||||
#pragma once
|
||||
#ifdef __cplusplus
|
||||
extern "C" char *__progname;
|
||||
#else
|
||||
extern char *__progname;
|
||||
#endif
|
||||
#define program_invocation_name __progname
|
||||
#define program_invocation_short_name __progname
|
||||
@@ -0,0 +1,272 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds DroidDeck's bionic runtime pack: the Android-side (bionic libc) pieces a bionic DroidDeck-Proton layer
|
||||
# needs inside DroidDeck's gamescope session. The Proton layer itself comes from The412Banner/proton-wine releases;
|
||||
# GPU drivers, DXVK/VKD3D and FEX stay app options. Binaries target Android 11+ (API 30: the fake-input
|
||||
# library hooks statx).
|
||||
#
|
||||
# usage: NDK=<Android NDK root> tools/bionic-runtime/build.sh <work dir> <out dir>
|
||||
# host needs: curl git tar zstd python3, wayland-scanner, and the X11/xcb/wayland/glm headers
|
||||
# (Debian/Ubuntu: libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libglm-dev)
|
||||
set -euo pipefail
|
||||
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT=$(cd "$HERE/../.." && pwd)
|
||||
WORK=${1:?usage: build.sh <work dir> <out dir>}
|
||||
OUT=${2:?usage: build.sh <work dir> <out dir>}
|
||||
: "${NDK:?set NDK to the Android NDK root}"
|
||||
API=30
|
||||
|
||||
# Pinned inputs (bump together with their sha256).
|
||||
IMAGEFS_URL=https://github.com/The412Banner/winlator-contents/releases/download/base-assets-v1/imagefs.tar.zst
|
||||
IMAGEFS_SHA256=7838756e6a05c91afff68f4bf12aa2780f815877753f8dd354e203e99b9caf8a # same pin as Bannerlator app/build.gradle
|
||||
BL_COMMIT=410c969dfe37ed0c687d6a5ee3327ea21a53e0f8 # The412Banner/Bannerlator
|
||||
BL_ASSETS=https://raw.githubusercontent.com/The412Banner/Bannerlator/$BL_COMMIT/app/src/main/assets
|
||||
# The Wayland adapter: Bannerlator's (bionic-vulkan-wrapper banner/wayland-wsi-bgra-native f970b6c) plus the placed-
|
||||
# mapping fixes 32-bit OpenGL / WineD3D need (branch banner/wayland-wsi-placed-export), from that repository's release.
|
||||
ADAPTER_URL=https://github.com/The412Banner/bionic-vulkan-wrapper/releases/download/wayland-adapter-placed-export-r1
|
||||
ADAPTER_SHA256=653791c2c2ea904a5122909f01d26689553e91cc4dc7a981478c1303adc96ea5 # libvulkan_wrapper.so
|
||||
ADAPTER_JSON_SHA256=5448fd64f15fa13ca3c805967c2b4788eb5f86d29a2d2755e15498130cdef9b3
|
||||
# OpenGL: the Fast OpenGL Mesa set (EGL + GLX + Zink) rebuilt from Mesa main d8cfbe82766 for Zink's kopper readback
|
||||
# fixes (Banners-Turnip fix/fastgl-zink-readback e07e94d0, run 44232301491); Bannerlator's copy is the 7cda7850 build.
|
||||
FASTGL_URL=https://github.com/The412Banner/Banners-Turnip/releases/download/fastgl-x11egl-mesa-d8cfbe8-r1
|
||||
FFMPEG8_SHA256=34ca9076b6b69bc96ee0d53fcb7b9d0d8df869b9f1255dd686bf89cc590b1b08 # ffmpeg8.tzst
|
||||
GAMESCOPE_TAG=3.16.29
|
||||
GAMESCOPE_COMMIT=8f212644c46460549035971ab914421180f61a7c
|
||||
GAMESCOPE_PATCHES="0117-wsi-cache-present-bypass-check.patch 0119-wsi-default-images-under-limiter.patch"
|
||||
VULKAN_HEADERS_TAG=v1.4.341
|
||||
# The bionic DroidDeck-Proton layer the pack is made for: linked against (libwayland-client) and checked against, not packed.
|
||||
# Layer v16 (067c719d) plus the ARM64EC code-map fix for 39-bit hosts (d4c9ffa7, run 44291095238).
|
||||
LAYER_URL=https://github.com/The412Banner/proton-wine/releases/download/build-bionic-layers-20261118-v16-unwind/DroidDeck-Proton-11.0-12.8-arm64ec.wcp
|
||||
LAYER_SHA256=3cc74b877bc8707d75aa2cc22e335373b6a6c0b6b1937c7b3c2cd98e55de2e89 # proton-wine d48e30a1 (a188791d + fecf7376 on d4c9ffa7)
|
||||
LAYER_VERSION=12.8
|
||||
# Packed into the DroidDeck-Bionic tool next to the layer: FEX with Android-built unix libraries, and default
|
||||
# DXVK / VKD3D-Proton (DroidDeck components can swap these in files/lib/wine/{dxvk,vkd3d-proton} later).
|
||||
FEX_URL=https://github.com/The412Banner/Nightlies/releases/download/FEXCore-2611.1/FEXCore-2611.1-unix.wcp
|
||||
FEX_SHA256=caca997e5e077feb5d9b7cf0f2c680cd93b442278903e3f3e7b1bd9cd544770c
|
||||
DXVK_URL=https://github.com/The412Banner/Nightlies/releases/download/Dxvk-gplasync-Linux/dxvk-gplasync-2.4.1-1-pre-reg-linux.wcp
|
||||
DXVK_SHA256=379b5dcde331de45a5f0ac7775d2c657c9c1510616afb9143ab8cdfbfa8e5342
|
||||
# VKD3D-Proton from DroidDeck-Components' stable release: the linux-nightly files are replaced as nightlies land.
|
||||
VKD3D_URL=https://github.com/Droid-Deck/DroidDeck-Components/releases/download/linux-stable/DD-vkd3d-proton-arm64ec-3.1.wcp
|
||||
VKD3D_SHA256=bd458d8adb08631d7d5da93c51ad02ce224178127d3408ca693b2947bf85bdd0
|
||||
# D7VK's 32-bit ddraw.dll (PROTON_USE_D7VK): the same file DroidDeck-Proton 11-12.8 ships, built there from
|
||||
# WinterSnowfall/d7vk; only that file is taken out of the release archive.
|
||||
D7VK_FROM=https://github.com/Droid-Deck/DroidDeck-Proton/releases/download/DroidDeck-Proton-11-12.8/DroidDeck-Proton-11-12.8-aarch64.tar.gz
|
||||
D7VK_MEMBER="DroidDeck-Proton 11-12.8/files/lib/wine/d7vk/i386-windows/ddraw.dll"
|
||||
D7VK_SHA256=aaf28d3dee147fd359d14bb08228f9d21335fb5fec334415e396353a967574aa
|
||||
D7VK_COMMIT=06656b9e94bf275854e3d83d6426517253937738
|
||||
|
||||
case "$(uname -s):$(uname -m)" in
|
||||
Linux:x86_64) NDK_HOST=linux-x86_64 ;;
|
||||
Linux:aarch64|Linux:arm64) NDK_HOST=linux-aarch64 ;;
|
||||
Darwin:arm64) NDK_HOST=darwin-arm64 ;;
|
||||
Darwin:x86_64) NDK_HOST=darwin-x86_64 ;;
|
||||
*) echo "unsupported host $(uname -s):$(uname -m)" >&2; exit 1 ;;
|
||||
esac
|
||||
TC="$NDK/toolchains/llvm/prebuilt/$NDK_HOST/bin"
|
||||
[[ -d "$TC" ]] || TC="$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
||||
CC="$TC/aarch64-linux-android${API}-clang"
|
||||
CXX="$TC/aarch64-linux-android${API}-clang++"
|
||||
READELF="$TC/llvm-readelf"
|
||||
STRIP="$TC/llvm-strip"
|
||||
[[ -x "$CC" && -x "$CXX" ]] || { echo "no NDK clang under $TC" >&2; exit 1; }
|
||||
|
||||
fetch() { # url sha256 dest
|
||||
curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused -o "$3" "$1"
|
||||
echo "$2 $3" | sha256sum -c -
|
||||
}
|
||||
|
||||
rm -rf "$WORK"; mkdir -p "$WORK" "$OUT"
|
||||
PACK="$WORK/droiddeck-bionic-runtime"
|
||||
mkdir -p "$PACK"/{lib,layer,preload,bin,adapter,share,etc}
|
||||
|
||||
echo "== imagefs (Bannerlator base, pinned)"
|
||||
fetch "$IMAGEFS_URL" "$IMAGEFS_SHA256" "$WORK/imagefs.tar.zst"
|
||||
mkdir -p "$WORK/imagefs"
|
||||
tar --zstd -xf "$WORK/imagefs.tar.zst" -C "$WORK/imagefs"
|
||||
IMG="$WORK/imagefs/usr/lib"
|
||||
[[ -d "$IMG" ]] || { echo "imagefs has no usr/lib" >&2; exit 1; }
|
||||
|
||||
echo "== bionic DroidDeck-Proton layer (pinned; its lib/ is on the library path at run time)"
|
||||
fetch "$LAYER_URL" "$LAYER_SHA256" "$WORK/layer.wcp"
|
||||
mkdir -p "$WORK/layer"
|
||||
tar --zstd -xf "$WORK/layer.wcp" -C "$WORK/layer" lib
|
||||
LAYERLIB="$WORK/layer/lib"
|
||||
|
||||
echo "== Wayland adapter (pinned release)"
|
||||
fetch "$ADAPTER_URL/libvulkan_wrapper.so" "$ADAPTER_SHA256" "$PACK/adapter/libvulkan_wrapper.so"
|
||||
fetch "$ADAPTER_URL/adapter.json" "$ADAPTER_JSON_SHA256" "$PACK/adapter/adapter.json"
|
||||
echo "== Bannerlator assets (pinned): FFmpeg 8"
|
||||
fetch "$BL_ASSETS/ffmpeg8.tzst" "$FFMPEG8_SHA256" "$WORK/ffmpeg8.tzst"
|
||||
|
||||
echo "== D7VK ddraw.dll (DroidDeck-Proton 11-12.8 release, that file only)"
|
||||
mkdir -p "$PACK/d7vk"
|
||||
curl -fsSL --retry 5 --retry-delay 3 --retry-connrefused "$D7VK_FROM" | tar -xzO -f - "$D7VK_MEMBER" > "$PACK/d7vk/ddraw.dll"
|
||||
echo "$D7VK_SHA256 $PACK/d7vk/ddraw.dll" | sha256sum -c -
|
||||
# OpenGL: bionic Mesa (EGL + GLX + Zink, x11 and wayland platforms) for winex11's EGL backend, the set Bannerlator's
|
||||
# Fast OpenGL uses, from the newer Mesa build pinned in FASTGL_URL
|
||||
mkdir -p "$PACK/egl"
|
||||
for e in libEGL.so.1:7d1febabcb0cb6348128bc44885886fba6a2edc103fcfc91f5f858e460b33fd6 \
|
||||
libGL.so.1:8de5c26d4de6dcac4dd2605d8742622711adcdb76d9fe5f5848894e439bb3826 \
|
||||
libGLESv2.so.2:2136442182ed8d724f80b2d69ee89f654694fd84439fdeb14010034c14f57658 \
|
||||
libgallium-27.0.0-devel.so:392ca9d6d3127b2ac5fc232d25830111c759dc672f437794731fc2778ff0eb34 \
|
||||
libwayland-client.so:fa49c2f119b84a0cf54669de1706a6bc427bb8a7f147c977328575ccbb920126 \
|
||||
libarchive.so:eb3b13634bd2c188d71e886f8c690ef32f6b4a2a0e8a7197a7f974b2d341b7ab \
|
||||
x11egl.json:90c1dcebb746625b81b4cf5335e177a4b7cbe608b359c9be5eaa43d8f0de499b; do
|
||||
fetch "$FASTGL_URL/${e%%:*}" "${e#*:}" "$PACK/egl/${e%%:*}"
|
||||
done
|
||||
cp "$HERE/icd.json" "$PACK/adapter/icd.json"
|
||||
|
||||
echo "== libraries from the imagefs"
|
||||
copy_lib() { # name: copies the file and every link on the way to it, as links (Android's own libraries are skipped)
|
||||
local name=$1 src=$IMG/$1 target
|
||||
[[ -e "$src" || -L "$src" ]] || { echo "missing in imagefs: $name" >&2; return 1; }
|
||||
[[ -L "$src" && "$(readlink "$src")" == /* ]] && return 0
|
||||
while [[ -L "$src" ]]; do
|
||||
target=$(readlink "$src")
|
||||
[[ -e "$PACK/lib/$(basename "$src")" || -L "$PACK/lib/$(basename "$src")" ]] || ln -s "$(basename "$target")" "$PACK/lib/$(basename "$src")"
|
||||
src="$(dirname "$src")/$target"
|
||||
done
|
||||
[[ -e "$PACK/lib/$(basename "$src")" ]] || cp "$src" "$PACK/lib/"
|
||||
}
|
||||
grep -v -e '^#' -e '^$' "$HERE/runtime-libs.txt" | while read -r name; do copy_lib "$name"; done
|
||||
[[ -e "$PACK/lib/libSDL2-2.0.so.0" ]] || ln -s libSDL2-2.0.so "$PACK/lib/libSDL2-2.0.so.0"
|
||||
mkdir -p "$PACK/lib/gstreamer-1.0"
|
||||
grep -v -e '^#' -e '^$' "$HERE/gst-plugins.txt" | while read -r p; do cp "$IMG/gstreamer-1.0/libgst$p.so" "$PACK/lib/gstreamer-1.0/"; done
|
||||
tar --zstd -xf "$WORK/ffmpeg8.tzst" -C "$PACK/lib"
|
||||
for f in "$PACK"/lib/libav*.so.* "$PACK"/lib/libsw*.so.*; do # soname links for the FFmpeg 8 files
|
||||
[[ -L "$f" ]] && continue
|
||||
so=$("$READELF" -d "$f" | sed -n 's/.*(SONAME).*\[\(.*\)\]/\1/p')
|
||||
[[ -n "$so" && ! -e "$PACK/lib/$so" ]] && ln -s "$(basename "$f")" "$PACK/lib/$so"
|
||||
done
|
||||
# GStreamer plugins: add the libraries they need from the imagefs; drop plugins needing something it lacks
|
||||
python3 "$HERE/check-needed.py" "$READELF" "$PACK" --available "$LAYERLIB" --fill "$IMG" --prune lib/gstreamer-1.0
|
||||
cp -a "$WORK/imagefs/usr/share/X11" "$PACK/share/"
|
||||
cp -a "$WORK/imagefs/etc/fonts" "$WORK/imagefs/etc/tls" "$PACK/etc/"
|
||||
|
||||
echo "== gamescope $GAMESCOPE_TAG WSI layer (+ DroidDeck patches: $GAMESCOPE_PATCHES)"
|
||||
GS="$WORK/gamescope"
|
||||
git clone -q --depth 1 --branch "$GAMESCOPE_TAG" https://github.com/ValveSoftware/gamescope "$GS"
|
||||
[[ "$(git -C "$GS" rev-parse HEAD)" == "$GAMESCOPE_COMMIT" ]] || { echo "gamescope $GAMESCOPE_TAG is not $GAMESCOPE_COMMIT" >&2; exit 1; }
|
||||
git -C "$GS" submodule update -q --init --depth 1 subprojects/vkroots || git -C "$GS" submodule update -q --init subprojects/vkroots
|
||||
for p in $GAMESCOPE_PATCHES; do git -C "$GS" apply "$ROOT/tools/gamescope/patches/$p"; done
|
||||
git clone -q --depth 1 --branch "$VULKAN_HEADERS_TAG" https://github.com/KhronosGroup/Vulkan-Headers "$WORK/vulkan-headers"
|
||||
INC="$WORK/inc"; GEN="$WORK/gen"; mkdir -p "$INC" "$GEN"
|
||||
cp -r "$WORK/vulkan-headers/include/vulkan" "$WORK/vulkan-headers/include/vk_video" "$INC/"
|
||||
cp -r /usr/include/X11 /usr/include/xcb /usr/include/glm "$INC/"
|
||||
cp /usr/include/wayland-*.h "$INC/"
|
||||
for p in gamescope-swapchain gamescope-limiter; do
|
||||
wayland-scanner client-header "$GS/protocol/$p.xml" "$GEN/$p-client-protocol.h"
|
||||
wayland-scanner private-code "$GS/protocol/$p.xml" "$GEN/$p-protocol.c"
|
||||
"$CC" -O2 -fPIC -c -I"$INC" "$GEN/$p-protocol.c" -o "$GEN/$p-protocol.o"
|
||||
done
|
||||
LINK=(-L"$PACK/lib" -Wl,-rpath-link,"$PACK/lib" -L"$LAYERLIB" -Wl,-rpath-link,"$LAYERLIB")
|
||||
"$CXX" -std=c++20 -O2 -fPIC -shared -DWLR_USE_UNSTABLE -D_GNU_SOURCE -include "$HERE/bionic_compat.h" \
|
||||
-I"$GS/subprojects/vkroots" -I"$GEN" -I"$INC" -I"$GS/layer" -I"$GS/src" \
|
||||
"$GS/layer/VkLayer_FROG_gamescope_wsi.cpp" "$GEN"/*.o "${LINK[@]}" \
|
||||
-lwayland-client -lX11-xcb -lX11 -lxcb -lxcb-composite -static-libstdc++ -Wl,--no-undefined \
|
||||
-o "$PACK/layer/libVkLayer_FROG_gamescope_wsi_aarch64.so"
|
||||
cp "$HERE/VkLayer_FROG_gamescope_wsi.aarch64.json" "$PACK/layer/"
|
||||
|
||||
echo "== DroidDeck GPU-load layer (tools/gpuload), off unless its DroidDeck variables are set"
|
||||
for l in gpuload; do
|
||||
"$CC" -std=c11 -shared -fPIC -O2 -Wall -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden \
|
||||
-pthread -Wl,-z,defs -include "$HERE/bionic_compat.h" -I"$INC" -I"$ROOT/tools/gpuload/src" \
|
||||
"$ROOT/tools/gpuload/src/vk_layer_droiddeck_$l.c" -o "$PACK/layer/libVkLayer_droiddeck_$l.so"
|
||||
done
|
||||
for j in gpu_load:gpuload; do
|
||||
sed 's#"library_path": *"[^"]*"#"library_path": "./libVkLayer_droiddeck_'"${j#*:}"'.so"#' \
|
||||
"$ROOT/tools/gpuload/layer/VK_LAYER_DROIDDECK_${j%%:*}.json" > "$PACK/layer/VK_LAYER_DROIDDECK_${j%%:*}.json"
|
||||
grep -q '"library_path": "./libVkLayer_droiddeck_' "$PACK/layer/VK_LAYER_DROIDDECK_${j%%:*}.json"
|
||||
done
|
||||
|
||||
echo "== DroidDeck fake input (app/src/main/cpp/fakeinput_steam.cpp), heap-tagging off, window tagger"
|
||||
"$CXX" -shared -fPIC -O2 -Wall -Wno-attributes -pthread -std=c++17 "$ROOT/app/src/main/cpp/fakeinput_steam.cpp" \
|
||||
-ldl -static-libstdc++ -o "$PACK/preload/libfakeinput.so"
|
||||
"$CC" -shared -fPIC -O2 -Wall "$HERE/notag.c" -ldl -o "$PACK/preload/libnotag.so"
|
||||
"$CC" -shared -fPIC -O2 -Wall "$HERE/execshim.c" -ldl -o "$PACK/preload/libexecshim.so"
|
||||
"$CC" -shared -fPIC -O2 -Wall -Wextra -fvisibility=hidden "$HERE/steamshm.c" -ldl -o "$PACK/preload/libsteamshm.so"
|
||||
"$CC" -O2 -Wall "$HERE/gstag.c" -o "$PACK/bin/gstag"
|
||||
"$STRIP" --strip-unneeded "$PACK/layer/"*.so "$PACK/preload/"*.so "$PACK/bin/gstag"
|
||||
|
||||
echo "== every library a pack file needs must be in the pack or on Android"
|
||||
python3 "$HERE/check-needed.py" "$READELF" "$PACK" --available "$LAYERLIB"
|
||||
|
||||
echo "== manifest"
|
||||
REV=$(git -C "$ROOT" rev-parse --short=8 HEAD)
|
||||
cp "$HERE/NOTICE" "$PACK/NOTICE"
|
||||
{
|
||||
echo "droiddeck-bionic-runtime $REV ($(date -u +%Y-%m-%dT%H:%M:%SZ), Android API $API, NDK $(basename "$NDK"))"
|
||||
echo "imagefs $IMAGEFS_URL sha256 $IMAGEFS_SHA256"
|
||||
echo "bannerlator $BL_COMMIT (ffmpeg8.tzst)"
|
||||
echo "fastgl $FASTGL_URL (egl/: Mesa EGL + GLX + Zink, Mesa main d8cfbe82766)"
|
||||
echo "adapter $ADAPTER_URL (libvulkan_wrapper.so sha256 $ADAPTER_SHA256)"
|
||||
echo "layer $LAYER_URL sha256 $LAYER_SHA256 (not packed)"
|
||||
echo "d7vk $D7VK_COMMIT: i386 ddraw.dll from $D7VK_FROM"
|
||||
echo "gamescope $GAMESCOPE_TAG $GAMESCOPE_COMMIT + $GAMESCOPE_PATCHES; vkroots $(git -C "$GS/subprojects/vkroots" rev-parse HEAD); Vulkan-Headers $VULKAN_HEADERS_TAG"
|
||||
echo
|
||||
(cd "$PACK" && find . -type f ! -name MANIFEST.txt | sort | xargs sha256sum)
|
||||
} > "$PACK/MANIFEST.txt"
|
||||
tar --zstd -cf "$OUT/droiddeck-bionic-runtime-$REV.tar.zst" -C "$WORK" droiddeck-bionic-runtime
|
||||
(cd "$OUT" && sha256sum "droiddeck-bionic-runtime-$REV.tar.zst" > "droiddeck-bionic-runtime-$REV.tar.zst.sha256")
|
||||
du -sh "$PACK" "$OUT"/*.tar.zst
|
||||
|
||||
echo "== DroidDeck-Bionic tool: layer + this pack + FEX + DXVK/VKD3D + tool scripts, in Proton's layout"
|
||||
NAME="DroidDeck-Bionic-$LAYER_VERSION-r${BUILD_NUMBER:-0}"
|
||||
T="$WORK/tool/$NAME"
|
||||
mkdir -p "$T/files" "$T/bionic"
|
||||
tar --zstd -xf "$WORK/layer.wcp" -C "$T/files" bin lib share prefixPack.txz
|
||||
mkdir -p "$WORK/pfx" && tar -xJf "$T/files/prefixPack.txz" -C "$WORK/pfx" && rm "$T/files/prefixPack.txz"
|
||||
mv "$WORK/pfx/.wine" "$T/files/default_pfx"
|
||||
# No drives in the template: its links point into Winlator, and a Z: -> / link here once let DroidDeck's tool delete
|
||||
# walk the whole device. launch.sh makes C: and Z: in each game's own prefix.
|
||||
rm -rf "$T/files/default_pfx/dosdevices"
|
||||
for c in FEX:"$FEX_URL":"$FEX_SHA256" DXVK:"$DXVK_URL":"$DXVK_SHA256" VKD3D:"$VKD3D_URL":"$VKD3D_SHA256"; do
|
||||
n=${c%%:*}; rest=${c#*:}; sha=${rest##*:}; url=${rest%:*}
|
||||
fetch "$url" "$sha" "$WORK/$n.wcp"
|
||||
mkdir -p "$WORK/$n" && tar --zstd -xf "$WORK/$n.wcp" -C "$WORK/$n"
|
||||
done
|
||||
cp "$WORK/FEX/aarch64-unix/"*.so "$T/files/lib/wine/aarch64-unix/"
|
||||
cp "$WORK/FEX/system32/"*.dll "$T/files/lib/wine/aarch64-windows/"
|
||||
cp -r "$WORK/DXVK/files/lib/wine/dxvk" "$WORK/VKD3D/files/lib/wine/vkd3d-proton" "$T/files/lib/wine/"
|
||||
cp -a "$PACK" "$T/files/runtime"
|
||||
# a spare copy of the tool's FEX for launch.sh, which puts it back if DroidDeck's component check swapped in its
|
||||
# own FEX (glibc unix libraries) for a game with a per-game FEX choice
|
||||
mkdir -p "$T/files/runtime/fex/aarch64-unix" "$T/files/runtime/fex/aarch64-windows"
|
||||
cp "$WORK/FEX/aarch64-unix/"*.so "$T/files/runtime/fex/aarch64-unix/"
|
||||
cp "$WORK/FEX/system32/"*.dll "$T/files/runtime/fex/aarch64-windows/"
|
||||
install -m 755 "$HERE/tool/proton" "$T/proton"
|
||||
install -m 755 "$HERE/tool/launch.sh" "$T/bionic/launch.sh"
|
||||
cp "$HERE/tool/desktop.reg" "$HERE/tool/Xdefaults" "$T/bionic/"
|
||||
cp "$HERE/tool/toolmanifest.vdf" "$T/"
|
||||
# The name Steam registers the tool under ends in -Proton: Steam maps Windows save folders (WinAppDataLocal, WinMyDocuments
|
||||
# ...) into compatdata/<app>/pfx only for tools whose name contains "proton" (a case-insensitive search in
|
||||
# steamclient.so's compat manager); without it Steam Cloud skipped every such save rule. The folder, the version file and
|
||||
# the release keep $NAME, which is what DroidDeck matches on.
|
||||
sed -e "s/@NAME@/$NAME-Proton/" -e "s/@DISPLAY@/DroidDeck-Bionic $LAYER_VERSION r${BUILD_NUMBER:-0}/" "$HERE/tool/compatibilitytool.vdf.in" > "$T/compatibilitytool.vdf"
|
||||
echo "$(date -u +%s) $NAME" > "$T/version"
|
||||
{
|
||||
echo "$NAME: DroidDeck runtime pack $REV + layer + FEX/DXVK/VKD3D"
|
||||
echo "fex $FEX_URL sha256 $FEX_SHA256"
|
||||
echo "dxvk $DXVK_URL sha256 $DXVK_SHA256"
|
||||
echo "vkd3d $VKD3D_URL sha256 $VKD3D_SHA256"
|
||||
} > "$T/SOURCES.txt"
|
||||
python3 "$HERE/check-needed.py" "$READELF" "$T/files" --available "$T/files/lib"
|
||||
echo "== no link may point out of the tool (DroidDeck deletes old tool folders)"
|
||||
python3 - "$T" <<'PY'
|
||||
import os, sys
|
||||
root = os.path.realpath(sys.argv[1])
|
||||
bad = []
|
||||
for d, dirs, files in os.walk(root):
|
||||
for n in dirs + files:
|
||||
p = os.path.join(d, n)
|
||||
if os.path.islink(p):
|
||||
t = os.path.realpath(p)
|
||||
if t != root and not t.startswith(root + os.sep):
|
||||
bad.append("%s -> %s" % (os.path.relpath(p, root), os.readlink(p)))
|
||||
if bad:
|
||||
sys.exit("links out of the tool:\n" + "\n".join(bad))
|
||||
print("no links out of the tool")
|
||||
PY
|
||||
tar -C "$WORK/tool" -cf - "$NAME" | xz -T0 -6 > "$OUT/$NAME-aarch64.tar.xz"
|
||||
(cd "$OUT" && sha512sum "$NAME-aarch64.tar.xz" > "$NAME-aarch64.sha512sum")
|
||||
du -sh "$T" "$OUT/$NAME-aarch64.tar.xz"
|
||||
@@ -0,0 +1,126 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Checks that every library an ELF file in the bionic runtime pack needs is in the pack, in --available
|
||||
(the Proton layer's lib/, on the library path at run time) or on Android.
|
||||
|
||||
usage: check-needed.py <llvm-readelf> <pack dir> [--available DIR]... [--fill IMAGEFS_LIB] [--prune SUBDIR]
|
||||
--fill copies missing libraries (and the links on the way to them) from IMAGEFS_LIB into <pack>/lib, repeatedly
|
||||
--prune deletes ELF files under <pack>/SUBDIR that still miss a library (plugins nothing else links to)
|
||||
Exits 1 when anything is still missing."""
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
# Android's own libraries (/system/lib64, /apex) the pack may rely on.
|
||||
ANDROID = {
|
||||
"libc.so", "libm.so", "libdl.so", "liblog.so", "libz.so", "libandroid.so", "libnativewindow.so", "libsync.so",
|
||||
"libEGL.so", "libGLESv1_CM.so", "libGLESv2.so", "libGLESv3.so", "libvulkan.so", "libaaudio.so", "libOpenSLES.so",
|
||||
"libmediandk.so", "libjnigraphics.so", "libcamera2ndk.so", "libbinder_ndk.so", "ld-android.so",
|
||||
}
|
||||
# Known gaps, loaded only for features the first version does not cover.
|
||||
OPTIONAL = {
|
||||
"libGL.so.1", # OpenGL games; a dangling link in the pinned imagefs
|
||||
"libodbc.so", # odbc32
|
||||
}
|
||||
|
||||
|
||||
def elf_files(pack):
|
||||
for root, _, files in os.walk(pack):
|
||||
for f in files:
|
||||
path = os.path.join(root, f)
|
||||
if os.path.islink(path) or not os.path.isfile(path):
|
||||
continue
|
||||
with open(path, "rb") as fh:
|
||||
if fh.read(4) == b"\x7fELF":
|
||||
yield path
|
||||
|
||||
|
||||
def needed(readelf, path):
|
||||
run = subprocess.run([readelf, "-d", path], capture_output=True, text=True)
|
||||
if run.returncode != 0: # a damaged ELF must fail the check, not pass with no dependencies
|
||||
raise SystemExit("check-needed: %s -d %s failed (%d): %s" % (readelf, path, run.returncode, run.stderr.strip()))
|
||||
return [l.split("[", 1)[1].split("]", 1)[0] for l in run.stdout.splitlines() if "(NEEDED)" in l]
|
||||
|
||||
|
||||
def names_in(*dirs):
|
||||
names = set()
|
||||
for d in dirs:
|
||||
for root, _, files in os.walk(d):
|
||||
# a link whose target is missing provides nothing
|
||||
names.update(f for f in files if os.path.isfile(os.path.join(root, f)))
|
||||
return names
|
||||
|
||||
|
||||
def missing_map(readelf, pack, available):
|
||||
have = names_in(pack, *available)
|
||||
missing = {}
|
||||
for path in elf_files(pack):
|
||||
for lib in needed(readelf, path):
|
||||
if lib not in have and lib not in ANDROID and lib not in OPTIONAL:
|
||||
missing.setdefault(lib, []).append(path)
|
||||
return missing
|
||||
|
||||
|
||||
def copy_from(img, name, dest):
|
||||
"""Copies img/name into dest, keeping relative links; False when absent or one of Android's (absolute link)."""
|
||||
src = os.path.join(img, name)
|
||||
if not os.path.lexists(src):
|
||||
return False
|
||||
while os.path.islink(src):
|
||||
target = os.readlink(src)
|
||||
if target.startswith("/"):
|
||||
return False
|
||||
link = os.path.join(dest, os.path.basename(src))
|
||||
if not os.path.lexists(link):
|
||||
os.symlink(os.path.basename(target), link)
|
||||
src = os.path.join(os.path.dirname(src), target)
|
||||
if not os.path.exists(src):
|
||||
return False
|
||||
out = os.path.join(dest, os.path.basename(src))
|
||||
if not os.path.exists(out):
|
||||
shutil.copy2(src, out)
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("readelf")
|
||||
ap.add_argument("pack")
|
||||
ap.add_argument("--available", action="append", default=[])
|
||||
ap.add_argument("--fill")
|
||||
ap.add_argument("--prune")
|
||||
a = ap.parse_args()
|
||||
|
||||
if a.fill:
|
||||
added = []
|
||||
while True:
|
||||
missing = missing_map(a.readelf, a.pack, a.available)
|
||||
new = [lib for lib in sorted(missing) if copy_from(a.fill, lib, os.path.join(a.pack, "lib"))]
|
||||
if not new:
|
||||
break
|
||||
added += new
|
||||
print(f"added from the imagefs: {len(added)} ({', '.join(added)})" if added else "added from the imagefs: none")
|
||||
|
||||
if a.prune:
|
||||
prune_root = os.path.join(a.pack, a.prune)
|
||||
while True:
|
||||
missing = missing_map(a.readelf, a.pack, a.available)
|
||||
doomed = {p for users in missing.values() for p in users if p.startswith(prune_root + os.sep)}
|
||||
if not doomed:
|
||||
break
|
||||
for p in sorted(doomed):
|
||||
libs = sorted(l for l, users in missing.items() if p in users)
|
||||
print(f"pruned {os.path.relpath(p, a.pack)}: missing {', '.join(libs)}")
|
||||
os.remove(p)
|
||||
|
||||
missing = missing_map(a.readelf, a.pack, a.available)
|
||||
for lib, users in sorted(missing.items()):
|
||||
print(f"missing {lib}: needed by {', '.join(sorted(os.path.relpath(u, a.pack) for u in users)[:5])}")
|
||||
if missing:
|
||||
sys.exit(1)
|
||||
print("all needed libraries present")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,235 @@
|
||||
// execshim: preloaded into the bionic Wine processes. From targetSdk 29 Android refuses execve() of files in the
|
||||
// app's data directory, but the system linker still starts them: "/system/bin/linker64 <file> [args]". So an
|
||||
// execve()/posix_spawn() of a dynamic ELF under /data whose interpreter is /system/bin/linker64 becomes a linker64
|
||||
// start, and a "#!" script there becomes a start of its interpreter. Static ELFs (wine-preloader) and everything
|
||||
// else pass through unchanged: where Android refuses them, Wine falls back to its loader, as on any failed exec.
|
||||
// A program started that way sees /proc/self/exe as linker64; wineserver looks for its NLS files next to its own
|
||||
// executable (server/unicode.c get_nls_dir), so realpath()/readlink() of /proc/self/exe answer with the program
|
||||
// linker64 runs (the second /proc/self/cmdline entry).
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <elf.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#if __has_include(<spawn.h>)
|
||||
#include <spawn.h>
|
||||
#else // old Android headers (e.g. Termux's): bionic's own definitions, both opaque pointers
|
||||
typedef struct __posix_spawnattr *posix_spawnattr_t;
|
||||
typedef struct __posix_spawn_file_actions *posix_spawn_file_actions_t;
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define LINKER "/system/bin/linker64"
|
||||
|
||||
enum kind { PASS, VIA_LINKER, VIA_INTERP };
|
||||
|
||||
// What starting `path` needs; for scripts, the interpreter and its optional argument.
|
||||
static enum kind classify(const char *path, char *resolved, char *interp, char *iarg) {
|
||||
if (!path || !realpath(path, resolved) || strncmp(resolved, "/data/", 6) != 0) return PASS;
|
||||
// non-blocking, so a FIFO without a writer cannot hang the start; anything but a regular file goes to libc
|
||||
int fd = open(resolved, O_RDONLY | O_CLOEXEC | O_NONBLOCK);
|
||||
if (fd < 0) return PASS;
|
||||
struct stat st;
|
||||
if (fstat(fd, &st) != 0 || !S_ISREG(st.st_mode)) {
|
||||
close(fd);
|
||||
return PASS;
|
||||
}
|
||||
enum kind k = PASS;
|
||||
unsigned char head[256];
|
||||
ssize_t n = pread(fd, head, sizeof head, 0);
|
||||
if (n >= (ssize_t)sizeof(Elf64_Ehdr) && memcmp(head, ELFMAG, SELFMAG) == 0 && head[EI_CLASS] == ELFCLASS64) {
|
||||
Elf64_Ehdr eh;
|
||||
memcpy(&eh, head, sizeof eh);
|
||||
for (int i = 0; i < eh.e_phnum && k == PASS; i++) {
|
||||
Elf64_Phdr ph;
|
||||
if (pread(fd, &ph, sizeof ph, (off_t)(eh.e_phoff + (Elf64_Off)i * eh.e_phentsize)) != sizeof ph) break;
|
||||
if (ph.p_type != PT_INTERP || ph.p_filesz == 0 || ph.p_filesz >= PATH_MAX) continue;
|
||||
char name[PATH_MAX] = {0};
|
||||
if (pread(fd, name, ph.p_filesz, (off_t)ph.p_offset) == (ssize_t)ph.p_filesz && strcmp(name, LINKER) == 0)
|
||||
k = VIA_LINKER;
|
||||
}
|
||||
} else if (n > 2 && head[0] == '#' && head[1] == '!') {
|
||||
char line[256];
|
||||
size_t len = 0;
|
||||
for (ssize_t i = 2; i < n && head[i] != '\n' && len < sizeof line - 1; i++) line[len++] = (char)head[i];
|
||||
line[len] = 0;
|
||||
char *p = line;
|
||||
while (*p == ' ' || *p == '\t') p++;
|
||||
char *end = p;
|
||||
while (*end && *end != ' ' && *end != '\t') end++;
|
||||
char *rest = *end ? end + 1 : end;
|
||||
*end = 0;
|
||||
while (*rest == ' ' || *rest == '\t') rest++;
|
||||
size_t rl = strlen(rest);
|
||||
while (rl && (rest[rl - 1] == ' ' || rest[rl - 1] == '\t' || rest[rl - 1] == '\r')) rest[--rl] = 0;
|
||||
if (*p) {
|
||||
strcpy(interp, p);
|
||||
strcpy(iarg, rest);
|
||||
k = VIA_INTERP;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
return k;
|
||||
}
|
||||
|
||||
static int argc_of(char *const argv[]) {
|
||||
int n = 0;
|
||||
while (argv && argv[n]) n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
// New argv for the rewritten start; *file is what to start. NULL when nothing changes.
|
||||
static char **rewrite(const char *path, char *const argv[], const char **file, char *storage) {
|
||||
char *resolved = storage, *interp = storage + PATH_MAX, *iarg = storage + 2 * PATH_MAX;
|
||||
enum kind k = classify(path, resolved, interp, iarg);
|
||||
if (k == PASS) return NULL;
|
||||
int argc = argc_of(argv);
|
||||
// up to four leading entries, argc - 1 trailing ones and the terminator (argc may be 0)
|
||||
char **out = calloc((size_t)(argc > 0 ? argc - 1 : 0) + 5, sizeof *out);
|
||||
if (!out) return NULL;
|
||||
int j = 0;
|
||||
if (k == VIA_LINKER) {
|
||||
*file = LINKER;
|
||||
out[j++] = (char *)LINKER;
|
||||
out[j++] = resolved;
|
||||
} else {
|
||||
// the interpreter may itself live in app data
|
||||
char *iresolved = storage + 3 * PATH_MAX, *x = storage + 4 * PATH_MAX, *y = storage + 5 * PATH_MAX;
|
||||
if (classify(interp, iresolved, x, y) == VIA_LINKER) {
|
||||
*file = LINKER;
|
||||
out[j++] = (char *)LINKER;
|
||||
out[j++] = iresolved;
|
||||
} else {
|
||||
*file = interp;
|
||||
out[j++] = interp;
|
||||
}
|
||||
if (*iarg) out[j++] = iarg;
|
||||
out[j++] = resolved;
|
||||
}
|
||||
for (int i = 1; i < argc; i++) out[j++] = argv[i];
|
||||
out[j] = NULL;
|
||||
return out;
|
||||
}
|
||||
|
||||
// libc's functions: bound when the library loads (single-threaded), so execve() in a post-fork child finds them bound.
|
||||
// A call that comes before that (another library's constructor) binds through an atomic slot: concurrent binders
|
||||
// store the same pointer, and readers never see a torn one.
|
||||
typedef ssize_t (*readlink_fn)(const char *, char *, size_t);
|
||||
typedef char *(*realpath_fn)(const char *, char *);
|
||||
typedef int (*execve_fn)(const char *, char *const[], char *const[]);
|
||||
typedef int (*spawn_fn)(pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *,
|
||||
char *const[], char *const[]);
|
||||
static void *slot_readlink, *slot_realpath, *slot_execve, *slot_spawn, *slot_spawnp;
|
||||
|
||||
static void *bound(void **slot, const char *name) {
|
||||
void *p = __atomic_load_n(slot, __ATOMIC_ACQUIRE);
|
||||
if (!p) {
|
||||
p = dlsym(RTLD_NEXT, name);
|
||||
__atomic_store_n(slot, p, __ATOMIC_RELEASE);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
#define real_readlink ((readlink_fn)bound(&slot_readlink, "readlink"))
|
||||
#define real_realpath ((realpath_fn)bound(&slot_realpath, "realpath"))
|
||||
#define real_execve ((execve_fn)bound(&slot_execve, "execve"))
|
||||
#define real_spawn ((spawn_fn)bound(&slot_spawn, "posix_spawn"))
|
||||
#define real_spawnp ((spawn_fn)bound(&slot_spawnp, "posix_spawnp"))
|
||||
|
||||
__attribute__((constructor)) static void bind_libc(void) {
|
||||
(void)real_readlink;
|
||||
(void)real_realpath;
|
||||
(void)real_execve;
|
||||
(void)real_spawn;
|
||||
(void)real_spawnp;
|
||||
}
|
||||
|
||||
// The program linker64 runs, when this process is such a start; 0 otherwise.
|
||||
static int linker_program(char *out, size_t n) {
|
||||
if (!real_readlink) return 0;
|
||||
char link[PATH_MAX];
|
||||
ssize_t l = real_readlink("/proc/self/exe", link, sizeof link - 1);
|
||||
if (l <= 0) return 0;
|
||||
link[l] = 0;
|
||||
const char *base = strrchr(link, '/'); // /system/bin/linker64 is a link into /apex/com.android.runtime/bin
|
||||
if (strcmp(base ? base + 1 : link, "linker64") != 0) return 0;
|
||||
int fd = open("/proc/self/cmdline", O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0) return 0;
|
||||
char buf[2 * PATH_MAX];
|
||||
ssize_t got = read(fd, buf, sizeof buf - 1);
|
||||
close(fd);
|
||||
if (got <= 0) return 0;
|
||||
buf[got] = 0;
|
||||
size_t first = strlen(buf);
|
||||
if ((ssize_t)first + 1 >= got || !buf[first + 1] || strlen(buf + first + 1) >= n) return 0;
|
||||
strcpy(out, buf + first + 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *realpath(const char *path, char *resolved) {
|
||||
if (!real_realpath) {
|
||||
errno = ENOSYS;
|
||||
return NULL;
|
||||
}
|
||||
char prog[PATH_MAX];
|
||||
if (path && strcmp(path, "/proc/self/exe") == 0 && linker_program(prog, sizeof prog)) return real_realpath(prog, resolved);
|
||||
return real_realpath(path, resolved);
|
||||
}
|
||||
|
||||
ssize_t readlink(const char *path, char *buf, size_t size) {
|
||||
char prog[PATH_MAX], full[PATH_MAX];
|
||||
if (path && strcmp(path, "/proc/self/exe") == 0 && linker_program(prog, sizeof prog)) {
|
||||
if (real_realpath && real_realpath(prog, full)) {
|
||||
size_t l = strlen(full);
|
||||
if (l > size) l = size;
|
||||
memcpy(buf, full, l);
|
||||
return (ssize_t)l;
|
||||
}
|
||||
}
|
||||
if (!real_readlink) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
return real_readlink(path, buf, size);
|
||||
}
|
||||
|
||||
int execve(const char *path, char *const argv[], char *const envp[]) {
|
||||
execve_fn real = real_execve;
|
||||
if (!real) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
char storage[6 * PATH_MAX]; // stack only: this may run in posix_spawn's vfork-like child (where it passes)
|
||||
const char *file = path;
|
||||
char **args = rewrite(path, argv, &file, storage);
|
||||
int ret = real(file, args ? args : argv, envp);
|
||||
int saved = errno;
|
||||
free(args);
|
||||
errno = saved;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *actions,
|
||||
const posix_spawnattr_t *attr, char *const argv[], char *const envp[]) {
|
||||
spawn_fn real = real_spawn;
|
||||
if (!real) return ENOSYS;
|
||||
char storage[6 * PATH_MAX];
|
||||
const char *file = path;
|
||||
// file actions can change the child's directory before it starts: a relative path is resolved there by libc, so
|
||||
// it is left to libc instead of being resolved here against the parent's directory
|
||||
char **args = (actions && path && path[0] != '/') ? NULL : rewrite(path, argv, &file, storage);
|
||||
int ret = real(pid, file, actions, attr, args ? args : argv, envp);
|
||||
free(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int posix_spawnp(pid_t *pid, const char *file, const posix_spawn_file_actions_t *actions,
|
||||
const posix_spawnattr_t *attr, char *const argv[], char *const envp[]) {
|
||||
if (file && strchr(file, '/')) return posix_spawn(pid, file, actions, attr, argv, envp);
|
||||
spawn_fn real = real_spawnp;
|
||||
if (!real) return ENOSYS;
|
||||
return real(pid, file, actions, attr, argv, envp);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
# GStreamer plugins packed for winegstreamer (game video/audio), from the imagefs's lib/gstreamer-1.0 by name
|
||||
# (libgst<name>.so): Proton's usual set as far as this imagefs has it (no vpx; videoconvert+videoscale are videoconvertscale).
|
||||
coreelements
|
||||
app
|
||||
audioconvert
|
||||
audiorate
|
||||
audioresample
|
||||
ogg
|
||||
opus
|
||||
pbtypes
|
||||
playback
|
||||
rawparse
|
||||
subparse
|
||||
theora
|
||||
typefindfunctions
|
||||
videoconvertscale
|
||||
videorate
|
||||
volume
|
||||
vorbis
|
||||
apetag
|
||||
audioparsers
|
||||
autodetect
|
||||
avi
|
||||
deinterlace
|
||||
id3demux
|
||||
interleave
|
||||
isomp4
|
||||
matroska
|
||||
mpg123
|
||||
videocrop
|
||||
videofilter
|
||||
wavparse
|
||||
flac
|
||||
videoparsersbad
|
||||
libav
|
||||
asf
|
||||
dvdsub
|
||||
mpegpsdemux
|
||||
mpegtsdemux
|
||||
jpeg
|
||||
png
|
||||
@@ -0,0 +1,330 @@
|
||||
// gstag: tags top-level X windows whose WM_CLASS contains <match> (any case) with
|
||||
// STEAM_GAME=<appid>, so gamescope treats a game started outside Steam's process tree
|
||||
// as the game (stand-in until a bionic winex11 sets STEAM_GAME itself).
|
||||
// Usage: gstag <display> <appid> <match> <seconds> [stop when this pid exits]
|
||||
// gamescope publishes focus (GAMESCOPE_FOCUSED_APP) and reads GAMESCOPECTRL_BASELAYER_APPID on its first X server
|
||||
// (:0, Steam's); with several (DroidDeck: games on :1) those two are read and written there.
|
||||
// If gamescope still focuses another app 8 s after the tag, it sets GAMESCOPECTRL_BASELAYER_APPID once to
|
||||
// <appid>,769 (what Steam writes when it shows a game); Steam can change it again later (e.g. the Steam button).
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int fd, tconn = -1, cconn = -1;
|
||||
static uint16_t tseq, cseq; // sequence number of the last request sent on each connection
|
||||
static uint8_t rbuf[1 << 16];
|
||||
static uint32_t pending[256]; static int npending;
|
||||
static uint32_t tagged[256]; static int ntagged;
|
||||
|
||||
static int wr(const void *p, size_t n) {
|
||||
const uint8_t *b = p;
|
||||
while (n) { ssize_t k = write(fd, b, n); if (k <= 0) return -1; b += k; n -= (size_t)k; }
|
||||
return 0;
|
||||
}
|
||||
static int rd(void *p, size_t n) {
|
||||
uint8_t *b = p;
|
||||
while (n) { ssize_t k = read(fd, b, n); if (k <= 0) return -1; b += k; n -= (size_t)k; }
|
||||
return 0;
|
||||
}
|
||||
static size_t pad4(size_t n) { return (n + 3) & ~(size_t)3; }
|
||||
|
||||
// Sends one request on the current connection; its sequence number goes to *seq. 0 when sent.
|
||||
static int request(const void *p, size_t n, uint16_t *seq) {
|
||||
if (wr(p, n)) return -1;
|
||||
uint16_t *last = (fd == cconn && cconn != tconn) ? &cseq : &tseq;
|
||||
++*last;
|
||||
if (seq) *seq = *last;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Reads one whole packet into rbuf; a reply (or generic event) longer than rbuf ends the connection. 0 when read.
|
||||
static int packet(void) {
|
||||
if (rd(rbuf, 32)) return -1;
|
||||
uint8_t type = rbuf[0] & 0x7f;
|
||||
if (rbuf[0] == 1 || type == 35) {
|
||||
uint32_t words = *(uint32_t *)(rbuf + 4);
|
||||
if (words > (sizeof rbuf - 32) / 4) return -1;
|
||||
if (words && rd(rbuf + 32, words * 4u)) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int known(uint32_t *list, int n, uint32_t w) { for (int i = 0; i < n; i++) if (list[i] == w) return 1; return 0; }
|
||||
|
||||
static void forget(uint32_t *list, int *n, uint32_t w) {
|
||||
for (int i = 0; i < *n; i++)
|
||||
if (list[i] == w) { list[i] = list[--*n]; return; }
|
||||
}
|
||||
|
||||
static void note_event(const uint8_t *e) {
|
||||
uint8_t type = e[0] & 0x7f;
|
||||
uint32_t win = *(uint32_t *)(e + 8);
|
||||
if (type == 17) { // DestroyNotify: a destroyed window is neither a candidate nor a tagged game window
|
||||
forget(pending, &npending, win);
|
||||
forget(tagged, &ntagged, win);
|
||||
return;
|
||||
}
|
||||
if (type != 16 && type != 19) return; // CreateNotify, MapNotify
|
||||
if (win && !known(tagged, ntagged, win) && !known(pending, npending, win) && npending < 256) pending[npending++] = win;
|
||||
}
|
||||
|
||||
// Reads until the answer to request `seq`. Returns 1 reply, 0 error, -1 io. Events are noted; errors of requests
|
||||
// without a reply (a ChangeProperty on a window that is gone) and other stale packets are skipped.
|
||||
static int reply(uint16_t seq) {
|
||||
for (;;) {
|
||||
if (packet()) return -1;
|
||||
if (rbuf[0] > 1) { note_event(rbuf); continue; }
|
||||
if (*(uint16_t *)(rbuf + 2) != seq) continue;
|
||||
return rbuf[0] == 1;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t intern(const char *name) {
|
||||
size_t n = strlen(name);
|
||||
uint8_t req[256] = {0};
|
||||
req[0] = 16;
|
||||
*(uint16_t *)(req + 2) = (uint16_t)(2 + pad4(n) / 4);
|
||||
*(uint16_t *)(req + 4) = (uint16_t)n;
|
||||
memcpy(req + 8, name, n);
|
||||
uint16_t seq;
|
||||
if (request(req, 8 + pad4(n), &seq)) return 0;
|
||||
return reply(seq) == 1 ? *(uint32_t *)(rbuf + 8) : 0;
|
||||
}
|
||||
|
||||
// WM_CLASS of a window into out (both strings joined by '|'); 0 if none.
|
||||
static int wm_class(uint32_t win, char *out, size_t cap) {
|
||||
uint8_t req[24] = {0};
|
||||
req[0] = 20;
|
||||
*(uint16_t *)(req + 2) = 6;
|
||||
*(uint32_t *)(req + 4) = win;
|
||||
*(uint32_t *)(req + 8) = 67; // WM_CLASS
|
||||
*(uint32_t *)(req + 12) = 31; // STRING
|
||||
*(uint32_t *)(req + 20) = 64;
|
||||
uint16_t seq;
|
||||
if (request(req, sizeof req, &seq) || reply(seq) != 1) return 0;
|
||||
uint32_t n = *(uint32_t *)(rbuf + 16);
|
||||
if (!n || n >= cap) return 0;
|
||||
for (uint32_t i = 0; i < n; i++) out[i] = rbuf[32 + i] ? (char)rbuf[32 + i] : '|';
|
||||
out[n] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void set_cards(uint32_t win, uint32_t prop, const uint32_t *values, uint32_t n) {
|
||||
uint8_t req[24 + 4 * 8] = {0};
|
||||
if (n > 8) n = 8;
|
||||
req[0] = 18;
|
||||
*(uint16_t *)(req + 2) = (uint16_t)(6 + n);
|
||||
*(uint32_t *)(req + 4) = win;
|
||||
*(uint32_t *)(req + 8) = prop;
|
||||
*(uint32_t *)(req + 12) = 6; // CARDINAL
|
||||
req[16] = 32;
|
||||
*(uint32_t *)(req + 20) = n;
|
||||
memcpy(req + 24, values, 4 * n);
|
||||
request(req, 24 + 4 * n, NULL);
|
||||
}
|
||||
|
||||
// First CARDINAL of a root property into *value (0 when unset). 0 when the property could not be read.
|
||||
static int first_card(uint32_t root, uint32_t prop, uint32_t *value) {
|
||||
uint8_t gp[24] = {20, 0, 6, 0};
|
||||
uint16_t seq;
|
||||
*(uint32_t *)(gp + 4) = root;
|
||||
*(uint32_t *)(gp + 8) = prop;
|
||||
*(uint32_t *)(gp + 20) = 64;
|
||||
if (request(gp, sizeof gp, &seq) || reply(seq) != 1) return 0;
|
||||
*value = *(uint32_t *)(rbuf + 16) ? *(uint32_t *)(rbuf + 32) : 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 1 when the window still exists (GetWindowAttributes answers), 0 when it is gone, -1 on an io failure.
|
||||
static int alive(uint32_t win) {
|
||||
uint8_t ga[8] = {3, 0, 2, 0};
|
||||
uint16_t seq;
|
||||
*(uint32_t *)(ga + 4) = win;
|
||||
if (request(ga, sizeof ga, &seq)) return -1;
|
||||
return reply(seq);
|
||||
}
|
||||
|
||||
static void set_card(uint32_t win, uint32_t prop, uint32_t value) {
|
||||
uint8_t req[28] = {0};
|
||||
req[0] = 18;
|
||||
*(uint16_t *)(req + 2) = 7;
|
||||
*(uint32_t *)(req + 4) = win;
|
||||
*(uint32_t *)(req + 8) = prop;
|
||||
*(uint32_t *)(req + 12) = 6; // CARDINAL
|
||||
req[16] = 32;
|
||||
*(uint32_t *)(req + 20) = 1;
|
||||
*(uint32_t *)(req + 24) = value;
|
||||
request(req, sizeof req, NULL);
|
||||
}
|
||||
|
||||
// Connects to display :<disp> (abstract socket) and returns the socket, its root window in *root; -1 on failure.
|
||||
static int x_connect(int disp, uint32_t *root) {
|
||||
struct sockaddr_un sa = {.sun_family = AF_UNIX};
|
||||
int n = snprintf(sa.sun_path + 1, sizeof sa.sun_path - 1, "/tmp/.X11-unix/X%d", disp);
|
||||
fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (connect(fd, (struct sockaddr *)&sa, (socklen_t)(offsetof(struct sockaddr_un, sun_path) + 1 + n))) {
|
||||
printf("gstag: connect to :%d failed: %s\n", disp, strerror(errno)); close(fd); return -1;
|
||||
}
|
||||
uint8_t setup[12] = {'l', 0, 11, 0};
|
||||
if (wr(setup, sizeof setup) || rd(rbuf, 8)) { close(fd); return -1; }
|
||||
uint32_t extra = *(uint16_t *)(rbuf + 6) * 4u;
|
||||
if (extra > sizeof rbuf - 8 || rd(rbuf + 8, extra) || rbuf[0] != 1) { printf("gstag: :%d refused\n", disp); close(fd); return -1; }
|
||||
uint8_t *d = rbuf + 8;
|
||||
uint16_t vlen = *(uint16_t *)(d + 16);
|
||||
uint8_t nformats = d[21];
|
||||
*root = *(uint32_t *)(d + 32 + pad4(vlen) + 8u * nformats);
|
||||
return fd;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 5) { fprintf(stderr, "usage: %s <display> <appid> <match> <seconds> [pid]\n", argv[0]); return 2; }
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
int disp = atoi(argv[1]);
|
||||
uint32_t appid = (uint32_t)strtoul(argv[2], NULL, 10);
|
||||
const char *match = argv[3];
|
||||
int seconds = atoi(argv[4]);
|
||||
pid_t watch = argc > 5 ? (pid_t)atoi(argv[5]) : 0;
|
||||
|
||||
uint32_t root, croot;
|
||||
int tfd = x_connect(disp, &root), cfd = tfd;
|
||||
if (tfd < 0) return 3;
|
||||
croot = root;
|
||||
if (disp != 0) {
|
||||
int c = x_connect(0, &croot);
|
||||
if (c >= 0) cfd = c;
|
||||
else croot = root;
|
||||
}
|
||||
tconn = tfd;
|
||||
cconn = cfd;
|
||||
fd = tfd;
|
||||
uint32_t a_game = intern("STEAM_GAME");
|
||||
|
||||
uint8_t cwa[16] = {2, 0, 4, 0}; // ChangeWindowAttributes(root, CWEventMask=SubstructureNotify)
|
||||
*(uint32_t *)(cwa + 4) = root;
|
||||
*(uint32_t *)(cwa + 8) = 0x800;
|
||||
*(uint32_t *)(cwa + 12) = 0x80000;
|
||||
request(cwa, sizeof cwa, NULL);
|
||||
|
||||
uint8_t qt[8] = {15, 0, 2, 0}; // QueryTree(root): windows that exist already
|
||||
uint16_t qseq;
|
||||
*(uint32_t *)(qt + 4) = root;
|
||||
if (request(qt, sizeof qt, &qseq) == 0 && reply(qseq) == 1) {
|
||||
uint16_t nk = *(uint16_t *)(rbuf + 16);
|
||||
uint32_t kids[1024];
|
||||
if (nk > 1024) nk = 1024;
|
||||
memcpy(kids, rbuf + 32, nk * 4u);
|
||||
for (int i = 0; i < nk && npending < 256; i++) pending[npending++] = kids[i];
|
||||
}
|
||||
printf("gstag: watching display %d for WM_CLASS ~ \"%s\" -> STEAM_GAME=%u\n", disp, match, appid);
|
||||
|
||||
fd = cfd; // atoms belong to the server they are interned on
|
||||
uint32_t a_apps = intern("GAMESCOPE_FOCUSABLE_APPS");
|
||||
uint32_t a_focus = intern("GAMESCOPE_FOCUSED_APP");
|
||||
uint32_t a_ctrl = intern("GAMESCOPECTRL_BASELAYER_APPID");
|
||||
fd = tfd;
|
||||
time_t tagged_at = 0; int focus_checked = 0, focus_reads = 0;
|
||||
time_t end = time(NULL) + seconds, next_status = time(NULL) + 3;
|
||||
while (time(NULL) < end) {
|
||||
if (time(NULL) >= next_status) {
|
||||
next_status = time(NULL) + 5;
|
||||
printf("status:");
|
||||
uint32_t props[3] = {a_apps, a_focus, a_ctrl};
|
||||
const char *names[3] = {"focusable", "focused", "baselayer"};
|
||||
fd = cfd;
|
||||
for (int k = 0; k < 3; k++) {
|
||||
uint8_t gp[24] = {20, 0, 6, 0};
|
||||
*(uint32_t *)(gp + 4) = croot;
|
||||
*(uint32_t *)(gp + 8) = props[k];
|
||||
*(uint32_t *)(gp + 20) = 64;
|
||||
uint16_t gseq;
|
||||
if (request(gp, sizeof gp, &gseq) == 0 && reply(gseq) == 1) {
|
||||
uint32_t cnt = *(uint32_t *)(rbuf + 16);
|
||||
printf(" %s=[", names[k]);
|
||||
for (uint32_t i = 0; i < cnt && i < 16; i++) printf("%s%u", i ? "," : "", ((uint32_t *)(rbuf + 32))[i]);
|
||||
printf("]");
|
||||
}
|
||||
}
|
||||
fd = tfd;
|
||||
for (int i = 0; i < ntagged; i++) {
|
||||
uint8_t ga[8] = {3, 0, 2, 0}; // GetWindowAttributes
|
||||
uint16_t aseq, gseq;
|
||||
*(uint32_t *)(ga + 4) = tagged[i];
|
||||
int map = -1, ovr = -1, w = -1, h = -1;
|
||||
if (request(ga, sizeof ga, &aseq) == 0 && reply(aseq) == 1) { map = rbuf[26]; ovr = rbuf[27]; }
|
||||
uint8_t gg[8] = {14, 0, 2, 0}; // GetGeometry
|
||||
*(uint32_t *)(gg + 4) = tagged[i];
|
||||
if (request(gg, sizeof gg, &gseq) == 0 && reply(gseq) == 1) { w = *(uint16_t *)(rbuf + 16); h = *(uint16_t *)(rbuf + 18); }
|
||||
printf(" win0x%x=%dx%d map%d ovr%d", tagged[i], w, h, map, ovr);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
if (tagged_at && !focus_checked && time(NULL) - tagged_at >= 8) {
|
||||
// the override is only for a game that still has a window: a tagged window that was destroyed is gone
|
||||
// from `tagged` (DestroyNotify), and one that is left must still answer
|
||||
int live = 0;
|
||||
for (int i = 0; i < ntagged && !live; i++) live = alive(tagged[i]) == 1;
|
||||
uint32_t f = 0;
|
||||
fd = cfd;
|
||||
int read_ok = live && first_card(croot, a_focus, &f);
|
||||
fd = tfd;
|
||||
if (!live) {
|
||||
focus_checked = 1;
|
||||
printf("gstag: no tagged window left 8 s after the tag; focus left as it is\n");
|
||||
} else if (!read_ok) {
|
||||
// a failed read says nothing about who has focus: try again on the next pass, a few times
|
||||
if (++focus_reads >= 3) { focus_checked = 1; printf("gstag: focus could not be read; left as it is\n"); }
|
||||
} else {
|
||||
focus_checked = 1;
|
||||
if (f != appid) {
|
||||
uint32_t ids[2] = {appid, 769};
|
||||
fd = cfd;
|
||||
set_cards(croot, a_ctrl, ids, 2);
|
||||
fd = tfd;
|
||||
printf("gstag: focus was %u, not %u, 8 s after the tag; set GAMESCOPECTRL_BASELAYER_APPID=%u,769\n", f, appid, appid);
|
||||
} else printf("gstag: %u has focus\n", appid);
|
||||
}
|
||||
}
|
||||
if (watch && kill(watch, 0) != 0 && errno == ESRCH) { printf("gstag: pid %d gone, stopping\n", watch); break; }
|
||||
for (int i = 0; i < npending; ) {
|
||||
char cls[512];
|
||||
uint32_t w = pending[i];
|
||||
if (wm_class(w, cls, sizeof cls) && strcasestr(cls, match)) {
|
||||
set_card(w, a_game, appid);
|
||||
if (ntagged < 256) tagged[ntagged++] = w;
|
||||
if (!tagged_at) tagged_at = time(NULL);
|
||||
printf("gstag: tagged window 0x%x (%s)\n", w, cls);
|
||||
pending[i] = pending[--npending];
|
||||
} else i++;
|
||||
}
|
||||
fd_set rs; FD_ZERO(&rs); FD_SET(fd, &rs);
|
||||
struct timeval tv = {0, 500000};
|
||||
if (select(fd + 1, &rs, NULL, NULL, &tv) > 0) {
|
||||
if (packet()) { printf("gstag: connection closed or a packet too long\n"); break; }
|
||||
if (rbuf[0] > 1) note_event(rbuf); // replies and errors here belong to no request waiting
|
||||
}
|
||||
if (npending > 200) {
|
||||
// drop only windows that are gone; live candidates may still get WM_CLASS
|
||||
for (int i = 0; i < npending; ) {
|
||||
int a = alive(pending[i]);
|
||||
if (a < 0) break;
|
||||
if (a == 0) pending[i] = pending[--npending];
|
||||
else i++;
|
||||
}
|
||||
if (npending > 200) { // still too many: keep the newest
|
||||
memmove(pending, pending + (npending - 200), 200 * sizeof *pending);
|
||||
npending = 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("gstag: done, %d window(s) tagged\n", ntagged);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"file_format_version": "1.0.0",
|
||||
"ICD": { "library_path": "./libvulkan_wrapper.so", "api_version": "1.3.0" }
|
||||
}
|
||||