Files
DroidDeck/tools/linuxfs/overlay/usr/local/bin/droiddeck-proton-extra
T
The412Banner 9e6f81540f feat(bionic): DroidDeck-Bionic compatibility tool (Wine on Android's libc, no proot) (#3037)
DroidDeck-Bionic: a Steam compatibility tool that runs the game itself on Android's libc (bionic) instead of glibc inside proot. Steam, the stores and the session stay on DroidDeck's Linux side; only the game process leaves proot.

- Listed in the Proton list only when Run without proot is on, in its own row. Its builds are pre-releases on Droid-Deck/DroidDeck-Proton (DroidDeck-Bionic-12.8-rNN, runtime built by .github/workflows/build-bionic-runtime.yml from tools/bionic-runtime); the app installs and updates them like the other extra tools and never makes one the default unless the user picks it.
- With proot on, a launch sent to a bionic tool goes to the newest DroidDeck-Proton (picks stay as set).
- ProtonExtras / ProtonMenu / ExperimentalProtons / droiddeck-proton-extra: bionic pre-releases checked and listed only without proot; updates carry the default and per-game picks over; deleting a tool never follows links out of it. ProtonDefault: picks left on an older bionic build move to the installed one.
- Components: FEX builds for bionic (bionic-stable on DroidDeck-Components); each tool is offered only the FEX builds that fit it.
- Session logs: the bionic game log and its graphics logs are part of Share logs.

Synced with main twice before the merge (latest sync fbed69ce on main 67b82ad9; Build APK and validation green); a local trial merge on main 3e1fc3e6 had no conflicts and the game-environment, Proton-extra and store-launch tests pass.
2026-11-24 23:39:23 +00:00

186 lines
6.7 KiB
Python

#!/usr/bin/python3
import hashlib
import json
import os
import re
import shutil
import subprocess
import sys
import urllib.error
import urllib.request
RELEASES = "https://api.github.com/repos/%s/releases"
SOURCES = {
"ge": ("GloriousEggroll/proton-ge-custom", re.compile(r"aarch64\.tar\.(gz|xz)$")),
"cachyos": ("CachyOS/proton-cachyos", re.compile(r"arm64\.tar\.(gz|xz)$")),
"droiddeck": ("Droid-Deck/DroidDeck-Proton", re.compile(r"^DroidDeck-Proton-.*aarch64\.tar\.(gz|xz)$")),
"bionic": ("Droid-Deck/DroidDeck-Proton", re.compile(r"^DroidDeck-Bionic-.*aarch64\.tar\.(gz|xz)$")),
}
PRERELEASES = {"bionic"}
USER_AGENT = "droiddeck-proton-extra"
NEED_BYTES = 4 * 1024 * 1024 * 1024
def log(*args):
print("droiddeck-proton-extra:", *args, flush=True)
def fetch_json(url):
req = urllib.request.Request(url, headers={
"User-Agent": USER_AGENT, "Accept": "application/vnd.github+json"})
with urllib.request.urlopen(req, timeout=60) as r:
return json.load(r)
def pick_asset(source):
repo, pattern = SOURCES[source]
for release in fetch_json(RELEASES % repo + "?per_page=15"):
if release.get("draft") or (release.get("prerelease") and source not in PRERELEASES):
continue
assets = {a["name"]: a["browser_download_url"] for a in release.get("assets", ())}
for name in sorted(assets):
if pattern.search(name):
sums = [u for n, u in assets.items()
if n.startswith(name.split(".tar")[0]) and "sha512" in n]
return release["tag_name"], assets[name], (sums[0] if sums else None)
return None, None, None
def release_asset(source, tag):
repo, pattern = SOURCES[source]
release = fetch_json(RELEASES % repo + "/tags/" + tag)
assets = {a["name"]: a["browser_download_url"] for a in release.get("assets", ())}
for name in sorted(assets):
if pattern.search(name):
sums = [u for n, u in assets.items()
if n.startswith(name.split(".tar")[0]) and "sha512" in n]
return tag, assets[name], (sums[0] if sums else None)
raise SystemExit("droiddeck-proton-extra: %s has no ARM64 asset" % tag)
def download(url, path):
log("downloading %s" % os.path.basename(path))
rc = subprocess.call([
"curl", "-fL", "--retry", "5", "--retry-delay", "3", "--retry-connrefused",
"-C", "-", "-A", USER_AGENT, "-o", path, url])
if rc != 0:
raise SystemExit("droiddeck-proton-extra: download failed (curl %d)" % rc)
log("downloaded %.0f MB" % (os.path.getsize(path) / 1048576.0))
def verify(path, sums_url):
if not sums_url:
log("no checksum published; skipping verification")
return
try:
req = urllib.request.Request(sums_url, headers={"User-Agent": USER_AGENT})
with urllib.request.urlopen(req, timeout=60) as r:
want = r.read().decode("utf-8", "replace").split()[0].lower()
except (urllib.error.URLError, IndexError, OSError) as e:
log("could not read the checksum (%s); skipping verification" % e)
return
h = hashlib.sha512()
with open(path, "rb") as f:
for chunk in iter(lambda: f.read(4 << 20), b""):
h.update(chunk)
if h.hexdigest() != want:
os.unlink(path)
raise SystemExit("droiddeck-proton-extra: checksum mismatch; the download was deleted")
log("checksum ok")
def extract(tarball, into):
os.makedirs(into, exist_ok=True)
log("unpacking (a few minutes; nothing is shown while tar runs)")
rc = subprocess.call(["tar", "-xf", tarball, "-C", into])
if rc != 0:
raise SystemExit("droiddeck-proton-extra: tar failed (%d)" % rc)
entries = [e for e in sorted(os.listdir(into)) if not e.startswith(".")]
for entry in entries:
path = os.path.join(into, entry)
if os.path.isdir(path) and os.path.isfile(os.path.join(path, "toolmanifest.vdf")):
return path
if len(entries) == 1 and os.path.isdir(os.path.join(into, entries[0])):
return os.path.join(into, entries[0])
raise SystemExit("droiddeck-proton-extra: no Proton tree in the archive")
def installed(tools):
out = []
for entry in sorted(os.listdir(tools)) if os.path.isdir(tools) else ():
if entry.startswith("."):
continue
if os.path.isfile(os.path.join(tools, entry, "toolmanifest.vdf")):
out.append(entry)
return out
def main():
argv = sys.argv[1:]
if not argv:
raise SystemExit(__doc__ or "usage: droiddeck-proton-extra <steam root> ge|cachyos|droiddeck|<url>")
steam_root = argv.pop(0)
tools = os.path.join(steam_root, "compatibilitytools.d")
os.makedirs(tools, exist_ok=True)
if not argv or argv[0] in ("--list", "-l"):
for name in installed(tools):
log("installed: %s" % name)
return
what = argv.pop(0)
tag = None
if argv and argv[0] in ("--tag", "-t"):
argv.pop(0)
tag = argv.pop(0) if argv else None
local = None
if what in SOURCES:
tag, url, sums = release_asset(what, tag) if tag else pick_asset(what)
if not url:
raise SystemExit("droiddeck-proton-extra: no ARM64 build published for %s" % what)
log("%s -> %s" % (what, tag))
elif what.startswith("http"):
url, sums = what, None
elif os.path.isfile(what):
local, url, sums = what, None, None
log("using %s" % what)
else:
raise SystemExit(
"droiddeck-proton-extra: expected ge, cachyos, droiddeck, a URL or a tarball path, got %r" % what)
free = shutil.disk_usage(tools).free
if free < NEED_BYTES:
raise SystemExit("droiddeck-proton-extra: needs about %d GB free, has %.1f GB" % (
NEED_BYTES // (1024 ** 3), free / float(1024 ** 3)))
shutil.rmtree(os.path.join(tools, ".bannerlator-download"), ignore_errors=True)
staging = os.path.join(tools, ".droiddeck-download")
os.makedirs(staging, exist_ok=True)
if local:
tarball = local
else:
tarball = os.path.join(staging, os.path.basename(url.split("?")[0]))
download(url, tarball)
verify(tarball, sums)
unpacked = os.path.join(staging, "unpacked")
shutil.rmtree(unpacked, ignore_errors=True)
tree = extract(tarball, unpacked)
name = os.path.basename(tree)
final = os.path.join(tools, name)
if os.path.exists(final):
shutil.rmtree(final, ignore_errors=True)
os.rename(tree, final)
if local:
shutil.rmtree(os.path.join(staging, "unpacked"), ignore_errors=True)
else:
shutil.rmtree(staging, ignore_errors=True)
log("installed %s" % name)
subprocess.call(["steam-compatibility", steam_root])
if __name__ == "__main__":
main()