Merge commit 'e1a7d527fd412b6bd78833e01fe80f515e324971' into merge/main-into-non-adreno-all

# Conflicts:
#	.github/workflows/build.yml
#	app/build.gradle
#	app/src/main/java/com/droiddeck/launcher/core/DeviceReport.kt
#	app/src/main/java/com/droiddeck/launcher/gpu/DriverPairs.kt
#	app/src/main/java/com/droiddeck/launcher/gpu/GpuInfo.kt
#	app/src/main/java/com/droiddeck/launcher/gpu/TurnipDriver.java
#	app/src/main/java/com/droiddeck/launcher/gpu/TurnipReleases.kt
#	app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java
#	app/src/main/java/com/droiddeck/launcher/session/SessionFiles.kt
#	app/src/main/java/com/droiddeck/launcher/session/SessionService.kt
#	app/src/main/res/values/strings.xml
#	app/src/test/java/com/droiddeck/launcher/ui/ComponentsPageProfileTest.kt
#	tools/build_local.sh
#	tools/gamescope/PATCHES.md
#	tools/gamescope/release.env
#	tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env
#	tools/linuxfs/preload/netif.c
#	tools/linuxfs/preload/opens.c
#	tools/release/runtime_inputs.py
This commit is contained in:
Kurt Himebauch committed 2026-10-22 12:22:36 -04:00
commit e7b523d653
574 files changed
+41749 -2616

No files matched your search

+218 -4
View File
@@ -4,6 +4,7 @@ import os
import shutil
from pathlib import Path
import runpy
import shlex
import subprocess
import sys
import tempfile
@@ -173,6 +174,17 @@ class ReadConfigMappingTest(unittest.TestCase):
class GameEnvironmentTest(unittest.TestCase):
def test_optional_xbox_loader_failure_keeps_stock_launch(self):
from unittest.mock import patch
for error in (FileNotFoundError('missing'), RuntimeError('module initialization failed')):
calls = []
with patch.dict(os.environ, {}, clear=True), patch('sys.argv', ['droiddeck-game-env', '/stock', 'run']), \
patch('runpy.run_path', side_effect=error), patch('os.execvpe', side_effect=lambda *args: calls.append(args)), \
patch.dict(MODULE['main'].__globals__, load_sync=lambda: None, select_sync=lambda command, env, sync: (command, env)):
MODULE['main']()
self.assertEqual(calls[0][0:2], ('/stock', ['/stock', 'run']))
def test_directaudio_capture_follows_the_session_microphone_setting(self):
with tempfile.TemporaryDirectory() as tmp:
home = Path(tmp)
@@ -213,6 +225,73 @@ class GameEnvironmentTest(unittest.TestCase):
self.assertEqual(calls[0][0][1], str(root))
self.assertEqual(calls[0][1]["DROIDDECK_SEED_SCRIPTS"], str(script))
SCRIPT = ('"evaluatorscript" { "0" { "appid" "228980" "compat_installscript" { "run process" { '
'"x64 14.28.29334.0" { "hasrunkey" "HKEY_LOCAL_MACHINE\\\\Software\\\\Valve\\\\Steam\\\\Apps\\\\CommonRedist\\\\vcredist\\\\2019" '
'"process 1" "%INSTALLDIR%\\\\x64.cmd" "requirement_os" { "Is64BitWindows" "1" } } '
'"Setup" { "process 1" "%INSTALLDIR%\\\\setup.exe" } } } } }')
REDIST = "[Software\\\\Wow6432Node\\\\Valve\\\\Steam\\\\Apps\\\\CommonRedist\\\\vcredist\\\\2019] 1\n\"x64 14.28.29334.0\"=dword:00000001\n"
SETUP = "[Software\\\\Valve\\\\Steam\\\\Apps\\\\228980] 1\n\"Setup\"=dword:00000001\n"
def test_install_script_run_keys_default_to_the_app_key(self):
keys = MODULE["run_keys"](MODULE["read_vdf"](self.SCRIPT))
self.assertEqual(keys, {
("hkey_local_machine\\software\\valve\\steam\\apps\\commonredist\\vcredist\\2019", "x64 14.28.29334.0"),
("hkey_local_machine\\software\\valve\\steam\\apps\\228980", "setup"),
})
with self.assertRaises(ValueError):
MODULE["read_vdf"]('"a" { "b" }')
def test_install_scripts_count_as_done_only_when_recorded_and_still_marked(self):
with tempfile.TemporaryDirectory() as tmp:
script = Path(tmp) / "evaluatorscript_1.vdf"
script.write_text(self.SCRIPT)
prefix = Path(tmp) / "compat/pfx"
env = {"STEAM_COMPAT_DATA_PATH": str(prefix.parent)}
done = MODULE["install_scripts_done"]
self.assertFalse(done([str(script)], env))
prefix.mkdir(parents=True)
MODULE["record_install_scripts"](MODULE["scripts_digest"]([str(script)]), env)
self.assertFalse(done([str(script)], env))
(prefix / "system.reg").write_text(self.REDIST)
self.assertFalse(done([str(script)], env))
(prefix / "system.reg").write_text(self.REDIST + self.SETUP)
self.assertTrue(done([str(script)], env))
script.write_text(self.SCRIPT.replace("x64.cmd", "x64-update.cmd"))
self.assertFalse(done([str(script)], env))
script.write_text('"InstallScript" { "Registry" { "HKEY_LOCAL_MACHINE\\\\Software\\\\Game" { "string" { "Path" "%INSTALLDIR%" } } } }')
MODULE["record_install_scripts"](MODULE["scripts_digest"]([str(script)]), env)
self.assertFalse(done([str(script)], env))
def test_the_evaluator_is_skipped_once_it_finished_the_same_scripts(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
(root / "legacycompat").mkdir()
evaluator = root / "legacycompat/iscriptevaluator.exe"
evaluator.write_bytes(b"evaluator")
script = root / "legacycompat/evaluatorscript_1.vdf"
prefix = root / "compatdata/1/pfx"
prefix.mkdir(parents=True)
(prefix / "system.reg").write_text(self.REDIST + self.SETUP)
runs = root / "runs"
proton = root / "proton"
proton.write_text("#!/bin/sh\necho run >> %s\nexit ${EXIT_CODE:-0}\n" % shlex.quote(str(runs)))
proton.chmod(0o755)
def evaluate(exit_code="0"):
script.write_text(self.SCRIPT if exit_code != "changed" else self.SCRIPT.replace("setup.exe", "setup-update.exe"))
env = dict(os.environ, HOME=tmp, STEAM_COMPAT_CLIENT_INSTALL_PATH=str(root),
STEAM_COMPAT_DATA_PATH=str(prefix.parent), EXIT_CODE="0" if exit_code == "changed" else exit_code)
result = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"), str(proton), "run",
str(evaluator), "legacycompat\\evaluatorscript_1.vdf"],
env=env, text=True, capture_output=True)
return result.returncode, len(runs.read_text().splitlines()) if runs.exists() else 0
self.assertEqual(evaluate("3"), (3, 1))
self.assertFalse((prefix / ".droiddeck-install-scripts").exists())
self.assertEqual(evaluate(), (0, 2))
self.assertEqual(evaluate(), (0, 2))
self.assertEqual(evaluate("changed"), (0, 3))
def test_profile_precedence_and_unset(self):
env = {"KEEP": "inherited", "REMOVE": "inherited", "CUSTOM": "launch option"}
config = {"version": 1, "shared": {"CUSTOM": "shared"}, "games": {"42": {"REMOVE": None, "CUSTOM": "game", "EMPTY": ""}}}
@@ -220,6 +299,17 @@ class GameEnvironmentTest(unittest.TestCase):
self.assertEqual(env["REMOVE"], "inherited")
self.assertEqual(MODULE["apply_config"](env, config, "43")["CUSTOM"], "shared")
def test_games_get_their_own_turnip_debug_and_a_game_profile_still_wins(self):
gpu = MODULE["game_gpu"]
self.assertEqual(gpu({"TU_DEBUG": "sysmem", "DROIDDECK_GAME_TU_DEBUG": "", "KEEP": "1"}), {"KEEP": "1"})
self.assertEqual(gpu({"TU_DEBUG": "sysmem", "DROIDDECK_GAME_TU_DEBUG": "sysmem"}), {"TU_DEBUG": "sysmem"})
self.assertEqual(gpu({"DROIDDECK_GAME_TU_DEBUG": "nolrz"}), {"TU_DEBUG": "nolrz"})
self.assertEqual(gpu({"TU_DEBUG": "sysmem"}), {"TU_DEBUG": "sysmem"})
config = {"version": 1, "games": {"42": {"TU_DEBUG": "sysmem"}}}
env = gpu({"TU_DEBUG": "sysmem", "DROIDDECK_GAME_TU_DEBUG": ""})
self.assertEqual(MODULE["apply_config"](env, config, "42")["TU_DEBUG"], "sysmem")
self.assertNotIn("TU_DEBUG", MODULE["apply_config"](env, config, "43"))
def test_a_games_wine_sync_choice_also_reaches_its_setup_runs(self):
env = {"BL_SYNC": "1", "BL_SYNC_FALLBACK": "1", "BL_FSYNC_FIRST": "0", "OTHER": "kept"}
config = {"version": 1, "games": {"42": {"BL_SYNC": "0", "BL_FSYNC_FIRST": "1", "PROTON_NO_ESYNC": "1", "FEX_TSOENABLED": "1"}}}
@@ -358,6 +448,75 @@ class GameEnvironmentTest(unittest.TestCase):
(other / "Other.exe").touch()
self.assertEqual(MODULE["engine_fixes"](str(other / "Other.exe"), []), ({}, [], []))
def test_easy_anti_cheat_games_start_offline_only_when_opted_in(self):
with tempfile.TemporaryDirectory() as tmp:
game = Path(tmp) / "ELDEN RING/Game"
(game / "EasyAntiCheat").mkdir(parents=True)
for name in ("start_protected_game.exe", "eldenring.exe"):
(game / name).touch()
(game / "EasyAntiCheat/settings.json").write_text('\ufeff{ "executable" : "eldenring.exe" }', encoding="utf-8")
command = ["proton", "waitforexitandrun", str(game / "start_protected_game.exe"), "-arg"]
offline = MODULE["offline_without_anticheat"]
self.assertEqual(offline(command, {}), command)
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "0"}), command)
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}),
["proton", "waitforexitandrun", str(game / "eldenring.exe"), "-arg"])
(game / "EasyAntiCheat/settings.json").write_text('{ "executable" : "../../escape.exe" }')
(Path(tmp) / "escape.exe").touch()
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}), command)
(game / "EasyAntiCheat/settings.json").write_text('{ "executable" : "missing.exe" }')
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}), command)
(game / "EasyAntiCheat/settings.json").write_text('{ "executable" : "link/escape.exe" }')
outside = Path(tmp) / "outside"
outside.mkdir()
(outside / "escape.exe").touch()
(game / "link").symlink_to(outside, target_is_directory=True)
self.assertEqual(offline(command, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}), command)
(game / "EasyAntiCheat/settings.json").write_text('{ "executable" : "eldenring.exe" }')
plain = ["proton", "waitforexitandrun", str(game / "eldenring.exe")]
self.assertEqual(offline(plain, {"DROIDDECK_ANTICHEAT_OFFLINE": "1"}), plain)
self.assertEqual(offline(["proton", "run", command[2]],
{"DROIDDECK_ANTICHEAT_OFFLINE": "1"}),
["proton", "run", command[2]])
def test_easy_anti_cheat_forwarding_through_entrypoint(self):
with tempfile.TemporaryDirectory() as tmp:
home = Path(tmp)
game = home / "ELDEN RING/Game"
(game / "EasyAntiCheat").mkdir(parents=True)
bootstrapper = game / "start_protected_game.exe"
target = game / "eldenring.exe"
bootstrapper.touch()
target.touch()
(game / "EasyAntiCheat/settings.json").write_text(json.dumps({"executable": "eldenring.exe"}))
proton = home / "fake-proton"
proton.write_text("#!" + sys.executable + "\nimport json, sys\nprint(json.dumps(sys.argv[1:]))\n")
proton.chmod(0o755)
config = home / ".config/droiddeck/game-environment.json"
config.parent.mkdir(parents=True)
env = dict(os.environ, HOME=tmp, STEAM_COMPAT_DATA_PATH="/compatdata/42")
env.pop("DROIDDECK_ANTICHEAT_OFFLINE", None)
for setting, expected in (("1", target), ("0", bootstrapper), (None, bootstrapper)):
with self.subTest(setting=setting):
values = {} if setting is None else {"DROIDDECK_ANTICHEAT_OFFLINE": setting}
config.write_text(json.dumps({"version": 1, "games": {"42": values}}))
result = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"),
str(proton), "waitforexitandrun", str(bootstrapper), "-arg"],
env=env, text=True, capture_output=True, check=True)
self.assertEqual(json.loads(result.stdout.strip()),
["waitforexitandrun", str(expected), "-arg"])
def test_deep_rock_gdk_avoids_the_raytracing_pipeline_crash(self):
game = "/game/FSD/Binaries/WinGDK/FSD-WinGDK-Shipping.exe"
env, extra, notes = MODULE["engine_fixes"](game, [])
self.assertEqual(extra, ["-noraytracing", "-ini:Engine:[/Script/Engine.RendererSettings]:r.RayTracing=False"])
self.assertEqual(env, {})
self.assertTrue(notes)
for choice in ("-raytracing", "-noraytracing"):
self.assertEqual(MODULE["engine_fixes"](game, [choice]), ({}, [], []))
self.assertEqual(MODULE["engine_fixes"]("/game/FSD-Win64-Shipping.exe", []), ({}, [], []))
self.assertEqual(MODULE["engine_fixes"]("/game/Other-WinGDK-Shipping.exe", []), ({}, [], []))
def test_arkham_city_gets_full_x87_precision_over_the_preset(self):
with tempfile.TemporaryDirectory() as tmp:
city = Path(tmp) / "Batman Arkham City GOTY/Binaries/Win32"
@@ -647,6 +806,8 @@ class GameEnvironmentTest(unittest.TestCase):
self.assertEqual(changes, {"42": COMPAT["TOOL"]})
def test_both_proton_wrappers_call_environment_launcher(self):
self.assertIn('bl_directaudio "$depot" "$@"', COMPAT["LAUNCHER_SH"])
self.assertIn('bl_directaudio "$here" "$@"', COMPAT["EXTRA_WRAPPER_SH"] % "proton")
for script in (COMPAT["LAUNCHER_SH"], COMPAT["EXTRA_WRAPPER_SH"] % "proton"):
subprocess.run(["bash", "-n"], input=script, text=True, check=True)
self.assertIn('bl_run ${BL_TASKSET:-} /usr/local/bin/droiddeck-game-env', script)
@@ -1062,12 +1223,15 @@ class DirectAudioPrefixTest(unittest.TestCase):
(self.windows / folder).mkdir(parents=True)
self.reg = self.compat / "pfx/user.reg"
def run_setup(self):
script = COMPAT["BL_DIRECTAUDIO_SETUP"] + '\nbl_directaudio "$1"\necho "WINEDLLPATH=$WINEDLLPATH"\necho "WINE_AUDIO_DRIVER=${WINE_AUDIO_DRIVER:-}"\n'
env = dict(os.environ, BL_DIRECTAUDIO=str(self.sets), STEAM_COMPAT_DATA_PATH=str(self.compat))
def run_setup(self, verb="waitforexitandrun", target="game.exe", cwd=None):
script = COMPAT["BL_DIRECTAUDIO_SETUP"] + '\nverb=$2\nbl_directaudio "$1" "$3"\necho "WINEDLLPATH=$WINEDLLPATH"\necho "WINE_AUDIO_DRIVER=${WINE_AUDIO_DRIVER:-}"\n'
steam = self.compat.parent / "Steam"
env = dict(os.environ, BL_DIRECTAUDIO=str(self.sets), STEAM_COMPAT_DATA_PATH=str(self.compat),
STEAM_COMPAT_CLIENT_INSTALL_PATH=str(steam))
env.pop("WINEDLLPATH", None)
env.pop("WINE_AUDIO_DRIVER", None)
return subprocess.run(["bash", "-c", script, "bash", str(self.tool)], env=env, capture_output=True, text=True, check=True)
return subprocess.run(["bash", "-c", script, "bash", str(self.tool), verb, target], cwd=cwd, env=env,
capture_output=True, text=True, check=True)
def audio_values(self):
found, current = [], None
@@ -1082,6 +1246,56 @@ class DirectAudioPrefixTest(unittest.TestCase):
path = self.windows / folder / "winedirectaudio.drv"
return os.readlink(path) if path.is_symlink() else None
def test_steam_installscript_evaluator_does_not_change_prefix_audio(self):
legacycompat = self.compat.parent / "Steam/legacycompat"
legacycompat.mkdir(parents=True)
(legacycompat / "iscriptevaluator.exe").write_bytes(b"Steam install-script evaluator")
self.reg.write_text("WINE REGISTRY Version 2\n\n#arch=win64\n")
result = self.run_setup(target="iscriptevaluator.exe", cwd=legacycompat)
self.assertIn("DirectAudio skipped for Steam's install-script evaluator", result.stderr)
self.assertIn("WINEDLLPATH=\n", result.stdout)
self.assertIn("WINE_AUDIO_DRIVER=\n", result.stdout)
self.assertEqual(self.reg.read_text(), "WINE REGISTRY Version 2\n\n#arch=win64\n")
self.assertIsNone(self.link("system32"))
self.assertIsNone(self.link("syswow64"))
def test_same_basename_outside_steam_legacycompat_keeps_normal_setup(self):
legacycompat = self.compat.parent / "Steam/legacycompat"
legacycompat.mkdir(parents=True)
(legacycompat / "iscriptevaluator.exe").write_bytes(b"Steam install-script evaluator")
other = self.compat.parent / "other"
other.mkdir()
(other / "iscriptevaluator.exe").write_bytes(b"unrelated executable")
self.reg.write_text("WINE REGISTRY Version 2\n\n#arch=win64\n")
result = self.run_setup(target="iscriptevaluator.exe", cwd=other)
self.assertIn("DirectAudio selected", result.stderr)
self.assertEqual(self.link("system32"), str(self.audio / "lib/wine/aarch64-windows/winedirectaudio.drv"))
self.assertEqual(self.audio_values(), [("[Software\\\\Wine\\\\Drivers]", '"Audio"="directaudio,pulse"')])
def test_non_launch_verbs_preserve_audio_configuration(self):
for verb in ("getcompatpath", "getnativepath", "destroyprefix"):
with self.subTest(verb=verb):
self.reg.write_text('WINE REGISTRY Version 2\n\n[Software\\\\Wine\\\\Drivers] 1\n"Audio"="pulse"\n')
before = self.reg.read_bytes()
result = self.run_setup(verb)
self.assertEqual(self.reg.read_bytes(), before)
self.assertIsNone(self.link("system32"))
self.assertIsNone(self.link("syswow64"))
self.assertIn("WINEDLLPATH=\n", result.stdout)
self.assertIn("WINE_AUDIO_DRIVER=\n", result.stdout)
def test_other_windows_launch_verbs_still_set_up_audio(self):
self.reg.write_text("WINE REGISTRY Version 2\n")
for verb in ("run", "runinprefix"):
with self.subTest(verb=verb):
result = self.run_setup(verb)
self.assertIn("DirectAudio ready", result.stderr)
self.assertIn("WINE_AUDIO_DRIVER=directaudio,pulse\n", result.stdout)
self.assertEqual(self.link("system32"), str(self.audio / "lib/wine/aarch64-windows/winedirectaudio.drv"))
def test_the_driver_is_placed_and_selected_the_way_wine_reads_it(self):
self.reg.write_text("WINE REGISTRY Version 2\n;; All keys relative to \\\\User\\\\S-1-5-21-0-0-0-1000\n\n#arch=win64\n")
result = self.run_setup()