mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(bionic): address review findings
Launcher (tools/bionic-runtime/tool/launch.sh) - The FEX code cache is also cleared when another FEX build wrote to it since this tool last ran the prefix: the stamp now holds the FEX ID and a fingerprint of the caches, saved after each run (also after runinprefix and when Steam stops the game). - A game started by a launcher that then exits keeps the tool waiting: the wait goes on while any program of the prefix runs, apart from Wine's own services. The game is looked up in this prefix only, by its name as fixed text. - The tool exits with Wine's status instead of 0. Install scripts (droiddeck-game-env) - A "run process" entry counts as done only when its hasrunkey value is a DWORD of at least its MinimumHasRunValue (1 by default), as Steam's evaluator decides; a 0 or a value of another type no longer lets the evaluator be skipped. Helpers - execshim: non-regular files (a FIFO) go to libc without a blocking open; libc functions are bound at load through atomic slots; relative posix_spawn paths with file actions are left to libc; the argument vector has room for its terminator when argv is empty. - gstag: replies and errors are matched to their request's sequence number per connection; one bounded packet reader; destroyed windows leave the candidate and tagged lists; the focus override needs a live tagged window and a successful focus read; only gone candidates are pruned. - steamshm: a new shared object is created and sized under a private name and then put in place in one step; both code redirects go in or neither, and unused trampolines are released. - check-needed.py fails when readelf fails and ignores dangling links. - The bionic runtime workflow also runs for tools/gpuload changes. App and tool wrapper - FEX twin downloads run once per name; a twin that a game's FEX choice still needs on an installed tool cannot be deleted. - With proot on and no DroidDeck-Proton installed, a launch sent to DroidDeck-Bionic stops with a message instead of starting the bionic tool.
This commit is contained in:
1 parent
dca443e3aa
commit
2aae4b2284
11 files changed
+435
-122
No files matched your search
@@ -207,19 +207,27 @@ object ComponentsManager {
|
||||
if (comp == "fex" && file != null) fetchFexTwin(context, safeName(file))
|
||||
}
|
||||
|
||||
// Twin downloads in flight: one worker per name, so two profile changes cannot share one partial download.
|
||||
private val twinDownloads = HashSet<String>()
|
||||
|
||||
private fun fetchFexTwin(context: Context, file: String) {
|
||||
val twin = fexTwin(file) ?: return
|
||||
if (isStored(context, twin) || protons(context).all { fexFits(it.dir.name, file) }) return
|
||||
if (protons(context).all { fexFits(it.dir.name, file) }) return
|
||||
synchronized(lock) { if (isStored(context, twin) || !twinDownloads.add(twin)) return }
|
||||
val app = context.applicationContext
|
||||
Thread({
|
||||
runCatching {
|
||||
val item = catalogItem(app, twin, if (bionicFex(twin)) DD_BIONIC else "FexCore-Linux")
|
||||
if (item == null) Log.i(TAG, "$twin is not listed")
|
||||
else {
|
||||
download(app, item) {}
|
||||
republish(app)
|
||||
}
|
||||
}.onFailure { Log.w(TAG, "download $twin", it) }
|
||||
try {
|
||||
runCatching {
|
||||
val item = catalogItem(app, twin, if (bionicFex(twin)) DD_BIONIC else "FexCore-Linux")
|
||||
if (item == null) Log.i(TAG, "$twin is not listed")
|
||||
else {
|
||||
download(app, item) {}
|
||||
republish(app)
|
||||
}
|
||||
}.onFailure { Log.w(TAG, "download $twin", it) }
|
||||
} finally {
|
||||
synchronized(lock) { twinDownloads.remove(twin) }
|
||||
}
|
||||
}, "fex-twin").start()
|
||||
}
|
||||
|
||||
@@ -832,6 +840,18 @@ object ComponentsManager {
|
||||
internal fun liveOnAny(key: String, entry: JSONObject, installs: List<Proton>?): Boolean =
|
||||
installs?.any { liveSelection(key, entry, it) } == true
|
||||
|
||||
// An installed tool that launches with `name` as the stored twin of a game's FEX choice (a Linux choice on
|
||||
// DroidDeck-Bionic, a -bionic one on another Proton): deleting the twin would drop that choice for that tool.
|
||||
internal fun twinUser(state: JSONObject, installed: List<Proton>, name: String): Proton? {
|
||||
val profiles = state.optJSONObject("profiles") ?: return null
|
||||
for (scope in profiles.keys()) {
|
||||
val chosen = profiles.optJSONObject(scope)?.optString("fex")?.takeIf { it.isNotEmpty() } ?: continue
|
||||
if (fexTwin(chosen) != name) continue
|
||||
installed.firstOrNull { !fexFits(it.dir.name, chosen) }?.let { return it }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
internal fun packagesInUse(state: JSONObject, installed: List<Proton>): Set<String> {
|
||||
val byId = installed.groupBy { it.id }
|
||||
val names = HashSet<String>()
|
||||
@@ -1004,6 +1024,8 @@ object ComponentsManager {
|
||||
fun deletePackage(context: Context, file: String): String = synchronized(lock) {
|
||||
val name = safeName(file)
|
||||
val state = loadState(context)
|
||||
val twinTool = twinUser(state, protons(context), name)
|
||||
check(twinTool == null) { context.getString(R.string.cmgr_package_in_use, name, twinTool?.name ?: "") }
|
||||
val installed = protons(context).groupBy { it.id }
|
||||
var changed = false
|
||||
for (key in listOf("queued", "active")) {
|
||||
|
||||
@@ -84,6 +84,14 @@ class ComponentsBionicFexTest {
|
||||
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)
|
||||
|
||||
Reference in new issue
Block a user