fix: Game debug logs reach x86-64 Proton games and Share logs keeps them (#3759)

* fix(fex): game debug logs reach games run on the x86-64 Proton

The x86-64 DroidDeck-Proton path runs the game through droiddeck-fex proton,
which applied per-game settings but never the Game debug logs or Detailed
graphics logs, so no Proton log was written for those launches. The proton
action now applies both after the game's settings, as droiddeck-game-env does,
and caps the Proton log size.

* fix(logs): Share logs keeps a session's game logs ahead of Steam client logs

The shared archive packed the Steam client's own logs (several MB each) before
the session's game logs, so the 64 MB budget could run out and drop the Proton
log Game debug logs had just written. Session-critical files go first, then the
session's game logs, then everything else.
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-12-05 13:00:31 -05:00
1 parent c54cadacde
commit caae385924
4 files changed
+87 -4

No files matched your search

@@ -268,7 +268,7 @@ internal object EnhancedSessionLogShare {
val out = outputDirectory.apply { deleteRecursively(); mkdirs() }
val redactionLearningComplete = LogRedactor.learnFromRuntime(LinuxRuntime.rootDir(context))
val discovery = collect(context, folder, limits.maxDiscoveredFiles, legacy = true)
val candidates = discovery.candidates.filter { it.linePrefix == null }
val candidates = discovery.candidates.filter { it.linePrefix == null }.sortedBy(::sharePriority)
if (candidates.isEmpty()) {
out.deleteRecursively()
return null
@@ -745,6 +745,12 @@ internal object EnhancedSessionLogShare {
return CollectionResult(out.values.toList(), truncated, partial)
}
private fun sharePriority(candidate: Candidate): Int = when {
candidate.origin == "session-critical" -> 0
candidate.origin == "session" && candidate.category == Category.GAMES -> 1
else -> 2
}
private fun remaining(maxFiles: Int, found: Int): Int = (maxFiles - found + 1).coerceAtLeast(0)
private fun walk(root: File, limit: Int): ScanResult {
@@ -10,6 +10,7 @@ import java.util.concurrent.TimeUnit
import java.util.zip.ZipFile
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
import org.junit.After
import org.junit.Before
@@ -116,6 +117,33 @@ class SessionLogShareZipTest {
}
}
@Test fun theSessionsGameLogsAreSharedBeforeBulkySteamClientLogsUseTheBudget() {
val session = File(LinuxRuntime.logDir(app), "2026-12-05-08-steam").apply { mkdirs() }
val out = File(app.getExternalFilesDir(null), "agent-logs/budget")
try {
File(session, "session.log").writeText("booted\n")
val steam = File(session, "steam").apply { mkdirs() }
listOf("console_log.txt", "webhelper_js.txt", "cef_log.txt").forEach {
File(steam, it).writeText("client line\n".repeat(600))
}
File(session, "steam-1568590.log").writeText("Proton: x86-64\nerr:module:load\n")
File(session, "games").apply { mkdirs() }.resolve("dxvk.log").writeText("info: DXVK\n")
val limits = EnhancedShareLimits(maxFilesPerArchive = 512, maxBytesPerFile = 8192, maxBytesTotal = 6000)
val zip = EnhancedSessionLogShare.createLegacy(app, session, outputDirectory = out, limits = limits)!!
ZipFile(zip).use { archive ->
assertNotNull(archive.getEntry("${session.name}/session.log"))
val proton = archive.getEntry("${session.name}/steam-1568590.log")!!
assertTrue(archive.getInputStream(proton).bufferedReader().readText().contains("err:module:load"))
assertTrue(archive.entries().toList().any { it.name.startsWith("${session.name}/games/") })
assertTrue(archive.entries().toList().count { it.name.startsWith("${session.name}/steam/") } < 3)
}
} finally {
out.deleteRecursively()
session.deleteRecursively()
}
}
@Test fun everyTextFileInTheZipIsScrubbedAndTheStoresAndToolsLogsComeAlong() {
val logs = LinuxRuntime.logDir(app)
val session = File(logs, "2026-10-08-01-steam").apply { mkdirs() }
@@ -784,7 +784,7 @@ def launch(command, env, mode, decide=None, keep_compat=False):
return os.execve(fex["bin"], [fex["bin"], program] + command[1:], guest)
def game_environment(env, command):
def game_environment(env, command, proton=None):
try:
game_env = runpy.run_path(os.path.join(BIN_DIR, "droiddeck-game-env"))
env = game_env["game_gpu"](env)
@@ -803,7 +803,14 @@ def game_environment(env, command):
config = json.load(source)
except FileNotFoundError:
config = {"version": 1}
return game_env["apply_config"](env, config, str(app), fixes)
env = game_env["apply_config"](env, config, str(app), fixes)
if proton and len(proton) > 2 and proton[1] == "waitforexitandrun":
logged = game_env["apply_game_debug_logs"](env, config)
if logged is not env:
say("game debug logs enabled for this launch")
env = game_env["game_logs"](proton, logged, str(app))
game_env["GAME_DEBUG"]["cap_proton_log"](env)
return env
except FileNotFoundError:
return env
except Exception as error:
@@ -981,7 +988,7 @@ def main(argv):
if action == "proton":
if len(args) < 2:
return 2
return launch(args, game_environment(dict(os.environ), args[2:] or args), "on", keep_compat=True)
return launch(args, game_environment(dict(os.environ), args[2:] or args, args), "on", keep_compat=True)
if action == "run":
try:
mode, decide, command = parse_run(args)
+42
View File
@@ -1374,6 +1374,48 @@ class LaunchTest(FexTestCase):
self.assertEqual(started(unity, "10")[:2], ("1", None))
self.assertEqual(started(other, "10")[:2], (None, None))
def test_x86_64_proton_launches_keep_the_game_debug_and_graphics_logs(self):
config = self.home / ".config/droiddeck/game-environment.json"
session = self.tmp / "session"
session.mkdir()
proton = str(self.tmp / "Proton x86-64/proton")
def started(verb, debug, extra=None):
self.write(config, json.dumps({"version": 1, "gameDebugLogs": debug,
"games": {"976730": {"DXVK_HUD": "fps"}}}))
env = {"SteamAppId": "976730", "SteamGameId": "976730", "DD_DEBUG_DIR": str(session), **(extra or {})}
with mock.patch.dict(G, {"launch": mock.Mock(return_value=0), "GAME_ENVIRONMENT": str(config)}), \
mock.patch.dict(os.environ, env, clear=True), mock.patch("subprocess.Popen") as capped:
_, said = self.quiet(FEX["main"], ["proton", proton, verb, "C:/game/game.exe"])
command, guest, mode = G["launch"].call_args[0]
self.assertEqual((command, mode), ([proton, verb, "C:/game/game.exe"], "on"))
return guest, said, capped
guest, said, capped = started("waitforexitandrun", True)
self.assertEqual((guest["PROTON_LOG"], guest["PROTON_LOG_DIR"]), ("1", str(session)))
self.assertIn("+seh", guest["WINEDEBUG"])
self.assertEqual(guest["DXVK_HUD"], "fps")
self.assertIn("game debug logs enabled for this launch", said)
self.assertIn(str(session / "steam-976730.log"), capped.call_args[0][0])
guest, said, _ = started("waitforexitandrun", False, {"DD_GAME_LOGS": "1"})
folder = Path(guest["PROTON_LOG_DIR"])
self.assertEqual((guest["PROTON_LOG"], folder.parent), ("1", session / "games"))
self.assertTrue(folder.name.endswith("-976730"))
self.assertNotIn("game debug logs enabled", said)
guest, _, capped = started("waitforexitandrun", False)
self.assertNotIn("PROTON_LOG", guest)
self.assertEqual(guest["DXVK_HUD"], "fps")
capped.assert_not_called()
guest, _, capped = started("run", True)
self.assertNotIn("PROTON_LOG", guest)
capped.assert_not_called()
guest, _, _ = started("waitforexitandrun", True, {"PROTON_LOG": "1", "PROTON_LOG_DIR": "/mine"})
self.assertEqual(guest["PROTON_LOG_DIR"], str(session))
class AppInfoTest(unittest.TestCase):
COMPAT = runpy.run_path(str(BIN / "steam-compatibility"))