Files
DroidDeck/tools/xbox/prepare.py
T
The412Banner 81e238b92e feat(xbox): Nexus backend 0.2.15, Nexus runtime 11.0-20261102 and DLC mounting (#2696)
Nexus moved its Xodus changes from patch files in xodus-nexus into a backend
fork (domsvoboda/nexus-backend, GPL-3.0). prepare.py now fetches that fork at
backend-v0.2.15 (e7884a27, same Xodus base 53ea781d, same Rust 1.99.0) and
applies the DroidDeck patches, rebased onto it:
- droiddeck-credentials, -launch-view, -library-subscriptions: same rebase as
  Bannerlator's 0.2.15 update (identical patches before and after).
- droiddeck-credential-fallback, -credential-diagnostics: applied unchanged.
- droiddeck-cloud-token: session::prepare now also returns the account
  snapshot; the ticket checks it like upstream's profile/social commands.
- droiddeck-licensing-device-ticket: upstream 0.2.15 already formats
  delegation-compact device tickets for Store license tokens (27c335e), so only
  the content licensing path is patched. Upstream now writes compact JWE
  delegation tickets as t=, so the d= prefix check is replaced by the token
  type, the same rule as upstream's store_license.rs.
droiddeck-xbox-ticket.patch is dropped: upstream sends compact JWE delegation
tickets to Xbox Live sign-in in a form it accepts, with tests.

Runtime: domsvoboda/nexus-runtime runtime-11.0-20261102-g76c6dd13 (was
xodus-nexus runtime-11.0-20261018). Same six modules at the same path;
xgameruntime.dll is the C++ implementation (nexus-xgameruntime 455b1ba9).
Archive sha512 from the release's .sha512sum, source sha256 from its
candidate.json, module sha256 from the extracted files. The PlayFab Game Saves
proxy is a newer build at the same path and still passes droiddeck-xbox's
export checks; its license moved to share/doc/nexus-runtime/.

DLC mounting: the C++ runtime mounts downloadable content only inside a
host-managed workspace named by XODUS_MOUNT_ROOT (src/System/Package/Mount.h
returns E_NOTIMPL without it). DroidDeck starts Wine itself
(droiddeck:prepare), so droiddeck-dlc-mount.patch (ported from Bannerlator)
creates the workspace in the launch directory for the prepare session and
reports it as mountRoot; XboxRuntime passes it in the xbox-prepare reply and
droiddeck-xbox sets XODUS_MOUNT_ROOT to its Z: path. XODUS_CONTENT_ROOTS is
unchanged and still read by the runtime.

Upstream fixes since the old pins include sign-in for some accounts, offline
play, cloud-save conflict handling, DLC mounting, duplicate token requests and
per-game fixes (Ori, AoE, MSFS, Forza Motorsport).
2026-11-15 20:55:42 -05:00

31 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env python3
import hashlib
import json
from pathlib import Path
import subprocess
import sys
recipe = Path(__file__).resolve().parent
cache = Path(sys.argv[1]).resolve()
lock = json.loads((recipe / 'backend.lock.json').read_text())
local_patches = ['droiddeck-credentials.patch', 'droiddeck-launch-view.patch', 'droiddeck-library-subscriptions.patch',
'droiddeck-credential-fallback.patch', 'droiddeck-credential-diagnostics.patch', 'droiddeck-cloud-token.patch',
'droiddeck-licensing-device-ticket.patch', 'droiddeck-dlc-mount.patch']
identity = hashlib.sha256((recipe / 'backend.lock.json').read_bytes() + b''.join((recipe / name).read_bytes() for name in local_patches)).hexdigest()
source = cache / ('source-' + identity[:16])
if not (source / '.prepared').is_file():
if source.exists():
raise RuntimeError('Incomplete Xbox source directory; inspect it before retrying: ' + str(source))
source.mkdir(parents=True)
# Nexus keeps its Xodus changes as commits in its backend fork (since 0.2.15), not as patch files.
subprocess.run(['git', 'init', '-q', str(source)], check=True)
subprocess.run(['git', '-C', str(source), 'fetch', '-q', '--depth', '1', lock['repository'], lock['commit']], check=True)
subprocess.run(['git', '-C', str(source), 'checkout', '-q', '--detach', 'FETCH_HEAD'], check=True)
assert subprocess.check_output(['git', '-C', str(source), 'rev-parse', 'HEAD'], text=True).strip() == lock['commit']
assert hashlib.sha256((source / 'Cargo.lock').read_bytes()).hexdigest() == lock['cargoLockSha256']
for name in local_patches:
subprocess.run(['git', '-C', str(source), 'apply', str(recipe / name)], check=True)
(source / '.prepared').write_text(identity + '\n')
assert (source / '.prepared').read_text().strip() == identity
print(source)