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 cbf3d11c2d..8ab96513db 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/EnhancedSessionLogShare.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/EnhancedSessionLogShare.kt @@ -826,9 +826,9 @@ internal object EnhancedSessionLogShare { } 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 } + runCatching { Library.compatdataDirs(context) }.getOrDefault(emptyList()).flatMapIndexed { library, compatdata -> + compatdata.listFiles().orEmpty().filter { !Files.isSymbolicLink(it.toPath()) && APP_ID.matches(it.name) }.mapNotNull { prefix -> + File(prefix, EAC_LOG_DIR).takeIf { it.isDirectory }?.let { (if (library == 0) prefix.name else "${prefix.name}/library${library + 1}") to it } } } @@ -938,7 +938,9 @@ internal object EnhancedSessionLogShare { val normalized = name.replace('\\', '/').trimStart('/') val parts = normalized.split('/') if (normalized.isEmpty() || parts.any { it.isEmpty() || it == "." || it == ".." }) return null - return parts.joinToString("/") { safeComponent(it) } + return parts.mapIndexed { index, part -> + if (index == 1 && parts[0] == "anticheat" && APP_ID.matches(part)) part else safeComponent(part) + }.joinToString("/") } private fun safeComponent(value: String): String { @@ -974,9 +976,10 @@ 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("library[0-9]{1,3}"), Regex("entry-[0-9a-f]{16}(?:\\.[a-z0-9]{1,8})?"), ) + private val APP_ID = Regex("[0-9]{1,10}") private val SAFE_SUFFIX = Regex("\\.[A-Za-z0-9]{1,8}$") private val CRITICAL_SESSION_FILES = listOf( "session.log", "app.log", "wayland.log", "audio.log", "device.txt", "network.txt", 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 fb133dfded..94a965cc6f 100644 --- a/app/src/test/java/com/droiddeck/launcher/session/SessionLogShareZipTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/session/SessionLogShareZipTest.kt @@ -145,29 +145,38 @@ class SessionLogShareZipTest { } @Test fun theEasyAntiCheatLauncherLogsFromGamePrefixesComeAlong() { + SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "") 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") + val second = File(app.getExternalFilesDir(null), "second-library-${UUID.randomUUID()}").apply { mkdirs() } + val library = SteamLibraries.add(app, second.path) as SteamLibraries.AddResult.Added try { File(session, "session.log").writeText("booted\n") - val eac = File(prefix, "pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/b1d0a8c3").apply { mkdirs() } + val eac = File(prefix, "pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/4815162342").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 secondEac = File(second, "steamapps/compatdata/976730/pfx/drive_c/users/steamuser/AppData/Roaming/EasyAntiCheat/b1d0a8c3").apply { mkdirs() } + File(secondEac, "anticheatlauncher.log").writeText("[Error] Launch Error: 206\n") 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")) + assertEquals(2, logs.size) + assertTrue(logs.all { it.name.endsWith("/anticheatlauncher.log") && !it.name.contains("4815162342") }) + val texts = logs.map { archive.getInputStream(it).bufferedReader().readText() } + assertTrue(texts.any { it.contains("Launch Error: 261") }) + assertTrue(texts.any { it.contains("Launch Error: 206") }) } } finally { + SteamLibraries.remove(app, library.entry.id) out.deleteRecursively() session.deleteRecursively() prefix.deleteRecursively() + second.deleteRecursively() } }