mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
fix: Epic client imports get the launch command, versioned installs need a matching manifest build
Games the Epic client installed now carry their LaunchCommand arguments too, split by a new launch.split op. A doubled quote inside a quoted argument is one literal quote, and an install with a version ignores a manifest without the same build.
This commit is contained in:
1 parent
42026b382f
commit
b0e405ebf3
4 files changed
+20
-4
No files matched your search
@@ -251,7 +251,7 @@ internal object EpicClientLibrary {
|
||||
SessionPrefs.addedGameStoredAppId(app, oldFolder.path)?.let { SteamLiveShortcuts.remove(app, it) }
|
||||
changed = true
|
||||
}
|
||||
val next = StoreGameSidecar(
|
||||
val next = withLaunchArgs(StoreGameSidecar(
|
||||
Store.EPIC, appName, item.optString("DisplayName").ifEmpty { appName }, exe,
|
||||
installVersion = item.optString("AppVersionString"), installedAt = existing?.installedAt?.takeIf { it > 0 } ?: folder.lastModified(),
|
||||
cover = existing?.cover, hero = existing?.hero,
|
||||
@@ -260,7 +260,7 @@ internal object EpicClientLibrary {
|
||||
epic = existing?.epic ?: com.droiddeck.launcher.stores.EpicOptions(),
|
||||
cloud = existing?.cloud ?: true,
|
||||
launcher = StoreLaunch.LAUNCHER,
|
||||
)
|
||||
), commandArgs(item.optString("LaunchCommand")))
|
||||
val sidecarChanged = existing?.toJson()?.toString(2) != next.toJson().toString(2)
|
||||
val launcher = File(folder, StoreLaunch.LAUNCHER)
|
||||
if (sidecarChanged || runCatching { launcher.readText() }.getOrNull() != StoreLaunch.launcherText(next)) {
|
||||
@@ -328,6 +328,7 @@ internal object EpicClientLibrary {
|
||||
.put("CatalogItemId", record.optString("itemId"))
|
||||
.put("InstallLocation", dir)
|
||||
.put("LaunchExecutable", record.optString("launchExecutable"))
|
||||
.put("LaunchCommand", record.optString("launchCommand"))
|
||||
.put("AppVersionString", record.optString("version"))
|
||||
.put("SidecarDeploymentId", record.optJSONObject("sidecar")?.optString("deploymentId").orEmpty())
|
||||
.put("DisplayName", title?.takeIf(String::isNotBlank) ?: dir.substringAfterLast('/'))
|
||||
@@ -386,11 +387,17 @@ internal object EpicClientLibrary {
|
||||
val manifest = File(install.folder, ".egstore/$guid.manifest").takeIf { it.isFile } ?: return null
|
||||
val launch = EpicNative.inspect(manifest.readBytes(), JSONObject().put("op", "launch")) ?: return null
|
||||
val build = launch.optString("buildVersion")
|
||||
if (install.version.isNotEmpty() && build.isNotEmpty() && build != install.version) return null
|
||||
if (install.version.isNotEmpty() && build != install.version) return null
|
||||
val args = launch.optJSONArray("args") ?: return null
|
||||
return List(args.length()) { args.optString(it) }.filter { it.isNotEmpty() }
|
||||
}
|
||||
|
||||
private fun commandArgs(command: String): List<String> {
|
||||
if (command.isBlank()) return emptyList()
|
||||
val args = EpicNative.call("launch.split", JSONObject().put("command", command))?.optJSONArray("args") ?: return emptyList()
|
||||
return List(args.length()) { args.optString(it) }.filter { it.isNotEmpty() }
|
||||
}
|
||||
|
||||
internal fun withLaunchArgs(sidecar: StoreGameSidecar, args: List<String>): StoreGameSidecar {
|
||||
val previous = sidecar.extra[LAUNCH_ARGS]?.split('\n')?.filter { it.isNotEmpty() }.orEmpty()
|
||||
val kept = sidecar.args.filterNot { it in previous }
|
||||
|
||||
Reference in new issue
Block a user