From 4af2071c47edfd651867b2612baccfbcafd974e5 Mon Sep 17 00:00:00 2001 From: maxjivi05 Date: Sat, 5 Dec 2026 13:04:45 -0500 Subject: [PATCH] fix: Share logs includes Easy Anti-Cheat launcher logs from game prefixes Anti-cheat launch failures only show the real error code in anticheatlauncher.log inside the game's compatdata prefix, which Share logs never collected. Recent .log files under each prefix's EasyAntiCheat folder are now added under anticheat// with high share priority. --- .../session/EnhancedSessionLogShare.kt | 36 ++++++++++++------- .../session/SessionLogShareZipTest.kt | 27 ++++++++++++++ 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/session/EnhancedSessionLogShare.kt b/app/src/main/java/com/droiddeck/launcher/session/EnhancedSessionLogShare.kt index 566f2bf20f..cbf3d11c2d 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/EnhancedSessionLogShare.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/EnhancedSessionLogShare.kt @@ -5,6 +5,7 @@ import android.os.ParcelFileDescriptor import android.system.Os import android.system.OsConstants import com.droiddeck.launcher.core.LogRedactor +import com.droiddeck.launcher.frontend.Library import com.droiddeck.launcher.runtime.BattleNet import com.droiddeck.launcher.runtime.LinuxRuntime import org.json.JSONArray @@ -680,6 +681,15 @@ internal object EnhancedSessionLogShare { categoryCounts[category] = (categoryCounts[category] ?: 0) + 1 } } + fun addRecentLogs(root: File, entryPrefix: String, origin: String) { + val scan = walk(root, remaining(maxFiles, out.size)) + truncated = truncated || scan.truncated + partial = partial || scan.partial + val base = root.toPath().toAbsolutePath().normalize() + scan.files.asSequence().filter { recent(it) && it.name.endsWith(".log", true) }.forEach { file -> + add(file, root, "$entryPrefix/${base.relativize(file.toPath().toAbsolutePath().normalize()).joinToString("/")}", origin) + } + } CRITICAL_SESSION_FILES.forEach { name -> File(folder, name).takeIf { it.exists() }?.let { add(it, folder, "${folder.name}/$name", "session-critical") } } @@ -713,17 +723,9 @@ internal object EnhancedSessionLogShare { add(source.file, source.root, source.entry, "battlenet") } } else { - battleNetRoots(context).forEach { (prefix, root) -> - val scan = walk(root, remaining(maxFiles, out.size)) - truncated = truncated || scan.truncated - partial = partial || scan.partial - scan.files.asSequence().filter { recent(it) && it.name.endsWith(".log", true) } - .forEach { file -> - val relative = root.toPath().toAbsolutePath().normalize().relativize(file.toPath().toAbsolutePath().normalize()).joinToString("/") - add(file, root, "battlenet/$prefix/$relative", "battlenet") - } - } + battleNetRoots(context).forEach { (prefix, root) -> addRecentLogs(root, "battlenet/$prefix", "battlenet") } } + antiCheatRoots(context).forEach { (appId, root) -> addRecentLogs(root, "anticheat/$appId", "anticheat") } val sessionScan = walk(folder, remaining(maxFiles, out.size)) truncated = truncated || sessionScan.truncated partial = partial || sessionScan.partial @@ -748,6 +750,7 @@ internal object EnhancedSessionLogShare { private fun sharePriority(candidate: Candidate): Int = when { candidate.origin == "session-critical" -> 0 candidate.origin == "session" && candidate.category == Category.GAMES -> 1 + candidate.origin == "anticheat" -> 1 else -> 2 } @@ -822,6 +825,13 @@ internal object EnhancedSessionLogShare { return ScanResult(files, truncated, partial) } + private fun antiCheatRoots(context: Context): List> = + runCatching { Library.compatdataDirs(context) }.getOrDefault(emptyList()).flatMap { compatdata -> + compatdata.listFiles().orEmpty().filter { !Files.isSymbolicLink(it.toPath()) }.mapNotNull { prefix -> + File(prefix, EAC_LOG_DIR).takeIf { it.isDirectory }?.let { prefix.name to it } + } + } + private fun battleNetRoots(context: Context): List> { val drive = File(BattleNet.prefix(context), "pfx/drive_c") val data = File(drive, "ProgramData/Battle.net") @@ -941,7 +951,7 @@ internal object EnhancedSessionLogShare { private fun category(entry: String): Category { val value = entry.lowercase(Locale.US) - if (value.startsWith("battlenet/") || value.startsWith("stores/") || value.startsWith("tools/") || value.startsWith("rpcs3/") || + if (value.startsWith("battlenet/") || value.startsWith("anticheat/") || value.startsWith("stores/") || value.startsWith("tools/") || value.startsWith("rpcs3/") || value.contains("droiddeck-esync/") || GAME_LOG.matches(value.substringAfterLast('/')) || listOf("proton", "wine", "dxvk", "vkd3d", "battle.net", "game-debug", "bionic").any(value::contains)) return Category.GAMES if (listOf("wayland", "gamescope", "xwayland", "vulkan", "gpu", "mesa", "egl", "glx", "drm", "compositor", "frame-trace").any(value::contains)) return Category.GRAPHICS @@ -950,7 +960,7 @@ internal object EnhancedSessionLogShare { private val GAME_LOG = Regex("steam-[0-9]+\\.(log|txt)") private val KNOWN_COMPONENTS = setOf( - "steam", "graphics", "games", "battlenet", "client", "agent", "setup", "stores", "tools", + "steam", "graphics", "games", "battlenet", "anticheat", "anticheatlauncher.log", "client", "agent", "setup", "stores", "tools", "droiddeck", "droiddeck-esync", "session.log", "app.log", "wayland.log", "audio.log", "device.txt", "network.txt", "events.jsonl", "memory.csv", "capture.json", "crash.log", "frame-trace.log", "process-trace.log", "game-lifecycle.log", "launches.log", "tools.tsv", "wanted.tsv", "prefixes.json", @@ -964,6 +974,7 @@ internal object EnhancedSessionLogShare { Regex("(?:battle\\.net-[0-9]+|battle\\.net-setup-[0-9]+|Agent-[0-9]+)\\.log"), Regex("(?:Agent\\.[0-9]+|bna_[0-9]+)"), Regex("stores-[0-9]{4}-[0-9]{2}-[0-9]{2}\\.log"), + Regex("[0-9]{1,10}"), Regex("entry-[0-9a-f]{16}(?:\\.[a-z0-9]{1,8})?"), ) private val SAFE_SUFFIX = Regex("\\.[A-Za-z0-9]{1,8}$") @@ -973,6 +984,7 @@ internal object EnhancedSessionLogShare { ) private const val RECENT_MILLIS = 7L * 24 * 60 * 60 * 1000 private const val STORE_LOG_SCAN = 512 + private const val EAC_LOG_DIR = "pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat" private const val COPY_BUFFER_BYTES = 64 * 1024 private const val TRACE_SCAN_BYTES = 16L * 1024 * 1024 private const val LEGACY_LOG_MAX_BYTES = 8L * 1024 * 1024 diff --git a/app/src/test/java/com/droiddeck/launcher/session/SessionLogShareZipTest.kt b/app/src/test/java/com/droiddeck/launcher/session/SessionLogShareZipTest.kt index 94537df59b..fb133dfded 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/SessionLogShareZipTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/SessionLogShareZipTest.kt @@ -144,6 +144,33 @@ class SessionLogShareZipTest { } } + @Test fun theEasyAntiCheatLauncherLogsFromGamePrefixesComeAlong() { + val session = File(LinuxRuntime.logDir(app), "2026-12-05-09-steam").apply { mkdirs() } + val out = File(app.getExternalFilesDir(null), "agent-logs/anticheat") + val prefix = File(SessionPrefs.steamRoot(app, SessionPrefs.activeSteamClientArch(app)), "steamapps/compatdata/976730") + try { + File(session, "session.log").writeText("booted\n") + val eac = File(prefix, "pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/b1d0a8c3").apply { mkdirs() } + File(eac, "anticheatlauncher.log").writeText("[Error] Launch Error: 261\n") + File(eac, "old.log").apply { + writeText("stale\n") + setLastModified(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30)) + } + + val zip = EnhancedSessionLogShare.createLegacy(app, session, outputDirectory = out)!! + ZipFile(zip).use { archive -> + val logs = archive.entries().toList().filter { it.name.startsWith("anticheat/976730/") } + assertEquals(1, logs.size) + assertTrue(logs.single().name.endsWith("/anticheatlauncher.log")) + assertTrue(archive.getInputStream(logs.single()).bufferedReader().readText().contains("Launch Error: 261")) + } + } finally { + out.deleteRecursively() + session.deleteRecursively() + prefix.deleteRecursively() + } + } + @Test fun everyTextFileInTheZipIsScrubbedAndTheStoresAndToolsLogsComeAlong() { val logs = LinuxRuntime.logDir(app) val session = File(logs, "2026-10-08-01-steam").apply { mkdirs() }