mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
Keep the second library and Games folders visible to the fast path
The fast path only kept the first 64 binds and silently dropped the rest. A second library adds about 36 binds: the library itself and private overrides for compatdata, shadercache and each Proton, runtime and FEX depot, under both /mnt/droiddeck-sd and the legacy /mnt/bannerlator-sd. With one chosen, a session has 96 binds. Everything past the 64th was then mapped into the rootfs instead: - the Games folders, bound last, showed their names but every stat and open failed, so owned games never matched. Their source stamps were null, the watcher restarted Steam every session to import them, and they stayed non-Steam shortcuts. - most of the library's private Proton, runtime and downloading overrides were dropped. Opens and stats there reached the shared folder while proot's own calls reached the private copy. The library now holds 256 binds of up to 1023 bytes per side. A view that does not fit turns the fast path off instead of answering with a partial table. The launcher checks the same limits before it hands the binds over. If they do not fit, the session runs on proot alone and the log says so. Checked on device (SM8850, Android 16) with a second library and a Games folder, in Deck mode and with Deck mode off: - all 96 binds are active and the Games folder's files stat correctly with the fast path on - both owned games route to their Steam entries; no shortcuts are left and Steam is not restarted again - the library stays registered in libraryfolders.vdf
This commit is contained in:
1 parent
26cb9e2f03
commit
5c6765233a
4 files changed
+70
-30
No files matched your search
@@ -21,6 +21,8 @@ import java.security.MessageDigest
|
||||
*/
|
||||
object ProotFastPath {
|
||||
const val LIBRARY = "/usr/local/lib/libblfastpath.so"
|
||||
const val MAX_BINDS = 256
|
||||
const val MAX_BIND_PATH = 1023
|
||||
|
||||
fun enabled(context: Context): Boolean =
|
||||
SessionPrefs.prootFastPath(context) && !SessionPrefs.prootNoSeccomp(context)
|
||||
@@ -28,6 +30,7 @@ object ProotFastPath {
|
||||
/** The key for this rootfs and these binds, or null when the library cannot be told them. */
|
||||
fun key(root: File, binds: List<String>): String? {
|
||||
if (binds.any { it.contains('|') } || root.path.contains('|')) return null
|
||||
if (binds.size > MAX_BINDS || binds.any { spec -> spec.split(':', limit = 2).any { it.length > MAX_BIND_PATH } }) return null
|
||||
val digest = MessageDigest.getInstance("SHA-256")
|
||||
.digest((root.path + "\n" + binds.joinToString("\n")).toByteArray())
|
||||
return digest.take(12).joinToString("") { "%02x".format(it) }
|
||||
|
||||
@@ -402,7 +402,7 @@ class SessionService : Service() {
|
||||
guest.addAll(fastPathAt, env)
|
||||
shellGuest.addAll(fastPathAt, env)
|
||||
Log.i(TAG, "proot: fast path on (${prootBinds.size} binds)")
|
||||
}
|
||||
} ?: null.also { Log.w(TAG, "proot: fast path off, it cannot be told these ${prootBinds.size} binds") }
|
||||
} else null
|
||||
|
||||
val command = LinuxRuntime.command(
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import java.io.File
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class ProotFastPathTest {
|
||||
private val root = File("/data/user/0/com.droiddeck.launcher/files/linuxfs")
|
||||
|
||||
private fun binds(n: Int) = (0 until n).map { "/data/user/0/com.droiddeck.launcher/files/steam-libraries/x/steamapps/common/tool$it:/mnt/droiddeck-sd/steamapps/common/tool$it" }
|
||||
|
||||
@Test fun aSessionWithASecondLibraryAndGamesFoldersKeepsTheFastPath() {
|
||||
assertNotNull(ProotFastPath.key(root, binds(96)))
|
||||
assertNotNull(ProotFastPath.key(root, binds(ProotFastPath.MAX_BINDS)))
|
||||
}
|
||||
|
||||
@Test fun moreBindsThanTheLibraryHoldsTurnTheFastPathOff() {
|
||||
assertNull(ProotFastPath.key(root, binds(ProotFastPath.MAX_BINDS + 1)))
|
||||
}
|
||||
|
||||
@Test fun aPathTooLongForTheLibraryTurnsTheFastPathOff() {
|
||||
val long = "/storage/emulated/0/" + "d".repeat(ProotFastPath.MAX_BIND_PATH)
|
||||
assertNull(ProotFastPath.key(root, binds(3) + "$long:/root/Games/Games"))
|
||||
assertNull(ProotFastPath.key(root, binds(3) + "/storage/emulated/0/Games:/root/Games/$long"))
|
||||
assertNotNull(ProotFastPath.key(root, binds(3) + "/storage/emulated/0/Games:/root/Games/Games"))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user