Compare commits

...
4 changed files with 60 additions and 2 deletions

No files matched your search

+8 -1
View File
@@ -294,7 +294,14 @@ adds `tabtip.exe=d` to `WINEDLLOVERRIDES` unless the launch has `SteamDeck=1`
or the overrides already set `tabtip.exe` (also as `*tabtip.exe` or
`tabtip.exe.dll`): Proton's tabtip only opens Steam's
keyboard with `SteamDeck=1`, but it always runs UI Automation queries inside the
focused game, which crash games that answer them (Godot 4.5 AccessKit). Malformed
focused game, which crash games that answer them (Godot 4.5 AccessKit). A game
launch also sets `PROTON_DISABLE_NVAPI=1` unless the launch already sets
`PROTON_DISABLE_NVAPI`, `PROTON_FORCE_NVAPI` or `DXVK_ENABLE_NVAPI`. Proton turns
NVAPI off itself when `/proc/modules` lists no NVIDIA driver, but Android does
not let it read that file, so NVAPI stayed on and its `nvcuda=b` override loaded
Wine's nvcuda stub, which exports no functions. A game that delay-loads CUDA
then stops with `0xc06d007f` (procedure not found) instead of seeing that there
is no nvcuda.dll, as it would on Windows without an NVIDIA driver. Malformed
configuration falls back to the inherited environment without evaluating its
contents. Both component and environment selection normalize signed non-Steam
prefix IDs to unsigned IDs.
@@ -241,6 +241,13 @@ def keyboard_helper_off(env):
return "tabtip.exe off (it only opens Steam's keyboard with SteamDeck=1, and its UI Automation calls crash games)"
def nvapi_off(env):
if {"PROTON_DISABLE_NVAPI", "PROTON_FORCE_NVAPI", "DXVK_ENABLE_NVAPI"} & env.keys():
return None
env["PROTON_DISABLE_NVAPI"] = "1"
return "NVAPI and nvcuda off (no NVIDIA driver; Proton cannot read /proc/modules to see that)"
def skip_red_launcher(command):
if len(command) > 2 and os.path.basename(command[2]).lower() == "redprelauncher.exe":
game = os.path.join(os.path.dirname(command[2]), "bin", "x64", "Cyberpunk2077.exe")
@@ -1675,6 +1682,9 @@ def main():
note = keyboard_helper_off(env)
if note:
print("droiddeck-game-env: " + note, file=sys.stderr)
note = nvapi_off(env)
if note:
print("droiddeck-game-env: " + note, file=sys.stderr)
else:
path = Path.home() / ".config/droiddeck/game-environment.json"
try:
+2 -1
View File
@@ -1095,7 +1095,8 @@ class LauncherTest(SyncTestCase):
self.assertEqual((calls[0][2]["WINEESYNC"], calls[0][2]["PROTON_NO_ESYNC"], calls[0][2]["DD_SYNC_PACK"]), ("0", "1", pack["id"]))
self.assertEqual(calls[1][2], self.env(STEAM_COMPAT_APP_ID="2630", PROTON_NO_NTSYNC="1", DD_SYNC="0", WINEESYNC="1",
vblank_mode="0", GAMESCOPE_WSI_MIN_IMAGE_COUNT="8",
GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT="1", **expected))
GAMESCOPE_WSI_ENSURE_MIN_IMAGE_COUNT="1", PROTON_DISABLE_NVAPI="1",
**expected))
self.assertEqual(calls[0][2].get("WINEDLLOVERRIDES"), expected.get("WINEDLLOVERRIDES"))
self.assertEqual(calls[0][2].get("SteamDeck"), expected.get("SteamDeck"))
self.assertIn("could not start (", said.getvalue())
+40
View File
@@ -912,6 +912,46 @@ class GameEnvironmentTest(unittest.TestCase):
env=env, text=True, capture_output=True, check=True)
self.assertEqual(result.stdout.strip().splitlines()[-1], expected)
def test_nvapi_is_off_unless_the_user_chose_an_nvapi_setting(self):
cases = (
({}, {"PROTON_DISABLE_NVAPI": "1"}),
({"WINEDLLOVERRIDES": "nvcuda=n,b"}, {"WINEDLLOVERRIDES": "nvcuda=n,b", "PROTON_DISABLE_NVAPI": "1"}),
({"PROTON_DISABLE_NVAPI": "0"}, {"PROTON_DISABLE_NVAPI": "0"}),
({"PROTON_DISABLE_NVAPI": ""}, {"PROTON_DISABLE_NVAPI": ""}),
({"PROTON_FORCE_NVAPI": "1"}, {"PROTON_FORCE_NVAPI": "1"}),
({"DXVK_ENABLE_NVAPI": "1"}, {"DXVK_ENABLE_NVAPI": "1"}),
)
for before, after in cases:
with self.subTest(env=before):
env = dict(before)
note = MODULE["nvapi_off"](env)
self.assertEqual(env, after)
self.assertEqual(note is not None, env != before)
def test_game_launch_turns_nvapi_off_and_keeps_user_choices(self):
with tempfile.TemporaryDirectory() as tmp:
home = Path(tmp)
probe = home / "probe"
probe.write_text("#!" + sys.executable + "\nimport os\nprint(os.environ.get('PROTON_DISABLE_NVAPI', 'unset'), os.environ.get('PROTON_FORCE_NVAPI', 'unset'))\n")
probe.chmod(0o755)
config = home / ".config/droiddeck/game-environment.json"
config.parent.mkdir(parents=True)
cases = (
("waitforexitandrun", {}, "1 unset"),
("waitforexitandrun", {"PROTON_DISABLE_NVAPI": "0"}, "0 unset"),
("waitforexitandrun", {"PROTON_FORCE_NVAPI": "1"}, "unset 1"),
("run", {}, "unset unset"),
)
for verb, profile, expected in cases:
with self.subTest(verb=verb, profile=profile):
config.write_text(json.dumps({"version": 1, "games": {"42": profile}}))
env = {k: v for k, v in os.environ.items()
if k not in ("PROTON_DISABLE_NVAPI", "PROTON_FORCE_NVAPI", "DXVK_ENABLE_NVAPI")}
env.update(HOME=tmp, STEAM_COMPAT_DATA_PATH="/compatdata/42")
result = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"), str(probe), verb],
env=env, text=True, capture_output=True, check=True)
self.assertEqual(result.stdout.strip().splitlines()[-1], expected)
def test_optional_xbox_loader_failure_keeps_stock_launch(self):
from unittest.mock import patch
for error in (FileNotFoundError('missing'), RuntimeError('module initialization failed')):