mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(bionic): name guest files by their Android paths in store launches
DroidDeck-Bionic's Wine has Android's root on Z:, but DroidDeck's store launch files and helpers name guest files by guest Z: paths. A Ubisoft game then skipped its service and started directly (Watch_Dogs exited at launch); the Epic parent stand-in, GOG/Rockstar registry values, reg.exe imports and the EA probe pointed at the wrong tree in the same way. Reported by 2-Shar on PR #3037. - proton: map guest Z: paths in every run argument (also NAME=Z:..., as in an installer's /DIR=) and export DROIDDECK_GUEST_ROOT, the guest's root as this Wine names it; launch.sh keeps it. - StoreLaunch: the Ubisoft service and the Epic parent stand-in start from %DD_R% (DROIDDECK_GUEST_ROOT, else Z:). An installed Ubisoft game's older launch file is rewritten at the next library scan. - droiddeck-store-launch: windows_path() asks DroidDeck-Bionic's getcompatpath when that tool runs the game. - droiddeck-gog-maintenance: name the tool for the registry step.
This commit is contained in:
1 parent
2aae4b2284
commit
f17d3ddaad
9 files changed
+194
-14
No files matched your search
@@ -12,8 +12,11 @@ object StoreLaunch {
|
||||
const val EPIC_CODE = ".droiddeck-epic-code"
|
||||
const val EPIC_ARGS = ".droiddeck-epic-args"
|
||||
const val UBISOFT_LAUNCH = ".droiddeck-ubisoft.json"
|
||||
private const val UBISOFT_SERVICE = "Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe"
|
||||
const val EPIC_PARENT = "Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe"
|
||||
/** DroidDeck-Bionic's Wine has Android's root on Z:; that tool sets this to the guest's root as its Wine names it. */
|
||||
const val GUEST_ROOT = "DROIDDECK_GUEST_ROOT"
|
||||
private const val ROOT_VAR = "DD_R"
|
||||
private const val UBISOFT_SERVICE = "%$ROOT_VAR%\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe"
|
||||
const val EPIC_PARENT = "%$ROOT_VAR%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe"
|
||||
/** Per-game environment switch: 1 starts any Epic game under [EPIC_PARENT], 0 never does. */
|
||||
const val EPIC_PARENT_SWITCH = "DD_EPIC_PARENT"
|
||||
/** Epic app names whose launchers treat the game as unowned unless a process named EpicGamesLauncher.exe started it. */
|
||||
@@ -47,6 +50,10 @@ object StoreLaunch {
|
||||
for ((k, v) in sidecar.env) if (ENV_NAME.matches(k)) lines += "set \"$k=${v.replace("\"", "")}\""
|
||||
val args = sidecar.args.joinToString(" ") { if (sidecar.store == Store.ROCKSTAR) batchArg(it) else quoteArg(it) }
|
||||
val run = "\"%~dp0$exe\"" + (if (args.isNotEmpty()) " $args" else "")
|
||||
if (sidecar.store == Store.EPIC || sidecar.store == Store.UBISOFT) {
|
||||
lines += "set \"$ROOT_VAR=Z:\""
|
||||
lines += "if defined $GUEST_ROOT set \"$ROOT_VAR=%$GUEST_ROOT%\""
|
||||
}
|
||||
if (sidecar.store == Store.EPIC) {
|
||||
lines += "set \"$PARENT_VAR=${if (sidecar.id in EPIC_PARENT_TITLES) "1" else ""}\""
|
||||
lines += "if \"%$EPIC_PARENT_SWITCH%\"==\"1\" set \"$PARENT_VAR=1\""
|
||||
@@ -137,7 +144,6 @@ object StoreLaunch {
|
||||
if (sidecar.store !in listOf(Store.UBISOFT, Store.ROCKSTAR) || !sidecar.isInstalled) return sidecar
|
||||
if (sidecar.store == Store.ROCKSTAR && java.nio.file.Files.isSymbolicLink(File(folder, LAUNCHER).toPath())) return sidecar.copy(launcher = null)
|
||||
val wrongExe = !sidecar.exeFile(folder).isFile || sidecar.exe.contains("installer", ignoreCase = true) || sidecar.exe.contains("autorun", ignoreCase = true)
|
||||
if (sidecar.store == Store.UBISOFT && sidecar.launcher == LAUNCHER && !wrongExe) return sidecar
|
||||
val metadataExe = if (sidecar.store == Store.ROCKSTAR) com.droiddeck.launcher.stores.rockstar.RockstarMetadata.find(folder)?.exe
|
||||
?.takeIf { File(folder, it).isFile && File(folder, it).canonicalPath.startsWith(folder.canonicalPath + File.separator) } else null
|
||||
val exe = metadataExe ?: if (wrongExe) StoreExe.pick(folder, null, sidecar.title).ifEmpty { sidecar.exe } else sidecar.exe
|
||||
|
||||
@@ -168,8 +168,8 @@ class StoreGameSidecarTest {
|
||||
"if \"%DD_EPIC_PARENT%\"==\"1\" set \"DD_P=1\"",
|
||||
"if \"%DD_EPIC_PARENT%\"==\"0\" set \"DD_P=\"",
|
||||
"if defined DD_P set \"SteamAppId=\"",
|
||||
"if defined DD_P if not exist \"Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\" set \"DD_P=\"",
|
||||
"if defined DD_P set DD_P=\"Z:\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\"",
|
||||
"if defined DD_P if not exist \"%DD_R%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\" set \"DD_P=\"",
|
||||
"if defined DD_P set DD_P=\"%DD_R%\\usr\\local\\lib\\droiddeck-epic\\EpicGamesLauncher.exe\"",
|
||||
)
|
||||
|
||||
@Test fun epicTitlesThatCheckTheirParentStartUnderTheStandIn() {
|
||||
|
||||
@@ -105,11 +105,28 @@ class UbisoftTest {
|
||||
val text = StoreLaunch.launcherText(StoreGameSidecar(Store.UBISOFT, "space-sc", "Splinter Cell", "system/SplinterCell.exe"))
|
||||
val lines = text.trimEnd().split("\r\n")
|
||||
assertTrue(lines.contains("if not exist \"%~dp0.droiddeck-ubisoft.json\" goto direct"))
|
||||
assertTrue(lines.contains("\"Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" \"%~dp0.droiddeck-ubisoft.json\""))
|
||||
val service = lines.indexOf("\"%DD_R%\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" \"%~dp0.droiddeck-ubisoft.json\"")
|
||||
assertTrue(service in 0 until lines.indexOf(":direct"))
|
||||
assertTrue(lines.indexOf("set \"DD_R=Z:\"") in 0 until lines.indexOf("if defined DROIDDECK_GUEST_ROOT set \"DD_R=%DROIDDECK_GUEST_ROOT%\""))
|
||||
assertTrue(lines.indexOf("if defined DROIDDECK_GUEST_ROOT set \"DD_R=%DROIDDECK_GUEST_ROOT%\"") < service)
|
||||
assertEquals("\"%~dp0system\\SplinterCell.exe\"", lines.last())
|
||||
assertTrue(lines.indexOf(":direct") < lines.lastIndex)
|
||||
}
|
||||
|
||||
@Test fun anInstalledGamesOlderLauncherIsRewritten() {
|
||||
val folder = java.nio.file.Files.createTempDirectory("ubisoft-adopt").toFile()
|
||||
try {
|
||||
File(folder, "system").mkdirs()
|
||||
File(folder, "system/SplinterCell.exe").writeText("exe")
|
||||
val sidecar = StoreGameSidecar(Store.UBISOFT, "space-sc", "Splinter Cell", "system/SplinterCell.exe", launcher = StoreLaunch.LAUNCHER)
|
||||
File(folder, StoreLaunch.LAUNCHER).writeText("@echo off\r\nif not exist \"Z:\\usr\\local\\lib\\droiddeck-ubisoft\\droiddeck-upc.exe\" goto direct\r\n")
|
||||
StoreLaunch.adopt(folder, sidecar)
|
||||
assertEquals(StoreLaunch.launcherText(sidecar), File(folder, StoreLaunch.LAUNCHER).readText())
|
||||
} finally {
|
||||
folder.deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun activationPayloadsSurviveTheHexHop() {
|
||||
val bytes = byteArrayOf(0, 1, 0x7f, -1, -128, 42)
|
||||
assertEquals("00017fff802a", UbisoftActivation.hex(bytes))
|
||||
|
||||
Reference in new issue
Block a user