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.
This commit is contained in:
The412Banner authored and GitHub committed 2026-11-24 23:39:23 +00:00
1 parent 3e1fc3e60e
commit 9e6f81540f
49 files changed
+3459 -84

No files matched your search

@@ -881,6 +881,8 @@ def read_vdf(text):
def run_keys(items, appid=""):
# (hasrunkey, value name, MinimumHasRunValue) of each "run process" entry; Steam runs the process unless the
# value is a DWORD of at least that minimum (1 when the script does not say)
appid = next((value for name, value in items if name.lower() == "appid" and isinstance(value, str)), appid)
found = set()
for name, value in items:
@@ -889,30 +891,44 @@ def run_keys(items, appid=""):
if any(isinstance(v, str) and re.fullmatch(r"process [0-9]+", n.lower()) for n, v in value):
key = next((v for n, v in value if n.lower() == "hasrunkey" and isinstance(v, str)),
"HKEY_LOCAL_MACHINE\\Software\\Valve\\Steam\\Apps\\" + appid)
found.add((key.lower(), name.lower()))
minimum = next((v for n, v in value if n.lower() == "minimumhasrunvalue" and isinstance(v, str)), "1")
try:
minimum = int(minimum.strip(), 0)
except ValueError:
minimum = int(minimum.strip()) if minimum.strip().isdigit() else 1
found.add((key.lower(), name.lower(), minimum))
found |= run_keys(value, appid)
return found
def registry_values(path):
found, section = set(), None
# {(key, value name): DWORD, or None for a value of another type}
found, section = {}, None
with open(path, encoding="utf-8", errors="replace") as reg:
for line in reg:
if line.startswith("["):
section = line[1:line.find("]")].replace("\\\\", "\\").lower() if "]" in line else None
elif section and line.startswith('"') and '"=' in line:
found.add((section, line[1:line.index('"=')].replace("\\\\", "\\").lower()))
name = line[1:line.index('"=')].replace("\\\\", "\\").lower()
data = line[line.index('"=') + 2:].strip()
dword = None
if data.lower().startswith("dword:"):
try:
dword = int(data[6:], 16)
except ValueError:
pass
found[(section, name)] = dword
return found
def has_run(key, value, values):
def has_run(key, value, values, minimum=1):
path = key[len("hkey_local_machine\\"):] if key.startswith("hkey_local_machine\\") else None
if path is None:
return False
views = [path]
if path.startswith("software\\"):
views.append("software\\wow6432node\\" + path[len("software\\"):])
return any((view, value) in values for view in views)
return any(isinstance(values.get((view, value)), int) and values[(view, value)] >= minimum for view in views)
def scripts_digest(scripts):
@@ -923,18 +939,49 @@ def scripts_digest(scripts):
return digest.hexdigest()
def only_guarded_runs(items):
# True when every action in the scripts is a "run process" entry. With all their hasrunkeys set, Steam's
# evaluator would run nothing, so the scripts need no run even when Steam has rewritten the file (its
# SteamID, language, install path or order change between launches).
found = False
for _, entries in items:
if not isinstance(entries, list):
return False
for _, entry in entries:
if not isinstance(entry, list):
return False
for _, block in entry:
if not isinstance(block, list):
continue
for section, actions in block:
if section.lower() != "run process" or not isinstance(actions, list):
return False
for _, action in actions:
if not isinstance(action, list) or not any(
isinstance(v, str) and re.fullmatch(r"process [0-9]+", n.lower()) for n, v in action):
return False
found = True
return found
def install_scripts_done(scripts, env):
prefix = Path(env.get("STEAM_COMPAT_DATA_PATH", "/nonexistent")) / "pfx"
try:
if (prefix / INSTALL_STAMP).read_text().strip() != scripts_digest(scripts):
return False
keys = set()
keys, parsed = set(), []
for path in scripts:
keys |= run_keys(read_vdf(Path(path).read_text(encoding="utf-8", errors="replace")))
parsed.append(read_vdf(Path(path).read_text(encoding="utf-8", errors="replace")))
keys |= run_keys(parsed[-1])
values = registry_values(prefix / "system.reg")
except (OSError, ValueError):
return False
return bool(keys) and all(has_run(key, value, values) for key, value in keys)
if not keys or not all(has_run(key, value, values, minimum) for key, value, minimum in keys):
return False
try:
if (prefix / INSTALL_STAMP).read_text().strip() == scripts_digest(scripts):
return True
except OSError:
pass
return all(only_guarded_runs(items) for items in parsed)
def record_install_scripts(digest, env):
@@ -243,6 +243,7 @@ def run_patch(folder, appid, installer, game):
previous = dict(os.environ)
try:
os.environ.update(env)
os.environ["DD_STORE_PROTON"] = command
pfx = Path(prefix) / "pfx"
if not (pfx / "system.reg").is_file() or not (pfx / "drive_c/windows/system32/reg.exe").is_file():
subprocess.run([command, "run", "wineboot.exe", "-u"], env=env, timeout=90, check=True)
@@ -13,8 +13,10 @@ 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"aarch64\.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
@@ -33,7 +35,7 @@ def fetch_json(url):
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"):
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):
@@ -2,6 +2,7 @@
import base64
import binascii
import functools
import json
import os
import re
@@ -156,7 +157,27 @@ def ask(channel, request, timeout=TIMEOUT, claim=False):
def windows_path(unix):
return "Z:" + unix.replace("/", "\\")
tool = bionic_tool(os.environ.get("DD_STORE_PROTON", ""))
return (tool and bionic_path(tool, unix)) or "Z:" + unix.replace("/", "\\")
def bionic_tool(proton):
if not proton or not os.environ.get("DDNATV_ROOT"):
return None
tool = Path(proton).parent
return str(tool / "proton") if (tool / "bionic" / "launch.sh").is_file() else None
@functools.lru_cache(maxsize=None)
def bionic_path(proton, unix):
# DroidDeck-Bionic's Wine sees Android's root on Z:, so a guest path is named by the Android file it maps to.
try:
result = subprocess.run([proton, "getcompatpath", unix], stdin=subprocess.DEVNULL, capture_output=True,
text=True, timeout=TIMEOUT)
except (OSError, subprocess.SubprocessError):
return None
path = result.stdout.strip()
return path if result.returncode == 0 and path[:3] == "Z:\\" else None
def reg_escape(value):
@@ -187,6 +187,9 @@ dd_components() {
# The selected system PowerVR runtime supplies DXVK at launch. Keep saved selections
# for a later manual-driver session without rewriting this Proton's bundled files now.
[ "$comp" = dxvk ] && [ -n "${DROIDDECK_POWERVR_RUNTIME:-}" ] && continue
# DroidDeck-Bionic loads only Android-built FEX unix libraries: -bionic packages or its own saved copy.
# A row without such a source (a glibc package, or a removal) is skipped and the tool keeps its FEX files.
if [ "$comp" = fex ] && [[ "$cm_tool" == DroidDeck-Bionic* ]] && [[ "${src,,}" != *bionic* ]]; then continue; fi
cm_rows+=("$comp"$'\\t'"$rel"$'\\t'"$sum"$'\\t'"$src")
[ "$src" != "-" ] && [ -f "$base/$rel" ] && cm_files+=("$base/$rel")
done <<< "$cm_selected"
@@ -290,6 +293,23 @@ dd_vacdiag() {
}
"""
# DroidDeck-Bionic runs only without proot. With proot on, a launch Steam sends to a DroidDeck-Bionic tool goes to the
# newest DroidDeck-Proton's wrapper before anything else runs, as if that Proton had been picked; the picks stay as set.
DD_BIONIC_PROOT_FALLBACK = """
if [ -f "$here/bionic/launch.sh" ] && [ -z "${DDNATV_ROOT:-}" ]; then
dd_fallback=$(cd "$here/.." 2>/dev/null && for d in DroidDeck-Proton*; do
[ -x "$d/droiddeck-proton-wrap" ] && [ ! -e "$d/bionic/launch.sh" ] || continue
v=${d#DroidDeck-Proton}; printf '%s\\t%s/%s\\n' "${v#[ -]}" "$PWD" "$d"
done | sort -V | tail -n 1 | cut -f 2-)
if [ -n "$dd_fallback" ]; then
echo "droiddeck-proton: DroidDeck-Bionic needs Run without proot; this launch uses ${dd_fallback##*/}" >&2
exec "$dd_fallback/droiddeck-proton-wrap" "$verb" "$@"
fi
echo "droiddeck-proton: DroidDeck-Bionic needs Run without proot, and no DroidDeck-Proton is installed to run this launch instead; turn on Run without proot or install DroidDeck-Proton" >&2
exit 1
fi
"""
DD_DRIVER_QUERY_SKIP = """
case "$verb:${1##*/}:${STEAM_COMPAT_DATA_PATH%/}" in
run:d3ddriverquery64.exe:*/compatdata/0 | run:d3ddriverquery.exe:*/compatdata/0)
@@ -487,7 +507,7 @@ dd_run ${DD_TASKSET:-} /usr/local/bin/droiddeck-game-env "$DD_STORE_PROTON" "$ve
def extra_wrapper_sh(entry_point):
return (EXTRA_WRAPPER_SH % entry_point).replace(
'here=$(dirname "$0")',
'here=$(dirname "$0")\n' + DD_DRIVER_QUERY_SKIP + DD_DESKTOP_GPU_SETUP + DD_DIRECTAUDIO_SETUP + DD_GAME_CPUS_SETUP
'here=$(dirname "$0")\n' + DD_BIONIC_PROOT_FALLBACK + 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)