mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
Components: choices enforced at every game launch; Steam's tool-0 probes get their own prefix per Proton
Steam runs its graphics probe through every registered Proton at once after login, all in compatdata/0. Prefix system32 links point into the Proton that set it up last, and the other Protons' Wines, running outside Proton's pfx.lock, wrote their builtin DLLs through them into that Proton's tree (device: GE's FEX DLLs became Proton Experimental's at session start). - bannerlator-steam-compat: both wrappers (Valve's depot launcher and the third-party bannerlator-proton-wrap) give a tool-0 run STEAM_COMPAT_DATA_PATH=.../compatdata/0-<tool>, and before every other launch check the Proton's files against the app's desired.tsv and put back anything that differs (same Proton build only), logging to reapplied.log. - ComponentsManager writes desired.tsv plus unpacked copies of the packages in use into the runtime after every change; the page and the drawer show 're-applied at launch'.
This commit is contained in:
1 parent
ff73c44ca9
commit
66ef6ca802
5 files changed
+153
-6
No files matched your search
BIN
Binary file not shown.
@@ -70,6 +70,62 @@ TOOL_MANIFEST_VDF = """"manifest"
|
||||
}
|
||||
""" % LAUNCHER
|
||||
|
||||
|
||||
# Steam runs its own graphics probe through EVERY registered tool at once, ~40 s after logging in,
|
||||
# all with STEAM_COMPAT_DATA_PATH=.../compatdata/0. A prefix's system32 holds links into the Proton
|
||||
# that last set it up, and the Wines of the other Protons, still running outside Proton's pfx.lock,
|
||||
# wrote their own builtin DLLs through those links - into that Proton's tree (seen on device: GE's
|
||||
# FEX DLLs replaced by Proton Experimental's at session start). So each tool's tool-0 run gets a
|
||||
# prefix of its own; games, which each have their own compatdata/<appid>, are not touched.
|
||||
BL_PROBE_PREFIX_SETUP = """
|
||||
bl_probe_prefix() {
|
||||
case "${STEAM_COMPAT_DATA_PATH:-}" in
|
||||
*/compatdata/0|*/compatdata/0/)
|
||||
STEAM_COMPAT_DATA_PATH="${STEAM_COMPAT_DATA_PATH%/}-$1"
|
||||
mkdir -p "$STEAM_COMPAT_DATA_PATH"
|
||||
export STEAM_COMPAT_DATA_PATH
|
||||
echo "bannerlator-proton: Steam's tool-0 run gets its own prefix: $STEAM_COMPAT_DATA_PATH" >&2 ;;
|
||||
esac
|
||||
}
|
||||
"""
|
||||
|
||||
# The Components page's choices, enforced in the one place every game launch passes: the app keeps
|
||||
# desired.tsv (tool dir, Proton build, component, file, sha256, source copy) and an unpacked copy of
|
||||
# each package in use. A file that no longer matches - whatever changed it - is put back before
|
||||
# Proton starts. Only for the Proton build the choice was made for: after a Steam update the build
|
||||
# differs and the Proton's own new files are left alone until the user chooses again.
|
||||
BL_COMPONENTS_SETUP = """
|
||||
bl_components() {
|
||||
base=$1
|
||||
cm_dir="${HOME:-/root}/.local/share/bannerlator-components"
|
||||
cm_list="$cm_dir/desired.tsv"
|
||||
[ -f "$cm_list" ] || return 0
|
||||
case "${STEAM_COMPAT_DATA_PATH:-}" in */compatdata/0|*/compatdata/0/|*/compatdata/0-*) return 0 ;; esac
|
||||
cm_tool=${base##*/}
|
||||
cm_build=$(awk 'NR == 1 { print $2 }' "$base/version" 2>/dev/null)
|
||||
cm_fixed=0
|
||||
cm_checked=0
|
||||
while IFS=$'\\t' read -r t want comp rel sum src; do
|
||||
[ "$t" = "$cm_tool" ] && [ "$want" = "$cm_build" ] || continue
|
||||
cm_checked=$((cm_checked + 1))
|
||||
f="$base/$rel"
|
||||
if [ -f "$f" ] && [ "$(sha256sum "$f" | cut -d' ' -f1)" = "$sum" ]; then continue; fi
|
||||
if [ ! -f "$src" ]; then
|
||||
echo "bannerlator-proton: components: $comp source missing ($src), left as it is" >&2
|
||||
continue
|
||||
fi
|
||||
mkdir -p "$(dirname "$f")"
|
||||
cp -f "$src" "$f.bl-new" && mv -f "$f.bl-new" "$f" || continue
|
||||
case "$rel" in *.so) chmod 755 "$f" ;; *) chmod 644 "$f" ;; esac
|
||||
cm_fixed=$((cm_fixed + 1))
|
||||
done < "$cm_list"
|
||||
if [ "$cm_fixed" -gt 0 ]; then
|
||||
echo "bannerlator-proton: components: re-applied $cm_fixed of $cm_checked file(s) in $cm_tool before this launch" >&2
|
||||
printf '%s\\t%s\\t%s\\n' "$(date +%s)" "$cm_tool" "$cm_fixed" >> "$cm_dir/reapplied.log"
|
||||
fi
|
||||
}
|
||||
"""
|
||||
|
||||
# Resolves the depot at launch time, so the tool can be registered before the depot exists and
|
||||
# survives the client updating or replacing it. Proton takes its base directory from
|
||||
# dirname(sys.argv[0]) without resolving it, so it is run from the depot itself.
|
||||
@@ -172,9 +228,11 @@ if [ -f "$fake" ]; then
|
||||
*) LD_PRELOAD="$fake${LD_PRELOAD:+:$LD_PRELOAD}"; export LD_PRELOAD ;;
|
||||
esac
|
||||
fi
|
||||
bl_probe_prefix "bannerlator-proton-arm64"
|
||||
for name in %s; do
|
||||
depot="$steam_root/steamapps/common/$name"
|
||||
if [ -d "$depot/files/bin-arm64" ] && [ -x "$depot/proton" ]; then
|
||||
bl_components "$depot"
|
||||
bl_directaudio "$depot"
|
||||
bl_game_cpus
|
||||
bl_idtech3 "$@"
|
||||
@@ -188,7 +246,8 @@ exit 1
|
||||
# and a % format would eat that into a single %, leaving a shell expansion that silently does
|
||||
# something else.
|
||||
LAUNCHER_SH = LAUNCHER_SH.replace(
|
||||
"verb=$1; shift", "verb=$1; shift\n" + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP + BL_IDTECH3_SETUP, 1)
|
||||
"verb=$1; shift", "verb=$1; shift\n" + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP + BL_IDTECH3_SETUP
|
||||
+ BL_PROBE_PREFIX_SETUP + BL_COMPONENTS_SETUP, 1)
|
||||
|
||||
# A third-party Proton dropped into compatibilitytools.d - GE-Proton, proton-cachyos, anything of
|
||||
# that shape - is adopted rather than used as shipped, for the same two reasons Valve's ARM64 depot
|
||||
@@ -220,6 +279,8 @@ if [ -f "$fake" ]; then
|
||||
*) LD_PRELOAD="$fake${LD_PRELOAD:+:$LD_PRELOAD}"; export LD_PRELOAD ;;
|
||||
esac
|
||||
fi
|
||||
bl_probe_prefix "${here##*/}"
|
||||
bl_components "$here"
|
||||
bl_directaudio "$here"
|
||||
bl_game_cpus
|
||||
bl_idtech3 "$@"
|
||||
@@ -384,7 +445,8 @@ def adopt_extras(tools):
|
||||
# ${major%%.*} of its own, and putting it through the format would eat both.
|
||||
body = (EXTRA_WRAPPER_SH % entry_point).replace(
|
||||
'here=$(dirname "$0")',
|
||||
'here=$(dirname "$0")\n' + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP + BL_IDTECH3_SETUP, 1)
|
||||
'here=$(dirname "$0")\n' + BL_DIRECTAUDIO_SETUP + BL_GAME_CPUS_SETUP + BL_IDTECH3_SETUP
|
||||
+ BL_PROBE_PREFIX_SETUP + BL_COMPONENTS_SETUP, 1)
|
||||
with open(wrapper, "w", encoding="utf-8") as f:
|
||||
f.write(body)
|
||||
os.chmod(wrapper, 0o755)
|
||||
|
||||
Reference in new issue
Block a user