mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-23 06:46:02 +00:00
chore: merge main into feat/lse-emu
This commit is contained in:
commit
e8e4ad565b
437 files changed
+12933
-4769
No files matched your search
@@ -3,9 +3,9 @@ echo "steamos-session-select: $*" >&2
|
||||
case "${1:-}" in
|
||||
""|gamescope) exit 0 ;;
|
||||
esac
|
||||
dir=${BL_LAUNCH_DIR:-}
|
||||
dir=${DD_LAUNCH_DIR:-}
|
||||
if [ -z "$dir" ] || [ ! -d "$dir" ]; then
|
||||
echo "steamos-session-select: not inside a DroidDeck session (BL_LAUNCH_DIR unset)" >&2
|
||||
echo "steamos-session-select: not inside a DroidDeck session (DD_LAUNCH_DIR unset)" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf 'session=desktop\nui=desktop\nurl=\n' > "$dir/steam-launch.tmp" && mv -f "$dir/steam-launch.tmp" "$dir/steam-launch"
|
||||
|
||||
@@ -283,7 +283,7 @@ def sandboxed_apps(proc=Path("/proc")):
|
||||
def window_steam_app(win, flatpaks, proc=Path("/proc")):
|
||||
match = STEAM_APP_CLASS.match(win.get("class") or "")
|
||||
if match:
|
||||
return match.group(1) if os.environ.get("BL_STEAM_CLIENT_ARCH") == "x86_64" else None
|
||||
return match.group(1) if os.environ.get("DD_STEAM_CLIENT_ARCH") == "x86_64" else None
|
||||
pid = win.get("pid")
|
||||
if pid:
|
||||
if under_reaper(pid, proc):
|
||||
@@ -391,18 +391,26 @@ class FocusWatcher(threading.Thread):
|
||||
x.close()
|
||||
except (OSError, AgentError) as e:
|
||||
log("focus snapshot failed: %s" % e)
|
||||
self.publish({})
|
||||
time.sleep(2)
|
||||
continue
|
||||
if tag_game_windows(snap):
|
||||
self.changed.set()
|
||||
continue
|
||||
body = {k: v for k, v in snap.items() if k != "t"}
|
||||
if body == self.last:
|
||||
continue
|
||||
self.last = body
|
||||
self.seq += 1
|
||||
snap["seq"] = self.seq
|
||||
write_json(self.path, snap)
|
||||
self.publish(snap)
|
||||
|
||||
def publish(self, snap):
|
||||
body = {k: v for k, v in snap.items() if k != "t"}
|
||||
if body == self.last:
|
||||
return
|
||||
try:
|
||||
write_json(self.path, dict(snap, seq=self.seq + 1))
|
||||
except OSError as e:
|
||||
log("focus publication failed: %s" % e)
|
||||
self.changed.set()
|
||||
return
|
||||
self.seq += 1
|
||||
self.last = body
|
||||
|
||||
def listen(self):
|
||||
while True:
|
||||
@@ -521,7 +529,7 @@ def cdp_port(agent_dir):
|
||||
try:
|
||||
port = (agent_dir / "cdp-port").read_text().strip()
|
||||
except OSError:
|
||||
port = os.environ.get("BL_CDP_PORT", "")
|
||||
port = os.environ.get("DD_CDP_PORT", "")
|
||||
if not port.isdigit():
|
||||
raise AgentError("NO_DEVTOOLS", "The Steam client's DevTools port is not known (no Steam client in this session yet)")
|
||||
return int(port)
|
||||
@@ -1210,9 +1218,9 @@ def serve(agent_dir, focus=True, poll=0.1):
|
||||
|
||||
|
||||
def main(argv):
|
||||
base = os.environ.get("BL_LAUNCH_DIR")
|
||||
base = os.environ.get("DD_LAUNCH_DIR")
|
||||
if not base:
|
||||
print("BL_LAUNCH_DIR is not set", file=sys.stderr)
|
||||
print("DD_LAUNCH_DIR is not set", file=sys.stderr)
|
||||
return 2
|
||||
if argv and argv[0] == "--wait-steam-shortcut-overview":
|
||||
if len(argv) not in (2, 3):
|
||||
|
||||
@@ -467,7 +467,7 @@ def still_pages(root):
|
||||
|
||||
|
||||
def desktop_size():
|
||||
width, height = os.environ.get("BL_WIDTH", ""), os.environ.get("BL_HEIGHT", "")
|
||||
width, height = os.environ.get("DD_WIDTH", ""), os.environ.get("DD_HEIGHT", "")
|
||||
if width.isdigit() and height.isdigit() and 0 < int(width) <= 7680 and 0 < int(height) <= 4320:
|
||||
return int(width), int(height)
|
||||
return 1280, 720
|
||||
@@ -900,18 +900,18 @@ class Tidy:
|
||||
|
||||
|
||||
def desktop_gpu():
|
||||
if os.environ.get("BL_DESKTOP") != "1" or os.environ.get("BL_DESKTOP_GPU_CHILD"):
|
||||
if os.environ.get("DD_DESKTOP") != "1" or os.environ.get("DD_DESKTOP_GPU_CHILD"):
|
||||
return None
|
||||
if os.environ.get("BL_DESKTOP_GPU", "on").strip().lower() in ("off", "0", "no", "false"):
|
||||
if os.environ.get("DD_DESKTOP_GPU", "on").strip().lower() in ("off", "0", "no", "false"):
|
||||
return None
|
||||
gpu = os.path.join(BIN, "droiddeck-gpu")
|
||||
return gpu if os.access(gpu, os.X_OK) else None
|
||||
|
||||
|
||||
def proton_options():
|
||||
if os.environ.get("BL_DESKTOP") == "1" and not os.environ.get("BL_DESKTOP_GPU_CHILD"):
|
||||
if os.environ.get("DD_DESKTOP") == "1" and not os.environ.get("DD_DESKTOP_GPU_CHILD"):
|
||||
return ["--window"]
|
||||
width, height = os.environ.get("BL_WIDTH", ""), os.environ.get("BL_HEIGHT", "")
|
||||
width, height = os.environ.get("DD_WIDTH", ""), os.environ.get("DD_HEIGHT", "")
|
||||
options = ["--desktop", "%sx%s" % (width, height)] if width.isdigit() and height.isdigit() else []
|
||||
game = os.environ.get("SteamGameId", "")
|
||||
return options + (["--game-id", game] if game.isdigit() and game != "0" else [])
|
||||
@@ -942,7 +942,7 @@ def queued_requests(launch_dir):
|
||||
|
||||
|
||||
def serve_requests(pfx, processes=None, launch_dir=None):
|
||||
launch_dir = launch_dir or os.environ.get("BL_LAUNCH_DIR")
|
||||
launch_dir = launch_dir or os.environ.get("DD_LAUNCH_DIR")
|
||||
names = queued_requests(launch_dir) if launch_dir else []
|
||||
if not names or not agent_up(wine_processes(pfx) if processes is None else processes):
|
||||
return False
|
||||
@@ -1136,7 +1136,7 @@ def stop_leftovers(pfx):
|
||||
def open_client(root, reinstall=False):
|
||||
pfx = os.path.join(prefix(root), "pfx")
|
||||
write_menu()
|
||||
answer = ask_fex(os.environ.get("BL_LAUNCH_DIR"))
|
||||
answer = ask_fex(os.environ.get("DD_LAUNCH_DIR"))
|
||||
say("FEX: %s" % (answer or "no answer from the app; Components' choice stays"))
|
||||
if running(pfx):
|
||||
say("Battle.net is already running in its prefix; waiting for it to close")
|
||||
@@ -1226,7 +1226,7 @@ def launch(root, code):
|
||||
try:
|
||||
own = None
|
||||
if lock is not None and not running(pfx):
|
||||
answer = ask_fex(os.environ.get("BL_LAUNCH_DIR"))
|
||||
answer = ask_fex(os.environ.get("DD_LAUNCH_DIR"))
|
||||
say("FEX: %s" % (answer or "no answer from the app; Components' choice stays"))
|
||||
verb = None if stop_leftovers(pfx) else "run"
|
||||
configure(root, LIBRARY)
|
||||
@@ -1560,7 +1560,7 @@ def main(argv):
|
||||
if gpu:
|
||||
say("the desktop starts Battle.net on the GPU")
|
||||
os.execv(gpu, [gpu, os.path.abspath(sys.argv[0])] + list(sys.argv[1:]))
|
||||
os.environ["BL_BATTLENET"] = "1"
|
||||
os.environ["DD_BATTLENET"] = "1"
|
||||
if launching:
|
||||
say("launch %s" % argv[1])
|
||||
return launch(root, argv[1])
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
# 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
|
||||
if [ -n "${DD_DEBUG_DIR:-}" ]; then
|
||||
mkdir -p "$DD_DEBUG_DIR" 2>/dev/null || true
|
||||
exec >>"$DD_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"
|
||||
echo "== droiddeck-bottom-desktop $(date -u '+%Y-%m-%d %H:%M:%S UTC') ${DD_WIDTH:-?}x${DD_HEIGHT:-?} beside a ${DD_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
|
||||
unset DD_LAUNCH_DIR BL_LAUNCH_DIR DD_LOG
|
||||
export DD_BOTTOM_DESKTOP=1
|
||||
|
||||
for _ in $(seq 1 100); do
|
||||
wayland-info >/dev/null 2>&1 && break
|
||||
|
||||
@@ -23,7 +23,7 @@ ET.register_namespace("bookmark", ICON_NS)
|
||||
def steam_libraries(home, data):
|
||||
steam = data / "Steam"
|
||||
libraries = {steam: "Internal Storage"}
|
||||
listing = os.environ.get("BL_STEAM_LIBRARIES")
|
||||
listing = os.environ.get("DD_STEAM_LIBRARIES")
|
||||
selected = None
|
||||
if listing:
|
||||
try:
|
||||
@@ -46,15 +46,15 @@ def steam_libraries(home, data):
|
||||
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"):
|
||||
if path == LIBRARY and selected is None and not os.environ.get("DD_LIBRARY_LABEL"):
|
||||
continue
|
||||
label = entry.get("label")
|
||||
label = re.sub(r'\\(["\\])', r'\1', label) if isinstance(label, str) else ""
|
||||
libraries[path] = label or path.name
|
||||
if selected is not None:
|
||||
libraries.update(selected)
|
||||
elif os.environ.get("BL_LIBRARY_LABEL"):
|
||||
libraries[LIBRARY] = os.environ["BL_LIBRARY_LABEL"]
|
||||
elif os.environ.get("DD_LIBRARY_LABEL"):
|
||||
libraries[LIBRARY] = os.environ["DD_LIBRARY_LABEL"]
|
||||
libraries[steam] = "Internal Storage"
|
||||
return {path.as_uri(): "Steam (" + (" ".join(label.split()) or path.name) + ")"
|
||||
for path, label in libraries.items() if path.is_absolute() and (path / "steamapps").is_dir()}
|
||||
@@ -67,7 +67,25 @@ def place_uri(uri):
|
||||
return uri
|
||||
|
||||
|
||||
def update_places(path, libraries):
|
||||
def removable_volumes():
|
||||
listing = os.environ.get("DD_DESKTOP_VOLUMES")
|
||||
if not listing:
|
||||
return {}
|
||||
volumes = {}
|
||||
for entry in json.loads(Path(listing).read_text()):
|
||||
path = Path(entry["path"])
|
||||
if not path.is_absolute():
|
||||
continue
|
||||
try:
|
||||
with os.scandir(path):
|
||||
pass
|
||||
except OSError:
|
||||
continue
|
||||
volumes[path.as_uri()] = " ".join(str(entry["label"]).split()) or path.name
|
||||
return volumes
|
||||
|
||||
|
||||
def update_places(path, libraries, mark=MARK, icon_name="steam", id_prefix="droiddeck-steam-"):
|
||||
if path.is_file():
|
||||
parser = ET.XMLParser(target=ET.TreeBuilder(insert_comments=True, insert_pis=True))
|
||||
root = ET.fromstring(path.read_bytes(), parser=parser)
|
||||
@@ -80,10 +98,10 @@ def update_places(path, libraries):
|
||||
before = ET.tostring(root)
|
||||
seen = set()
|
||||
personal = {place_uri(b.get("href")) for b in root.findall("bookmark")
|
||||
if b.find("info/metadata[@owner='" + KDE_OWNER + "']/" + MARK) is None}
|
||||
if b.find("info/metadata[@owner='" + KDE_OWNER + "']/" + mark) is None}
|
||||
for bookmark in root.findall("bookmark"):
|
||||
metadata = bookmark.find("info/metadata[@owner='" + KDE_OWNER + "']")
|
||||
if metadata is None or metadata.find(MARK) is None:
|
||||
if metadata is None or metadata.find(mark) is None:
|
||||
continue
|
||||
uri = place_uri(bookmark.get("href"))
|
||||
if uri not in libraries or uri in seen or uri in personal:
|
||||
@@ -101,10 +119,10 @@ def update_places(path, libraries):
|
||||
ET.SubElement(bookmark, "title").text = label
|
||||
info = ET.SubElement(bookmark, "info")
|
||||
icon = ET.SubElement(info, "metadata", {"owner": "http://freedesktop.org"})
|
||||
ET.SubElement(icon, "{" + ICON_NS + "}icon", {"name": "steam"})
|
||||
ET.SubElement(icon, "{" + ICON_NS + "}icon", {"name": icon_name})
|
||||
metadata = ET.SubElement(info, "metadata", {"owner": KDE_OWNER})
|
||||
ET.SubElement(metadata, "ID").text = "droiddeck-steam-" + hashlib.sha256(uri.encode()).hexdigest()[:16]
|
||||
ET.SubElement(metadata, MARK).text = "true"
|
||||
ET.SubElement(metadata, "ID").text = id_prefix + hashlib.sha256(uri.encode()).hexdigest()[:16]
|
||||
ET.SubElement(metadata, mark).text = "true"
|
||||
ET.SubElement(metadata, "isSystemItem").text = "false"
|
||||
if ET.tostring(root) != before:
|
||||
atomic_write(path, ET.tostring(root, encoding="unicode", xml_declaration=True))
|
||||
@@ -150,11 +168,13 @@ def atomic_write(path, content):
|
||||
def main():
|
||||
home = Path.home()
|
||||
config = Path(os.environ.get("XDG_CONFIG_HOME") or home / ".config")
|
||||
label = os.environ.get("BL_LIBRARY_LABEL")
|
||||
label = os.environ.get("DD_LIBRARY_LABEL")
|
||||
available = bool(label) and (LIBRARY / "steamapps").is_dir()
|
||||
update_bookmark(bookmarks_file(home, config), label if available else None)
|
||||
data = Path(os.environ.get("XDG_DATA_HOME") or home / ".local/share")
|
||||
update_places(data / "user-places.xbel", steam_libraries(home, data))
|
||||
places = data / "user-places.xbel"
|
||||
update_places(places, steam_libraries(home, data))
|
||||
update_places(places, removable_volumes(), "DroidDeckRemovableVolume", "drive-removable-media", "droiddeck-volume-")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
[ -n "${BL_ANDROID_CLIPBOARD:-}" ] && [ -n "${DISPLAY:-}" ] || exit 0
|
||||
/usr/local/bin/droiddeck-clipboard "$BL_ANDROID_CLIPBOARD" &
|
||||
[ -n "${DD_ANDROID_CLIPBOARD:-}" ] && [ -n "${DISPLAY:-}" ] || exit 0
|
||||
/usr/local/bin/droiddeck-clipboard "$DD_ANDROID_CLIPBOARD" &
|
||||
child=$!
|
||||
trap 'kill "$child" 2>/dev/null' EXIT
|
||||
trap 'exit 0' TERM INT
|
||||
|
||||
@@ -4,8 +4,8 @@ import re
|
||||
import sys
|
||||
|
||||
HOME = os.environ.get("HOME", "/root")
|
||||
X64 = os.environ.get("BL_STEAM_CLIENT_ARCH") == "x86_64"
|
||||
CLIENT_HOME = (os.environ.get("BL_X64_HOME") or os.path.join(HOME, ".droiddeck-x64")) if X64 else HOME
|
||||
X64 = os.environ.get("DD_STEAM_CLIENT_ARCH") == "x86_64"
|
||||
CLIENT_HOME = (os.environ.get("DD_X64_HOME") or os.path.join(HOME, ".droiddeck-x64")) if X64 else HOME
|
||||
STEAM_ROOT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(CLIENT_HOME, ".local/share/Steam")
|
||||
LIBRARIES = ((STEAM_ROOT, "Steam Games"), ("/mnt/droiddeck-sd/x86-64" if X64 else "/mnt/droiddeck-sd", "SD Games"))
|
||||
NOT_GAMES = {228980, 1070560, 1161040, 1391110, 1493710, 1628350, 1826330, 3127680, 4183110, 4185400, 4427310, 4628740}
|
||||
|
||||
@@ -112,7 +112,7 @@ HIDDEN_ENV = {
|
||||
"DROIDDECK_EPIC_HIDDEN": "1",
|
||||
"EGL_DISABLE_STORE_PREWARM": "1",
|
||||
}
|
||||
KEPT_ENV = ("HOME", "USER", "LOGNAME", "LANG", "LANGUAGE", "LC_ALL", "LC_MESSAGES", "TZ", "XDG_RUNTIME_DIR", "BL_LAUNCH_DIR")
|
||||
KEPT_ENV = ("HOME", "USER", "LOGNAME", "LANG", "LANGUAGE", "LC_ALL", "LC_MESSAGES", "TZ", "XDG_RUNTIME_DIR", "DD_LAUNCH_DIR", "BL_LAUNCH_DIR")
|
||||
LAUNCH_VERBS = ("waitforexitandrun", "run", "runinprefix")
|
||||
EPIC_ARGS = ("-auth_", "-epic")
|
||||
CMD_SPECIAL = "&|<>^"
|
||||
@@ -720,7 +720,7 @@ def clear_playing():
|
||||
|
||||
|
||||
def launch_dir():
|
||||
found = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
found = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
if not found:
|
||||
try:
|
||||
with open(LAUNCH_DIR_FILE, encoding="utf-8") as f:
|
||||
@@ -1234,25 +1234,7 @@ def wait_for(check, timeout, step=0.1):
|
||||
|
||||
|
||||
def capped_log(path):
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
handle = open(path, "wb")
|
||||
read, write = os.pipe()
|
||||
|
||||
def pump():
|
||||
written = 0
|
||||
with os.fdopen(read, "rb") as source:
|
||||
while True:
|
||||
chunk = source.read1(65536) if hasattr(source, "read1") else source.read(65536)
|
||||
if not chunk:
|
||||
break
|
||||
if written < LOG_CAP:
|
||||
handle.write(chunk[:LOG_CAP - written])
|
||||
handle.flush()
|
||||
written += len(chunk)
|
||||
handle.close()
|
||||
|
||||
threading.Thread(target=pump, daemon=True).start()
|
||||
return write
|
||||
return GAME_DEBUG["capped_log"](path, LOG_CAP)[0]
|
||||
|
||||
|
||||
class Session:
|
||||
|
||||
@@ -39,7 +39,7 @@ MIN_NOFILE = 8192
|
||||
LOG_LINES = 200
|
||||
LIVE_FILE = "prefixes.json"
|
||||
LIVE_ROWS = 200
|
||||
LIVE_KEYS = ("WINESERVER", "BL_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "BL_SYNC", "BL_FSYNC", "WINEFSYNC")
|
||||
LIVE_KEYS = ("WINESERVER", "DD_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "DD_SYNC", "DD_FSYNC", "WINEFSYNC")
|
||||
CACHE_ROWS = 512
|
||||
TEMP_AGE = 3600
|
||||
GC_GRACE = 600
|
||||
@@ -637,7 +637,7 @@ def app_id(env):
|
||||
|
||||
def minimum_nofile(env):
|
||||
try:
|
||||
return int(env.get("BL_SYNC_MIN_NOFILE") or MIN_NOFILE)
|
||||
return int(env.get("DD_SYNC_MIN_NOFILE") or MIN_NOFILE)
|
||||
except ValueError:
|
||||
return MIN_NOFILE
|
||||
|
||||
@@ -650,8 +650,8 @@ def log_launch(root, command, env, tool, pack_id):
|
||||
try:
|
||||
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
|
||||
line = tsv([[int(time.time()), app_id(env) or "-", command[1] if len(command) > 1 else "-", tool, pack_id or "-",
|
||||
env.get("WINEESYNC") or "-", env.get("BL_SYNC") or "-", "%s/%s" % (limit(soft), limit(hard)),
|
||||
env.get("BL_FSYNC") or "-"]])
|
||||
env.get("WINEESYNC") or "-", env.get("DD_SYNC") or "-", "%s/%s" % (limit(soft), limit(hard)),
|
||||
env.get("DD_FSYNC") or "-"]])
|
||||
|
||||
def append(text):
|
||||
lines = [entry for entry in text.split("\n") if entry]
|
||||
@@ -704,7 +704,7 @@ def select(command, env):
|
||||
if not prefix or last == "0" or last.startswith("0-"):
|
||||
return result
|
||||
if truthy(env.get("PROTON_NO_NTSYNC")):
|
||||
env["BL_SYNC"] = "0"
|
||||
env["DD_SYNC"] = "0"
|
||||
result = (list(command), dict(env))
|
||||
root = store_root(env)
|
||||
if root is None:
|
||||
@@ -796,7 +796,7 @@ def keep_live(root, command, env, tool):
|
||||
return None
|
||||
if not os.path.isfile(kept_command) or not server_running(prefix):
|
||||
return None
|
||||
kept_pack = row["env"].get("BL_SYNC_PACK")
|
||||
kept_pack = row["env"].get("DD_SYNC_PACK", row["env"].get("BL_SYNC_PACK"))
|
||||
if isinstance(kept_pack, str) and kept_pack and command[1:2] == ["waitforexitandrun"]:
|
||||
try:
|
||||
cache = HashCache(root)
|
||||
@@ -808,25 +808,28 @@ def keep_live(root, command, env, tool):
|
||||
pack = {"id": kept_pack}
|
||||
if pack is None or pack["id"] != kept_pack:
|
||||
return None
|
||||
kept = {("DD_" + name[3:] if name.startswith("BL_") else name): value
|
||||
for name, value in row["env"].items() if name.startswith("BL_")}
|
||||
kept.update((name, value) for name, value in row["env"].items() if not name.startswith("BL_"))
|
||||
command, env = list(command), dict(env)
|
||||
command[0] = kept_command
|
||||
for name in LIVE_KEYS:
|
||||
value = row["env"].get(name)
|
||||
value = kept.get(name)
|
||||
if isinstance(value, str):
|
||||
env[name] = value
|
||||
else:
|
||||
env.pop(name, None)
|
||||
say("droiddeck-esync: Wine is still running in this prefix; keeping its sync choice (%s)" % describe(env))
|
||||
log_launch(root, command, env, tool, env.get("BL_SYNC_PACK"))
|
||||
log_launch(root, command, env, tool, env.get("DD_SYNC_PACK"))
|
||||
return command, env
|
||||
|
||||
|
||||
def describe(env):
|
||||
if env.get("BL_SYNC") == "1":
|
||||
if env.get("DD_SYNC") == "1":
|
||||
return "droiddeck-ntsync"
|
||||
if env.get("BL_FSYNC") == "1":
|
||||
if env.get("DD_FSYNC") == "1":
|
||||
return "droiddeck-fsync"
|
||||
if env.get("BL_SYNC_PACK") and truthy(env.get("WINEESYNC")):
|
||||
if env.get("DD_SYNC_PACK") and truthy(env.get("WINEESYNC")):
|
||||
return "droiddeck-esync"
|
||||
if all(truthy(env.get(name)) for name in WINESERVER_ONLY):
|
||||
return "wineserver"
|
||||
@@ -835,13 +838,13 @@ def describe(env):
|
||||
|
||||
def fsync_ready(env, measured):
|
||||
listed = "PROTON_NO_FSYNC" not in env and app_id(env) in NOSYNC_APPS
|
||||
return measured["fsync"] and env.get("BL_SYNC") != "1" and not truthy(env.get("PROTON_NO_FSYNC")) and not listed
|
||||
return measured["fsync"] and env.get("DD_SYNC") != "1" and not truthy(env.get("PROTON_NO_FSYNC")) and not listed
|
||||
|
||||
|
||||
def with_fsync(root, command, env, tool, reason):
|
||||
command, env = list(command), dict(env)
|
||||
env["BL_FSYNC"] = "1"
|
||||
env["BL_SYNC"] = "0"
|
||||
env["DD_FSYNC"] = "1"
|
||||
env["DD_SYNC"] = "0"
|
||||
env["WINEFSYNC"] = "1"
|
||||
say("droiddeck-fsync: %s; stock binaries with Proton's fsync" % reason)
|
||||
log_launch(root, command, env, tool, None)
|
||||
@@ -855,10 +858,10 @@ def stand_in(root, command, env, tool, reason, measured=None):
|
||||
if truthy(env.get("PROTON_NO_NTSYNC")):
|
||||
say("droiddeck-esync: %s; stock binaries" % reason)
|
||||
elif measured is not None and not measured["ntsync"]:
|
||||
env["BL_SYNC"] = "0"
|
||||
env["DD_SYNC"] = "0"
|
||||
say("droiddeck-esync: %s; stock binaries (this Wine has no ntsync)" % reason)
|
||||
else:
|
||||
env["BL_SYNC"] = "1"
|
||||
env["DD_SYNC"] = "1"
|
||||
say("droiddeck-esync: %s; stock binaries with droiddeck-ntsync" % reason)
|
||||
log_launch(root, command, env, tool, None)
|
||||
return command, env
|
||||
@@ -880,17 +883,17 @@ def wineserver_only(env):
|
||||
if truthy(env["PROTON_NO_FSYNC"]):
|
||||
env["WINEFSYNC"] = "0"
|
||||
if truthy(env["PROTON_NO_NTSYNC"]):
|
||||
env["BL_SYNC"] = "0"
|
||||
env["DD_SYNC"] = "0"
|
||||
return env
|
||||
|
||||
|
||||
def choose(root, command, env, tool, stock):
|
||||
name = os.path.basename(tool.rstrip("/")) or tool
|
||||
wants_fsync = env.get("BL_FSYNC_FIRST") == "1"
|
||||
if "BL_FSYNC" in env:
|
||||
env["BL_FSYNC"] = "0"
|
||||
stock = (stock[0], dict(stock[1], BL_FSYNC="0"))
|
||||
if env.get("BL_SYNC_FALLBACK") != "1" and not wants_fsync and env.get("BL_SYNC") != "1":
|
||||
wants_fsync = env.get("DD_FSYNC_FIRST") == "1"
|
||||
if "DD_FSYNC" in env:
|
||||
env["DD_FSYNC"] = "0"
|
||||
stock = (stock[0], dict(stock[1], DD_FSYNC="0"))
|
||||
if env.get("DD_SYNC_FALLBACK") != "1" and not wants_fsync and env.get("DD_SYNC") != "1":
|
||||
stock = (stock[0], wineserver_only(stock[1]))
|
||||
say("droiddeck-esync: off; wineserver sync only")
|
||||
log_launch(root, stock[0], stock[1], tool, None)
|
||||
@@ -898,14 +901,14 @@ def choose(root, command, env, tool, stock):
|
||||
cache = HashCache(root)
|
||||
try:
|
||||
measured = measure(tool, cache)
|
||||
if env.get("BL_SYNC") == "1" and not measured["ntsync"]:
|
||||
env["BL_SYNC"] = "0"
|
||||
stock = (stock[0], dict(stock[1], BL_SYNC="0"))
|
||||
if env.get("DD_SYNC") == "1" and not measured["ntsync"]:
|
||||
env["DD_SYNC"] = "0"
|
||||
stock = (stock[0], dict(stock[1], DD_SYNC="0"))
|
||||
wants_fsync = True
|
||||
say("droiddeck-ntsync: %s has no ntsync; trying droiddeck-fsync" % name)
|
||||
if wants_fsync and fsync_ready(env, measured):
|
||||
return with_fsync(root, command, env, tool, "chosen for %s" % name)
|
||||
if env.get("BL_SYNC_FALLBACK") != "1":
|
||||
if env.get("DD_SYNC_FALLBACK") != "1":
|
||||
say("droiddeck-esync: off")
|
||||
log_launch(root, command, env, tool, None)
|
||||
return stock
|
||||
@@ -936,16 +939,16 @@ def choose(root, command, env, tool, stock):
|
||||
env["WINEESYNC"] = "0"
|
||||
env["PROTON_NO_ESYNC"] = "1"
|
||||
if not truthy(env.get("PROTON_NO_NTSYNC")) and measured["ntsync"]:
|
||||
env["BL_SYNC"] = "1"
|
||||
env["DD_SYNC"] = "1"
|
||||
elif not env.get("WINEESYNC"):
|
||||
env["WINEESYNC"] = "1"
|
||||
if truthy(env["WINEESYNC"]) and "PROTON_NO_FSYNC" not in env:
|
||||
env["PROTON_NO_FSYNC"] = "1"
|
||||
env["WINESERVER"] = os.path.join(dist, WINESERVER)
|
||||
env["BL_SYNC_PACK"] = pack["id"]
|
||||
env["DD_SYNC_PACK"] = pack["id"]
|
||||
command[0] = os.path.join(dist, os.path.basename(command[0]))
|
||||
say("droiddeck-esync: pack %s for %s (%s, %s match); droiddeck-ntsync %s, droiddeck-esync %s, fds %s/%s"
|
||||
% (pack["id"], name, measured["version_line"], match_kind(pack, measured), "on" if env.get("BL_SYNC") == "1" else "off",
|
||||
% (pack["id"], name, measured["version_line"], match_kind(pack, measured), "on" if env.get("DD_SYNC") == "1" else "off",
|
||||
"on" if truthy(env["WINEESYNC"]) else "off", limit(soft), limit(hard)))
|
||||
log_launch(root, command, env, tool, pack["id"])
|
||||
return command, env
|
||||
@@ -1005,7 +1008,7 @@ def update_wanted(root, fresh, scanned, packs, cache):
|
||||
def reconcile_store(root, steam_root, env):
|
||||
cache = HashCache(root)
|
||||
packs = load_packs(root)
|
||||
enabled = env.get("BL_SYNC_FALLBACK") == "1"
|
||||
enabled = env.get("DD_SYNC_FALLBACK") == "1"
|
||||
rows = []
|
||||
fresh = {}
|
||||
scanned = set()
|
||||
|
||||
@@ -38,7 +38,7 @@ RUNTIMES = {SNIPER_APPID: ("sniper_platform_", "Steam Linux Runtime 3.0 (sniper"
|
||||
SLR4_APPID: ("steamrt4_platform_", "Steam Linux Runtime 4.0 (steamrt4")}
|
||||
MARKER = ".droiddeck-fex"
|
||||
LAYOUT = 1
|
||||
ROOTFS_LAYOUT = 4
|
||||
ROOTFS_LAYOUT = 10
|
||||
BLOB_DIRS = re.compile(r"^(?:\.ref|[0-9a-f]{2})$")
|
||||
ROOTFS_LIBRARY_DIRS = ("lib", "lib64")
|
||||
ARCH_DIRS = ("x86_64-linux-gnu", "i386-linux-gnu")
|
||||
@@ -49,10 +49,18 @@ PROVIDED = frozenset((
|
||||
"libnss_compat.so.2", "libnss_dns.so.2", "libnss_files.so.2", "libnss_hesiod.so.2", "libthread_db.so.1",
|
||||
"libmemusage.so", "libpcprofile.so", "libc_malloc_debug.so.0", "gconv", "libstdc++.so.6", "libgcc_s.so.1",
|
||||
"libssl.so.3", "libcrypto.so.3",
|
||||
"libfreetype.so.6", "libpng16.so.16", "libbrotlidec.so.1", "libbrotlicommon.so.1", "libbz2.so.1.0", "libz.so.1",
|
||||
"libwayland-client.so.0", "libwayland-egl.so.1", "libwayland-server.so.0", "libffi.so.8",
|
||||
"libgbm.so.1", "libdrm.so.2", "libexpat.so.1",
|
||||
))
|
||||
PROVIDED_NEEDS = {
|
||||
"libwayland-client.so.0": ("libffi.so.8",),
|
||||
"libwayland-server.so.0": ("libffi.so.8",),
|
||||
"libgbm.so.1": ("libdrm.so.2", "libexpat.so.1"),
|
||||
}
|
||||
GLIBC_BUILD = re.compile(r"^(?:ld|lib[A-Za-z_]+)-2\.[0-9]+\.so$|^libSegFault\.so$")
|
||||
GUEST_LIBDIRS = (("x86_64", "lib/x86_64-linux-gnu"), ("i386", "lib/i386-linux-gnu"))
|
||||
PRELOAD_NAMES = ("libblsession.so", "libfakeinput.so")
|
||||
PRELOAD_NAMES = ("libddsession.so", "libfakeinput.so")
|
||||
FAULT_REPORT = "libfaultreport.so"
|
||||
VULKAN_PIN = "libvulkan-thunk.so"
|
||||
VULKAN_PIN_DIR = "lib/x86_64-linux-gnu/droiddeck/vulkan"
|
||||
@@ -174,7 +182,7 @@ def own_fex_loads():
|
||||
|
||||
|
||||
def update_own_fex():
|
||||
wanted = os.environ.get("BL_FEX_TAG")
|
||||
wanted = os.environ.get("DD_FEX_TAG")
|
||||
if not wanted:
|
||||
return
|
||||
if (read_text(OWN_FEX_TAG) or "").strip() == wanted and own_fex_loads():
|
||||
@@ -343,10 +351,14 @@ def stays_in_libraries(root, target, link):
|
||||
|
||||
|
||||
def mirror(source, provider, name, target, root):
|
||||
if provider and name in PROVIDED and os.path.lexists(os.path.join(provider, name)):
|
||||
usable_provider = provider and all(os.path.exists(os.path.join(provider, needed))
|
||||
for needed in (name,) + PROVIDED_NEEDS.get(name, ()))
|
||||
if name in PROVIDED and usable_provider:
|
||||
clone(os.path.join(provider, name), os.path.join(target, name))
|
||||
return
|
||||
path = os.path.join(source, name)
|
||||
if not os.path.lexists(path):
|
||||
return
|
||||
link = os.readlink(path) if os.path.islink(path) else None
|
||||
if link and GLIBC_BUILD.match(os.path.basename(link)):
|
||||
if name not in INTERPRETERS:
|
||||
@@ -365,6 +377,16 @@ def build_rootfs(base, provider):
|
||||
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 "",
|
||||
os.path.realpath(provider), read_text(os.path.join(provider_files, MARKER)) or "")
|
||||
for top in ("lib", "lib64"):
|
||||
for arch in ARCH_DIRS:
|
||||
for name in sorted(PROVIDED):
|
||||
path = os.path.join(provider_files, top, arch, name)
|
||||
try:
|
||||
info = os.stat(path)
|
||||
stamp += "\n%s %s %d %d %d %d" % (path, os.path.realpath(path), info.st_ino, info.st_size,
|
||||
info.st_mtime_ns, info.st_ctime_ns)
|
||||
except OSError:
|
||||
stamp += "\n%s missing" % path
|
||||
if read_text(os.path.join(rootfs, MARKER)) == stamp:
|
||||
return False
|
||||
for entry in os.listdir(STATE):
|
||||
@@ -384,7 +406,7 @@ def build_rootfs(base, provider):
|
||||
if entry in ARCH_DIRS and os.path.isdir(path) and not os.path.islink(path):
|
||||
provided = os.path.join(provider_files, top, entry)
|
||||
os.makedirs(os.path.join(tmp, top, entry))
|
||||
for name in set(os.listdir(path)) | {name for name in PROVIDED if os.path.lexists(os.path.join(provided, name))}:
|
||||
for name in set(os.listdir(path)) | {name for name in PROVIDED if os.path.exists(os.path.join(provided, name))}:
|
||||
mirror(path, provided, name, os.path.join(tmp, top, entry), tmp)
|
||||
else:
|
||||
mirror(source, None, entry, os.path.join(tmp, top), tmp)
|
||||
|
||||
@@ -55,11 +55,11 @@ fex_ready() {
|
||||
local have ok=
|
||||
have=$(cat /usr/local/share/fex-emu/.droiddeck-tag 2>/dev/null || true)
|
||||
[ -x /usr/local/bin/FEX ] && fex_loads / && ok=1
|
||||
if [ -n "${BL_FEX_TAG:-}" ]; then
|
||||
if [ -n "$ok" ] && [ "$have" = "$BL_FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=catalog; return 0; fi
|
||||
step "downloading FEX ($BL_FEX_TAG)"
|
||||
if fex_install "$BL_FEX_TAG" "${BL_FEX_SHA256:-}" "${BL_FEX_URLS:-}"; then FEX_NOW=$BL_FEX_TAG FEX_FROM=catalog; return 0; fi
|
||||
if [ -n "$ok" ]; then FEX_NOW=$have FEX_FROM="kept; $BL_FEX_TAG did not install"; return 0; fi
|
||||
if [ -n "${DD_FEX_TAG:-}" ]; then
|
||||
if [ -n "$ok" ] && [ "$have" = "$DD_FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=catalog; return 0; fi
|
||||
step "downloading FEX ($DD_FEX_TAG)"
|
||||
if fex_install "$DD_FEX_TAG" "${DD_FEX_SHA256:-}" "${DD_FEX_URLS:-}"; then FEX_NOW=$DD_FEX_TAG FEX_FROM=catalog; return 0; fi
|
||||
if [ -n "$ok" ]; then FEX_NOW=$have FEX_FROM="kept; $DD_FEX_TAG did not install"; return 0; fi
|
||||
fi
|
||||
if [ -n "$ok" ] && [ "$have" = "$FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=built-in; return 0; fi
|
||||
step "downloading FEX ($FEX_TAG)"
|
||||
|
||||
@@ -7,7 +7,7 @@ case ":${XDG_DATA_DIRS:-}:" in
|
||||
*) export XDG_DATA_DIRS=$HOME/.local/share/flatpak/exports/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share} ;;
|
||||
esac
|
||||
socket=()
|
||||
if [ -n "${BL_INSIDE:-}" ] || [ -n "${GAMESCOPE_WAYLAND_DISPLAY:-}" ]; then
|
||||
if [ -n "${DD_INSIDE:-}" ] || [ -n "${GAMESCOPE_WAYLAND_DISPLAY:-}" ]; then
|
||||
unset WAYLAND_DISPLAY
|
||||
export XDG_SESSION_TYPE=x11
|
||||
socket=(--nosocket=wayland --socket=x11)
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#!/usr/bin/python3
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
GAME_DEBUG_CHANNELS = (
|
||||
@@ -44,7 +47,7 @@ def load_config():
|
||||
|
||||
|
||||
def session_debug_dir(env):
|
||||
return env.get("BL_DEBUG_DIR", "")
|
||||
return env.get("DD_DEBUG_DIR", "")
|
||||
|
||||
|
||||
def apply_game_debug_logs(env, config=None, debug_dir=None):
|
||||
@@ -69,3 +72,74 @@ def apply_game_debug_logs(env, config=None, debug_dir=None):
|
||||
"WINEDEBUG": game_debug_channels(env.get("WINEDEBUG"), env.get("PROTON_LOG")),
|
||||
})
|
||||
return result
|
||||
|
||||
|
||||
def capped_log(path, limit, mirror=False):
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
handle = open(path, "wb")
|
||||
try:
|
||||
read, write = os.pipe()
|
||||
except OSError:
|
||||
handle.close()
|
||||
raise
|
||||
|
||||
def pump():
|
||||
remaining = limit
|
||||
mirror_ok = mirror
|
||||
with os.fdopen(read, "rb") as source, handle:
|
||||
while True:
|
||||
chunk = source.read1(65536)
|
||||
if not chunk:
|
||||
break
|
||||
saved = chunk[:remaining]
|
||||
remaining -= len(saved)
|
||||
if saved:
|
||||
try:
|
||||
handle.write(saved)
|
||||
handle.flush()
|
||||
except (OSError, ValueError):
|
||||
remaining = 0
|
||||
if mirror_ok:
|
||||
try:
|
||||
sys.stderr.write(chunk.decode("utf-8", "replace"))
|
||||
sys.stderr.flush()
|
||||
except (OSError, ValueError):
|
||||
mirror_ok = False
|
||||
|
||||
thread = threading.Thread(target=pump, daemon=True)
|
||||
thread.start()
|
||||
return write, thread
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def desktop_program_logs(env):
|
||||
program = env.get("DROIDDECK_DESKTOP_PROGRAM")
|
||||
if program:
|
||||
env = dict(env)
|
||||
env.pop("DROIDDECK_DESKTOP_PROGRAM", None)
|
||||
if not program or env.get("PROTON_LOG", "0") not in ("", "0"):
|
||||
yield env, None
|
||||
return
|
||||
folder = session_debug_dir(env)
|
||||
try:
|
||||
if not os.path.isabs(folder) or not os.path.isdir(folder):
|
||||
raise OSError("session log directory unavailable")
|
||||
fd, path = tempfile.mkstemp(prefix="desktop-program-", suffix=".log", dir=folder)
|
||||
os.close(fd)
|
||||
output, thread = capped_log(path, 1024 * 1024, mirror=True)
|
||||
except OSError as error:
|
||||
print("droiddeck-game-env: desktop diagnostics unavailable (%s)" % error, file=sys.stderr)
|
||||
yield env, None
|
||||
return
|
||||
try:
|
||||
if env.get("WINEDEBUG", "-all") in ("", "-all"):
|
||||
env["WINEDEBUG"] = "-all,err+all,+mscoree,+loaddll"
|
||||
try:
|
||||
print("droiddeck-game-env: desktop program %s; first 1048576 diagnostic bytes: %s" % (program, path),
|
||||
file=sys.stderr, flush=True)
|
||||
except OSError:
|
||||
pass
|
||||
yield env, output
|
||||
finally:
|
||||
os.close(output)
|
||||
thread.join(timeout=1)
|
||||
@@ -2,6 +2,7 @@
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import runpy
|
||||
import signal
|
||||
@@ -14,9 +15,9 @@ GAME_PREFIX = "DROIDDECK_GAME_"
|
||||
GAME_SPLIT_KEYS = ("TU_DEBUG", "MESA_NO_ERROR")
|
||||
CHROMIUM_FILES = {"chrome-sandbox", "chrome_100_percent.pak", "v8_context_snapshot.bin"}
|
||||
D3D9_DEFAULT_MEMORY_MB = 4096
|
||||
SYNC_KEYS = ("BL_SYNC", "BL_SYNC_FALLBACK", "BL_FSYNC_FIRST", "BL_SYNC_MIN_NOFILE", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
SYNC_KEYS = ("DD_SYNC", "DD_SYNC_FALLBACK", "DD_FSYNC_FIRST", "DD_SYNC_MIN_NOFILE", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC", "PROTON_NO_NTSYNC", "WINEESYNC")
|
||||
SEED_REDISTS = "/usr/local/bin/droiddeck-seed-redists"
|
||||
PACK_KEYS = ("WINESERVER", "BL_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC")
|
||||
PACK_KEYS = ("WINESERVER", "DD_SYNC_PACK", "WINEESYNC", "PROTON_NO_ESYNC", "PROTON_NO_FSYNC")
|
||||
GAME_DEBUG = runpy.run_path(str(Path(__file__).with_name("droiddeck-game-debug")))
|
||||
game_debug_channels = GAME_DEBUG["game_debug_channels"]
|
||||
apply_game_debug_logs = GAME_DEBUG["apply_game_debug_logs"]
|
||||
@@ -453,7 +454,7 @@ def game_gpu(env, keep=False):
|
||||
|
||||
|
||||
def vram_cap(env):
|
||||
value = env.get("BL_VRAM_MB", "")
|
||||
value = env.get("DD_VRAM_MB", "")
|
||||
if not re.fullmatch(r"[1-9][0-9]{0,6}", value):
|
||||
return env
|
||||
result = env.copy()
|
||||
@@ -551,7 +552,7 @@ def cpu_topology(env, command=()):
|
||||
if env["WINE_CPU_TOPOLOGY"]:
|
||||
env["PROTON_CPU_TOPOLOGY"] = env["WINE_CPU_TOPOLOGY"]
|
||||
return
|
||||
picked = bool(env.get("DROIDDECK_GAME_CORES", "").strip() or env.get("BL_GAME_CPUS", "").strip())
|
||||
picked = bool(env.get("DROIDDECK_GAME_CORES", "").strip() or env.get("DD_GAME_CPUS", "").strip())
|
||||
fastest = env.get("DROIDDECK_FASTEST_CORES", "").strip() != "0" and game_id(env) is not None
|
||||
if not (picked or fastest):
|
||||
return
|
||||
@@ -632,7 +633,7 @@ def apply_config(env, config, app_id, fixes=None):
|
||||
# An open driver pair (PanVK, RADV) on a GPU that is not an Adreno: vkd3d-proton reports the
|
||||
# driver's own feature level and shader model. The app-wide 12_2 / 6_9 over-promised what PanVK
|
||||
# has, and an Unreal DX12 game took paths that crashed. A game's own setting still wins.
|
||||
if env.get("BL_OPEN_DRIVER") == "1":
|
||||
if env.get("DD_OPEN_DRIVER") == "1":
|
||||
game = config.get("games", {}).get(app_id, {}) or {}
|
||||
for name in ("VKD3D_FEATURE_LEVEL", "VKD3D_SHADER_MODEL"):
|
||||
if name not in game and name in result:
|
||||
@@ -667,7 +668,7 @@ def render_path_defaults(command, env):
|
||||
|
||||
|
||||
def bridge_feature_level(env):
|
||||
if env.get("BL_VKBRIDGE") != "1" or env.get("VKD3D_FEATURE_LEVEL") not in ("12_1", "12_2"):
|
||||
if env.get("DD_VKBRIDGE") != "1" or env.get("VKD3D_FEATURE_LEVEL") not in ("12_1", "12_2"):
|
||||
return None
|
||||
was = env["VKD3D_FEATURE_LEVEL"]
|
||||
env["VKD3D_FEATURE_LEVEL"] = "12_0"
|
||||
@@ -748,11 +749,31 @@ EVALUATOR_SCRIPT = re.compile(r"(?:^|[\\/])evaluatorscript_[0-9]+\.vdf$", re.IGN
|
||||
def mark_install_scripts(command, env):
|
||||
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")
|
||||
root = env.get("DD_X64_STEAM_ROOT") or env.get("STEAM_COMPAT_CLIENT_INSTALL_PATH") or str(Path.home() / ".local/share/Steam")
|
||||
scripts = [str(Path(root) / arg.replace("\\", "/")) for arg in command if EVALUATOR_SCRIPT.search(arg)]
|
||||
scripts = [path for path in scripts if os.path.isfile(path)]
|
||||
if not scripts:
|
||||
return []
|
||||
data = env.get("STEAM_COMPAT_DATA_PATH")
|
||||
tool = os.path.dirname(command[0])
|
||||
new_prefix = data and not os.path.isfile(os.path.join(data, "pfx", "system.reg"))
|
||||
template = "default_pfx"
|
||||
if env.get("PROTON_USE_ARM64", "1") == "1" and platform.machine() == "aarch64" and os.path.isdir(os.path.join(tool, "files/bin-arm64")):
|
||||
template = "default_pfx_arm64"
|
||||
if new_prefix and not os.path.isfile(os.path.join(tool, "files/share", template, "system.reg")):
|
||||
try:
|
||||
subprocess.run([command[0], "run", "cmd.exe", "/c", "exit", "0"], env=env,
|
||||
stdout=sys.stderr, stderr=sys.stderr, timeout=120, check=False)
|
||||
except (OSError, subprocess.SubprocessError) as error:
|
||||
print("droiddeck-game-env: prefix initialization failed (%s)" % error, file=sys.stderr)
|
||||
try:
|
||||
wineserver = next((path for path in (os.path.join(tool, "files", name, "wineserver") for name in ("bin-arm64", "bin"))
|
||||
if os.access(path, os.X_OK)), os.path.join(tool, "files/bin-arm64/wineserver"))
|
||||
subprocess.run([wineserver, "-w"], env=dict(env, WINEPREFIX=os.path.join(data, "pfx")),
|
||||
stdout=sys.stderr, stderr=sys.stderr, timeout=120, check=True)
|
||||
except (OSError, subprocess.SubprocessError) as error:
|
||||
print("droiddeck-game-env: wineserver wait failed (%s)" % error, file=sys.stderr)
|
||||
return scripts
|
||||
try:
|
||||
subprocess.run([SEED_REDISTS, root], env=dict(env, DROIDDECK_SEED_SCRIPTS="\n".join(scripts)),
|
||||
stdout=sys.stderr, timeout=60, check=False)
|
||||
@@ -980,7 +1001,7 @@ def repair_foreign_system_dlls(prefix, proton, env=None):
|
||||
machine = pe_machine(path)
|
||||
if machine is None or PE["machine_compatible"](path, machines, machine, builtins):
|
||||
continue
|
||||
link = path.parent / (name + ".bl-new")
|
||||
link = path.parent / (name + ".dd-new")
|
||||
backup = path.parent / (name + FOREIGN_SUFFIX)
|
||||
if backups:
|
||||
backup = path.parent / (name + FOREIGN_SUFFIX + ".%d" % (backups[-1][0] + 1))
|
||||
@@ -1157,11 +1178,22 @@ def diagnostic_game_exit(app_id, raw_code, source=None, wrapper_status=None):
|
||||
|
||||
|
||||
def start(launch, launch_env, digest, after=None, diagnostic_app_id=None):
|
||||
with GAME_DEBUG["desktop_program_logs"](launch_env) as (env, output):
|
||||
code = start_process(launch, env, digest, after, diagnostic_app_id, output)
|
||||
if output is not None:
|
||||
try:
|
||||
print("droiddeck-game-env: desktop program exited with status %d" % code, file=sys.stderr, flush=True)
|
||||
except OSError:
|
||||
pass
|
||||
return code
|
||||
|
||||
|
||||
def start_process(launch, launch_env, digest, after=None, diagnostic_app_id=None, output=None):
|
||||
if len(launch) > 1 and launch[1] == "waitforexitandrun":
|
||||
ubisoft_composition_off(launch[0], launch_env)
|
||||
launch, launch_env = system_graphics_launch(launch, launch_env)
|
||||
if after or diagnostic_app_id is not None:
|
||||
process = subprocess.Popen(launch, env=launch_env)
|
||||
if after or diagnostic_app_id is not None or output is not None:
|
||||
process = subprocess.Popen(launch, env=launch_env, stderr=output)
|
||||
if diagnostic_app_id is not None:
|
||||
diagnostic_game_event("game_start", diagnostic_app_id)
|
||||
try:
|
||||
@@ -1238,14 +1270,14 @@ def system_graphics_launch(command, env):
|
||||
def game_logs(command, env, app_id, now=None):
|
||||
"""Detailed graphics logs for one game launch, in the session's log folder: Proton's own log,
|
||||
DXVK's and vkd3d-proton's, and the Vulkan driver's startup messages. The app turns this on
|
||||
(BL_GAME_LOGS=1) on a GPU that is not an Adreno, or with Setup's "Detailed graphics logs"."""
|
||||
if env.get("BL_GAME_LOGS") != "1" or not env.get("BL_DEBUG_DIR") or len(command) < 3 \
|
||||
(DD_GAME_LOGS=1) on a GPU that is not an Adreno, or with Setup's "Detailed graphics logs"."""
|
||||
if env.get("DD_GAME_LOGS") != "1" or not env.get("DD_DEBUG_DIR") or len(command) < 3 \
|
||||
or command[1] != "waitforexitandrun":
|
||||
return env
|
||||
import time
|
||||
stamp = time.strftime("%Y%m%d-%H%M%S", time.localtime(now))
|
||||
name = app_id or re.sub(r"[^A-Za-z0-9._-]+", "_", Path(command[2]).stem)[:40] or "game"
|
||||
parent = Path(env["BL_DEBUG_DIR"]) / "games"
|
||||
parent = Path(env["DD_DEBUG_DIR"]) / "games"
|
||||
try:
|
||||
parent.mkdir(parents=True, exist_ok=True)
|
||||
folder = Path(tempfile.mkdtemp(prefix=stamp + "-", suffix="-" + name, dir=parent))
|
||||
@@ -1271,7 +1303,7 @@ def game_logs(command, env, app_id, now=None):
|
||||
"proton: %s" % command[0],
|
||||
"started: %s" % time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(now)),
|
||||
] + ["%s=%s" % (key, env[key]) for key in sorted(env)
|
||||
if key.startswith(("VK_", "BL_VK", "BL_DRM", "BL_OPEN", "MESA_", "PANVK", "DXVK_", "VKD3D", "ZINK", "TU_", "DROIDDECK_VKD3D"))]) + "\n")
|
||||
if key.startswith(("VK_", "DD_VK", "DD_DRM", "DD_OPEN", "MESA_", "PANVK", "DXVK_", "VKD3D", "ZINK", "TU_", "DROIDDECK_VKD3D"))]) + "\n")
|
||||
except OSError:
|
||||
pass
|
||||
# Whether the game's sound reaches PulseAudio: the streams 20 s and 60 s in, without waiting.
|
||||
@@ -1296,7 +1328,7 @@ def main():
|
||||
if not command:
|
||||
return 2
|
||||
env = game_gpu(os.environ.copy())
|
||||
mic_enabled = env.get("BL_MIC_ENABLED")
|
||||
mic_enabled = env.get("DD_MIC_ENABLED")
|
||||
debug_dir = session_debug_dir(env)
|
||||
prefix_path = env.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
|
||||
app_id = game_id(env)
|
||||
@@ -1338,7 +1370,7 @@ def main():
|
||||
if fixed:
|
||||
print("droiddeck-game-env: replaced foreign-architecture system DLLs with this Proton's own: %s" % ", ".join(fixed),
|
||||
file=sys.stderr)
|
||||
scripts = mark_install_scripts(command, env)
|
||||
scripts = mark_install_scripts(command, effective_env)
|
||||
if scripts and install_scripts_done(scripts, env):
|
||||
print("droiddeck-game-env: install scripts already run in this prefix; evaluator skipped", file=sys.stderr)
|
||||
return 0
|
||||
|
||||
@@ -99,11 +99,11 @@ def desktop_environment(base, proc=Path("/proc")):
|
||||
if command != b"/usr/bin/plasmashell":
|
||||
continue
|
||||
values = dict(os.fsdecode(item).split("=", 1) for item in (entry / "environ").read_bytes().split(b"\0") if b"=" in item)
|
||||
if values.get("BL_DESKTOP") != "1" or values.get("XDG_RUNTIME_DIR") != env.get("XDG_RUNTIME_DIR"):
|
||||
if values.get("DD_DESKTOP") != "1" or values.get("XDG_RUNTIME_DIR") != env.get("XDG_RUNTIME_DIR"):
|
||||
continue
|
||||
if not values.get("DISPLAY") or values.get("WAYLAND_DISPLAY") == env.get("WAYLAND_DISPLAY"):
|
||||
continue
|
||||
for key in ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS", "BL_DESKTOP"):
|
||||
for key in ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS", "DD_DESKTOP"):
|
||||
if key in values:
|
||||
env[key] = values[key]
|
||||
return env
|
||||
@@ -130,10 +130,10 @@ def runner(folder, appid, game, graphical=False):
|
||||
raise ValueError("No Proton tool is installed for this game")
|
||||
tool, command = available[name]
|
||||
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 = run["environment"](base, target, tool, root, window=base.get("DD_DESKTOP") == "1")
|
||||
env["DROIDDECK_GOG_MAINTENANCE"] = "1"
|
||||
env["FEX_X87REDUCEDPRECISION"] = "0"
|
||||
env.pop("BL_STORE_EXIT", None)
|
||||
env.pop("DD_STORE_EXIT", None)
|
||||
return str(Path(tool) / command), env, target.compatdata
|
||||
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ def advertise_compositing():
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
raise SystemExit('usage: droiddeck-gpu-window <program> [args...]')
|
||||
if 'BL_GPU_CHILD_WSI' in os.environ:
|
||||
wsi = os.environ.pop('BL_GPU_CHILD_WSI')
|
||||
if 'DD_GPU_CHILD_WSI' in os.environ:
|
||||
wsi = os.environ.pop('DD_GPU_CHILD_WSI')
|
||||
if wsi:
|
||||
os.environ['MESA_VK_WSI_DEBUG'] = wsi
|
||||
else:
|
||||
|
||||
@@ -84,8 +84,8 @@ def connect():
|
||||
|
||||
|
||||
def main():
|
||||
launch = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
report = Report(os.environ.get("BL_IME_DIR") or (os.path.join(launch, "agent") if launch else ""))
|
||||
launch = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
report = Report(os.environ.get("DD_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 = {}
|
||||
|
||||
@@ -323,7 +323,7 @@ def load_netmanager():
|
||||
|
||||
|
||||
def main():
|
||||
directory = os.environ.get("BL_LAUNCH_DIR")
|
||||
directory = os.environ.get("DD_LAUNCH_DIR")
|
||||
if not directory or not Path(directory).is_dir():
|
||||
sys.exit("droiddeck-login1: no DroidDeck session directory")
|
||||
ready = Path(directory) / "steam-sleep-ready"
|
||||
|
||||
@@ -187,7 +187,7 @@ def import_of(key, what):
|
||||
|
||||
|
||||
def imported(what, real, key, name):
|
||||
launch = os.environ.get("BL_LAUNCH_DIR")
|
||||
launch = os.environ.get("DD_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)
|
||||
result = os.path.join(launch, "desktop-import-%s.result" % key)
|
||||
@@ -311,7 +311,7 @@ def command(path, args, what, window=False, appid=None):
|
||||
|
||||
|
||||
def on_desktop(env):
|
||||
return env.get("BL_DESKTOP") == "1" and not env.get("GAMESCOPE_WAYLAND_DISPLAY") and os.access(GPU, os.X_OK)
|
||||
return env.get("DD_DESKTOP") == "1" and not env.get("GAMESCOPE_WAYLAND_DISPLAY") and os.access(GPU, os.X_OK)
|
||||
|
||||
|
||||
def unattended(env):
|
||||
@@ -321,7 +321,7 @@ def unattended(env):
|
||||
return True
|
||||
if stat.S_ISCHR(out.st_mode):
|
||||
return not os.isatty(1)
|
||||
folder = env.get("BL_DEBUG_DIR")
|
||||
folder = env.get("DD_DEBUG_DIR")
|
||||
try:
|
||||
log = os.stat(os.path.join(folder, "desktop.log")) if folder else None
|
||||
except OSError:
|
||||
@@ -417,7 +417,7 @@ def main(argv):
|
||||
say("%s: %s" % (cmd[0], error))
|
||||
if status != 0 and time.monotonic() - started < QUICK_FAILURE:
|
||||
notify("%s did not start" % os.path.basename(path),
|
||||
"It exited with status %d; the session's desktop.log says why." % status)
|
||||
"desktop.log (%d)" % status)
|
||||
if what == "windows":
|
||||
try:
|
||||
subprocess.call([sys.executable, PROGRAMS])
|
||||
|
||||
@@ -30,7 +30,7 @@ def main(argv):
|
||||
url = argv[0] if argv else ""
|
||||
if url.startswith("steam://openurl/"):
|
||||
url = url[len("steam://openurl/"):]
|
||||
launch_dir = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
launch_dir = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
if not launch_dir:
|
||||
try:
|
||||
launch_dir = open(LAUNCH_DIR_FILE).read().strip()
|
||||
|
||||
@@ -693,7 +693,7 @@ def melonds_geometry():
|
||||
import base64, struct
|
||||
w, h = 512, 288
|
||||
try:
|
||||
screen_w = int(os.environ.get("BL_WIDTH", "1920"))
|
||||
screen_w = int(os.environ.get("DD_WIDTH", "1920"))
|
||||
except ValueError:
|
||||
screen_w = 1920
|
||||
rect = (0, 0, w - 1, h - 1)
|
||||
|
||||
@@ -227,7 +227,7 @@ def shortcut_entries(root):
|
||||
except (OSError, ValueError, IndexError, KeyError, struct.error):
|
||||
pass
|
||||
try:
|
||||
with open(os.environ.get("BL_ADDED_GAMES", ""), encoding="utf-8") as f:
|
||||
with open(os.environ.get("DD_ADDED_GAMES", ""), encoding="utf-8") as f:
|
||||
for game in json.load(f):
|
||||
if isinstance(game, dict) and game.get("exe") and str(game.get("appid", "")).isdigit():
|
||||
entries.append((int(game["appid"]) & 0xFFFFFFFF, game["exe"], game.get("dir") or ""))
|
||||
@@ -524,6 +524,8 @@ def main(argv):
|
||||
os.makedirs(target.compatdata, exist_ok=True)
|
||||
env = environment(os.environ, target, folder, root, window, game_id)
|
||||
env.update(extra)
|
||||
if app is None and verb == VERB:
|
||||
env["DROIDDECK_DESKTOP_PROGRAM"] = program
|
||||
say("%s with %s (%s), %s prefix %s%s" % (program, name, why, target.kind, target.compatdata,
|
||||
", without the Steam client" if app is not None else ""))
|
||||
try:
|
||||
|
||||
@@ -16,7 +16,7 @@ run=("${interp[@]}" "./$entry")
|
||||
if [ -x /usr/local/bin/droiddeck-fex ]; then
|
||||
run=(/usr/local/bin/droiddeck-fex run --mode "$fex" --for "$folder" -- "${interp[@]}" "./$entry")
|
||||
fi
|
||||
if [ "$fex" = off ]; then unset BL_BINFMT; else export BL_BINFMT=1; fi
|
||||
if [ "$fex" = off ]; then unset DD_BINFMT; else export DD_BINFMT=1; fi
|
||||
echo "== script $entry in $folder (${interp[*]:-a program}, FEX $fex)"
|
||||
case ${DBUS_SESSION_BUS_ADDRESS:-} in
|
||||
unix:*) "${run[@]}" "$@" ;;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1315,7 +1315,7 @@ def main():
|
||||
files_only = sys.argv[1:2] == ["--files-only"]
|
||||
steam_root = sys.argv[2 if files_only else 1]
|
||||
try:
|
||||
port = int(os.environ.get("BL_CDP_PORT", ""))
|
||||
port = int(os.environ.get("DD_CDP_PORT", ""))
|
||||
except ValueError:
|
||||
say("no devtools port for this session; the client's mapping is kept through config.vdf")
|
||||
return 0
|
||||
@@ -1339,7 +1339,7 @@ def main():
|
||||
watcher = Watcher([COMPAT["state_path"]("request.json"), COMPAT["state_path"]("games.json"),
|
||||
os.path.join(steam_root, "appcache", "appinfo.vdf")] +
|
||||
[os.path.join(lib, "steamapps", "libraryfolders.vdf") for lib in (steam_root, COMPAT["LIBRARY"] + "-sd")])
|
||||
steamos = os.environ.get("BL_STEAMDECK") == "1" and os.environ.get("BL_STEAM_UI") != "desktop"
|
||||
steamos = os.environ.get("DD_STEAMDECK") == "1" and os.environ.get("DD_STEAM_UI") != "desktop"
|
||||
helper = Helper(steam_root, port, steamos)
|
||||
failures = 0
|
||||
last = None
|
||||
|
||||
@@ -21,9 +21,9 @@ def select_desktop(evaluate, timeout=90):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
base = os.environ.get('BL_LAUNCH_DIR')
|
||||
base = os.environ.get('DD_LAUNCH_DIR')
|
||||
if not base:
|
||||
raise SystemExit('BL_LAUNCH_DIR is not set')
|
||||
raise SystemExit('DD_LAUNCH_DIR is not set')
|
||||
agent = runpy.run_path('/usr/local/bin/droiddeck-agent')
|
||||
selected = select_desktop(lambda expression: agent['cdp_eval'](
|
||||
Path(base) / 'agent', expression, timeout=2))
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
import ctypes as C
|
||||
import functools
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import runpy
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -132,7 +134,7 @@ def method(obj, slot, result, *args):
|
||||
|
||||
|
||||
def probe(steam_root, ids):
|
||||
library = C.CDLL(os.environ.get("BL_STEAMCLIENT") or str(Path(steam_root) / "steamrtarm64/steamclient.so"))
|
||||
library = C.CDLL(os.environ.get("DD_STEAMCLIENT") or str(Path(steam_root) / "steamrtarm64/steamclient.so"))
|
||||
library.CreateInterface.argtypes = [C.c_char_p, C.c_void_p]
|
||||
library.CreateInterface.restype = C.c_void_p
|
||||
client = library.CreateInterface(b"SteamClient020", None)
|
||||
@@ -182,8 +184,8 @@ def downloads_idle(steam_root):
|
||||
|
||||
|
||||
def request_restart(steam_root):
|
||||
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"]
|
||||
Path(os.environ.get("HOME", "/root"), ".dd-restart-once").touch()
|
||||
command = shlex.split(os.environ.get("DD_STEAM_SHUTDOWN", "")) or [str(Path(steam_root) / "steamrtarm64/steam"), "-shutdown"]
|
||||
subprocess.run(command,
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=30)
|
||||
|
||||
@@ -229,7 +231,7 @@ def remember_tried(steam_root, account, appids):
|
||||
|
||||
def watch(steam_root, listing):
|
||||
games = [game for game in read_json(listing, []) if not store_game(game) and not game.get("native")]
|
||||
if os.environ.get("BL_STEAM_OFFLINE") == "1" or not games:
|
||||
if os.environ.get("DD_STEAM_OFFLINE") == "1" or not games:
|
||||
return
|
||||
candidates, sources = {}, {}
|
||||
next_lookup = 0
|
||||
@@ -257,7 +259,7 @@ def watch(steam_root, listing):
|
||||
elif candidates and (key != probed or now >= next_probe):
|
||||
probed, next_probe = key, now + 300
|
||||
try:
|
||||
probe_env = dict(os.environ, HOME=os.environ["BL_STEAM_IPC_HOME"]) if os.environ.get("BL_STEAM_IPC_HOME") else None
|
||||
probe_env = dict(os.environ, HOME=os.environ["DD_STEAM_IPC_HOME"]) if os.environ.get("DD_STEAM_IPC_HOME") else None
|
||||
result = subprocess.run([sys.executable, __file__, "probe", steam_root,
|
||||
*map(str, sorted(set(candidates.values())))],
|
||||
capture_output=True, text=True, timeout=15, env=probe_env)
|
||||
@@ -445,18 +447,22 @@ def park(steamapps):
|
||||
print(f"droiddeck-steam-games: {appid} is not here this session; its install is set aside until it is")
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=1)
|
||||
def compatibility():
|
||||
return runpy.run_path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "steam-compatibility"))
|
||||
|
||||
|
||||
def seed_install(steam_root, game, appid):
|
||||
steamapps = Path(steam_root) / "steamapps"
|
||||
common = steamapps / "common"
|
||||
name = f"DroidDeck-{appid}"
|
||||
target = common / name
|
||||
source = Path(game["folder"])
|
||||
title = game["name"].replace("\\", "\\\\").replace('"', '\\"').replace("\n", " ").replace("\r", " ")
|
||||
minimal = ('"AppState"\n{\n' + f' "appid" "{appid}"\n "Universe" "1"\n "name" "{title}"\n'
|
||||
+ f' "StateFlags" "4"\n "installdir" "{name}"\n' + '}\n')
|
||||
manifest_text = compatibility()["manifest_text"]
|
||||
minimal = manifest_text(appid, game["name"], name)
|
||||
legacy = minimal.replace(' "Universe" "1"\n', '')
|
||||
# Steam checks every file of an import with no build before updating it, from scratch each time it is interrupted.
|
||||
bare = minimal[:-2] + ' "AutoUpdateBehavior" "1"\n}\n'
|
||||
bare = manifest_text(appid, game["name"], name, True)
|
||||
build = installed_build(source, appid, name)
|
||||
if build is None:
|
||||
content = bare
|
||||
|
||||
@@ -6,7 +6,7 @@ stable_channel=steamdeck_stable
|
||||
steam_root=${XDG_DATA_HOME:-$HOME/.local/share}/Steam
|
||||
channel_state=$steam_root/package/droiddeck-channel
|
||||
pinned=1
|
||||
wanted=${BL_STEAM_CHANNEL:-$(cat "$HOME/.config/droiddeck/steam-channel" 2>/dev/null || true)}
|
||||
wanted=${DD_STEAM_CHANNEL:-$(cat "$HOME/.config/droiddeck/steam-channel" 2>/dev/null || true)}
|
||||
case $wanted in
|
||||
stable|"$stable_channel") steam_channel=$stable_channel ;;
|
||||
beta|"$beta_channel") steam_channel=$beta_channel ;;
|
||||
@@ -24,7 +24,7 @@ manifest=steam_client_${steam_channel}_linuxarm64
|
||||
stamp=$steam_root/package/droiddeck-installed
|
||||
legacy_stamp=$steam_root/package/bannerlator-installed
|
||||
unconfirmed=$steam_root/package/droiddeck-unconfirmed
|
||||
repair_request=$HOME/.bl-steam-repair
|
||||
repair_request=$HOME/.dd-steam-repair
|
||||
parts=$steam_root/package/droiddeck-download
|
||||
if [ -f "$legacy_stamp" ] && [ ! -f "$stamp" ]; then
|
||||
mv -f "$legacy_stamp" "$stamp" || true
|
||||
@@ -85,7 +85,7 @@ size_of() {
|
||||
echo $((n))
|
||||
}
|
||||
limits=(--connect-timeout 30 --speed-limit 4096 --speed-time 60)
|
||||
read -r -a delays <<< "${BL_STEAM_RETRY_DELAYS:-5 10 20 30 30}"
|
||||
read -r -a delays <<< "${DD_STEAM_RETRY_DELAYS:-5 10 20 30 30}"
|
||||
|
||||
step() { echo "== STEP $(date -u +%H:%M:%S) $*"; }
|
||||
progress() {
|
||||
|
||||
@@ -11,13 +11,13 @@ case $target in
|
||||
*) url=steam://rungameid/$target ;;
|
||||
esac
|
||||
|
||||
if [ "$ui" = desktop ] && [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
if [ "$ui" = desktop ] && [ "${DD_DESKTOP:-}" = 1 ]; then
|
||||
case ",${MESA_VK_WSI_DEBUG:-}," in
|
||||
*,sw,*) ;;
|
||||
*) export MESA_VK_WSI_DEBUG=${MESA_VK_WSI_DEBUG:+$MESA_VK_WSI_DEBUG,}sw ;;
|
||||
esac
|
||||
if [ "${BL_STEAM_CLIENT_ARCH:-}" = x86_64 ]; then
|
||||
client_home=${BL_X64_HOME:-${HOME:-/root}/.droiddeck-x64}
|
||||
if [ "${DD_STEAM_CLIENT_ARCH:-}" = x86_64 ]; then
|
||||
client_home=${DD_X64_HOME:-${HOME:-/root}/.droiddeck-x64}
|
||||
client=(/usr/local/bin/droiddeck-steam-x64 --exec)
|
||||
else
|
||||
steam_root=${XDG_DATA_HOME:-${HOME:-/root}/.local/share}/Steam
|
||||
@@ -25,7 +25,7 @@ if [ "$ui" = desktop ] && [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
client_home=$HOME
|
||||
client=("$steam_root/steamrtarm64/steam")
|
||||
fi
|
||||
if [ "${BL_BOTTOM_DESKTOP:-}" = 1 ]; then
|
||||
if [ "${DD_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.
|
||||
@@ -48,13 +48,13 @@ if [ "$ui" = desktop ] && [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
exit 69
|
||||
fi
|
||||
[ "$url" = steam://exit ] && exit 0
|
||||
export BL_INSIDE=1 BL_STEAM_UI=desktop
|
||||
export DD_INSIDE=1 DD_STEAM_UI=desktop
|
||||
exec /usr/local/bin/droiddeck-session steam "${url:-steam://open/library}"
|
||||
fi
|
||||
|
||||
dir=${BL_LAUNCH_DIR:-}
|
||||
dir=${DD_LAUNCH_DIR:-}
|
||||
if [ -z "$dir" ] || [ ! -d "$dir" ]; then
|
||||
echo "droiddeck-steam-launch: not inside a DroidDeck session (BL_LAUNCH_DIR unset)" >&2
|
||||
echo "droiddeck-steam-launch: not inside a DroidDeck session (DD_LAUNCH_DIR unset)" >&2
|
||||
exit 69
|
||||
fi
|
||||
printf 'ui=%s\nurl=%s\n' "$ui" "$url" > "$dir/steam-launch.tmp" && mv -f "$dir/steam-launch.tmp" "$dir/steam-launch"
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import runpy
|
||||
import sys
|
||||
|
||||
LIBRARIES = (("/mnt/droiddeck-sd", os.environ.get("BL_LIBRARY_LABEL", "SD Card")),)
|
||||
BIN_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
LIBRARIES = (("/mnt/droiddeck-sd", os.environ.get("DD_LIBRARY_LABEL", "SD Card")),)
|
||||
MAIN_LABEL = "Internal Storage"
|
||||
|
||||
|
||||
@@ -50,6 +52,77 @@ def register(steam_root, library, label):
|
||||
return len(apps)
|
||||
|
||||
|
||||
def installdirs(libraries):
|
||||
found = set()
|
||||
for library in libraries:
|
||||
steamapps = os.path.join(library, "steamapps")
|
||||
try:
|
||||
names = os.listdir(steamapps)
|
||||
except OSError:
|
||||
continue
|
||||
for name in names:
|
||||
if not re.fullmatch(r"appmanifest_\d+\.acf", name):
|
||||
continue
|
||||
try:
|
||||
with open(os.path.join(steamapps, name), encoding="utf-8", errors="replace") as f:
|
||||
m = re.search(r'"installdir"\s+"([^"]*)"', f.read(), re.I)
|
||||
except OSError:
|
||||
continue
|
||||
if m:
|
||||
found.add(m.group(1))
|
||||
return found
|
||||
|
||||
|
||||
def populated(path):
|
||||
try:
|
||||
with os.scandir(path) as entries:
|
||||
return next(entries, None) is not None
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def adoptable(library, known):
|
||||
common = os.path.join(library, "steamapps", "common")
|
||||
try:
|
||||
names = sorted(os.listdir(common))
|
||||
except OSError:
|
||||
return []
|
||||
return [n for n in names if n not in known and not n.startswith(".")
|
||||
and os.path.isdir(os.path.join(common, n)) and populated(os.path.join(common, n))]
|
||||
|
||||
|
||||
def adopt(steam_root, library):
|
||||
compat = runpy.run_path(os.path.join(BIN_DIR, "steam-compatibility"))
|
||||
known = compat["libraries"](steam_root)
|
||||
folders = adoptable(library, installdirs(known + [library]))
|
||||
if not folders:
|
||||
return 0
|
||||
entries = compat["appinfo_entries"](os.path.join(steam_root, "appcache", "appinfo.vdf"))
|
||||
by_dir = {}
|
||||
for app, info in entries.items():
|
||||
if app not in compat["NOT_GAMES"] and info["type"] in compat["PLAYABLE_TYPES"] and info["installdir"]:
|
||||
by_dir.setdefault(info["installdir"], []).append((app, info))
|
||||
steamapps = os.path.join(library, "steamapps")
|
||||
adopted = 0
|
||||
for folder in folders:
|
||||
matches = by_dir.get(folder, [])
|
||||
games = [m for m in matches if m[1]["type"] == "game"] or matches
|
||||
if len(games) != 1:
|
||||
continue
|
||||
app, info = games[0]
|
||||
if any(os.path.isfile(os.path.join(root, "steamapps", "appmanifest_%s.acf" % app))
|
||||
for root in known + [library]):
|
||||
continue
|
||||
try:
|
||||
with open(os.path.join(steamapps, "appmanifest_%s.acf" % app), "x", encoding="utf-8") as f:
|
||||
f.write(compat["manifest_text"](app, info["name"] or folder, folder, True))
|
||||
except OSError:
|
||||
continue
|
||||
adopted += 1
|
||||
print("droiddeck-steam-library: adopted %s as app %s in %s" % (folder, app, library))
|
||||
return adopted
|
||||
|
||||
|
||||
RETIRED = ("/mnt/bannerlator",)
|
||||
RENAMED = (("/mnt/bannerlator-sd", "/mnt/droiddeck-sd"),)
|
||||
|
||||
@@ -146,7 +219,7 @@ ADDED_DIR = "/mnt/droiddeck-lib/"
|
||||
|
||||
|
||||
def wanted():
|
||||
listing = os.environ.get("BL_STEAM_LIBRARIES")
|
||||
listing = os.environ.get("DD_STEAM_LIBRARIES")
|
||||
if not listing:
|
||||
return None
|
||||
try:
|
||||
@@ -176,6 +249,7 @@ def main():
|
||||
managed = libraries is not None
|
||||
for library, label in libraries if managed else LIBRARIES:
|
||||
if os.path.isdir(os.path.join(library, "steamapps")):
|
||||
adopt(steam_root, library)
|
||||
register(steam_root, library, label)
|
||||
relabel(steam_root, library, label)
|
||||
else:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -u
|
||||
if [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
if [ "${DD_DESKTOP:-}" = 1 ]; then
|
||||
url=
|
||||
ui=desktop
|
||||
for arg in "$@"; do
|
||||
@@ -12,5 +12,5 @@ if [ "${BL_DESKTOP:-}" = 1 ]; then
|
||||
done
|
||||
exec /usr/local/bin/droiddeck-steam-launch "$ui" ${url:+"$url"}
|
||||
fi
|
||||
[ "${BL_STEAM_CLIENT_ARCH:-}" = x86_64 ] && exec /usr/local/bin/droiddeck-steam-x64 --exec "$@"
|
||||
[ "${DD_STEAM_CLIENT_ARCH:-}" = x86_64 ] && exec /usr/local/bin/droiddeck-steam-x64 --exec "$@"
|
||||
exec "${HOME:-/root}/.local/share/Steam/steamrtarm64/steam" "$@"
|
||||
@@ -345,7 +345,7 @@ def main():
|
||||
cfg = os.path.join(steam_root, "config", "config.vdf")
|
||||
if os.path.isfile(cfg) and (ours or routes):
|
||||
tools = os.path.join(steam_root, "compatibilitytools.d")
|
||||
x64_tool = os.environ.get("BL_COMPAT_TOOL")
|
||||
x64_tool = os.environ.get("DD_COMPAT_TOOL")
|
||||
own = {}
|
||||
if x64_tool:
|
||||
protect = {compat.first_key(os.path.join(tools, e, "compatibilitytool.vdf"), ["compatibilitytools", "compat_tools"]) or e: e
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# before starting the browser when Android denies sched_setaffinity.
|
||||
set -u
|
||||
if [ "$#" -ge 2 ] && [[ "$1" =~ ^(0[xX])?[0-9a-fA-F]+$ ]] &&
|
||||
[ -n "${BL_STEAM_WEBHELPER:-}" ] && [ "$2" -ef "$BL_STEAM_WEBHELPER" ]; then
|
||||
[ -n "${DD_STEAM_WEBHELPER:-}" ] && [ "$2" -ef "$DD_STEAM_WEBHELPER" ]; then
|
||||
mask=$1
|
||||
shift
|
||||
# Pin this wrapper before exec; never retry a helper that has already run.
|
||||
|
||||
@@ -7,7 +7,7 @@ X64_CHANNEL=steamdeck_publicbeta
|
||||
MANIFEST=steam_client_${X64_CHANNEL}_steamrt64
|
||||
|
||||
REAL_HOME=${HOME:-/root}
|
||||
X64_HOME=${BL_X64_HOME:-$REAL_HOME/.droiddeck-x64}
|
||||
X64_HOME=${DD_X64_HOME:-$REAL_HOME/.droiddeck-x64}
|
||||
ROOTFS=$X64_HOME/rootfs
|
||||
STEAM_X64=$X64_HOME/.local/share/Steam
|
||||
ARM_STEAM=${XDG_DATA_HOME:-$REAL_HOME/.local/share}/Steam
|
||||
@@ -88,7 +88,7 @@ x64_map_direct() {
|
||||
done
|
||||
python3 - "$mode" "$STEAM_X64/config/config.vdf" "$STEAM_X64/appcache/appinfo.vdf" "$X64_HOME/direct-auto.json" \
|
||||
"$X64_HOME/direct-sniper" "$libraries" "$(x64_default_tool)" \
|
||||
"$REAL_HOME/.bl-compat-pending" ${BL_X64_DIRECT_APPS:-550} \
|
||||
"$REAL_HOME/.dd-compat-pending" ${DD_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.
|
||||
import json, os, re, struct, sys
|
||||
@@ -356,7 +356,7 @@ if [ ! -f "$ROOTFS/.droiddeck-complete" ]; then
|
||||
fi
|
||||
echo "== x86-64 rootfs: $(sed -n 's|.*/download/\([^/]*\)/.*|\1|p' <<<"$ROOTFS_URL") (sha256 ${ROOTFS_SHA256:0:12})" >&2
|
||||
: > "$ROOTFS/etc/ld.so.preload"
|
||||
for lib in libblsession libfakeinput; do
|
||||
for lib in libddsession libfakeinput; do
|
||||
have=0
|
||||
arches="x86_64 i386"; [ "$lib" = libfakeinput ] && arches=x86_64
|
||||
rm -f "$ROOTFS/usr/local/lib/i386-linux-gnu/libfakeinput.so"
|
||||
@@ -371,11 +371,11 @@ for lib in libblsession libfakeinput; do
|
||||
elif [ "$have" = 1 ]; then echo "/usr/local/\$LIB/$lib.so" >> "$ROOTFS/etc/ld.so.preload"
|
||||
else step "warning: no x86 build of $lib (/usr/local/lib/droiddeck-fex/x86_64/$lib.so)"; fi
|
||||
done
|
||||
rm -f "$ROOTFS/usr/local/lib/libblsession-x86_64.so" "$ROOTFS/usr/local/lib/libfakeinput-x86_64.so"
|
||||
rm -f "$ROOTFS/usr/local/lib/libddsession-x86_64.so" "$ROOTFS/usr/local/lib/libfakeinput-x86_64.so"
|
||||
unconfirmed=$STEAM_X64/package/droiddeck-unconfirmed
|
||||
if [ -d "${unconfirmed%/*}" ] && ! grep -qx tracked "$unconfirmed" 2>/dev/null; then echo tracked > "$unconfirmed"; fi
|
||||
x64_repair=
|
||||
if [ "${BL_X64_REPAIR:-0}" = 1 ]; then
|
||||
if [ "${DD_X64_REPAIR:-0}" = 1 ]; then
|
||||
x64_repair=requested
|
||||
elif [ -f "$unconfirmed" ] && ! grep -qx repaired "$unconfirmed" && [ "$(grep -cx start "$unconfirmed")" -ge 2 ]; then
|
||||
x64_repair="the client was started $(grep -cx start "$unconfirmed") times without showing anything"
|
||||
@@ -502,7 +502,7 @@ marker=$(cat "${0%/*}/vac-marker" 2>/dev/null)
|
||||
case "$*" in *hl2.sh*|*hl2_linux*|*srcds*) [ -n "$marker" ] && [ -f "$marker" ] && set -- "$@" -condebug ;; esac
|
||||
# game-gpu.env is rewritten whenever the launcher runs; game-gpu.local is the user's and is read after it.
|
||||
gpu=$HOME/game-gpu.env
|
||||
if [ -f "$gpu" ] && [ "${BL_X64_GAME_SOFTWARE:-0}" != 1 ]; then
|
||||
if [ -f "$gpu" ] && [ "${DD_X64_GAME_SOFTWARE:-0}" != 1 ]; then
|
||||
. "$gpu"
|
||||
[ -f "$HOME/game-gpu.local" ] && . "$HOME/game-gpu.local"
|
||||
else
|
||||
@@ -580,9 +580,9 @@ VDF
|
||||
x64_sync_login
|
||||
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
|
||||
if DD_X64_SHARED=$X64_HOME/shared/arm64 python3 - "$STEAM_X64" "${DD_X64_STEAM_LIBRARIES:-}" "$STEAM_X64/config/libraryfolders.vdf" "$STEAM_X64/steamapps/libraryfolders.vdf" <<'PY'; then
|
||||
import json, os, re, sys
|
||||
keep = {os.path.realpath(sys.argv[1]), os.path.realpath(os.environ["BL_X64_SHARED"])}
|
||||
keep = {os.path.realpath(sys.argv[1]), os.path.realpath(os.environ["DD_X64_SHARED"])}
|
||||
# Without the session's list nothing is known about the card: leave the folders as they are.
|
||||
if not sys.argv[2]:
|
||||
sys.exit(3)
|
||||
@@ -622,7 +622,7 @@ PY
|
||||
step "could not check the x86-64 client's library folders"
|
||||
fi
|
||||
if [ "$listing_ok" = 1 ]; then
|
||||
BL_STEAM_LIBRARIES=$BL_X64_STEAM_LIBRARIES droiddeck-steam-library "$STEAM_X64" ||
|
||||
DD_STEAM_LIBRARIES=$DD_X64_STEAM_LIBRARIES droiddeck-steam-library "$STEAM_X64" ||
|
||||
step "could not add the card to the x86-64 client's library folders"
|
||||
fi
|
||||
fi
|
||||
@@ -706,11 +706,11 @@ PY
|
||||
}
|
||||
|
||||
x64_gpu() {
|
||||
[ "${BL_X64_SOFTWARE:-0}" != 1 ] && [ -d /usr/local/share/fex-emu/GuestThunks ] && [ -d /usr/local/lib/fex-emu/HostThunks ]
|
||||
[ "${DD_X64_SOFTWARE:-0}" != 1 ] && [ -d /usr/local/share/fex-emu/GuestThunks ] && [ -d /usr/local/lib/fex-emu/HostThunks ]
|
||||
}
|
||||
|
||||
x64_webhelper_gpu() {
|
||||
x64_gpu && [ "${BL_X64_CLIENT_SOFTWARE:-0}" != 1 ] && [ "${BL_X64_CEF_GPU:-1}" != 0 ]
|
||||
x64_gpu && [ "${DD_X64_CLIENT_SOFTWARE:-0}" != 1 ] && [ "${DD_X64_CEF_GPU:-1}" != 0 ]
|
||||
}
|
||||
|
||||
x64_env() {
|
||||
@@ -729,7 +729,7 @@ if x64_gpu; then
|
||||
done
|
||||
} > "$X64_HOME/game-gpu.env"
|
||||
fi
|
||||
if x64_gpu && [ "${BL_X64_CLIENT_SOFTWARE:-0}" != 1 ]; then
|
||||
if x64_gpu && [ "${DD_X64_CLIENT_SOFTWARE:-0}" != 1 ]; then
|
||||
export FEX_THUNKCONFIG=$X64_HOME/thunks.json
|
||||
unset LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE
|
||||
else
|
||||
@@ -737,7 +737,7 @@ unset FEX_THUNKCONFIG $gpu_vars
|
||||
export LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe
|
||||
export LIBGL_DRI3_DISABLE=1
|
||||
fi
|
||||
[ "${BL_X64_FP_OFF:-0}" = 1 ] && export PROOT_FP_OFF=1
|
||||
[ "${DD_X64_FP_OFF:-0}" = 1 ] && export PROOT_FP_OFF=1
|
||||
export FEX_TSOENABLED=${FEX_TSOENABLED:-1} FEX_VECTORTSOENABLED=${FEX_VECTORTSOENABLED:-0} \
|
||||
FEX_MEMCPYSETTSOENABLED=${FEX_MEMCPYSETTSOENABLED:-0} FEX_HALFBARRIERTSOENABLED=${FEX_HALFBARRIERTSOENABLED:-0} \
|
||||
FEX_X87REDUCEDPRECISION=${FEX_X87REDUCEDPRECISION:-1} FEX_MULTIBLOCK=${FEX_MULTIBLOCK:-1}
|
||||
@@ -750,7 +750,7 @@ export STEAM_RUNTIME=1
|
||||
[ -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
|
||||
export STEAM_STEAMRT_RECURSION_GUARD=1
|
||||
export BL_WEBHELPER_HIDE_TRACER=1
|
||||
export DD_WEBHELPER_HIDE_TRACER=1
|
||||
}
|
||||
|
||||
x64_manifest_version() {
|
||||
@@ -760,7 +760,7 @@ x64_manifest_version() {
|
||||
}
|
||||
|
||||
x64_gpu_probe() {
|
||||
local fex=${BL_FEX:-/usr/local/bin/FEX}
|
||||
local fex=${DD_FEX:-/usr/local/bin/FEX}
|
||||
echo "== x86-64 GPU probe (x86 glxinfo and vulkaninfo through FEX):"
|
||||
(
|
||||
unset LD_LIBRARY_PATH
|
||||
@@ -795,23 +795,23 @@ x64_arm_webhelper_cpu_supported() {
|
||||
x64_exec() {
|
||||
x64_env
|
||||
cd "$STEAM_X64"
|
||||
if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] && [ -x /usr/local/bin/droiddeck-x64-arm-webhelper ] &&
|
||||
if [ "${DD_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
|
||||
chan=$(cat "$STEAM_X64/package/beta" 2>/dev/null || echo "$X64_CHANNEL")
|
||||
x86_build=$(awk -F'"' '$2 == "version" { print $4; exit }' "$STEAM_X64/package/steam_client_${chan}_steamrt64.manifest" 2>/dev/null || true)
|
||||
arm_build=$(awk -F'"' '$2 == "version" { print $4; exit }' "$ARM_STEAM/package/steam_client_${chan}_linuxarm64.manifest" 2>/dev/null || true)
|
||||
if [ -n "$x86_build" ] && [ "$x86_build" = "$arm_build" ]; then
|
||||
export BL_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-arm-webhelper
|
||||
export DD_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-arm-webhelper
|
||||
else
|
||||
echo "== x86-64 client build ${x86_build:-?}, arm64 web helper's ${arm_build:-?}: keeping the x86 web helper" >&2
|
||||
fi
|
||||
fi
|
||||
if [ -z "${BL_X64_ARM_WEBHELPER:-}" ] && x64_webhelper_gpu; then
|
||||
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
|
||||
export BL_WEBHELPER_ARGS=stock
|
||||
if [ -z "${DD_X64_ARM_WEBHELPER:-}" ] && x64_webhelper_gpu; then
|
||||
export DD_WEBHELPER_ARGS="--ignore-gpu-blocklist --use-gl=angle --use-angle=gl --ozone-platform=x11"
|
||||
[ -x /usr/local/bin/droiddeck-x64-webhelper ] && export DD_X64_ARM_WEBHELPER=/usr/local/bin/droiddeck-x64-webhelper
|
||||
elif [ -z "${DD_X64_ARM_WEBHELPER:-}" ]; then
|
||||
export DD_WEBHELPER_ARGS=stock
|
||||
local a args=() soft=0
|
||||
for a in "$@"; do
|
||||
case $a in
|
||||
@@ -827,7 +827,7 @@ x64_exec() {
|
||||
grep --line-buffered -oE 'Downloading update \([0-9,]+ of [0-9,]+ KB\)|^[[:space:]]*(\[[^]]+\][[:space:]]*)*(Extracting package|Installing update)\.\.\.[[:space:]]*$' | sed -u 's/,//g' >&2 ) &
|
||||
echo "== x86-64 client: steamrt64 $(x64_manifest_version steamrt64) (the client may update itself)" >&2
|
||||
x64_webhelper_gpu && { x64_gpu_watch >&2 & }
|
||||
exec "${BL_FEX:-/usr/local/bin/FEX}" "$STEAM_X64/steamrt64/steam" "$@"
|
||||
exec "${DD_FEX:-/usr/local/bin/FEX}" "$STEAM_X64/steamrt64/steam" "$@"
|
||||
}
|
||||
|
||||
x64_share() {
|
||||
@@ -969,8 +969,8 @@ if pgrep -f 'steamrtarm64/steam( |$)' >/dev/null 2>&1; then
|
||||
fi
|
||||
x64_prepare
|
||||
step "FEX, rootfs and client ready"
|
||||
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 &
|
||||
if [ -n "${DD_FEXSERVER_LOG:-}" ]; then
|
||||
FEX_ROOTFS=$ROOTFS "$(dirname "${DD_FEX:-/usr/local/bin/FEX}")/FEXServer" -f -p 600 >"$DD_FEXSERVER_LOG" 2>&1 &
|
||||
sleep 1
|
||||
fi
|
||||
x64_bus= x64_nm= x64_pin=
|
||||
@@ -1017,11 +1017,11 @@ if ! pgrep -f 'steamrt64/steam( |$)' >/dev/null 2>&1; then
|
||||
{ [ -e "$f" ] || [ -L "$f" ]; } && rm -f "$f"
|
||||
done
|
||||
fi
|
||||
if [ -n "${BL_CLIENT_CPUS:-}" ] && command -v taskset >/dev/null 2>&1; then
|
||||
if [ -n "${DD_CLIENT_CPUS:-}" ] && command -v taskset >/dev/null 2>&1; then
|
||||
(
|
||||
while sleep 5; do
|
||||
for pid in $(ps -A -o PID,ARGS | awk '($2 ~ /^(.*\/)?FEX(Interpreter)?$/) && ($3 ~ /steamrt64\/steam$/ || $3 ~ /steamwebhelper$/) {print $1} $2 ~ /steamrtarm64\/steamwebhelper$/ {print $1}'); do
|
||||
taskset -a -p -c "$BL_CLIENT_CPUS" "$pid" >/dev/null 2>&1
|
||||
taskset -a -p -c "$DD_CLIENT_CPUS" "$pid" >/dev/null 2>&1
|
||||
done
|
||||
done
|
||||
) &
|
||||
@@ -1031,7 +1031,7 @@ for attempt in 1 2 3 4 5; do
|
||||
echo "$X64_CHANNEL" > "$STEAM_X64/package/beta"
|
||||
step "starting the x86-64 SteamRT3 client under FEX (attempt $attempt): $*"
|
||||
rc=0
|
||||
if [ "${BL_X64_X86_WEBHELPER:-0}" != 1 ] || x64_webhelper_gpu; then cef=(-cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan); else cef=(-cef-disable-gpu); fi
|
||||
if [ "${DD_X64_X86_WEBHELPER:-0}" != 1 ] || x64_webhelper_gpu; then cef=(-cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan); else cef=(-cef-disable-gpu); fi
|
||||
( x64_exec -clientbeta "$X64_CHANNEL" -no-cef-sandbox "${cef[@]}" "$@" ) >>"$LOG" 2>&1 || rc=$?
|
||||
step "client exited rc=$rc"
|
||||
[ "$rc" = 42 ] || break
|
||||
|
||||
@@ -7,6 +7,7 @@ import os
|
||||
import re
|
||||
import shlex
|
||||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
import time
|
||||
import subprocess
|
||||
@@ -192,7 +193,7 @@ def server_socket(pfx):
|
||||
st = os.stat(pfx)
|
||||
except OSError:
|
||||
return None
|
||||
base = os.environ.get("BL_WINE_SERVER_BASE") or "/tmp/.wine-%d" % os.getuid()
|
||||
base = os.environ.get("DD_WINE_SERVER_BASE") or "/tmp/.wine-%d" % os.getuid()
|
||||
return Path(base) / ("server-%x-%x" % (st.st_dev, st.st_ino)) / "socket"
|
||||
|
||||
|
||||
@@ -264,7 +265,7 @@ BATTLENET_LAUNCH = re.compile(r'(?i)^--exec=\s*"?launch\s+([A-Za-z0-9_]{1,16})"?
|
||||
|
||||
|
||||
def battlenet(argv, env=os.environ):
|
||||
if env.get("BL_BATTLENET"):
|
||||
if env.get("DD_BATTLENET"):
|
||||
return None
|
||||
exe, code = False, None
|
||||
for raw in argv:
|
||||
@@ -285,12 +286,14 @@ def cloud_on(sidecar):
|
||||
|
||||
def exited(argv, code=0):
|
||||
found = find_store_game(argv)
|
||||
launch_dir = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
launch_dir = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
if found is not None and launch_dir and str(found[1].get("store")) == "rockstar":
|
||||
ask(Path(launch_dir) / "stores", {"op": "rockstar-exited", "store": "rockstar", "id": str(found[1].get("id"))}, timeout=1.0)
|
||||
compat_data = os.environ.get("STEAM_COMPAT_DATA_PATH")
|
||||
if compat_data:
|
||||
(Path(compat_data) / "pfx" / ROCKSTAR_FOLDER / "launch.json").unlink(missing_ok=True)
|
||||
for line in rockstar_launcher_log(compat_data):
|
||||
log("rockstar launcher: " + line)
|
||||
return 0
|
||||
if found is not None and str(found[1].get("store")) == "epic" and os.environ.get(EPIC_HANDLED) != "1" \
|
||||
and os.access(EPIC_CLIENT, os.X_OK):
|
||||
@@ -320,6 +323,29 @@ ROCKSTAR_TITLES = {"gta3": "Grand Theft Auto III", "gtavc": "Grand Theft Auto: V
|
||||
"gta4": "Grand Theft Auto IV", "lanoire": "LANoireMTL"}
|
||||
|
||||
|
||||
def rockstar_launcher_log(compat_data, limit=65536):
|
||||
pfx = Path(compat_data) / "pfx"
|
||||
target = pfx / ROCKSTAR_FOLDER
|
||||
if not target.resolve().is_relative_to(pfx.resolve()):
|
||||
return []
|
||||
path = target / "launcher.log"
|
||||
try:
|
||||
descriptor = os.open(path, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK)
|
||||
except OSError:
|
||||
return []
|
||||
try:
|
||||
if not stat.S_ISREG(os.fstat(descriptor).st_mode):
|
||||
return []
|
||||
with os.fdopen(descriptor, "rb", closefd=False) as source:
|
||||
data = source.read(limit)
|
||||
path.unlink(missing_ok=True)
|
||||
except OSError:
|
||||
return []
|
||||
finally:
|
||||
os.close(descriptor)
|
||||
return [line.strip() for line in data.decode("utf-8", "replace").splitlines() if line.strip()]
|
||||
|
||||
|
||||
def rockstar_sdk(folder, sidecar):
|
||||
if str(sidecar.get("id")) in ("gta4", "lanoire"):
|
||||
return True
|
||||
@@ -464,6 +490,7 @@ def prepare_rockstar(folder, sidecar, compat_data, launch_dir, proton="", ask_ap
|
||||
return "invalid-service-path"
|
||||
config = target / "launch.json"
|
||||
config.unlink(missing_ok=True)
|
||||
(target / "launcher.log").unlink(missing_ok=True)
|
||||
legacy = str(sidecar.get("id")) in ROCKSTAR_TITLES
|
||||
sdk = rockstar_sdk(folder, sidecar)
|
||||
title = ROCKSTAR_TITLES.get(str(sidecar.get("id")))
|
||||
@@ -798,7 +825,7 @@ def provision_galaxy(compat_data, proton, timeout=90):
|
||||
':existing', 'echo ready>"%s"' % answer, 'exit /b 0']
|
||||
bat.write_bytes(("\r\n".join(lines) + "\r\n").encode())
|
||||
env = os.environ.copy()
|
||||
env["BL_COMET_BOOTSTRAP"] = "1"
|
||||
env["DD_COMET_BOOTSTRAP"] = "1"
|
||||
run = subprocess.run([proton, "run", "cmd.exe", "/d", "/c", windows_path(str(bat))],
|
||||
env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=timeout)
|
||||
if run.returncode or not result.is_file() or result.read_text().strip() != "ready":
|
||||
@@ -819,7 +846,7 @@ def prepare_gog(sidecar, compat_data, launch_dir):
|
||||
if not isinstance(answer, dict) or not answer.get("ready"):
|
||||
log("gog achievements: " + (str(answer.get("reason", "unavailable")) if isinstance(answer, dict) else "timeout"))
|
||||
return False
|
||||
state = provision_galaxy(compat_data, os.environ.get("BL_STORE_PROTON", ""))
|
||||
state = provision_galaxy(compat_data, os.environ.get("DD_STORE_PROTON", ""))
|
||||
log("gog achievements prefix: " + state)
|
||||
return state == "ready"
|
||||
|
||||
@@ -1405,7 +1432,7 @@ def write_licenses(compat_data, licenses):
|
||||
|
||||
def prepare_ea(folder, sidecar, compat_data, launch_dir):
|
||||
game = str(sidecar.get("id"))
|
||||
proton = os.environ.get("BL_STORE_PROTON", "")
|
||||
proton = os.environ.get("DD_STORE_PROTON", "")
|
||||
made = create_prefix(compat_data, proton)
|
||||
ready = made in ("present", "created") or (compat_data and (Path(compat_data) / "pfx/user.reg").is_file())
|
||||
stub = install_origin_stub(compat_data) if ready else "no-prefix"
|
||||
@@ -1573,22 +1600,22 @@ def main(argv):
|
||||
return RAN_FAILED
|
||||
compat_data = os.environ.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
|
||||
prefix_id = os.path.basename(compat_data) if compat_data else ""
|
||||
launch_dir = os.environ.get("BL_LAUNCH_DIR", "")
|
||||
launch_dir = os.environ.get("DD_LAUNCH_DIR", "")
|
||||
if launch_dir and cloud_on(sidecar):
|
||||
made = create_prefix(compat_data, os.environ.get("BL_STORE_PROTON", ""))
|
||||
made = create_prefix(compat_data, os.environ.get("DD_STORE_PROTON", ""))
|
||||
if made != "present":
|
||||
log("cloud %s %s prefix=%s" % (store, game, made))
|
||||
if store == "gog":
|
||||
prepare_gog(sidecar, compat_data, launch_dir)
|
||||
log("gog registry: " + apply_gog_registry(folder, compat_data, os.environ.get("BL_STORE_PROTON", "")))
|
||||
log("gog support data: " + gog_support_data(folder, compat_data, os.environ.get("BL_STORE_PROTON", "")))
|
||||
log("gog registry: " + apply_gog_registry(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
|
||||
log("gog support data: " + gog_support_data(folder, compat_data, os.environ.get("DD_STORE_PROTON", "")))
|
||||
if store == "rockstar":
|
||||
if game not in ROCKSTAR_TITLES and not rockstar_sdk(folder, sidecar):
|
||||
if compat_data:
|
||||
(Path(compat_data) / "pfx" / ROCKSTAR_FOLDER / "launch.json").unlink(missing_ok=True)
|
||||
return STORE_GAME
|
||||
try:
|
||||
state = prepare_rockstar(folder, sidecar, compat_data, launch_dir, os.environ.get("BL_STORE_PROTON", ""))
|
||||
state = prepare_rockstar(folder, sidecar, compat_data, launch_dir, os.environ.get("DD_STORE_PROTON", ""))
|
||||
except (OSError, ValueError, subprocess.TimeoutExpired):
|
||||
state = "preparation-failed"
|
||||
log("rockstar %s: %s" % (game, state))
|
||||
@@ -1597,7 +1624,7 @@ def main(argv):
|
||||
return STORE_GAME if state == "ready" else RAN_FAILED
|
||||
if store == "ubisoft":
|
||||
try:
|
||||
log("ubisoft %s: %s" % (game, prepare_ubisoft(folder, sidecar, compat_data, launch_dir, os.environ.get("BL_STORE_PROTON", ""))))
|
||||
log("ubisoft %s: %s" % (game, prepare_ubisoft(folder, sidecar, compat_data, launch_dir, os.environ.get("DD_STORE_PROTON", ""))))
|
||||
except OSError as e:
|
||||
try:
|
||||
(folder / UBISOFT_LAUNCH).unlink()
|
||||
|
||||
@@ -9,7 +9,7 @@ for v in $(compgen -e); do
|
||||
case $v in FEX_*) unset "$v" ;; esac
|
||||
done
|
||||
unset LD_LIBRARY_PATH LD_PRELOAD STEAM_RUNTIME_STEAMRT STEAM_STEAMRT_RECURSION_GUARD \
|
||||
LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE GALLIUM_DRIVER BL_WEBHELPER_HIDE_TRACER PROOT_FP_OFF
|
||||
LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE GALLIUM_DRIVER DD_WEBHELPER_HIDE_TRACER PROOT_FP_OFF
|
||||
|
||||
game_display=${DISPLAY:-}
|
||||
if [ -f "$x64_home/arm-session.env" ]; then
|
||||
@@ -18,7 +18,7 @@ else
|
||||
export HOME=/root
|
||||
fi
|
||||
[ -z "$game_display" ] || export DISPLAY=$game_display
|
||||
export BL_X64_STEAM_ROOT=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-}
|
||||
export DD_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
|
||||
if [ "$overlay" = 1 ] && [ -f "$arm_overlay" ]; then
|
||||
|
||||
@@ -5,7 +5,7 @@ arm=/root/.local/share/Steam/steamrtarm64
|
||||
for v in $(compgen -e); do
|
||||
case $v in FEX_*) unset "$v" ;; esac
|
||||
done
|
||||
unset LD_PRELOAD LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE BL_WEBHELPER_HIDE_TRACER BL_X64_ARM_WEBHELPER
|
||||
unset LD_PRELOAD LIBGL_ALWAYS_SOFTWARE LIBGL_DRI3_DISABLE DD_WEBHELPER_HIDE_TRACER DD_X64_ARM_WEBHELPER
|
||||
if [ -f "$x64_home/arm-session.env" ]; then
|
||||
eval "$(grep -E '^declare -x (VK_ICD_FILENAMES|VK_DRIVER_FILES|GALLIUM_DRIVER|MESA_LOADER_DRIVER_OVERRIDE|LIBGL_KOPPER_DRI2|TU_DEBUG|ZINK_DEBUG|ZINK_DESCRIPTORS|MESA_NO_ERROR|MESA_DISK_CACHE_DATABASE)=' "$x64_home/arm-session.env")"
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
unset BL_X64_ARM_WEBHELPER
|
||||
export BL_WEBHELPER_ARGS=stock DISABLE_GAMESCOPE_WSI=1 vk_xwayland_wait_ready=true LIBGL_KOPPER_DISABLE=true
|
||||
unset DD_X64_ARM_WEBHELPER
|
||||
export DD_WEBHELPER_ARGS=stock DISABLE_GAMESCOPE_WSI=1 vk_xwayland_wait_ready=true LIBGL_KOPPER_DISABLE=true
|
||||
if [ -x ./steamwebhelper ]; then
|
||||
exec ./steamwebhelper "$@"
|
||||
fi
|
||||
|
||||
@@ -385,7 +385,7 @@ def launch(command, env):
|
||||
for name in DLLS:
|
||||
if not (RUNTIME / 'windows' / name).is_file():
|
||||
raise RuntimeError('Xbox Windows runtime is missing; update the Linux runtime')
|
||||
launch_dir = env.get('BL_LAUNCH_DIR')
|
||||
launch_dir = env.get('DD_LAUNCH_DIR')
|
||||
if not launch_dir:
|
||||
raise RuntimeError('No Xbox account channel; start the game from DroidDeck')
|
||||
reply = store['ask'](Path(launch_dir) / 'stores', {'op': 'xbox-prepare', 'id': sidecar['id']}, timeout=190)
|
||||
@@ -409,6 +409,10 @@ def launch(command, env):
|
||||
owned_env.pop(name, None)
|
||||
if reply.get('playfab'):
|
||||
owned_env['XODUS_XSTS_PLAYFAB'] = reply['playfab']
|
||||
# The runtime mounts DLC only inside this backend-owned workspace (E_NOTIMPL without it).
|
||||
mount_root = reply.get('mountRoot')
|
||||
if isinstance(mount_root, str) and mount_root.startswith('/'):
|
||||
owned_env['XODUS_MOUNT_ROOT'] = 'Z:' + mount_root.replace('/', '\\')
|
||||
content = folder / '.xbox-content'
|
||||
roots = []
|
||||
if content.is_dir():
|
||||
|
||||
@@ -59,72 +59,73 @@ TOOL_MANIFEST_VDF = """"manifest"
|
||||
""" % LAUNCHER
|
||||
|
||||
|
||||
BL_STORE_SETUP = """
|
||||
bl_store_launch() {
|
||||
DD_STORE_SETUP = """
|
||||
dd_store_launch() {
|
||||
[ "${verb:-}" = waitforexitandrun ] || return 0
|
||||
if [ -x /usr/local/bin/droiddeck-open-url ]; then
|
||||
mkdir -p /tmp/droiddeck-browser
|
||||
ln -sfn /usr/local/bin/droiddeck-open-url /tmp/droiddeck-browser/xdg-open
|
||||
[ -n "${BL_LAUNCH_DIR:-}" ] && printf '%s
|
||||
' "$BL_LAUNCH_DIR" > /tmp/droiddeck-browser/launch-dir
|
||||
[ -n "${DD_LAUNCH_DIR:-}" ] && printf '%s
|
||||
' "$DD_LAUNCH_DIR" > /tmp/droiddeck-browser/launch-dir
|
||||
PATH="/tmp/droiddeck-browser:$PATH"; export PATH
|
||||
fi
|
||||
if [ "${BL_DEBUG_BROWSER:-}" = 1 ]; then
|
||||
if [ "${DD_DEBUG_BROWSER:-}" = 1 ]; then
|
||||
WINEDEBUG="${WINEDEBUG:+$WINEDEBUG,}+shell,+winebrowser"; export WINEDEBUG
|
||||
fi
|
||||
[ -x /usr/local/bin/droiddeck-store-launch ] || return 0
|
||||
/usr/local/bin/droiddeck-store-launch "$@"
|
||||
rc=$?
|
||||
[ $rc -eq 10 ] && BL_STORE_EXIT=1
|
||||
[ $rc -eq 10 ] && DD_STORE_EXIT=1
|
||||
[ $rc -eq 11 ] && exit 0
|
||||
[ $rc -eq 12 ] && exit 1
|
||||
return 0
|
||||
}
|
||||
|
||||
bl_run() {
|
||||
dd_run() {
|
||||
if [ -x /usr/local/bin/droiddeck-steamvr-flat ] && /usr/local/bin/droiddeck-steamvr-flat "${verb:-}"; then
|
||||
set -- /usr/local/bin/droiddeck-steamvr-game "$@"
|
||||
fi
|
||||
if [ -n "${BL_STORE_EXIT:-}" ]; then
|
||||
if [ -n "${DD_STORE_EXIT:-}" ]; then
|
||||
trap : INT TERM HUP
|
||||
"$@"
|
||||
rc=$?
|
||||
/usr/local/bin/droiddeck-store-launch --exited --code "$rc" "${BL_STORE_ARGS[@]}" || true
|
||||
/usr/local/bin/droiddeck-store-launch --exited --code "$rc" "${DD_STORE_ARGS[@]}" || true
|
||||
exit $rc
|
||||
fi
|
||||
exec "$@"
|
||||
}
|
||||
"""
|
||||
|
||||
BL_DESKTOP_GPU_SETUP = """
|
||||
bl_desktop_gpu() {
|
||||
DD_DESKTOP_GPU_SETUP = """
|
||||
dd_desktop_gpu() {
|
||||
local name saved gpu=/usr/local/bin/droiddeck-gpu
|
||||
local names=(LD_PRELOAD LD_LIBRARY_PATH ENABLE_VK_LAYER_VALVE_steam_overlay_1 ENABLE_VK_LAYER_VALVE_steam_fossilize_1)
|
||||
if [ -n "${BL_DESKTOP_GPU_CHILD:-}" ]; then
|
||||
if [ -n "${DD_DESKTOP_GPU_CHILD:-}" ]; then
|
||||
for name in "${names[@]}"; do
|
||||
saved=BL_GPU_SAVED_$name
|
||||
saved=DD_GPU_SAVED_$name
|
||||
[ -n "${!saved+x}" ] || continue
|
||||
export "$name=${!saved}"
|
||||
unset "$saved"
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
[ "${BL_DESKTOP:-}" = 1 ] && [ "${verb:-}" = waitforexitandrun ] && [ -x "$gpu" ] || return 0
|
||||
local choice=${BL_DESKTOP_GPU:-on}
|
||||
[ "${DD_DESKTOP:-}" = 1 ] && [ "${verb:-}" = waitforexitandrun ] && [ -x "$gpu" ] || return 0
|
||||
local choice=${DD_DESKTOP_GPU:-on}
|
||||
case "${choice,,}" in off | 0 | no | false) return 0 ;; esac
|
||||
case " $* " in *iscriptevaluator*) return 0 ;; esac
|
||||
local clear=()
|
||||
for name in "${names[@]}"; do
|
||||
[ -n "${!name+x}" ] || continue
|
||||
export "BL_GPU_SAVED_$name=${!name}"
|
||||
export "DD_GPU_SAVED_$name=${!name}"
|
||||
clear+=(-u "$name")
|
||||
done
|
||||
echo "droiddeck-gpu: the desktop starts this game on the GPU" >&2
|
||||
exec env "${clear[@]}" "$gpu" "$0" "$verb" "$@"
|
||||
}
|
||||
bl_desktop_gpu "$@"
|
||||
dd_desktop_gpu "$@"
|
||||
"""
|
||||
BL_COMPONENTS_SETUP = """
|
||||
bl_components() {
|
||||
DD_COMPONENTS_SETUP = """
|
||||
dd_components() {
|
||||
base=$1
|
||||
cm_dir="${HOME:-/root}/.local/share/droiddeck-components"
|
||||
cm_list="$cm_dir/desired.tsv"
|
||||
@@ -206,7 +207,7 @@ bl_components() {
|
||||
continue
|
||||
fi
|
||||
mkdir -p "$(dirname "$f")"
|
||||
cp -f "$src" "$f.bl-new" && mv -f "$f.bl-new" "$f" || continue
|
||||
cp -f "$src" "$f.dd-new" && mv -f "$f.dd-new" "$f" || continue
|
||||
case "$rel" in *.so) chmod 755 "$f" ;; *) chmod 644 "$f" ;; esac
|
||||
cm_fixed=$((cm_fixed + 1))
|
||||
done
|
||||
@@ -218,17 +219,17 @@ bl_components() {
|
||||
}
|
||||
"""
|
||||
|
||||
BL_GAME_CPUS_SETUP = """
|
||||
bl_game_cpus() {
|
||||
[ -n "${BL_GAME_CPUS:-}" ] || return 0
|
||||
DD_GAME_CPUS_SETUP = """
|
||||
dd_game_cpus() {
|
||||
[ -n "${DD_GAME_CPUS:-}" ] || return 0
|
||||
command -v taskset >/dev/null 2>&1 || return 0
|
||||
BL_TASKSET="taskset -c $BL_GAME_CPUS"
|
||||
echo "droiddeck-proton: game cores $BL_GAME_CPUS" >&2
|
||||
DD_TASKSET="taskset -c $DD_GAME_CPUS"
|
||||
echo "droiddeck-proton: game cores $DD_GAME_CPUS" >&2
|
||||
}
|
||||
"""
|
||||
|
||||
BL_LIBPATH_SETUP = """
|
||||
bl_libpath() {
|
||||
DD_LIBPATH_SETUP = """
|
||||
dd_libpath() {
|
||||
export PROTON_USE_PIPEWIRE=${PROTON_USE_PIPEWIRE:-0}
|
||||
[ -n "${LD_LIBRARY_PATH:-}" ] || return 0
|
||||
local kept= dir old_ifs=$IFS
|
||||
@@ -244,9 +245,9 @@ bl_libpath() {
|
||||
}
|
||||
"""
|
||||
|
||||
BL_IDTECH3_SETUP = """
|
||||
bl_idtech3() {
|
||||
BL_EXTRA_ARGS=()
|
||||
DD_IDTECH3_SETUP = """
|
||||
dd_idtech3() {
|
||||
DD_EXTRA_ARGS=()
|
||||
case "${SteamAppId:-${STEAM_COMPAT_APP_ID:-}}" in
|
||||
2200|2350|9010|6020) ;;
|
||||
*) return 0 ;;
|
||||
@@ -256,15 +257,15 @@ bl_idtech3() {
|
||||
echo "droiddeck-proton: Quake-engine title; its launch options set the video mode, left as they are" >&2
|
||||
return 0 ;;
|
||||
esac
|
||||
w=${BL_WIDTH:-1280}
|
||||
h=${BL_HEIGHT:-720}
|
||||
BL_EXTRA_ARGS=(+set r_fullscreen 0 +set r_mode -1 +set r_customwidth "$w" +set r_customheight "$h")
|
||||
w=${DD_WIDTH:-1280}
|
||||
h=${DD_HEIGHT:-720}
|
||||
DD_EXTRA_ARGS=(+set r_fullscreen 0 +set r_mode -1 +set r_customwidth "$w" +set r_customheight "$h")
|
||||
echo "droiddeck-proton: Quake-engine title: windowed at ${w}x${h}" >&2
|
||||
}
|
||||
"""
|
||||
|
||||
BL_VACDIAG_SETUP = """
|
||||
bl_vacdiag() {
|
||||
DD_VACDIAG_SETUP = """
|
||||
dd_vacdiag() {
|
||||
[ -f /root/.droiddeck-vac-diagnostics ] || return 0
|
||||
[ "${verb:-}" = waitforexitandrun ] || return 0
|
||||
local exe= a dir added=no app=${SteamAppId:-${STEAM_COMPAT_APP_ID:-0}}
|
||||
@@ -275,7 +276,7 @@ bl_vacdiag() {
|
||||
if ls "$dir"/*/gameinfo.txt >/dev/null 2>&1 || ls "$dir"/../../*/gameinfo.gi >/dev/null 2>&1; then
|
||||
case " $* " in
|
||||
*" -condebug "*) echo "droiddeck-proton: vac-diag: app $app already has -condebug" >&2 ;;
|
||||
*) BL_EXTRA_ARGS+=(-condebug); added=yes
|
||||
*) DD_EXTRA_ARGS+=(-condebug); added=yes
|
||||
echo "droiddeck-proton: vac-diag: app $app is a Source title; launched with -condebug" >&2 ;;
|
||||
esac
|
||||
else
|
||||
@@ -289,7 +290,7 @@ bl_vacdiag() {
|
||||
}
|
||||
"""
|
||||
|
||||
BL_DRIVER_QUERY_SKIP = """
|
||||
DD_DRIVER_QUERY_SKIP = """
|
||||
case "$verb:${1##*/}:${STEAM_COMPAT_DATA_PATH%/}" in
|
||||
run:d3ddriverquery64.exe:*/compatdata/0 | run:d3ddriverquery.exe:*/compatdata/0)
|
||||
echo "droiddeck-proton: Steam's D3D driver query is not run (it fails here and would start Wine in compatdata/0)" >&2
|
||||
@@ -297,23 +298,23 @@ case "$verb:${1##*/}:${STEAM_COMPAT_DATA_PATH%/}" in
|
||||
esac
|
||||
"""
|
||||
|
||||
BL_DIRECTAUDIO_SETUP = """
|
||||
bl_is_steam_installscript_target() {
|
||||
DD_DIRECTAUDIO_SETUP = """
|
||||
dd_is_steam_installscript_target() {
|
||||
local target=${1:-}
|
||||
local steam_root=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/Steam}
|
||||
local helper="$steam_root/legacycompat/iscriptevaluator.exe"
|
||||
[ -f "$helper" ] && [[ -n "$target" && "$target" -ef "$helper" ]]
|
||||
}
|
||||
|
||||
bl_directaudio() {
|
||||
dd_directaudio() {
|
||||
case "${verb:-}" in
|
||||
run|waitforexitandrun|runinprefix) ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
base=$1
|
||||
[ -n "${BL_DIRECTAUDIO:-}" ] || return 0
|
||||
[ -d "$BL_DIRECTAUDIO" ] || return 0
|
||||
if bl_is_steam_installscript_target "${2:-}"; then
|
||||
[ -n "${DD_DIRECTAUDIO:-}" ] || return 0
|
||||
[ -d "$DD_DIRECTAUDIO" ] || return 0
|
||||
if dd_is_steam_installscript_target "${2:-}"; then
|
||||
echo "droiddeck-proton: DirectAudio skipped for Steam's install-script evaluator" >&2
|
||||
return 0
|
||||
fi
|
||||
@@ -337,7 +338,7 @@ bl_directaudio() {
|
||||
return 0
|
||||
fi
|
||||
if grep -aq PsCreateSystemThread "$winepulse"; then set=linux-wine11-systhread; else set=linux-wine11; fi
|
||||
da="$BL_DIRECTAUDIO/$set"
|
||||
da="$DD_DIRECTAUDIO/$set"
|
||||
if [ ! -d "$da/lib/wine" ]; then
|
||||
echo "droiddeck-proton: DirectAudio left off - no driver set for the $set interface is staged" >&2
|
||||
return 0
|
||||
@@ -358,16 +359,16 @@ bl_directaudio() {
|
||||
dir="$pfx/drive_c/windows/${pair%%:*}"
|
||||
src="$da/lib/wine/${pair#*:}/winedirectaudio.drv"
|
||||
if [ -d "$dir" ] && [ -f "$src" ] && [ "$(readlink "$dir/winedirectaudio.drv" 2>/dev/null)" != "$src" ]; then
|
||||
ln -sfn "$src" "$dir/winedirectaudio.drv.bl-new" && mv -f "$dir/winedirectaudio.drv.bl-new" "$dir/winedirectaudio.drv"
|
||||
ln -sfn "$src" "$dir/winedirectaudio.drv.dd-new" && mv -f "$dir/winedirectaudio.drv.dd-new" "$dir/winedirectaudio.drv"
|
||||
fi
|
||||
done
|
||||
key='[Software\\\\Wine\\\\Drivers]'
|
||||
if [ "$(readlink "$pfx/drive_c/windows/system32/winedirectaudio.drv" 2>/dev/null)" != "$da/lib/wine/aarch64-windows/winedirectaudio.drv" ]; then
|
||||
echo "droiddeck-proton: DirectAudio could not be placed in the prefix; Proton's own audio stays" >&2
|
||||
elif ! BL_KEY="$key" awk 'index($0, "[") == 1 { inside = index($0, ENVIRON["BL_KEY"] " ") == 1 } inside && index($0, "\\"Audio\\"=") == 1 { last = $0 } END { exit last != "\\"Audio\\"=\\"directaudio,pulse\\"" }' "$reg" 2>/dev/null; then
|
||||
elif ! DD_KEY="$key" awk 'index($0, "[") == 1 { inside = index($0, ENVIRON["DD_KEY"] " ") == 1 } inside && index($0, "\\"Audio\\"=") == 1 { last = $0 } END { exit last != "\\"Audio\\"=\\"directaudio,pulse\\"" }' "$reg" 2>/dev/null; then
|
||||
printf '\\n%s %s\\n"Audio"="directaudio,pulse"\\n' "$key" "$(date +%s)" >> "$reg"
|
||||
echo "droiddeck-proton: DirectAudio selected in the prefix" >&2
|
||||
srv="${BL_WINE_SERVER_BASE:-/tmp/.wine-$(id -u)}/server-$(printf '%x-%x' $(stat -c '%d %i' "$pfx" 2>/dev/null || echo 0 0))/socket"
|
||||
srv="${DD_WINE_SERVER_BASE:-/tmp/.wine-$(id -u)}/server-$(printf '%x-%x' $(stat -c '%d %i' "$pfx" 2>/dev/null || echo 0 0))/socket"
|
||||
if [ -S "$srv" ]; then
|
||||
echo "droiddeck-proton: a wineserver is already running for this prefix; DirectAudio may only engage on the next launch" >&2
|
||||
fi
|
||||
@@ -382,7 +383,7 @@ bl_directaudio() {
|
||||
LAUNCHER_SH = """#!/bin/bash
|
||||
verb=$1; shift
|
||||
steam_root=${STEAM_COMPAT_CLIENT_INSTALL_PATH:-${XDG_DATA_HOME:-$HOME/.local/share}/Steam}
|
||||
for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libblsession.so; do
|
||||
for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libddsession.so; do
|
||||
if [ -f "$fake" ]; then
|
||||
case ":${LD_PRELOAD:-}:" in
|
||||
*":$fake:"*) ;;
|
||||
@@ -390,7 +391,7 @@ for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libblsession.so; do
|
||||
esac
|
||||
fi
|
||||
done
|
||||
audit=/usr/local/lib/libblaudit.so
|
||||
audit=/usr/local/lib/libddaudit.so
|
||||
if [ -n "${PROOT_FP_KEY:-}" ] && [ -f "$audit" ]; then
|
||||
case ":${LD_AUDIT:-}:" in
|
||||
*":$audit:"*) ;;
|
||||
@@ -415,16 +416,16 @@ for name in %s; do
|
||||
[ -n "$depot" ] && break
|
||||
done
|
||||
if [ -n "$depot" ]; then
|
||||
bl_components "$depot"
|
||||
bl_directaudio "$depot" "$@"
|
||||
bl_game_cpus
|
||||
bl_idtech3 "$@"
|
||||
bl_vacdiag "$@"
|
||||
bl_libpath
|
||||
BL_STORE_PROTON="$depot/proton"; export BL_STORE_PROTON
|
||||
bl_store_launch "$@"
|
||||
BL_STORE_ARGS=("$@")
|
||||
bl_run ${BL_TASKSET:-} /usr/local/bin/droiddeck-game-env "$depot/proton" "$verb" "$@" "${BL_EXTRA_ARGS[@]}"
|
||||
dd_components "$depot"
|
||||
dd_directaudio "$depot" "$@"
|
||||
dd_game_cpus
|
||||
dd_idtech3 "$@"
|
||||
dd_vacdiag "$@"
|
||||
dd_libpath
|
||||
DD_STORE_PROTON="$depot/proton"; export DD_STORE_PROTON
|
||||
dd_store_launch "$@"
|
||||
DD_STORE_ARGS=("$@")
|
||||
dd_run ${DD_TASKSET:-} /usr/local/bin/droiddeck-game-env "$depot/proton" "$verb" "$@" "${DD_EXTRA_ARGS[@]}"
|
||||
fi
|
||||
echo "droiddeck-proton: no ARM64 Proton depot yet - the client downloads one as this tool's dependency; retry the launch once it has" >&2
|
||||
exit 1
|
||||
@@ -434,8 +435,8 @@ LAUNCHER_TEMPLATE = LAUNCHER_SH
|
||||
|
||||
def launcher_sh(sources=SOURCES):
|
||||
return (LAUNCHER_TEMPLATE % " ".join('"%s"' % n for n in sources)).replace(
|
||||
"verb=$1; shift", "verb=$1; shift\n" + BL_DRIVER_QUERY_SKIP + BL_DESKTOP_GPU_SETUP + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP + BL_IDTECH3_SETUP
|
||||
+ BL_VACDIAG_SETUP + BL_COMPONENTS_SETUP + BL_LIBPATH_SETUP + BL_STORE_SETUP, 1)
|
||||
"verb=$1; shift", "verb=$1; shift\n" + DD_DRIVER_QUERY_SKIP + DD_DESKTOP_GPU_SETUP + DD_DIRECTAUDIO_SETUP + DD_GAME_CPUS_SETUP + DD_IDTECH3_SETUP
|
||||
+ DD_VACDIAG_SETUP + DD_COMPONENTS_SETUP + DD_LIBPATH_SETUP + DD_STORE_SETUP, 1)
|
||||
|
||||
|
||||
LAUNCHER_SH = launcher_sh()
|
||||
@@ -455,7 +456,7 @@ EXTRA_MANIFEST_VDF = """"manifest"
|
||||
EXTRA_WRAPPER_SH = """#!/bin/bash
|
||||
verb=$1; shift
|
||||
here=$(dirname "$0")
|
||||
for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libblsession.so; do
|
||||
for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libddsession.so; do
|
||||
if [ -f "$fake" ]; then
|
||||
case ":${LD_PRELOAD:-}:" in
|
||||
*":$fake:"*) ;;
|
||||
@@ -463,31 +464,31 @@ for fake in /usr/local/lib/libfakeinput.so /usr/local/lib/libblsession.so; do
|
||||
esac
|
||||
fi
|
||||
done
|
||||
audit=/usr/local/lib/libblaudit.so
|
||||
audit=/usr/local/lib/libddaudit.so
|
||||
if [ -n "${PROOT_FP_KEY:-}" ] && [ -f "$audit" ]; then
|
||||
case ":${LD_AUDIT:-}:" in
|
||||
*":$audit:"*) ;;
|
||||
*) LD_AUDIT="$audit${LD_AUDIT:+:$LD_AUDIT}"; export LD_AUDIT ;;
|
||||
esac
|
||||
fi
|
||||
bl_components "$here"
|
||||
bl_directaudio "$here" "$@"
|
||||
bl_game_cpus
|
||||
bl_idtech3 "$@"
|
||||
bl_vacdiag "$@"
|
||||
bl_libpath
|
||||
BL_STORE_PROTON="$here/%s"; export BL_STORE_PROTON
|
||||
bl_store_launch "$@"
|
||||
BL_STORE_ARGS=("$@")
|
||||
bl_run ${BL_TASKSET:-} /usr/local/bin/droiddeck-game-env "$BL_STORE_PROTON" "$verb" "$@" "${BL_EXTRA_ARGS[@]}"
|
||||
dd_components "$here"
|
||||
dd_directaudio "$here" "$@"
|
||||
dd_game_cpus
|
||||
dd_idtech3 "$@"
|
||||
dd_vacdiag "$@"
|
||||
dd_libpath
|
||||
DD_STORE_PROTON="$here/%s"; export DD_STORE_PROTON
|
||||
dd_store_launch "$@"
|
||||
DD_STORE_ARGS=("$@")
|
||||
dd_run ${DD_TASKSET:-} /usr/local/bin/droiddeck-game-env "$DD_STORE_PROTON" "$verb" "$@" "${DD_EXTRA_ARGS[@]}"
|
||||
"""
|
||||
|
||||
|
||||
def extra_wrapper_sh(entry_point):
|
||||
return (EXTRA_WRAPPER_SH % entry_point).replace(
|
||||
'here=$(dirname "$0")',
|
||||
'here=$(dirname "$0")\n' + BL_DRIVER_QUERY_SKIP + BL_DESKTOP_GPU_SETUP + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP
|
||||
+ BL_IDTECH3_SETUP + BL_VACDIAG_SETUP + BL_COMPONENTS_SETUP + BL_LIBPATH_SETUP + BL_STORE_SETUP, 1)
|
||||
'here=$(dirname "$0")\n' + DD_DRIVER_QUERY_SKIP + DD_DESKTOP_GPU_SETUP + DD_DIRECTAUDIO_SETUP + DD_GAME_CPUS_SETUP
|
||||
+ DD_IDTECH3_SETUP + DD_VACDIAG_SETUP + DD_COMPONENTS_SETUP + DD_LIBPATH_SETUP + DD_STORE_SETUP, 1)
|
||||
|
||||
|
||||
EXTRA_COMPAT_TOOL_VDF = """"compatibilitytools"
|
||||
@@ -532,12 +533,12 @@ verb=$1; shift
|
||||
case $verb in
|
||||
getcompatpath | getnativepath) printf '%s\\n' "$1"; exit 0 ;;
|
||||
esac
|
||||
""" + BL_DESKTOP_GPU_SETUP + BL_GAME_CPUS_SETUP + """
|
||||
bl_game_cpus
|
||||
""" + DD_DESKTOP_GPU_SETUP + DD_GAME_CPUS_SETUP + """
|
||||
dd_game_cpus
|
||||
if [ -x /usr/local/bin/droiddeck-steamvr-flat ] && /usr/local/bin/droiddeck-steamvr-flat "$verb"; then
|
||||
exec /usr/local/bin/droiddeck-steamvr-game ${BL_TASKSET:-} /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
exec /usr/local/bin/droiddeck-steamvr-game ${DD_TASKSET:-} /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
fi
|
||||
exec ${BL_TASKSET:-} /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
exec ${DD_TASKSET:-} /usr/local/bin/droiddeck-fex steam "$verb" "$@"
|
||||
"""
|
||||
|
||||
|
||||
@@ -892,7 +893,10 @@ def appinfo_entries(path, wanted=None):
|
||||
deck = common.get("steam_deck_compatibility")
|
||||
configuration = deck.get("configuration") if isinstance(deck, dict) else None
|
||||
recommended = configuration.get("recommended_runtime", "") if isinstance(configuration, dict) else ""
|
||||
config = info.get("config") if isinstance(info.get("config"), dict) else {}
|
||||
entry = {
|
||||
"name": str(common.get("name", "")),
|
||||
"installdir": str(config.get("installdir", "")),
|
||||
"oslist": {part.strip().lower() for part in str(common.get("oslist", "")).split(",") if part.strip()},
|
||||
"osarch": str(common.get("osarch", "")).lower(),
|
||||
"type": str(common.get("type", "")).lower(),
|
||||
@@ -959,6 +963,13 @@ def native_targets(steam_root, apps):
|
||||
return targets
|
||||
|
||||
|
||||
def manifest_text(appid, name, installdir, bare=False):
|
||||
title = name.replace("\\", "\\\\").replace('"', '\\"').replace("\n", " ").replace("\r", " ")
|
||||
text = ('"AppState"\n{\n' + f' "appid" "{appid}"\n "Universe" "1"\n "name" "{title}"\n'
|
||||
+ f' "StateFlags" "4"\n "installdir" "{installdir}"\n' + '}\n')
|
||||
return text[:-2] + ' "AutoUpdateBehavior" "1"\n}\n' if bare else text
|
||||
|
||||
|
||||
def app_manifest(steam_root, app):
|
||||
for library in libraries(steam_root):
|
||||
try:
|
||||
@@ -1690,7 +1701,7 @@ def x64_repoint(steam_root, tool, live=False):
|
||||
write_changed(config, text)
|
||||
print("steam-compatibility: x86-64 client's Proton entries point at %s" % tool)
|
||||
if moved and live:
|
||||
with open(os.path.join(os.path.expanduser("~"), ".bl-compat-pending"), "a") as f:
|
||||
with open(os.path.join(os.path.expanduser("~"), ".dd-compat-pending"), "a") as f:
|
||||
f.write("".join("%s\n" % a for a in moved))
|
||||
print("steam-compatibility: repointed while the client runs: %s" % " ".join(moved))
|
||||
return moved
|
||||
@@ -1699,7 +1710,7 @@ def x64_repoint(steam_root, tool, live=False):
|
||||
def main():
|
||||
steam_root = sys.argv[1]
|
||||
if "--x64" in sys.argv[2:]:
|
||||
x64_repoint(steam_root, os.environ.get("BL_COMPAT_TOOL"), "--live" in sys.argv[2:])
|
||||
x64_repoint(steam_root, os.environ.get("DD_COMPAT_TOOL"), "--live" in sys.argv[2:])
|
||||
return
|
||||
tools = os.path.join(steam_root, "compatibilitytools.d")
|
||||
os.makedirs(tools, exist_ok=True)
|
||||
|
||||
Reference in new issue
Block a user