mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
feat(stores): editable launch options for EA store games (#2444)
This commit is contained in:
1 parent
9a76e75ee9
commit
6349a171b5
5 files changed
+41
-2
No files matched your search
@@ -499,6 +499,7 @@ object AddedGames {
|
||||
launchOptions = when {
|
||||
sidecar == null -> SessionPrefs.addedGameLaunch(context, folder.path)
|
||||
sidecar.store == Store.UBISOFT -> com.droiddeck.launcher.stores.ubisoft.UbisoftConnect.launchOptions(context)
|
||||
sidecar.store == Store.EA -> SessionPrefs.addedGameLaunch(context, folder.path)
|
||||
else -> ""
|
||||
},
|
||||
single = single != null, steamProgram = steamProgram))
|
||||
|
||||
@@ -97,7 +97,7 @@ object StoreLaunch {
|
||||
lines += "del \"%~dp0$EA_ENV\""
|
||||
lines += ":run"
|
||||
lines += "if exist \"$EA_ORIGIN\" start \"\" \"$EA_ORIGIN\""
|
||||
lines += run
|
||||
lines += "$run %*"
|
||||
lines += "taskkill /f /im Origin.exe >nul 2>&1"
|
||||
} else {
|
||||
lines += run
|
||||
|
||||
@@ -96,6 +96,7 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import coil.compose.AsyncImage
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.frontend.AddedGameEdits
|
||||
import com.droiddeck.launcher.frontend.GameRemoval
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.runtime.CurseForgeApp
|
||||
@@ -104,6 +105,7 @@ import com.droiddeck.launcher.runtime.WowAddonCatalog
|
||||
import com.droiddeck.launcher.runtime.WowAddons
|
||||
import com.droiddeck.launcher.store.UserAppsState
|
||||
import com.droiddeck.launcher.session.GameSaves
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.CloudSaves
|
||||
@@ -1001,6 +1003,25 @@ private fun LaunchTab(game: Library.SteamGame, s: FrontEndState, a: FrontEndActi
|
||||
}
|
||||
val folder = game.gameFiles
|
||||
if (game.library == Library.ADDED && game.source == Library.ADDED && !s.shortcutPicker && folder != null) ShortcutFields(game, folder)
|
||||
if (game.library == Library.ADDED && Store.byId(game.source) == Store.EA && folder != null) StoreLaunchOptions(folder, a)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun StoreLaunchOptions(folder: File, a: FrontEndActions) {
|
||||
val app = LocalContext.current.applicationContext
|
||||
val scope = rememberCoroutineScope()
|
||||
var saved by remember(folder.path) { mutableStateOf(SessionPrefs.addedGameLaunch(app, folder.path)) }
|
||||
var editing by remember(folder.path) { mutableStateOf(false) }
|
||||
Column(Modifier.fillMaxWidth().tabPanel()) {
|
||||
MenuItem(stringResource(R.string.edit_launch_options), checked = false, detail = saved.ifEmpty { "—" }) { editing = true }
|
||||
}
|
||||
if (editing) TextEntryDialog(stringResource(R.string.edit_launch_options), saved, onDismiss = { editing = false }) { value ->
|
||||
scope.launch {
|
||||
withContext(Dispatchers.IO) { AddedGameEdits.setLaunchOptions(app, folder.path, value) }
|
||||
saved = value
|
||||
a.onAddedGamesChanged(listOf(folder.path))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user