Mali old DXVK: a failed detection keeps the last automatic choice, one Proton failing does not stop the others, the bridge file's driver_api counts unless promotion=on

When nothing could be read (no apps-vulkan file and VulkanInfo failing), every automatic choice was
undone: a 1.1 phone went back to a DXVK that cannot start, and the next session flipped it again.
Now an automatic choice is undone only when the Vulkan is known and wants none.

Each Proton's swap or undo is on its own: a failure (a missing saved copy, an I/O error) is said in
the result and the remaining Protons still get theirs. When the Proton is the same but its saved copy
is gone, the choice stays and is said, instead of being forgotten with DXVK 1.10.3 still installed.

apps-vulkan: the version counts only with promotion=on; otherwise, and in files from servers before
the field (which wrote a promoted version even where it was not trusted), driver_api does. A file
whose driver_api is not the driver's own version (a driver update, a server rolled back) is left out.
This commit is contained in:
ASEbrahim authored and maxjivi05 committed 2026-10-26 13:55:31 -04:00
1 parent 9040f828e9
commit 678e16af4d
3 files changed
+58 -11

No files matched your search

@@ -27,18 +27,23 @@ data class AppVulkan(
if (!DeviceSupport.vkBridge(context)) return null
val native = VulkanInfo.query()
val file = File(VkBridgeComponent.cacheDir(context), BRIDGE_FILE)
val fromBridge = FileUtils.readString(file)?.let { fromBridgeFile(it, native["device"]) }
val fromBridge = FileUtils.readString(file)?.let { fromBridgeFile(it, native["device"], native["api"]) }
val found = fromBridge ?: fromDriver(native)
Log.i(TAG, found?.label ?: "unknown (driver query: ${native["error"] ?: "no api line"})")
return found
}
internal fun fromBridgeFile(text: String, driverDevice: String?): AppVulkan? {
internal fun fromBridgeFile(text: String, driverDevice: String?, driverApi: String? = null): AppVulkan? {
val map = keyValues(text)
val device = map["device"]
if (device != null && driverDevice != null && device != driverDevice) return null
val (major, minor) = version(map["api"]) ?: return null
return AppVulkan(major, minor, bool(map["shader_int64"]), map["max_push_constants"]?.toIntOrNull(), "bridge")
val fileDriver = version(map["driver_api"])
val native = version(driverApi)
if (fileDriver != null && native != null && fileDriver != native) return null
val promoted = map["promotion"]?.trim()?.lowercase() == "on"
val (major, minor) = (if (promoted) version(map["api"]) else fileDriver ?: version(map["api"])) ?: return null
return AppVulkan(major, minor, bool(map["shader_int64"]), map["max_push_constants"]?.toIntOrNull(),
if (promoted) "bridge, promoted" else "bridge")
}
internal fun fromDriver(map: Map<String, String>): AppVulkan? {
@@ -1041,8 +1041,13 @@ object ComponentsManager {
val p = proton(context, protonId)
val state = loadState(context)
val entry = state.sub("active").optJSONObject(p.id)?.optJSONObject(comp)
if (entry?.optString("protonVersion") == p.version && originalFile(context, p, comp).isFile)
val sameProton = entry?.optString("protonVersion") == p.version
if (sameProton && originalFile(context, p, comp).isFile)
return restore(context, protonId, comp, safeName(p.version))
if (sameProton) {
Log.w(TAG, "${p.name}: its own ${LABEL[comp]} copy is gone; keeping ${entry?.optString("label")}")
return "${LABEL[comp]}: ${p.name} keeps ${entry?.optString("label")} (its own copy is gone)"
}
state.sub("active").optJSONObject(p.id)?.remove(comp)
saveState(context, state)
"${LABEL[comp]}: ${p.name} keeps its own copy"
@@ -1064,11 +1069,13 @@ object ComponentsManager {
if (rules.isEmpty() && !bridgeSession) return null
val installed = protons(context)
val lines = mutableListOf<String>()
if (bridgeSession) {
fun each(p: Proton, what: () -> String): String =
runCatching(what).getOrElse { e -> Log.w(TAG, "${p.name}: ${e.message}", e); "${p.name}: ${e.message ?: e.javaClass.simpleName}" }
if (bridgeSession && vulkan != null) {
val state = loadState(context)
for (p in installed) {
val entry = state.optJSONObject("active")?.optJSONObject(p.id)?.optJSONObject("dxvk")
if (bridgeRule == null && autoChoiceStale(entry, null)) lines.add(undoAuto(p.id, "dxvk"))
if (bridgeRule == null && autoChoiceStale(entry, null)) lines.add(each(p) { undoAuto(p.id, "dxvk") })
}
}
for ((rule, auto) in rules) {
@@ -1085,7 +1092,7 @@ object ComponentsManager {
continue
}
if (auto) lines.add("${vulkan?.label}: DXVK ${rule.file}")
lines.add(targets.joinToString("; ") { if (auto) applyAuto(it.id, rule.file) else apply(it.id, rule.file) })
lines.add(targets.joinToString("; ") { p -> if (auto) each(p) { applyAuto(p.id, rule.file) } else apply(p.id, rule.file) })
}
return lines.filter { it.isNotEmpty() }.joinToString("; ").ifEmpty { null }
}