mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
Merge latest origin/main and resolve conflicts
This commit is contained in:
commit
8171bf20fd
581 files changed
+14773
-4227
No files matched your search
@@ -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")
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
# KDE Plasma on a dual-screen handheld's bottom screen, next to the session on the top one.
|
||||
set -u
|
||||
export HOME=${HOME:-/root}
|
||||
if [ -n "${BL_DEBUG_DIR:-}" ]; then
|
||||
mkdir -p "$BL_DEBUG_DIR" 2>/dev/null || true
|
||||
exec >>"$BL_DEBUG_DIR/bottom-desktop.log" 2>&1
|
||||
fi
|
||||
echo "== droiddeck-bottom-desktop $(date -u '+%Y-%m-%d %H:%M:%S UTC') ${BL_WIDTH:-?}x${BL_HEIGHT:-?} beside a ${BL_TOP_SESSION:-?} session"
|
||||
[ -x /usr/local/bin/droiddeck-desktop ] || { echo "== the desktop package is not installed"; exit 66; }
|
||||
|
||||
# Launch requests would reach the top session's watcher and could replace it.
|
||||
unset BL_LAUNCH_DIR BL_LOG
|
||||
export BL_BOTTOM_DESKTOP=1
|
||||
|
||||
for _ in $(seq 1 100); do
|
||||
wayland-info >/dev/null 2>&1 && break
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
if command -v dbus-daemon >/dev/null 2>&1 && command -v droiddeck-netmanager >/dev/null 2>&1 \
|
||||
&& ! pgrep -f 'dbus-daemon --config-file=/usr/local/share/droiddeck/system-bus.conf' >/dev/null 2>&1; then
|
||||
mkdir -p /run/dbus /usr/local/share/droiddeck
|
||||
cat > /usr/local/share/droiddeck/system-bus.conf <<'BUSCONF'
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<type>system</type>
|
||||
<listen>unix:path=/run/dbus/system_bus_socket</listen>
|
||||
<auth>EXTERNAL</auth>
|
||||
<servicedir>/usr/share/droiddeck/system-services</servicedir>
|
||||
<policy context="default">
|
||||
<allow user="*"/>
|
||||
<allow own="*"/>
|
||||
<allow send_destination="*"/>
|
||||
<allow receive_sender="*"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
BUSCONF
|
||||
rm -f /run/dbus/system_bus_socket
|
||||
dbus-daemon --config-file=/usr/local/share/droiddeck/system-bus.conf --nofork --nopidfile &
|
||||
for _ in $(seq 1 50); do
|
||||
[ -S /run/dbus/system_bus_socket ] && break
|
||||
sleep 0.1
|
||||
done
|
||||
[ -S /run/dbus/system_bus_socket ] && droiddeck-login1 --with-netmanager &
|
||||
fi
|
||||
|
||||
# The game on the top screen keeps the CPU first.
|
||||
renice -n 5 $$ >/dev/null 2>&1 || true
|
||||
exec /usr/local/bin/droiddeck-desktop
|
||||
@@ -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
|
||||
@@ -13,6 +12,7 @@ import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
LIBRARY = Path("/mnt/droiddeck-sd")
|
||||
ADDED = Path("/mnt/droiddeck-lib")
|
||||
URI = "file:///mnt/droiddeck-sd"
|
||||
KDE_OWNER = "http://www.kde.org"
|
||||
MARK = "DroidDeckSteamLibrary"
|
||||
@@ -43,7 +43,7 @@ def steam_libraries(home, data):
|
||||
if not isinstance(path, str):
|
||||
continue
|
||||
path = Path(re.sub(r'\\(["\\])', r'\1', path))
|
||||
managed = path == LIBRARY or path.is_relative_to(home / "Games")
|
||||
managed = path == LIBRARY or path.is_relative_to(home / "Games") or path.is_relative_to(ADDED)
|
||||
if selected is not None and managed and path not in selected:
|
||||
continue
|
||||
if path == LIBRARY and selected is None and not os.environ.get("BL_LIBRARY_LABEL"):
|
||||
|
||||
@@ -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,13 +119,22 @@ 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"
|
||||
|
||||
|
||||
|
||||
@fix
|
||||
def doom_2016_swapchain_images(game):
|
||||
if "doomx64vk.exe" in game.files and game.stem in ("doomx64", "doomx64vk"):
|
||||
images = {
|
||||
"GAMESCOPE_WSI_MIN_IMAGE_COUNT": None,
|
||||
"GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT": None,
|
||||
"vk_x11_strict_image_count": "true",
|
||||
}
|
||||
return images, [], "DOOM (2016): the swapchain keeps the image count the game asks for"
|
||||
|
||||
|
||||
@fix
|
||||
def teardown_vsync(game):
|
||||
if game.stem == "teardown":
|
||||
@@ -157,8 +161,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 +180,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 +244,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 +261,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 +271,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 +286,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 +312,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 +323,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 +345,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 +361,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 +375,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 +400,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 +432,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"
|
||||
@@ -509,7 +493,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:
|
||||
@@ -520,8 +503,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:
|
||||
@@ -535,7 +516,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
|
||||
@@ -607,10 +587,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 ""
|
||||
@@ -631,10 +607,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")
|
||||
@@ -758,7 +730,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]
|
||||
@@ -793,7 +764,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:
|
||||
@@ -812,7 +782,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
|
||||
@@ -823,7 +792,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()
|
||||
@@ -837,11 +805,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)
|
||||
@@ -876,10 +839,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
|
||||
|
||||
@@ -85,7 +85,7 @@ def connect():
|
||||
|
||||
def main():
|
||||
launch = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
report = Report(os.path.join(launch, "agent") if launch else "")
|
||||
report = Report(os.environ.get("BL_IME_DIR") or (os.path.join(launch, "agent") if launch else ""))
|
||||
conn = Connection(connect())
|
||||
conn.send(DISPLAY_ID, 1, struct.pack("<I", REGISTRY_ID))
|
||||
contexts = {}
|
||||
|
||||
@@ -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
|
||||
@@ -192,10 +190,14 @@ present() { awk -F'\t' -v hive="$hive" '
|
||||
regs=()
|
||||
for reg in "$steam_root"/steamapps/common/Proton*/files/share/default_pfx*/system.reg \
|
||||
/mnt/droiddeck-sd/steamapps/common/Proton*/files/share/default_pfx*/system.reg \
|
||||
/mnt/droiddeck-lib/*/steamapps/common/Proton*/files/share/default_pfx*/system.reg \
|
||||
/mnt/droiddeck-lib/*/x86-64/steamapps/common/Proton*/files/share/default_pfx*/system.reg \
|
||||
/root/Games/*/steamapps/common/Proton*/files/share/default_pfx*/system.reg \
|
||||
"$steam_root"/compatibilitytools.d/*/files/share/default_pfx*/system.reg \
|
||||
"$steam_root"/steamapps/compatdata/*/pfx/system.reg \
|
||||
/mnt/droiddeck-sd/steamapps/compatdata/*/pfx/system.reg \
|
||||
/mnt/droiddeck-lib/*/steamapps/compatdata/*/pfx/system.reg \
|
||||
/mnt/droiddeck-lib/*/x86-64/steamapps/compatdata/*/pfx/system.reg \
|
||||
/root/Games/*/steamapps/compatdata/*/pfx/system.reg; do
|
||||
[ -f "$reg" ] && regs+=("$reg")
|
||||
done
|
||||
|
||||
@@ -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}$ ]] \
|
||||
@@ -381,8 +380,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
|
||||
@@ -400,7 +397,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)
|
||||
@@ -419,10 +415,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"
|
||||
@@ -552,7 +546,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 $?
|
||||
@@ -637,7 +630,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
|
||||
@@ -697,7 +689,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=()
|
||||
@@ -713,8 +704,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
|
||||
@@ -742,9 +731,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
|
||||
@@ -773,7 +759,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
|
||||
@@ -962,14 +947,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))
|
||||
@@ -1061,13 +1043,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
|
||||
@@ -1342,13 +1322,12 @@ case $mode in
|
||||
: > "$compat_restarted"
|
||||
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
|
||||
local app m flags r card=/mnt/droiddeck-sd added=(/mnt/droiddeck-lib/*)
|
||||
[ "$steam_x64" = 1 ] && { card=/mnt/droiddeck-sd/x86-64; added=(/mnt/droiddeck-lib/*/x86-64); }
|
||||
while read -r app; do
|
||||
[ -n "$app" ] || continue
|
||||
m=
|
||||
for r in "$steam_root" "$card"; do
|
||||
for r in "$steam_root" "$card" "${added[@]}"; do
|
||||
[ -f "$r/steamapps/appmanifest_$app.acf" ] && { m=$r/steamapps/appmanifest_$app.acf; break; }
|
||||
done
|
||||
[ -n "$m" ] || return 1
|
||||
@@ -1417,7 +1396,7 @@ case $mode in
|
||||
done
|
||||
fi
|
||||
if [ "$beat" -le 720 ] && [ "$((beat % 3))" -eq 0 ] && { [ -z "$library_job" ] || ! kill -0 "$library_job" 2>/dev/null; }; then
|
||||
libraries=("$steam_root/steamapps" /mnt/droiddeck/steamapps /mnt/droiddeck-sd/steamapps /root/Games/*/steamapps)
|
||||
libraries=("$steam_root/steamapps" /mnt/droiddeck/steamapps /mnt/droiddeck-sd/steamapps /mnt/droiddeck-lib/*/steamapps /mnt/droiddeck-lib/*/x86-64/steamapps /root/Games/*/steamapps)
|
||||
seed=; compat=
|
||||
seed_due && seed=1
|
||||
compat_due && compat=1
|
||||
@@ -1460,7 +1439,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
|
||||
@@ -1520,7 +1498,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
|
||||
|
||||
@@ -18,6 +18,19 @@ COMPAT = runpy.run_path(os.path.join(HERE, "steam-compatibility"))
|
||||
BINDING = "droiddeckCompatChanged"
|
||||
BRIGHTNESS_BINDING = "droiddeckBrightnessChanged"
|
||||
CONTROLS_DIR = "/etc/droiddeck-device-controls"
|
||||
LIBRARY_ART_JS = r"""
|
||||
(() => {
|
||||
if (window.__droiddeckLibraryArt) return "present";
|
||||
const store = typeof appStore === "object" ? appStore : null;
|
||||
if (typeof store?.BHasCachedLibraryAsset !== "function") return "unavailable";
|
||||
// The client reports which cached assets exist only after a logon that reaches Steam; before that every app reads as
|
||||
// uncached and the UI asks the CDN, which is blank offline. The native check still runs, so misses are still reported.
|
||||
const native = store.BHasCachedLibraryAsset.bind(store);
|
||||
store.BHasCachedLibraryAsset = (appid, version, type) => native(appid, version, type) || !version;
|
||||
window.__droiddeckLibraryArt = true;
|
||||
return "installed";
|
||||
})()
|
||||
"""
|
||||
BRIGHTNESS_JS = r"""
|
||||
(() => {
|
||||
if (window.__droiddeckBrightness) return "present";
|
||||
@@ -233,10 +246,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 +256,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 +428,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 +781,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 +806,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")
|
||||
@@ -866,6 +864,7 @@ class Helper:
|
||||
if self.files_only:
|
||||
page.call("Runtime.addBinding", {"name": FILE_BINDING})
|
||||
page.evaluate(FILE_JS)
|
||||
page.evaluate(LIBRARY_ART_JS)
|
||||
self.page = page
|
||||
self.controls_state = None
|
||||
self.controls_installed = False
|
||||
@@ -876,10 +875,10 @@ class Helper:
|
||||
page.evaluate(VR_JS)
|
||||
page.call("Runtime.addBinding", {"name": FILE_BINDING})
|
||||
page.evaluate(FILE_JS)
|
||||
page.evaluate(LIBRARY_ART_JS)
|
||||
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 +915,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 +946,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 +978,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 +1003,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)
|
||||
|
||||
@@ -25,6 +25,14 @@ if [ "$ui" = desktop ] && [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
client_home=$HOME
|
||||
client=("$steam_root/steamrtarm64/steam")
|
||||
fi
|
||||
if [ "${BL_BOTTOM_DESKTOP:-}" = 1 ]; then
|
||||
pid=$(cat "$client_home/.steam/steam.pid" 2>/dev/null || true)
|
||||
if [ -p "$client_home/.steam/steam.pipe" ] && [[ "$pid" =~ ^[0-9]+$ ]] && kill -0 "$pid" 2>/dev/null; then
|
||||
# The top screen's client takes the request, so games open there.
|
||||
exec "${client[@]}" -nobigpicture -no-cef-sandbox \
|
||||
-cef-ozone-platform=x11 -cef-disable-gpu "${url:-steam://open/library}"
|
||||
fi
|
||||
fi
|
||||
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/droiddeck"
|
||||
exec 9>"${XDG_CACHE_HOME:-$HOME/.cache}/droiddeck/steam-desktop.lock"
|
||||
if ! flock -n 9; then
|
||||
|
||||
@@ -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
|
||||
@@ -153,6 +142,7 @@ def relabel(steam_root, target, label):
|
||||
|
||||
|
||||
GAMES_DIR = "/root/Games/"
|
||||
ADDED_DIR = "/mnt/droiddeck-lib/"
|
||||
|
||||
|
||||
def wanted():
|
||||
@@ -193,7 +183,7 @@ def main():
|
||||
if managed:
|
||||
keep = {library for library, _ in libraries}
|
||||
for library in registered(steam_root):
|
||||
if library not in keep and (library == LIBRARIES[0][0] or library.startswith(GAMES_DIR)):
|
||||
if library not in keep and (library == LIBRARIES[0][0] or library.startswith((GAMES_DIR, ADDED_DIR))):
|
||||
forget(steam_root, library)
|
||||
|
||||
|
||||
|
||||
@@ -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,14 +77,17 @@ 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
|
||||
[ -f "$STEAM_X64/config/config.vdf" ] || return 0
|
||||
if [ "$mode" = write ] && pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1; then return 0; fi
|
||||
local libraries="$STEAM_X64/steamapps:/mnt/droiddeck-sd/x86-64/steamapps:$X64_HOME/shared/arm64/steamapps" library
|
||||
for library in /mnt/droiddeck-lib/*/x86-64/steamapps; do
|
||||
[ -d "$library" ] && libraries="$libraries:$library"
|
||||
done
|
||||
python3 - "$mode" "$STEAM_X64/config/config.vdf" "$STEAM_X64/appcache/appinfo.vdf" "$X64_HOME/direct-auto.json" \
|
||||
"$X64_HOME/direct-sniper" "$STEAM_X64/steamapps:/mnt/droiddeck-sd/x86-64/steamapps:$X64_HOME/shared/arm64/steamapps" "$(x64_default_tool)" \
|
||||
"$X64_HOME/direct-sniper" "$libraries" "$(x64_default_tool)" \
|
||||
"$REAL_HOME/.bl-compat-pending" ${BL_X64_DIRECT_APPS:-550} \
|
||||
<<'PY' || { [ "$mode" = live ] || step "could not map titles to DroidDeck direct"; }
|
||||
# Steam does not swap an installed build when the tool changes: a title installed for Windows stays on Proton.
|
||||
@@ -317,7 +319,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 +337,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 +355,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 +434,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 +442,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 +452,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 +530,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 +541,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 +573,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 +621,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 +695,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 +709,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 +730,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 +742,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 +754,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 +765,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 +778,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 +790,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 +803,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 +833,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 +968,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 +1006,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 +1023,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))
|
||||
|
||||
Reference in new issue
Block a user