feat(ea, ubisoft): cloud saves and a kept Ubisoft Denuvo token (#2824)

* feat(ubisoft): keep Denuvo game tokens per account and product until the game invalidates them

* feat(ubisoft): sync cloud saves through Ubisoft's cloud save service

* fix(xbox): turning cloud saves off passes the offline mode the game save runtime reads

* fix(ubisoft): Ubisoft games list their shared prefix, so they get a saves and cloud tab

* feat(ea): sync cloud saves through EA's cloud sync service

* fix(ea): sync at EA launch and exit, keep one rule snapshot, and check the cloud copy under the write lock

* fix(ubisoft): exact slot versions, scoped save export, and a Denuvo cache bound to its account

* fix(ea): fresh rules per sync, checksums required, backup before restore, and sign-in shown on the saves tab

* fix(ubisoft): launch-time sync on the shared prefix, saves scoped to the game, and Denuvo bound to each launch's account

* fix(ea): back up only the saves a restore replaces, refuse truncated manifests, and need a master title id

* fix(ubisoft): treat a slot whose bytes changed since the last sync as a conflict before uploading over it

* fix(ea): one resolved save folder per sync, refuse case collisions, and walk each folder once

* fix(ubisoft): sync only identified slots, keep live saves and backups safe, and tie a pending eviction to its account

* fix(cloud): a forced download fetches every saved conflict and keeps the ones it could not write

* test(ea): keep the cloud save cases in EaTest

* fix(ubisoft): report only written slots, keep drift conflicts, read whole headers, and never rename a named eviction

* fix(ea): keep real save folders in the inventory, back up any restored file, refuse duplicate or malformed cloud listings

* fix(cloud): commit Ubisoft slots one at a time and stop on a newer cloud write, name skipped and blocked slots, keep unsent conflicts

* fix(ubisoft): acknowledge an invalidation only once its marker is published and never serve a kept token after it

* fix(cloud): a cloud request the launcher cannot write still starts the game and keeps the exit upload

* fix(cloud): scope Ubisoft sync state to the account and product, compare alike slots, keep committed progress, and name partial slots

* fix(ea): ask for sign-in after a rejected refresh, upload saves reached through folder aliases

* fix(cloud): a launch that stops waiting for the cloud download claims it back, so no save is written once the game starts

* fix(ubisoft): name the account in an invalidation marker and never hold the token lock across a pipe write

* fix(ea): only invalid_grant asks for sign-in again, and case collisions count only among synced saves

* test(epic): let the launcher's ask doubles take the claim flag

* fix(ea): apply save rules in their order, match bare patterns inside the save folder, and resolve LocalLow and install folders

* fix(ubisoft): stamp a fresh identifier into a new save that has none, so it can sync

* fix(ubisoft): answer a burn ticket request as unavailable instead of leaving the game waiting

* fix(cloud): read EA manifests with the XML parser, clear conflicts whose sides match, and bound the claim and stall tests
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-18 18:32:06 -05:00
1 parent 6ed281f78d
commit 123c431b8e
31 files changed
+1999 -132

No files matched your search

@@ -116,7 +116,7 @@ def through_client(folder, sidecar, timeout=CLIENT_TIMEOUT):
return str(answer.get("reason") or "failed")
def ask(channel, request, timeout=TIMEOUT):
def ask(channel, request, timeout=TIMEOUT, claim=False):
req_dir, resp_dir = channel / "req", channel / "resp"
req_dir.mkdir(parents=True, exist_ok=True)
resp_dir.mkdir(parents=True, exist_ok=True)
@@ -125,19 +125,33 @@ def ask(channel, request, timeout=TIMEOUT):
tmp.write_text(json.dumps(request))
os.rename(tmp, req_dir / (rid + ".json"))
answer = resp_dir / (rid + ".json")
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
def wait(seconds):
deadline = time.monotonic() + seconds
while time.monotonic() < deadline:
try:
value = json.loads(answer.read_text())
answer.unlink()
return value
except (OSError, ValueError):
time.sleep(0.05)
return None
value = wait(timeout)
if value is not None:
return value
for pending in (req_dir / (rid + ".json"), resp_dir / (rid + ".taken")):
abandoned = pending.with_name(rid + ".abandoned")
try:
value = json.loads(answer.read_text())
answer.unlink()
return value
except (OSError, ValueError):
time.sleep(0.05)
try:
(req_dir / (rid + ".json")).unlink()
except OSError:
pass
return None
os.rename(pending, abandoned)
except OSError:
continue
try:
abandoned.unlink()
except OSError:
pass
return None
return wait(CLAIMED_TIMEOUT) if claim else None
def windows_path(unix):
@@ -255,7 +269,8 @@ def create_prefix(compat_data, proton, timeout=120):
CLOUD_TIMEOUT = 15.0
CLOUD_STORES = ("gog", "epic")
CLAIMED_TIMEOUT = 120.0
CLOUD_STORES = ("gog", "epic", "ea", "ubisoft")
STORE_GAME = 10
RAN = 11
RAN_FAILED = 12
@@ -304,11 +319,14 @@ def exited(argv, code=0):
if found is not None and launch_dir and str(found[1].get("store")) == "ea":
ask(Path(launch_dir) / "stores", {"op": "ea-exited", "store": "ea", "id": str(found[1].get("id"))}, timeout=1.0)
log("ea %s exited" % found[1].get("id"))
return 0
if found is None or not launch_dir or not cloud_on(found[1]):
return 0
store, game = str(found[1].get("store")), str(found[1].get("id"))
ask(Path(launch_dir) / "stores", {"op": "cloud-up", "store": store, "id": game}, timeout=1.0)
try:
ask(Path(launch_dir) / "stores", {"op": "cloud-up", "store": store, "id": game}, timeout=1.0)
except OSError as error:
log("cloud %s %s up not requested (%s)" % (store, game, type(error).__name__))
return 0
log("cloud %s %s up requested" % (store, game))
return 0
@@ -1601,7 +1619,7 @@ def main(argv):
compat_data = os.environ.get("STEAM_COMPAT_DATA_PATH", "").rstrip("/")
prefix_id = os.path.basename(compat_data) if compat_data else ""
launch_dir = os.environ.get("DD_LAUNCH_DIR", "")
if launch_dir and cloud_on(sidecar):
if launch_dir and cloud_on(sidecar) and store != "ea":
made = create_prefix(compat_data, os.environ.get("DD_STORE_PROTON", ""))
if made != "present":
log("cloud %s %s prefix=%s" % (store, game, made))
@@ -1670,13 +1688,16 @@ def main(argv):
log("epic prefix=%s %s" % (prefix_id or "?", provision_prefix(compat_data)))
if store == "ea":
prepare_ea(folder, sidecar, compat_data, launch_dir)
return STORE_GAME
if not cloud_on(sidecar):
if store in CLOUD_STORES:
log("cloud %s %s down result=skipped reason=off" % (store, game))
return 0
return STORE_GAME if store == "ea" else 0
if launch_dir:
answer = ask(Path(launch_dir) / "stores", {"op": "cloud-down", "store": store, "id": game}, timeout=CLOUD_TIMEOUT)
try:
answer = ask(Path(launch_dir) / "stores", {"op": "cloud-down", "store": store, "id": game}, timeout=CLOUD_TIMEOUT, claim=True)
except OSError as error:
log("cloud %s %s down result=failed reason=%s" % (store, game, type(error).__name__))
return STORE_GAME
if answer is None:
log("cloud %s %s down result=timeout" % (store, game))
else:
@@ -518,7 +518,7 @@ def launch(command, env):
context.chmod(0o600)
owned_env = dict(env, DROIDDECK_XBOX_ACTIVE='1', DROIDDECK_XBOX_COMMAND_FILE=str(context),
XODUS_SOCKET=reply['socket'], XODUS_BRIDGE_PORT=str(port), XODUS_BRIDGE_KEY=key,
XODUS_LOG='off', RUST_LOG='off', XODUS_SAVE_SYNC='auto' if sidecar.get('cloud', True) else 'off')
XODUS_LOG='off', RUST_LOG='off', XODUS_SAVE_SYNC='auto' if sidecar.get('cloud', True) else 'none')
for name in ('DROIDDECK_XBOX_CREDENTIAL_SOCKET', 'DROIDDECK_XBOX_CREDENTIAL_PORT', 'DROIDDECK_XBOX_CREDENTIAL_KEY'):
owned_env.pop(name, None)
if reply.get('playfab'):