mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
launch.sh kept only a fixed list of variables, so DroidDeck settings that DroidDeck-Proton games get were dropped: the games' TU_DEBUG (sysmem by default), MESA_NO_ERROR and DXVK_CONFIG (VRAM cap, per-game DXVK options), the Game environment entries, the Wine sync choice and Force SSBS. - proton (guest) lists the names of DroidDeck's game environment for this game (shared entries and the game's own, as droiddeck-game-env applied them) in DROIDDECK_BIONIC_KEEP; launch.sh keeps those names. - launch.sh also keeps TU_DEBUG, MESA_NO_ERROR, DXVK_CONFIG, DXVK_HUD and the sync variables. - Sync: ntsync -> userspace ntsync with esync fallback, esync -> esync, wineserver -> neither, fsync (no futex_waitv on Android) -> ntsync; PROTON_NO_NTSYNC / PROTON_NO_ESYNC / WINEESYNC=0 still turn one off. - Force SSBS (DROIDDECK_FORCE_SSBS, a glibc preload on DroidDeck-Proton) maps to bionic Wine's WINE_FORCE_SSBS. - The log names the sync, SSBS, TU_DEBUG and kept settings.
63 lines
2.6 KiB
Bash
63 lines
2.6 KiB
Bash
#!/bin/bash
|
|
# DroidDeck-Bionic: a Steam compatibility tool that runs Windows games on the bionic (Android libc) Proton layer
|
|
# under files/, outside the Linux userland. Steam calls it inside DroidDeck's no-proot guest; it turns guest paths
|
|
# into Android paths and hands over to bionic/launch.sh, an Android /system/bin/sh script.
|
|
# Verbs: run/waitforexitandrun (start the game), runinprefix (run a program in the prefix), getcompatpath/
|
|
# getnativepath (path conversion); the rest are accepted and ignored.
|
|
set -u
|
|
verb=${1:-}
|
|
[ $# -gt 0 ] && shift
|
|
|
|
if [ -z "${DDNATV_ROOT:-}" ]; then
|
|
echo "DroidDeck-Bionic needs Settings > Run without proot" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# guest path -> Android path: the longest no-proot bind whose guest side starts the path, else inside the rootfs
|
|
real() {
|
|
local p="$1" best="" host="" b g h
|
|
local -a binds
|
|
IFS='|' read -r -a binds <<< "${DDNATV_BINDS:-}"
|
|
for b in "${binds[@]}"; do
|
|
h="${b%%:*}"; g="${b#*:}"
|
|
case "$p" in "$g"|"$g"/*) [ ${#g} -gt ${#best} ] && { best="$g"; host="$h"; } ;; esac
|
|
done
|
|
if [ -n "$best" ]; then echo "$host${p#"$best"}"; return; fi
|
|
case "$p" in /data/*|/storage/*|/sdcard/*|/system/*|/apex/*|/vendor/*) echo "$p" ;; *) echo "$DDNATV_ROOT$p" ;; esac
|
|
}
|
|
|
|
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
tool=$(real "$here")
|
|
compat=$(real "${STEAM_COMPAT_DATA_PATH:-$HOME/.local/share/Steam/steamapps/compatdata/0}")
|
|
|
|
case "$verb" in
|
|
run|waitforexitandrun|runinprefix)
|
|
[ $# -gt 0 ] || exit 0
|
|
exe=$(real "$1"); shift
|
|
export DROIDDECK_BIONIC_ROOT="$DDNATV_ROOT"
|
|
# DroidDeck's game environment (shared entries and this game's), already applied by droiddeck-game-env: the
|
|
# names launch.sh keeps when it drops the rest of the guest environment.
|
|
DROIDDECK_BIONIC_KEEP=$(python3 - "${STEAM_COMPAT_DATA_PATH:-}" 2>/dev/null <<'PY'
|
|
import json, os, re, sys
|
|
try:
|
|
config = json.load(open(os.path.expanduser("~/.config/droiddeck/game-environment.json"), encoding="utf-8"))
|
|
except (OSError, ValueError):
|
|
sys.exit(0)
|
|
scope = os.path.basename(sys.argv[1].rstrip("/"))
|
|
names = set((config.get("shared") or {}).keys())
|
|
if re.fullmatch(r"[1-9][0-9]{0,9}", scope):
|
|
names |= set(((config.get("games") or {}).get(scope) or {}).keys())
|
|
print(" ".join(sorted(n for n in names if re.fullmatch(r"[A-Za-z_][A-Za-z0-9_]*", n) and n in os.environ)))
|
|
PY
|
|
)
|
|
export DROIDDECK_BIONIC_KEEP
|
|
exec /system/bin/sh "$tool/bionic/launch.sh" "$verb" "$compat" "$exe" "$@" ;;
|
|
getcompatpath)
|
|
p=$(real "${1:-}")
|
|
printf 'Z:%s\n' "${p//\//\\}" ;;
|
|
getnativepath)
|
|
p=${1:-}; p=${p#[Zz]:}; p=${p//\\//}
|
|
echo "$p" ;;
|
|
*) exit 0 ;;
|
|
esac
|