fix(game-env): non-Adreno graphics logs no longer turn on Wine debug tracing (#2730)

* fix(game-env): non-Adreno graphics logs no longer turn on Wine debug tracing

* test(game-env): graphics-log tests use the session's DD_ variable names

---------

Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
Co-authored-by: maxjivi05 <maxjividen@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-11-25 11:26:24 -05:00
1 parent d38fd373f0
commit a8df9a7ae1
2 files changed
+52 -1

No files matched your search

@@ -1530,9 +1530,13 @@ def game_logs(command, env, app_id, now=None):
except OSError as error:
print("droiddeck-game-env: no game log folder (%s)" % error, file=sys.stderr)
return env
proton_log = env.get("PROTON_LOG", "")
asked = proton_log not in ("", "0")
result = dict(env)
if not asked:
result.setdefault("WINEDEBUG", "-all,err+all")
result.update({
"PROTON_LOG": "1",
"PROTON_LOG": proton_log if asked else "1",
"PROTON_LOG_DIR": str(folder),
"DXVK_LOG_PATH": str(folder),
"DXVK_LOG_LEVEL": env.get("DXVK_LOG_LEVEL", "info"),
+47
View File
@@ -2199,6 +2199,53 @@ class GameEnvironmentTest(unittest.TestCase):
named = game_logs(command, on, None, now=0)
self.assertTrue(Path(named["PROTON_LOG_DIR"]).name.endswith("-Hades"))
def test_graphics_logs_trace_wine_only_when_asked(self):
game_logs = MODULE["game_logs"]
command = ["/proton", "waitforexitandrun", "/games/Hades/Hades.exe"]
with tempfile.TemporaryDirectory() as tmp, mock.patch("subprocess.Popen"):
on = {"DD_GAME_LOGS": "1", "DD_DEBUG_DIR": tmp}
for given in ({}, {"PROTON_LOG": "0"}, {"PROTON_LOG": ""}):
with self.subTest(given=given):
result = game_logs(command, {**on, **given}, "42", now=0)
self.assertEqual(result["PROTON_LOG"], "1")
self.assertEqual(result["WINEDEBUG"], "-all,err+all")
own = game_logs(command, {**on, "WINEDEBUG": "+relay"}, "42", now=0)
self.assertEqual(own["WINEDEBUG"], "+relay")
for value in ("1", "+relay"):
with self.subTest(proton_log=value):
user = game_logs(command, {**on, "PROTON_LOG": value}, "42", now=0)
self.assertEqual(user["PROTON_LOG"], value)
self.assertNotIn("WINEDEBUG", user)
config = {"version": 1, "gameDebugLogs": True}
debug = game_logs(command, MODULE["apply_game_debug_logs"](on, config, tmp), "42", now=0)
self.assertEqual(debug["PROTON_LOG"], "1")
self.assertEqual(debug["WINEDEBUG"], MODULE["game_debug_channels"]())
def test_game_debug_switch_controls_wine_traces_with_graphics_logs_on(self):
with tempfile.TemporaryDirectory() as tmp:
home = Path(tmp)
config_path = home / ".config/droiddeck/game-environment.json"
config_path.parent.mkdir(parents=True)
probe = home / "proton"
probe.write_text("#!" + sys.executable + "\nimport json, os\n"
"print(json.dumps({k: os.environ.get(k) for k in ('PROTON_LOG', 'WINEDEBUG')}))\n")
probe.chmod(0o755)
env = {**os.environ, "HOME": tmp, "STEAM_COMPAT_DATA_PATH": str(home / "compatdata/599140"),
"DD_DEBUG_DIR": tmp, "DD_GAME_LOGS": "1"}
for name in ("PROTON_LOG", "WINEDEBUG"):
env.pop(name, None)
for enabled in (True, False, True):
with self.subTest(enabled=enabled):
config_path.write_text(json.dumps({"version": 1, "gameDebugLogs": enabled}))
result = json.loads(subprocess.run(
[sys.executable, str(BIN / "droiddeck-game-env"), str(probe), "waitforexitandrun", "game.exe"],
env=env, text=True, capture_output=True, check=True).stdout)
self.assertEqual(result["PROTON_LOG"], "1")
if enabled:
self.assertIn("+seh", result["WINEDEBUG"].split(","))
else:
self.assertEqual(result["WINEDEBUG"], "-all,err+all")
def test_rapid_game_launches_keep_separate_diagnostics(self):
with tempfile.TemporaryDirectory() as tmp, mock.patch("subprocess.Popen"):
env = {"DD_GAME_LOGS": "1", "DD_DEBUG_DIR": tmp}