mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
Xbox Cloud Gaming: stream from the store and Games tab, native player with DroidDeck frame generation (#1531)
Xbox Cloud Gaming: stream from the store and Games tab, native player with DroidDeck frame generation Stream Xbox games with Xbox Cloud Gaming (Game Pass) from DroidDeck, outside the Linux session. - Backend: `xodus-cli cloud-token` (tools/xbox/droiddeck-cloud-token.patch) gets the streaming tokens; they stay in memory. - Web player (default): the Greenlight player page (tools/xcloud-player, MIT) in a WebView, plus Microsoft's own xbox.com/play player. In-stream menu with screen effects (sharpen, colour, deband, FXAA, CRT, NTSC, Toon, fps cap), stream quality, performance overlay (level, layout, top right / top left) and rumble. - Native player (opt-in, Android 10+, Player engine: Native): Google's WebRTC (io.github.webrtc-sdk 125.6422.07, BSD) with the Greenlight protocol ported to Kotlin, in its own process (:xcloudnative) with its own instance of DroidDeck's compositor. Decoded frames reach the compositor as AHardwareBuffers (new stream mode, VK_ANDROID_external_memory_android_ hardware_buffer import), so DDFG 2x and LSFG 2x/3x/4x run on them. Live frame generation, frame-rate target (presets and a 10-165 fps slider, even pacing), zero-copy picture, small network buffer, fast decoder, instant controller input, overlay with engine and on-screen fps, background end, restart and web fallback. It takes the main process's tokens through XboxCloudTokenService; they are fetched ahead while a cloud game is shown. - The compositor requests the dma-buf import extensions only where the driver has them (the system driver has none). - Catalog: cloud availability, Game Pass plan CFQ7TTC0K6L8 counted, library filter All / Owned / Game Pass / Cloud, Stream and Add to Games on the store page, stream-only Games-tab entries (Stream + Download / Play + Stream). - Xbox games get VC++ 2015-2022 and the ARM64 runtime registry entries (vcredist2022_arm64, built in until the catalog has it) before each launch. - Controller focus reaches pickers opened from a game page (install location, uninstall); Add / Remove from Games keep the focus. Credits: Greenlight by UnknownSKL (Jim Kroon), MIT, player and protocol; Better xCloud for the resolution / OS mapping; MGamer404's Bannerlator #627 for the ARM64 runtime approach. Ported from the412banner's Bannerlator.
This commit is contained in:
1 parent
5ca1f610ab
commit
c5d7cdc058
78 files changed
+7835
-45
No files matched your search
@@ -56,6 +56,17 @@ class WinCompSourcesTest {
|
||||
assertEquals(emptyList<String>(), WinCompSources.epic("Installers/LauncherHelper.exe", "Launcher Helper"))
|
||||
}
|
||||
|
||||
@Test fun xboxGamesAlwaysGetVisualCppAndTheirDeclaredRuntimes() {
|
||||
val folder = tmp.newFolder("xbox")
|
||||
val vc = listOf("vcredist2022" to "VC14", "vcredist2022_arm64" to "VC14")
|
||||
assertEquals(vc, WinCompSources.xbox(folder))
|
||||
File(folder, "MicrosoftGame.Config").writeText("""<Game><DesktopRegistration><DependencyList><KnownDependency Name="VC14"/></DependencyList></DesktopRegistration></Game>""")
|
||||
assertEquals(vc, WinCompSources.xbox(folder))
|
||||
sidecar(folder, Store.XBOX, emptyMap())
|
||||
assertEquals(listOf("vcredist2022" to WinCompSources.Origin.XBOX, "vcredist2022_arm64" to WinCompSources.Origin.XBOX),
|
||||
auto(WinCompSources.forGame(app, game(folder, Store.XBOX.id))).distinct())
|
||||
}
|
||||
|
||||
@Test fun steamworksSharedDepotsMapToComponents() {
|
||||
assertEquals(listOf("vcredist2015_dll" to "VC++ 2015", "d3dx9" to "DirectX (June 2010)"), WinCompSources.steamDepots(listOf("228986", "228990", "999")))
|
||||
}
|
||||
|
||||
@@ -31,6 +31,14 @@ class WinComponentsSupportTest {
|
||||
step("install_msi", "url" to "$base/ps-x86.msi"), step("install_msi", "url" to "$base/ps-x64.msi"))))
|
||||
}
|
||||
|
||||
@Test fun builtInArm64RuntimeIsRegistryOnlyInBothViews() {
|
||||
val c = WinComponents.builtInArm64Runtime()
|
||||
assertEquals(Support.READY, support(c))
|
||||
assertEquals(12, c.steps.count { it.action == "set_register_key" })
|
||||
assertEquals(setOf("HKLM\\Software\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\arm64",
|
||||
"HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\arm64"), c.steps.map { it.str("key") }.toSet())
|
||||
}
|
||||
|
||||
@Test fun installerWrappersInstallHere() {
|
||||
assertEquals(Support.READY, support(component("vcredist2022",
|
||||
step("install_exe", "url" to "$base/vcredist2022__VC_redist.x86.exe", "file_name" to "VC_redist.x86.exe"),
|
||||
|
||||
@@ -83,13 +83,14 @@ class XboxCatalogTest {
|
||||
assertEquals(mapOf(game to "gamepass", parent to "gamepass"), access(row(game, parent), row(parent, plan), row(plan)))
|
||||
}
|
||||
|
||||
@Test fun onlyPcPlansGrantSubscriptionAccess() {
|
||||
for (pc in listOf("CFQ7TTC0KGQ8", "CFQ7TTC0KHS0", "CFQ7TTC0P85B", "CFQ7TTC0K5DJ", "CFQ7TTC10QFD")) {
|
||||
assertEquals(mapOf(game to "gamepass"), access(row(game, pc), row(pc)))
|
||||
@Test fun everyActivePlanGrantsSubscriptionAccess() {
|
||||
for (plan in listOf("CFQ7TTC0KGQ8", "CFQ7TTC0KHS0", "CFQ7TTC0P85B", "CFQ7TTC0K5DJ", "CFQ7TTC10QFD", "CFQ7TTC0K6L8")) {
|
||||
assertEquals(mapOf(game to "gamepass"), access(row(game, plan), row(plan)))
|
||||
}
|
||||
val console = "CFQ7TTC0K6L8"
|
||||
assertTrue(access(row(game, console), row(console)).isEmpty())
|
||||
assertTrue(XboxCatalog.access(withMembership(envelope(row(game, console)), membership(console)),
|
||||
assertEquals(mapOf(game to "gamepass"), XboxCatalog.access(withMembership(envelope(row(game, console)), membership(console)),
|
||||
"test@example.test", "US", now))
|
||||
assertTrue(XboxCatalog.access(withMembership(envelope(row(game, console)), membership(console).put("status", "Expired")),
|
||||
"test@example.test", "US", now).isEmpty())
|
||||
}
|
||||
|
||||
@@ -165,4 +166,29 @@ class XboxCatalogTest {
|
||||
assertEquals(game, XboxCatalog.product(product("Windows.Desktop", "MSIXVC").put("ProductId", game.lowercase()), mapOf(game to "owned"))!!.id)
|
||||
assertTrue(pc.accessible); assertTrue(pc.subscription); assertFalse(pc.owned)
|
||||
}
|
||||
|
||||
private fun product(id: String, platform: String?) = JSONObject().put("ProductId", id).put("ProductType", "Game")
|
||||
.put("LocalizedProperties", JSONArray().put(JSONObject().put("ProductTitle", "A Game")))
|
||||
.put("DisplaySkuAvailabilities", JSONArray().put(JSONObject().put("Sku", JSONObject().put("Properties", JSONObject()
|
||||
.put("Packages", if (platform == null) JSONArray() else JSONArray().put(JSONObject().put("PackageFormat", "MSIXVC")
|
||||
.put("PlatformDependencies", JSONArray().put(JSONObject().put("PlatformName", platform)))))))))
|
||||
|
||||
@Test fun cloudListsKeepStreamOnlyGamesAndMarkStreamablePcGames() {
|
||||
val cloud = XboxCloudCatalog(gamePass = setOf(game), all = setOf(game, parent))
|
||||
val pc = XboxCatalog.product(product(game, "Windows.Desktop"), mapOf(game to "gamepass"), cloud)!!
|
||||
assertTrue(pc.xboxPc); assertTrue(pc.xboxCloud)
|
||||
val consoleOnly = XboxCatalog.product(product(parent, "Xbox.One"), mapOf(parent to "owned"), cloud)!!
|
||||
assertFalse(consoleOnly.xboxPc); assertTrue(consoleOnly.xboxCloud); assertEquals(0L, consoleOnly.sizeBytes)
|
||||
assertNull(XboxCatalog.product(product(parent, "Xbox.One"), mapOf(parent to "gamepass"), cloud))
|
||||
assertNull(XboxCatalog.product(product(parent, "Xbox.One"), mapOf(parent to "owned"), null))
|
||||
assertFalse(XboxCatalog.product(product(game, "Windows.Desktop"), mapOf(game to "gamepass"), null)!!.xboxCloud)
|
||||
}
|
||||
|
||||
@Test fun aCloudOnlyEditionFoldsIntoThePcCardWithTheSameTitle() {
|
||||
val cloud = XboxCloudCatalog(gamePass = setOf(parent), all = emptySet())
|
||||
val pc = XboxCatalog.product(product(game, "Windows.Desktop"), mapOf(game to "gamepass"), cloud)!!
|
||||
val console = XboxCatalog.product(product(parent, "Xbox.One"), mapOf(parent to "gamepass"), cloud)!!
|
||||
val merged = mergeEditions(listOf(pc, console)).single()
|
||||
assertEquals(game, merged.id); assertTrue(merged.xboxPc); assertTrue(merged.xboxCloud); assertEquals(parent, merged.xboxCloudId)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.droiddeck.launcher.stores.xbox
|
||||
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
|
||||
@org.junit.runner.RunWith(org.robolectric.RobolectricTestRunner::class)
|
||||
@org.robolectric.annotation.Config(sdk = [33], application = android.app.Application::class)
|
||||
class XboxCloudTest {
|
||||
@Test fun settingsRoundTripAndOutOfRangeValuesAreClamped() {
|
||||
val settings = XboxCloudSettings(resolution = "720p", bitrateMbps = 20, volume = 200, sharpen = 4, fxaa = true, statsCorner = "left",
|
||||
playerEngine = "native", frameGen = "lsfg3", fpsLimit = 120, fpsCustomOn = true, fpsCustom = 90, smallBuffer = true, zeroCopy = true)
|
||||
assertEquals(settings, XboxCloudSettings.decode(settings.toJson()))
|
||||
val wild = XboxCloudSettings.decode("""{"resolution":"4k","codec":"x","bitrateMbps":900,"volume":5,"statsLevel":9,"gamma":40}""")
|
||||
assertEquals("1080p", wild.resolution); assertEquals("default", wild.codec); assertEquals(100, wild.bitrateMbps)
|
||||
assertEquals(100, wild.volume); assertEquals(4, wild.statsLevel); assertEquals(3f, wild.gamma)
|
||||
assertEquals("right", XboxCloudSettings.decode("""{"statsCorner":"middle"}""").statsCorner)
|
||||
assertEquals("ddfg", XboxCloudSettings.decode("""{"frameGen":"winfg"}""").frameGen)
|
||||
assertEquals(0, XboxCloudSettings.decode("""{"fpsLimit":77,"fpsCustom":500}""").fpsLimit)
|
||||
assertEquals(165, XboxCloudSettings.decode("""{"fpsCustomOn":true,"fpsCustom":500}""").fpsTarget)
|
||||
assertEquals(XboxCloudSettings(), XboxCloudSettings.decode("not json"))
|
||||
assertEquals("android", XboxCloudSettings(resolution = "720p").osName)
|
||||
assertEquals("tizen", XboxCloudSettings(resolution = "1080p_hq").osName)
|
||||
}
|
||||
|
||||
@Test fun addedCloudGamesKeepValidRowsOnly() {
|
||||
val list = listOf(XboxCloudGames.Entry("9AAAAAAAAAAA", "A game", "https://store-images.s-microsoft.com/p", null))
|
||||
val decoded = XboxCloudGames.decode(XboxCloudGames.encode(list))
|
||||
assertEquals(1, decoded.size); assertEquals("A game", decoded[0].title); assertNull(decoded[0].hero)
|
||||
assertTrue(XboxCloudGames.decode("""[{"id":"bad","title":"x"},{"id":"9BBBBBBBBBBB","title":""}]""").isEmpty())
|
||||
assertTrue(XboxCloudGames.decode("nope").isEmpty())
|
||||
assertTrue(XboxCloudGames.rowId("9AAAAAAAAAAA") < 0)
|
||||
}
|
||||
|
||||
@Test fun libraryFilterSplitsOwnedGamePassAndCloud() {
|
||||
fun item(owned: Boolean, pass: Boolean, cloud: Boolean) = CatalogItem(Store.XBOX, "9AAAAAAAAAAA", "A", null,
|
||||
owned = owned, subscription = pass, extra = mapOf("cloud" to if (cloud) "1" else "0"))
|
||||
val owned = item(true, false, false); val pass = item(false, true, true)
|
||||
assertTrue(XboxLibraryFilter.keeps(XboxLibraryFilter.ALL, owned))
|
||||
assertTrue(XboxLibraryFilter.keeps(XboxLibraryFilter.OWNED, owned)); assertFalse(XboxLibraryFilter.keeps(XboxLibraryFilter.OWNED, pass))
|
||||
assertTrue(XboxLibraryFilter.keeps(XboxLibraryFilter.GAME_PASS, pass)); assertFalse(XboxLibraryFilter.keeps(XboxLibraryFilter.GAME_PASS, owned))
|
||||
assertTrue(XboxLibraryFilter.keeps(XboxLibraryFilter.CLOUD, pass)); assertFalse(XboxLibraryFilter.keeps(XboxLibraryFilter.CLOUD, owned))
|
||||
}
|
||||
|
||||
@Test fun cloudLaunchUrlUsesTheStreamingEdition() {
|
||||
assertEquals("https://www.xbox.com/play/launch/ball-x-pit/9BBBBBBBBBBB", XboxCatalog.cloudUrl("9AAAAAAAAAAA", "BALL x PIT", "9BBBBBBBBBBB"))
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class XboxLibraryCacheTest {
|
||||
private fun game(id: String, subscription: Boolean) = CatalogItem(Store.XBOX, id, "A game", "https://example.test/hero",
|
||||
tallImageUrl = "https://example.test/poster", description = "Description", developer = "Developer", publisher = "Publisher",
|
||||
sizeBytes = 12345, owned = !subscription, subscription = subscription, storeUrl = "https://www.xbox.com/games/store/$id",
|
||||
extra = mapOf("market" to "US", "access" to if (subscription) "gamepass" else "owned"))
|
||||
extra = mapOf("market" to "US", "access" to if (subscription) "gamepass" else "owned", "pc" to "1", "cloud" to "0", "cloudId" to ""))
|
||||
|
||||
@Test fun restartRestoresMetadataWithoutTurningSubscriptionsIntoPurchases() {
|
||||
val games = listOf(game("9AAAAAAAAAAA", false), game("9BBBBBBBBBBB", true))
|
||||
@@ -28,7 +28,7 @@ class XboxLibraryCacheTest {
|
||||
val text = XboxLibraryCache.encode(account, "US", listOf(game("9AAAAAAAAAAA", false)), now)
|
||||
assertNull(XboxLibraryCache.decode(text, "other@example.test", "US", now))
|
||||
assertNull(XboxLibraryCache.decode(text, account, "GB", now))
|
||||
assertNull(XboxLibraryCache.decode(text.replace("\"schema\":1", "\"schema\":2"), account, "US", now))
|
||||
assertNull(XboxLibraryCache.decode(text.replace("\"schema\":2", "\"schema\":1"), account, "US", now))
|
||||
assertNull(XboxLibraryCache.decode("invalid", account, "US", now))
|
||||
assertNull(XboxLibraryCache.decode(text, account, "US", now - 120_000))
|
||||
}
|
||||
@@ -50,4 +50,13 @@ class XboxLibraryCacheTest {
|
||||
XboxLibraryCache.clear(app)
|
||||
assertNull(XboxLibraryCache.read(app, account, "US"))
|
||||
}
|
||||
|
||||
@Test fun cloudFlagsAndTheStreamingEditionSurviveARestart() {
|
||||
val stream = game("9CCCCCCCCCCC", true).copy(extra = mapOf("market" to "US", "access" to "gamepass", "pc" to "0", "cloud" to "1", "cloudId" to ""))
|
||||
val folded = game("9AAAAAAAAAAA", true).copy(extra = mapOf("market" to "US", "access" to "gamepass", "pc" to "1", "cloud" to "1", "cloudId" to "9DDDDDDDDDDD"))
|
||||
val cached = XboxLibraryCache.decode(XboxLibraryCache.encode(account, "US", listOf(stream, folded), now), account, "US", now)!!
|
||||
assertEquals(listOf(stream, folded), cached.games)
|
||||
assertFalse(cached.games[0].xboxPc); assertTrue(cached.games[0].xboxCloud)
|
||||
assertEquals("9DDDDDDDDDDD", cached.games[1].xboxCloudId)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user