fix(bionic): name guest files by their Android paths in store launches

DroidDeck-Bionic's Wine has Android's root on Z:, but DroidDeck's store
launch files and helpers name guest files by guest Z: paths. A Ubisoft
game then skipped its service and started directly (Watch_Dogs exited at
launch); the Epic parent stand-in, GOG/Rockstar registry values, reg.exe
imports and the EA probe pointed at the wrong tree in the same way.
Reported by 2-Shar on PR #3037.

- proton: map guest Z: paths in every run argument (also NAME=Z:..., as
  in an installer's /DIR=) and export DROIDDECK_GUEST_ROOT, the guest's
  root as this Wine names it; launch.sh keeps it.
- StoreLaunch: the Ubisoft service and the Epic parent stand-in start
  from %DD_R% (DROIDDECK_GUEST_ROOT, else Z:). An installed Ubisoft
  game's older launch file is rewritten at the next library scan.
- droiddeck-store-launch: windows_path() asks DroidDeck-Bionic's
  getcompatpath when that tool runs the game.
- droiddeck-gog-maintenance: name the tool for the registry step.
This commit is contained in:
The412Banner committed 2026-11-23 00:44:48 +00:00
1 parent 2aae4b2284
commit f17d3ddaad
9 files changed
+194 -14

No files matched your search

+1
View File
@@ -37,6 +37,7 @@ for v in $(env | sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p'); do
WINE_OFFSCREEN_CHECK_MS|WINE_CPU_TOPOLOGY|WINE_LARGE_ADDRESS_AWARE|WINESTEAMNOEXEC|TZ) ;;
DXVK_LOG_LEVEL|DXVK_HDR|VKD3D_DEBUG|VKD3D_SHADER_DEBUG) ;;
DROIDDECK_GPU_LOAD|DROIDDECK_GPU_LOAD_DIR|DROIDDECK_VRAM_CAP|DROIDDECK_VRAM_CAP_MB|DROIDDECK_DISPLAY_DRIVER) ;;
DROIDDECK_GUEST_ROOT) ;;
VKD3D_FEATURE_LEVEL|VKD3D_SHADER_MODEL|vk_x11_strict_image_count) ;;
*) unset "$v" 2>/dev/null ;;
esac
+24 -7
View File
@@ -26,6 +26,16 @@ real() {
case "$p" in /data/*|/storage/*|/sdcard/*|/system/*|/apex/*|/vendor/*) echo "$p" ;; *) echo "$DDNATV_ROOT$p" ;; esac
}
# A guest Z: path (also as NAME=Z:..., e.g. an installer's /DIR=) -> the Z: path of its Android file; anything else unchanged
zpath() {
local p k
case "$1" in
[Zz]:[\\/]*) p=${1:2}; p=$(real "${p//\\//}"); printf 'Z:%s\n' "${p//\//\\}" ;;
*=[Zz]:[\\/]*) k=${1%%=[Zz]:[\\/]*}; printf '%s=%s\n' "$k" "$(zpath "${1#"$k="}")" ;;
*) printf '%s\n' "$1" ;;
esac
}
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
tool=$(real "$here")
compat=$(real "${STEAM_COMPAT_DATA_PATH:-$HOME/.local/share/Steam/steamapps/compatdata/0}")
@@ -33,24 +43,31 @@ compat=$(real "${STEAM_COMPAT_DATA_PATH:-$HOME/.local/share/Steam/steamapps/comp
case "$verb" in
run|waitforexitandrun|runinprefix)
[ $# -gt 0 ] || exit 0
# A Windows path (DroidDeck's Xbox launch names the game on a drive letter of its own) or a bare program name
# (DroidDeck's store steps run cmd.exe, which Wine finds in system32) goes to Wine unchanged.
# Another Windows path (DroidDeck's Xbox launch names the game on a drive letter of its own) or a bare program
# name (DroidDeck's store steps run cmd.exe, which Wine finds in system32) goes to Wine unchanged.
case "$1" in
[Zz]:[\\/]*) exe=$(zpath "$1") ;;
[A-Za-z]:[\\/]*) exe=$1 ;;
/*) exe=$(real "$1") ;;
*/*) exe=$(real "$PWD/$1") ;;
*) exe=$1 ;;
esac
shift
# DroidDeck's store and Xbox helpers name guest files by Z: paths (reg.exe import, cmd.exe /c, msiexec /i, setup
# /DIR=); this Wine's Z: is Android's root.
args=()
for a in "$@"; do args+=("$(zpath "$a")"); done
export DROIDDECK_BIONIC_ROOT="$DDNATV_ROOT"
# The Xbox runtime's DLC and mount folders come as Z: paths of the guest; this Wine sees the Android side.
# The guest's root as this Wine names it; the store launch files DroidDeck writes (StoreLaunch.kt) start their
# helpers from it.
r=$(real /); r=${r%/}; DROIDDECK_GUEST_ROOT="Z:${r//\//\\}"; export DROIDDECK_GUEST_ROOT
# The Xbox runtime's DLC and mount folders come as ;-separated Z: paths of the guest.
zreal() {
local out="" part p
local out="" part
local -a parts
IFS=';' read -r -a parts <<< "$1"
for part in "${parts[@]}"; do
case "$part" in [Zz]:\\*) p=${part:2}; p=$(real "${p//\\//}"); part="Z:${p//\//\\}" ;; esac
out="${out:+$out;}$part"
out="${out:+$out;}$(zpath "$part")"
done
echo "$out"
}
@@ -75,7 +92,7 @@ print(" ".join(sorted(n for n in names if re.fullmatch(r"[A-Za-z_][A-Za-z0-9_]*"
PY
)
export DROIDDECK_BIONIC_KEEP
exec /system/bin/sh "$tool/bionic/launch.sh" "$verb" "$compat" "$exe" "$@" ;;
exec /system/bin/sh "$tool/bionic/launch.sh" "$verb" "$compat" "$exe" ${args[@]+"${args[@]}"} ;;
getcompatpath)
p=$(real "${1:-}")
printf 'Z:%s\n' "${p//\//\\}" ;;
@@ -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)
@@ -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):
+100
View File
@@ -0,0 +1,100 @@
import importlib.machinery
import importlib.util
import os
import shutil
import subprocess
import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch
TOOLS = Path(__file__).resolve().parents[1]
PROTON = TOOLS / 'bionic-runtime/tool/proton'
LAUNCH = TOOLS / 'bionic-runtime/tool/launch.sh'
BIN = TOOLS / 'linuxfs/overlay/usr/local/bin'
ANDROID = '/data/user/0/com.droiddeck.launcher/files/linuxfs'
BINDS = '/storage/emulated/0/Games:/home/games|/storage/1234-5678/Steam:/mnt/sd'
def load(name):
loader = importlib.machinery.SourceFileLoader(name.replace('-', '_'), str(BIN / name))
spec = importlib.util.spec_from_loader(loader.name, loader)
module = importlib.util.module_from_spec(spec)
loader.exec_module(module)
return module
store = load('droiddeck-store-launch')
def zpath(arg):
text = PROTON.read_text()
functions = text[text.index('real() {'):text.index('\nhere=')]
env = dict(os.environ, DDNATV_ROOT=ANDROID, DDNATV_BINDS=BINDS)
return subprocess.run(['bash', '-c', functions + '\nzpath "$1"', 'zpath', arg], env=env,
capture_output=True, text=True, check=True).stdout.rstrip('\n')
class ToolArguments(unittest.TestCase):
def test_a_guest_path_names_its_android_file(self):
self.assertEqual('Z:\\data\\user\\0\\com.droiddeck.launcher\\files\\linuxfs\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe',
zpath('Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe'))
def test_a_bound_folder_names_its_android_side(self):
self.assertEqual('Z:\\storage\\emulated\\0\\Games\\Brotato\\setup.exe', zpath('Z:\\home\\games\\Brotato\\setup.exe'))
self.assertEqual('Z:\\storage\\1234-5678\\Steam\\a.reg', zpath('z:/mnt/sd/a.reg'))
def test_a_switch_value_is_mapped(self):
self.assertEqual('/DIR=Z:\\storage\\emulated\\0\\Games\\Game', zpath('/DIR=Z:\\home\\games\\Game'))
def test_android_and_other_paths_stay(self):
for arg in ('Z:\\storage\\emulated\\0\\Download\\a.exe', 'Z:\\data\\user\\0\\com.droiddeck.launcher\\files\\linuxfs\\tmp\\a.bat',
'C:\\windows\\system32\\reg.exe', 'X:\\Brotato.exe', '-dx12', '-n', '-e', 'cmd.exe', '/d', ''):
self.assertEqual(arg, zpath(arg))
def test_wine_keeps_the_guest_root(self):
self.assertIn('DROIDDECK_GUEST_ROOT) ;;', LAUNCH.read_text())
class StorePaths(unittest.TestCase):
def setUp(self):
self.tmp = tempfile.TemporaryDirectory()
self.addCleanup(self.tmp.cleanup)
self.tool = Path(self.tmp.name) / 'compatibilitytools.d/DroidDeck-Bionic-12.8-r41-Proton'
(self.tool / 'bionic').mkdir(parents=True)
shutil.copy(PROTON, self.tool / 'proton')
(self.tool / 'proton').chmod(0o755)
(self.tool / 'bionic/launch.sh').write_text('')
def env(self, **extra):
values = {'DD_STORE_PROTON': str(self.tool / 'proton'), 'DDNATV_ROOT': ANDROID, 'DDNATV_BINDS': BINDS}
values.update(extra)
return patch.dict(os.environ, values)
def test_a_bionic_game_gets_android_paths(self):
with self.env():
self.assertEqual('Z:\\data\\user\\0\\com.droiddeck.launcher\\files\\linuxfs\\root\\.cache\\droiddeck-ubisoft\\bridge-274',
store.windows_path('/root/.cache/droiddeck-ubisoft/bridge-274'))
self.assertEqual('Z:\\storage\\emulated\\0\\Games\\Watch_Dogs\\bin\\Watch_Dogs.exe',
store.windows_path('/home/games/Watch_Dogs/bin/Watch_Dogs.exe'))
def test_the_wrapper_names_the_same_tool(self):
with self.env(DD_STORE_PROTON=str(self.tool / 'droiddeck-proton-wrap')):
self.assertEqual('Z:\\storage\\emulated\\0\\Games\\a.reg', store.windows_path('/home/games/a.reg'))
def test_other_tools_keep_guest_paths(self):
(self.tool / 'bionic/launch.sh').unlink()
with self.env():
self.assertEqual('Z:\\home\\games\\a.reg', store.windows_path('/home/games/a.reg'))
with patch.dict(os.environ, {'DD_STORE_PROTON': str(self.tool / 'proton')}):
os.environ.pop('DDNATV_ROOT', None)
self.assertEqual('Z:\\home\\games\\b.reg', store.windows_path('/home/games/b.reg'))
def test_a_failing_tool_keeps_the_guest_path(self):
(self.tool / 'proton').write_text('#!/bin/sh\nexit 1\n')
with self.env():
self.assertEqual('Z:\\home\\games\\c.reg', store.windows_path('/home/games/c.reg'))
if __name__ == '__main__':
unittest.main()
+17
View File
@@ -1005,6 +1005,23 @@ class Ubisoft(unittest.TestCase):
self.assertEqual('C:/users/steamuser/Saved Games/Ubisoft/u1/109/', launch['saves'])
self.assertTrue((self.compat_data / 'pfx/drive_c/users/steamuser/Saved Games/Ubisoft/u1/109').is_dir())
def test_a_bionic_launch_names_the_android_files(self):
self.runtime()
tool = self.root / 'DroidDeck-Bionic-12.8-r41-Proton'
(tool / 'bionic').mkdir(parents=True)
(tool / 'bionic/launch.sh').write_text('')
proton = Path(__file__).resolve().parents[1] / 'bionic-runtime/tool/proton'
(tool / 'proton').write_bytes(proton.read_bytes())
(tool / 'proton').chmod(0o755)
env = {'DD_STORE_PROTON': str(tool / 'proton'), 'DDNATV_ROOT': '/data/user/0/app/files/linuxfs',
'DDNATV_BINDS': '/storage/emulated/0/T:%s' % self.root}
with patch.dict(os.environ, env):
self.prepare(self.answer)
launch = json.loads((self.folder / store.UBISOFT_LAUNCH).read_text())
self.assertEqual('Z:\\storage\\emulated\\0\\T\\Games\\Stores\\Ubisoft\\Splinter Cell\\system\\SplinterCell.exe', launch['exe'])
for key in ('bridge', 'log'):
self.assertTrue(launch[key].startswith('Z:\\storage\\emulated\\0\\T\\cache\\'), launch[key])
def test_without_a_session_the_launch_file_is_removed_and_the_game_starts_as_is(self):
self.runtime()
(self.folder / store.UBISOFT_LAUNCH).write_text('{}')