mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix: publish component choices again when a new Proton build appears
Game and global component choices were written to desired.tsv only when a selection changed, so a Proton build installed later (DroidDeck-Proton 11-11.8) had no rows and kept its bundled FEX. Battle.net's d2rfix FEX never reached it and StarCraft died in ClientSdk.dll's DllMain. The choices are now republished at session start and on Battle.net's FEX request whenever the installed tools no longer match what was published.
This commit is contained in:
1 parent
4c7e59ed8b
commit
c781cfd525
4 files changed
+111
-2
No files matched your search
@@ -360,6 +360,8 @@ object BattleNet {
|
||||
if (ComponentsManager.gameComponents(context, scope)["fex"] != file) {
|
||||
ComponentsManager.setGameComponent(context, scope, "fex", file)
|
||||
Log.i(TAG, "FEX for the Battle.net prefix: $file")
|
||||
} else if (ComponentsManager.republish(context)) {
|
||||
Log.i(TAG, "FEX for the Battle.net prefix: $file, now in every installed Proton")
|
||||
}
|
||||
return file
|
||||
}
|
||||
|
||||
@@ -155,8 +155,7 @@ object ComponentsManager {
|
||||
if (staged.exists()) check(staged.delete()) { "Could not remove unpublished component selections" }
|
||||
}
|
||||
|
||||
private fun saveState(context: Context, state: JSONObject) {
|
||||
val prepared = prepareLaunchState(context, state)
|
||||
private fun saveState(context: Context, state: JSONObject, prepared: PreparedLaunchState = prepareLaunchState(context, state)) {
|
||||
val dir = launchDir(context)
|
||||
val tmp = File(dir, "desired.tsv.tmp")
|
||||
try {
|
||||
@@ -175,6 +174,14 @@ object ComponentsManager {
|
||||
?.forEach { it.deleteRecursively() }
|
||||
}
|
||||
|
||||
fun republish(context: Context): Boolean = synchronized(lock) {
|
||||
val state = loadState(context)
|
||||
val prepared = prepareLaunchState(context, state)
|
||||
if ((FileUtils.readString(File(launchDir(context), "desired.tsv")) ?: "") == prepared.text) return false
|
||||
saveState(context, state, prepared)
|
||||
true
|
||||
}
|
||||
|
||||
private fun JSONObject.sub(key: String): JSONObject = optJSONObject(key) ?: JSONObject().also { put(key, it) }
|
||||
|
||||
private fun rememberProfiledComponent(state: JSONObject, comp: String) {
|
||||
|
||||
@@ -480,6 +480,9 @@ class SessionService : Service() {
|
||||
val size = SessionState.outputSize
|
||||
val guest = ArrayList<String>()
|
||||
val steamHere = SessionState.mode == MODE_STEAM || SessionState.mode == MODE_DESKTOP
|
||||
runCatching { ComponentsManager.republish(this) }
|
||||
.onSuccess { if (it) Log.i(TAG, "component selections published for the installed Proton builds") }
|
||||
.onFailure { Log.w(TAG, "component selections", it) }
|
||||
if (steamHere) {
|
||||
runCatching { ComponentsManager.ensureForcedPackages(this) }
|
||||
.onSuccess { if (it != null) Log.i(TAG, it) }
|
||||
|
||||
Reference in new issue
Block a user