mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
chore: remove source comments and unused code, translate every missing string (#1965)
* chore(i18n): translate every missing string in all locales Adds the 87 strings the bottom-screen Dashboard and in-game stats pages introduced to all 32 locales, plus the 51 older settings strings Japanese and the 50 Chinese locales were still missing. Every locale now has all 3456 translatable strings with the same placeholders as English. Also translates 36 entries that were still English where the language does not use the English word, and makes es-419 touch_app_id use the same %1$s placeholder as English. * chore(patches): drop comments from the lines downstream patches add Removes comment lines and trailing comments from lines our patches add, with hunk headers recounted. Lines that a later patch uses as context and the upstream backport 0123 are left as they are. The gamescope, FEX, proot and xodus series still apply to their pinned sources, and the patched trees differ only in those comments. test_hud_frames now finds the HUD writer by its first declaration. * docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix These were credited only in source headers and NOTICE files. * chore: remove source comments and unused functions Removes explanatory comments from first-party Kotlin, Java, C, C++, Rust, TypeScript, Python, shell, Gradle, CMake and workflow files. License and attribution headers stay, and vendored third-party trees, generated files and license files are untouched. A shellcheck directive is kept, and udevmon's fallthrough comments became fallthrough attributes. Syntax trees and token streams match the previous sources apart from the comments and Python docstrings. Module docstrings that argparse prints are kept, and device-smoke.sh prints the same --help text from a heredoc. Also removes 37 functions and 4 fields that nothing referenced. * chore: remove comments from the Syncthing integration and the latest main sources * docs: credit Syncthing and the syncthing-android fork * chore(i18n): translate the Syncthing strings in all locales The 107 strings the Syncthing integration added are now in all 32 locales. sync_web_path_locked names the Syncthing tab by its label. * docs: credit @xXJSONDeruloXx for the HUD metric readers The CPU, GPU load, thermal and battery readers come from their PerformanceHudView pull requests #777, #877, #991, #1406 and #1573. The FusionHUD credit line is unchanged. * docs: credit the HUD metric readers to @xXJSONDeruloXx's work
This commit is contained in:
1 parent
d730f0fa8b
commit
c5577478ca
511 files changed
+6813
-4068
No files matched your search
@@ -45,7 +45,6 @@ static void android_volume_set(pa_sink *sink) {
|
||||
unsigned requested = PA_MIN(pa_cvolume_max(&sink->real_volume), PA_VOLUME_NORM);
|
||||
level = ((uint64_t)requested * maximum + PA_VOLUME_NORM / 2) / PA_VOLUME_NORM;
|
||||
pa_cvolume_set(&sink->real_volume, sink->sample_spec.channels, (uint64_t)level * PA_VOLUME_NORM / maximum);
|
||||
/* Android applies media gain to both PulseAudio and DirectAudio streams. */
|
||||
pa_cvolume_reset(&sink->soft_volume, sink->sample_spec.channels);
|
||||
android_volume_request(sink, "volume", level);
|
||||
}
|
||||
@@ -88,7 +87,6 @@ static void android_volume_refresh(pa_mainloop_api *api, pa_time_event *event, c
|
||||
pa_xfree(mute_request);
|
||||
pa_xfree(processing);
|
||||
pa_xfree(mute_processing);
|
||||
/* A held volume key steps Android every ~50 ms; sampling at 100 ms hands Steam uneven multi-step jumps. */
|
||||
unsigned delay_ms = ANDROID_VOLUME_IDLE_MS;
|
||||
if (bridge->active_ticks) {
|
||||
bridge->active_ticks--;
|
||||
|
||||
@@ -86,8 +86,6 @@ trap 'exit 143' TERM
|
||||
|
||||
cache_dir=${DROIDDECK_BUILD_CACHE:-"${HOME}/.cache/droiddeck-build"}
|
||||
mkdir -p "${cache_dir}"
|
||||
# Steps whose output depends only on tracked sources are kept per input hash in the
|
||||
# shared cache, so a rerun or a fresh worktree copies them instead of rebuilding.
|
||||
inputs_hash() {
|
||||
(cd "${repo_root}" && { printf '%s\n' "$1"; shift; find "$@" -type f ! -name '*.pyc' | LC_ALL=C sort | xargs shasum -a 256; }) \
|
||||
| shasum -a 256 | cut -d' ' -f1
|
||||
@@ -105,7 +103,6 @@ save_step() {
|
||||
part=$(mktemp -d "${stored}.part.XXXXXX")
|
||||
(cd "$3" && tar -cf - .) | tar -xf - -C "${part}"
|
||||
touch "${part}/.complete"
|
||||
# Another checkout may have published the same key meanwhile; its copy is equivalent.
|
||||
if [[ -e "${stored}" ]]; then rm -rf "${part}"; else mv "${part}" "${stored}" || rm -rf "${part}"; fi
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ int main(void) {
|
||||
cardboard_push_constants(&q, pose, 0, 0, 0, 0, pc);
|
||||
CHECK(isfinite(pc[17]) && isfinite(pc[19]));
|
||||
|
||||
// Narrow optical profiles and the lower SteamVR slider values must reach
|
||||
// the projection unchanged, rather than all becoming a 30-degree view.
|
||||
const float glasses_fovs[] = {22.0f, 23.3f, 24.0f, 25.8f, 29.0f};
|
||||
for (unsigned i = 0; i < sizeof(glasses_fovs) / sizeof(glasses_fovs[0]); i++) {
|
||||
q.fov_deg = glasses_fovs[i];
|
||||
|
||||
@@ -156,7 +156,6 @@ def main():
|
||||
read(0,0,width,height,0x1908,0x1401,actual)
|
||||
samples = []
|
||||
for x, y in coords:
|
||||
# Readback is GL bottom-up; coordinates below are image top-left.
|
||||
offset = ((height-1-y)*width+x)*4
|
||||
rgb = list(actual[offset:offset+3])
|
||||
eye = 0 if mono or x < width/2 else 1
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
"""Reuse reviewed preload snapshots; changed snapshots must prove their main-build origin."""
|
||||
import argparse
|
||||
import gzip
|
||||
import http.client
|
||||
@@ -147,7 +146,6 @@ def producer_sources(group, commit, root=ROOT):
|
||||
name = 'arm64-preloads' if group == 'arm64' else 'x86-preloads'
|
||||
patterns = definitions[name]['source_inputs']
|
||||
else:
|
||||
# Older approved builds kept ARM64 commands inline, before the Vulkan/VR build.
|
||||
if group == 'arm64':
|
||||
text = run('git', 'show', f'{commit}:.github/workflows/build.yml', root=root).decode()
|
||||
text = text[text.index(' aarch64-linux-gnu-g++ -shared'):]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
"""One entry point for runtime recipes, cache identities and verified job handoff."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
@@ -63,7 +63,6 @@ def graft_targets():
|
||||
|
||||
|
||||
def changed_paths(donor_commit):
|
||||
"""Return {path: status} for the checkout, uncommitted and untracked files included."""
|
||||
changes = {}
|
||||
fields = git('diff', '--name-status', '-z', '--no-renames', donor_commit).decode().split('\0')
|
||||
for status, path in zip(fields[0::2], fields[1::2]):
|
||||
@@ -74,7 +73,6 @@ def changed_paths(donor_commit):
|
||||
|
||||
|
||||
def classify(changes, targets, donor_entries):
|
||||
"""Split changes into grafts {path: asset}, ignored paths and blockers {path: reason}."""
|
||||
grafts, ignored, blocked = {}, [], {}
|
||||
for path, status in sorted(changes.items()):
|
||||
if is_ignored(path):
|
||||
@@ -96,7 +94,6 @@ def helper_bytes(path):
|
||||
|
||||
|
||||
def graft(donor, replacements, output):
|
||||
"""Copy the donor with entries replaced, dropping its signature so it can be re-signed."""
|
||||
with ZipFile(donor) as source, ZipFile(output, 'w') as target:
|
||||
for info in source.infolist():
|
||||
name = info.filename
|
||||
@@ -200,7 +197,6 @@ def pwsh():
|
||||
|
||||
|
||||
def signing_env():
|
||||
"""The .signing.env build_local.sh uses: the override, else the checkout's own, else the main checkout's."""
|
||||
common = Path(git('rev-parse', '--path-format=absolute', '--git-common-dir').decode().strip())
|
||||
for candidate in (os.environ.get('DROIDDECK_SIGNING_ENV'), ROOT / '.signing.env', common.parent / '.signing.env'):
|
||||
if candidate and Path(candidate).is_file():
|
||||
@@ -218,7 +214,6 @@ def sign_with_env(env_file, unsigned, signed):
|
||||
build_tools = sorted(complete, key=version_key, reverse=True)
|
||||
if not build_tools:
|
||||
raise Refused('no build-tools with aapt, zipalign and apksigner under ' + str(sdk_root() / 'build-tools'))
|
||||
# BUILD_TOOLS is assigned after the env file is sourced so the file cannot replace the chosen SDK.
|
||||
script = 'set -a; cd "$(dirname "$1")"; . "$1"; set +a; BUILD_TOOLS="$5" exec "$2" "$3" standard "$4"'
|
||||
result = subprocess.run(['bash', '-c', script, 'sign', str(env_file), str(ROOT / 'tools/release/sign-apk.sh'),
|
||||
str(unsigned), str(signed), str(build_tools[0].parent.resolve())],
|
||||
@@ -230,7 +225,6 @@ def sign_with_env(env_file, unsigned, signed):
|
||||
def sign(unsigned, signed):
|
||||
if not SIGNER.is_file() and (env_file := signing_env()):
|
||||
return sign_with_env(env_file, unsigned, signed)
|
||||
# Microsoft Store Python virtualizes AppData for child processes too and hides the signer; use a python.org install.
|
||||
def quoted(value):
|
||||
return "'" + str(value).replace("'", "''") + "'"
|
||||
command = (f"if (-not (Test-Path -LiteralPath {quoted(SIGNER)})) {{ Write-Error 'Local signer not found'; exit 1 }}; "
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
"""The packages the KDE desktop package ships: the dependency closure of the seeds over Arch Linux
|
||||
ARM's extracted repository databases, minus what the runtime already has at a version that serves.
|
||||
|
||||
closure.py <db dir with x_core, x_extra, x_alarm> <runtime-packages.txt> <seeds.txt>
|
||||
|
||||
Prints one "repo/filename sha256" per package to ship (the sha256 the repository database gives).
|
||||
"""
|
||||
import collections
|
||||
import os
|
||||
import re
|
||||
@@ -107,7 +100,6 @@ def main():
|
||||
providers[pname].append((name, pver or pkgs[name]["version"]))
|
||||
|
||||
def resolve(dep):
|
||||
"""The package to take for a dependency string, and whether the runtime's copy serves."""
|
||||
name, op, want = parse_dep(dep)
|
||||
if name in runtime and satisfies(runtime[name], op, want):
|
||||
return name, True
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
--- a/src/backends/wayland/wayland_backend.cpp
|
||||
+++ b/src/backends/wayland/wayland_backend.cpp
|
||||
@@ -455,6 +455,20 @@
|
||||
@@ -455,6 +455,19 @@
|
||||
|
||||
if (WaylandClient::LinuxDmabufV1 *dmabuf = m_display->linuxDmabuf()) {
|
||||
m_renderDevice = GpuManager::self()->compatibleRenderDevice(dmabuf->mainDevice());
|
||||
+ if (!m_renderDevice && qEnvironmentVariableIsSet("DROIDDECK_NESTED_SCALE")) {
|
||||
+ const auto nodes = GpuManager::splitPathList(qEnvironmentVariable("KWIN_RENDER_NODES"));
|
||||
+ const auto &devices = GpuManager::self()->renderDevices();
|
||||
+ // Android's KGSL host cannot name a DRM device in its dmabuf feedback.
|
||||
+ if (nodes.size() == 1) {
|
||||
+ for (const auto &device : devices) {
|
||||
+ if (device->path() == nodes.constFirst()) {
|
||||
|
||||
@@ -1,15 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate removal inventories from checksum-pinned published archives.
|
||||
|
||||
Usage: removal-manifests.py <LXQt tar.zst> <KDE r1 tar.zst> <KDE r2 tar.zst>
|
||||
<emulators tar.zst> <verified KDE package cache> <output dir>
|
||||
<verified LXQt package cache>
|
||||
removal-manifests.py --add <KDE tar.zst> <tag> <sha256> <verified KDE package cache> <output dir>
|
||||
Removal includes desktop applications/themes and our overlay, not their shared dependencies.
|
||||
The KDE cache is verified against the published desktop-kde.packages.txt before use.
|
||||
The LXQt cache contains the signed application packages listed by desktop.packages.txt;
|
||||
verify their Arch Linux ARM Build System signatures before generating the inventory.
|
||||
"""
|
||||
import gzip
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
+28
-24
@@ -1,26 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# Smoke test of a DroidDeck build on a real device, over plain adb (no python, no root).
|
||||
#
|
||||
# What it does, in order, and restores afterwards:
|
||||
# 1. prints the device (model, Android, kernel, page size, SoC);
|
||||
# 2. installs --apk when given and launches the app;
|
||||
# 3. checks that the app starts and that nothing in the crash buffer belongs to it;
|
||||
# 4. changes the display density and the window size and checks the app keeps its process
|
||||
# (and does not recreate the activity that is on top);
|
||||
# 5. on a foldable cycles the device state (half-opened, and with --closed also closed) through
|
||||
# `cmd device_state`, then puts the original state back;
|
||||
# 6. reads the newest session folder of a debug build: first frame, last frame rate, the
|
||||
# memory page size, the proot that session ran, and the last process exits.
|
||||
#
|
||||
# Usage: tools/device-smoke.sh [--serial SERIAL] [--apk FILE] [--pkg PACKAGE]
|
||||
# [--no-density] [--no-size] [--no-fold] [--closed]
|
||||
# Exit status: 0 when no check failed, 1 when one did, 2 for a usage or device problem.
|
||||
#
|
||||
# Not a replacement for tools/droiddeck-scenario, which drives a game through the agent bridge;
|
||||
# this covers what that does not: display changes and foldable states.
|
||||
set -u
|
||||
export MSYS_NO_PATHCONV=1 MSYS2_ARG_CONV_EXCL='*'
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Smoke test of a DroidDeck build on a real device, over plain adb (no python, no root).
|
||||
|
||||
What it does, in order, and restores afterwards:
|
||||
1. prints the device (model, Android, kernel, page size, SoC);
|
||||
2. installs --apk when given and launches the app;
|
||||
3. checks that the app starts and that nothing in the crash buffer belongs to it;
|
||||
4. changes the display density and the window size and checks the app keeps its process
|
||||
(and does not recreate the activity that is on top);
|
||||
5. on a foldable cycles the device state (half-opened, and with --closed also closed) through
|
||||
`cmd device_state`, then puts the original state back;
|
||||
6. reads the newest session folder of a debug build: first frame, last frame rate, the
|
||||
memory page size, the proot that session ran, and the last process exits.
|
||||
|
||||
Usage: tools/device-smoke.sh [--serial SERIAL] [--apk FILE] [--pkg PACKAGE]
|
||||
[--no-density] [--no-size] [--no-fold] [--closed]
|
||||
Exit status: 0 when no check failed, 1 when one did, 2 for a usage or device problem.
|
||||
|
||||
Not a replacement for tools/droiddeck-scenario, which drives a game through the agent bridge;
|
||||
this covers what that does not: display changes and foldable states.
|
||||
EOF
|
||||
}
|
||||
|
||||
pkg=com.droiddeck.launcher
|
||||
serial=${ANDROID_SERIAL:-}
|
||||
apk=
|
||||
@@ -39,7 +44,7 @@ while [ $# -gt 0 ]; do
|
||||
--no-size) do_size=0 ;;
|
||||
--no-fold) do_fold=0 ;;
|
||||
--closed) do_closed=1 ;;
|
||||
-h|--help) sed -n '2,22p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) echo "unknown option: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
shift
|
||||
@@ -96,7 +101,6 @@ restore_size() {
|
||||
echo "$current" | grep -q 'Physical size:' || return 1
|
||||
[ "$(echo "$current" | wm_override size)" = "$override_size" ]
|
||||
}
|
||||
# An override that was already in place (a test lab pins one) is put back; otherwise the request is cancelled.
|
||||
restore_fold() { if [ -n "$pre_override" ]; then sh_ cmd device_state state "$pre_override" >/dev/null; else sh_ cmd device_state state reset >/dev/null; fi; }
|
||||
|
||||
restore() {
|
||||
@@ -133,7 +137,7 @@ app_crashes() {
|
||||
pat=$(printf '%s' "$pkg" | sed 's/[.[\*^$]/\\&/g')
|
||||
printf '%s\n' "$out" | grep -c -E "(Process: |Cmdline: |>>> )$pat([ ,<:]|$)" || true
|
||||
}
|
||||
relaunches_of() { # $1 = activity class fragment
|
||||
relaunches_of() {
|
||||
sh_ logcat -b events -d 2>/dev/null | grep -E 'wm_(relaunch|destroy|create)_activity' | grep -c "$1"
|
||||
}
|
||||
|
||||
@@ -214,7 +218,7 @@ if [ "$do_size" = 1 ]; then
|
||||
phys=$(echo "$size_snapshot" | sed -n 's/.*Physical size: \([0-9]*\)x\([0-9]*\).*/\1 \2/p' | head -1)
|
||||
set -- $phys
|
||||
if [ -n "${1:-}" ]; then
|
||||
w=$(( ($2 * 2 / 3) / 2 * 2 )); h=$1 # a narrower, taller window, like a cover screen
|
||||
w=$(( ($2 * 2 / 3) / 2 * 2 )); h=$1
|
||||
pid0=$(app_pid)
|
||||
size_changed=1
|
||||
wm_status=0
|
||||
@@ -250,7 +254,7 @@ if [ "$do_fold" = 1 ]; then
|
||||
else
|
||||
id_of() { echo "$states" | sed -n "s/.*identifier=\([0-9]*\), name='$1'.*/\1/p" | head -1; }
|
||||
half=$(id_of HALF_OPENED); closed=$(id_of CLOSED)
|
||||
cycle() { # $1 name $2 id
|
||||
cycle() {
|
||||
pid0=$(app_pid)
|
||||
fold_changed=1
|
||||
sh_ cmd device_state state "$2" >/dev/null; sleep 8
|
||||
|
||||
@@ -1,49 +1,10 @@
|
||||
/* DirectAudio relay - the contract between the driver and the relay helper.
|
||||
*
|
||||
/*
|
||||
* Copyright 2026 The412Banner
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* WHY THIS EXISTS. The driver's whole premise is an in-process AAudio client:
|
||||
* the guest's WASAPI buffers are mixed and handed to Android's audio server
|
||||
* from inside the game, no daemon in the path. That is only possible when the
|
||||
* game process is a bionic process. Under a glibc runtime (the Linux Steam
|
||||
* client, where the game runs inside a proot'd Arch rootfs on Valve's own
|
||||
* ARM64 Proton) libaaudio cannot be loaded at all: it is a bionic library and
|
||||
* the rootfs's dynamic linker does not know how to bring it into a glibc
|
||||
* process. The game side therefore has to stop at a boundary it CAN cross, and
|
||||
* the only thing both worlds agree on is the kernel: a unix socket, a memfd and
|
||||
* a futex word.
|
||||
*
|
||||
* SHAPE. One helper process (directaudio-relay, bionic, links libaaudio) runs
|
||||
* on the Android side and listens on a unix socket. Each game process that
|
||||
* needs audio connects once, sends its launch config (the same knobs the
|
||||
* in-process build reads from BANNER_AUDIO_DIRECT_*), and gets back one or two
|
||||
* shared rings (memfds passed with SCM_RIGHTS):
|
||||
*
|
||||
* render ring game (producer) -> helper (consumer) -> AAudio OUTPUT
|
||||
* capture ring helper (producer, AAudio INPUT) -> game (consumer)
|
||||
*
|
||||
* The driver keeps its mixer and its per-voice WASAPI rings exactly as in the
|
||||
* in-process build; what used to be the AAudio data callback is now a pump
|
||||
* thread that keeps the render ring topped up, and the capture callback is a
|
||||
* pump that drains the capture ring into the capture voices. Everything that
|
||||
* needs an AAudioStream (open, adaptive buffer growth and decay, route-change
|
||||
* reopen, the stalled-callback watchdog, the live-config mailbox) moves to the
|
||||
* helper unchanged in spirit.
|
||||
*
|
||||
* COST. One extra hand-off: the ring. The helper's callback pulls a burst from
|
||||
* the ring, so the ring must hold at least one burst at every callback; the
|
||||
* driver keeps DA_RING_TARGET_BURSTS bursts queued and the helper raises that
|
||||
* target when a callback finds the ring short. Everything else - the AAudio
|
||||
* buffer, AudioFlinger's own latency - is what the in-process build pays too.
|
||||
*
|
||||
* WIRE FORMAT. Fixed-width, native-endian, same-machine only. The two sides are
|
||||
* different libcs but the same CPU, so no marshalling beyond fixed-size structs.
|
||||
* Bump DA_RELAY_VERSION on any layout change; the helper refuses a mismatch.
|
||||
*/
|
||||
#ifndef DA_RELAY_PROTO_H
|
||||
#define DA_RELAY_PROTO_H
|
||||
@@ -52,34 +13,20 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#define DA_RELAY_VERSION 1
|
||||
#define DA_RING_MAGIC 0x44415247u /* 'DARG' */
|
||||
#define DA_HELLO_MAGIC 0x44414831u /* 'DAH1' */
|
||||
#define DA_ACK_MAGIC 0x44414131u /* 'DAA1' */
|
||||
#define DA_RING_MAGIC 0x44415247u
|
||||
#define DA_HELLO_MAGIC 0x44414831u
|
||||
#define DA_ACK_MAGIC 0x44414131u
|
||||
|
||||
/* Socket path. The driver reads BANNER_AUDIO_DIRECT_RELAY; when unset it falls
|
||||
* back to $XDG_RUNTIME_DIR/DA_RELAY_DEFAULT_NAME, which a host that already
|
||||
* hands its runtime dir into the session gets for free. */
|
||||
#define DA_RELAY_ENV "BANNER_AUDIO_DIRECT_RELAY"
|
||||
#define DA_RELAY_DEFAULT_NAME "directaudio-relay"
|
||||
|
||||
/* Both rings carry float32 interleaved stereo. The render ring is always
|
||||
* 48 kHz (the mixer's output rate); the capture ring runs at whatever rate the
|
||||
* input stream was granted, published in da_ring.rate, and the driver resamples
|
||||
* per voice as the in-process build already does. */
|
||||
#define DA_RING_RATE 48000
|
||||
#define DA_RING_CHANNELS 2
|
||||
|
||||
/* Render ring sizing. Capacity is the ceiling adaptive growth can reach; the
|
||||
* initial target is what the driver keeps queued. Two bursts: the helper's
|
||||
* callback consumes one burst and wakes the pump, which then has a full burst
|
||||
* period to refill before the next callback. */
|
||||
#define DA_RING_CAP_MS 250
|
||||
#define DA_RING_TARGET_BURSTS 2
|
||||
#define DA_RING_MAX_TARGET_MS 100
|
||||
|
||||
/* Capture ring: 200 ms is far more than a game ever leaves queued; on overrun
|
||||
* the helper drops the newest block, matching the in-process "guest is not
|
||||
* draining" behaviour of dropping data rather than blocking the mic thread. */
|
||||
#define DA_CAPTURE_RING_MS 200
|
||||
|
||||
enum da_ring_state
|
||||
@@ -93,35 +40,27 @@ struct da_ring
|
||||
{
|
||||
uint32_t magic;
|
||||
uint32_t version;
|
||||
uint32_t cap_frames; /* ring capacity in frames */
|
||||
uint32_t rate; /* frames per second of the data in this ring */
|
||||
uint32_t channels; /* DA_RING_CHANNELS */
|
||||
uint32_t cap_frames;
|
||||
uint32_t rate;
|
||||
uint32_t channels;
|
||||
uint32_t _pad0;
|
||||
|
||||
/* Single producer, single consumer; monotonic frame totals, wrap-safe with
|
||||
* unsigned arithmetic. Producer writes widx with RELEASE after the data;
|
||||
* consumer writes ridx with RELEASE after it has copied the data out. */
|
||||
volatile uint32_t widx;
|
||||
volatile uint32_t ridx;
|
||||
|
||||
/* Futex word the CONSUMER of a render ring / PRODUCER of a capture ring
|
||||
* bumps after each block, so the other side can sleep on it instead of
|
||||
* polling. Waiters always use a timeout, so a missed wake only costs one
|
||||
* period. */
|
||||
volatile uint32_t wake;
|
||||
|
||||
volatile uint32_t quit; /* either side: tear down */
|
||||
volatile uint32_t state; /* enum da_ring_state, helper-owned */
|
||||
volatile uint32_t quit;
|
||||
volatile uint32_t state;
|
||||
|
||||
/* Render ring only, helper-owned, read by the driver: */
|
||||
volatile int32_t target_frames; /* keep at least this many queued */
|
||||
volatile int32_t hw_buf_frames; /* AAudio buffer size right now (get_latency) */
|
||||
volatile int32_t hw_burst; /* frames per burst of the output stream */
|
||||
volatile uint32_t underruns; /* callbacks that found fewer than they needed */
|
||||
volatile uint32_t cb_count; /* data callbacks so far (liveness) */
|
||||
volatile int32_t target_frames;
|
||||
volatile int32_t hw_buf_frames;
|
||||
volatile int32_t hw_burst;
|
||||
volatile uint32_t underruns;
|
||||
volatile uint32_t cb_count;
|
||||
uint32_t _pad1[3];
|
||||
|
||||
float data[]; /* cap_frames * channels */
|
||||
float data[];
|
||||
};
|
||||
|
||||
static inline size_t da_ring_bytes(uint32_t cap_frames)
|
||||
@@ -141,62 +80,52 @@ static inline uint32_t da_ring_space(const struct da_ring *r)
|
||||
return r->cap_frames - da_ring_avail(r);
|
||||
}
|
||||
|
||||
/* ---- wire messages ------------------------------------------------------- */
|
||||
|
||||
#define DA_HELLO_MIC 0x01u /* also open an INPUT stream + capture ring */
|
||||
#define DA_HELLO_EXCLUSIVE 0x02u /* AAUDIO_SHARING_MODE_EXCLUSIVE requested */
|
||||
#define DA_HELLO_MIC 0x01u
|
||||
#define DA_HELLO_EXCLUSIVE 0x02u
|
||||
#define DA_HELLO_ADAPTIVE 0x04u
|
||||
#define DA_HELLO_DECAY 0x08u
|
||||
#define DA_HELLO_WATCHDOG 0x10u
|
||||
|
||||
/* First message on a fresh connection, driver -> helper. Mirrors the launch
|
||||
* config the in-process build derives from BANNER_AUDIO_DIRECT_* so a preset
|
||||
* means the same thing under both runtimes. */
|
||||
struct da_hello
|
||||
{
|
||||
uint32_t magic; /* DA_HELLO_MAGIC */
|
||||
uint32_t version; /* DA_RELAY_VERSION */
|
||||
uint32_t flags; /* DA_HELLO_* */
|
||||
int32_t perf; /* 0 NONE, 1 LOW_LATENCY, 2 POWER_SAVING (host convention) */
|
||||
int32_t target_ms; /* AAudio buffer, ms; 0 = use target_frames or the default */
|
||||
int32_t max_ms; /* adaptive ceiling, ms; 0 = max_frames or the default */
|
||||
int32_t target_frames; /* frame forms, used only when the ms forms are 0 */
|
||||
uint32_t magic;
|
||||
uint32_t version;
|
||||
uint32_t flags;
|
||||
int32_t perf;
|
||||
int32_t target_ms;
|
||||
int32_t max_ms;
|
||||
int32_t target_frames;
|
||||
int32_t max_frames;
|
||||
uint32_t stall_ms; /* watchdog: callback silent this long => rebuild */
|
||||
uint32_t quiet_ms; /* decay pacing, see the driver */
|
||||
uint32_t stall_ms;
|
||||
uint32_t quiet_ms;
|
||||
uint32_t punish_ms;
|
||||
uint32_t max_backoff;
|
||||
int32_t pid; /* the game process, for the log */
|
||||
uint32_t log; /* BANNER_AUDIO_DIRECT_LOG */
|
||||
char runtime_path[256]; /* BANNER_AUDIO_DIRECT_RUNTIME mailbox, "" = none */
|
||||
char name[64]; /* process name, for the log */
|
||||
int32_t pid;
|
||||
uint32_t log;
|
||||
char runtime_path[256];
|
||||
char name[64];
|
||||
};
|
||||
|
||||
#define DA_ACK_MIC_FAILED 0x01u /* mic asked for, input stream would not open */
|
||||
#define DA_ACK_MIC_FAILED 0x01u
|
||||
|
||||
/* Reply, helper -> driver, followed by SCM_RIGHTS carrying the ring fds:
|
||||
* fd[0] = render ring, fd[1] = capture ring (present iff in_cap_frames > 0). */
|
||||
struct da_ack
|
||||
{
|
||||
uint32_t magic; /* DA_ACK_MAGIC */
|
||||
int32_t status; /* 0 = ok, else an AAudio error code (negative) */
|
||||
int32_t rate; /* output stream rate (48000) */
|
||||
int32_t burst; /* output frames per burst */
|
||||
int32_t buf_frames; /* output buffer size as opened */
|
||||
int32_t out_cap_frames; /* render ring capacity */
|
||||
int32_t in_cap_frames; /* capture ring capacity, 0 = no capture ring */
|
||||
int32_t in_rate; /* rate of the capture ring's data */
|
||||
uint32_t flags; /* DA_ACK_* */
|
||||
uint32_t magic;
|
||||
int32_t status;
|
||||
int32_t rate;
|
||||
int32_t burst;
|
||||
int32_t buf_frames;
|
||||
int32_t out_cap_frames;
|
||||
int32_t in_cap_frames;
|
||||
int32_t in_rate;
|
||||
uint32_t flags;
|
||||
uint32_t _pad;
|
||||
};
|
||||
|
||||
/* Subsequent messages, driver -> helper, on the same socket. The helper never
|
||||
* writes after the ack; everything it has to say is in the ring header. EOF on
|
||||
* the socket is how the helper learns the game is gone. */
|
||||
enum da_msg_type
|
||||
{
|
||||
DA_MSG_MIC_START = 1, /* first capture voice started: make the mic hot */
|
||||
DA_MSG_MIC_STOP = 2, /* last capture voice gone: stop (keep open) */
|
||||
DA_MSG_MIC_START = 1,
|
||||
DA_MSG_MIC_STOP = 2,
|
||||
DA_MSG_PING = 3,
|
||||
};
|
||||
|
||||
@@ -206,4 +135,4 @@ struct da_msg
|
||||
int32_t arg;
|
||||
};
|
||||
|
||||
#endif /* DA_RELAY_PROTO_H */
|
||||
#endif
|
||||
@@ -1,24 +1,5 @@
|
||||
/*
|
||||
* module-directaudio-native-sink: a PulseAudio 13 sink that is DirectAudio's AAudio engine,
|
||||
* in-process. For the native Linux Steam client on Android (DroidDeck, Bannerlator's Linux
|
||||
* session), whose sound can only ever reach a PulseAudio daemon: this module is where that
|
||||
* daemon's mixed output meets Android, one step away from AudioFlinger, with the same engine the
|
||||
* game driver has - adaptive device buffer that grows a burst on every xrun, optional decay with a
|
||||
* remembered floor, a primed ring with fades instead of clicks, route-change / error reopen on a
|
||||
* fresh stream, and a stall watchdog.
|
||||
*
|
||||
* It is the relay helper's per-client OUTPUT engine (directaudio-relay.c) with the socket and the
|
||||
* shared-memory ring replaced by a ring in this process, fed by the sink's IO thread exactly as
|
||||
* module-directaudio-sink feeds the relay. Compared with that module there is no second process
|
||||
* and no 40 ms proot safety margin: the ring here only has to cover the IO thread's own
|
||||
* scheduling jitter, so it starts at two bursts and grows only if a callback finds it short.
|
||||
*
|
||||
* The daemon must run on the Android side (the host app's process), not inside proot, for AAudio
|
||||
* to be reachable at all - which is where both host apps already run it.
|
||||
*
|
||||
* Field fixes carried from the relay (MaxsTechReview, Droid-Deck/DroidDeck#338): prime before
|
||||
* playing, fade on an underrun, one consumer per ring across a reopen, a device buffer of at
|
||||
* least two bursts.
|
||||
* Derived from the AAudio engine of DirectAudio's relay helper (directaudio-relay.c) by The412Banner.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
@@ -52,7 +33,7 @@
|
||||
#include <pulsecore/thread-mq.h>
|
||||
#include <pulsecore/thread.h>
|
||||
|
||||
#include "da_relay_proto.h" /* struct da_ring + the ring helpers; nothing of the socket protocol */
|
||||
#include "da_relay_proto.h"
|
||||
|
||||
PA_MODULE_AUTHOR("The412Banner");
|
||||
PA_MODULE_DESCRIPTION("Android audio output: DirectAudio's AAudio engine, in-process");
|
||||
@@ -77,7 +58,6 @@ PA_MODULE_USAGE(
|
||||
#define WATCHDOG_TICK_USEC (1 * PA_USEC_PER_SEC)
|
||||
#define AUDIO_NICE (-16)
|
||||
|
||||
/* ---- tunables: the in-process driver's, same defaults ----------------------- */
|
||||
#define DA_KNEE 0.75f
|
||||
#define DA_DEFAULT_MS 12
|
||||
#define DA_DEFAULT_MAX_MS 100
|
||||
@@ -112,17 +92,14 @@ struct userdata {
|
||||
pa_sample_spec ss;
|
||||
size_t frame_size;
|
||||
|
||||
/* configuration */
|
||||
aaudio_performance_mode_t perf;
|
||||
int32_t target_ms, max_ms, ring_ms;
|
||||
bool adaptive, decay, limiter, watchdog_on;
|
||||
|
||||
/* the ring: this process's, same layout as the relay's so the engine is shared */
|
||||
struct da_ring *ring;
|
||||
int32_t burst;
|
||||
int32_t ring_max_target;
|
||||
|
||||
/* the one OUTPUT stream and its adaptive state (the relay's struct client, minus the socket) */
|
||||
AAudioStream *aq;
|
||||
pthread_mutex_t lock;
|
||||
int32_t last_xrun;
|
||||
@@ -134,7 +111,6 @@ struct userdata {
|
||||
int suspended;
|
||||
volatile int dead;
|
||||
|
||||
/* what the IO thread last logged, so engine changes made on the AAudio thread get a line */
|
||||
int32_t seen_target, seen_hw_buf;
|
||||
uint32_t seen_underruns;
|
||||
pa_usec_t next_watchdog, settled_at, stats_at;
|
||||
@@ -152,8 +128,6 @@ static uint64_t now_ns(void) {
|
||||
|
||||
static void request_reopen(struct userdata *u, const char *why);
|
||||
|
||||
/* ---- the engine: the relay's out_cb / open_output / reopen / watchdog, on a local ring ---- */
|
||||
|
||||
static void fade(float *p, uint32_t frames, int in) {
|
||||
uint32_t i, ch;
|
||||
|
||||
@@ -165,8 +139,6 @@ static void fade(float *p, uint32_t frames, int in) {
|
||||
}
|
||||
}
|
||||
|
||||
/* The driver's soft-knee limiter: below DA_KNEE the signal is untouched, so ordinary material is
|
||||
* bit-identical; above it a smooth knee folds the overshoot back under full scale. */
|
||||
static void limit(float *p, uint32_t samples) {
|
||||
uint32_t i;
|
||||
|
||||
@@ -193,7 +165,6 @@ static aaudio_data_callback_result_t out_cb(AAudioStream *aq, void *user, void *
|
||||
int fade_in = 0, short_read = 0, starving = 0;
|
||||
uint64_t now;
|
||||
|
||||
/* Only the promoted stream reads the ring; an outgoing one during a reopen plays silence. */
|
||||
if ((live && aq != live) || __atomic_exchange_n(&u->consuming, 1, __ATOMIC_ACQUIRE)) {
|
||||
memset(out, 0, (size_t) frames * DA_RING_CHANNELS * sizeof(float));
|
||||
return AAUDIO_CALLBACK_RESULT_CONTINUE;
|
||||
@@ -248,8 +219,6 @@ static aaudio_data_callback_result_t out_cb(AAudioStream *aq, void *user, void *
|
||||
__atomic_add_fetch(&u->cb_count, 1, __ATOMIC_SEQ_CST);
|
||||
__atomic_store_n(&r->cb_count, u->cb_count, __ATOMIC_RELAXED);
|
||||
|
||||
/* The ring's own adaptive step: a short ring means the IO thread did not get scheduled in
|
||||
* time - an xrun one stage earlier - so keep one more burst queued. Only grows. */
|
||||
if (short_read)
|
||||
__atomic_add_fetch(&r->underruns, 1, __ATOMIC_RELAXED);
|
||||
if ((short_read || starving) && u->adaptive) {
|
||||
@@ -262,8 +231,6 @@ static aaudio_data_callback_result_t out_cb(AAudioStream *aq, void *user, void *
|
||||
__atomic_store_n(&r->target_frames, want, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
/* The device buffer: grow a burst per xrun; decay a burst after a quiet spell, never below
|
||||
* the floor a punished decay taught us. */
|
||||
if (u->adaptive) {
|
||||
int32_t xruns = AAudioStream_getXRunCount(aq);
|
||||
int32_t burst = AAudioStream_getFramesPerBurst(aq);
|
||||
@@ -312,8 +279,6 @@ static void out_error_cb(AAudioStream *aq, void *user, aaudio_result_t error) {
|
||||
|
||||
if (aq != __atomic_load_n(&u->aq, __ATOMIC_SEQ_CST)) return;
|
||||
if (__atomic_load_n(&u->suspended, __ATOMIC_SEQ_CST)) return;
|
||||
/* A disconnected stream (headphones plugged or unplugged, a Bluetooth route coming or going)
|
||||
* can never be restarted: it has to be closed and a new one opened on the current route. */
|
||||
if (error != AAUDIO_ERROR_DISCONNECTED &&
|
||||
error != AAUDIO_ERROR_INVALID_STATE &&
|
||||
error != AAUDIO_ERROR_INVALID_HANDLE &&
|
||||
@@ -322,8 +287,6 @@ static void out_error_cb(AAudioStream *aq, void *user, aaudio_result_t error) {
|
||||
request_reopen(u, "stream error");
|
||||
}
|
||||
|
||||
/* 48 kHz / float / stereo, buffer from the ms form rounded up to a burst and never below two,
|
||||
* capacity from the ceiling. The ring target floor is two bursts or ring_ms, whichever is more. */
|
||||
static aaudio_result_t open_output(struct userdata *u, AAudioStream **out) {
|
||||
AAudioStreamBuilder *builder = NULL;
|
||||
AAudioStream *aq = NULL;
|
||||
@@ -446,7 +409,6 @@ static void request_reopen(struct userdata *u, const char *why) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Ticked once a second from the IO thread: a callback silent for a second is a dead stream. */
|
||||
static void watchdog(struct userdata *u) {
|
||||
uint64_t now = now_ns(), last_cb, prev_tick;
|
||||
unsigned int cb;
|
||||
@@ -484,13 +446,10 @@ static void close_output(struct userdata *u) {
|
||||
AAudioStream_requestStop(aq);
|
||||
AAudioStream_close(aq);
|
||||
}
|
||||
/* A reopen still in flight sees u->dead and stops; give it a moment to let go of u. */
|
||||
while (__atomic_load_n(&u->reopen_running, __ATOMIC_SEQ_CST))
|
||||
usleep(10000);
|
||||
}
|
||||
|
||||
/* ---- the PulseAudio side: module-directaudio-sink's producer, on the local ring ---- */
|
||||
|
||||
static pa_usec_t frames_to_usec(const struct userdata *u, int64_t frames) {
|
||||
return (pa_usec_t) (frames * (int64_t) PA_USEC_PER_SEC / (int64_t) u->ss.rate);
|
||||
}
|
||||
@@ -528,7 +487,6 @@ static void produce(struct userdata *u, uint32_t frames) {
|
||||
__atomic_store_n(&r->widx, w + frames, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
/* Tops the ring up to the engine's target and narrates what the engine changed. */
|
||||
static void service_ring(struct userdata *u) {
|
||||
struct da_ring *r = u->ring;
|
||||
uint32_t avail, space;
|
||||
@@ -587,8 +545,6 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
|
||||
return pa_sink_process_msg(o, code, data, offset, chunk);
|
||||
}
|
||||
|
||||
/* A started AAudio stream keeps audioserver's AudioMix wake lock held, so the device never
|
||||
* suspends while the session sleeps: stop it, and the IO thread's timer, until the sink reopens. */
|
||||
static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, pa_suspend_cause_t new_suspend_cause) {
|
||||
struct userdata *u = s->userdata;
|
||||
aaudio_result_t res = AAUDIO_OK;
|
||||
@@ -629,9 +585,6 @@ static void thread_func(void *userdata) {
|
||||
for (;;) {
|
||||
int ret;
|
||||
|
||||
/* Half a burst between visits, never blocking on the stream: clients' audio reaches this
|
||||
* thread as messages pa_rtpoll_run handles, and a thread stuck in a write or a wait lets
|
||||
* them run dry (the crackle #338 fixed). */
|
||||
if (!u->suspended) {
|
||||
service_ring(u);
|
||||
pa_rtpoll_set_timer_relative(u->rtpoll, PA_MAX(frames_to_usec(u, u->burst) / 2, PA_USEC_PER_MSEC));
|
||||
@@ -719,7 +672,6 @@ int pa__init(pa_module *m) {
|
||||
pthread_mutex_init(&u->lock, NULL);
|
||||
pa_channel_map_init_stereo(&map);
|
||||
|
||||
/* The ring: the relay's layout in this process's memory. */
|
||||
cap_frames = DA_RING_CAP_MS_LOCAL * DA_RING_RATE / 1000;
|
||||
u->ring = pa_xmalloc0(da_ring_bytes(cap_frames));
|
||||
u->ring->magic = DA_RING_MAGIC;
|
||||
@@ -774,8 +726,6 @@ int pa__init(pa_module *m) {
|
||||
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
|
||||
pa_sink_set_rtpoll(u->sink, u->rtpoll);
|
||||
pa_sink_set_max_request(u->sink, (size_t) u->ring->target_frames * u->frame_size);
|
||||
/* What clients should keep queued on their side: the ring's starting target plus the device
|
||||
* buffer. Grows are reported live through GET_LATENCY. */
|
||||
pa_sink_set_fixed_latency(u->sink, frames_to_usec(u, (int64_t) u->ring->target_frames + u->base_buf_frames));
|
||||
|
||||
if (!(u->thread = pa_thread_new("directaudio-native-sink", thread_func, u))) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds the 32-bit ws2_32.dll stand-in for DiRT 3 and DiRT Showdown into the given folder.
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
mkdir -p "$1"
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
"""ws2_32 stand-in helpers.
|
||||
|
||||
gen.py generate SRC OUT writes OUT/thunks.c (one jump per export) and OUT/ws2_32.def from SRC/ws2_32-exports.txt.
|
||||
gen.py verify SRC DLL checks that DLL exports exactly the ordinals and names in SRC/ws2_32-exports.txt.
|
||||
"""
|
||||
import struct
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
/* ws2_32.dll stand-in for DiRT 3 and DiRT Showdown (32-bit).
|
||||
*
|
||||
* Both games close their motion telemetry UDP socket at the end of a race (and when leaving Joyride) and keep
|
||||
* calling sendto() on it; the WSAENOTSOCK (10038) failure stops the game. Every export here jumps to the
|
||||
* same-ordinal export of Wine's own ws2_32.dll, except that a sendto() failing with 10038 reports 0 bytes sent.
|
||||
* Same behaviour as DiRTTelemetryErrorFix by RoccoC (MIT), based on the fix by Carsten Gottschling. */
|
||||
/* Same behaviour as DiRTTelemetryErrorFix by RoccoC (MIT), based on the fix by Carsten Gottschling. */
|
||||
|
||||
typedef unsigned short WCHAR;
|
||||
typedef unsigned long DWORD;
|
||||
@@ -21,7 +16,6 @@ __attribute__((dllimport)) UINT WINAPI GetSystemDirectoryW(WCHAR *buffer, UINT s
|
||||
__attribute__((dllimport)) DWORD WINAPI GetEnvironmentVariableW(const WCHAR *name, WCHAR *buffer, DWORD size);
|
||||
__attribute__((dllimport)) DWORD WINAPI GetFileAttributesW(const WCHAR *name);
|
||||
|
||||
/* droiddeck-game-env recognises a swapped-in copy by this text. */
|
||||
__attribute__((used)) const char dirtfix_marker[] = "droiddeck-dirt-ws2_32";
|
||||
|
||||
extern const unsigned short dirtfix_ordinals[];
|
||||
@@ -59,8 +53,6 @@ static void append_number(WCHAR *dst, UINT n)
|
||||
append(dst, digits + i);
|
||||
}
|
||||
|
||||
/* When this file replaces the prefix's syswow64\ws2_32.dll, Wine's own copy is the i386-windows\ws2_32.dll in one
|
||||
* of the builtin DLL folders Wine lists in WINEDLLDIR0, WINEDLLDIR1, ... as NT paths (\??\Z:\...). */
|
||||
static HMODULE load_wine_ws2_32(HMODULE self)
|
||||
{
|
||||
WCHAR name[24], path[600];
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Sourced by the build scripts: picks the Docker platform and the matching cross-build image.
|
||||
docker_platform=${DROIDDECK_DOCKER_PLATFORM:-}
|
||||
if [[ -z "${docker_platform}" ]]; then
|
||||
case "$(uname -m)" in arm64|aarch64) docker_platform=linux/arm64 ;; *) docker_platform=linux/amd64 ;; esac
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
"""Check the engine before modifying build assets; never rebuild for a daemon error."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
@@ -18,7 +17,7 @@ if __name__ == '__main__':
|
||||
sys.exit('Docker is unavailable: ' + engine.stderr.strip())
|
||||
image = run('image', 'inspect', sys.argv[1])
|
||||
if image.returncode:
|
||||
if 'No such image' not in image.stderr and 'image not known' not in image.stderr: # Docker, Podman
|
||||
if 'No such image' not in image.stderr and 'image not known' not in image.stderr:
|
||||
sys.exit('Cannot inspect the build image: ' + image.stderr.strip())
|
||||
repo = Path(__file__).resolve().parents[1]
|
||||
subprocess.run(['docker', 'build', '--platform', os.environ.get('DROIDDECK_DOCKER_PLATFORM', 'linux/amd64'), '-t', sys.argv[1],
|
||||
|
||||
@@ -146,7 +146,6 @@ class Runner:
|
||||
log.append(entry)
|
||||
|
||||
def evidence(self, folder: Path) -> dict:
|
||||
"""What a failed run leaves behind: the screen, gamescope's focus, the session's logs."""
|
||||
found = {}
|
||||
for name, action in (
|
||||
("screenshot", lambda: ctl.screenshot(self.adb, self.serial, str(folder / "failure.png"), None)),
|
||||
|
||||
+1
-18
@@ -24,7 +24,6 @@ from adb_device import DeviceResolutionError, resolve_serial
|
||||
from proot_profile import report as proot_profile_report
|
||||
|
||||
|
||||
# tools/release/variants.txt: the same app also ships as other packages (e.g. com.antutu.benchmark.full).
|
||||
PACKAGE = os.environ.get("DROIDDECK_PACKAGE", "com.droiddeck.launcher")
|
||||
AUTHORITY = f"content://{PACKAGE}.agent"
|
||||
PACKAGE_NAME = re.compile(r"[A-Za-z][A-Za-z0-9_]*(\.[A-Za-z][A-Za-z0-9_]*)+")
|
||||
@@ -115,7 +114,6 @@ def provider_call(adb: str, serial: str, method: str, arg: str | None = None, re
|
||||
|
||||
|
||||
def checked(response: dict, default_code: str) -> dict:
|
||||
"""A provider or guest answer, raised as a ControlError when it carries ok: false."""
|
||||
if response.get("ok") is False:
|
||||
error = response.get("error", {})
|
||||
raise ControlError(error.get("message", default_code), error.get("code", default_code))
|
||||
@@ -166,7 +164,6 @@ def get_state(adb: str, serial: str) -> dict:
|
||||
|
||||
|
||||
def wait_until(adb: str, serial: str, describe: str, done, timeout: float, poll: float = 1.0) -> dict:
|
||||
"""Poll state until done(state) is true. A failed session ends the wait at once."""
|
||||
deadline = time.monotonic() + timeout
|
||||
while True:
|
||||
state = get_state(adb, serial)
|
||||
@@ -203,8 +200,6 @@ def wait_for_phase(adb: str, serial: str, wanted: str, timeout: float) -> dict:
|
||||
|
||||
|
||||
def focused(state: dict, app_id: int | None) -> bool:
|
||||
"""The game has focus the way a player sees it: gamescope focuses it and it is in the list the
|
||||
Steam client orders the base layer from. app_id None means any game (not the client)."""
|
||||
focus = state.get("session", {}).get("focus") or {}
|
||||
current = focus.get("focusedApp")
|
||||
if app_id is None:
|
||||
@@ -232,7 +227,6 @@ def add_serial(response: dict, serial: str) -> dict:
|
||||
|
||||
|
||||
def displays(adb: str, serial: str) -> list[dict]:
|
||||
"""Logical displays with the SurfaceFlinger (physical) id screencap and screenrecord want."""
|
||||
result = run_adb(adb, serial, "shell", "dumpsys", "display", timeout=30)
|
||||
text = result.stdout.decode(errors="replace")
|
||||
devices = dict(re.findall(r'DisplayDeviceInfo\{"([^"]+)": uniqueId="local:(\d+)"', text))
|
||||
@@ -300,14 +294,6 @@ def record(adb: str, serial: str, path: str, seconds: float, display: int | None
|
||||
|
||||
|
||||
def pacing_summary(text: str, package: str = PACKAGE) -> dict:
|
||||
"""What reached the panel, from a `dumpsys SurfaceFlinger --timestats -dump`.
|
||||
|
||||
The game is on the compositor's own layer (droiddeck_wayland_game) when it has one, otherwise on
|
||||
the session's SurfaceView. SurfaceFlinger keeps one record per layer AND refresh rate, so a panel
|
||||
that switches between 60 and 120 Hz mid-capture splits the same layer into several records: they
|
||||
are summed. A game's own fps counter does not show any of this - it counts frames handed over, not
|
||||
frames shown, and 60 handed over can be 48 on screen with one in four held for two refreshes.
|
||||
"""
|
||||
records = {"game": [], "surface": []}
|
||||
for part in re.split(r"^displayRefreshRate = ", text, flags=re.M)[1:]:
|
||||
rate = re.match(r"(\d+)", part)
|
||||
@@ -329,7 +315,6 @@ def pacing_summary(text: str, package: str = PACKAGE) -> dict:
|
||||
for ms, count in bins.items():
|
||||
histogram[ms] = histogram.get(ms, 0) + count
|
||||
if bins:
|
||||
# SurfaceFlinger bins by whole milliseconds, so one cadence spans two buckets (16.7 ms: 16 and 17).
|
||||
mode = max(bins, key=bins.get)
|
||||
off += sum(count for ms, count in bins.items() if abs(ms - mode) > 1)
|
||||
intervals = sum(histogram.values())
|
||||
@@ -346,7 +331,6 @@ def pacing_summary(text: str, package: str = PACKAGE) -> dict:
|
||||
|
||||
|
||||
def pacing(adb: str, serial: str, seconds: float) -> dict:
|
||||
"""Frames on screen and their intervals over `seconds`, from SurfaceFlinger's timestats."""
|
||||
seconds = max(1.0, min(600.0, seconds))
|
||||
timestats = ("shell", "dumpsys", "SurfaceFlinger", "--timestats")
|
||||
try:
|
||||
@@ -487,7 +471,6 @@ def xr_capture(adb: str, serial: str, destination: Path, timeout: float) -> dict
|
||||
except (OSError, EOFError, zlib.error) as error:
|
||||
raise ControlError('Incomplete compressed XR image', 'XR_CAPTURE_FAILED') from error
|
||||
images[eye] = xr_ppm_to_png(pixels, linear=eye == 'source' and metadata.get('sourceColorSpace') == 'linear')
|
||||
# Detect overlapping captures before publishing images with another request's metadata.
|
||||
check = run_adb(adb, serial, 'shell', 'cat', remote + '.json')
|
||||
try:
|
||||
unchanged = json.loads(check.stdout).get('id') == token
|
||||
@@ -961,7 +944,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
args = build_parser().parse_args(argv)
|
||||
serial = None
|
||||
try:
|
||||
if not PACKAGE_NAME.fullmatch(PACKAGE): # it reaches the device shell through `am start` and `content call`
|
||||
if not PACKAGE_NAME.fullmatch(PACKAGE):
|
||||
raise ControlError(f"DROIDDECK_PACKAGE is not an Android package name: {PACKAGE!r}", "INVALID_REQUEST")
|
||||
if args.command == "proot-profile" and args.profile_op == "report":
|
||||
if args.limit < 1:
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
# Runs inside an Arch Linux ARM container (menci/archlinuxarm:base-devel) on an arm64 runner. Arch Linux ARM ships
|
||||
# no FEX package and FEX publishes no Linux binaries.
|
||||
set -euxo pipefail
|
||||
VERSION=${FEX_VERSION:-FEX-2610}
|
||||
WORK=/work
|
||||
@@ -10,7 +8,6 @@ grep -q '^DisableSandbox' /etc/pacman.conf || sed -i 's/^\[options\]/[options]\n
|
||||
mv /etc/pacman.d/mirrorlist.new /etc/pacman.d/mirrorlist
|
||||
pacman -Syu --noconfirm --needed git zstd binutils cmake ninja clang lld llvm python squashfs-tools file patchelf xxhash
|
||||
|
||||
# The x86 sysroot is Arch x86_64 and multilib i686 packages unpacked by pacman, never run: no scriptlets or signature checks.
|
||||
THUNKS=${FEX_THUNKS:-0}
|
||||
X86ROOT=$WORK/x86root
|
||||
if [ "$THUNKS" = 1 ]; then
|
||||
@@ -40,15 +37,12 @@ fi
|
||||
|
||||
rm -rf fex-src out && git clone -q --depth 1 --branch "$VERSION" --recurse-submodules --shallow-submodules https://github.com/FEX-Emu/FEX.git fex-src
|
||||
for p in tools/fex/patches/*.patch; do patch -d fex-src -p1 --no-backup-if-mismatch < "$p"; done
|
||||
# FEX's x86 toolchain files assume an x86 build machine; here the guest thunks need the x86 sysroot too.
|
||||
# Arch's clang adds stack protection; its canary load in a guest thunk's prologue clobbered r11 (the host function).
|
||||
if [ "$THUNKS" = 1 ]; then
|
||||
for t in fex-src/Data/CMake/toolchain_x86_64.cmake fex-src/Data/CMake/toolchain_x86_32.cmake; do
|
||||
printf '\nif (X86_DEV_ROOTFS AND NOT X86_DEV_ROOTFS STREQUAL "/")\n set(CMAKE_SYSROOT "${X86_DEV_ROOTFS}")\nendif()\n' >> "$t"
|
||||
printf '\nset(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-stack-protector")\nset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector")\n' >> "$t"
|
||||
done
|
||||
fi
|
||||
# TUNE_CPU none: the default (native) would tune for the runner's Neoverse cores, not the device.
|
||||
cmake -S fex-src -B fex-build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DUSE_LINKER=lld \
|
||||
@@ -60,8 +54,6 @@ cmake -S fex-src -B fex-build -G Ninja \
|
||||
ninja -C fex-build
|
||||
DESTDIR="$WORK/out" ninja -C fex-build install
|
||||
install -Dm755 /usr/bin/unsquashfs out/usr/local/bin/unsquashfs
|
||||
# The Linux runtime has no xxhash and no ld.so.cache: the library goes beside libFEXCore and the programs
|
||||
# that need it find it through RUNPATH.
|
||||
install -Dm644 "$(readlink -f /usr/lib/libxxhash.so.0)" out/usr/local/lib/libxxhash.so.0
|
||||
bundled=$(cd out/usr/local/lib && ls -- *.so* | sort -u)
|
||||
for f in out/usr/local/bin/*; do
|
||||
@@ -70,7 +62,6 @@ for f in out/usr/local/bin/*; do
|
||||
readelf -d "$f" | awk '/NEEDED/ { gsub(/[\[\]]/, "", $5); print $5 }' | grep -qxF "$bundled" \
|
||||
&& patchelf --set-rpath '$ORIGIN/../lib' "$f"
|
||||
done
|
||||
# Every NEEDED soname must resolve in a stock guest: bundled here or provided by the runtime (runtime-libs.txt).
|
||||
for f in out/usr/local/bin/* out/usr/local/lib/*.so* out/usr/local/lib/fex-emu/HostThunks*/*.so; do
|
||||
[ -f "$f" ] && file "$f" | grep -q ELF || continue
|
||||
readelf -d "$f" | awk '/NEEDED/ { gsub(/[\[\]]/, "", $5); print $5 }'
|
||||
|
||||
@@ -10,7 +10,7 @@ index 7172460..2c80dca 100644
|
||||
#include <linux/openat2.h>
|
||||
#include <fcntl.h>
|
||||
#include <filesystem>
|
||||
@@ -632,6 +633,163 @@ static bool ShouldSkipOpenInEmu(int flags) {
|
||||
@@ -632,6 +633,157 @@ static bool ShouldSkipOpenInEmu(int flags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,19 +26,15 @@ index 7172460..2c80dca 100644
|
||||
+ return Result;
|
||||
+}
|
||||
+
|
||||
+// openat2() with RESOLVE_IN_ROOT, walked one component at a time: PRoot has no openat2 and fails it with ENOSYS.
|
||||
+// DirFD is AT_FDCWD only for thunk overlays, which never resolve in the root.
|
||||
+static int OpenatWithoutOpenat2(int DirFD, const char* Pathname, int Flags, uint32_t Mode) {
|
||||
+ if (DirFD == AT_FDCWD) {
|
||||
+ return ::syscall(SYSCALL_DEF(openat), DirFD, Pathname, Flags, Mode);
|
||||
+ }
|
||||
+
|
||||
+ // The kernel's MAXSYMLINKS.
|
||||
+ constexpr uint32_t MaxSymlinks = 40;
|
||||
+ uint32_t Symlinks {};
|
||||
+ std::optional<dev_t> RootDev {};
|
||||
+
|
||||
+ // O_NOFOLLOW and O_CREAT | O_EXCL leave a final symlink alone, unless a trailing slash follows it.
|
||||
+ const bool NoFollow = (Flags & O_NOFOLLOW) || (Flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL);
|
||||
+
|
||||
+ char Resolved[PATH_MAX];
|
||||
@@ -116,7 +112,6 @@ index 7172460..2c80dca 100644
|
||||
+ }
|
||||
+
|
||||
+ if (Buffer.st_dev != *RootDev && IsOnProcFS(DirFD, Resolved)) {
|
||||
+ // Only procfs has magic links. RESOLVE_IN_ROOT fails them with EXDEV and the callers then open without it.
|
||||
+ return ::syscall(SYSCALL_DEF(openat), DirFD, Pathname, Flags, Mode);
|
||||
+ }
|
||||
+
|
||||
@@ -145,7 +140,6 @@ index 7172460..2c80dca 100644
|
||||
+ }
|
||||
+
|
||||
+ if (Last) {
|
||||
+ // openat reports on the final component, which O_CREAT may create.
|
||||
+ ResolvedLen = CandidateLen;
|
||||
+ if (TrailingSlash) {
|
||||
+ Resolved[ResolvedLen++] = '/';
|
||||
@@ -174,7 +168,7 @@ index 7172460..2c80dca 100644
|
||||
bool FileManager::ReplaceEmuFd(int fd, int flags, uint32_t mode) {
|
||||
char Tmp[PATH_MAX + 1];
|
||||
|
||||
@@ -678,6 +836,8 @@ uint64_t FileManager::Open(const char* pathname, int flags, uint32_t mode) {
|
||||
@@ -678,6 +830,8 @@ uint64_t FileManager::Open(const char* pathname, int flags, uint32_t mode) {
|
||||
// This means a magic symlink (/proc/foo) was involved. In this case we
|
||||
// just punt and do the access without RESOLVE_IN_ROOT.
|
||||
fd = ::syscall(SYSCALL_DEF(openat), Path.FD, Path.Path, flags, mode);
|
||||
@@ -183,7 +177,7 @@ index 7172460..2c80dca 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -931,6 +1091,8 @@ uint64_t FileManager::Openat([[maybe_unused]] int dirfs, const char* pathname, i
|
||||
@@ -931,6 +1085,8 @@ uint64_t FileManager::Openat([[maybe_unused]] int dirfs, const char* pathname, i
|
||||
// This means a magic symlink (/proc/foo) was involved. In this case we
|
||||
// just punt and do the access without RESOLVE_IN_ROOT.
|
||||
fd = ::syscall(SYSCALL_DEF(openat), Path.FD, Path.Path, flags, mode);
|
||||
@@ -192,7 +186,7 @@ index 7172460..2c80dca 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,6 +1129,8 @@ uint64_t FileManager::Openat2(int dirfs, const char* pathname, FEX::HLE::open_ho
|
||||
@@ -967,6 +1123,8 @@ uint64_t FileManager::Openat2(int dirfs, const char* pathname, FEX::HLE::open_ho
|
||||
// This means a magic symlink (/proc/foo) was involved. In this case we
|
||||
// just punt and do the access without RESOLVE_IN_ROOT.
|
||||
fd = ::syscall(SYSCALL_DEF(openat2), Path.FD, Path.Path, how, usize);
|
||||
|
||||
@@ -26,11 +26,10 @@ index 60b0ef1..4a94009 100644
|
||||
using FindHandler = uint64_t (MemAllocator32Bit::*)(uint64_t Start, size_t Pages) const;
|
||||
FindHandler FindPageRangePtr {};
|
||||
};
|
||||
@@ -132,6 +135,37 @@ uint64_t MemAllocator32Bit::FindPageRange_TopDown(uint64_t Start, size_t Pages)
|
||||
@@ -132,6 +135,36 @@ uint64_t MemAllocator32Bit::FindPageRange_TopDown(uint64_t Start, size_t Pages)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+// Marks each run of host mappings that overlaps the range as used, in full. Returns false if none overlaps.
|
||||
+bool MemAllocator32Bit::SetHostMappedPages(uint64_t PageAddr, size_t PagesLength) {
|
||||
+ const int MapsFD = ::open("/proc/self/maps", O_RDONLY | O_CLOEXEC);
|
||||
+ if (MapsFD == -1) {
|
||||
@@ -64,7 +63,7 @@ index 60b0ef1..4a94009 100644
|
||||
void* MemAllocator32Bit::Mmap(void* addr, size_t length, int prot, int flags, int fd, off_t offset) {
|
||||
std::scoped_lock<std::mutex> lk {AllocMutex};
|
||||
size_t PagesLength = FEXCore::AlignUp(length, FEXCore::Utils::FEX_PAGE_SIZE) >> FEXCore::Utils::FEX_PAGE_SHIFT;
|
||||
@@ -175,11 +209,17 @@ void* MemAllocator32Bit::Mmap(void* addr, size_t length, int prot, int flags, in
|
||||
@@ -175,11 +208,16 @@ void* MemAllocator32Bit::Mmap(void* addr, size_t length, int prot, int flags, in
|
||||
|
||||
auto AllocateNoHint = [&]() -> void* {
|
||||
bool Wrapped = false;
|
||||
@@ -74,7 +73,6 @@ index 60b0ef1..4a94009 100644
|
||||
// Linear range scan
|
||||
uint64_t LowerPage = (this->*FindPageRangePtr)(BottomPage, PagesLength);
|
||||
if (LowerPage == 0) {
|
||||
+ // A second scan from the start found nothing either: the range is full, as the kernel would say.
|
||||
+ if (Restarted) {
|
||||
+ return reinterpret_cast<void*>(-ENOMEM);
|
||||
+ }
|
||||
@@ -82,15 +80,12 @@ index 60b0ef1..4a94009 100644
|
||||
// Try again but this time from the start
|
||||
BottomPage = Map32Bit ? LastKeyLocation32Bit : LastKeyLocation;
|
||||
LowerPage = (this->*FindPageRangePtr)(BottomPage, PagesLength);
|
||||
@@ -206,7 +246,17 @@ restart: {
|
||||
@@ -206,7 +244,14 @@ restart: {
|
||||
return (void*)(uintptr_t)-errno;
|
||||
} else {
|
||||
// Try again
|
||||
- if (SearchDown) {
|
||||
+ if (Map32Bit) {
|
||||
+ // MAP_32BIT from a 64-bit guest, whose other mappings bypass this allocator: once Counter-Strike 2 had reserved the
|
||||
+ // low 2GB, stepping one page at a time scanned for ever. Record what the host holds there and rescan the range, or
|
||||
+ // move past it if that mapping is gone.
|
||||
+ const bool Marked = SetHostMappedPages(LowerPage, PagesLength);
|
||||
+ if (SearchDown) {
|
||||
+ BottomPage = Marked ? UpperPage - 1 : LowerPage - 1;
|
||||
|
||||
@@ -49,7 +49,6 @@ tar --use-compress-program=unzstd -xf "$PKG" -C out --strip-components=2 usr/bin
|
||||
mv out/gamescope out/usr/local/bin/gamescope
|
||||
chmod 755 out/usr/local/bin/gamescope
|
||||
strip --strip-unneeded out/usr/local/bin/gamescope || true
|
||||
# The WSI layer carries patches too (0117); the runtime's stock copy is replaced.
|
||||
mkdir -p out/usr/lib
|
||||
tar --use-compress-program=unzstd -xf "$PKG" -C out usr/lib/libVkLayer_FROG_gamescope_wsi_aarch64.so
|
||||
strip --strip-unneeded out/usr/lib/libVkLayer_FROG_gamescope_wsi_aarch64.so || true
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
--- a/src/wlserver.cpp
|
||||
+++ b/src/wlserver.cpp
|
||||
@@ -203,6 +203,12 @@
|
||||
@@ -203,6 +203,9 @@
|
||||
}
|
||||
|
||||
void xwayland_surface_commit(struct wlr_surface *wlr_surface) {
|
||||
+ // Cursor surfaces never acquire an X11/xdg window association. Keeping their
|
||||
+ // commits in g_PendingCommits pins every old SHM buffer until the cursor
|
||||
+ // surface is destroyed. X11 cursor images are handled by MouseCursor.
|
||||
+ if ( wlr_surface->role && strcmp( wlr_surface->role->name, "wl_pointer-cursor" ) == 0 )
|
||||
+ return;
|
||||
+
|
||||
|
||||
@@ -9,12 +9,10 @@
|
||||
#include <sys/stat.h>
|
||||
// For limiter file.
|
||||
#include <time.h>
|
||||
@@ -476,6 +478,34 @@
|
||||
@@ -476,6 +478,32 @@
|
||||
// Cached for comparison.
|
||||
std::optional<VkRect2D> cachedWindowRect;
|
||||
|
||||
+ // canBypassXWayland costs several X round trips; at present time it is refreshed at most
|
||||
+ // every DROIDDECK_WSI_BYPASS_CHECK_MS (default 0 = every present; DroidDeck's Performance mode sets 100).
|
||||
+ std::optional<bool> presentBypass;
|
||||
+ bool presentBypassHdr = false;
|
||||
+ uint64_t presentBypassNs = 0;
|
||||
@@ -44,7 +42,7 @@
|
||||
bool isWayland() const {
|
||||
// Is native Wayland?
|
||||
return connection == nullptr;
|
||||
@@ -1597,7 +1627,7 @@
|
||||
@@ -1597,7 +1625,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,10 @@ diff --git a/layer/VkLayer_FROG_gamescope_wsi.cpp b/layer/VkLayer_FROG_gamescope
|
||||
index ea4ba84..46d086c 100644
|
||||
--- a/layer/VkLayer_FROG_gamescope_wsi.cpp
|
||||
+++ b/layer/VkLayer_FROG_gamescope_wsi.cpp
|
||||
@@ -201,6 +201,13 @@ namespace GamescopeWSILayer {
|
||||
@@ -201,6 +201,10 @@ namespace GamescopeWSILayer {
|
||||
return s_minImageCount;
|
||||
}
|
||||
|
||||
+ // The raised count keeps an uncapped game drawing while gamescope turns its buffers around.
|
||||
+ // Under the frame limiter's FIFO the extra images only queue frames ahead of the screen,
|
||||
+ // so a limited swapchain gets the default count.
|
||||
+ static uint32_t getMinImageCount(bool forcingFifo) {
|
||||
+ return forcingFifo ? std::min(getMinImageCount(), 3u) : getMinImageCount();
|
||||
+ }
|
||||
@@ -16,7 +13,7 @@ index ea4ba84..46d086c 100644
|
||||
static bool getEnsureMinImageCount() {
|
||||
static bool s_ensureMinImageCount = []() -> bool {
|
||||
if (auto ensure = parseEnv<bool>("GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT")) {
|
||||
@@ -984,7 +991,7 @@ namespace GamescopeWSILayer {
|
||||
@@ -984,7 +988,7 @@ namespace GamescopeWSILayer {
|
||||
|
||||
pSurfaceCapabilities->currentExtent = rect->extent;
|
||||
}
|
||||
@@ -25,7 +22,7 @@ index ea4ba84..46d086c 100644
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@@ -1027,7 +1034,7 @@ namespace GamescopeWSILayer {
|
||||
@@ -1027,7 +1031,7 @@ namespace GamescopeWSILayer {
|
||||
|
||||
pSurfaceCapabilities->surfaceCapabilities.currentExtent = rect->extent;
|
||||
}
|
||||
@@ -34,7 +31,7 @@ index ea4ba84..46d086c 100644
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@@ -1305,7 +1312,7 @@ namespace GamescopeWSILayer {
|
||||
@@ -1305,7 +1309,7 @@ namespace GamescopeWSILayer {
|
||||
|
||||
uint32_t minImageCount = swapchainInfo.minImageCount;
|
||||
if (getEnsureMinImageCount())
|
||||
@@ -43,12 +40,10 @@ index ea4ba84..46d086c 100644
|
||||
swapchainInfo.minImageCount = minImageCount;
|
||||
|
||||
fprintf(stderr, "[Gamescope WSI] Creating swapchain for xid: 0x%0x - oldSwapchain: %p - provided minImageCount: %u - minImageCount: %u - format: %s - colorspace: %s - flip: %s\n",
|
||||
@@ -1627,6 +1634,13 @@ namespace GamescopeWSILayer {
|
||||
@@ -1627,6 +1631,11 @@ namespace GamescopeWSILayer {
|
||||
continue;
|
||||
}
|
||||
|
||||
+ // Other apps keep their swapchain when the limiter changes; ask them to recreate it so
|
||||
+ // the image count follows the limiter as well.
|
||||
+ if (!frameLimiterAware && gamescopeSwapchain->forceFifo != forceFifo &&
|
||||
+ getMinImageCount(true) != getMinImageCount(false) &&
|
||||
+ !(gamescopeSurface->flags & GamescopeLayerClient::Flag::NoSuboptimal))
|
||||
|
||||
@@ -2,13 +2,10 @@ diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp
|
||||
index 40164ba..1b85e63 100644
|
||||
--- a/src/Backends/WaylandBackend.cpp
|
||||
+++ b/src/Backends/WaylandBackend.cpp
|
||||
@@ -1698,6 +1698,52 @@ namespace gamescope
|
||||
@@ -1698,6 +1698,46 @@ namespace gamescope
|
||||
}
|
||||
}
|
||||
|
||||
+ // -r sets the refresh gamescope starts with. With GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST=1 a refresh
|
||||
+ // the host compositor reports later replaces it, so pacing and the frame limiter follow a panel
|
||||
+ // switched to another mode during the session.
|
||||
+ static bool NestedRefreshFollowsHost()
|
||||
+ {
|
||||
+ static const bool s_bFollow = []
|
||||
@@ -19,9 +16,6 @@ index 40164ba..1b85e63 100644
|
||||
+ return s_bFollow;
|
||||
+ }
|
||||
+
|
||||
+ // A mode switch on the host can report a passing rate for a few frames (72 Hz between 144 and
|
||||
+ // 120 on an AYANEO Pocket FIT); a new rate is taken once it has been reported for 300 ms.
|
||||
+ // Until then gamescope keeps presenting, so a still screen also gets the feedback that takes it.
|
||||
+ static bool HostRefreshChanged( int32_t nRefreshmHz, uint64_t ulPresentedNs )
|
||||
+ {
|
||||
+ static int32_t s_nPendingmHz = 0;
|
||||
@@ -55,7 +49,7 @@ index 40164ba..1b85e63 100644
|
||||
void CWaylandPlane::UpdateVRRRefreshRate()
|
||||
{
|
||||
if ( m_pParent )
|
||||
@@ -1724,6 +1770,7 @@ namespace gamescope
|
||||
@@ -1724,6 +1764,7 @@ namespace gamescope
|
||||
// TODO(strategy): We should pick the largest refresh rate.
|
||||
xdg_log.infof( "Changed refresh to: %.3fhz", ConvertmHzToHz( (float) nLargestRefreshRateMhz ) );
|
||||
g_nOutputRefresh = nLargestRefreshRateMhz;
|
||||
@@ -63,7 +57,7 @@ index 40164ba..1b85e63 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1794,10 +1841,11 @@ namespace gamescope
|
||||
@@ -1794,10 +1835,11 @@ namespace gamescope
|
||||
if ( uRefreshCycle )
|
||||
{
|
||||
int32_t nRefresh = RefreshCycleTomHz( uRefreshCycle );
|
||||
@@ -76,11 +70,10 @@ index 40164ba..1b85e63 100644
|
||||
}
|
||||
|
||||
m_pConnector->SetHostCompositorIsCurrentlyVRR( false );
|
||||
@@ -2636,6 +2684,9 @@ namespace gamescope
|
||||
@@ -2636,6 +2678,8 @@ namespace gamescope
|
||||
}
|
||||
void CWaylandBackend::Wayland_Output_Mode( wl_output *pOutput, uint32_t uFlags, int32_t nWidth, int32_t nHeight, int32_t nRefresh )
|
||||
{
|
||||
+ // The followed rate comes from presentation feedback, so a still screen presents once for it.
|
||||
+ if ( NestedRefreshFollowsHost() && m_pOutputs[ pOutput ].nRefresh != nRefresh )
|
||||
+ force_repaint();
|
||||
m_pOutputs[ pOutput ].nRefresh = nRefresh;
|
||||
@@ -90,12 +83,11 @@ diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
|
||||
index 6c9299d..5fb9086 100644
|
||||
--- a/src/steamcompmgr.cpp
|
||||
+++ b/src/steamcompmgr.cpp
|
||||
@@ -9254,6 +9254,15 @@ void update_vrr_atoms(xwayland_ctx_t *root_ctx, bool force, bool* needs_flush =
|
||||
@@ -9254,6 +9254,14 @@ void update_vrr_atoms(xwayland_ctx_t *root_ctx, bool force, bool* needs_flush =
|
||||
g_nCurrentRefreshRate_CachedValue = g_nOutputRefresh;
|
||||
if (needs_flush)
|
||||
*needs_flush = true;
|
||||
+
|
||||
+ // Steam reads the display's refresh rates from gamescope_control when it binds; send them again.
|
||||
+ if ( !force )
|
||||
+ {
|
||||
+ wlserver_lock();
|
||||
|
||||
@@ -11,12 +11,10 @@ index 9a027a2..e6d8e31 100644
|
||||
};
|
||||
|
||||
std::mutex g_wlserver_xdg_shell_windows_lock;
|
||||
@@ -800,6 +802,20 @@ static void gamescope_swapchain_destroy_co( struct wl_resource *resource );
|
||||
@@ -800,6 +802,18 @@ static void gamescope_swapchain_destroy_co( struct wl_resource *resource );
|
||||
|
||||
void gamescope_xwayland_server_t::handle_override_window_content( struct wl_client *client, struct wl_resource *gamescope_swapchain_resource, struct wlr_surface *surface, uint32_t x11_window )
|
||||
{
|
||||
+ // The WSI layer sends this on every present. Finding the top level walks the X tree with a
|
||||
+ // round trip per level, so a swapchain repeating the same window skips it for 100 ms.
|
||||
+ const uint64_t ulNow = get_time_in_nanos();
|
||||
+ if ( gamescope_swapchain_resource )
|
||||
+ {
|
||||
@@ -32,7 +30,7 @@ index 9a027a2..e6d8e31 100644
|
||||
x11_window = x11_find_toplevel_for_xid( this->ctx->dpy, x11_window );
|
||||
|
||||
wlserver_x11_surface_info *x11_surface = lookup_x11_surface_info_from_xid( this, x11_window );
|
||||
@@ -813,7 +829,11 @@ void gamescope_xwayland_server_t::handle_override_window_content( struct wl_clie
|
||||
@@ -813,7 +827,11 @@ void gamescope_xwayland_server_t::handle_override_window_content( struct wl_clie
|
||||
|
||||
if ( content_overrides.count( x11_window ) ) {
|
||||
if ( content_overrides[x11_window]->gamescope_swapchain == gamescope_swapchain_resource )
|
||||
@@ -44,7 +42,7 @@ index 9a027a2..e6d8e31 100644
|
||||
#ifdef GAMESCOPE_SWAPCHAIN_DEBUG
|
||||
wl_log.infof( "handle_override_window_content: (2) DESTROYING x11_window: 0x%x old_swapchain: %p new_swapchain: %p", x11_window, content_overrides[x11_window]->gamescope_swapchain, gamescope_swapchain_resource );
|
||||
#endif
|
||||
@@ -830,6 +850,8 @@ void gamescope_xwayland_server_t::handle_override_window_content( struct wl_clie
|
||||
@@ -830,6 +848,8 @@ void gamescope_xwayland_server_t::handle_override_window_content( struct wl_clie
|
||||
co->surface = surface;
|
||||
co->x11_window = x11_window;
|
||||
co->gamescope_swapchain = gamescope_swapchain_resource;
|
||||
|
||||
@@ -2,12 +2,11 @@ diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp
|
||||
index 1b85e63..370661d 100644
|
||||
--- a/src/Backends/WaylandBackend.cpp
|
||||
+++ b/src/Backends/WaylandBackend.cpp
|
||||
@@ -2977,6 +2977,9 @@ namespace gamescope
|
||||
@@ -2977,6 +2977,8 @@ namespace gamescope
|
||||
LogDisplayError( "Failed to read events on input thread", m_pBackend->GetDisplay() );
|
||||
abort();
|
||||
}
|
||||
+
|
||||
+ // Reading also queues releases and presentation feedback for steamcompmgr.
|
||||
+ nudge_steamcompmgr();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,12 +36,11 @@ index 22aa907..0aef598 100644
|
||||
void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, steamcompmgr_win_t *w, ResListEntry_t& reslistentry)
|
||||
{
|
||||
struct wlr_buffer *buf = reslistentry.buf;
|
||||
@@ -8602,7 +8629,11 @@ void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, st
|
||||
@@ -8602,7 +8629,10 @@ void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, st
|
||||
struct wlr_dmabuf_attributes dmabuf = {0};
|
||||
if ( wlr_buffer_get_dmabuf( buf, &dmabuf ) )
|
||||
{
|
||||
- fence = dup( dmabuf.fd[0] );
|
||||
+ // A finished buffer needs no fence of its own.
|
||||
+ if ( cv_commit_ready_check && commit_fence_ready_now( dmabuf.fd[0] ) )
|
||||
+ bKnownReady = true;
|
||||
+ else
|
||||
@@ -49,7 +48,7 @@ index 22aa907..0aef598 100644
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -8610,11 +8641,22 @@ void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, st
|
||||
@@ -8610,11 +8640,22 @@ void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, st
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,12 +71,11 @@ index 22aa907..0aef598 100644
|
||||
else
|
||||
g_ImageWaiter.AddWaitable( newCommit.get() );
|
||||
}
|
||||
@@ -9400,6 +9442,13 @@ void steamcompmgr_check_xdg(bool vblank, uint64_t vblank_idx)
|
||||
@@ -9400,6 +9441,12 @@ void steamcompmgr_check_xdg(bool vblank, uint64_t vblank_idx)
|
||||
}
|
||||
|
||||
check_new_xdg_res();
|
||||
+
|
||||
+ // Commits marked done at import: handle them now rather than on the next wake. FIFO commits still wait for a vblank.
|
||||
+ if ( s_bXdgCommitsDoneAtImport )
|
||||
+ {
|
||||
+ s_bXdgCommitsDoneAtImport = false;
|
||||
@@ -86,12 +84,11 @@ index 22aa907..0aef598 100644
|
||||
}
|
||||
|
||||
void update_edid_prop()
|
||||
@@ -10512,6 +10561,14 @@ steamcompmgr_main(int argc, char **argv)
|
||||
@@ -10512,6 +10559,13 @@ steamcompmgr_main(int argc, char **argv)
|
||||
gamescope_xwayland_server_t *server = NULL;
|
||||
for (size_t i = 0; (server = wlserver_get_xwayland_server(i)); i++)
|
||||
check_new_xwayland_res(server->ctx.get());
|
||||
+
|
||||
+ // Commits marked done at import: handle them now rather than on the next wake. FIFO commits still wait for a vblank.
|
||||
+ if ( s_bXwaylandCommitsDoneAtImport )
|
||||
+ {
|
||||
+ s_bXwaylandCommitsDoneAtImport = false;
|
||||
|
||||
@@ -69,11 +69,10 @@ index 0aef598..1473148 100644
|
||||
gamescope::ConVar<bool> cv_commit_ready_check( "commit_ready_check", true, "Check a new commit's fence at import; a finished frame is marked done in the same pass instead of through the image waiter." );
|
||||
|
||||
// Set when update_wayland_res marks a commit done itself, so the main loop handles it in the same pass.
|
||||
@@ -8519,6 +8522,16 @@ void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, st
|
||||
@@ -8519,6 +8522,15 @@ void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, st
|
||||
uMangoMsgType = pMangoFocus->externalOverlayWindow->uMangoappMsgType;
|
||||
}
|
||||
|
||||
+ // The commits the typed stream of connector 0 counts, whether or not a mangoapp runs.
|
||||
+ bool bDroidDeckHudFrame = false;
|
||||
+ if ( pUpscaleFocus && !w->isSteamStreamingClient )
|
||||
+ bDroidDeckHudFrame = pUpscaleFocus->ulVirtualFocusKey == 0;
|
||||
@@ -86,7 +85,7 @@ index 0aef598..1473148 100644
|
||||
bool bValidPreemptiveScale = reslistentry.pAcquirePoint && pUpscaleFocus && cv_upscale_preemptive;
|
||||
bool bPreemptiveUpscale = bValidPreemptiveScale && newCommit->ShouldPreemptivelyUpscale( pUpscaleFocus->eUpscaleFilter, pUpscaleFocus->eUpscaleScaler );
|
||||
|
||||
@@ -8650,7 +8663,7 @@ void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, st
|
||||
@@ -8650,7 +8662,7 @@ void update_wayland_res(const std::shared_ptr<CommitDoneList_t> &doneCommits, st
|
||||
|
||||
gpuvis_trace_printf( "pushing wait for commit %lu win %lx", newCommit->commitID, w->type == steamcompmgr_win_type_t::XWAYLAND ? w->xwayland().id : 0 );
|
||||
{
|
||||
@@ -95,18 +94,10 @@ index 0aef598..1473148 100644
|
||||
if ( bKnownReady )
|
||||
{
|
||||
newCommit->Signal();
|
||||
@@ -9865,6 +9878,109 @@ static void publish_mangoapp_connector_snapshots()
|
||||
@@ -9865,6 +9877,100 @@ static void publish_mangoapp_connector_snapshots()
|
||||
}
|
||||
}
|
||||
|
||||
+// DroidDeck's own HUD reads the frame times DroidDeck's mangoapp shows from a shared file named by
|
||||
+// DROIDDECK_HUD_FRAMES, also while no mangoapp runs. That mangoapp (Valve's 20260902.1 build) reads the
|
||||
+// field at byte 16 of each message as its frame time, which is app_frametime_ns here: one time per
|
||||
+// signalled commit of the connector's windows (mangoapp_nudge_app_frame). The file gets the same commits
|
||||
+// of connector 0. Little-endian: 0 magic, 4 version, 8 capacity, 12 pid, 16 frames written (u64),
|
||||
+// 24 info sequence (odd while the info is written), 28 output width, 32 height, 36 refresh mHz, 40 Steam
|
||||
+// focused, 44 engine (40 bytes), then from 128 one { frametime ns, monotonic time ns } pair per frame,
|
||||
+// a ring of capacity.
|
||||
+static constexpr uint32_t k_uDroidDeckHudFramesMagic = 0x46484444;
|
||||
+static constexpr uint32_t k_uDroidDeckHudFramesVersion = 1;
|
||||
+static constexpr uint32_t k_uDroidDeckHudFramesCapacity = 1024;
|
||||
@@ -157,7 +148,6 @@ index 0aef598..1473148 100644
|
||||
+ return droiddeck_hud_frames_map() != nullptr;
|
||||
+}
|
||||
+
|
||||
+// Signal() runs on the image waiter thread or, for a frame finished at import, on steamcompmgr's.
|
||||
+void droiddeck_hud_app_frame( uint64_t ulNow )
|
||||
+{
|
||||
+ std::unique_lock lock( s_DroidDeckHudFramesMutex );
|
||||
@@ -205,7 +195,7 @@ index 0aef598..1473148 100644
|
||||
// mangohudctl posts one control message for every instance to act on.
|
||||
static void relay_mangoapp_control()
|
||||
{
|
||||
@@ -10843,6 +10959,7 @@ steamcompmgr_main(int argc, char **argv)
|
||||
@@ -10843,6 +10949,7 @@ steamcompmgr_main(int argc, char **argv)
|
||||
|
||||
publish_mangoapp_snapshot();
|
||||
publish_mangoapp_connector_snapshots();
|
||||
|
||||
@@ -19,7 +19,6 @@ def enabled():
|
||||
|
||||
|
||||
def main_group(text):
|
||||
"""The [Desktop Entry] group's lines, and everything after it."""
|
||||
lines = text.splitlines()
|
||||
start = next((i for i, l in enumerate(lines) if l.strip() == "[Desktop Entry]"), None)
|
||||
if start is None:
|
||||
@@ -56,8 +55,6 @@ def chromium_exec(exec_line):
|
||||
|
||||
|
||||
def gpu_exec(exec_line):
|
||||
"""The Exec that runs a program on the GPU; a Flatpak app goes through its launcher, which
|
||||
keeps it on gamescope's X server instead of the desktop's Wayland socket."""
|
||||
if exec_line.startswith("/usr/bin/flatpak run ") or exec_line.startswith("flatpak run "):
|
||||
exec_line = "/usr/local/bin/droiddeck-flatpak-run " + exec_line.split(" run ", 1)[1]
|
||||
return "droiddeck-gpu " + exec_line
|
||||
|
||||
@@ -19,7 +19,6 @@ typedef struct {
|
||||
typedef VkResult (*Enumerate)(const char *, unsigned int *, VkExtensionProperties *);
|
||||
typedef Function (*ProcAddr)(void *, const char *);
|
||||
|
||||
/* The driver cannot enumerate devices for an instance with VK_KHR_display, and gamescope's WSI layer aborts on that. */
|
||||
static const char *const hidden_extensions[] = {
|
||||
"VK_KHR_display",
|
||||
"VK_KHR_get_display_properties2",
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
#!/bin/sh
|
||||
# Runs DroidDeck's bundled innoextract with its own boost libraries. The guest's
|
||||
# env -i startup has no LD_LIBRARY_PATH, and the rootfs must not grow a second
|
||||
# copy of boost for the installer fallback.
|
||||
LD_LIBRARY_PATH=/usr/local/lib/droiddeck-inno
|
||||
export LD_LIBRARY_PATH
|
||||
exec /usr/local/lib/droiddeck-inno/innoextract "$@"
|
||||
@@ -1,22 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""The guest side of the agent bridge (docs/agent-control.md).
|
||||
|
||||
Started by droiddeck-session inside the session, so whatever it runs has the session's own
|
||||
environment: DISPLAY, the games' Xwayland, XDG_RUNTIME_DIR, and the preloads every guest process
|
||||
gets - which is what lets it reach the Steam client's DevTools port, open to guest processes only.
|
||||
|
||||
The app talks to it through files under $BL_LAUNCH_DIR/agent (the session root, the same path on
|
||||
both sides):
|
||||
|
||||
req/<id>.json a request the app wrote (tmp + rename)
|
||||
resp/<id>.json the answer, written the same way
|
||||
hello.json this daemon is up: pid, version, what it can do
|
||||
focus.json gamescope's focus and every server's top-level windows, rewritten on change
|
||||
cdp-port the client's DevTools port, written by droiddeck-session
|
||||
|
||||
Requests: ping, exec, focus, cdp, quit. Each answer is {"ok": true, ...} or
|
||||
{"ok": false, "error": {"code", "message"}}.
|
||||
"""
|
||||
|
||||
import base64
|
||||
import json
|
||||
@@ -72,7 +54,6 @@ class AgentError(Exception):
|
||||
|
||||
|
||||
class X:
|
||||
"""One connection to an Xwayland server. The rootfs has xprop but no python X library."""
|
||||
|
||||
def __init__(self, display):
|
||||
num = display.lstrip(":").split(".")[0]
|
||||
@@ -116,7 +97,6 @@ class X:
|
||||
return buf
|
||||
|
||||
def request(self, data):
|
||||
"""Send one request and return its reply, or None for an X error (a window that went)."""
|
||||
self.s.sendall(data)
|
||||
while True:
|
||||
head = self._read(32)
|
||||
@@ -186,7 +166,6 @@ class X:
|
||||
|
||||
|
||||
def windows(x):
|
||||
"""Top-level windows that are mapped or carry an app id: what gamescope picks focus from."""
|
||||
out = []
|
||||
for win in x.children(x.root):
|
||||
attrs = x.attributes(win)
|
||||
@@ -230,9 +209,6 @@ def displays():
|
||||
|
||||
|
||||
def focus_snapshot():
|
||||
"""gamescope's focus as Steam sees it (root properties on the client's server) and every
|
||||
server's windows. GAMESCOPE_FOCUSABLE_WINDOWS is the list the client orders the base layer
|
||||
from: a game missing there stays behind the client however healthy its window looks."""
|
||||
shown = displays()
|
||||
if not shown:
|
||||
raise AgentError("NO_DISPLAY", "This session has no X display")
|
||||
@@ -349,7 +325,6 @@ def tag_game_windows(snap, proc=Path("/proc")):
|
||||
|
||||
|
||||
def vr_scene_app(path=Path('/run/droiddeck/droiddeck-steamvr/scene-focus.json'), proc=Path('/proc')):
|
||||
"""Only a live SteamVR scene with its dashboard hidden may claim game focus."""
|
||||
try:
|
||||
state = json.loads(path.read_text())
|
||||
server, scene = int(state['serverPid']), int(state['scenePid'])
|
||||
@@ -385,8 +360,6 @@ class VrSceneFocus:
|
||||
|
||||
|
||||
class FocusWatcher(threading.Thread):
|
||||
"""Rewrites focus.json when gamescope's focus properties change, and every few seconds when
|
||||
the windows do (a window can change without any root property moving)."""
|
||||
|
||||
def __init__(self, path):
|
||||
super().__init__(daemon=True, name="focus")
|
||||
@@ -450,7 +423,6 @@ class FocusWatcher(threading.Thread):
|
||||
|
||||
|
||||
class WebSocket:
|
||||
"""A minimal RFC 6455 client: text frames out, text frames in. Enough for CDP."""
|
||||
|
||||
def __init__(self, url, timeout):
|
||||
target = urllib.parse.urlsplit(url)
|
||||
@@ -887,11 +859,6 @@ def steam_selection(agent_dir, timeout=5):
|
||||
|
||||
|
||||
def steam_shortcut_app_id(game_id):
|
||||
"""Return the 32-bit app id in Steam's shortcut CGameID form, or None for other ids.
|
||||
|
||||
DroidDeck's shortcut IDs are `(appid << 32) | 0x02000000`. The URL still needs that full
|
||||
CGameID for RunGame; the app-details API separately needs the unsigned 32-bit app id.
|
||||
"""
|
||||
if not isinstance(game_id, str) or not game_id.isascii() or not game_id.isdigit():
|
||||
return None
|
||||
try:
|
||||
@@ -907,7 +874,6 @@ def steam_shortcut_app_id(game_id):
|
||||
|
||||
|
||||
def wait_for_steam_shortcut_overview(agent_dir, game_id, timeout=45):
|
||||
"""Wait until Steam can map a shortcut CGameID to its 32-bit app overview."""
|
||||
app_id = steam_shortcut_app_id(game_id)
|
||||
if app_id is None:
|
||||
return {"supported": False, "ready": False}
|
||||
@@ -962,8 +928,6 @@ def steam_shortcut_state(agent_dir, game_id, timeout=6):
|
||||
|
||||
|
||||
def game_pids(app_id):
|
||||
"""Our processes started for this Steam app (Steam sets SteamAppId / SteamGameId in their
|
||||
environment, and Proton's wine processes inherit it)."""
|
||||
wanted = [("SteamAppId=%s" % app_id).encode(), ("SteamGameId=%s" % app_id).encode()]
|
||||
me = os.getpid()
|
||||
pids = []
|
||||
@@ -1022,8 +986,6 @@ VR_ACTIONS = ("status", "install", "start", "stop")
|
||||
|
||||
|
||||
def steamvr(req):
|
||||
"""Cardboard mode's SteamVR: a fixed helper with four actions, unlike exec (no command line from
|
||||
the request). install downloads 571 MB, so it runs detached and status reports it."""
|
||||
action = req.get("action", "status")
|
||||
if action not in VR_ACTIONS:
|
||||
raise AgentError("INVALID_REQUEST", "vr action must be one of " + ", ".join(VR_ACTIONS))
|
||||
@@ -1244,11 +1206,10 @@ def main(argv):
|
||||
if len(argv) != 2 or not argv[1].isascii() or not argv[1].isdecimal():
|
||||
print("usage: droiddeck-agent --steam-supports-vr <appid>", file=sys.stderr)
|
||||
return 2
|
||||
# Optional-VR games (Thumper, VRChat) carry vr_supported without vr_only.
|
||||
expression = ("(o => o ? (o.vr_supported === true || o.vr_only === true) : null)"
|
||||
"(window.appStore?.GetAppOverviewByGameID?.(%s))" % json.dumps(argv[1]))
|
||||
value = None
|
||||
deadline = time.monotonic() + 12 # Steam's UI is busiest while a game starts.
|
||||
deadline = time.monotonic() + 12
|
||||
while value is None and time.monotonic() < deadline:
|
||||
try:
|
||||
value = cdp_eval(Path(base) / "agent", expression, await_promise=False, timeout=8).get("value")
|
||||
|
||||
@@ -68,7 +68,6 @@ def fd_path(fd):
|
||||
|
||||
|
||||
def expand(argv):
|
||||
"""argv with every --args FD replaced by the NUL-separated arguments read from FD."""
|
||||
out = []
|
||||
i = 0
|
||||
while i < len(argv):
|
||||
@@ -188,7 +187,6 @@ def real(path):
|
||||
|
||||
|
||||
def remaps_nothing(s):
|
||||
"""True when every path in the sandbox is what it is out here already."""
|
||||
for op in s.ops:
|
||||
t = op["t"]
|
||||
if t == "bind":
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Expose available Steam libraries in Dolphin, retaining the old PCManFM bookmark."""
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
|
||||
@@ -54,7 +54,6 @@ def icon_for(appid):
|
||||
|
||||
|
||||
def client_entries():
|
||||
"""App ids the client already wrote a menu entry for."""
|
||||
found = set()
|
||||
if not os.path.isdir(APPS_DIR):
|
||||
return found
|
||||
|
||||
@@ -329,7 +329,6 @@ def mirror(source, provider, name, target):
|
||||
|
||||
|
||||
def build_rootfs(base, provider):
|
||||
"""The runtime with glibc and libstdc++ taken from a newer one, which FEX's GL and Vulkan thunks are built against."""
|
||||
base_files, provider_files = os.path.join(base, "files"), os.path.join(provider, "files")
|
||||
rootfs = os.path.join(STATE, "rootfs")
|
||||
stamp = "%d\n%s\n%s%s\n%s" % (ROOTFS_LAYOUT, os.path.realpath(base), read_text(os.path.join(base_files, MARKER)) or "",
|
||||
@@ -431,8 +430,6 @@ def link_steam_sdk():
|
||||
|
||||
|
||||
def link_guest_sdk(root):
|
||||
# Proton's lsteamclient only looks in $HOME/.steam/sdk64; on ARM Steam that is the arm64 client, so
|
||||
# the x86 runtime gets its own link, which FEX resolves before the host path.
|
||||
for sdk, candidates in (("sdk64", ("linux64", "ubuntu12_64")), ("sdk32", ("linux32", "ubuntu12_32"))):
|
||||
want = "x86_64" if sdk == "sdk64" else "i386"
|
||||
directory = next((os.path.join(STEAM_ROOT, candidate) for candidate in candidates
|
||||
@@ -612,17 +609,13 @@ def guest_environment(fex, env):
|
||||
result["FEX_APP_CONFIG_LOCATION"] = CONFIG_DIR + "/"
|
||||
result["FEX_APP_DATA_LOCATION"] = data + "/"
|
||||
result["FEX_APP_CACHE_LOCATION"] = CACHE_DIR + "/"
|
||||
# Valve's FEX-Emu binds its server socket under $STEAM_COMPAT_DATA_PATH/fex-emu whatever FEX_APP_DATA_LOCATION or
|
||||
# FEX_SERVERSOCKETPATH say, and sun_path is 108 bytes: compatdata under the app's data folder is too long.
|
||||
if result.get("STEAM_COMPAT_DATA_PATH"):
|
||||
short = data if data != DATA_DIR else "/tmp/fex"
|
||||
os.makedirs(short, exist_ok=True)
|
||||
result["STEAM_COMPAT_DATA_PATH"] = short
|
||||
result.setdefault("FEX_SILENTLOG", "0")
|
||||
result.setdefault("FEX_OUTPUTLOG", "stderr")
|
||||
# The session's tunables are for the host libc; an x86 ld.so copying them under FEX fails in sbrk.
|
||||
result.pop("GLIBC_TUNABLES", None)
|
||||
# Mono's incremental Boehm collector corrupts its heap under FEX, so Unity games crash at their first collections.
|
||||
result.setdefault("GC_DISABLE_INCREMENTAL", "1")
|
||||
if fex["portable"]:
|
||||
result["FEX_PORTABLE"] = "1"
|
||||
@@ -713,7 +706,6 @@ def launch(command, env, mode, decide=None):
|
||||
folder = decide if decide and os.path.isdir(decide) else os.path.dirname(program)
|
||||
if thunks == "on" and x86_64 and os.path.isfile(os.path.join(PRELOADS, "x86_64", VULKAN_PIN)) \
|
||||
and vulkan_thunk_loads(fex, folder):
|
||||
# Any LD_AUDIT module makes Mono's garbage collector crash under FEX, so the Vulkan thunk is pinned by search path.
|
||||
guest["LD_LIBRARY_PATH"] = ":".join(["/usr/" + VULKAN_PIN_DIR] + split_paths(guest.get("LD_LIBRARY_PATH")))
|
||||
thunks = "on, its own Vulkan loader too"
|
||||
say("running %s with %s (runtime %s, thunks %s)" % (program, fex["bin"], guest.get("FEX_ROOTFS", "none"), thunks))
|
||||
|
||||
@@ -3,7 +3,6 @@ FEX_TAG=fex-2610-r5
|
||||
FEX_SHA256=0fc1ca2ba13817ad70d1ea157119a75c9c02446b57d166e6d676cce0807c19c4
|
||||
FEX_URL=https://github.com/Droid-Deck/DroidDeck-Components/releases/download/$FEX_TAG/fex.tzst
|
||||
|
||||
# Whether every program in the FEX tree at $1 finds its libraries (r4 did not without libxxhash).
|
||||
fex_loads() {
|
||||
local b out
|
||||
for b in FEX FEXServer unsquashfs; do
|
||||
@@ -13,8 +12,6 @@ fex_loads() {
|
||||
done
|
||||
}
|
||||
|
||||
# Installs one FEX build only once its archive matches the sha256 and it loads. The files it replaces are kept
|
||||
# until the installed copy loads too, and put back otherwise; the tag is written last.
|
||||
fex_install() {
|
||||
local tag=$1 sha=$2 urls=$3 dst=/ tmp u f
|
||||
tmp=$(mktemp -d)
|
||||
@@ -54,8 +51,6 @@ fex_install() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# The build DroidDeck-Components' fex.json names (the app passes it as BL_FEX_*) comes first, then a working
|
||||
# installed one, then FEX_TAG above. Sets FEX_NOW and FEX_FROM.
|
||||
fex_ready() {
|
||||
local have ok=
|
||||
have=$(cat /usr/local/share/fex-emu/.droiddeck-tag 2>/dev/null || true)
|
||||
|
||||
@@ -38,10 +38,6 @@ BUS_CONFIG = """<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Config
|
||||
|
||||
|
||||
def prepare_rootfs():
|
||||
"""Some runtimes (KDE 6.10) ship etc/resolv.conf as a link to /run/host/monitor/resolv.conf.
|
||||
Deploying one, Flatpak removes that link only if GIO reports it existing, and GIO follows it:
|
||||
dangling here, it was left in place and making Flatpak's own link failed ("File exists").
|
||||
With the target present in the rootfs the link resolves and the deploy goes through."""
|
||||
target = "/run/host/monitor/resolv.conf"
|
||||
try:
|
||||
if not os.path.exists(target):
|
||||
@@ -177,7 +173,6 @@ def installation():
|
||||
|
||||
|
||||
def app_ref(inst, app_id):
|
||||
"""The installed ref of an app, or None."""
|
||||
for ref in inst.list_installed_refs_by_kind(Flatpak.RefKind.APP, None):
|
||||
if ref.get_name() == app_id:
|
||||
return ref
|
||||
@@ -281,7 +276,6 @@ def install(app_id):
|
||||
|
||||
|
||||
def install_bundle(path):
|
||||
"""A single-file bundle (flatpak build-bundle), for apps Flathub does not carry."""
|
||||
inst = installation()
|
||||
bundle = Gio.File.new_for_path(path)
|
||||
try:
|
||||
|
||||
@@ -39,7 +39,6 @@ DOTNET_FEX = {
|
||||
|
||||
|
||||
def game_files(exe):
|
||||
"""Lower-cased names of the files next to the game's executable and one directory below."""
|
||||
names = set()
|
||||
folder = os.path.dirname(exe)
|
||||
try:
|
||||
@@ -58,7 +57,6 @@ def game_files(exe):
|
||||
|
||||
|
||||
class Game:
|
||||
"""What a fix gets to look at: the executable, its launch arguments and the files beside it."""
|
||||
|
||||
def __init__(self, exe, args):
|
||||
self.exe = exe
|
||||
@@ -109,9 +107,6 @@ def godot_sentry(game):
|
||||
|
||||
@fix
|
||||
def d3dgear_hook(game):
|
||||
"""D3DGear's capture DLL left beside a game (The Crew 2) is loaded by it and hooks the DXGI swapchain;
|
||||
under Wine the hook faults over a thousand times within seconds and the game never presents again:
|
||||
black screen while the sound keeps playing."""
|
||||
if "d3dgear64.dll" in game.files:
|
||||
return {"WINEDLLOVERRIDES": "d3dgear64=d"}, [], "D3DGear capture hook off (it stops the game drawing)"
|
||||
|
||||
@@ -124,8 +119,6 @@ def deep_rock_gdk_raytracing(game):
|
||||
|
||||
@fix
|
||||
def arkham_city_x87(game):
|
||||
"""Batman: Arkham City (BatmanAC.exe, also started through BmLauncher.exe beside it) leans on x87
|
||||
and stops with Unreal's "Fatal error!" right after start when FEX reduces its precision."""
|
||||
if "batmanac.exe" in game.files:
|
||||
return {"FEX_X87REDUCEDPRECISION": "0"}, [], "Batman: Arkham City: FEX with full x87 precision"
|
||||
|
||||
@@ -157,8 +150,6 @@ def caravan_sandwitch_feature_level(game):
|
||||
|
||||
@fix
|
||||
def robocop_rogue_city_feature_level(game):
|
||||
"""vkd3d-proton turns mesh shaders off on Adreno, but 12_2 still advertises them, and UE5 then builds mesh
|
||||
pipelines with no pipeline layout that crash Turnip on launch."""
|
||||
if "robocop.exe" in game.files or game.stem == "robocop-win64-shipping":
|
||||
return {"VKD3D_FEATURE_LEVEL": "12_1"}, [], "RoboCop: Rogue City: D3D12 feature level 12_1"
|
||||
|
||||
@@ -178,10 +169,6 @@ def cyberpunk_feature_level(game):
|
||||
return {"VKD3D_FEATURE_LEVEL": "12_1"}, [], "Cyberpunk 2077: D3D12 feature level 12_1"
|
||||
|
||||
def skip_red_launcher(command):
|
||||
"""Cyberpunk 2077's prelauncher opens REDlauncher, a Qt WebEngine window that hands over to the
|
||||
game half a minute later and then stays up beside it, well over a core busy for as long as the
|
||||
game runs. The game is started itself instead; the prelauncher's own --launcher-skip started it
|
||||
twice."""
|
||||
if len(command) > 2 and os.path.basename(command[2]).lower() == "redprelauncher.exe":
|
||||
game = os.path.join(os.path.dirname(command[2]), "bin", "x64", "Cyberpunk2077.exe")
|
||||
if os.path.isfile(game):
|
||||
@@ -246,7 +233,6 @@ def ubisoft_overlay_off(env):
|
||||
|
||||
|
||||
def offline_without_anticheat(command, env):
|
||||
"""Start the configured game executable when the player opts into launching without EAC."""
|
||||
if (env.get("DROIDDECK_ANTICHEAT_OFFLINE") != "1" or len(command) <= 2
|
||||
or command[1] != "waitforexitandrun"
|
||||
or not re.fullmatch(r"start_protected_game(?:_?x64|_?64)?\.exe",
|
||||
@@ -264,7 +250,6 @@ def offline_without_anticheat(command, env):
|
||||
game = os.path.join(folder, relative)
|
||||
if os.path.isabs(relative) or relative.startswith("..") or not os.path.isfile(game):
|
||||
return command
|
||||
# Resolve symlinks before accepting an executable inside the game directory.
|
||||
root = os.path.realpath(folder)
|
||||
if os.path.commonpath((root, os.path.realpath(game))) != root:
|
||||
return command
|
||||
@@ -275,7 +260,6 @@ def offline_without_anticheat(command, env):
|
||||
|
||||
|
||||
def engine_fixes(exe, args):
|
||||
"""Environment and extra arguments a game needs because of what it is built with."""
|
||||
game = Game(exe, args)
|
||||
env, extra, notes = {}, [], []
|
||||
for check in FIXES:
|
||||
@@ -291,7 +275,6 @@ def engine_fixes(exe, args):
|
||||
|
||||
|
||||
def win_components(compat, app_id):
|
||||
"""The game's Windows components put into its prefix; returns their WINEDLLOVERRIDES entries."""
|
||||
if not compat:
|
||||
return ""
|
||||
try:
|
||||
@@ -318,7 +301,6 @@ def game_gpu(env):
|
||||
|
||||
|
||||
def vram_cap(env):
|
||||
"""Puts the session's VRAM cap ahead of the game's own DXVK settings, so a game profile can still raise it."""
|
||||
value = env.get("BL_VRAM_MB", "")
|
||||
if not re.fullmatch(r"[1-9][0-9]{0,6}", value):
|
||||
return env
|
||||
@@ -330,7 +312,6 @@ def vram_cap(env):
|
||||
|
||||
|
||||
def parse_cores(text):
|
||||
"""CPU numbers from a list such as "0-3,6"; None when the text is not one."""
|
||||
cores = set()
|
||||
for part in text.replace(" ", "").split(","):
|
||||
match = re.fullmatch(r"(\d{1,3})(?:-(\d{1,3}))?", part)
|
||||
@@ -353,7 +334,6 @@ def online_cores():
|
||||
|
||||
|
||||
def game_cores(env):
|
||||
"""Pins the game to the cores its profile names, in place of the session's game cores."""
|
||||
text = env.get("DROIDDECK_GAME_CORES", "").strip()
|
||||
if not text:
|
||||
return
|
||||
@@ -370,7 +350,6 @@ def game_cores(env):
|
||||
|
||||
|
||||
def core_speeds(cores, root="/sys/devices/system/cpu"):
|
||||
"""Each core's capacity, else its top clock; None when some core reports neither."""
|
||||
for name in ("cpu_capacity", "cpufreq/cpuinfo_max_freq"):
|
||||
speeds = {}
|
||||
for core in cores:
|
||||
@@ -385,14 +364,12 @@ def core_speeds(cores, root="/sys/devices/system/cpu"):
|
||||
|
||||
|
||||
def fastest_first(cores):
|
||||
"""The cores, fastest first; cores of equal or unknown speed keep their numeric order."""
|
||||
cores = sorted(cores)
|
||||
speeds = core_speeds(cores)
|
||||
return sorted(cores, key=lambda core: -speeds[core]) if speeds else cores
|
||||
|
||||
|
||||
def proton_cpu_limit(command, env):
|
||||
"""This game's entry in Proton's own default_cpu_limit list: a core count, another value such as "P" as text, or None."""
|
||||
app_id = env.get("SteamGameId", "")
|
||||
if not command or not app_id.isdigit():
|
||||
return None
|
||||
@@ -412,7 +389,6 @@ def proton_cpu_limit(command, env):
|
||||
|
||||
|
||||
def cpu_topology(env, command=()):
|
||||
"""Windows sees the game's cores fastest first, so a thread a game pins to CPU 0 runs on the fastest core."""
|
||||
if "PROTON_CPU_TOPOLOGY" in env:
|
||||
return
|
||||
if "WINE_CPU_TOPOLOGY" in env:
|
||||
@@ -445,9 +421,6 @@ def cpu_topology(env, command=()):
|
||||
|
||||
|
||||
def gl_vsync(env):
|
||||
"""OpenGL stops waiting for each screen refresh; Steam's Frame Limit still holds the game through gamescope."""
|
||||
# Wine asks for interval 1 on every GL window, and WineD3D's front-buffer drawing (DirectDraw,
|
||||
# Direct3D 1-7) never lowers it, so those games ran at the refresh rate with no limit set.
|
||||
if "vblank_mode" in env or game_id(env) is None:
|
||||
return False
|
||||
env["vblank_mode"] = "0"
|
||||
@@ -501,7 +474,6 @@ WINE_DEBUG_SELECTOR = re.compile(r"(?:(trace|warn|err|fixme))?([+-])([A-Za-z_][A
|
||||
|
||||
|
||||
def game_debug_channels(*values):
|
||||
"""Normalize Wine selectors, retaining custom channels before required diagnostics."""
|
||||
selectors = {}
|
||||
for value in values:
|
||||
if not isinstance(value, str) or "\0" in value or len(value) > 8192:
|
||||
@@ -512,8 +484,6 @@ def game_debug_channels(*values):
|
||||
if match is None:
|
||||
continue
|
||||
key = (match[1] or "", match[3])
|
||||
# Move the last value to the end: global +/-all and per-class selectors
|
||||
# have ordered semantics, so replacing a value in its old position is wrong.
|
||||
selectors.pop(key, None)
|
||||
selectors[key] = part
|
||||
for channel in GAME_DEBUG_CHANNELS:
|
||||
@@ -527,7 +497,6 @@ def game_debug_channels(*values):
|
||||
|
||||
|
||||
def apply_game_debug_logs(env, config, debug_dir):
|
||||
"""Apply app-owned diagnostics to a real game, without editing its launch command."""
|
||||
if not isinstance(config, dict) or config.get("version") != 1 or config.get("gameDebugLogs") is not True:
|
||||
return env
|
||||
if (not isinstance(debug_dir, str) or "\0" in debug_dir or len(debug_dir) > 8192
|
||||
@@ -599,10 +568,6 @@ SSBS_LIB = "/usr/local/lib/libssbs.so"
|
||||
|
||||
|
||||
def force_ssbs(command, env):
|
||||
"""DROIDDECK_FORCE_SSBS=1 (a game's or the shared environment): preload libssbs.so into this
|
||||
Proton's Wine, which then keeps PSTATE.SSBS set across signal returns - speculative store
|
||||
bypass stays allowed, as force_ssbs.diff does inside a rebuilt ntdll. ARM64 Protons only: the
|
||||
library is aarch64 and only arm64 Wine has the signal path it fixes."""
|
||||
if env.get("DROIDDECK_FORCE_SSBS", "").lower() not in ("1", "on", "true", "yes"):
|
||||
return env
|
||||
proton = os.path.dirname(command[0]) if command else ""
|
||||
@@ -623,10 +588,6 @@ EVALUATOR_SCRIPT = re.compile(r"(?:^|[\\/])evaluatorscript_[0-9]+\.vdf$", re.IGN
|
||||
|
||||
|
||||
def mark_install_scripts(command, env):
|
||||
"""The client is about to run a game's install scripts (iscriptevaluator.exe): mark every process
|
||||
in them but a Vulkan runtime installer as already run first, so no redistributable installer
|
||||
starts - on first launch the shared ones may still be downloading, and on ARM64 Proton the VC++
|
||||
ones stop with an error."""
|
||||
if not any(arg.lower().replace("\\", "/").endswith("iscriptevaluator.exe") for arg in command):
|
||||
return []
|
||||
root = env.get("BL_X64_STEAM_ROOT") or env.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or str(Path.home() / ".local/share/Steam")
|
||||
@@ -750,7 +711,6 @@ DIRT_SAVED = ".droiddeck-original"
|
||||
|
||||
|
||||
def dirt_telemetry_on(prefix, game):
|
||||
"""Whether the game's UDP/motion output is on, as In-game stats or another listener sets it ("dbox" is its default)."""
|
||||
try:
|
||||
folders = [f for f in (Path(prefix) / "pfx/drive_c/users/steamuser/Documents/My Games").iterdir()
|
||||
if f.name.lower().replace(" ", "") == game]
|
||||
@@ -785,7 +745,6 @@ WINE_DLL_DIRS = ("/lib/wine/i386-windows", "/lib/wine/x86_64-windows", "/lib/win
|
||||
|
||||
|
||||
def is_wine_dll_link(path):
|
||||
"""A link into a Wine DLL folder: the rule Proton uses to tell its own DLLs in a prefix (file_is_wine_builtin_dll)."""
|
||||
try:
|
||||
return os.path.islink(path) and os.path.dirname(os.readlink(path)).endswith(WINE_DLL_DIRS)
|
||||
except OSError:
|
||||
@@ -804,7 +763,6 @@ def is_dirt_stand_in(path):
|
||||
|
||||
|
||||
def dirt_ws2_wanted(command, env):
|
||||
"""The prefix to give the ws2_32 stand-in: a DiRT 3 / Showdown launch with telemetry on and a Proton without the fix."""
|
||||
prefix = env.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
|
||||
if len(command) < 3 or not prefix or not os.path.isfile(DIRT_WS2):
|
||||
return None
|
||||
@@ -815,7 +773,6 @@ def dirt_ws2_wanted(command, env):
|
||||
|
||||
|
||||
def swap_dirt_ws2(prefix):
|
||||
"""Puts the stand-in where the prefix's syswow64/ws2_32.dll is; that file is kept beside it."""
|
||||
target = prefix_ws2(prefix)
|
||||
saved = target.with_name(target.name + DIRT_SAVED)
|
||||
data = Path(DIRT_WS2).read_bytes()
|
||||
@@ -829,11 +786,6 @@ def swap_dirt_ws2(prefix):
|
||||
|
||||
|
||||
def restore_dirt_ws2(prefix, proton):
|
||||
"""Puts a Wine syswow64/ws2_32.dll back if the stand-in is still there; true when it changed something.
|
||||
|
||||
That is the prefix's own one, unless it was a link to a Wine DLL folder and the game ran on another Proton since
|
||||
the swap: Proton then relinked the prefix's other DLLs to itself but left the stand-in, so a link to the running
|
||||
Proton's ws2_32.dll goes back instead. Anything else (a native file, a link to a mod's DLL) goes back as it was."""
|
||||
target = prefix_ws2(prefix)
|
||||
saved = target.with_name(target.name + DIRT_SAVED)
|
||||
own = proton_ws2(proton)
|
||||
@@ -868,10 +820,6 @@ def windows_core_count(env):
|
||||
|
||||
|
||||
def ego_core_plan(command, env):
|
||||
"""Codemasters EGO games (DiRT 3, DiRT Showdown, GRID, F1 ...) pick their thread plan by core count from
|
||||
system/hardware_settings_restrictions.xml. A count with no plan (5 when a phone's slow cores are left out) puts
|
||||
every worker on one core, and DiRT 3 then stops on a loading screen. Adds a plan for the count Windows sees,
|
||||
copied from the nearest smaller one; the file as it was is kept beside it. Returns a note, or None."""
|
||||
count = windows_core_count(env)
|
||||
if not count or len(command) < 3:
|
||||
return None
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""GOG patch installers and the lease shared by maintenance and game launches."""
|
||||
import fcntl
|
||||
import errno
|
||||
import json
|
||||
@@ -133,7 +132,6 @@ def runner(folder, appid, game, graphical=False):
|
||||
base = desktop_environment(os.environ) if graphical else dict(os.environ)
|
||||
env = run["environment"](base, target, tool, root, window=base.get("BL_DESKTOP") == "1")
|
||||
env["DROIDDECK_GOG_MAINTENANCE"] = "1"
|
||||
# Installer copy routines use x87 integer loads/stores; reduced precision corrupts paths (FEX #5827).
|
||||
env["FEX_X87REDUCEDPRECISION"] = "0"
|
||||
env.pop("BL_STORE_EXIT", None)
|
||||
return str(Path(tool) / command), env, target.compatdata
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Let GTK draw close buttons inside gamescope, which supplies no window decorations."""
|
||||
import ctypes as c
|
||||
import os
|
||||
import signal
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Holds a game launcher's hidden web interface on one slow core while something else has focus.
|
||||
|
||||
Rockstar's launcher keeps drawing its Chromium interface (SocialClubHelper.exe: a renderer, and a
|
||||
GPU process compositing through DXVK) for as long as it runs, hidden behind the game too, and at a
|
||||
higher priority than the game's (Wine passes Chromium's on: the GPU process ran at nice -10). With
|
||||
Red Dead Redemption 2 in front on the RedMagic that was 1.3 to 2.5 cores under FEX, on a phone
|
||||
already held back by its temperature, for a page nobody sees. Held, riding at the throttle limit
|
||||
went from 46.5 to 48.7 fps, 1% lows from 27.5 to 32.6. So while the focused window belongs to
|
||||
anything but the launcher, every helper thread runs on one core of the slowest cluster at nice 19;
|
||||
when the launcher's own window has focus again (signing in, the game closed) each thread gets its
|
||||
own mask and priority back. Stopping the helpers instead would not hold: proot, the tracer of every
|
||||
guest process, resumes a stopped tracee.
|
||||
|
||||
Focus comes from droiddeck-agent's focus.json (the path is the argument), which the agent rewrites
|
||||
whenever gamescope's focus changes. droiddeck-session starts this for Steam sessions;
|
||||
BL_LAUNCHER_CORES=0 leaves the launchers alone."""
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
@@ -35,7 +19,6 @@ def log(message):
|
||||
|
||||
|
||||
def image(proc, pid):
|
||||
"""A process's program as Wine names it (argv[0]), lower case with backslashes, or None."""
|
||||
try:
|
||||
with open(proc / str(pid) / "cmdline", "rb") as stream:
|
||||
first = stream.read(4096).split(b"\0", 1)[0]
|
||||
@@ -56,7 +39,6 @@ def tasks(proc, pid):
|
||||
|
||||
|
||||
class Cores:
|
||||
"""The kernel calls, apart so a test can stand in for them."""
|
||||
|
||||
def own(self):
|
||||
return os.sched_getaffinity(0)
|
||||
@@ -81,8 +63,6 @@ class Holder:
|
||||
self.core = None
|
||||
|
||||
def slow_core(self):
|
||||
"""The last core of the slowest cluster the session has - not of the game's cores, which
|
||||
the launcher inherits when BL_GAME_CPUS is set: the core the game misses least."""
|
||||
def top(cpu):
|
||||
try:
|
||||
return int((self.cpufreq / f"cpu{cpu}/cpufreq/cpuinfo_max_freq").read_text())
|
||||
@@ -98,8 +78,6 @@ class Holder:
|
||||
yield int(name)
|
||||
|
||||
def hold(self):
|
||||
"""Every helper thread onto the slow core at NICE: new ones, and held ones the program has
|
||||
moved since (Chromium sets its threads' priorities, and Wine passes that on)."""
|
||||
if self.core is None:
|
||||
self.core = self.slow_core()
|
||||
hold = ({self.core}, NICE)
|
||||
@@ -125,8 +103,6 @@ class Holder:
|
||||
return None
|
||||
|
||||
def release(self):
|
||||
"""Every held thread back to its own mask and priority; one started during the hold gets
|
||||
what its process had."""
|
||||
for pid, before in self.held.items():
|
||||
default = before.get(pid) or self.first()
|
||||
for tid in tasks(self.proc, pid):
|
||||
@@ -141,7 +117,6 @@ class Holder:
|
||||
|
||||
|
||||
def focused(snapshot):
|
||||
"""(app id, pid) of the window gamescope has focused, from droiddeck-agent's snapshot."""
|
||||
window = snapshot.get("focusedWindow")
|
||||
for entry in snapshot.get("focusableWindows") or []:
|
||||
if entry.get("window") == window:
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Steam's login1 sleep notifications, backed by DroidDeck's session pause.
|
||||
|
||||
Android owns device power. Suspend here pauses the guest through SessionService;
|
||||
the app's Resume action thaws it and completes PrepareForSleep(false). Steam
|
||||
must see this service before startup or it can stay black after its idle timer.
|
||||
"""
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
@@ -1,32 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Installs a Windows Installer package (.msi) the way Wine's own msiexec would, without running it.
|
||||
|
||||
droiddeck-msi-install <package.msi | installer.exe> <component dir>
|
||||
droiddeck-msi-install --unpack <archive | installer.exe | cabinet> <dir>
|
||||
|
||||
A .msi is a database: which files go to which folder, which registry values to write, which .NET
|
||||
and side-by-side assemblies to register. This reads those tables (msiinfo), unpacks the package's
|
||||
cabinets (cabextract, which knows every compression a cabinet can use) and lays the result out
|
||||
for droiddeck-wincomponents, which puts it into a game's prefix at launch:
|
||||
|
||||
<component dir>/drive_c/... the files, at the paths they get on 64-bit Windows
|
||||
<component dir>/registry.json the registry values, in the view (32/64-bit) Windows uses
|
||||
|
||||
An installer .exe is opened the same way when it is a wrapper around packages: a WiX bundle
|
||||
(Visual C++ 2012 and later, the .NET Core and 5+ runtimes: the packages sit in a cabinet the
|
||||
bundle's own header locates, named in its manifest), a self-extracting cabinet (Visual C++ 2005
|
||||
to 2010) or a self-extracting 7-Zip archive (.NET Framework 4.0 to 4.8). The packages inside are
|
||||
laid out one after the other into the same component dir; the 32- and 64-bit ones both, an ARM64
|
||||
one never. An .exe that is its own setup program (NSIS, InnoSetup) holds no package: an error says so.
|
||||
|
||||
What a package does by running its own code (custom actions such as DXSETUP, self-registering
|
||||
DLLs) cannot be done this way; each is named in the notes, so nothing is left out silently.
|
||||
|
||||
--unpack opens an archive or installer for the caller to take files out of (cabextract for a
|
||||
cabinet or self-extracting cabinet, 7-Zip for the rest) and prints the files it found.
|
||||
|
||||
Prints "progress <text>" lines while it works and ends with "result <json>": the counts and notes.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@@ -47,7 +19,6 @@ SKIP_PLATFORMS = ("arm64", "arm")
|
||||
|
||||
|
||||
def tool_env():
|
||||
"""The environment the tools run in: their own libraries (libmsi, libgsf, libgcab) beside them."""
|
||||
env = dict(os.environ)
|
||||
env["LD_LIBRARY_PATH"] = ":".join(p for p in (str(TOOLS), env.get("LD_LIBRARY_PATH", "")) if p)
|
||||
return env
|
||||
@@ -95,7 +66,6 @@ class MsiError(Exception):
|
||||
|
||||
|
||||
def progress(text, fraction=None):
|
||||
"""A progress line: "progress <text>", or "progress NN% <text>" when how far along is known."""
|
||||
if fraction is None:
|
||||
print("progress " + text, flush=True)
|
||||
else:
|
||||
@@ -103,7 +73,6 @@ def progress(text, fraction=None):
|
||||
|
||||
|
||||
class Span:
|
||||
"""The slice of the whole job one package's progress maps into (a wrapper runs several)."""
|
||||
def __init__(self, lo=0.0, hi=1.0):
|
||||
self.lo, self.hi = lo, hi
|
||||
|
||||
@@ -137,7 +106,6 @@ class Package:
|
||||
self.summary[name.strip().lower()] = value.strip()
|
||||
|
||||
def table(self, name):
|
||||
"""The table's rows as dicts by column name; an absent table has none."""
|
||||
if name in self._tables:
|
||||
return self._tables[name]
|
||||
rows = []
|
||||
@@ -158,7 +126,6 @@ class Package:
|
||||
|
||||
|
||||
def long_name(value):
|
||||
"""A Directory/File name column: "short|long", the long one when there are two."""
|
||||
return value.split("|")[-1]
|
||||
|
||||
|
||||
@@ -176,7 +143,6 @@ KEYWORDS = {"not", "and", "or", "xor", "eqv", "imp"}
|
||||
|
||||
|
||||
class Conditions:
|
||||
"""Windows Installer's condition language, enough of it for what packages ask at install time."""
|
||||
|
||||
def __init__(self, props, feature_state=None, component_state=None):
|
||||
self.props = props
|
||||
@@ -318,7 +284,6 @@ class Conditions:
|
||||
|
||||
|
||||
def win_to_rel(path):
|
||||
"""C:\\windows\\x\\ -> drive_c/windows/x; None for a path off drive C or a folder left out."""
|
||||
if not path:
|
||||
return None
|
||||
match = re.match(r"^[Cc]:\\?(.*)$", path)
|
||||
@@ -341,7 +306,6 @@ def clean_version(version):
|
||||
|
||||
|
||||
def clr_version(path):
|
||||
"""The .NET runtime an assembly was built for ("v4.0.30319"), from its metadata header."""
|
||||
try:
|
||||
data = Path(path).read_bytes()
|
||||
except OSError:
|
||||
@@ -389,7 +353,6 @@ class Installer:
|
||||
return 3 if name in self.included_components else -1
|
||||
|
||||
def directory(self, key):
|
||||
"""The folder a Directory key resolves to, as drive_c/..., or None when it is left out."""
|
||||
if key in self._resolving:
|
||||
return None
|
||||
value = self.props.get(key)
|
||||
@@ -414,7 +377,6 @@ class Installer:
|
||||
return parent + "/" + default
|
||||
|
||||
def format(self, text):
|
||||
"""Formatted text: [Property], [Folder], [#file], [$component], [%env], [\\x], [~]."""
|
||||
if not text:
|
||||
return text
|
||||
|
||||
@@ -449,7 +411,6 @@ class Installer:
|
||||
|
||||
|
||||
def run_set_actions(self):
|
||||
"""The property/folder-setting custom actions, in sequence order; the rest go to the notes."""
|
||||
actions = {row["Action"]: row for row in self.pkg.table("CustomAction")}
|
||||
sequence = {}
|
||||
for table in ("InstallUISequence", "InstallExecuteSequence"):
|
||||
@@ -506,7 +467,6 @@ class Installer:
|
||||
self.included_components.add(name)
|
||||
|
||||
def assemblies(self):
|
||||
"""Component -> where its files go when it is a global assembly (the GAC or winsxs)."""
|
||||
names = {}
|
||||
for row in self.pkg.table("MsiAssemblyName"):
|
||||
names.setdefault(row["Component_"], {})[row["Name"].lower()] = row["Value"]
|
||||
@@ -535,7 +495,6 @@ class Installer:
|
||||
|
||||
@staticmethod
|
||||
def sxs_names(ident):
|
||||
"""Wine's winsxs names for a side-by-side assembly: its folder and, for a policy, the policy folder."""
|
||||
arch = ident.get("processorarchitecture", "x86").lower() or "x86"
|
||||
name = ident.get("name", "").lower()
|
||||
token = ident.get("publickeytoken", "").lower()
|
||||
@@ -548,7 +507,6 @@ class Installer:
|
||||
return "assembly", "%s_%s_%s_%s_none_deadbeef" % (arch, name, token, version), version
|
||||
|
||||
def unpack(self, work):
|
||||
"""Every cabinet in the package, unpacked; returns File key -> unpacked file."""
|
||||
found = {}
|
||||
media = [row for row in self.pkg.table("Media") if row.get("Cabinet", "")]
|
||||
for index, row in enumerate(media):
|
||||
@@ -656,7 +614,6 @@ class Installer:
|
||||
self.registry.append({"hive": hive, "key": key, "name": name, "type": kind, "data": data})
|
||||
|
||||
def registry_data(self, raw):
|
||||
"""A Registry table Value: (type, data) as droiddeck-wincomponents writes them."""
|
||||
if raw is None or raw == "":
|
||||
return "sz", ""
|
||||
if raw.startswith("#x") or raw.startswith("#X"):
|
||||
@@ -773,7 +730,6 @@ class Installer:
|
||||
|
||||
|
||||
def sibling(path, name):
|
||||
"""A file next to [path] called [name], whatever its case; None when there is none."""
|
||||
folder = path.parent
|
||||
candidate = folder / name
|
||||
if candidate.is_file():
|
||||
@@ -786,7 +742,6 @@ def sibling(path, name):
|
||||
|
||||
|
||||
def kind_of(path):
|
||||
"""What a file is by its first bytes: msi, exe, cab or other."""
|
||||
with open(path, "rb") as source:
|
||||
head = source.read(8)
|
||||
if head.startswith(MSI_MAGIC):
|
||||
@@ -806,9 +761,6 @@ def run_tool(args, timeout=1800):
|
||||
|
||||
|
||||
def burn_containers(data):
|
||||
"""A WiX bundle's containers as (offset, size) pairs: the .wixburn section of the stub names
|
||||
their sizes; each is a cabinet laid out after the stub, found by its header since signing can
|
||||
move them. None when the file is no bundle."""
|
||||
try:
|
||||
pe = struct.unpack_from("<I", data, 0x3C)[0]
|
||||
if data[pe:pe + 4] != b"PE\0\0":
|
||||
@@ -845,8 +797,6 @@ def burn_containers(data):
|
||||
|
||||
|
||||
def unpack_burn(path, dest, containers):
|
||||
"""Unpacks a bundle's containers into [dest] and gives the payloads the names its manifest
|
||||
lists (a9 -> packages/vcRuntimeMinimum_amd64/vc_runtimeMinimum_x64.msi)."""
|
||||
data = path.read_bytes()
|
||||
names = {}
|
||||
for index, (start, size) in enumerate(containers):
|
||||
@@ -877,8 +827,6 @@ def unpack_burn(path, dest, containers):
|
||||
|
||||
|
||||
def unpack_installer(path, dest):
|
||||
"""Opens an installer or archive into [dest]: a bundle by its header, a cabinet (or
|
||||
self-extracting one) with cabextract, anything else with 7-Zip."""
|
||||
kind = kind_of(path)
|
||||
if kind == "exe":
|
||||
containers = burn_containers(path.read_bytes())
|
||||
@@ -900,7 +848,6 @@ def unpack_installer(path, dest):
|
||||
|
||||
|
||||
def packages_in(root):
|
||||
"""The Windows Installer packages an unpacked installer holds, shallowest first, by name."""
|
||||
found = []
|
||||
for entry in sorted(root.rglob("*")):
|
||||
if entry.is_file() and kind_of(entry) == "msi":
|
||||
@@ -910,11 +857,6 @@ def packages_in(root):
|
||||
|
||||
|
||||
def choose_packages(found, root):
|
||||
"""Which packages make up the install: the ones at the top of the installer (a bundle keeps
|
||||
each in its own folder, so there every level counts), for the x86 and x64 platforms. The .NET
|
||||
Framework 4.5+ installers carry a complete product (netfx_Full_*) beside the 4.0 parts they
|
||||
patch (netfx_Core_*, netfx_Extended_*) and per-Windows-version copies in NetFx* folders: the
|
||||
complete product wins, the copies are left out."""
|
||||
if not found:
|
||||
return []
|
||||
depth = min(len(entry.relative_to(root).parts) for entry in found)
|
||||
@@ -933,7 +875,6 @@ def choose_packages(found, root):
|
||||
|
||||
|
||||
def install_wrapper(path, out):
|
||||
"""Lays out every package inside an installer wrapper; the result is the sum of them."""
|
||||
total = {"product": "", "version": "", "counts": {"files": 0, "assemblies": 0, "registry": 0}, "notes": [], "packages": []}
|
||||
with tempfile.TemporaryDirectory(dir=str(out.parent), prefix=".unpack-") as work:
|
||||
dest = Path(work) / "x"
|
||||
@@ -968,9 +909,6 @@ NESTED_SUFFIXES = (".7z", ".zip", ".cab", ".exe", ".msi", ".rar", ".xz", ".gz",
|
||||
|
||||
|
||||
def open_nested(dest, depth=0):
|
||||
"""Archives inside an unpacked installer (QuickTime's cabinets, an NSIS pack's payloads) are
|
||||
opened in place, one "<name>.nested" folder per archive, two levels deep: the same layout the
|
||||
component recordings (winlator-contents tools/snapshot/record.py) map their file sources to."""
|
||||
if depth > 1:
|
||||
return 0
|
||||
opened = 0
|
||||
|
||||
@@ -1,19 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Runs a program from the desktop: a Windows program through the Proton Steam has chosen, a Linux
|
||||
program (x86 ones under FEX), an AppImage, or a script (under FEX beside x86 programs, as a game's
|
||||
start script is). Shared storage is noexec: FEX runs x86 programs there where they lie (libblsession's
|
||||
noexec.c), while a native one is copied - alone into the cache, or with its folder by the app once (as
|
||||
Add an app does) when that holds native programs or libraries. A Steam library's games are Steam's.
|
||||
|
||||
droiddeck-open [--window | --terminal] FILE [ARGS...] the file manager's Run entries
|
||||
droiddeck-open --exec FILE [ARGS...] an exec the kernel refused (libblsession)
|
||||
droiddeck-open --install the Run entries and default handlers
|
||||
|
||||
The desktop composites in software, so a program started from it runs on the GPU in a window of its
|
||||
own (droiddeck-gpu), as the menu's games do: --window keeps it on the desktop's software drawing
|
||||
instead, --terminal runs it in Konsole. A plain script stays on the desktop, and an exec whose output is read (a terminal,
|
||||
a pipe, a file) stays where it was started.
|
||||
"""
|
||||
import fcntl
|
||||
import hashlib
|
||||
import os
|
||||
@@ -120,7 +105,6 @@ def for_x86(script):
|
||||
|
||||
|
||||
def runnable(path):
|
||||
"""The program itself, or a copy in the cache of a native one on noexec storage."""
|
||||
if not noexec(path) or machine(head(path)) in EMULATED:
|
||||
return path
|
||||
st = os.stat(path)
|
||||
@@ -141,7 +125,6 @@ def runnable(path):
|
||||
|
||||
|
||||
def appimage(path):
|
||||
"""The image unpacked once into the cache, laid out as droiddeck-appimage-run expects."""
|
||||
st = os.stat(path)
|
||||
real = os.path.realpath(path)
|
||||
key = hashlib.sha1(("%s\0%d\0%d" % (real, st.st_size, st.st_mtime_ns)).encode("utf-8")).hexdigest()[:16]
|
||||
@@ -150,7 +133,6 @@ def appimage(path):
|
||||
|
||||
|
||||
def once(key, make):
|
||||
"""[make]() for [key] one start at a time: a second start waits for the first, then finds it done."""
|
||||
locks = os.path.join(CACHE, "locks")
|
||||
os.makedirs(locks, exist_ok=True)
|
||||
with open(os.path.join(locks, key), "w") as lock:
|
||||
@@ -203,8 +185,6 @@ def import_of(key, what):
|
||||
|
||||
|
||||
def imported(what, real, key, name):
|
||||
"""[real] added by the app instead, as Add an app adds it (to the menu too): an AppImage whose hard
|
||||
links (sharun's) only the app's own proot can make, or a folder of native programs off noexec storage."""
|
||||
launch = os.environ.get("BL_LAUNCH_DIR")
|
||||
if not launch or not os.path.isdir(launch):
|
||||
raise RuntimeError("%s cannot run from here; add it in DroidDeck with Add an app." % name)
|
||||
@@ -235,9 +215,6 @@ def imported(what, real, key, name):
|
||||
|
||||
|
||||
def game_folder(path):
|
||||
"""The folder of [path] when it runs only from a copy: on noexec storage, holding native programs or
|
||||
libraries (besides [path]) that it starts or loads. Not the storage itself, one of Android's folders
|
||||
or a Steam library."""
|
||||
real = os.path.realpath(path)
|
||||
folder = os.path.dirname(real)
|
||||
if in_steam_library(real) or not noexec(folder):
|
||||
@@ -263,12 +240,10 @@ def game_folder(path):
|
||||
|
||||
|
||||
def in_steam_library(path):
|
||||
"""Whether [path] is in a Steam library: its games are Steam's to start, never copied in."""
|
||||
return "steamapps" in os.path.realpath(path).lower().split(os.sep)
|
||||
|
||||
|
||||
def storage_root(folder):
|
||||
"""The top of the storage [folder] is on: the last folder above it on the same file system."""
|
||||
top = folder
|
||||
try:
|
||||
dev = os.stat(folder).st_dev
|
||||
@@ -280,7 +255,6 @@ def storage_root(folder):
|
||||
|
||||
|
||||
def copied_in(path):
|
||||
"""The app's copy of [path]'s folder, added (once) for it."""
|
||||
real = os.path.realpath(path)
|
||||
key = hashlib.sha1(("folder\0%s" % real).encode("utf-8")).hexdigest()[:16]
|
||||
name = os.path.basename(os.path.dirname(real))
|
||||
@@ -288,7 +262,6 @@ def copied_in(path):
|
||||
|
||||
|
||||
def steam_title(path):
|
||||
"""The Steam game [path] is the program of: Steam starts it, with the client most games need."""
|
||||
try:
|
||||
run = runpy.run_path(PROTON_RUN)
|
||||
root = os.environ.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or run["STEAM_ROOT"]
|
||||
@@ -299,7 +272,6 @@ def steam_title(path):
|
||||
|
||||
|
||||
def command(path, args, what, window=False, appid=None):
|
||||
"""(command, working directory) that runs [path] in place."""
|
||||
folder = os.path.dirname(path)
|
||||
if what == "steam":
|
||||
return [STEAM_LAUNCH, "desktop", appid], folder
|
||||
@@ -321,7 +293,6 @@ def on_desktop(env):
|
||||
|
||||
|
||||
def unattended(env):
|
||||
"""Nobody reads the output: it goes to /dev/null or the desktop's log, as from Dolphin or the menu."""
|
||||
try:
|
||||
out = os.fstat(1)
|
||||
except OSError:
|
||||
@@ -337,7 +308,6 @@ def unattended(env):
|
||||
|
||||
|
||||
def placed(cmd, what, mode, env):
|
||||
"""[cmd] where it shows: on the GPU from the desktop, else where it was started."""
|
||||
if mode == "terminal" and what not in ("windows", "steam") and shutil.which("konsole"):
|
||||
return ["konsole", "--hold", "-e"] + cmd
|
||||
if mode == "window" or what in ("script", "steam") or not on_desktop(env):
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""A game's web links to Android: Wine's winebrowser starts this (named as the browser in the
|
||||
prefix's HKCU\\Software\\Wine\\WineBrowser, and as xdg-open first on a game's PATH), and an
|
||||
http(s) address goes to the app, which opens it in Android's browser - so an EOS sign-in step or a
|
||||
store page can be finished on the phone. Anything else goes on to the system's own xdg-open.
|
||||
|
||||
The session channel is $BL_LAUNCH_DIR/stores; Wine may not pass that variable on to what it
|
||||
starts, so droiddeck-proton also leaves it in LAUNCH_DIR_FILE."""
|
||||
|
||||
import json
|
||||
import os
|
||||
@@ -25,7 +18,6 @@ def hand_over(url, launch_dir):
|
||||
|
||||
|
||||
def where(url):
|
||||
"""scheme://host only, for the log: no path, no query."""
|
||||
from urllib.parse import urlsplit
|
||||
try:
|
||||
u = urlsplit(url)
|
||||
|
||||
@@ -89,7 +89,6 @@ def rpcs3_shader_mode():
|
||||
|
||||
|
||||
def ini_section(lines, name):
|
||||
"""(start, end) line indices of [name]'s body, or None."""
|
||||
start = None
|
||||
for i, l in enumerate(lines):
|
||||
t = l.strip()
|
||||
@@ -102,9 +101,6 @@ def ini_section(lines, name):
|
||||
|
||||
|
||||
def patch_ini_section(path, section, body, what, needle="SDL-", require=None, done="Player 1 on the controller"):
|
||||
"""Add body's lines to [section] of an ini the emulator wrote itself, unless the section
|
||||
already binds a controller (needle). Missing file: nothing - the emulator writes its own
|
||||
defaults on first run and this runs again."""
|
||||
if not os.path.isfile(path):
|
||||
return
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
@@ -178,7 +174,6 @@ def ini_get(path, section, key):
|
||||
|
||||
|
||||
def ini_set(path, section, key, value):
|
||||
"""Sets one key (the first of that name) in [section], adding either as needed."""
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
lines = f.read().splitlines()
|
||||
span = ini_section(lines, section)
|
||||
@@ -440,9 +435,6 @@ def armsx2():
|
||||
|
||||
|
||||
def armsx2_bios(ini):
|
||||
"""PCSX2 boots the one BIOS file named in [Filenames] BIOS (inside [Folders] Bios); its first-time
|
||||
setup is what names it. With that skipped, the first dump in the folder is named here - a US one
|
||||
first - while none is named or the named one is gone. A choice made in ARMSX2 is kept."""
|
||||
folder = ini_get(ini, "Folders", "Bios") or ps2_bios_folder()
|
||||
if not os.path.isabs(folder):
|
||||
folder = os.path.join(os.path.dirname(os.path.dirname(ini)), folder)
|
||||
@@ -518,12 +510,6 @@ DOLPHIN_DATA = "/usr/share/dolphin-emu"
|
||||
|
||||
|
||||
def dolphin_data():
|
||||
"""The Dolphin build in the catalog finds its own data - the GameCube fonts, the per-game fixes
|
||||
(GameSettings: GUT.ini puts Ultimate Spider-Man on the MMU), its icons and shaders - only at the
|
||||
fixed /usr/share/dolphin-emu it was built for; there is no setting or variable to move it. Here it
|
||||
runs from a copy unpacked under /tmp (no FUSE), so it found none of it: a GameCube game stopped
|
||||
on "Windows-1252 fonts are not loaded", another on an invalid write the missing game fix would
|
||||
have prevented. So the folder is unpacked from the AppImage to that path, once per AppImage."""
|
||||
import shutil, subprocess, tempfile
|
||||
try:
|
||||
st = os.stat(DOLPHIN_APPIMAGE)
|
||||
@@ -716,7 +702,6 @@ def melonds_geometry():
|
||||
|
||||
|
||||
def toml_get(lines, table, key):
|
||||
"""The raw value of key in [table], or None."""
|
||||
inside = False
|
||||
for l in lines:
|
||||
t = l.strip()
|
||||
@@ -728,7 +713,6 @@ def toml_get(lines, table, key):
|
||||
|
||||
|
||||
def toml_set(lines, table, key, value):
|
||||
"""key = value in [table]; the table is added at the end when missing."""
|
||||
start = None
|
||||
for i, l in enumerate(lines):
|
||||
t = l.strip()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/bin/sh
|
||||
# Audio stays on the session's PulseAudio, so WirePlumber runs its upstream video-only profile.
|
||||
set -u
|
||||
|
||||
bundle=/usr/local/lib/droiddeck-pipewire.tzst
|
||||
|
||||
@@ -31,7 +31,6 @@ def fetch_json(url):
|
||||
|
||||
|
||||
def pick_asset(source):
|
||||
"""(release tag, asset url, sha512 url or None) for the newest full release with an ARM64 build."""
|
||||
repo, pattern = SOURCES[source]
|
||||
for release in fetch_json(RELEASES % repo + "?per_page=15"):
|
||||
if release.get("draft") or release.get("prerelease"):
|
||||
@@ -58,8 +57,6 @@ def release_asset(source, tag):
|
||||
|
||||
|
||||
def download(url, path):
|
||||
"""Resumable, because this is hundreds of megabytes over a phone's connection. curl is used
|
||||
rather than urllib so a retry continues rather than starting again."""
|
||||
log("downloading %s" % os.path.basename(path))
|
||||
rc = subprocess.call([
|
||||
"curl", "-fL", "--retry", "5", "--retry-delay", "3", "--retry-connrefused",
|
||||
|
||||
@@ -1,25 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Runs a Windows program with the Proton the Steam client has chosen for it.
|
||||
|
||||
droiddeck-proton-run [--window] [--prefix ID] [--verb run] [--game-id ID] [--desktop WxH] PROGRAM [ARGS...]
|
||||
droiddeck-proton-run --app ID [--dir FOLDER] [--options TEXT] [PROGRAM [ARGS...]]
|
||||
|
||||
The program belongs to an installed Steam game when it sits in one's folder, to a prefix when it
|
||||
sits in one's drive_c, or to a non-Steam shortcut that names it; any other program gets a prefix of
|
||||
its own, under the id the client gives a new shortcut. That title's CompatToolMapping entry in
|
||||
config.vdf picks the tool, else the client's default for all other titles ("0"). The tool is
|
||||
started as the client starts it - its toolmanifest's command line, the waitforexitandrun verb and
|
||||
the STEAM_COMPAT_* environment - so its wrapper applies the game's settings, components and audio.
|
||||
--window keeps the program in the desktop's own window, drawn with WineD3D on the desktop's software
|
||||
GL (llvmpipe): KWin there composites in software, and the session's zink finds no device.
|
||||
--prefix ID puts the program in compatdata/ID whatever it is. --verb run starts it beside what already
|
||||
runs in the prefix, which waitforexitandrun would wait for; the wrapper's launch-time steps are skipped.
|
||||
--game-id ID keeps the id of the launch it runs for: gamescope shows the windows that carry the id Steam launched.
|
||||
--app starts one game without the Steam client (its Start without Steam): a Steam game's default
|
||||
Windows launch option from appinfo.vdf when no program is given, else the program in that
|
||||
shortcut's own prefix, started in --dir with the shortcut's launch options (--options). Without
|
||||
--options it takes the launch options set in the client's Properties for that game or shortcut.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@@ -91,7 +70,6 @@ def mapping(root):
|
||||
|
||||
|
||||
def tools(root):
|
||||
"""Windows compatibility tools this runtime can start, by the name config.vdf uses."""
|
||||
found = {}
|
||||
for base in [os.path.join(root, "compatibilitytools.d")] + list(SYSTEM_TOOLS):
|
||||
try:
|
||||
@@ -121,7 +99,6 @@ def state_default():
|
||||
|
||||
|
||||
def choose_tool(appid, current, available):
|
||||
"""(tool name, why) from the client's mapping, else the session's own default."""
|
||||
for key, why in ((appid, "Steam's choice for this title"), ("0", "Steam's default")):
|
||||
name = current.get(key)
|
||||
if name in available:
|
||||
@@ -144,7 +121,6 @@ class Target:
|
||||
|
||||
|
||||
def ancestors(path):
|
||||
"""(folder, the entry below it on the way to path) from the program's folder up to /."""
|
||||
child, folder = path, os.path.dirname(path)
|
||||
while True:
|
||||
yield folder, os.path.basename(child)
|
||||
@@ -211,7 +187,6 @@ def same_file(a, b):
|
||||
|
||||
|
||||
def shortcut_entries(root):
|
||||
"""(appid, exe, start dir) of the client's non-Steam shortcuts and the app's added games."""
|
||||
entries = []
|
||||
try:
|
||||
tool = runpy.run_path(os.path.join(BIN_DIR, "droiddeck-steam-shortcuts"))
|
||||
@@ -239,7 +214,6 @@ def shortcut_entries(root):
|
||||
|
||||
|
||||
def prefix_folder(root, appid):
|
||||
"""The prefix folder the client made for [appid], under either spelling of the id."""
|
||||
folder = os.path.join(root, "steamapps", "compatdata")
|
||||
try:
|
||||
names = sorted(os.listdir(folder))
|
||||
@@ -267,7 +241,6 @@ def vdf_string(token):
|
||||
|
||||
|
||||
def steam_options(app, root):
|
||||
"""The launch options the client keeps for a game (localconfig.vdf) or a shortcut (shortcuts.vdf)."""
|
||||
try:
|
||||
tool = runpy.run_path(os.path.join(BIN_DIR, "droiddeck-steam-shortcuts"))
|
||||
account = tool["account_dir"](root)
|
||||
@@ -305,7 +278,6 @@ def shortcut(program, root):
|
||||
|
||||
|
||||
def own_id(program):
|
||||
"""The id the client gives a new shortcut: the CRC of its quoted target and its name."""
|
||||
name = os.path.splitext(os.path.basename(program))[0]
|
||||
return zlib.crc32(('"%s"%s' % (program, name)).encode("utf-8")) | SHORTCUT_BIT
|
||||
|
||||
@@ -337,8 +309,6 @@ def split_words(text):
|
||||
|
||||
|
||||
def split_options(text):
|
||||
"""A shortcut's launch options: NAME=value words before %command% go to the environment, the words
|
||||
after it - or all of them, without %command% - are the program's arguments."""
|
||||
words = split_words(text)
|
||||
if "%command%" not in words:
|
||||
return {}, words
|
||||
@@ -352,7 +322,6 @@ def split_options(text):
|
||||
|
||||
|
||||
def find_file(base, relative):
|
||||
"""base/relative, matching each part without regard to case as Windows does."""
|
||||
path = base
|
||||
for part in [p for p in relative.replace("\\", "/").split("/") if p and p != "."]:
|
||||
exact = os.path.join(path, part)
|
||||
@@ -379,7 +348,6 @@ def steam_install(appid, root):
|
||||
|
||||
|
||||
def steam_launch(appid, root):
|
||||
"""(target, program, arguments) for a Steam game's default Windows launch option, or None."""
|
||||
library, install = steam_install(appid, root)
|
||||
if not install or not os.path.isdir(install):
|
||||
return None
|
||||
@@ -406,7 +374,6 @@ def shortcut_target(appid, program, start, root):
|
||||
|
||||
|
||||
def steam_launches(target, program, root):
|
||||
"""Whether a launch option of the Steam game starts [program]: then Steam should start it."""
|
||||
if target.kind != "steam":
|
||||
return False
|
||||
entry = compat()["appinfo_entries"](os.path.join(root, "appcache", "appinfo.vdf")).get(target.appid, {})
|
||||
|
||||
@@ -144,8 +144,6 @@ unseed() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# The ledger lines whose values the registry still holds, in both views where we wrote both. A Proton
|
||||
# update replaces its default_pfx system.reg but not our ledger beside it, and new prefixes copy both.
|
||||
present() { awk -F'\t' -v hive="$hive" '
|
||||
NR == FNR {
|
||||
path = $1
|
||||
|
||||
@@ -138,7 +138,6 @@ run_gamescope() (
|
||||
local status_file child_status compositor_status
|
||||
status_file=$(mktemp "${XDG_RUNTIME_DIR:-/tmp}/droiddeck-steam-exit.XXXXXX") || exit 73
|
||||
trap 'rm -f "$status_file"' EXIT
|
||||
# Gamescope can return success when its primary child crashed.
|
||||
BL_STEAM_EXIT_FILE="$status_file" gamescope "$@"
|
||||
compositor_status=$?
|
||||
if read -r child_status < "$status_file" && [[ $child_status =~ ^[0-9]{1,3}$ ]] \
|
||||
@@ -305,8 +304,6 @@ if [ -z "${BL_INSIDE:-}" ]; then
|
||||
echo "== gamescope: games at ${nested}x${nested_h} stretched to the ${width}x${height} output"
|
||||
fi
|
||||
fi
|
||||
# Off unless Performance asks for it. Compositing the cursor here adds a second
|
||||
# plane on the phone's compositor; a controller-driven cursor is the reason to turn it on.
|
||||
if [ "$mode" = steam ] && [ "${BL_CURSOR_COMPOSITE:-0}" = 1 ]; then
|
||||
export gamescope_cursor_composite=2
|
||||
fi
|
||||
@@ -317,7 +314,6 @@ if [ -z "${BL_INSIDE:-}" ]; then
|
||||
fi
|
||||
if [ "${BL_REFRESH:-0}" -gt 0 ]; then
|
||||
args+=(-r "$BL_REFRESH")
|
||||
# -r is the starting rate; gamescope follows the panel when it switches modes later.
|
||||
export GAMESCOPE_NESTED_REFRESH_FOLLOWS_HOST=1
|
||||
fi
|
||||
[ "$mode" = steam ] && [ "${BL_STEAM_UI:-}" != desktop ] && args+=(-e)
|
||||
@@ -336,10 +332,8 @@ if [ -z "${BL_INSIDE:-}" ]; then
|
||||
args+=(--mangoapp)
|
||||
echo "== gamescope: mangoapp on ($(command -v mangoapp), config $MANGOHUD_CONFIGFILE)"
|
||||
fi
|
||||
# gamescope writes the frame times the app's HUD shows here (patch 0125).
|
||||
mkdir -p /run/droiddeck-hud && export DROIDDECK_HUD_FRAMES=/run/droiddeck-hud/frames
|
||||
export BL_INSIDE=1
|
||||
# A fixed path: left to itself gamescope creates a new limiter state file on every start.
|
||||
rm -f "${XDG_RUNTIME_DIR:-/tmp}"/gamescope-limiter-*
|
||||
export GAMESCOPE_LIMITER_FILE="${XDG_RUNTIME_DIR:-/tmp}/droiddeck-gamescope-limiter"
|
||||
rm -f "$GAMESCOPE_LIMITER_FILE"
|
||||
@@ -469,7 +463,6 @@ case $mode in
|
||||
steam_cef_gpu=1
|
||||
if [ "$steam_x64" = 1 ]; then
|
||||
step "checking the Steam client's arm64 parts (first run downloads them, ~1-2 min)"
|
||||
# droiddeck-steam-install removes the repair request: read it first so Repair Steam covers both clients.
|
||||
_bl_x64_repair=0
|
||||
[ -e "$HOME/.bl-steam-repair" ] && _bl_x64_repair=1
|
||||
droiddeck-steam-install || steam_setup_failed $?
|
||||
@@ -554,7 +547,6 @@ case $mode in
|
||||
for _d in /proc/[0-9]*; do
|
||||
[ "${_d##*/}" != "$BASHPID" ] || continue
|
||||
_args=()
|
||||
# Under FEX the program is FEX's first argument. AppId= is its own argument.
|
||||
while IFS= read -r -d '' _c; do _args+=("$_c"); done 2>/dev/null < "$_d/cmdline" || true
|
||||
[ "${#_args[@]}" -gt 0 ] || continue
|
||||
_name=${_args[0]} _fex=0
|
||||
@@ -614,7 +606,6 @@ case $mode in
|
||||
_bl_rss=$_rss
|
||||
echo "$# processes, resident $((_rss / 1024)) MB, in zram $((_swap / 1024)) MB"
|
||||
}
|
||||
# Only processes that loaded libblsession are the session's own and answer SIGURG.
|
||||
bl_session_others() {
|
||||
local _p
|
||||
_bl_session=()
|
||||
@@ -630,8 +621,6 @@ case $mode in
|
||||
_pids=("${_bl_pids[@]}")
|
||||
fi
|
||||
}
|
||||
# Same protocol as SessionSuspendController: an empty ack when the page-out starts, a byte when it is done.
|
||||
# A process whose SIGURG handler was replaced never acks, so it is not waited for after the first 2 s.
|
||||
bl_zram_wait() {
|
||||
local _p _left _start=$SECONDS
|
||||
while [ $((SECONDS - _start)) -lt 12 ]; do
|
||||
@@ -659,9 +648,6 @@ case $mode in
|
||||
bl_zram_pick "$_which"
|
||||
step "zRAM: done ($(bl_zram_usage "${_pids[@]}"))"
|
||||
}
|
||||
# Proton starts its reaper before the game window; compressing during launch stalls it.
|
||||
# Desktop Steam has no focus.json, so it still uses the game process as its trigger.
|
||||
# A configured RAM cap can still force compression while a game is launching.
|
||||
bl_game_focused() {
|
||||
if [ "${BL_DESKTOP:-}" = 1 ] || [ -z "${BL_LAUNCH_DIR:-}" ]; then
|
||||
return 0
|
||||
@@ -690,7 +676,6 @@ case $mode in
|
||||
bl_zram_scan
|
||||
if bl_cap_due; then
|
||||
if bl_over_cap; then
|
||||
# A cap below the game's working set cannot be met; paging out again every 30 s only churns.
|
||||
if [ "$_bl_capped" -lt 0 ] || [ $((SECONDS - _bl_capped)) -ge "$_bl_backoff" ]; then
|
||||
bl_zram_usage "${_bl_pids[@]}" > /dev/null
|
||||
if [ "$_bl_rss" -ge $((512 * 1024)) ]; then
|
||||
@@ -879,14 +864,11 @@ case $mode in
|
||||
until [ "$(_bl_focused)" = 769 ] || [ "$SECONDS" -ge "$_bl_end" ]; do
|
||||
sleep 1
|
||||
done
|
||||
# Shortcut CGameIDs are 64-bit; Steam app ids fit in 32 bits and keep the old short delay.
|
||||
[ "${#game}" -gt 10 ] && shortcut=1
|
||||
[ -n "$shortcut" ] || sleep 4
|
||||
echo "== steam: interface up; launching the requested game $game"
|
||||
_bl_hand_off
|
||||
[ -n "$shortcut" ] || return 0
|
||||
# Steam can drop a shortcut launch it gets before the shortcut's overview exists (large libraries).
|
||||
# A launch can be running before it creates its first window.
|
||||
while [ "$(_bl_focused)" = 769 ] && [ "$waited" -lt 20 ]; do
|
||||
sleep 1
|
||||
waited=$((waited + 1))
|
||||
@@ -978,13 +960,11 @@ case $mode in
|
||||
exit 69
|
||||
fi
|
||||
|
||||
# The UI bridge launches SteamVR, which needs the guest agent's library environment.
|
||||
_bl_compat_env=(env -u LD_LIBRARY_PATH -u STEAM_RUNTIME -u STEAM_STEAMRT_RECURSION_GUARD)
|
||||
[ "${LD_LIBRARY_PATH+x}" ] && _bl_compat_env+=("LD_LIBRARY_PATH=$LD_LIBRARY_PATH")
|
||||
[ "${STEAM_RUNTIME+x}" ] && _bl_compat_env+=("STEAM_RUNTIME=$STEAM_RUNTIME")
|
||||
[ "${STEAM_STEAMRT_RECURSION_GUARD+x}" ] && _bl_compat_env+=("STEAM_STEAMRT_RECURSION_GUARD=$STEAM_STEAMRT_RECURSION_GUARD")
|
||||
export STEAM_RUNTIME=1
|
||||
# A containerized client re-executes itself through pressure-vessel-wrap (bwrap) unless told it is already inside.
|
||||
export STEAM_STEAMRT_RECURSION_GUARD=1
|
||||
export LD_LIBRARY_PATH=$steam_root/steamrtarm64:$steam_root/steamrtarm64/panorama${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
||||
export SDL_VIDEO_X11_DGAMOUSE=0
|
||||
@@ -1238,7 +1218,6 @@ case $mode in
|
||||
compat_restarts=0
|
||||
compat_settled() {
|
||||
local app m flags r card=/mnt/droiddeck-sd
|
||||
# The arm64 card library may hold that client's copy of the same title.
|
||||
[ "$steam_x64" = 1 ] && card=/mnt/droiddeck-sd/x86-64
|
||||
while read -r app; do
|
||||
[ -n "$app" ] || continue
|
||||
@@ -1355,7 +1334,6 @@ case $mode in
|
||||
lossless_left=0
|
||||
elif ! pgrep -x wineserver >/dev/null 2>&1; then
|
||||
(
|
||||
# The probe reaches the x86-64 client through the arm64 client's steamclient.so, as the import watcher does.
|
||||
if [ "$steam_x64" = 1 ]; then export BL_STEAMCLIENT=$XDG_DATA_HOME/Steam/steamrtarm64/steamclient.so; fi
|
||||
answer=$(droiddeck-steam-games probe "$steam_root" 993090 2>/dev/null) || exit 0
|
||||
case $answer in
|
||||
@@ -1415,7 +1393,6 @@ case $mode in
|
||||
BL_COMPAT_TOOL=$_bl_x64_tool droiddeck-steam-shortcuts "$steam_root" "$BL_ADDED_GAMES" || true
|
||||
fi
|
||||
fi
|
||||
# The x86-64 client rewrote config.vdf from memory on exit, over the live passes' mapping.
|
||||
if [ "$steam_x64" = 1 ]; then
|
||||
[ -z "${_bl_x64_tool:-}" ] ||
|
||||
BL_COMPAT_TOOL=$_bl_x64_tool steam-compatibility "$steam_root" --x64 >/dev/null 2>&1 || true
|
||||
|
||||
@@ -233,10 +233,6 @@ SWITCH_JS = r"""
|
||||
})()
|
||||
""".replace("__BINDING__", SWITCH_BINDING)
|
||||
SESSION_SELECT = "/usr/bin/steamos-session-select"
|
||||
# Steam opens its Steam Controller welcome tour at every start while the client setting
|
||||
# controller_show_ibex_tour (CMsgClientSettings field 140014) is on, and only a finished tour turns it
|
||||
# off; closing it leaves it on. The app's pad is an emulated controller, so the tour never applies.
|
||||
# A pending firmware update still opens Steam's updater, which checks the update priority instead.
|
||||
TOUR_JS = r"""
|
||||
(() => {
|
||||
let key = 140014 * 8;
|
||||
@@ -247,13 +243,6 @@ TOUR_JS = r"""
|
||||
return "off";
|
||||
})()
|
||||
"""
|
||||
# Steam keeps the Quick Access Frame Limit as the client setting gamescope_app_target_framerate
|
||||
# (CMsgClientSettings field 21002) and offers the values gamescope's display state lists in
|
||||
# active_display_info.supported_frame_rates. When the panel's refresh rate changes, a remembered
|
||||
# limit that is not one of the new values leaves the slider on its first value while the game runs
|
||||
# at the old limit. The limit is kept when it is still offered and moved to the highest value
|
||||
# otherwise. Choices are read once they have been unchanged for a moment, since a mode switch can
|
||||
# report a passing rate first.
|
||||
FRAME_LIMIT_JS = r"""
|
||||
(() => {
|
||||
if (window.__droiddeckFrameLimit) return "present";
|
||||
@@ -426,7 +415,6 @@ VR_JS = r"""
|
||||
|
||||
|
||||
def launch_steamvr():
|
||||
"""Keep downloads/startup off the Steam UI bridge's event loop."""
|
||||
say("SteamVR library launch: using the DroidDeck ARM64 helper")
|
||||
state = os.path.join(os.environ.get("XDG_RUNTIME_DIR", "/tmp"), "droiddeck-steamvr")
|
||||
try:
|
||||
@@ -780,7 +768,6 @@ class Helper:
|
||||
pass
|
||||
|
||||
def sync_frame_limit(self):
|
||||
# Steam can still be loading its settings and gamescope state when the helper attaches.
|
||||
if self.frame_limit_state in ("installed", "present") or time.monotonic() < self.frame_limit_retry:
|
||||
return
|
||||
try:
|
||||
@@ -806,8 +793,6 @@ class Helper:
|
||||
self.finish_chooser(ident, None)
|
||||
return
|
||||
command = [sys.executable, os.path.realpath(__file__), "--choose-file"]
|
||||
# Gamescope shows the dialog over the client by the AppId on a reaper above it; the x86-64 client has no
|
||||
# native reaper, so the arm64 client's is borrowed when it is installed.
|
||||
data = os.environ.get("XDG_DATA_HOME") or os.path.join(os.path.expanduser("~"), ".local", "share")
|
||||
for root in (self.steam_root, os.path.join(data, "Steam")):
|
||||
reaper = os.path.join(root, "steamrtarm64", "reaper")
|
||||
@@ -879,7 +864,6 @@ class Helper:
|
||||
try:
|
||||
page.evaluate(TOUR_JS)
|
||||
except RuntimeError:
|
||||
# The optional tour setting must not block the compat bridge.
|
||||
pass
|
||||
if not self.steamos:
|
||||
page.call("Runtime.addBinding", {"name": SWITCH_BINDING})
|
||||
@@ -916,7 +900,6 @@ class Helper:
|
||||
prior_auto = state.get("auto", {})
|
||||
if not isinstance(prior_auto, dict):
|
||||
prior_auto = {}
|
||||
# "native" from earlier builds also lists dual-platform games nobody chose to run natively.
|
||||
prior_native = state.get("native_choices", ())
|
||||
native_choices = set(prior_native if isinstance(prior_native, (list, tuple, set)) else ())
|
||||
picked = COMPAT["picked_apps"](state)
|
||||
@@ -948,7 +931,6 @@ class Helper:
|
||||
else:
|
||||
for app in set(native) | native_choices:
|
||||
if app in raw_mapping:
|
||||
# The client shows an explicit native choice as the tool it inherits, and writes config.vdf late.
|
||||
if raw_mapping[app] == "" or current.get(app) not in self.known:
|
||||
current[app] = raw_mapping[app]
|
||||
elif app in prior_auto or app in native_choices or app in picked and (
|
||||
@@ -981,7 +963,6 @@ class Helper:
|
||||
COMPAT["write_json"](state_file, state)
|
||||
|
||||
def ensure_tools(self):
|
||||
"""Proton, FEX and the runtimes FEX needs are fetched as soon as the client is up, never left pending."""
|
||||
now = time.monotonic()
|
||||
if self.tools_checked is not None and now - self.tools_checked < TOOL_CHECK_SECONDS:
|
||||
return
|
||||
@@ -1007,7 +988,6 @@ class Helper:
|
||||
return isinstance(request.get("seq"), int) and request["seq"] > int(state.get("applied", 0) or 0)
|
||||
|
||||
def drain(self):
|
||||
"""The page's events; a switch to the desktop is acted on as it comes."""
|
||||
events = self.page.drain()
|
||||
if any(called(e, SWITCH_BINDING) for e in events):
|
||||
switch_to_desktop()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Honor a desktop launch even when Steam remembers Big Picture from its last session."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Resolve added games against the signed-in Steam client's licenses."""
|
||||
import ctypes as C
|
||||
import json
|
||||
import os
|
||||
@@ -66,8 +65,6 @@ def source_stamp(game):
|
||||
|
||||
|
||||
def store_game(game):
|
||||
"""Games a store client installed belong to that store: the Steam copy of the same title is
|
||||
another license with its own files, and an import would let Steam update over the store's."""
|
||||
return bool(game.get("store"))
|
||||
|
||||
|
||||
@@ -150,7 +147,6 @@ def probe(steam_root, ids):
|
||||
|
||||
|
||||
def game_running():
|
||||
"""Whether a Proton game is up: a wineserver is there for as long as any prefix is in use."""
|
||||
try:
|
||||
pids = [p for p in os.listdir("/proc") if p.isdigit()]
|
||||
except OSError:
|
||||
@@ -173,8 +169,6 @@ def downloads_idle(steam_root):
|
||||
|
||||
|
||||
def request_restart(steam_root):
|
||||
"""The client reads manifests and shortcuts only at start, so an import needs one restart;
|
||||
the session's loop runs the importer between the exit and the next start."""
|
||||
Path(os.environ.get("HOME", "/root"), ".bl-restart-once").touch()
|
||||
command = shlex.split(os.environ.get("BL_STEAM_SHUTDOWN", "")) or [str(Path(steam_root) / "steamrtarm64/steam"), "-shutdown"]
|
||||
subprocess.run(command,
|
||||
@@ -182,7 +176,6 @@ def request_restart(steam_root):
|
||||
|
||||
|
||||
def ask_restart(names, timeout=600, clock=None, sleep=None):
|
||||
"""The app asks whether to restart the client now; anything but "now" leaves the import to the next start."""
|
||||
clock, sleep = clock or time.monotonic, sleep or time.sleep
|
||||
folder = Path(os.environ.get("HOME", "/root"), ".cache/droiddeck")
|
||||
ask, answer = folder / "steam-import.json", folder / "steam-import.answer"
|
||||
@@ -296,8 +289,6 @@ def watch(steam_root, listing):
|
||||
|
||||
|
||||
def installed_build(folder, appid, installdir):
|
||||
"""The build another Steam client recorded for these files, so Steam updates from it
|
||||
instead of verifying every file."""
|
||||
try:
|
||||
text = (folder.parent / WINNATIVE / f"appmanifest_{appid}.acf").read_text()
|
||||
install = re.search(r'("installdir"\s*")([^"\\]*)(")', text, re.I)
|
||||
@@ -425,8 +416,6 @@ def seed_install(steam_root, game, appid):
|
||||
|
||||
|
||||
def release(steam_root, game, stale, reason):
|
||||
"""Undoes the imports of the game's folder as the Steam apps [stale] picks. Only our symlink and
|
||||
manifest go; the folder stays where it is."""
|
||||
steamapps = Path(steam_root) / "steamapps"
|
||||
sources = {game.get("folder", ""), legacy_path(game.get("folder", ""))}
|
||||
for target in sorted((steamapps / "common").glob("DroidDeck-*")):
|
||||
|
||||
@@ -227,7 +227,6 @@ mkdir -p "$HOME/.steam"
|
||||
ln -sfn "$steam_root" "$HOME/.steam/root"
|
||||
ln -sfn "$steam_root" "$HOME/.steam/steam"
|
||||
ln -sfn "$steam_root/steamrtarm64" "$HOME/.steam/bin64"
|
||||
# sdk64 is where x86_64 Steamworks looks for steamclient.so; arm64 builds look in sdkarm64.
|
||||
ln -sfn "$steam_root/linux64" "$HOME/.steam/sdk64"
|
||||
ln -sfn "$steam_root/linuxarm64" "$HOME/.steam/sdkarm64"
|
||||
ln -sfn "$steam_root/steamrtarm64" "$HOME/.steam/binarm64"
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Sets the Steam client's interface language to the app's, before the client starts.
|
||||
|
||||
droiddeck-steam-language <home> <language>
|
||||
|
||||
<language> is one of the client's language names (english, spanish, latam, japanese, koreana,
|
||||
schinese, tchinese, ...). The client reads it from <home>/.steam/registry.vdf, under
|
||||
HKCU/Software/Valve/Steam and again under .../Steamsteamglobal: that second key is copied over the
|
||||
first at every start, so setting only the first is undone by the old value. Its update window
|
||||
reads the first key alone, and nothing reads LANG. exportedsettings.json is what the client writes
|
||||
beside them when its own setting changes. The session also passes -language, which the interface
|
||||
honours over the file; the file is still what the update window shows itself in.
|
||||
|
||||
Run only while the client is stopped: it keeps the registry in memory and writes it back on exit.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@@ -63,7 +49,6 @@ def serialize(tokens):
|
||||
|
||||
|
||||
def block_end(tokens, start):
|
||||
"""Index of the '}' closing the block whose '{' is at start."""
|
||||
depth = 0
|
||||
for i in range(start, len(tokens)):
|
||||
if tokens[i] == "{":
|
||||
@@ -76,8 +61,6 @@ def block_end(tokens, start):
|
||||
|
||||
|
||||
def child(tokens, start, end, name):
|
||||
"""Index of the '{' of the block called name directly inside tokens[start:end], or None.
|
||||
Keys are matched without case, as the client does."""
|
||||
i = start
|
||||
while i < end:
|
||||
if tokens[i] in ("{", "}"):
|
||||
@@ -93,7 +76,6 @@ def child(tokens, start, end, name):
|
||||
|
||||
|
||||
def ensure_block(tokens, path):
|
||||
"""The '{' of the block at path, creating it and any missing parent at the end of its parent."""
|
||||
start, end = 0, len(tokens)
|
||||
for depth, name in enumerate(path):
|
||||
found = child(tokens, start, end, name)
|
||||
|
||||
@@ -9,9 +9,6 @@ MAIN_LABEL = "Internal Storage"
|
||||
|
||||
|
||||
def register(steam_root, library, label):
|
||||
"""Adds one library folder to the client's list; the client then offers it as an install
|
||||
location as well as reading the games already in it. Registered even when empty: a new user
|
||||
should be able to install straight into it."""
|
||||
steamapps = os.path.join(library, "steamapps")
|
||||
if not os.path.isdir(steamapps):
|
||||
return 0
|
||||
@@ -58,8 +55,6 @@ RENAMED = (("/mnt/bannerlator-sd", "/mnt/droiddeck-sd"),)
|
||||
|
||||
|
||||
def rename(steam_root, old, new):
|
||||
"""Moves a library registered under an earlier mount point to the current one, keeping its
|
||||
entry (content id, app sizes) rather than registering it anew."""
|
||||
path = os.path.join(steam_root, "steamapps", "libraryfolders.vdf")
|
||||
if not os.path.isfile(path):
|
||||
return
|
||||
@@ -77,8 +72,6 @@ def rename(steam_root, old, new):
|
||||
|
||||
|
||||
def forget(steam_root, library):
|
||||
"""Removes a library folder earlier builds registered and this one no longer binds, so the
|
||||
client does not keep offering a location that is not there."""
|
||||
path = os.path.join(steam_root, "steamapps", "libraryfolders.vdf")
|
||||
if not os.path.isfile(path):
|
||||
return
|
||||
@@ -107,10 +100,6 @@ def forget(steam_root, library):
|
||||
|
||||
|
||||
def relabel(steam_root, target, label):
|
||||
"""Names a library for what it is. The client writes its own entry with an empty label and
|
||||
falls back to showing the mount point - "Local Drive (/)" - so the install dialog gives no
|
||||
clue which of the two places is the phone and which is the card. A library registered on an
|
||||
earlier run keeps whatever label it was given then, so both are named here every time."""
|
||||
path = os.path.join(steam_root, "steamapps", "libraryfolders.vdf")
|
||||
if not os.path.isfile(path):
|
||||
return
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Sets the Steam client's shader pre-caching (Settings > Downloads), before the client starts.
|
||||
|
||||
droiddeck-steam-shaders <0|1> <steam root>...
|
||||
|
||||
The client stores the toggle as InstallConfigStore/Software/Valve/Steam/ShaderCacheManager/
|
||||
DisableShaderCache in config/config.vdf: "1" when off, "0" when on. It keeps the setting in memory
|
||||
and writes config.vdf back on exit, so this runs only while the client is stopped. The launcher
|
||||
passes a value only after its own toggle changes; otherwise the client's toggle stays the user's."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
import sys
|
||||
|
||||
@@ -16,7 +16,6 @@ TAG = "droiddeck-app"
|
||||
|
||||
|
||||
def account_dir(steam_root):
|
||||
"""The most recent account's userdata folder, else the only one that is not 0."""
|
||||
users = os.path.join(steam_root, "config", "loginusers.vdf")
|
||||
recent, best = None, None
|
||||
try:
|
||||
@@ -243,9 +242,6 @@ ART_SLOTS = (("p", "p"), ("header", ""), ("hero", "_hero"), ("logo", "_logo"))
|
||||
|
||||
|
||||
def install_art(acct, games):
|
||||
"""Copies each game's art into the client's grid folder under the names it looks for. A file
|
||||
the client already has that this script did not write (art the user set in the client) is
|
||||
left alone; ours are replaced when the source changed and removed when the game lost its art."""
|
||||
grid = os.path.join(acct, "config", "grid")
|
||||
os.makedirs(grid, exist_ok=True)
|
||||
manifest_path = os.path.join(grid, ART_MANIFEST)
|
||||
@@ -354,7 +350,6 @@ def main():
|
||||
if x64_tool:
|
||||
protect = {compat.first_key(os.path.join(tools, e, "compatibilitytool.vdf"), ["compatibilitytools", "compat_tools"]) or e: e
|
||||
for e in (os.listdir(tools) if os.path.isdir(tools) else [])}
|
||||
# Its own state: the arm64 client's state.json lists which of that client's titles follow its default.
|
||||
own = {"default": x64_tool,
|
||||
"directory": os.path.join(os.path.dirname(os.path.abspath(steam_root)), "droiddeck-compat"),
|
||||
"linux_tool": "droiddeck-direct"}
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Initialize Steam's own display settings once; subsequent choices belong to Steam.
|
||||
|
||||
The UI scale, and native resolution: the client treats our gamescope as an external display and,
|
||||
unless "Enable Native Resolution on External Displays" is on, draws itself at 1920x1080 on any
|
||||
larger output - a 2340x1080 session came up as 16:9 with bars. The session's size is already the
|
||||
user's Resolution choice, so the client should use all of it.
|
||||
|
||||
And the screensaver over a running game. The client's defaults (steamui.so's settings descriptor)
|
||||
show screensavers while a game runs, after 300 s on AC power with no button pressed - and a stick or
|
||||
trigger held is no press. Red Dead Redemption 2's cutscenes run longer than that: the slideshow
|
||||
covered the game, and the button that woke it reached the game as well (B asked to quit to the
|
||||
desktop). Customization > Screensaver > "Show screensavers when playing a game" still turns it on."""
|
||||
import math
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -116,8 +104,6 @@ def seed_text(text, scale):
|
||||
|
||||
|
||||
def seed_value(text, path, value):
|
||||
"""InstallConfigStore/<path> = value, unless the client already has a value there (the
|
||||
user's), adding only the blocks that are missing."""
|
||||
root = parse(text).get('InstallConfigStore')
|
||||
if not isinstance(root, Block):
|
||||
raise ValueError("missing InstallConfigStore")
|
||||
@@ -170,9 +156,6 @@ def initialize(steam_root, width, height):
|
||||
|
||||
|
||||
def seed_once(steam_root, marker_name, seed, message):
|
||||
"""Applies seed to config.vdf the first time only: the marker keeps a later choice - including
|
||||
a return to the client's own default, which the client may store by dropping the key - the
|
||||
user's."""
|
||||
config = Path(steam_root) / 'config/config.vdf'
|
||||
marker = config.with_name(marker_name)
|
||||
if marker.exists():
|
||||
|
||||
@@ -3,7 +3,6 @@ set -eu
|
||||
ROOTFS_URL=https://github.com/Droid-Deck/DroidDeck-Components/releases/download/fex-rootfs-ubuntu-24.04-2026-08-11/Ubuntu_24_04.sqsh
|
||||
ROOTFS_SHA256=2854b06d3ff1b8f6e526135bfb6dd5b7b30ab3ab73e79ae933a3d9fed959a178
|
||||
CDN=https://client-update.fastly.steamstatic.com
|
||||
# Must match the -clientbeta droiddeck-session starts this client with (steam_channel).
|
||||
X64_CHANNEL=steamdeck_publicbeta
|
||||
MANIFEST=steam_client_${X64_CHANNEL}_steamrt64
|
||||
|
||||
@@ -78,7 +77,6 @@ x64_sync_client() {
|
||||
rm -rf "$work"
|
||||
}
|
||||
|
||||
# The client rewrites config.vdf from memory as it exits: the mapping is written only while no x86 client runs.
|
||||
x64_map_direct() {
|
||||
local mode=write
|
||||
[ "${1:-}" = --live ] && mode=live
|
||||
@@ -317,7 +315,6 @@ print("droiddeck-steam-x64: %d Linux title(s) on DroidDeck direct (%d on the new
|
||||
PY
|
||||
}
|
||||
|
||||
# A resumable download that reports every tenth of its size as a step.
|
||||
x64_fetch() {
|
||||
local url=$1 out=$2 label=$3 total pid rc=0 last=-1 pct
|
||||
total=$(curl -fsSIL "$url" 2>/dev/null | tr -d '\r' | awk 'tolower($1) == "content-length:" { v = $2 } END { print v + 0 }')
|
||||
@@ -336,11 +333,9 @@ x64_fetch() {
|
||||
x64_prepare() {
|
||||
fex_ready || { step "FEX could not be installed; see $LOG"; exit 1; }
|
||||
step "FEX ready ($FEX_NOW, $FEX_FROM)"
|
||||
# The client's opt-in to its SteamRT3 build; without it, it re-executes through steam.sh, whose checks fail under proot.
|
||||
mkdir -p "$STEAM_X64" && : > "$STEAM_X64/.steam-enable-steamrt64-client"
|
||||
|
||||
if [ ! -f "$ROOTFS/.droiddeck-complete" ]; then
|
||||
# Resumes a part-done download; a finished one answers 416, which is not a failure here.
|
||||
x64_fetch "$ROOTFS_URL" "$X64_HOME/rootfs.sqsh" "downloading FEX's Ubuntu 24.04 x86 rootfs" || {
|
||||
rc=$?
|
||||
[ "$rc" = 22 ] && [ -s "$X64_HOME/rootfs.sqsh" ] || { step "rootfs download failed (curl $rc)"; exit 1; }
|
||||
@@ -356,13 +351,9 @@ if [ ! -f "$ROOTFS/.droiddeck-complete" ]; then
|
||||
touch "$ROOTFS/.droiddeck-complete"
|
||||
fi
|
||||
echo "== x86-64 rootfs: $(sed -n 's|.*/download/\([^/]*\)/.*|\1|p' <<<"$ROOTFS_URL") (sha256 ${ROOTFS_SHA256:0:12})" >&2
|
||||
# FEX falls back to the guest's own /etc/ld.so.preload (arm64 libraries) when the rootfs has none. The x86
|
||||
# session shim provides System V IPC, which Android kernels lack and the client's tier0 needs to start.
|
||||
: > "$ROOTFS/etc/ld.so.preload"
|
||||
for lib in libblsession libfakeinput; do
|
||||
have=0
|
||||
# 32-bit libfakeinput crashes SDL2 games (a NULL udev attribute reaches strdup), so only the x86_64 copy
|
||||
# is preloaded, by full path: with $LIB, FEX falls through to the session's own i386 copy.
|
||||
arches="x86_64 i386"; [ "$lib" = libfakeinput ] && arches=x86_64
|
||||
rm -f "$ROOTFS/usr/local/lib/i386-linux-gnu/libfakeinput.so"
|
||||
for arch in $arches; do
|
||||
@@ -439,7 +430,6 @@ if [ -f "$scout/steam-runtime.tar.xz" ] &&
|
||||
fi
|
||||
[ -L "$STEAM_X64/steamapps" ] && rm -f "$STEAM_X64/steamapps"
|
||||
mkdir -p "$STEAM_X64/steamapps"
|
||||
# FEX looks in the rootfs first: an empty dev/dri there hides the session's KGSL node, which x86 programs spin on.
|
||||
mkdir -p "$ROOTFS/dev/dri"
|
||||
mkdir -p "$X64_HOME/.steam"
|
||||
ln -sfn "$STEAM_X64" "$X64_HOME/.steam/root"
|
||||
@@ -448,9 +438,7 @@ ln -sfn "$STEAM_X64/ubuntu12_32" "$X64_HOME/.steam/bin32"
|
||||
ln -sfn "$STEAM_X64/ubuntu12_64" "$X64_HOME/.steam/bin64"
|
||||
ln -sfn "$STEAM_X64/linux32" "$X64_HOME/.steam/sdk32"
|
||||
ln -sfn "$STEAM_X64/linux64" "$X64_HOME/.steam/sdk64"
|
||||
# Valve's Steam Runtime container needs user namespaces and a session-bus launcher; steamrt-shim stands in for both.
|
||||
droiddeck-steamrt-shim "$STEAM_X64/steamrt64" "$X64_HOME/steamrt-shim" || rm -rf "$X64_HOME/steamrt-shim"
|
||||
# Valve's platform libraries ship without soname links (pressure-vessel makes them); ldconfig adds them here.
|
||||
srt_libs=$X64_HOME/steamrt-libs
|
||||
rm -rf "$srt_libs"
|
||||
mkdir -p "$srt_libs"
|
||||
@@ -460,13 +448,11 @@ for d in "$STEAM_X64"/steamrt64/pv-runtime/steam-runtime-steamrt/steamrt3c_platf
|
||||
for f in "$d"/*.so*; do [ -e "$srt_libs/$(basename "$f")" ] || ln -s "$f" "$srt_libs/"; done
|
||||
done
|
||||
FEX_ROOTFS=$ROOTFS /usr/local/bin/FEX "$ROOTFS/usr/sbin/ldconfig.real" -n "$srt_libs" >>"$LOG" 2>&1 || step "ldconfig on $srt_libs failed"
|
||||
# The rootfs's HarfBuzz needs a newer FreeType than some games bundle (Counter-Strike 2): use Valve's runtime one.
|
||||
sniper_compat=$X64_HOME/sniper-compat
|
||||
rm -rf "$sniper_compat"
|
||||
mkdir -p "$sniper_compat"
|
||||
hb=$(ls "$srt_libs"/libharfbuzz.so.0.* 2>/dev/null | head -n 1)
|
||||
if [ -n "$hb" ]; then ln -s "$hb" "$sniper_compat/libharfbuzz.so.0"; else step "warning: no HarfBuzz in Valve's runtime for the newer-runtime titles"; fi
|
||||
# LD_LIBRARY_PATH beats the system folders whatever its order: Valve's older glibc must not shadow the rootfs's.
|
||||
for f in "$srt_libs"/*; do
|
||||
n=$(basename "$f")
|
||||
if [ -e "$ROOTFS/usr/lib/x86_64-linux-gnu/$n" ] || [ -e "$ROOTFS/lib/x86_64-linux-gnu/$n" ]; then rm -f "$f"; fi
|
||||
@@ -540,7 +526,6 @@ RUN
|
||||
fi
|
||||
x64_share x86-64
|
||||
x64_map_direct
|
||||
# Each wrapper execs droiddeck-x64-arm-proton through an arm64 binary, which FEX hands straight to the CPU.
|
||||
arm_tools=$ARM_STEAM/compatibilitytools.d
|
||||
mkdir -p "$X64_HOME/arm64"
|
||||
cp -f /usr/bin/env "$X64_HOME/arm64/env"
|
||||
@@ -552,7 +537,6 @@ RUN
|
||||
for src in "$arm_tools"/*/; do
|
||||
src=${src%/}; name=${src##*/}
|
||||
[ -f "$src/compatibilitytool.vdf" ] && [ -f "$src/toolmanifest.vdf" ] || continue
|
||||
# A droiddeck-fex wrapper made the arm64 client install Valve's FEX when this client probed its tools after logon.
|
||||
case $name in droiddeck-direct|droiddeck-fex) continue ;; esac
|
||||
dst=$STEAM_X64/compatibilitytools.d/$name
|
||||
mkdir -p "$dst"
|
||||
@@ -585,7 +569,6 @@ VDF
|
||||
chmod 755 "$dst/run"
|
||||
done
|
||||
x64_sync_login
|
||||
# Each client keeps its own libraries; written only while no x86 client runs, as it rewrites these on exit.
|
||||
if ! pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1; then
|
||||
listing_ok=0
|
||||
if BL_X64_SHARED=$X64_HOME/shared/arm64 python3 - "$STEAM_X64" "${BL_X64_STEAM_LIBRARIES:-}" "$STEAM_X64/config/libraryfolders.vdf" "$STEAM_X64/steamapps/libraryfolders.vdf" <<'PY'; then
|
||||
@@ -634,7 +617,6 @@ PY
|
||||
step "could not add the card to the x86-64 client's library folders"
|
||||
fi
|
||||
fi
|
||||
# default-tool is the default this script set: titles still on it move along; a user's choice is kept.
|
||||
default=$(x64_default_dir)
|
||||
if [ -f "$default/compatibilitytool.vdf" ] && [ -f "$STEAM_X64/config/config.vdf" ] &&
|
||||
! pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1; then
|
||||
@@ -709,7 +691,6 @@ s = s[:steam.end()] + movie.group(0) + s[steam.end():]
|
||||
open(path, "w", encoding="utf-8", errors="surrogateescape").write(s)
|
||||
PY
|
||||
fi
|
||||
# FEX takes its rootfs from FEXServer, and one started without FEX_ROOTFS serves none: stop it while no x86 client runs.
|
||||
if ! pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1; then
|
||||
FEX_ROOTFS=$ROOTFS /usr/local/bin/FEXServer -k >/dev/null 2>&1 || true
|
||||
fi
|
||||
@@ -724,7 +705,6 @@ x64_webhelper_gpu() {
|
||||
}
|
||||
|
||||
x64_env() {
|
||||
# droiddeck-x64-arm-proton restores this arm64 environment before Proton runs.
|
||||
export -p | grep -v -E '^declare -x (PWD|OLDPWD|SHLVL|_)=' > "$X64_HOME/arm-session.env.new" || true
|
||||
mv -f "$X64_HOME/arm-session.env.new" "$X64_HOME/arm-session.env"
|
||||
unset LD_LIBRARY_PATH LD_PRELOAD STEAM_RUNTIME STEAM_RUNTIME_PREFER_HOST_LIBRARIES
|
||||
@@ -746,7 +726,6 @@ if x64_gpu && [ "${BL_X64_CLIENT_SOFTWARE:-0}" != 1 ]; then
|
||||
else
|
||||
unset FEX_THUNKCONFIG $gpu_vars
|
||||
export LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe
|
||||
# Over DRI3 the X server hands out the GPU node, and Mesa's software path loops on KMS dumb buffers on it.
|
||||
export LIBGL_DRI3_DISABLE=1
|
||||
fi
|
||||
[ "${BL_X64_FP_OFF:-0}" = 1 ] && export PROOT_FP_OFF=1
|
||||
@@ -759,12 +738,9 @@ export FEX_ROOTFS=$ROOTFS
|
||||
export STEAM_EXTRA_COMPAT_TOOLS_PATHS=
|
||||
export STEAM_RUNTIME=1
|
||||
[ -d "$X64_HOME/steamrt-shim" ] && export STEAM_RUNTIME_STEAMRT=$X64_HOME/steamrt-shim
|
||||
# The client starts commands via steam-runtime-launch-client; Valve's needs a session-bus service, the shim's runs them.
|
||||
[ -d "$X64_HOME/steamrt-shim/bin" ] && export PATH=$X64_HOME/steamrt-shim/bin:$PATH
|
||||
export LD_LIBRARY_PATH=$STEAM_X64/steamrt64:$STEAM_X64/steamrt64/panorama:$X64_HOME/steamrt-libs
|
||||
# After an update the client re-executes itself through pressure-vessel-wrap (bwrap) unless this guard is set.
|
||||
export STEAM_STEAMRT_RECURSION_GUARD=1
|
||||
# proot is a tracer: tier0 takes it for a debugger and breaks into it with int3 on its first failed assertion.
|
||||
export BL_WEBHELPER_HIDE_TRACER=1
|
||||
}
|
||||
|
||||
@@ -774,7 +750,6 @@ x64_manifest_version() {
|
||||
awk -F'"' '$2 == "version" { print $4; exit }' "$STEAM_X64/package/steam_client_${chan}_$1.manifest" 2>/dev/null || echo "?"
|
||||
}
|
||||
|
||||
# What x86 GL and Vulkan look like through FEX's thunks, for a session whose menus failed on the GPU.
|
||||
x64_gpu_probe() {
|
||||
local fex=${BL_FEX:-/usr/local/bin/FEX}
|
||||
echo "== x86-64 GPU probe (x86 glxinfo and vulkaninfo through FEX):"
|
||||
@@ -786,8 +761,6 @@ x64_gpu_probe() {
|
||||
) | sed 's/^/ /'
|
||||
}
|
||||
|
||||
# Steam's menus come from the web helper; when its GPU process keeps exiting, Chromium gives up on the GPU and
|
||||
# the menus never appear. Says so once in the session log, with the probe above.
|
||||
x64_gpu_watch() {
|
||||
local log=$STEAM_X64/logs/console-linux.txt from n codes
|
||||
from=$(( $(wc -l 2>/dev/null < "$log" || echo 0) + 1 ))
|
||||
@@ -801,7 +774,6 @@ x64_gpu_watch() {
|
||||
|
||||
x64_arm_webhelper_cpu_supported() {
|
||||
local status=0
|
||||
# Valve's native ARM web helper contains LSE atomics; missing CPU data cannot establish incompatibility.
|
||||
awk -F: '
|
||||
$1 ~ /^[[:space:]]*Features[[:space:]]*$/ {
|
||||
if ($2 !~ /(^|[[:space:]])atomics([[:space:]]|$)/) unsupported = 1
|
||||
@@ -814,8 +786,6 @@ x64_arm_webhelper_cpu_supported() {
|
||||
x64_exec() {
|
||||
x64_env
|
||||
cd "$STEAM_X64"
|
||||
# The client checksums its files at start and reinstalls over edited ones, so the session shim (preload/net.c)
|
||||
# swaps the web helper at exec. The arm64 helper only comes up against a client of the same build.
|
||||
if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] && [ -x /usr/local/bin/droiddeck-x64-arm-webhelper ] &&
|
||||
[ -x "$ARM_STEAM/steamrtarm64/steamwebhelper" ] && x64_arm_webhelper_cpu_supported; then
|
||||
local chan x86_build arm_build
|
||||
@@ -829,7 +799,6 @@ x64_exec() {
|
||||
fi
|
||||
fi
|
||||
if [ -z "${BL_X64_ARM_WEBHELPER:-}" ] && x64_webhelper_gpu; then
|
||||
# Not --in-process-gpu (the preload's default): a GPU crash there takes the whole helper down.
|
||||
export BL_WEBHELPER_ARGS="--ignore-gpu-blocklist --use-gl=angle --use-angle=gl --ozone-platform=x11"
|
||||
[ -x /usr/local/bin/droiddeck-x64-webhelper ] && export BL_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-webhelper
|
||||
elif [ -z "${BL_X64_ARM_WEBHELPER:-}" ]; then
|
||||
@@ -860,7 +829,6 @@ x64_share() {
|
||||
step "could not share the games between the clients"
|
||||
}
|
||||
|
||||
# Steam renews its token every few days and refuses old copies: copy the newest every start, never while a client runs.
|
||||
x64_sync_login() {
|
||||
pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1 && return 0
|
||||
pgrep -f 'steamrtarm64/steam( |$)' >/dev/null 2>&1 && return 0
|
||||
@@ -996,7 +964,6 @@ if [ -n "${BL_FEXSERVER_LOG:-}" ]; then
|
||||
FEX_ROOTFS=$ROOTFS "$(dirname "${BL_FEX:-/usr/local/bin/FEX}")/FEXServer" -f -p 600 >"$BL_FEXSERVER_LOG" 2>&1 &
|
||||
sleep 1
|
||||
fi
|
||||
# The client's connection status comes from NetworkManager on the system bus; a desktop has no system bus.
|
||||
x64_bus= x64_nm= x64_pin=
|
||||
x64_cleanup() {
|
||||
[ -n "$x64_pin" ] && kill "$x64_pin" 2>/dev/null
|
||||
@@ -1035,7 +1002,6 @@ BUSCONF
|
||||
step "network: the system bus did not come up; the client will show no connection"
|
||||
fi
|
||||
fi
|
||||
# Left by a killed client: .crash opens the update UI on its spinner; stale Singleton* locks can blank the UI.
|
||||
if ! pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1; then
|
||||
for f in "$STEAM_X64/.crash" "$STEAM_X64/steam.pid" "$STEAM_X64/config/htmlcache/SingletonLock" \
|
||||
"$STEAM_X64/config/htmlcache/SingletonCookie" "$STEAM_X64/config/htmlcache/SingletonSocket"; do
|
||||
@@ -1053,7 +1019,6 @@ if [ -n "${BL_CLIENT_CPUS:-}" ] && command -v taskset >/dev/null 2>&1; then
|
||||
x64_pin=$!
|
||||
fi
|
||||
for attempt in 1 2 3 4 5; do
|
||||
# The branch on disk must match -clientbeta before every start, or the client loops on rc=42.
|
||||
echo "$X64_CHANNEL" > "$STEAM_X64/package/beta"
|
||||
step "starting the x86-64 SteamRT3 client under FEX (attempt $attempt): $*"
|
||||
rc=0
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
#!/bin/bash
|
||||
# droiddeck-steamrt-shim <client runtime dir> <shim dir>
|
||||
# Builds <shim dir> from the Steam Runtime container the client carries and exits 0, or removes it and exits 1
|
||||
# when the client carries none.
|
||||
set -eu
|
||||
client=$1
|
||||
shim=$2
|
||||
@@ -25,13 +22,11 @@ for e in "$srt_real"/bin/*; do
|
||||
[ -e "$e" ] || continue
|
||||
ln -s "$e" "$shim/bin/$(basename "$e")"
|
||||
done
|
||||
# The client's bwrap probe (steam-runtime-check-requirements) needs user namespaces, which no Android app has.
|
||||
rm -f "$shim/bin/steam-runtime-check-requirements"
|
||||
printf '#!/bin/sh
|
||||
exit 0
|
||||
' > "$shim/bin/steam-runtime-check-requirements"
|
||||
chmod 755 "$shim/bin/steam-runtime-check-requirements"
|
||||
# Valve's launcher asks a service on the session bus; proot is already the container, so the command runs here.
|
||||
rm -f "$shim/bin/steam-runtime-launch-client"
|
||||
cat > "$shim/bin/steam-runtime-launch-client" <<'LAUNCH'
|
||||
#!/bin/sh
|
||||
|
||||
@@ -26,7 +26,6 @@ quest_settings() {
|
||||
configure_graphics() {
|
||||
case "$(cat /sys/class/kgsl/kgsl-3d0/gpu_model 2>/dev/null)" in
|
||||
Adreno840*)
|
||||
# The session's forced sysmem mode loses the Vulkan device in SteamVR.
|
||||
export TU_DEBUG="$(
|
||||
IFS=', '
|
||||
set -f
|
||||
@@ -41,8 +40,6 @@ configure_graphics() {
|
||||
esac
|
||||
}
|
||||
|
||||
# Any OpenXR probe (Steam runs one through Proton at every client start) starts vrserver
|
||||
# while a runtime is registered, so SteamVR is registered only during a DroidDeck VR session.
|
||||
unregister() {
|
||||
if grep -qF "\"$steamvr\"" "$HOME/.config/openvr/openvrpaths.vrpath" 2>/dev/null; then
|
||||
rm -f "$HOME/.config/openvr/openvrpaths.vrpath"
|
||||
@@ -78,7 +75,6 @@ stop() {
|
||||
|
||||
case "${1:-status}" in
|
||||
launch)
|
||||
# Library/URL entry point: use the same installer and start path as the app.
|
||||
exec 8>"$state/launch.lock"
|
||||
flock -n 8 || exit 0
|
||||
if ! installed; then
|
||||
@@ -221,7 +217,6 @@ JSON
|
||||
quest_settings apply || exit 1
|
||||
startup_handed_off=0
|
||||
trap '[ "$startup_handed_off" = 1 ] || quest_settings restore' EXIT
|
||||
# The pinned Frame package's CVP constructor exits on Quest's unsupported SoC.
|
||||
cvp=$steamvr/drivers/cv/bin/linuxarm64/libArcturusPerception.so
|
||||
if [ -f "$cvp" ]; then
|
||||
disabled=$cvp.droiddeck-disabled
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Exit 0 when this game run should open as a SteamVR panel: SteamVR is running and Steam
|
||||
# lists no VR support for the app, optional or required. Under SteamVR, Steam stacks a flat game's window behind
|
||||
# its own, so without the panel the game plays unseen.
|
||||
[ "${1:-}" = waitforexitandrun ] || exit 1
|
||||
[ -z "${DROIDDECK_STEAMVR_PANEL:-}" ] || exit 1
|
||||
# Non-Steam shortcuts run with SteamAppId=0 and their CGameID in SteamGameId.
|
||||
app=${SteamAppId:-}
|
||||
[ "$app" = 0 ] && app=${SteamGameId:-}
|
||||
case $app in '' | 0 | *[!0-9]*) exit 1 ;; esac
|
||||
|
||||
@@ -6,13 +6,11 @@ pgrep -x vrserver >/dev/null 2>&1 || {
|
||||
echo 'Start SteamVR before launching a game with droiddeck-steamvr-game.' >&2
|
||||
exit 1
|
||||
}
|
||||
# droiddeck-steamvr-flat skips a run that a launch option already wrapped.
|
||||
export DROIDDECK_STEAMVR_PANEL=1
|
||||
vrdir=${DROIDDECK_VR_DIR:-/usr/local/lib/droiddeck-vr}
|
||||
export VK_LAYER_PATH="$vrdir/layer${VK_LAYER_PATH:+:$VK_LAYER_PATH}"
|
||||
export VK_INSTANCE_LAYERS="VK_LAYER_DROIDDECK_vr${VK_INSTANCE_LAYERS:+:$VK_INSTANCE_LAYERS}"
|
||||
export VK_LOADER_LAYERS_DISABLE="${VK_LOADER_LAYERS_DISABLE:-~implicit~}"
|
||||
# Quest's guest GPU images use Vulkan sharing rather than DMA-BUF modifiers.
|
||||
if [ -S "/run/droiddeck/droiddeck-xr-frames" ]; then
|
||||
export gamescope_vr_use_modifiers=${gamescope_vr_use_modifiers:-false}
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Preserve SteamVR preferences across Quest's required compositor overrides."""
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,34 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
r"""Before Proton starts a store game, asks the app for what that store needs at launch.
|
||||
|
||||
Run by droiddeck-proton / droiddeck-proton-wrap (steam-compatibility) for every real game launch,
|
||||
whoever started it: the Games tab, a pinned shortcut, or the Steam client's own Play button. It
|
||||
looks for the store launcher DroidDeck wrote (.droiddeck-launch.bat) among the arguments; beside it
|
||||
.droiddeck-store.json says which store and game it is.
|
||||
|
||||
For an Epic game, once the Epic Games Launcher is installed (droiddeck-epic), the game is started
|
||||
through it: the hidden launcher signs the game in and hands its arguments back in
|
||||
.droiddeck-epic-args. Without the launcher, or when it cannot, the game needs a fresh exchange code
|
||||
to sign in, which only the app can mint. The request goes through files under $BL_LAUNCH_DIR/stores (the session root, the same path on both
|
||||
sides):
|
||||
|
||||
req/<id>.json {"op": "epic-code", "store": "epic", "id": "<app name>"} (tmp + rename)
|
||||
resp/<id>.json {"ok": true, "code": true|false, "reason": "..."}
|
||||
|
||||
The app writes .droiddeck-epic-code into the game's folder itself - the code never passes through
|
||||
here - and the launcher .bat reads and deletes it. No answer within TIMEOUT seconds: the game starts
|
||||
with its offline identity. A code file older than STALE_SECONDS is removed first, so a code left by
|
||||
an earlier launch is never used.
|
||||
|
||||
The game's prefix gets Wine's browser set to droiddeck-open-url, which hands web addresses to
|
||||
Android: an EOS sign-in step that falls back to a browser (a consent Epic asks for once per product)
|
||||
is finished there. An EOS overlay pointer (HKCU\Software\Epic Games\EOS "OverlayPath") an earlier
|
||||
build wrote is removed - with it the game exited while loading.
|
||||
|
||||
Battle.net.exe in Battle.net's prefix is handed to droiddeck-battlenet, which runs the whole launch.
|
||||
|
||||
droiddeck-store-launch <the arguments Steam gave the compat tool>
|
||||
"""
|
||||
|
||||
import base64
|
||||
import binascii
|
||||
@@ -77,12 +47,6 @@ def sidecar_at(folder):
|
||||
|
||||
|
||||
def find_store_game(argv):
|
||||
"""
|
||||
The (folder, sidecar) of a store game among [argv], or None when this is not one. Steam passes
|
||||
the shortcut's target: the launcher .bat when the game has one (Epic, Amazon, a GOG game with
|
||||
arguments), else the game's exe itself (most GOG games), which may sit in a subfolder - so the
|
||||
folders above it are looked through too, up to MAX_DEPTH, for the sidecar.
|
||||
"""
|
||||
for raw in argv:
|
||||
arg = raw.strip().strip('"').strip("'").replace("\\", "/")
|
||||
low = arg.lower()
|
||||
@@ -100,7 +64,6 @@ def find_store_game(argv):
|
||||
|
||||
|
||||
def drop_stale(folder, now=None):
|
||||
"""Removes a code file older than STALE_SECONDS; True when one was removed."""
|
||||
code = folder / EPIC_CODE
|
||||
try:
|
||||
if (now if now is not None else time.time()) - code.stat().st_mtime > STALE_SECONDS:
|
||||
@@ -136,7 +99,6 @@ def through_client(folder, sidecar, timeout=CLIENT_TIMEOUT):
|
||||
|
||||
|
||||
def ask(channel, request, timeout=TIMEOUT):
|
||||
"""Writes [request] under channel/req and waits for channel/resp; the answer, or None on timeout."""
|
||||
req_dir, resp_dir = channel / "req", channel / "resp"
|
||||
req_dir.mkdir(parents=True, exist_ok=True)
|
||||
resp_dir.mkdir(parents=True, exist_ok=True)
|
||||
@@ -161,7 +123,6 @@ def ask(channel, request, timeout=TIMEOUT):
|
||||
|
||||
|
||||
def windows_path(unix):
|
||||
"""A guest path as Wine names it through Z: (the whole filesystem)."""
|
||||
return "Z:" + unix.replace("/", "\\")
|
||||
|
||||
|
||||
@@ -170,12 +131,6 @@ def reg_escape(value):
|
||||
|
||||
|
||||
def set_value(reg, key, name, value, now=None):
|
||||
"""
|
||||
Appends `key` with `"name"="value"` to a prefix's user.reg unless the last word on it already
|
||||
says so. Appended rather than edited in place, as DirectAudio's key is: Wine reads later sections
|
||||
over earlier ones, and nothing of the file is rewritten under a wineserver that might hold it.
|
||||
False when there is no user.reg yet (Proton creates the prefix after this; the next launch has it).
|
||||
"""
|
||||
if not reg.is_file():
|
||||
return False
|
||||
line = '"%s"="%s"' % (name, reg_escape(value))
|
||||
@@ -193,7 +148,6 @@ def set_value(reg, key, name, value, now=None):
|
||||
|
||||
|
||||
def remove_value(reg, key, name):
|
||||
"""Drops every `"name"=` line under `key` in user.reg; True when one was there."""
|
||||
if not reg.is_file():
|
||||
return False
|
||||
rows, inside, dropped = [], False, False
|
||||
@@ -212,13 +166,11 @@ def remove_value(reg, key, name):
|
||||
|
||||
|
||||
def options(sidecar):
|
||||
"""An Epic game's launch choices from its sidecar, as the Games tab's Epic card sets them."""
|
||||
e = sidecar.get("epic") if isinstance(sidecar.get("epic"), dict) else {}
|
||||
return {"eos": e.get("eos", True) is not False, "offline": e.get("offline", False) is True}
|
||||
|
||||
|
||||
def server_socket(pfx):
|
||||
"""The wineserver socket for prefix [pfx], as Wine names it (server-<dev>-<inode> under /tmp/.wine-<uid>)."""
|
||||
try:
|
||||
st = os.stat(pfx)
|
||||
except OSError:
|
||||
@@ -228,11 +180,6 @@ def server_socket(pfx):
|
||||
|
||||
|
||||
def wait_for_server(pfx, timeout=SERVER_WAIT):
|
||||
"""
|
||||
Waits for a wineserver still holding this prefix (an earlier verb's, or the last launch's) to
|
||||
exit: it rewrites user.reg from its own memory when it does, which drops a line appended
|
||||
meanwhile. True when none is left.
|
||||
"""
|
||||
sock = server_socket(pfx)
|
||||
if sock is None:
|
||||
return True
|
||||
@@ -243,7 +190,6 @@ def wait_for_server(pfx, timeout=SERVER_WAIT):
|
||||
|
||||
|
||||
def has_value(reg, key, name, value=None):
|
||||
"""Whether the last word on `key` in user.reg sets "name" (to [value], when given)."""
|
||||
if not reg.is_file():
|
||||
return False
|
||||
inside, last = False, None
|
||||
@@ -258,7 +204,6 @@ def has_value(reg, key, name, value=None):
|
||||
|
||||
|
||||
def provision_prefix(compat_data, wait=SERVER_WAIT):
|
||||
"""Wine's browser set to the hand-off, and an earlier build's EOS overlay pointer removed."""
|
||||
if not compat_data:
|
||||
return "no-prefix"
|
||||
pfx = Path(compat_data) / "pfx"
|
||||
@@ -318,12 +263,10 @@ def battlenet(argv, env=os.environ):
|
||||
|
||||
|
||||
def cloud_on(sidecar):
|
||||
"""Cloud saves for this game (the game card's switch; on unless turned off)."""
|
||||
return str(sidecar.get("store")) in CLOUD_STORES and sidecar.get("cloud", True) is not False
|
||||
|
||||
|
||||
def exited(argv, code=0):
|
||||
"""After the game: ask the app to upload what changed, without waiting for it."""
|
||||
found = find_store_game(argv)
|
||||
launch_dir = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
if found is not None and str(found[1].get("store")) == "epic" and os.environ.get(EPIC_HANDLED) != "1" \
|
||||
@@ -344,7 +287,6 @@ COMET_DIR = Path("/usr/local/lib/droiddeck-comet")
|
||||
|
||||
|
||||
def provision_galaxy(compat_data, proton, timeout=90):
|
||||
"""Proton creates the prefix and registers Galaxy before the first game runs."""
|
||||
if not compat_data or not proton or not Path(proton).is_file():
|
||||
return "no-proton"
|
||||
data = Path(compat_data)
|
||||
|
||||
@@ -1,27 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Windows components (OpenAL, d3dx, XAudio, ...) for a game's Proton prefix.
|
||||
|
||||
The app installs each component under STORE/<id>: its files in system32/ (64-bit) and syswow64/
|
||||
(32-bit) as Windows lays them out, and component.json naming the overrides that make Wine load
|
||||
them instead of its own ("name" for native-then-builtin, or "name=n" with Wine's own letters) and
|
||||
the components it bundles ("requires"). The ids are Bannerlator's catalog names (xaudio2.7,
|
||||
oalinst_dll...). The user picks components per game; the picks are in SELECTION as
|
||||
{"version": 1, "games": {"<appid>": ["oalinst_dll", ...]}}.
|
||||
|
||||
A component installed from a Windows Installer package (droiddeck-msi-install) also has drive_c/,
|
||||
its files at their Windows paths (Program Files, the .NET GAC, winsxs...), and registry.json, the
|
||||
values its package writes.
|
||||
|
||||
droiddeck-game-env calls apply() before every game launch. It copies what is missing or changed
|
||||
into compatdata/<appid>/pfx, writes the components' registry values into the prefix's registry
|
||||
files (system.reg, user.reg) and returns the overrides for WINEDLLOVERRIDES, so Wine never has to
|
||||
be running. A prefix Proton has not made yet gets the registry values on the launch after.
|
||||
|
||||
Proton leaves the files alone afterwards: its builtin refresh (update_builtin_libs) replaces only
|
||||
files that are its own builtins, and a new prefix is built around files already there (copy_pfx
|
||||
skips them). The one case that removes them is a launch on an older Proton than the prefix's,
|
||||
which deletes every file Proton once placed - and the next launch's apply() puts ours back.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@@ -62,7 +39,6 @@ def wanted(app_id, selection=SELECTION):
|
||||
|
||||
|
||||
def component(store, cid):
|
||||
"""The component's overrides, its files as (relative path, source) and the ids it bundles, or None if not installed."""
|
||||
root = Path(store) / cid
|
||||
try:
|
||||
with open(root / "component.json", encoding="utf-8") as source:
|
||||
@@ -87,7 +63,6 @@ def component(store, cid):
|
||||
|
||||
|
||||
def registry_values(root):
|
||||
"""The component's registry values (registry.json), the ones that are well formed."""
|
||||
try:
|
||||
with open(Path(root) / "registry.json", encoding="utf-8") as source:
|
||||
values = json.load(source).get("values", [])
|
||||
@@ -102,7 +77,6 @@ def registry_values(root):
|
||||
|
||||
|
||||
def expand(store, ids, saved=None):
|
||||
"""The picks with everything they bundle, each once, a bundle's parts before it."""
|
||||
out, seen = [], set()
|
||||
saved = saved if isinstance(saved, dict) else {}
|
||||
|
||||
@@ -122,7 +96,6 @@ def expand(store, ids, saved=None):
|
||||
|
||||
|
||||
def spelled(path):
|
||||
"""path with each folder that exists spelled as the prefix spells it (Windows names ignore case)."""
|
||||
parts = path.parts
|
||||
current = Path(parts[0])
|
||||
for part in parts[1:]:
|
||||
@@ -141,7 +114,6 @@ def spelled(path):
|
||||
|
||||
|
||||
def existing(path):
|
||||
"""The file at path as the prefix spells it: Windows names ignore case, the filesystem may not."""
|
||||
folder = spelled(path.parent)
|
||||
path = folder / path.name
|
||||
try:
|
||||
@@ -165,7 +137,6 @@ def same(src, dst):
|
||||
|
||||
|
||||
def builtin(path):
|
||||
"""Proton's own: a symlink into its files, or a Wine DLL that says so in its DOS stub."""
|
||||
if path.is_symlink():
|
||||
return True
|
||||
try:
|
||||
@@ -177,7 +148,6 @@ def builtin(path):
|
||||
|
||||
|
||||
def place(src, target, backup=None):
|
||||
"""Copies src over target unless it is already there; a file of someone else's goes to backup first."""
|
||||
target = spelled(target.parent) / target.name
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
found = existing(target)
|
||||
@@ -195,7 +165,6 @@ def place(src, target, backup=None):
|
||||
|
||||
|
||||
def reg_escape(text, extra=""):
|
||||
"""A string as Wine's registry files write it."""
|
||||
out = []
|
||||
for ch in text:
|
||||
if ch == "\\" or ch == '"' or ch in extra:
|
||||
@@ -240,7 +209,6 @@ def reg_key_line(key):
|
||||
|
||||
|
||||
def reg_value_line(name, kind, data):
|
||||
"""name=data as one registry file line; None for a kind that has no line of its own."""
|
||||
head = "@" if name == "" else '"%s"' % reg_escape(name)
|
||||
if kind == "sz":
|
||||
return '%s="%s"' % (head, reg_escape(str(data)))
|
||||
@@ -258,13 +226,11 @@ def reg_value_line(name, kind, data):
|
||||
|
||||
|
||||
def reg_string(line):
|
||||
"""The text of a string value line (plain or str(2)), or None for any other kind."""
|
||||
match = re.match(r'^(?:@|"(?:[^"\\]|\\.)*")=(?:str\(2\):)?"((?:[^"\\]|\\.)*)"\s*$', line)
|
||||
return reg_unescape(match.group(1)) if match else None
|
||||
|
||||
|
||||
class RegistryFile:
|
||||
"""One of a prefix's registry files, as Wine keeps them: [key] sections of name=value lines."""
|
||||
|
||||
def __init__(self, path):
|
||||
self.path = Path(path)
|
||||
@@ -291,7 +257,6 @@ class RegistryFile:
|
||||
self.links[current.lower()] = target
|
||||
|
||||
def link_target(self, number, root):
|
||||
"""Where the link key whose "#link" line is at number leads, relative to this file's root."""
|
||||
for at in range(number + 1, min(number + 8, len(self.lines))):
|
||||
line = self.lines[at]
|
||||
if line.startswith("["):
|
||||
@@ -312,7 +277,6 @@ class RegistryFile:
|
||||
return None
|
||||
|
||||
def resolve(self, key):
|
||||
"""The key Wine really keeps key in: a path through a link key leads to the link's target."""
|
||||
key = key.strip("\\")
|
||||
for _ in range(8):
|
||||
lower = key.lower()
|
||||
@@ -338,7 +302,6 @@ class RegistryFile:
|
||||
return None if end is None else reg_unescape(line[1:end])
|
||||
|
||||
def section(self, key):
|
||||
"""(start, end) line numbers of the key's values, or None."""
|
||||
start = self.index.get(self.resolve(key).lower())
|
||||
if start is None:
|
||||
return None
|
||||
@@ -355,7 +318,6 @@ class RegistryFile:
|
||||
return reg_unescape(match.group(1)).lower() if match else None
|
||||
|
||||
def find(self, key, name):
|
||||
"""(first, last + 1) of the value's lines, or None."""
|
||||
span = self.section(key)
|
||||
if span is None:
|
||||
return None
|
||||
@@ -389,7 +351,6 @@ class RegistryFile:
|
||||
self.changed = True
|
||||
|
||||
def put(self, key, name, raw):
|
||||
"""Sets the value's line(s) to raw, or removes the value when raw is None; True if that changed it."""
|
||||
found = self.find(key, name)
|
||||
if raw is None:
|
||||
if found is None:
|
||||
@@ -432,8 +393,6 @@ class RegistryFile:
|
||||
|
||||
|
||||
def list_line(name, current, item, separator, add, at_end=True):
|
||||
"""current (a string value line) with item added to or taken out of its list, None if it had
|
||||
nothing else; a value that is not a string is left as it is."""
|
||||
text = reg_string(current) if current is not None else ""
|
||||
if text is None:
|
||||
return current
|
||||
@@ -447,9 +406,6 @@ def list_line(name, current, item, separator, add, at_end=True):
|
||||
|
||||
|
||||
def apply_registry(pfx, values, state, held=()):
|
||||
"""Writes the picked components' registry values into the prefix and takes out the ones of
|
||||
components turned off: a value goes back to what it was before, an entry added to a list such
|
||||
as PATH just leaves the list. Returns (values written, notes)."""
|
||||
files = {}
|
||||
for hive, name in HIVES.items():
|
||||
if (pfx / name).is_file():
|
||||
@@ -518,7 +474,6 @@ def save_state(compat, state):
|
||||
|
||||
|
||||
def pending_for(app_id, pending=PENDING):
|
||||
"""The component ids the app is still getting ready for app_id; empty when none (or no file)."""
|
||||
try:
|
||||
with open(pending, encoding="utf-8") as source:
|
||||
ids = json.load(source).get("games", {}).get(str(app_id), [])
|
||||
@@ -528,9 +483,6 @@ def pending_for(app_id, pending=PENDING):
|
||||
|
||||
|
||||
def wait_for_pending(app_id, pending=PENDING, store=STORE, timeout=PENDING_WAIT, sleep=time.sleep, clock=time.monotonic):
|
||||
"""Waits (at most timeout seconds) for the components still being got ready for app_id to be in
|
||||
the store or dropped from the pending list. No wait at all when nothing is pending. Returns a
|
||||
note for the log, or None."""
|
||||
def missing():
|
||||
return [cid for cid in pending_for(app_id, pending) if component(store, cid) is None]
|
||||
left = missing()
|
||||
@@ -548,7 +500,6 @@ def wait_for_pending(app_id, pending=PENDING, store=STORE, timeout=PENDING_WAIT,
|
||||
|
||||
|
||||
def apply(compat_path, app_id, selection=SELECTION, store=STORE, pending=PENDING, wait=wait_for_pending):
|
||||
"""Brings the prefix in line with the game's picks. Returns (overrides, notes)."""
|
||||
compat = Path(compat_path)
|
||||
pfx = compat / "pfx"
|
||||
waited = wait(app_id, pending, store) if wait else None
|
||||
@@ -642,7 +593,6 @@ def apply(compat_path, app_id, selection=SELECTION, store=STORE, pending=PENDING
|
||||
|
||||
|
||||
def overrides_value(names):
|
||||
"""WINEDLLOVERRIDES entries: native-then-builtin unless the component says otherwise; the last word on a DLL wins."""
|
||||
modes = {}
|
||||
for entry in names:
|
||||
name, _, mode = entry.partition("=")
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Runs natively: droiddeck-steam-x64's x86 wrappers start it through an arm64 binary, which FEX hands to the CPU.
|
||||
tool=$1; shift
|
||||
x64_home=$HOME
|
||||
|
||||
# The game overlay tags the game's windows with the Steam app ID; without it gamescope never shows them.
|
||||
overlay=0
|
||||
case ${LD_PRELOAD:-} in *gameoverlayrenderer.so*) overlay=1 ;; esac
|
||||
|
||||
@@ -20,7 +18,6 @@ else
|
||||
export HOME=/root
|
||||
fi
|
||||
[ -z "$game_display" ] || export DISPLAY=$game_display
|
||||
# Proton takes its Steam client parts from the client's install folder; the x86-64 client's are x86.
|
||||
export BL_X64_STEAM_ROOT=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-}
|
||||
export STEAM_COMPAT_CLIENT_INSTALL_PATH=$HOME/.local/share/Steam
|
||||
arm_overlay=$STEAM_COMPAT_CLIENT_INSTALL_PATH/steamrtarm64/gameoverlayrenderer.so
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/bin/bash
|
||||
# The arm64 client's web helper for the x86-64 client, run natively: FEX hands this arm64 program to the CPU.
|
||||
x64_home=$HOME
|
||||
arm=/root/.local/share/Steam/steamrtarm64
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Steam's compositor draws each browser window from its X pixmap: frames must reach X, not gamescope's WSI layer.
|
||||
# gamescope sets vk_xwayland_wait_ready=false for its children; kopper swapchains flashed black even with the wait.
|
||||
unset BL_X64_ARM_WEBHELPER
|
||||
# The shim already added the GPU flags (preload/webhelper.c) to these arguments.
|
||||
export BL_WEBHELPER_ARGS=stock DISABLE_GAMESCOPE_WSI=1 vk_xwayland_wait_ready=true LIBGL_KOPPER_DISABLE=true
|
||||
if [ -x ./steamwebhelper ]; then
|
||||
exec ./steamwebhelper "$@"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
"""Licensed Xbox launches through Xodus and the game's selected ARM64 Proton."""
|
||||
import hmac
|
||||
import json
|
||||
import os
|
||||
|
||||
@@ -248,8 +248,6 @@ bl_idtech3() {
|
||||
}
|
||||
"""
|
||||
|
||||
# Source games report VAC-secure or insecure only in their console, written to console.log only with -condebug.
|
||||
# The app keeps the switch and the records in /root: the x86-64 client runs games with its own HOME.
|
||||
BL_VACDIAG_SETUP = """
|
||||
bl_vacdiag() {
|
||||
[ -f /root/.droiddeck-vac-diagnostics ] || return 0
|
||||
@@ -276,10 +274,6 @@ bl_vacdiag() {
|
||||
}
|
||||
"""
|
||||
|
||||
# Steam's shader pre-caching runs its D3D driver query through every Proton tool at each start, as
|
||||
# "run <client>/bin/d3ddriverquery64.exe" in compatdata/0. Here it has never succeeded (exit 1 every time), and each
|
||||
# run started Wine in compatdata/0, where the two Protons upgrade the prefix back and forth for many seconds while the
|
||||
# game starts. Steam gets the same failure without starting Wine; other verbs and prefixes are left alone.
|
||||
BL_DRIVER_QUERY_SKIP = """
|
||||
case "$verb:${1##*/}:${STEAM_COMPAT_DATA_PATH%/}" in
|
||||
run:d3ddriverquery64.exe:*/compatdata/0 | run:d3ddriverquery.exe:*/compatdata/0)
|
||||
@@ -551,7 +545,6 @@ def tokenize(text):
|
||||
|
||||
|
||||
def find_block(tokens, path):
|
||||
"""Index of the '{' opening the block at path, or None."""
|
||||
depth, want, i = 0, 0, 0
|
||||
while i < len(tokens):
|
||||
t = tokens[i]
|
||||
@@ -602,10 +595,6 @@ def serialize(tokens):
|
||||
|
||||
|
||||
def write_changed(path, text, mode=None):
|
||||
"""Writes `text` to `path` only when it differs, through a rename so a reader never sees half a
|
||||
file. The session runs this script every 15 s for as long as the client does; rewriting files
|
||||
that have not changed cost a python start's worth of writes each time, and config.vdf is the
|
||||
client's own, which it may be writing at that moment. Returns whether anything was written."""
|
||||
try:
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
same = f.read() == text
|
||||
@@ -633,8 +622,6 @@ def display_name(base):
|
||||
|
||||
|
||||
def first_key(path, section):
|
||||
"""The single key naming a block inside `section`, or None. Used to keep a third-party tool's
|
||||
own internal name, so a mapping the user already made against it keeps working."""
|
||||
try:
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
tokens = tokenize(f.read())
|
||||
@@ -652,7 +639,6 @@ def first_key(path, section):
|
||||
|
||||
|
||||
def manifest_entry_point(path):
|
||||
"""The script a toolmanifest's commandline runs, relative to the tool directory."""
|
||||
try:
|
||||
with open(path, encoding="utf-8", errors="replace") as f:
|
||||
tokens = tokenize(f.read())
|
||||
@@ -667,9 +653,6 @@ def manifest_entry_point(path):
|
||||
|
||||
|
||||
def adopt_extras(tools):
|
||||
"""Makes every other Proton in compatibilitytools.d launchable here, and returns the tool names
|
||||
to leave alone in CompatToolMapping - the whole point of installing one is to pick it per game,
|
||||
so register_default must not repoint it back at ours."""
|
||||
adopted = {}
|
||||
try:
|
||||
entries = sorted(os.listdir(tools))
|
||||
@@ -743,7 +726,6 @@ def libraries(steam_root):
|
||||
|
||||
|
||||
def installed_apps(steam_root):
|
||||
"""App ids of the titles the client has installed, tools and runtimes excluded."""
|
||||
apps = set()
|
||||
for library in libraries(steam_root):
|
||||
steamapps = os.path.join(library, "steamapps")
|
||||
@@ -763,7 +745,6 @@ STEAM_PLAY_MANIFESTS = 891390
|
||||
|
||||
|
||||
def launch_programs(config):
|
||||
"""The Windows and Linux programs an app's launch options start, relative to its folder (lowercase, "/")."""
|
||||
launch = config.get("launch") if isinstance(config, dict) else None
|
||||
found = []
|
||||
for option in launch.values() if isinstance(launch, dict) else ():
|
||||
@@ -778,7 +759,6 @@ def launch_programs(config):
|
||||
|
||||
|
||||
def launch_options(config):
|
||||
"""An app's launch options as Steam lists them: executable, arguments, working folder, type and oslist."""
|
||||
launch = config.get("launch") if isinstance(config, dict) else None
|
||||
found = []
|
||||
for key, option in launch.items() if isinstance(launch, dict) else ():
|
||||
@@ -956,7 +936,6 @@ def manifest_flags(tokens):
|
||||
|
||||
|
||||
def tool_downloads(steam_root):
|
||||
"""(app, "install" or "update") for each tool the client has yet to install or bring up to date."""
|
||||
wanted = []
|
||||
for app in REQUIRED_TOOLS:
|
||||
tokens = app_manifest(steam_root, app)
|
||||
@@ -1252,7 +1231,6 @@ def applied_game_requests(requests, overrides, state):
|
||||
|
||||
|
||||
def requested_games(requests, catalog, runnable=None):
|
||||
"""App id -> requested tool, None for inherit, or DEFERRED_GAME_TOOL while unavailable."""
|
||||
runnable = None if runnable is None else set(runnable)
|
||||
resolved = {}
|
||||
for app, request in requests.items():
|
||||
@@ -1356,7 +1334,6 @@ def read_mapping(tokens, mapping):
|
||||
|
||||
|
||||
def read_config_mapping(config_path):
|
||||
"""Read per-app choices without creating or rewriting the client's mapping block."""
|
||||
try:
|
||||
with open(config_path, encoding="utf-8", errors="replace") as f:
|
||||
tokens = tokenize(f.read())
|
||||
@@ -1442,9 +1419,6 @@ def live_helper_running(directory=None):
|
||||
|
||||
def register_default(config_path, apps=(), protect=(), default=None, catalog=None, directory=None, settle=False, picks=(),
|
||||
linux_tool=FEX_TOOL):
|
||||
"""Writes the mapping: the "0" default and every title that follows it (see plan_mapping).
|
||||
With settle, the default itself is decided first (see choose_default): before the client
|
||||
starts, config.vdf holds what the client last kept, menu changes included."""
|
||||
with locked(directory):
|
||||
state = read_json(state_path("state.json", directory))
|
||||
with open(config_path, encoding="utf-8", errors="replace") as f:
|
||||
@@ -1508,7 +1482,6 @@ def register_default(config_path, apps=(), protect=(), default=None, catalog=Non
|
||||
|
||||
|
||||
def depot_build(depot):
|
||||
"""The build number a depot's version file starts with; 0 when there is none."""
|
||||
try:
|
||||
with open(os.path.join(depot, "version"), encoding="utf-8", errors="replace") as f:
|
||||
first = f.read().split(None, 1)
|
||||
@@ -1518,7 +1491,6 @@ def depot_build(depot):
|
||||
|
||||
|
||||
def find_source(steam_root, sources=SOURCES):
|
||||
"""The first of `sources` the client has downloaded, newest across the libraries holding it."""
|
||||
for name in sources:
|
||||
found = [os.path.join(root, "steamapps", "common", name) for root in libraries(steam_root)
|
||||
if os.path.isdir(os.path.join(root, "steamapps", "common", name, "files", "bin-arm64"))]
|
||||
@@ -1528,7 +1500,6 @@ def find_source(steam_root, sources=SOURCES):
|
||||
|
||||
|
||||
def build_tool(tool_dir, depot, sources=SOURCES, name=TOOL):
|
||||
"""Our own manifests and the launcher, named after `depot`. The depot is run at launch time."""
|
||||
if os.path.islink(tool_dir):
|
||||
os.unlink(tool_dir)
|
||||
elif os.path.isdir(tool_dir) and set(os.listdir(tool_dir)) - set(OWN_FILES):
|
||||
@@ -1557,7 +1528,6 @@ def remove_tool(tool_dir):
|
||||
|
||||
|
||||
def local_tools(steam_root):
|
||||
"""The names of the compatibility tools installed in steam_root/compatibilitytools.d."""
|
||||
names = set()
|
||||
tools = os.path.join(steam_root, "compatibilitytools.d")
|
||||
try:
|
||||
@@ -1576,11 +1546,6 @@ def local_tools(steam_root):
|
||||
|
||||
|
||||
def x64_repoint(steam_root, tool, live=False):
|
||||
"""The x86-64 client (droiddeck-steam-x64): its tools are arm64 wrappers that script makes and
|
||||
its Linux titles run as Linux builds (FEX), so only the entries the client aimed at a Proton it
|
||||
cannot start are repointed, to `tool`. Tools in its own compatibilitytools.d are kept: the
|
||||
wrappers include proton-cachyos-*-a64, which starts with "proton" like Valve's own.
|
||||
Returns the app ids repointed."""
|
||||
config = os.path.join(steam_root, "config", "config.vdf")
|
||||
if not tool or not os.path.isfile(config):
|
||||
return []
|
||||
@@ -1597,7 +1562,6 @@ def x64_repoint(steam_root, tool, live=False):
|
||||
set_mapping(tokens, mapping, "0", tool)
|
||||
for app, name in current.items():
|
||||
named = name.lower()
|
||||
# A tool named arm64 is never this client's (its wrappers are -a64), so this legacy name is always repointed.
|
||||
legacy = named == "droiddeck-proton-arm64"
|
||||
if (named.startswith("proton") or legacy) and named != tool.lower() \
|
||||
and (legacy or named not in keep):
|
||||
@@ -1608,7 +1572,6 @@ def x64_repoint(steam_root, tool, live=False):
|
||||
if text != serialize(tokenize(original)):
|
||||
write_changed(config, text)
|
||||
print("steam-compatibility: x86-64 client's Proton entries point at %s" % tool)
|
||||
# Steam reads a mapping changed while it runs only at its next start; the session restarts it (.bl-compat-pending).
|
||||
if moved and live:
|
||||
with open(os.path.join(os.path.expanduser("~"), ".bl-compat-pending"), "a") as f:
|
||||
f.write("".join("%s\n" % a for a in moved))
|
||||
|
||||
@@ -178,10 +178,6 @@ static int caller_is_winebus(void *caller) {
|
||||
return strstr(info.dli_fname, "winebus.so") != NULL;
|
||||
}
|
||||
|
||||
/* Wine's HID haptics give every XInput rumble a 1000 ms cutoff and xinput only writes on a change,
|
||||
* but XInput motors hold their speed until the next XInputSetState; evdev's length 0 holds until
|
||||
* stopped. Only this library, preloaded first, sees winebus as the caller. The length is put back
|
||||
* because winebus compares its copy with the next state to decide whether to upload again. */
|
||||
__attribute__((visibility("hidden"))) int bl_winebus_rumble_ioctl(int (*real)(int, unsigned long, void *), int fd,
|
||||
unsigned long request, void *arg, void *caller,
|
||||
int *rc) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* In Deck mode (-steamos3) the x86-64 client's SteamOS audio manager passes libpulse the NULL operation of a
|
||||
* failed request, and libpulse aborts on it ("Assertion 'o' failed ... pa_operation_get_state()"). */
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
@@ -9,7 +7,6 @@ typedef struct pa_operation pa_operation;
|
||||
|
||||
#define PA_OPERATION_CANCELLED 2
|
||||
|
||||
/* A libpulse loaded with RTLD_LOCAL (Wine's winepulse.so) is not in RTLD_NEXT's scope. */
|
||||
static void *libpulse(const char *name) {
|
||||
void *fn = dlsym(RTLD_NEXT, name);
|
||||
if (!fn) {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#define BL_RESOLVE_BENEATH 0x08
|
||||
#define BL_RESOLVE_IN_ROOT 0x10
|
||||
// The kernel's MAXSYMLINKS.
|
||||
#define BL_MAX_SYMLINKS 40
|
||||
#define BL_PROC_ROOT_INO 1
|
||||
|
||||
@@ -107,7 +106,6 @@ void *dlopen(const char *filename, int flags) {
|
||||
}
|
||||
const char *basename = filename ? strrchr(filename, '/') : NULL;
|
||||
basename = basename ? basename + 1 : filename;
|
||||
// Steam's deep binding bypasses the robust-list shim under PRoot.
|
||||
if (basename && strcmp(basename, "vrclient.so") == 0) {
|
||||
flags &= ~RTLD_DEEPBIND;
|
||||
}
|
||||
@@ -148,7 +146,6 @@ static struct robust_list_head *thread_robust_head(void) {
|
||||
return head;
|
||||
}
|
||||
|
||||
// Magic links are procfs links below a process's directory; procfs's root holds only plain ones (self, thread-self, mounts).
|
||||
static int is_magic_link(int dirfd, char *link, size_t parent_len) {
|
||||
int fd = (int)path_open(dirfd, link, O_PATH | O_NOFOLLOW | O_CLOEXEC, 0L);
|
||||
if (fd < 0) {
|
||||
@@ -168,7 +165,6 @@ static int is_magic_link(int dirfd, char *link, size_t parent_len) {
|
||||
return result != 0 || parent.st_ino != BL_PROC_ROOT_INO;
|
||||
}
|
||||
|
||||
// RESOLVE_IN_ROOT walked one component at a time: absolute symlinks restart at dirfd and ".." stops there.
|
||||
static long openat_in_root(int dirfd, const char *path, int flags, long mode) {
|
||||
char resolved[PATH_MAX];
|
||||
char pending[PATH_MAX];
|
||||
@@ -177,7 +173,6 @@ static long openat_in_root(int dirfd, const char *path, int flags, long mode) {
|
||||
int have_root = 0;
|
||||
int root_on_procfs = 0;
|
||||
dev_t root_dev = 0;
|
||||
// O_NOFOLLOW and O_CREAT | O_EXCL leave a final symlink alone, unless a trailing slash follows it.
|
||||
int nofollow = (flags & O_NOFOLLOW) || (flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL);
|
||||
const char *rest = path;
|
||||
for (;;) {
|
||||
@@ -241,7 +236,6 @@ static long openat_in_root(int dirfd, const char *path, int flags, long mode) {
|
||||
have_root = 1;
|
||||
}
|
||||
if ((st.st_dev != root_dev || root_on_procfs) && is_magic_link(dirfd, resolved, resolved_len)) {
|
||||
// RESOLVE_IN_ROOT refuses magic links.
|
||||
errno = EXDEV;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/* Steam's Linux Remote Play host has no touch injection: client touches arrive as an XTest mouse (absolute
|
||||
* motion plus button 1). While a stream holds the encoder, those become touches into gamescope's own touch
|
||||
* input, as a finger on the device screen would. */
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -195,8 +195,8 @@ static unsigned murmur_hash2(const char *key, size_t len) {
|
||||
len -= 4;
|
||||
}
|
||||
switch (len) {
|
||||
case 3: h ^= data[2] << 16; /* fallthrough */
|
||||
case 2: h ^= data[1] << 8; /* fallthrough */
|
||||
case 3: h ^= data[2] << 16; __attribute__((fallthrough));
|
||||
case 2: h ^= data[1] << 8; __attribute__((fallthrough));
|
||||
case 1: h ^= data[0]; h *= m;
|
||||
}
|
||||
h ^= h >> 13;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* /dev/video-enc0 for Steam's Remote Play V4L2 encoder stage, backed by the app's MediaCodec encoder. */
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
@@ -587,7 +586,6 @@ __attribute__((visibility("hidden"))) void bl_venc_closed(int fd) {
|
||||
vn_free_queue(&v->raw);
|
||||
vn_free_queue(&v->coded);
|
||||
v->used = 0;
|
||||
/* A forked child closing its inherited copy must not end the stream for the parent. */
|
||||
if (__atomic_sub_fetch(&vn_open_count, 1, __ATOMIC_RELEASE) == 0 && v->owner == getpid()) vn_marker(0);
|
||||
pthread_mutex_unlock(&vn_lock);
|
||||
}
|
||||
|
||||
@@ -126,8 +126,6 @@ static void zr_walk(int compress) {
|
||||
zr_sys(SYS_close, maps);
|
||||
}
|
||||
|
||||
// Before it stops a session for suspend, the app waits for <ZR_CTL>.ack.<pid> to appear (the handler
|
||||
// runs here, not one a program installed over it) and then to hold a byte (the page-out finished).
|
||||
static void zr_ack(int done) {
|
||||
static const char suffix[] = ".ack.";
|
||||
char path[sizeof(ZR_CTL) + sizeof(suffix) + 20];
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds the add-on packs the app downloads on first use instead of shipping in the APK:
|
||||
# proot.tar.zst the patched proot and its loader (built by tools/proot)
|
||||
# directaudio.tar.zst the Wine DirectAudio drivers (fetched by tools/directaudio/fetch.sh)
|
||||
# tracking.tar.zst hand-tracking models and the OpenCV/MediaPipe native libraries
|
||||
# xbox.tar.zst the Xbox backend (built by tools/xbox) for /usr/local/lib/droiddeck-xbox
|
||||
# comet.tar.zst the GOG Galaxy companion (built by tools/comet) for /usr/local/lib/droiddeck-comet
|
||||
# Only CI publishes these (.github/workflows/publish-packs.yml); the APK built from the same
|
||||
# directory pins each pack's SHA-256.
|
||||
# Usage: tools/packs/build.sh <out-dir>
|
||||
set -euo pipefail
|
||||
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
|
||||
@@ -1,6 +1,2 @@
|
||||
# Published proot pack for a build that did not compile libproot.so into the APK.
|
||||
# CI builds embed the binary and publish their own pack; this pin is what a source
|
||||
# build downloads. Tag on DroidDeck-Components: pack-proot-<first 16 hex of the digest>.
|
||||
# Update both lines when source builds should pick up a newer proot.
|
||||
PROOT_PACK_SHA256=5a2b7284e6357f88a14a790abd54e61effbe5f202c63b6aaba9b974c559649c3
|
||||
PROOT_PACK_SIZE=96643
|
||||
@@ -1,6 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# assemble.sh <extracted packages root> <out.tzst>
|
||||
# Packs the video side of SteamOS's PipeWire and WirePlumber: no audio plugins, no JACK.
|
||||
set -euo pipefail
|
||||
src=$1
|
||||
out=$2
|
||||
|
||||
@@ -37,8 +37,6 @@ DONOR_CERT_SHA256 = 'b241ea7d77822d39b89d3227e06f3ecf62adec6cbfd38ad06196787991b
|
||||
DONOR_URL = 'https://github.com/Droid-Deck/DroidDeck-CI/releases/download/pr-732/DroidDeck-PR.732-bdf876d.apk'
|
||||
AUDITED_SOURCE = '1dc66bf9be64a404c80400049c0803614814461b'
|
||||
LOCAL_BUILD_PLUMBING = {'app/build.gradle', 'tools/release/runtime_inputs.py'}
|
||||
# These Android-only inputs are compiled by Gradle, never taken from the donor.
|
||||
# Keep this list explicit so unrelated native or Linux runtime edits still fail.
|
||||
LOCAL_ANDROID_SOURCES = {'app/src/main/cpp/CMakeLists.txt',
|
||||
'app/src/main/cpp/viture/sdk_bridge.cpp',
|
||||
'app/src/main/cpp/viture/display_modes.h',
|
||||
@@ -51,8 +49,6 @@ LOCAL_ANDROID_SOURCES = {'app/src/main/cpp/CMakeLists.txt',
|
||||
'app/src/main/cpp/waylandcomp/src/waylandcomp_jni.c',
|
||||
'app/src/main/cpp/waylandcomp/src/spatialpose.c',
|
||||
'app/src/main/cpp/waylandcomp/CMakeLists.txt'}
|
||||
# These audited helper updates are copied from this checkout by runtime.record().
|
||||
# Permit them only while source_assets() still guarantees that staging path.
|
||||
LOCAL_SESSION_HELPERS = {'tools/linuxfs/overlay/usr/local/bin/droiddeck-steam-compat',
|
||||
'tools/linuxfs/overlay/usr/local/bin/droiddeck-steamvr'}
|
||||
VR_PREFIX = 'assets/linuxfs/usr/local/lib/droiddeck-vr/'
|
||||
@@ -83,7 +79,6 @@ def changed(base, target=None):
|
||||
|
||||
|
||||
def check_sources():
|
||||
# A branch label alone is insufficient: CI merged this main commit into it.
|
||||
if git('merge-tree', '--write-tree', DONOR_PR_SOURCE, DONOR_MAIN_SOURCE).decode().splitlines()[0] != DONOR_TREE:
|
||||
raise ValueError('The donor CI merge does not match the audited source tree')
|
||||
helper_sources = {path.relative_to(ROOT).as_posix() for path in source_assets()}
|
||||
@@ -187,8 +182,6 @@ def validate_tracked_assets(package, llvm_strip):
|
||||
if prefix != 'app/src/main/jniLibs/':
|
||||
raise ValueError('Tracked bytes differ from the donor: ' + name +
|
||||
' (text inputs must be checked out with LF)')
|
||||
# AGP strips prebuilt JNI libraries during packaging. Verify that
|
||||
# deterministic transformation on a temporary copy, never the source.
|
||||
with tempfile.TemporaryDirectory(prefix='droiddeck-strip-check-') as temp:
|
||||
stripped = Path(temp) / 'library.so'
|
||||
subprocess.run([str(llvm_strip), '--strip-unneeded', '-o', str(stripped),
|
||||
@@ -264,7 +257,6 @@ def prepare(apk, rebuilt_dir, gamescope, llvm_strip=None, rebuilt_vr=None, vk_in
|
||||
checked_output(target)
|
||||
plan[target] = data
|
||||
origins[target] = 'VR rebuilt from current source; source and output checksums verified'
|
||||
# Do not silently retain unrelated files from a prior preparation.
|
||||
expected = set(plan) | {'app/src/main/' + name for name in helper_assets}
|
||||
for tree in ('linuxfs', 'directaudio', 'droiddeck-esync'):
|
||||
base = ROOT / 'app/src/main/assets' / tree
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef DROIDDECK_BENCH_CHECKS_H
|
||||
#define DROIDDECK_BENCH_CHECKS_H
|
||||
|
||||
/* Benchmark assertions execute the operations being measured. */
|
||||
#ifdef NDEBUG
|
||||
#undef NDEBUG
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
"""Fast path equivalence, part two: symlinked directories (Wine's dosdevices), "..", trailing
|
||||
slashes, realpath/getcwd, the write family, Unix sockets, xattrs, statfs, inotify and fstat.
|
||||
|
||||
Run under proot with and without the fast path (run-device.sh fpoff / fastpath) and diff the
|
||||
output: every line must match. Builds its own tree under /root/fx and /mnt/droiddeck-sd/fx.
|
||||
"""
|
||||
import ctypes
|
||||
import errno
|
||||
import os
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
"""Fast path equivalence, part three: /proc (self, fd and exe links, readlink as proot answers it,
|
||||
realpath through it, opening through fd links), link text naming host paths, creating in
|
||||
directories whose host path is long, glue above a binding proot cannot look into, files the
|
||||
caller may not stat, trailing slashes, shm_open, accept, passwd lookups and the _FORTIFY_SOURCE
|
||||
entry points.
|
||||
|
||||
Run under proot with and without the fast path (run-device.sh fpoff / fastpath) and diff the
|
||||
output: every line must match. The rig's rootfs is ROOT; run-device.sh binds /cache/fp/perf and
|
||||
SHARED at /opt/fpx.
|
||||
"""
|
||||
import ctypes
|
||||
import errno
|
||||
import os
|
||||
|
||||
@@ -913,7 +913,6 @@ static void fill_statx(struct statx *out, const struct stat *st) {
|
||||
out->stx_dev_minor = dev_minor(st->st_dev);
|
||||
}
|
||||
|
||||
/* Emulate statx on older kernels < 4.11 */
|
||||
static long statx_call(int dirfd, const char *path, int flags, unsigned mask, struct statx *out) {
|
||||
struct stat st;
|
||||
long rs;
|
||||
@@ -1374,7 +1373,6 @@ int inotify_add_watch(int fd, const char *path, uint32_t mask) {
|
||||
}
|
||||
|
||||
|
||||
/* The kernel reports a socket named through /proc/self/fd/N/<name> under that name: map it back, per socket. */
|
||||
enum { LONG_SELF, LONG_PEER };
|
||||
static struct { unsigned long ino; int kind; char name[sizeof ((struct sockaddr_un *)0)->sun_path]; char guest[sizeof ((struct sockaddr_un *)0)->sun_path]; } long_names[64];
|
||||
static unsigned long_next;
|
||||
@@ -1453,7 +1451,6 @@ static long socket_address(const struct sockaddr *addr, socklen_t len, int follo
|
||||
memset(out, 0, sizeof *out);
|
||||
out->sun_family = AF_UNIX;
|
||||
if (hlen >= room) {
|
||||
/* proot would bind it to a temporary name the fast path cannot see: name it through its directory. */
|
||||
char *slash = strrchr(r.host, '/');
|
||||
if (!slash || slash == r.host) return FP_SLOW;
|
||||
*slash = 0;
|
||||
|
||||
@@ -89,7 +89,6 @@ long fp_svc_dispatch(const long *r) {
|
||||
}
|
||||
|
||||
void fp_svc_entry(void) __attribute__((visibility("hidden")));
|
||||
/* A replaced svc may have live values in every register, including NZCV and SIMD. */
|
||||
__asm__(
|
||||
".text\n.p2align 4\n.hidden fp_svc_entry\n.type fp_svc_entry,%function\nfp_svc_entry:\n"
|
||||
".cfi_startproc\n.cfi_def_cfa sp, 16\n.cfi_return_column 16\n"
|
||||
@@ -144,11 +143,11 @@ static int svc_emit(uint32_t *code, uint32_t *site, uint32_t *branch) {
|
||||
uint32_t back;
|
||||
if (!svc_branch((uintptr_t)site, (uintptr_t)code, branch) ||
|
||||
!svc_branch((uintptr_t)(code + 5), (uintptr_t)(site + 1), &back)) return 0;
|
||||
code[0] = 0xa9bf47f0U; /* stp x16, x17, [sp, #-16]! */
|
||||
code[1] = 0x580000f0U; /* ldr x16, literal at +32 */
|
||||
code[2] = 0x10000051U; /* adr x17, +8 */
|
||||
code[3] = 0xd61f0200U; /* br x16 */
|
||||
code[4] = 0xa8c147f0U; /* ldp x16, x17, [sp], #16 */
|
||||
code[0] = 0xa9bf47f0U;
|
||||
code[1] = 0x580000f0U;
|
||||
code[2] = 0x10000051U;
|
||||
code[3] = 0xd61f0200U;
|
||||
code[4] = 0xa8c147f0U;
|
||||
code[5] = back;
|
||||
uintptr_t entry = (uintptr_t)fp_svc_entry;
|
||||
uintptr_t resume = (uintptr_t)(site + 1);
|
||||
|
||||
@@ -78,6 +78,5 @@ static int svc_stack_room(uintptr_t sp) {
|
||||
if (grow < svc_stack_gap) grow = svc_stack_gap;
|
||||
if (grow < low) low = grow;
|
||||
}
|
||||
/* Path translation nests several PATH_MAX-sized frames. */
|
||||
return sp - low >= 96 * 1024;
|
||||
}
|
||||
@@ -15,19 +15,17 @@ diff --git a/src/tracee/tracee.c b/src/tracee/tracee.c
|
||||
#include <sys/ptrace.h> /* ptrace(2), PTRACE_*, */
|
||||
#include <errno.h> /* E*, */
|
||||
#include <inttypes.h> /* PRI*, */
|
||||
+#include <unistd.h> /* getpid(2), */
|
||||
+#include <stdio.h> /* fopen(3), fgets(3), snprintf(3), */
|
||||
+#include <dirent.h> /* opendir(3), readdir(3), closedir(3), */
|
||||
+#include <limits.h> /* INT_MAX, */
|
||||
+#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
+#include <dirent.h>
|
||||
+#include <limits.h>
|
||||
|
||||
#include "tracee/tracee.h"
|
||||
#include "tracee/reg.h"
|
||||
@@ -402,16 +406,128 @@
|
||||
@@ -402,16 +406,119 @@
|
||||
}
|
||||
}
|
||||
|
||||
+/* Read host process IDs, not PRoot's guest /proc view. /proc/<tid>/status
|
||||
+ * works for non-leader threads too, even though /proc lists only leaders. */
|
||||
+static int read_task_ids(pid_t pid, long *tgid, long *ppid, long *tracer)
|
||||
+{
|
||||
+ char path[64], line[256];
|
||||
@@ -54,13 +52,6 @@ diff --git a/src/tracee/tracee.c b/src/tracee/tracee.c
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
+/* Recover only a delivered creation event whose GETEVENTMSG succeeded but
|
||||
+ * returned zero. The creator is still stopped at that event, and its real
|
||||
+ * clone flags have already been read. Require exactly one uninitialized,
|
||||
+ * PRoot-traced candidate of the right kind and relationship. Never infer
|
||||
+ * clone flags from PPid, substitute a process for a thread, or choose by PID
|
||||
+ * order. Include tracees whose initial SIGSTOP was handled before this event.
|
||||
+ * Missing events and ambiguous candidates need separate recovery logic. */
|
||||
+static int find_event_child(Tracee *parent, word_t clone_flags, unsigned long *result)
|
||||
+{
|
||||
+ char path[64];
|
||||
@@ -153,7 +144,7 @@ diff --git a/src/tracee/tracee.c b/src/tracee/tracee.c
|
||||
int status;
|
||||
|
||||
/* If the tracee calls clone(2) with the CLONE_VFORK flag,
|
||||
@@ -425,24 +541,62 @@
|
||||
@@ -425,24 +532,60 @@
|
||||
* order to get the right flags.
|
||||
*/
|
||||
status = fetch_regs(parent);
|
||||
@@ -185,8 +176,6 @@ diff --git a/src/tracee/tracee.c b/src/tracee/tracee.c
|
||||
+ static bool warned;
|
||||
+
|
||||
+ status = flags_known ? find_event_child(parent, clone_flags, &pid) : -EIO;
|
||||
+ /* A thread creator can reach clone's exit while its child is held.
|
||||
+ * vfork cannot: its creator waits for the child, so do not defer it. */
|
||||
+ if (status == -EAGAIN && (clone_flags & CLONE_THREAD) != 0 &&
|
||||
+ (clone_flags & CLONE_VFORK) == 0) {
|
||||
+ parent->pending_clone_flags = clone_flags;
|
||||
@@ -218,14 +207,10 @@ diff --git a/src/tracee/tracee.c b/src/tracee/tracee.c
|
||||
|
||||
child = get_tracee(parent, (pid_t) pid, true);
|
||||
if (child == NULL) {
|
||||
@@ -628,6 +782,52 @@
|
||||
@@ -628,6 +771,46 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* A clone event occurs before the creating thread returns from clone. For an
|
||||
+ * ambiguous thread lookup, obtain the exact TID at that syscall's exit instead
|
||||
+ * of guessing from the order of /proc entries. Called before normal syscall
|
||||
+ * exit handling so the registers and inherited tracee state are still intact. */
|
||||
+void finish_pending_child(Tracee *parent)
|
||||
+{
|
||||
+ word_t flags = parent->pending_clone_flags;
|
||||
@@ -243,8 +228,6 @@ diff --git a/src/tracee/tracee.c b/src/tracee/tracee.c
|
||||
+ status = -ESRCH;
|
||||
+ goto failed;
|
||||
+ }
|
||||
+ /* Validate the host TID before setup. This also rejects an unmappable
|
||||
+ * PID from a different PID namespace instead of adopting an unrelated task. */
|
||||
+ status = read_task_ids(parent->pid, &ptgid, &ppid, &tracer);
|
||||
+ if (status < 0)
|
||||
+ goto failed;
|
||||
@@ -295,17 +278,16 @@ diff --git a/src/tracee/event.c b/src/tracee/event.c
|
||||
diff --git a/src/tracee/tracee.h b/src/tracee/tracee.h
|
||||
--- a/src/tracee/tracee.h
|
||||
+++ b/src/tracee/tracee.h
|
||||
@@ -172,6 +172,9 @@
|
||||
@@ -172,6 +172,8 @@
|
||||
SIGSTOP_ALLOWED, /* Allow SIGSTOP (once the parent is known). */
|
||||
SIGSTOP_PENDING, /* Block SIGSTOP until the parent is unknown. */
|
||||
} sigstop;
|
||||
+
|
||||
+ /* Nonzero only while resolving an ambiguous thread clone at its exit. */
|
||||
+ word_t pending_clone_flags;
|
||||
|
||||
/* True if next SIGSYS caused by seccomp should be silently dropped
|
||||
* without affecting state of any registers. */
|
||||
@@ -310,6 +313,7 @@
|
||||
@@ -310,6 +312,7 @@
|
||||
bool only_with_pevent, word_t wait_options);
|
||||
extern bool has_ptracees(const Tracee *ptracer, pid_t pid, word_t wait_options);
|
||||
extern int new_child(Tracee *parent, word_t clone_flags);
|
||||
|
||||
@@ -72,11 +72,6 @@ static inline bool droiddeck_proot_statx_fill_mnt_id(pid_t pid, int fd,
|
||||
int n = snprintf(tracee_fd_path, sizeof tracee_fd_path, "/proc/%ld/fd/%d", (long)pid, fd);
|
||||
if (n < 0 || (size_t)n >= sizeof tracee_fd_path) return false;
|
||||
|
||||
/* Another thread sharing the tracee's fd table can close/reuse fd after statx returns. Pin the
|
||||
* current referent, then require both device and inode to match statx before trusting its mount.
|
||||
* Read fdinfo from our pin so a later tracee fd reuse cannot change which mount ID is observed.
|
||||
* A same-inode bind-mount alias has the same device/inode pair; at this exit stop we cannot
|
||||
* distinguish that rare concurrent replacement from the mount used by the completed syscall. */
|
||||
int pinned = open(tracee_fd_path, O_PATH | O_CLOEXEC);
|
||||
if (pinned < 0) return false;
|
||||
struct stat st;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
"""Read cumulative PRoot handler counters from a session log without double counting snapshots."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build the Quest allocation adapter around the unchanged bundled Android Turnip."""
|
||||
import io
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -34,7 +33,6 @@ def pack(entries, output):
|
||||
|
||||
|
||||
def build_a6xx(ndk, output_dir=OUTPUT.parent, archive_path=None):
|
||||
"""Pin a real A6xx driver, with a separate Quest adapter around the same bytes."""
|
||||
cached = archive_path or ROOT / 'app/build/quest-inputs' / f'Turnip-{A6XX_TAG}.zip'
|
||||
if not cached.exists():
|
||||
cached.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* Exercise the production vkp_render entrypoint without Android/Vulkan hardware.
|
||||
* The Python runner extracts that function verbatim into the included file. */
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
@@ -18,8 +16,6 @@ static void vkp_signal_first_frame(void) { first_frames++; }
|
||||
static int vkp_base_black(int w, int h) { base_calls++; return base_result; }
|
||||
static int sc_layer_present_pass(const struct vkp_draw *draws, int n, int w, int h) {
|
||||
pass_calls++;
|
||||
/* Production sc_layer_present_pass signals only after a content submission.
|
||||
* Its no-op results (off-screen geometry or pool exhaustion) also return 0. */
|
||||
if (pass_result == 0 && pass_shown) vkp_signal_first_frame();
|
||||
return pass_result;
|
||||
}
|
||||
@@ -40,12 +36,10 @@ int main(void) {
|
||||
for (int i = 0; i < 3; i++) assert(vkp_render(1280, 720, NULL, 0) == 0);
|
||||
assert(base_calls == 3 && pass_calls == 0 && first_frames == 0);
|
||||
|
||||
/* An accepted layer operation is not necessarily a displayed client frame. */
|
||||
reset();
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
assert(pass_calls == 1 && base_calls == 1 && first_frames == 0);
|
||||
|
||||
/* Content is the sole owner of the notification, with no second backdrop event. */
|
||||
reset(); pass_shown = 1;
|
||||
assert(vkp_render(1280, 720, &draw, 1) == 0);
|
||||
assert(first_frames == 1);
|
||||
@@ -59,7 +53,6 @@ int main(void) {
|
||||
assert(vkp_render(1280, 720, NULL, 0) == -1);
|
||||
assert(first_frames == 0);
|
||||
|
||||
/* Existing routes remain responsible for their own notifications. */
|
||||
for (int mode = 0; mode < 3; mode++) {
|
||||
reset();
|
||||
if (mode == 0) quest = 0;
|
||||
|
||||
Loaded 100 of 511 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user