mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
fix(xbox): hand Xodus a launch folder the Linux guest can see (#2751)
* fix(xbox): log and show why an Xbox launch could not be prepared * fix(xbox): hand Xodus a launch folder the Linux guest can see --------- Co-authored-by: Zeratullo <8460122+Zeratullo@users.noreply.github.com>
This commit is contained in:
1 parent
c8b291b9db
commit
c7cd2b55af
4 files changed
+19
-3
No files matched your search
@@ -58,7 +58,11 @@ object StoreLaunchRequests {
|
||||
}
|
||||
"xbox-renew" -> JSONObject().put("ok", com.droiddeck.launcher.stores.xbox.XboxRuntime.renew(app, request.optString("id"), request.optString("lease")))
|
||||
"xbox-prepare" -> runCatching { com.droiddeck.launcher.stores.xbox.XboxRuntime.prepare(app, request.getString("id")) }
|
||||
.getOrElse { JSONObject().put("ok", false).put("reason", "Xbox account service is unavailable. Sign in again and retry.") }
|
||||
.getOrElse {
|
||||
StoresState.logLine("Xbox: launch prepare failed (${it.javaClass.simpleName}: ${it.message})")
|
||||
val reason = (it as? IllegalStateException)?.message ?: "Xbox account service is unavailable. Sign in again and retry."
|
||||
JSONObject().put("ok", false).put("reason", reason)
|
||||
}
|
||||
"ea-prepare" -> runCatching { lastLaunched = Store.EA to request.optString("id"); com.droiddeck.launcher.stores.ea.EaLaunch.prepare(app, request) }
|
||||
.getOrElse { JSONObject().put("ok", false).put("reason", "error-" + it.javaClass.simpleName) }
|
||||
"ea-exited" -> {
|
||||
|
||||
@@ -18,7 +18,8 @@ internal class XboxLaunchViews {
|
||||
parent.listFiles()?.filter { it.name.startsWith("launch-") }?.forEach(::remove)
|
||||
recovered.add(parent.path)
|
||||
}
|
||||
return Files.createTempDirectory(parent.toPath(), "launch-").toFile()
|
||||
// The guest binds the files directory by the path Android reports, not its canonical one.
|
||||
return File(files, "xbox-runtime/views/" + Files.createTempDirectory(parent.toPath(), "launch-").fileName)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -50,4 +50,15 @@ class XboxLaunchViewsTest {
|
||||
assertEquals("preserve", evidence.readText())
|
||||
} finally { root.deleteRecursively() }
|
||||
}
|
||||
|
||||
@Test fun viewsKeepTheFilesPathTheGuestBinds() {
|
||||
val root = Files.createTempDirectory("xbox-view-alias").toFile()
|
||||
try {
|
||||
val real = root.resolve("data/data/app/files").apply { mkdirs() }
|
||||
val alias = root.resolve("user0").also { Files.createSymbolicLink(it.toPath(), real.parentFile!!.toPath()) }.resolve("files")
|
||||
val view = XboxLaunchViews().create(alias)
|
||||
assertEquals(alias.resolve("xbox-runtime/views").path, view.parentFile!!.path)
|
||||
assertTrue(real.resolve("xbox-runtime/views").resolve(view.name).isDirectory)
|
||||
} finally { root.deleteRecursively() }
|
||||
}
|
||||
}
|
||||
@@ -390,7 +390,7 @@ def launch(command, env):
|
||||
raise RuntimeError('No Xbox account channel; start the game from DroidDeck')
|
||||
reply = store['ask'](Path(launch_dir) / 'stores', {'op': 'xbox-prepare', 'id': sidecar['id']}, timeout=190)
|
||||
if not reply or not reply.get('ok'):
|
||||
raise RuntimeError('Xbox account service is unavailable; sign in again and retry')
|
||||
raise RuntimeError((reply or {}).get('reason') or 'Xbox account service is unavailable; sign in again and retry')
|
||||
stopped = threading.Event()
|
||||
close = lambda: None
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user