mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-26 00:06:02 +00:00
feat(bionic): DroidDeck-Bionic compatibility tool (Wine on Android's libc, no proot) (#3037)
DroidDeck-Bionic: a Steam compatibility tool that runs the game itself on Android's libc (bionic) instead of glibc inside proot. Steam, the stores and the session stay on DroidDeck's Linux side; only the game process leaves proot. - Listed in the Proton list only when Run without proot is on, in its own row. Its builds are pre-releases on Droid-Deck/DroidDeck-Proton (DroidDeck-Bionic-12.8-rNN, runtime built by .github/workflows/build-bionic-runtime.yml from tools/bionic-runtime); the app installs and updates them like the other extra tools and never makes one the default unless the user picks it. - With proot on, a launch sent to a bionic tool goes to the newest DroidDeck-Proton (picks stay as set). - ProtonExtras / ProtonMenu / ExperimentalProtons / droiddeck-proton-extra: bionic pre-releases checked and listed only without proot; updates carry the default and per-game picks over; deleting a tool never follows links out of it. ProtonDefault: picks left on an older bionic build move to the installed one. - Components: FEX builds for bionic (bionic-stable on DroidDeck-Components); each tool is offered only the FEX builds that fit it. - Session logs: the bionic game log and its graphics logs are part of Share logs. Synced with main twice before the merge (latest syncfbed69ceon main 67b82ad9; Build APK and validation green); a local trial merge on main3e1fc3e6had no conflicts and the game-environment, Proton-extra and store-launch tests pass.
This commit is contained in:
1 parent
3e1fc3e60e
commit
9e6f81540f
49 files changed
+3459
-84
No files matched your search
@@ -0,0 +1,139 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [28], manifest = Config.NONE)
|
||||
class ComponentsBionicFexTest {
|
||||
private val bionicTool = "DroidDeck-Bionic-12.8-r24"
|
||||
private val ownTool = "DroidDeck-Proton-11-12.8"
|
||||
|
||||
private fun proton(dir: String, valve: Boolean = false) =
|
||||
ComponentsManager.Proton(dir, dir, File("/steam/compatibilitytools.d/$dir"), "/p/$dir", "$dir-1", valve)
|
||||
|
||||
private fun item(file: String, release: String) = ComponentsManager.CatalogItem(file, "fex", release, "", 1, "")
|
||||
|
||||
@Test fun onlyBionicNamedPackagesFitDroidDeckBionic() {
|
||||
assertTrue(ComponentsManager.bionicFex("FEXCore-2611.1-bionic.wcp"))
|
||||
assertTrue(ComponentsManager.bionicFex("FEXCore-2611.1-PPA-BIONIC.WCP"))
|
||||
assertFalse(ComponentsManager.bionicFex("FEXCore-2611.1-linux.wcp"))
|
||||
assertFalse(ComponentsManager.bionicFex("DD-FEXCore-2611+51-nightly.wcp"))
|
||||
assertFalse(ComponentsManager.bionicFex("bionic-FEXCore-2611.wcp"))
|
||||
assertTrue(ComponentsManager.bionicTool(bionicTool))
|
||||
assertFalse(ComponentsManager.bionicTool(ownTool))
|
||||
assertFalse(ComponentsManager.bionicTool("GE-Proton10-25"))
|
||||
assertFalse(ComponentsManager.bionicTool(null))
|
||||
assertTrue(ComponentsManager.fexFits(bionicTool, "FEXCore-2611-bionic.wcp"))
|
||||
assertFalse(ComponentsManager.fexFits(bionicTool, "FEXCore-2611-linux.wcp"))
|
||||
assertFalse(ComponentsManager.fexFits(bionicTool, "DD-FEXCore-2611+51-nightly.wcp"))
|
||||
assertTrue(ComponentsManager.fexFits(ownTool, "DD-FEXCore-2611+51-nightly.wcp"))
|
||||
assertTrue(ComponentsManager.fexFits(ownTool, "FEXCore-2611-linux.wcp"))
|
||||
assertFalse(ComponentsManager.fexFits(ownTool, "FEXCore-2611-bionic.wcp"))
|
||||
assertFalse(ComponentsManager.fexFits(null, "FEXCore-2611-bionic.wcp"))
|
||||
}
|
||||
|
||||
@Test fun aTwinSwapsTheLinuxAndBionicEnding() {
|
||||
assertEquals("FEXCore-2611.1-bionic.wcp", ComponentsManager.fexTwin("FEXCore-2611.1-linux.wcp"))
|
||||
assertEquals("FEXCore-2611.1-linux.wcp", ComponentsManager.fexTwin("FEXCore-2611.1-bionic.wcp"))
|
||||
assertEquals("FEXCore-2611-PPA-bionic.wcp", ComponentsManager.fexTwin("FEXCore-2611-PPA-linux.wcp"))
|
||||
assertNull(ComponentsManager.fexTwin("DD-FEXCore-2611+51-nightly.wcp"))
|
||||
assertNull(ComponentsManager.fexTwin("my-fex.wcp"))
|
||||
}
|
||||
|
||||
@Test fun aLaunchTakesTheChoiceOrItsStoredTwinForEachFlavor() {
|
||||
val stored = setOf("FEXCore-2611.1-linux.wcp", "FEXCore-2611.1-bionic.wcp", "FEXCore-2610-linux.wcp")
|
||||
val has: (String) -> Boolean = { it in stored }
|
||||
assertEquals("FEXCore-2611.1-bionic.wcp", ComponentsManager.launchFex(bionicTool, "FEXCore-2611.1-linux.wcp", has))
|
||||
assertEquals("FEXCore-2611.1-bionic.wcp", ComponentsManager.launchFex(bionicTool, "FEXCore-2611.1-bionic.wcp", has))
|
||||
assertEquals("FEXCore-2611.1-linux.wcp", ComponentsManager.launchFex(ownTool, "FEXCore-2611.1-bionic.wcp", has))
|
||||
assertEquals("FEXCore-2610-linux.wcp", ComponentsManager.launchFex(ownTool, "FEXCore-2610-linux.wcp", has))
|
||||
assertEquals("DD-FEXCore-2611+51-nightly.wcp", ComponentsManager.launchFex(ownTool, "DD-FEXCore-2611+51-nightly.wcp", has))
|
||||
assertNull(ComponentsManager.launchFex(bionicTool, "FEXCore-2610-linux.wcp", has))
|
||||
assertNull(ComponentsManager.launchFex(bionicTool, "DD-FEXCore-2611+51-nightly.wcp", has))
|
||||
}
|
||||
|
||||
@Test fun fexListsShowTheProtonsFlavorAndTheCurrentChoice() {
|
||||
val files = listOf("FEXCore-2611.1-linux.wcp", "FEXCore-2611.1-bionic.wcp", "DD-FEXCore-2611+51-nightly.wcp", "FEXCore-2610-bionic.wcp")
|
||||
assertEquals(listOf("FEXCore-2611.1-bionic.wcp", "FEXCore-2610-bionic.wcp"), ComponentsManager.forTool("fex", bionicTool, files) { it })
|
||||
assertEquals(listOf("FEXCore-2611.1-linux.wcp", "DD-FEXCore-2611+51-nightly.wcp"), ComponentsManager.forTool("fex", ownTool, files) { it })
|
||||
assertEquals(listOf("FEXCore-2611.1-linux.wcp", "DD-FEXCore-2611+51-nightly.wcp"), ComponentsManager.forTool("fex", null, files) { it })
|
||||
assertEquals(listOf("FEXCore-2611.1-linux.wcp", "FEXCore-2611.1-bionic.wcp", "FEXCore-2610-bionic.wcp"),
|
||||
ComponentsManager.forTool("fex", bionicTool, files, selected = "FEXCore-2611.1-linux.wcp") { it })
|
||||
assertEquals(files, ComponentsManager.forTool("dxvk", bionicTool, files) { it })
|
||||
}
|
||||
|
||||
@Test fun bionicStableAssetsAreFex() {
|
||||
assertEquals("fex", ComponentsManager.assetComp(ComponentsManager.DD_BIONIC, "FEXCore-2611.1-bionic.wcp"))
|
||||
assertEquals("fex", ComponentsManager.assetComp(ComponentsManager.DD_BIONIC, "FEXCore-2610-PPA-bionic.wcp"))
|
||||
assertEquals("fex", ComponentsManager.assetComp("FexCore-Linux", "FEXCore-2611.1-linux.wcp"))
|
||||
}
|
||||
|
||||
@Test fun aGameFexChoiceKeepsItsTwinInUseWhileTheOtherFlavorIsInstalled() {
|
||||
val state = JSONObject().put("profiles", JSONObject().put("42", JSONObject().put("fex", "FEXCore-2611.1-linux.wcp")))
|
||||
assertEquals(setOf("FEXCore-2611.1-linux.wcp"), ComponentsManager.packagesInUse(state, listOf(proton(ownTool))))
|
||||
assertEquals(setOf("FEXCore-2611.1-linux.wcp", "FEXCore-2611.1-bionic.wcp"),
|
||||
ComponentsManager.packagesInUse(state, listOf(proton(ownTool), proton(bionicTool))))
|
||||
}
|
||||
|
||||
@Test fun aTwinAGameChoiceStillNeedsCannotBeDeletedAsUnused() {
|
||||
val state = JSONObject().put("profiles", JSONObject().put("42", JSONObject().put("fex", "FEXCore-2611.1-linux.wcp")))
|
||||
assertEquals(bionicTool, ComponentsManager.twinUser(state, listOf(proton(ownTool), proton(bionicTool)), "FEXCore-2611.1-bionic.wcp")?.dir?.name)
|
||||
assertEquals(null, ComponentsManager.twinUser(state, listOf(proton(ownTool)), "FEXCore-2611.1-bionic.wcp"))
|
||||
assertEquals(null, ComponentsManager.twinUser(state, listOf(proton(ownTool), proton(bionicTool)), "FEXCore-2610-bionic.wcp"))
|
||||
assertEquals(null, ComponentsManager.twinUser(JSONObject(), listOf(proton(bionicTool)), "FEXCore-2611.1-bionic.wcp"))
|
||||
}
|
||||
|
||||
@Test fun droidDeckBionicFollowsTheNewestBionicFexAndNothingElse() {
|
||||
val bionic = proton(bionicTool)
|
||||
val own = proton(ownTool)
|
||||
assertTrue(ComponentUpdates.autoFollows(bionic, "fex"))
|
||||
assertFalse(ComponentUpdates.autoFollows(bionic, "dxvk"))
|
||||
assertFalse(ComponentUpdates.autoFollows(bionic, "vkd3d"))
|
||||
assertFalse(ComponentUpdates.autoFollows(proton(bionicTool, valve = true), "fex"))
|
||||
assertFalse(ComponentUpdates.follows(bionic))
|
||||
assertTrue(ComponentUpdates.autoFollows(own, "dxvk"))
|
||||
assertFalse(ComponentUpdates.autoFollows(proton("GE-Proton10-25"), "fex"))
|
||||
assertEquals("fex-bionic", ComponentUpdates.fexLine(bionic).key)
|
||||
assertEquals("fex", ComponentUpdates.fexLine(own).key)
|
||||
assertEquals("fex", ComponentUpdates.line("fex", false).key)
|
||||
|
||||
val catalog = listOf(
|
||||
item("DD-FEXCore-2611+51-nightly.wcp", ComponentsManager.DD_NIGHTLY),
|
||||
item("DD-FEXCore-2611+52-bionic.wcp", ComponentsManager.DD_NIGHTLY),
|
||||
item("FEXCore-2611.1-linux.wcp", "FexCore-Linux"),
|
||||
item("FEXCore-2610-bionic.wcp", ComponentsManager.DD_BIONIC),
|
||||
item("FEXCore-2611-PPA-bionic.wcp", ComponentsManager.DD_BIONIC),
|
||||
item("FEXCore-2611.1-bionic.wcp", ComponentsManager.DD_BIONIC),
|
||||
)
|
||||
assertEquals("FEXCore-2611.1-bionic.wcp", ComponentUpdates.pick(catalog, ComponentUpdates.fexLine(bionic), emptySet())?.file)
|
||||
assertNull(ComponentUpdates.pick(catalog, ComponentUpdates.fexLine(bionic), setOf("FEXCore-2611.1-bionic.wcp")))
|
||||
assertEquals("DD-FEXCore-2611+51-nightly.wcp", ComponentUpdates.pick(catalog, ComponentUpdates.fexLine(own), emptySet())?.file)
|
||||
}
|
||||
|
||||
@Test fun pruningTheBionicLineKeepsBionicPackagesTheUserDownloaded() {
|
||||
val line = ComponentUpdates.fexLine(proton(bionicTool))
|
||||
val current = "FEXCore-2611.1-bionic.wcp"
|
||||
val stored = listOf("FEXCore-2610-bionic.wcp", "FEXCore-2611-PPA-bionic.wcp", current, "FEXCore-2610-linux.wcp")
|
||||
assertEquals(listOf("FEXCore-2610-bionic.wcp"),
|
||||
ComponentUpdates.stale(line, setOf("FEXCore-2610-bionic.wcp", current), stored, setOf(current), current))
|
||||
}
|
||||
|
||||
@Test fun aBionicProtonsOwnFexChoiceIsNotHandedBack() {
|
||||
val bionic = proton(bionicTool)
|
||||
val choices = mapOf(bionic.id to mapOf(
|
||||
"fex" to ComponentsManager.Choice("FEXCore-2611.1-bionic.wcp", false, bionic.version),
|
||||
"dxvk" to ComponentsManager.Choice("DD-dxvk-3.1.1+190-nightly.wcp", false, bionic.version),
|
||||
))
|
||||
assertEquals(listOf(bionic to "dxvk"),
|
||||
ComponentUpdates.strays(listOf(bionic), choices, setOf("FEXCore-2611.1-bionic.wcp", "DD-dxvk-3.1.1+190-nightly.wcp")))
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertThrows
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
@@ -23,6 +24,7 @@ class ComponentsRepublishTest {
|
||||
private val fex = "FEXCore-2610-d2rfix28-linux.wcp"
|
||||
private val scope = "2596113170"
|
||||
private val dll = "files/lib/wine/aarch64-windows/libwow64fex.dll"
|
||||
private val so = "files/lib/wine/aarch64-unix/libwow64fex.so"
|
||||
private lateinit var context: Context
|
||||
|
||||
@Before fun setUp() {
|
||||
@@ -48,6 +50,61 @@ class ComponentsRepublishTest {
|
||||
assertEquals(fex, ComponentsManager.gameComponents(context, scope)["fex"])
|
||||
}
|
||||
|
||||
@Test fun aGlibcGameFexChoiceWithoutItsTwinLeavesDroidDeckBionicOnItsOwnFex() {
|
||||
proton("DroidDeck-Proton 11-12.8", "DroidDeck-Proton-11-12.8")
|
||||
proton("DroidDeck-Bionic-12.8-r6", "DroidDeck-Bionic-12.8-r6")
|
||||
packageFile()
|
||||
ComponentsManager.setGameComponent(context, scope, "fex", fex) { false }
|
||||
assertEquals(setOf("DroidDeck-Proton 11-12.8"), scopedTools())
|
||||
val bionic = rows().filter { it[1] == "DroidDeck-Bionic-12.8-r6" && it[3] == "fex" }
|
||||
assertTrue(bionic.isNotEmpty())
|
||||
assertTrue(bionic.all { it[0] == "*" && "/store/original-DroidDeck-Bionic-12.8-r6-" in it[6] })
|
||||
}
|
||||
|
||||
@Test fun aGameFexChoiceReachesEachProtonAsTheBuildOfItsFlavor() {
|
||||
proton("DroidDeck-Proton-11-12.8", "DroidDeck-Proton-11-12.8")
|
||||
proton("DroidDeck-Bionic-12.8-r24", "DroidDeck-Bionic-12.8-r24")
|
||||
val linux = "FEXCore-2611.1-linux.wcp"
|
||||
val bionic = "FEXCore-2611.1-bionic.wcp"
|
||||
packageFile(linux, "FEXCore-Linux", "glibc wow64")
|
||||
packageFile(bionic, "FEXCore-Bionic", "android wow64")
|
||||
|
||||
for (choice in listOf(linux, bionic)) {
|
||||
ComponentsManager.setGameComponent(context, scope, "fex", choice) { false }
|
||||
val scoped = rows().filter { it[0] == scope && it[3] == "fex" }
|
||||
val own = scoped.single { it[1] == "DroidDeck-Proton-11-12.8" && it[4] == dll }
|
||||
val android = scoped.single { it[1] == "DroidDeck-Bionic-12.8-r24" && it[4] == dll }
|
||||
assertEquals("glibc wow64", File(LinuxRuntime.rootDir(context), own[6].removePrefix("/")).readText())
|
||||
assertEquals("android wow64", File(LinuxRuntime.rootDir(context), android[6].removePrefix("/")).readText())
|
||||
assertTrue(scoped.any { it[1] == "DroidDeck-Proton-11-12.8" && it[6] == "-" })
|
||||
assertTrue(scoped.none { it[1] == "DroidDeck-Bionic-12.8-r24" && it[6] == "-" })
|
||||
assertEquals(choice, ComponentsManager.gameComponents(context, scope)["fex"])
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun aProtonsFexIsOnlyEverSwappedToABuildOfItsFlavor() {
|
||||
proton("DroidDeck-Proton-11-12.8", "DroidDeck-Proton-11-12.8")
|
||||
proton("DroidDeck-Bionic-12.8-r24", "DroidDeck-Bionic-12.8-r24")
|
||||
val linux = "FEXCore-2611.1-linux.wcp"
|
||||
val bionic = "FEXCore-2611.1-bionic.wcp"
|
||||
packageFile(linux, "FEXCore-Linux", "glibc wow64")
|
||||
packageFile(bionic, "FEXCore-Bionic", "android wow64")
|
||||
val bionicDll = File(protonDir("DroidDeck-Bionic-12.8-r24"), dll)
|
||||
val ownDll = File(protonDir("DroidDeck-Proton-11-12.8"), dll)
|
||||
|
||||
assertThrows(IllegalStateException::class.java) { ComponentsManager.swap(context, "DroidDeck-Bionic-12.8-r24", linux) }
|
||||
assertThrows(IllegalStateException::class.java) { ComponentsManager.swap(context, "DroidDeck-Proton-11-12.8", bionic) }
|
||||
assertEquals("bundled FEX DroidDeck-Bionic-12.8-r24", bionicDll.readText())
|
||||
assertEquals("bundled FEX DroidDeck-Proton-11-12.8", ownDll.readText())
|
||||
|
||||
ComponentsManager.swap(context, "DroidDeck-Bionic-12.8-r24", bionic)
|
||||
ComponentsManager.swap(context, "DroidDeck-Proton-11-12.8", linux)
|
||||
assertEquals("android wow64", bionicDll.readText())
|
||||
assertEquals("glibc wow64", ownDll.readText())
|
||||
assertTrue(File(protonDir("DroidDeck-Bionic-12.8-r24"), so).isFile)
|
||||
assertTrue(rows().none { it[1] == "DroidDeck-Bionic-12.8-r24" && it[3] == "fex" && it[6] == "-" })
|
||||
}
|
||||
|
||||
@Test fun nothingIsRewrittenWhileTheToolsAreUnchanged() {
|
||||
proton("DroidDeck-Proton 11-11.8", "DroidDeck-Proton-11-11.8")
|
||||
packageFile()
|
||||
@@ -117,18 +174,21 @@ class ComponentsRepublishTest {
|
||||
|
||||
private fun launchState() = File(LinuxRuntime.rootDir(context), "root/.local/share/droiddeck-components/desired.tsv")
|
||||
|
||||
private fun protonDir(name: String) = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/common/$name")
|
||||
|
||||
private fun proton(name: String, version: String) {
|
||||
val dir = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/common/$name")
|
||||
val dir = protonDir(name)
|
||||
File(dir, "files/lib/wine").mkdirs()
|
||||
File(dir, "proton").writeText("#!/bin/sh\n")
|
||||
File(dir, "version").writeText("1 $version\n")
|
||||
File(dir, dll).apply { parentFile!!.mkdirs(); writeText("bundled FEX $version") }
|
||||
File(dir, so).apply { parentFile!!.mkdirs(); writeText("bundled unix FEX $version") }
|
||||
}
|
||||
|
||||
private fun packageFile() {
|
||||
val out = File(context.filesDir, "components/packages/$fex").apply { parentFile!!.mkdirs() }
|
||||
val profile = JSONObject().put("type", "FEXCore-Linux").put("versionName", "2610-d2rfix28").toString().toByteArray()
|
||||
val body = "d2rfix28 wow64".toByteArray()
|
||||
private fun packageFile(name: String = fex, type: String = "FEXCore-Linux", text: String = "d2rfix28 wow64") {
|
||||
val out = File(context.filesDir, "components/packages/$name").apply { parentFile!!.mkdirs() }
|
||||
val profile = JSONObject().put("type", type).put("versionName", name.removeSuffix(".wcp")).toString().toByteArray()
|
||||
val body = text.toByteArray()
|
||||
TarArchiveOutputStream(ZstdOutputStream(out.outputStream())).use { tar ->
|
||||
tar.putArchiveEntry(TarArchiveEntry("profile.json").apply { size = profile.size.toLong() })
|
||||
tar.write(profile)
|
||||
|
||||
@@ -98,6 +98,22 @@ class EnhancedSessionLogShareTest {
|
||||
SessionLogShare.clear(app)
|
||||
}
|
||||
|
||||
@Test fun aBionicGameLogIsSharedWithTheGamesUnderItsName() {
|
||||
val session = tmp.newFolder("2026-11-22-09-steam")
|
||||
session.resolve("session.log").writeText("startup ok\n")
|
||||
val launch = session.resolve("games/2026-11-22-201105-bionic-341940").apply { mkdirs() }
|
||||
launch.resolve("droiddeck-bionic.log").writeText("20:11:05 waitforexitandrun Hatred.exe\n")
|
||||
|
||||
val games = EnhancedSessionLogShare.create(app, session).single { it.name.endsWith("-games.zip") }
|
||||
|
||||
ZipFile(games).use { archive ->
|
||||
val entry = archive.getEntry("${session.name}/games/2026-11-22-201105-bionic-341940/droiddeck-bionic.log")
|
||||
assertTrue(entry != null)
|
||||
assertEquals("20:11:05 waitforexitandrun Hatred.exe\n", archive.getInputStream(entry).bufferedReader().readText())
|
||||
}
|
||||
SessionLogShare.clear(app)
|
||||
}
|
||||
|
||||
@Test fun oversizedFilesKeepBoundedBeginningAndTailAndDeclareTruncation() {
|
||||
val session = tmp.newFolder("2026-11-04-02-game")
|
||||
session.resolve("steam-7.log").writeText("begin\n" + "middle\n".repeat(100) + "tail\n")
|
||||
|
||||
@@ -68,6 +68,19 @@ class ExperimentalProtonsTest {
|
||||
assertEquals(listOf("pre"), ProtonExtras.assets(tool, releases, true).map { it.tag })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bionicBuildsKeepTheirOwnRow() {
|
||||
val tool = ProtonExtras.tools.first { it.id == ProtonExtras.OWN }
|
||||
val releases = JSONArray("""
|
||||
[{"tag_name":"DroidDeck-Proton-11-12.8","prerelease":false,"published_at":"2026-11-14T00:00:00Z","assets":[{"name":"DroidDeck-Proton-11-12.8-aarch64.tar.gz","browser_download_url":"https://example/stable"}]},
|
||||
{"tag_name":"DroidDeck-Bionic-12.8-r37","prerelease":true,"published_at":"2026-11-19T00:00:00Z","assets":[{"name":"DroidDeck-Bionic-12.8-r37-aarch64.tar.xz","browser_download_url":"https://example/bionic"}]},
|
||||
{"tag_name":"DroidDeck-Proton-11-12.9-test1","prerelease":true,"published_at":"2026-11-19T01:00:00Z","assets":[{"name":"DroidDeck-Proton-11-12.9-test1-aarch64.tar.xz","browser_download_url":"https://example/test"}]}]
|
||||
""".trimIndent())
|
||||
val assets = ProtonExtras.assets(tool, releases, true)
|
||||
assertEquals(listOf("DroidDeck-Bionic-12.8-r37", "DroidDeck-Proton-11-12.9-test1"), assets.map { it.tag })
|
||||
assertEquals(listOf("DroidDeck-Proton-11-12.9-test1"), ExperimentalProtons.listed(assets).map { it.tag })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun markerRoundTripKeepsReleaseTag() {
|
||||
val dir = File(com.droiddeck.launcher.runtime.LinuxRuntime.rootDir(activity), "root/.local/share/Steam/compatibilitytools.d/Experimental-pre").apply { mkdirs() }
|
||||
|
||||
@@ -127,4 +127,90 @@ class ProtonDefaultTest {
|
||||
assertTrue(games.containsKey("43"))
|
||||
assertNull(games["43"])
|
||||
}
|
||||
|
||||
@Test
|
||||
fun anUpdateMovesTheDefaultThatNamesTheReplacedTool() {
|
||||
val bionic = """
|
||||
{"default": "DroidDeck-Bionic-12.8-r30-Proton", "applied": 7, "live": false,
|
||||
"tools": [{"name": "DroidDeck-Bionic-12.8-r30-Proton", "display": "r30", "dir": "DroidDeck-Bionic-12.8-r30", "valve": false},
|
||||
{"name": "DroidDeck-Proton-11-12.8", "display": "DD", "dir": "DroidDeck-Proton 11-12.8", "valve": false}]}
|
||||
""".trimIndent()
|
||||
val parsed = ProtonDefault.parseState(bionic)
|
||||
val from = setOf("DroidDeck-Bionic-12.8-r30")
|
||||
// applied default, no request yet
|
||||
assertEquals(ProtonDefault.Request(100, false, "DroidDeck-Bionic-12.8-r31"),
|
||||
ProtonDefault.movedDefault(parsed, null, from, "DroidDeck-Bionic-12.8-r31", 100))
|
||||
// a pending request for the replaced tool wins over the applied default and the new seq is above both
|
||||
assertEquals(ProtonDefault.Request(51, false, "DroidDeck-Bionic-12.8-r31"),
|
||||
ProtonDefault.movedDefault(parsed, ProtonDefault.Request(50, false, "DroidDeck-Bionic-12.8-r30"), from, "DroidDeck-Bionic-12.8-r31", 3))
|
||||
// a default on another tool stays as it is
|
||||
assertNull(ProtonDefault.movedDefault(parsed, ProtonDefault.Request(50, false, "DroidDeck-Proton 11-12.8"), from, "DroidDeck-Bionic-12.8-r31", 100))
|
||||
assertNull(ProtonDefault.movedDefault(ProtonDefault.parseState(state), null, from, "DroidDeck-Bionic-12.8-r31", 100))
|
||||
// an applied request (seq not above "applied") no longer decides: the applied default does
|
||||
assertEquals("DroidDeck-Bionic-12.8-r31",
|
||||
ProtonDefault.movedDefault(parsed, ProtonDefault.Request(7, false, "DroidDeck-Proton 11-12.8"), from, "DroidDeck-Bionic-12.8-r31", 1)?.dir)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aBionicDefaultOnAnotherBuildMovesToTheInstalledOne() {
|
||||
val r37 = "DroidDeck-Bionic-12.8-r37"
|
||||
val applied = ProtonDefault.parseState("""{"default": "DroidDeck-Bionic-12.8-r30-Proton", "applied": 7,
|
||||
"tools": [{"name": "DroidDeck-Bionic-12.8-r30-Proton", "display": "r30", "dir": "DroidDeck-Bionic-12.8-r30", "valve": false},
|
||||
{"name": "droiddeck-proton-arm64", "display": "Proton ARM64", "dir": "Proton Experimental (ARM64)", "valve": true}]}""")
|
||||
// the applied default is an older build
|
||||
assertEquals(ProtonDefault.Request(100, false, r37), ProtonDefault.bionicDefault(applied, null, "DroidDeck-Bionic", r37, 100))
|
||||
// the guest fell back to its own tool because the requested build was gone: the request still names it
|
||||
val fallback = ProtonDefault.parseState("""{"default": "droiddeck-proton-arm64", "applied": 50, "source": "fallback",
|
||||
"tools": [{"name": "droiddeck-proton-arm64", "display": "Proton ARM64", "dir": "Proton Experimental (ARM64)", "valve": true}]}""")
|
||||
assertEquals(ProtonDefault.Request(51, false, r37),
|
||||
ProtonDefault.bionicDefault(fallback, ProtonDefault.Request(50, false, "DroidDeck-Bionic-12.8-r24"), "DroidDeck-Bionic", r37, 3))
|
||||
// already the installed build, another tool, or a fallback the request did not cause: left as it is
|
||||
assertNull(ProtonDefault.bionicDefault(fallback, ProtonDefault.Request(50, false, r37), "DroidDeck-Bionic", r37, 3))
|
||||
assertNull(ProtonDefault.bionicDefault(fallback, ProtonDefault.Request(50, false, "DroidDeck-Proton 11-12.8"), "DroidDeck-Bionic", r37, 3))
|
||||
assertNull(ProtonDefault.bionicDefault(ProtonDefault.parseState(state), null, "DroidDeck-Bionic", r37, 100))
|
||||
val steam = ProtonDefault.parseState("""{"default": "droiddeck-proton-arm64", "applied": 50, "source": "steam",
|
||||
"tools": [{"name": "droiddeck-proton-arm64", "display": "Proton ARM64", "dir": "Proton Experimental (ARM64)", "valve": true}]}""")
|
||||
assertNull(ProtonDefault.bionicDefault(steam, ProtonDefault.Request(50, false, "DroidDeck-Bionic-12.8-r24"), "DroidDeck-Bionic", r37, 3))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun keepingBionicCurrentRewritesTheDefaultAndThePicks() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val d = File(LinuxRuntime.rootDir(context), "root/.local/share/droiddeck-compat").apply { deleteRecursively(); mkdirs() }
|
||||
File(d, "state.json").writeText("""{"default": "droiddeck-proton-arm64", "applied": 9, "source": "fallback",
|
||||
"tools": [{"name": "droiddeck-proton-arm64", "display": "Proton ARM64", "dir": "Proton Experimental (ARM64)", "valve": true}]}""")
|
||||
File(d, "request.json").writeText("""{"seq": 9, "valve": false, "dir": "DroidDeck-Bionic-12.8-r24"}""")
|
||||
ProtonDefault.requestGame(context, "42", proton("DroidDeck-Bionic-12.8-r29", false))
|
||||
ProtonDefault.requestGame(context, "43", proton("DroidDeck-Proton 11-12.8", false))
|
||||
ProtonDefault.requestGame(context, "44", null)
|
||||
ProtonDefault.keepBionicCurrent(context, "DroidDeck-Bionic", "DroidDeck-Bionic-12.8-r37")
|
||||
val request = ProtonDefault.parseRequest(File(d, "request.json").readText())
|
||||
assertEquals("DroidDeck-Bionic-12.8-r37", request?.dir)
|
||||
assertTrue(request!!.seq > 9)
|
||||
val games = ProtonDefault.parseGames(File(d, "games.json").readText())
|
||||
assertEquals(ProtonDefault.GameChoice(false, "DroidDeck-Bionic-12.8-r37"), games["42"])
|
||||
assertEquals(ProtonDefault.GameChoice(false, "DroidDeck-Proton 11-12.8"), games["43"])
|
||||
assertTrue(games.containsKey("44"))
|
||||
assertNull(games["44"])
|
||||
val before = File(d, "request.json").readText() + File(d, "games.json").readText()
|
||||
ProtonDefault.keepBionicCurrent(context, "DroidDeck-Bionic", "DroidDeck-Bionic-12.8-r37")
|
||||
assertEquals(before, File(d, "request.json").readText() + File(d, "games.json").readText())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun moveDefaultRewritesTheRequestFile() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val d = File(LinuxRuntime.rootDir(context), "root/.local/share/droiddeck-compat").apply { mkdirs() }
|
||||
File(d, "state.json").writeText("""{"default": "DroidDeck-Bionic-12.8-r30-Proton", "applied": 7,
|
||||
"tools": [{"name": "DroidDeck-Bionic-12.8-r30-Proton", "display": "r30", "dir": "DroidDeck-Bionic-12.8-r30", "valve": false}]}""")
|
||||
File(d, "request.json").delete()
|
||||
ProtonDefault.moveDefault(context, setOf("DroidDeck-Bionic-12.8-r30"), "DroidDeck-Bionic-12.8-r31")
|
||||
val written = ProtonDefault.parseRequest(File(d, "request.json").readText())
|
||||
assertEquals("DroidDeck-Bionic-12.8-r31", written?.dir)
|
||||
assertFalse(written!!.valve)
|
||||
assertTrue(written.seq > 7)
|
||||
val before = File(d, "request.json").readText()
|
||||
ProtonDefault.moveDefault(context, setOf("DroidDeck-Bionic-12.8-r29"), "DroidDeck-Bionic-12.8-r31")
|
||||
assertEquals(before, File(d, "request.json").readText())
|
||||
}
|
||||
}
|
||||
@@ -77,8 +77,8 @@ class ProtonExtrasTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theThreeSourcesInOrder() {
|
||||
assertEquals(listOf("ge", "cachyos", "droiddeck"), ProtonExtras.tools.map { it.id })
|
||||
fun theSourcesInOrder() {
|
||||
assertEquals(listOf("ge", "cachyos", "droiddeck", "bionic"), ProtonExtras.tools.map { it.id })
|
||||
val droiddeck = tool("droiddeck")
|
||||
assertEquals("DroidDeck-Proton", droiddeck.name)
|
||||
assertEquals("DroidDeck-Proton", droiddeck.prefix)
|
||||
@@ -90,6 +90,29 @@ class ProtonExtrasTest {
|
||||
assertFalse(tool("cachyos").assetPattern.containsMatchIn("proton-cachyos-11.0-20261005-slr-x86_64.tar.xz"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bionicAndDroidDeckProtonShareTheReleasesButNotTheirArchives() {
|
||||
val bionic = tool("bionic")
|
||||
assertEquals("DroidDeck-Bionic", bionic.prefix)
|
||||
assertEquals("Droid-Deck/DroidDeck-Proton", bionic.repo)
|
||||
assertTrue(bionic.assetPattern.containsMatchIn("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz"))
|
||||
assertFalse(bionic.assetPattern.containsMatchIn("DroidDeck-Proton-11-12.8-aarch64.tar.gz"))
|
||||
assertFalse(bionic.assetPattern.containsMatchIn("DroidDeck-Bionic-12.8-r3-aarch64.sha512sum"))
|
||||
assertFalse(tool("droiddeck").assetPattern.containsMatchIn("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bionicTakesItsPrereleaseAndDroidDeckProtonSkipsIt() {
|
||||
val releases = JSONArray()
|
||||
.put(release("DroidDeck-Bionic-12.8-r3", asset("DroidDeck-Bionic-12.8-r3-aarch64.sha512sum"),
|
||||
asset("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz"), prerelease = true))
|
||||
.put(droiddeckRelease("11-12.8"))
|
||||
val bionic = ProtonExtras.pickAsset(tool("bionic"), releases)!!
|
||||
assertEquals("DroidDeck-Bionic-12.8-r3-aarch64.tar.xz", bionic.name)
|
||||
assertTrue(bionic.sha512!!.endsWith("DroidDeck-Bionic-12.8-r3-aarch64.sha512sum"))
|
||||
assertEquals("DroidDeck-Proton-11-12.8-aarch64.tar.gz", ProtonExtras.pickAsset(tool("droiddeck"), releases)!!.name)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theTarballAndItsSha512FileArePicked() {
|
||||
val picked = ProtonExtras.pickAsset(tool("droiddeck"), JSONArray().put(droiddeckRelease("11-7.5")))!!
|
||||
@@ -206,6 +229,22 @@ class ProtonExtrasTest {
|
||||
assertNull(ProtonExtras.update(context, tool("droiddeck")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removingDeletesLinksButNeverWhatTheyPointTo() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val tools = File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/compatibilitytools.d")
|
||||
val outside = temp.newFolder("outside").apply { File(this, "keep.txt").writeText("x") }
|
||||
for (name in listOf("DroidDeck-Bionic-12.8-r3", "DroidDeck-Bionic-12.8-r5")) {
|
||||
val dosdevices = File(installTool(tools, name), "files/default_pfx/dosdevices").apply { mkdirs() }
|
||||
java.nio.file.Files.createSymbolicLink(File(dosdevices, "z:").toPath(), outside.toPath())
|
||||
}
|
||||
ProtonExtras.removeOlder(context, tool("bionic"))
|
||||
ProtonExtras.remove(context, tool("bionic"), "DroidDeck-Bionic-12.8-r5")
|
||||
assertFalse(File(tools, "DroidDeck-Bionic-12.8-r3").exists())
|
||||
assertFalse(File(tools, "DroidDeck-Bionic-12.8-r5").exists())
|
||||
assertTrue(File(outside, "keep.txt").isFile)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun removingDeletesOneBuildOrEveryOlderOne() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
|
||||
@@ -168,8 +168,8 @@ class StoreGameSidecarTest {
|
||||
"if \"%DD_EPIC_PARENT%\"==\"1\" set \"DD_P=1\"",
|
||||
"if \"%DD_EPIC_PARENT%\"==\"0\" set \"DD_P=\"",
|
||||
"if defined DD_P set \"SteamAppId=\"",
|
||||
"if defined DD_P if not exist \"Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\" set \"DD_P=\"",
|
||||
"if defined DD_P set DD_P=\"Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\"",
|
||||
"if defined DD_P if not exist \"%DD_R%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\" set \"DD_P=\"",
|
||||
"if defined DD_P set DD_P=\"%DD_R%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\"",
|
||||
)
|
||||
|
||||
@Test fun epicTitlesThatCheckTheirParentStartUnderTheStandIn() {
|
||||
|
||||
@@ -105,11 +105,28 @@ class UbisoftTest {
|
||||
val text = StoreLaunch.launcherText(StoreGameSidecar(Store.UBISOFT, "space-sc", "Splinter Cell", "system/SplinterCell.exe"))
|
||||
val lines = text.trimEnd().split("\r\n")
|
||||
assertTrue(lines.contains("if not exist \"%~dp0.droiddeck-ubisoft.json\" goto direct"))
|
||||
assertTrue(lines.contains("\"Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" \"%~dp0.droiddeck-ubisoft.json\""))
|
||||
val service = lines.indexOf("\"%DD_R%\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" \"%~dp0.droiddeck-ubisoft.json\"")
|
||||
assertTrue(service in 0 until lines.indexOf(":direct"))
|
||||
assertTrue(lines.indexOf("set \"DD_R=Z:\"") in 0 until lines.indexOf("if defined DROIDDECK_GUEST_ROOT set \"DD_R=%DROIDDECK_GUEST_ROOT%\""))
|
||||
assertTrue(lines.indexOf("if defined DROIDDECK_GUEST_ROOT set \"DD_R=%DROIDDECK_GUEST_ROOT%\"") < service)
|
||||
assertEquals("\"%~dp0system\\SplinterCell.exe\"", lines.last())
|
||||
assertTrue(lines.indexOf(":direct") < lines.lastIndex)
|
||||
}
|
||||
|
||||
@Test fun anInstalledGamesOlderLauncherIsRewritten() {
|
||||
val folder = java.nio.file.Files.createTempDirectory("ubisoft-adopt").toFile()
|
||||
try {
|
||||
File(folder, "system").mkdirs()
|
||||
File(folder, "system/SplinterCell.exe").writeText("exe")
|
||||
val sidecar = StoreGameSidecar(Store.UBISOFT, "space-sc", "Splinter Cell", "system/SplinterCell.exe", launcher = StoreLaunch.LAUNCHER)
|
||||
File(folder, StoreLaunch.LAUNCHER).writeText("@echo off\r\nif not exist \"Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" goto direct\r\n")
|
||||
StoreLaunch.adopt(folder, sidecar)
|
||||
assertEquals(StoreLaunch.launcherText(sidecar), File(folder, StoreLaunch.LAUNCHER).readText())
|
||||
} finally {
|
||||
folder.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun activationPayloadsSurviveTheHexHop() {
|
||||
val bytes = byteArrayOf(0, 1, 0x7f, -1, -128, 42)
|
||||
assertEquals("00017fff802a", UbisoftActivation.hex(bytes))
|
||||
|
||||
Reference in new issue
Block a user