mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
Stores: every install goes to Steam, no switch; the Games hero names where a game lives
The user's call: adding a store game to Steam is not optional. The setting is gone from the cog, Setup and the prefs; the sidecar has no addToSteam field (an older sidecar's is read past and ignored), the scan lists every store install, and the game page shows a passive In Steam chip instead of a button. The Games hero's eyebrow for a never-played store game now reads Games storage (the chip names the store) and Custom game for a hand-added folder, in step with the Custom chip; Steam titles keep their label.
This commit is contained in:
1 parent
21aeab0126
commit
a4841dff9d
16 files changed
+47
-84
No files matched your search
@@ -165,7 +165,6 @@ class MainActivity : ComponentActivity() {
|
||||
private var animationsEnabled by mutableStateOf(true)
|
||||
private var storeEnabled by mutableStateOf(false)
|
||||
private var gameStoresEnabled by mutableStateOf(false)
|
||||
private var gameStoresAddToSteam by mutableStateOf(true)
|
||||
private var gameStoresSpeedTier by mutableStateOf("fast")
|
||||
private var storesOpenTab by mutableStateOf(SessionPrefs.STORES_OPEN_LIBRARY)
|
||||
private var mic by mutableStateOf(false)
|
||||
@@ -528,7 +527,6 @@ class MainActivity : ComponentActivity() {
|
||||
animationsEnabled = SessionPrefs.animationsEnabled(this)
|
||||
storeEnabled = SessionPrefs.storeEnabled(this)
|
||||
gameStoresEnabled = SessionPrefs.gameStoresEnabled(this)
|
||||
gameStoresAddToSteam = SessionPrefs.gameStoresAddToSteam(this)
|
||||
gameStoresSpeedTier = SessionPrefs.gameStoresSpeedTier(this)
|
||||
storesOpenTab = SessionPrefs.storesOpenTab(this)
|
||||
applyLauncherFullscreen()
|
||||
@@ -585,7 +583,6 @@ class MainActivity : ComponentActivity() {
|
||||
animationsEnabled = animationsEnabled,
|
||||
storeEnabled = storeEnabled,
|
||||
gameStoresEnabled = gameStoresEnabled,
|
||||
gameStoresAddToSteam = gameStoresAddToSteam,
|
||||
gameStoresSpeedTier = gameStoresSpeedTier,
|
||||
storesOpenTab = storesOpenTab,
|
||||
storeDownloadsActive = com.droiddeck.launcher.stores.StoresState.activeDownloads,
|
||||
@@ -717,7 +714,6 @@ class MainActivity : ComponentActivity() {
|
||||
},
|
||||
onStoreEnabled = { on -> SessionPrefs.setStoreEnabled(this, on); storeEnabled = on },
|
||||
onGameStoresEnabled = { on -> SessionPrefs.setGameStoresEnabled(this, on); gameStoresEnabled = on; if (on) com.droiddeck.launcher.stores.StoresState.refresh(this) },
|
||||
onGameStoresAddToSteam = { on -> SessionPrefs.setGameStoresAddToSteam(this, on); gameStoresAddToSteam = on },
|
||||
onGameStoresSpeedTier = { tier -> SessionPrefs.setGameStoresSpeedTier(this, tier); gameStoresSpeedTier = tier },
|
||||
onStoresOpenTab = { tab -> SessionPrefs.setStoresOpenTab(this, tab); storesOpenTab = tab },
|
||||
onLibraryChanged = { refreshAddedGames(); refresh() },
|
||||
|
||||
@@ -143,9 +143,8 @@ object AddedGames {
|
||||
|
||||
private fun scanGame(context: Context, folder: File, out: MutableList<Game>) {
|
||||
run {
|
||||
// A store install carries a sidecar; every one of them is a shortcut.
|
||||
val sidecar = StoreGameSidecar.read(folder)
|
||||
// A store install the user keeps out of Steam: not a shortcut, so not listed here.
|
||||
if (sidecar != null && !sidecar.addToSteam) return
|
||||
val candidates = candidates(folder)
|
||||
val picked = SessionPrefs.addedGameExe(context, folder.path)
|
||||
val chosen = picked.takeIf { it.isNotEmpty() }?.let { File(it) }?.takeIf { it.isFile }
|
||||
|
||||
@@ -60,13 +60,6 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("gameStoresEnabled", on).apply()
|
||||
}
|
||||
|
||||
/** Whether a game a store installs is added to the Steam client's library as a shortcut. On by default. */
|
||||
fun gameStoresAddToSteam(context: Context): Boolean = prefs(context).getBoolean("gameStoresAddToSteam", true)
|
||||
|
||||
fun setGameStoresAddToSteam(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("gameStoresAddToSteam", on).apply()
|
||||
}
|
||||
|
||||
/** The store download engine's speed tier (stores/download/StoreDownloadTier ids); Fast unless chosen otherwise. */
|
||||
fun gameStoresSpeedTier(context: Context): String = prefs(context).getString("gameStoresSpeedTier", "fast") ?: "fast"
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import java.io.File
|
||||
* the shortcut after the store's title and to tag the game with its [store]. [launcher] is the
|
||||
* small .bat the install writes when the game needs arguments or environment at launch (Epic's
|
||||
* identity arguments, Amazon's FuelPump variables): a Steam shortcut can only carry a fixed Exe,
|
||||
* so the launcher is what the shortcut runs and [exe] is what it starts. [addToSteam] off keeps
|
||||
* the game out of the client's library (Setup › Stores, or the game page's "Add to Steam").
|
||||
* so the launcher is what the shortcut runs and [exe] is what it starts. Every store install is a
|
||||
* Steam shortcut; there is no switch for it (an `addToSteam` field in an older sidecar is ignored).
|
||||
*
|
||||
* Paths are relative to the game folder with forward slashes, so the folder can move between
|
||||
* storage volumes and stay valid.
|
||||
@@ -28,7 +28,6 @@ class StoreGameSidecar(
|
||||
val env: Map<String, String> = emptyMap(),
|
||||
val installVersion: String = "",
|
||||
val installedAt: Long = 0L,
|
||||
val addToSteam: Boolean = true,
|
||||
val cover: String? = null,
|
||||
val hero: String? = null,
|
||||
/** Per-store identifiers the launcher needs again (Epic namespace / catalog id, Amazon entitlement). */
|
||||
@@ -40,9 +39,9 @@ class StoreGameSidecar(
|
||||
fun copy(
|
||||
exe: String = this.exe, launcher: String? = this.launcher, args: List<String> = this.args,
|
||||
env: Map<String, String> = this.env, installVersion: String = this.installVersion,
|
||||
installedAt: Long = this.installedAt, addToSteam: Boolean = this.addToSteam,
|
||||
cover: String? = this.cover, hero: String? = this.hero, extra: Map<String, String> = this.extra,
|
||||
) = StoreGameSidecar(store, id, title, exe, launcher, args, env, installVersion, installedAt, addToSteam, cover, hero, extra)
|
||||
installedAt: Long = this.installedAt, cover: String? = this.cover, hero: String? = this.hero,
|
||||
extra: Map<String, String> = this.extra,
|
||||
) = StoreGameSidecar(store, id, title, exe, launcher, args, env, installVersion, installedAt, cover, hero, extra)
|
||||
|
||||
fun toJson(): JSONObject = JSONObject().apply {
|
||||
put("version", VERSION)
|
||||
@@ -55,7 +54,6 @@ class StoreGameSidecar(
|
||||
if (env.isNotEmpty()) put("env", JSONObject(env as Map<*, *>))
|
||||
if (installVersion.isNotEmpty()) put("installVersion", installVersion)
|
||||
if (installedAt > 0L) put("installedAt", installedAt)
|
||||
put("addToSteam", addToSteam)
|
||||
if (!cover.isNullOrEmpty()) put("cover", cover)
|
||||
if (!hero.isNullOrEmpty()) put("hero", hero)
|
||||
if (extra.isNotEmpty()) put("extra", JSONObject(extra as Map<*, *>))
|
||||
@@ -102,7 +100,6 @@ class StoreGameSidecar(
|
||||
store, id, title, exe, launcher, args, env,
|
||||
installVersion = o.optString("installVersion", ""),
|
||||
installedAt = o.optLong("installedAt", 0L),
|
||||
addToSteam = o.optBoolean("addToSteam", true),
|
||||
cover = o.optString("cover", "").ifEmpty { null },
|
||||
hero = o.optString("hero", "").ifEmpty { null },
|
||||
extra = extra,
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.util.Log
|
||||
import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.frontend.LibraryCache
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
@@ -28,8 +27,7 @@ object StoreInstalls {
|
||||
*/
|
||||
fun complete(context: Context, folder: File, sidecar: StoreGameSidecar) {
|
||||
val app = context.applicationContext
|
||||
val withLauncher = StoreLaunch.writeLauncher(folder, sidecar)
|
||||
withLauncher.copy(addToSteam = sidecar.addToSteam && SessionPrefs.gameStoresAddToSteam(app)).write(folder)
|
||||
StoreLaunch.writeLauncher(folder, sidecar).write(folder)
|
||||
// The art first, so the listing written below already carries it for the client's grid.
|
||||
StoreArt.fetchInto(folder, sidecar)
|
||||
register(app)
|
||||
@@ -48,17 +46,6 @@ object StoreInstalls {
|
||||
}
|
||||
}
|
||||
|
||||
/** Flips whether the game is a Steam shortcut; the listing follows. Off the main thread. */
|
||||
fun setAddToSteam(context: Context, game: InstalledStoreGame, on: Boolean, onDone: () -> Unit) {
|
||||
val app = context.applicationContext
|
||||
Thread({
|
||||
game.sidecar.copy(addToSteam = on).write(game.folder)
|
||||
register(app)
|
||||
StoresState.logLine("${if (on) "added" else "removed"} Steam shortcut for \"${game.sidecar.title}\"")
|
||||
StoresState.post(onDone)
|
||||
}, "stores-steam-toggle").start()
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a store game: its folder with the sidecar, then the shortcut (the listing without
|
||||
* it makes the writer drop the entry; the live client is asked too). Blocking.
|
||||
|
||||
@@ -223,7 +223,7 @@ private fun ColumnScope.GameHeroCopy(g: Library.SteamGame, titleSize: androidx.c
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
SourceChip(g.source)
|
||||
Text(
|
||||
(lastPlayedText(g.lastPlayed) ?: libraryLabel(g.library)).uppercase(),
|
||||
(lastPlayedText(g.lastPlayed) ?: libraryLabel(g)).uppercase(),
|
||||
fontSize = 12.sp, fontWeight = FontWeight.SemiBold, letterSpacing = 1.2.sp, color = LocalPalette.current.signal,
|
||||
maxLines = 1, overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
@@ -336,11 +336,15 @@ private fun playedSpan(lastPlayed: Long): String? {
|
||||
).toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Where a never-played game lives, beside its source chip: Steam's library, the Games storage for
|
||||
* a store install (the chip names the store), "Custom game" for a folder the user added.
|
||||
*/
|
||||
@Composable
|
||||
private fun libraryLabel(library: String): String = when (library) {
|
||||
"internal" -> stringResource(R.string.games_internal)
|
||||
Library.ADDED -> stringResource(R.string.games_added)
|
||||
else -> library
|
||||
private fun libraryLabel(g: Library.SteamGame): String = when {
|
||||
g.library != Library.ADDED -> if (g.library == "internal") stringResource(R.string.games_internal) else g.library
|
||||
g.source != Library.ADDED -> stringResource(R.string.games_store_storage)
|
||||
else -> stringResource(R.string.games_custom)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,8 +131,6 @@ class FrontEndState(
|
||||
val storeEnabled: Boolean = false,
|
||||
/** The Stores section (GOG, Epic Games, Amazon Games), turned on in Setup. */
|
||||
val gameStoresEnabled: Boolean = false,
|
||||
/** Setup › Stores: a game a store installs is added to Steam's library as a shortcut. */
|
||||
val gameStoresAddToSteam: Boolean = true,
|
||||
/** Setup › Stores: the download engine's speed tier (stores/download/StoreDownloadTier ids). */
|
||||
val gameStoresSpeedTier: String = "fast",
|
||||
/** Setup › Stores: the tab a signed-in store opens on (SessionPrefs.STORES_OPEN_LIBRARY / STORE). */
|
||||
@@ -190,7 +188,6 @@ class FrontEndActions(
|
||||
val onAnimationsEnabled: (Boolean) -> Unit = {},
|
||||
val onStoreEnabled: (Boolean) -> Unit = {},
|
||||
val onGameStoresEnabled: (Boolean) -> Unit = {},
|
||||
val onGameStoresAddToSteam: (Boolean) -> Unit = {},
|
||||
val onGameStoresSpeedTier: (String) -> Unit = {},
|
||||
val onStoresOpenTab: (String) -> Unit = {},
|
||||
/** The Games list rebuilt now: a store install or removal changed what is on disk. */
|
||||
|
||||
@@ -373,11 +373,7 @@ internal fun SetupPanel(
|
||||
host, "stores-enabled", stringResource(R.string.setup_stores_show),
|
||||
stringResource(R.string.setup_stores_show_hint), s.gameStoresEnabled,
|
||||
) { a.onGameStoresEnabled(it) }
|
||||
ToggleRow(
|
||||
host, "stores-add-to-steam", stringResource(R.string.setup_stores_add_to_steam),
|
||||
stringResource(R.string.setup_stores_add_to_steam_hint), s.gameStoresAddToSteam,
|
||||
) { a.onGameStoresAddToSteam(it) }
|
||||
// The same three rows as the Stores page's own cog, for whoever looks here first.
|
||||
// The same rows as the Stores page's own cog, for whoever looks here first.
|
||||
SettingsRow(stringResource(R.string.setup_stores_open_on), stringResource(R.string.setup_stores_open_on_hint)) {
|
||||
SegmentedTabs(
|
||||
listOf(SessionPrefs.STORES_OPEN_LIBRARY to stringResource(R.string.stores_tab_library), SessionPrefs.STORES_OPEN_STORE to stringResource(R.string.stores_tab_store)),
|
||||
|
||||
@@ -39,7 +39,6 @@ import coil.compose.AsyncImage
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import com.droiddeck.launcher.stores.StoreInstalls
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import com.droiddeck.launcher.stores.download.DownloadState
|
||||
import com.droiddeck.launcher.stores.formatBytes
|
||||
@@ -84,10 +83,8 @@ internal fun StoreGameDetail(store: Store, key: String, s: FrontEndState, a: Fro
|
||||
when {
|
||||
installed != null -> {
|
||||
PrimaryButton(stringResource(R.string.games_launch), main = true, icon = Icons.Filled.PlayArrow, enabled = !s.busy) { launchStoreGame(ctx, store, id, s, a) }
|
||||
val inSteam = installed.sidecar.addToSteam
|
||||
SecondaryButton(if (inSteam) stringResource(R.string.stores_in_steam) else stringResource(R.string.stores_add_to_steam)) {
|
||||
StoreInstalls.setAddToSteam(ctx, installed, !inSteam) { StoresState.refresh(ctx); a.onLibraryChanged() }
|
||||
}
|
||||
// Every install is a shortcut; the chip just says so.
|
||||
ActionChip(stringResource(R.string.stores_in_steam), ok = true)
|
||||
s.steamGames.firstOrNull { it.source == store.id && it.storeId == id }?.protonPrefix?.takeIf { it.isDirectory }?.let { dir ->
|
||||
SecondaryButton(stringResource(R.string.games_prefix)) { a.onBrowseFiles(dir) }
|
||||
}
|
||||
@@ -146,12 +143,7 @@ internal fun StoreGameDetail(store: Store, key: String, s: FrontEndState, a: Fro
|
||||
Store.AMAZON -> stringResource(R.string.stores_kv_launched_by_amazon)
|
||||
Store.GOG -> stringResource(R.string.stores_kv_launched_by_value)
|
||||
})
|
||||
KeyValue(stringResource(R.string.stores_kv_steam), when {
|
||||
installed != null && installed.sidecar.addToSteam -> stringResource(R.string.stores_kv_steam_on)
|
||||
installed != null -> stringResource(R.string.stores_kv_steam_off)
|
||||
s.gameStoresAddToSteam -> stringResource(R.string.stores_kv_steam_on)
|
||||
else -> stringResource(R.string.stores_kv_steam_off)
|
||||
})
|
||||
KeyValue(stringResource(R.string.stores_kv_steam), stringResource(R.string.stores_kv_steam_on))
|
||||
}
|
||||
}
|
||||
if (wide) Row(horizontalArrangement = Arrangement.spacedBy(24.dp)) {
|
||||
|
||||
@@ -198,8 +198,9 @@ private fun SettingCard(label: String, note: String, control: @Composable () ->
|
||||
}
|
||||
|
||||
/**
|
||||
* The chip row's cog: the section's own settings in a small card - which tab a store opens on,
|
||||
* whether installs go to Steam, the speed tier. Setup › Stores repeats them under its gate.
|
||||
* The chip row's cog: the section's own settings in a small card - which tab a store opens on
|
||||
* and the speed tier. Setup › Stores repeats them under its gate. Every install is added to Steam;
|
||||
* that is not a choice.
|
||||
*/
|
||||
@Composable
|
||||
internal fun StoresSettingsDialog(s: FrontEndState, a: FrontEndActions, onDismiss: () -> Unit) {
|
||||
@@ -215,9 +216,6 @@ internal fun StoresSettingsDialog(s: FrontEndState, a: FrontEndActions, onDismis
|
||||
s.storesOpenTab,
|
||||
) { a.onStoresOpenTab(it) }
|
||||
}
|
||||
SettingsRow(stringResource(R.string.setup_stores_add_to_steam), stringResource(R.string.setup_stores_add_to_steam_hint)) {
|
||||
ToggleSwitch(s.gameStoresAddToSteam, label = stringResource(R.string.setup_stores_add_to_steam)) { a.onGameStoresAddToSteam(it) }
|
||||
}
|
||||
SettingsRow(stringResource(R.string.setup_stores_speed), stringResource(R.string.setup_stores_speed_hint)) {
|
||||
SegmentedTabs(StoreDownloadTier.ALL.map { it.id to stringResource(it.label) }, s.gameStoresSpeedTier) { a.onGameStoresSpeedTier(it) }
|
||||
}
|
||||
|
||||
@@ -926,6 +926,8 @@
|
||||
<string name="games_last_played">Last played %1$s</string>
|
||||
<string name="games_internal">Internal storage</string>
|
||||
<string name="games_added">Added game</string>
|
||||
<string name="games_custom">Custom game</string>
|
||||
<string name="games_store_storage">Games storage</string>
|
||||
<string name="gpu_auto_hint">The best pair for this GPU, kept up to date</string>
|
||||
<string name="gpu_manual_hint">Pick a pair yourself</string>
|
||||
<string name="gpu_checking">Checking for drivers…</string>
|
||||
@@ -1965,8 +1967,6 @@
|
||||
<string name="setup_stores">Stores</string>
|
||||
<string name="setup_stores_show">Show Stores in the rail</string>
|
||||
<string name="setup_stores_show_hint">GOG, Epic Games and Amazon Games libraries, with the download manager.</string>
|
||||
<string name="setup_stores_add_to_steam">Add installed store games to Steam</string>
|
||||
<string name="setup_stores_add_to_steam_hint">Creates a non-Steam shortcut so the game shows in Steam\'s Deck UI with Steam Input.</string>
|
||||
<string name="setup_stores_open_on">Open a store on</string>
|
||||
<string name="setup_stores_open_on_hint">Which tab a signed-in store opens when its chip is picked.</string>
|
||||
<string name="setup_stores_speed">Download speed tier</string>
|
||||
@@ -2029,7 +2029,6 @@
|
||||
<string name="stores_eyebrow_library">in your library</string>
|
||||
<string name="stores_eyebrow_store">store</string>
|
||||
<string name="stores_in_steam">✓ In Steam</string>
|
||||
<string name="stores_add_to_steam">Add to Steam</string>
|
||||
<string name="stores_uninstall">Uninstall</string>
|
||||
<string name="stores_uninstall_confirm">Press again to uninstall</string>
|
||||
<string name="stores_launch_not_registered">Steam picks the game up when it next starts; launch it from there, or start Steam now.</string>
|
||||
@@ -2052,8 +2051,7 @@
|
||||
<string name="stores_kv_launched_by_epic">Steam and Proton · Epic sign-in per launch, EOS overlay off</string>
|
||||
<string name="stores_kv_launched_by_amazon">Steam and Proton · Amazon Games Services variables set</string>
|
||||
<string name="stores_kv_steam">Steam</string>
|
||||
<string name="stores_kv_steam_on">shortcut added on install (Deck UI + Steam Input)</string>
|
||||
<string name="stores_kv_steam_off">no shortcut (Stores settings)</string>
|
||||
<string name="stores_kv_steam_on">added to Steam on install (Deck UI + Steam Input)</string>
|
||||
<string name="stores_downloads_empty">No downloads. Install something from a library.</string>
|
||||
<string name="stores_dl_paused">Paused</string>
|
||||
<string name="stores_dl_queued">Queued</string>
|
||||
|
||||
@@ -19,12 +19,12 @@ import org.robolectric.annotation.Config
|
||||
class AddedGamesStoreScanTest {
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
|
||||
private fun install(store: Store, id: String, title: String, exe: String, addToSteam: Boolean = true, launcher: Boolean = false): File {
|
||||
private fun install(store: Store, id: String, title: String, exe: String, launcher: Boolean = false): File {
|
||||
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
|
||||
val folder = File(StoreInstallRoot.storeDir(StoreInstallRoot.installRoot(app), store), StoreInstallRoot.folderName(title, id))
|
||||
File(folder, exe).apply { parentFile!!.mkdirs(); writeText("game") }
|
||||
File(folder, "unins000.exe").writeText("uninstaller")
|
||||
var sidecar = StoreGameSidecar(store, id, title, exe, addToSteam = addToSteam, args = if (launcher) listOf("-EpicPortal") else emptyList())
|
||||
var sidecar = StoreGameSidecar(store, id, title, exe, args = if (launcher) listOf("-EpicPortal") else emptyList())
|
||||
if (launcher) sidecar = StoreLaunch.writeLauncher(folder, sidecar)
|
||||
sidecar.write(folder)
|
||||
return folder
|
||||
@@ -51,9 +51,11 @@ class AddedGamesStoreScanTest {
|
||||
assertEquals(Store.EPIC.id, game.source)
|
||||
}
|
||||
|
||||
@Test fun aStoreGameKeptOutOfSteamIsNotListed() {
|
||||
val folder = install(Store.AMAZON, "amzn1.adg.product.x", "Yakuza 0", "Yakuza0.exe", addToSteam = false)
|
||||
assertTrue(AddedGames.scan(app).none { it.folder.absolutePath == folder.absolutePath })
|
||||
@Test fun anOlderSidecarsSteamSwitchIsIgnoredEveryInstallIsListed() {
|
||||
val folder = install(Store.AMAZON, "amzn1.adg.product.x", "Yakuza 0", "Yakuza0.exe")
|
||||
val file = StoreGameSidecar.file(folder)
|
||||
file.writeText(file.readText().replaceFirst("{", "{\"addToSteam\": false,"))
|
||||
assertTrue(AddedGames.scan(app).any { it.folder.absolutePath == folder.absolutePath })
|
||||
}
|
||||
|
||||
@Test fun theListingCarriesTheLauncherAndTheTitle() {
|
||||
|
||||
@@ -16,7 +16,7 @@ class StoreGameSidecarTest {
|
||||
private val sample = StoreGameSidecar(
|
||||
Store.EPIC, "abc123", "Celeste", "Celeste.exe", launcher = ".droiddeck-launch.bat",
|
||||
args = listOf("-EpicPortal", "-epicusername=\"Some One\""), env = mapOf("FOO" to "bar"),
|
||||
installVersion = "1.4.0", installedAt = 1700000000L, addToSteam = false, cover = "https://x/c.jpg",
|
||||
installVersion = "1.4.0", installedAt = 1700000000L, cover = "https://x/c.jpg",
|
||||
extra = mapOf("namespace" to "ns"),
|
||||
)
|
||||
|
||||
@@ -31,14 +31,13 @@ class StoreGameSidecarTest {
|
||||
assertEquals(sample.env, back.env)
|
||||
assertEquals("1.4.0", back.installVersion)
|
||||
assertEquals(1700000000L, back.installedAt)
|
||||
assertFalse(back.addToSteam)
|
||||
assertEquals("https://x/c.jpg", back.cover)
|
||||
assertEquals("ns", back.extra["namespace"])
|
||||
}
|
||||
|
||||
@Test fun defaultsWhenFieldsAreAbsent() {
|
||||
val back = StoreGameSidecar.parse("""{"store":"gog","id":"1","title":"T","exe":"bin\\game.exe"}""")!!
|
||||
assertTrue(back.addToSteam)
|
||||
val back = StoreGameSidecar.parse("""{"store":"gog","id":"1","title":"T","exe":"bin\\game.exe","addToSteam":false}""")!!
|
||||
// An older sidecar's Steam switch is read past, not acted on.
|
||||
assertEquals("bin/game.exe", back.exe)
|
||||
assertNull(back.launcher)
|
||||
assertTrue(back.args.isEmpty())
|
||||
|
||||
Reference in new issue
Block a user