mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
feat(xbox): install legacy EAppx titles through Windows Update (on main) (#2825)
* feat(xbox): install legacy EAppx titles through Windows Update A legacy Store title does not ship as MSIXVC. It ships as an encrypted EAppx bundle, which streaming rejects, so the store could list the game and never install it. Accept EAPPX and EAPPXBUNDLE beside MSIXVC, carry the format through the catalogue, the install record and the cached library, and dispatch legacy-install for those formats. Two backend patches do the work: - droiddeck-legacy-packages.patch lets the plan, license and extract verbs handle a legacy package, and expands a bundle in place (nesting bounded at three), decrypting each inner EAppx with the same keys. - droiddeck-legacy-install.patch adds legacy-install: resolve, license, download, extract, hoist AppxManifest.xml to the game root. Resolution asks the Xbox content service first and Windows Update second, because some legacy products return no files from the content service at all. The WU endpoint needs no Xbox credential but chains to Microsoft's ECC Product Root CA 2018, which Android's CA bundle does not carry, so that one public root is pinned for those requests. The manifest reader accepts AppxManifest.xml as well as MicrosoftGame.config, since a legacy package carries only the former. Running it against a real title exposed four things that only show up at full size: - A licence names a key by its 16-byte content id, while a bundle header names it as a (content id, package id) pair. Reading the 16-byte id yields a different pair, so a complete key file reported every key missing and no bundle could be opened. Keys are now aligned against the header's own ids before the header is judged. - Windows Update answers with several updates whose PackageContentId differs from the bundle's own. Licensing used to take the first and fail with content-http 400; every candidate is now tried in order, preferring the one the container is named after. - A container already in .xodus-container is reused rather than fetched again, so a failed run does not cost another download of tens of gigabytes. The space preflight no longer counts a container twice for the same reason. - A bundle that carries add-on packages unpacks each into its own folder, leaving the manifest one level down. Hoisting lifts the largest folder that holds a manifest, so the game still lands at the root beside its add-ons. Unpacking now reports bytes written, so the install bubble fills while a package is decrypted instead of holding a single unchanging word. * fix(xbox): unpack a legacy package across cores and report the bytes Unpacking one title ran as a single thread on a saturated core at about 40 MB/s. Files sit at independent offsets, so each worker now opens its own handle and takes every Nth file, with a 1 MiB read buffer in place of the 8 KiB default that turned one 64 KiB block into eight reads. Measured on the Forza Horizon 4 bundle, writes went from 40 MB/s to about 200 MB/s. Two things the first full-size run exposed: - The container was deleted only after the whole nested tree was unpacked, so a title that holds its package as one member held the archive and the decrypted copy at once. On this device that runs out of space partway through the second stage. The container is now deleted once its members are on disk, which frees the archive before they are decrypted. - A bundle member is written as a single file, so a counter that advances when a file finishes stays at zero for the whole of the longest stage. The reported figure now also follows the growth of the destination while that is the case, and never moves backwards when the container is freed. Progress is exact during the per-file stage: each file's declared length is added as it lands, instead of walking the whole destination every tick. * docs(xbox): record the completed legacy install The evidence section said a finished legacy install and its decrypted contents were unverified, because the first run was still unpacking when it was written. That install has now completed on the same device: the 85,219,173,025-byte container produced 79.3 GB at the game root with AppxManifest.xml and the package DLLs directly beneath it, and the launcher lists the title as installed. It also records what unpacking costs, since that decided the change: one thread held a core at 100% for about 40 MB/s and four reach about 200 MB/s, and releasing each container once its members are on disk is what keeps the peak footprint at one package rather than the archive plus its contents. The launch is not part of this evidence, and the entry says so. * fix(xbox): place the 64-bit framework beside a legacy title A Windows Update framework category lists one package per architecture under identifier-only names. The first package was unpacked, which on this device was the x86 build, so a 64-bit title got 32-bit DLLs and every load failed with STATUS_INVALID_IMAGE_FORMAT. Candidates are unpacked now and only the one whose manifest declares ProcessorArchitecture="x64" is kept. The framework folder was also never created, so a finished download failed at the move with "no such file or directory". unzip.rs belongs to this patch: legacy-install calls it and the recipe left it out, so a rebuild from the pinned source could not compile. * feat(xbox): report a UWP entry point at launch An unpacked package can name a COM class as its entry point instead of Windows.FullTrustApplication. That class is a UWP application, which expects the app model to activate a view; Wine has no host for it, so the launch died inside the loader with no explanation. The launch now reads the entry point and reports uwp-entry-point, and full-trust packages are unaffected. Forza Horizon 4 is such a package: its manifest names Forza.App. Its frameworks are installed and the loader is clean before that point. * fix(xbox): report why a launch was refused A failed prepare replaced the backend message with a fixed sign-in hint, so a title that was not installed or a runtime that refused all read as a bad account. The reason is kept, with paths and URLs dropped, and written to the store log. * fix(adb): dismiss the keyboard on Search and Go Search and Go were terminal IME actions but were not handled, so focus stayed in the field and the keyboard covered the results it had just fetched. * fix(xbox): keep a cache row without a legacy format plain Decoding added a format key with an empty value to every cached title, so a library restored from storage no longer matched the one that was saved. * test(ui): match the manifest message a legacy package reports The message covers both a MicrosoftGame.config and an AppxManifest, so the assertion follows the text the content dialog now prints. * fix(xbox): refuse to start a title that needs the Windows app model A legacy package that names an entry point other than Windows.FullTrustApplication is a UWP application. Wine has no app-model host, so starting its executable crashes inside the loader and the launch looks like nothing happened. Read the entry point from the manifest the installer already parses and stop the Play action with a message instead. Forza Horizon 4 names Forza.App, so it installs and reports as installed but cannot be started here yet. * fix(xbox): dispatch on the container format of the chosen package The catalogue records the format of the first installable desktop package, and the picker only replaced the content id. An offer that lists MSIXVC and a legacy container would then hand the legacy id to streaming, or the streamed id to legacy-install, and the install failed after resolution had succeeded. The choice now carries its own format and the catalogue value only fills a gap. * fix(xbox): keep an extraction reason that the sanitizer rewrote The extraction sanitizer replaces anything outside letters, digits, space, dot, underscore and dash with a question mark, so a reason such as "(os error 28)" arrived as "?os error 28?" and the allowlist dropped the line. The failure then showed only the stage code, with no cause. Add that replacement character to the class the allowlist accepts. * fix(xbox): print the reason a launch was refused The account channel sends a reason with a refusal, and the guest replaced it with a fixed sign-in message, so a title that was never installed still read as a bad account. The guest now shows the reason it was given, and a token holding a path is dropped whole instead of having its slashes removed and its directory names kept. * build(xbox): leave RUST_TEST_THREADS unset when the host has no value The recipe always passed the variable, empty when the host had none, and the pinned test harness rejects an empty count. On an ARM64 host that runs cargo test, so the default local build failed before compiling. * fix(xbox): rebuild the backend patches from the tree that ran The two patches in this branch were not the ones the verified install ran, and one of them did not compile. `unzip.rs` inflates deflated entries but the dependency that provides the inflater was never added, so `prepare.py` produced a tree that failed at `flate2::read::DeflateDecoder`. Anything else missing fell into the same gap: the install stage reported no bytes, so the bar held one value for the whole unpack, and a container a stopped run had finished was downloaded again. Rebuilt from the patched source, and fixed the defects a review of the patch found: - Unpacking reports bytes again: the workers count each file's declared length, and for the single-file bundle member the folder's growth stands in, which is what the device run showed. - A finished container is reused, so a retry after a failure past the download does not spend hours fetching it again. The space preflight counts it as reclaimable, since the retry truncates it first. - An install over a folder that already has a manifest replaces the old files instead of leaving the new package nested and reporting success. A first install still refuses to merge into an existing target. - The manifest search looks at the depth a nested bundle writes, not only one level down. - `withdraw_libraries` removes only the DLLs `copy_libraries` recorded copying, so a framework replacement cannot delete a library the title owns. - ZIP64 sizes and offsets stay `u64`; truncating them to `u32` read the wrong local header past 4 GiB. - The extraction checks the blockmap length against the footer's before writing, which the crate only does when asked. - The container being unpacked is never treated as a nested member, so `extract-eappx title.eappx .` no longer re-enters and deletes its own input. - `flate2` is declared and the lock is updated. `prepare.py` reproduces this from a pristine checkout and `cargo test` passes on it. * fix(xbox): apply the legacy install patch over the Nexus 0.2.15 backend * fix(xbox): install only the newest x64 build of a legacy title and size the space check at its real peak * fix(xbox): install a store package that is a plain archive instead of an XVD * fix(xbox): refuse a package entry that ends before its recorded size * fix(xbox): credit only complete staged containers toward the free space a legacy install needs * fix(xbox): bound each package entry to its data and check ZIP64 decoded sizes * fix(xbox): refuse duplicate package names and clear an unfinished download before measuring space * fix(xbox): bound package entries by the next header and stage a plain package until it validates * fix(xbox): hold the install folder lock through a legacy install * fix(xbox): fall back to an older build when Microsoft refuses the newest one a license * fix(xbox): keep the registered device across sign-out * feat(xbox): explain device-limit and license refusals, with a link to manage devices * fix(xbox): locate each build only once licensed, roll back a failed package swap, report the final license answer * fix(xbox): skip trial and preorder packages, read runtime behavior, keep licensing timeouts * fix(xbox): keep a failed package swap recoverable, size bundles up front, report key-write and framework errors cleanly * fix(xbox): drop a pending manifest check on any newer launch, keep committed backups out of restores, match the app-model order * fix(xbox): cancel pending launch checks on a new intent, remember entries a rollback could not remove * fix(xbox): clear the removal list before a restore moves old files back --------- Co-authored-by: TimmyCraft <46533729+TimmyTurner51@users.noreply.github.com>
This commit is contained in:
1 parent
7680b4d771
commit
a5d8abeab4
31 files changed
+4072
-68
No files matched your search
@@ -1,7 +1,8 @@
|
||||
# Xbox / PC Game Pass on Thor
|
||||
|
||||
This integrates PC Microsoft Store MSIXVC packages,
|
||||
not Xbox console emulation or UWP/APPX packages.
|
||||
This integrates PC Microsoft Store packages, both streamed MSIXVC packages and the legacy
|
||||
EAppx containers older desktop titles still ship as. It is not Xbox console emulation and
|
||||
does not run UWP titles in a packaged-app host.
|
||||
|
||||
## Testing on Thor
|
||||
|
||||
@@ -69,14 +70,96 @@ not Xbox console emulation or UWP/APPX packages.
|
||||
cleanup must preserve installed game files reached through view symlinks.
|
||||
10. Sign out from Xbox. Installed files should remain, account library data should
|
||||
clear, and Play/download licensing should require sign-in again.
|
||||
11. Install a legacy title that ships an EAppx bundle, such as Forza Horizon 4
|
||||
(`9PNQKHFLD2WQ`). The download shows as a percentage rather than a streamed
|
||||
install, Stop kills it rather than pausing, and a finished install registers
|
||||
the executable named by `AppxManifest.xml`. Expect tens of gigabytes: check
|
||||
free space first, since the preflight needs the download plus two copies of
|
||||
the largest container.
|
||||
|
||||
Do not uninstall DroidDeck or clear application data to troubleshoot this build.
|
||||
The signed APK is installed in place to retain existing Steam and store data.
|
||||
|
||||
## Legacy EAppx packages
|
||||
|
||||
A title that predates MSIXVC ships as an EAppx bundle: an archive of Appx packages, encrypted,
|
||||
with an `AppxManifest.xml` per package instead of `MicrosoftGame.config`. `streaming` rejects the
|
||||
format, so the installer reads the format the catalogue recorded and runs `xodus-cli
|
||||
legacy-install` instead. `MSIXVC`, `EAPPX` and `EAPPXBUNDLE` are the only formats listed for a
|
||||
`Windows.Desktop` package; the format is carried into the install record so a later update or
|
||||
resume dispatches the same way.
|
||||
|
||||
The verb resolves, licenses, downloads, extracts, then hoists the manifest to the game root:
|
||||
|
||||
- **Resolution.** The Xbox content service is asked first. Some legacy bundles it answers with no
|
||||
files at all; Windows Update (`fe3cr.delivery.mp.microsoft.com`, SOAP `GetCookie`,
|
||||
`SyncUpdates`, `GetExtendedUpdateInfo2`) is asked next through the title's `WuCategoryId` and
|
||||
returns the full bundle with a time-signed CDN URL. That endpoint is a public Windows Update
|
||||
service and needs no Xbox credential, but it presents a certificate chained to Microsoft's ECC
|
||||
Product Root CA 2018, which Android's CA bundle does not carry, so `wu-root.pem` is pinned for
|
||||
those requests only. A WU result is reduced to its `.eappx`/`.eappxbundle` files: the plain
|
||||
`.appx` framework packages delivered beside it (VCLibs) and the differential `.cab` metadata are
|
||||
not containers this path can unpack.
|
||||
- **Licensing.** The existing `license` verb runs before the first byte is fetched and must return
|
||||
content keys; no keys means no install.
|
||||
- **Space.** Free space is checked up front against the download plus two copies of the largest
|
||||
container, because a bundle is expanded in place. Each container is removed as soon as it is
|
||||
unpacked, so the peak is the archive plus its contents rather than both plus the earlier
|
||||
archives. A container a stopped attempt finished is counted as reclaimable, since the retry
|
||||
truncates it before writing.
|
||||
- **Pause and resume.** A legacy download has no control channel: Stop kills the downloader, and
|
||||
the next attempt starts an unfinished container again from byte zero, while a container that
|
||||
completed is kept and reused. Nothing is checkpointed inside a container.
|
||||
- **Frameworks.** An installed package gets its `PackageDependency` frameworks from the package
|
||||
graph; an unpacked folder has none, so the loader fails with `0xc0000135` on
|
||||
`VCRUNTIME140_APP.dll` and friends. The verb fetches each declared framework from its Windows
|
||||
Update category and copies its libraries beside the title, which is where the loader looks. A
|
||||
category lists one package per architecture under identifier-only names, so each is unpacked
|
||||
until one declares `ProcessorArchitecture="x64"`; taking the first one puts 32-bit DLLs into a
|
||||
64-bit folder and every load fails with `0xc000007b`. Only the libraries that copy put there
|
||||
are withdrawn when a framework is replaced, so a title's own DLL of the same name survives.
|
||||
- **Updates.** Installing over a folder that already holds a manifest lifts the new package over
|
||||
the old files; on a first install an existing target is an error rather than a merge.
|
||||
- **Failure detail.** A release build hides logcat from adb, so a failed install writes the
|
||||
backend's stderr tail to `files/xbox-install.log` beside the app and repeats the last lines in
|
||||
the failure message.
|
||||
|
||||
## Evidence and limits
|
||||
|
||||
Verified during development:
|
||||
|
||||
- The catalogue lists a legacy title beside the MSIXVC ones, and its detail page
|
||||
offers Install with the recorded format.
|
||||
- Resolution of a real legacy PC bundle on Thor without any Xbox token: Forza
|
||||
Horizon 4 (`9PNQKHFLD2WQ`) through Windows Update as
|
||||
`Microsoft.SunriseBaseGame_2023.1122.1704.2_neutral_~_8wekyb3d8bbwe.eappxbundle`,
|
||||
85,219,173,025 bytes, with a signed CDN URL. The Xbox content service returns
|
||||
no files for that product, which is why the WU route exists.
|
||||
- `AppxManifest.xml` identity and executable extraction, and its rejection rules,
|
||||
are unit-tested against a manifest of that shape.
|
||||
- An install of that bundle completed on Thor. The 85,219,173,025-byte container
|
||||
produced 79.3 GB at the game root with `AppxManifest.xml` and the package DLLs
|
||||
directly beneath it, which the launcher reports as installed.
|
||||
- Unpacking that bundle ran at about 40 MB/s on one thread and about 200 MB/s
|
||||
across four, measured as growth of the destination folder. The container is
|
||||
deleted once its members are on disk, so the peak footprint is one package at
|
||||
a time rather than the archive plus everything under it. The install bubble
|
||||
advances through this stage: each file's declared length is counted as it is
|
||||
written, and a bundle member is one file, so the folder's growth covers it.
|
||||
- A launch of this title through Xodus/ARM64 Proton reaches the loader with every declared
|
||||
framework in place, then fails inside Wine: its manifest names `EntryPoint="Forza.App"`, a UWP
|
||||
application that expects the app model to activate a view, which Wine has no host for. The
|
||||
Play action reads that entry point from `AppxManifest.xml` and refuses the launch with a
|
||||
message, and a launch that does reach the runtime reports `uwp-entry-point` rather than dying
|
||||
silently. A package naming `Windows.FullTrustApplication` starts as an ordinary Win32
|
||||
executable instead.
|
||||
- Activation itself is not the missing piece. A DLL registered under
|
||||
`HKLM\Software\Microsoft\WindowsRuntime\ActivatableClassId\Windows.ApplicationModel.Core.CoreApplication`
|
||||
is loaded by `combase.dll`, and its `DllGetActivationFactory` is called for that class. Such a
|
||||
title still stops earlier: `GetCurrentPackageFullName` and `GetCurrentPackageFamilyName` are
|
||||
Wine stubs, so a package has no identity, and an activation factory alone cannot supply the
|
||||
`IFrameworkViewSource`/`CoreWindow` host the view asks for.
|
||||
|
||||
- Native AArch64 CLI execution on Thor's existing Linux runtime.
|
||||
- Abstract-socket credential transport with a synthetic account on Thor; this
|
||||
does not establish a real Microsoft sign-in.
|
||||
|
||||
Reference in new issue
Block a user