feat(ubisoft): Ubisoft Connect store with native sign-in, library, downloads and launch (#2322)

* feat(ubisoft): sign in to Ubisoft Connect and list the owned library

* feat(ubisoft): download games natively through Demux and Ubisoft's CDN

* fix(ubisoft): show the owned games on the store page

* fix(ctl): reach the agent bridge by broadcast when the shell has no content command

* feat(ubisoft): run Ubisoft games in one prefix with Ubisoft Connect installed and the game registered

* feat(ubisoft): launch games through a native stand-in for Ubisoft Connect's local service

* feat(ubisoft): document the launcher pipes, log why owned games have no download, drop the installer after extraction

* feat(ubisoft): Steam-owned Ubisoft games install through Steam, and the launch session carries the game's application id

* feat(ubisoft): answer Denuvo activations through Ubisoft's activation service and log unanswered pipe traffic

* feat(ubisoft): report installed chunks to the game and skip add-ons the account does not own

* fix(ubisoft): the overlay stays off, Ubisoft's install steps pick Windows components, and shared-prefix games keep their own settings

* fix(ubisoft): write the manifest's registry values, and pick the game's exe over Ubisoft's installer stubs

* fix(ubisoft): stream download slices, guard the launch hook, and keep per-game components in the shared prefix

* fix(ubisoft): direct launches in the shared prefix keep their own game id

* ci(ubisoft): build the launcher service after the prepared components are verified

* fix(ubisoft): verify reused files, drop syncs from a signed-out account, and clear activation requests before launch

* fix(ubisoft): fetch again a reused file whose slices cannot be checked
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-10 15:08:37 -05:00
1 parent d8ed02f2cf
commit 3c96df4ab1
49 files changed
+3960 -24

No files matched your search

+21
View File
@@ -1124,6 +1124,23 @@ class GameEnvironmentTest(unittest.TestCase):
scope = MODULE["game_id"](env)
expected = "untouched" if scope is None else scope if scope in {"42", "4294967295", "2147483648"} else "*"
self.assertEqual(target.read_text(), expected)
for app, expected in (("42", "42"), ("4294967295", "4294967295"), ("43", "*"), ("", "*"), ("x", "*")):
with self.subTest(shared=app):
env = dict(os.environ, HOME=str(root), STEAM_COMPAT_DATA_PATH="/steam/compatdata/2929927072", SteamAppId=app)
target.write_text("untouched")
subprocess.run(["bash", "-c", script, "test", str(base)], env=env, check=True, capture_output=True)
self.assertEqual(MODULE["game_id"](env), app if app in {"42", "4294967295", "43"} else "2929927072")
self.assertEqual(target.read_text(), expected)
for game, expected in (
(str(42 << 32 | 0x02000000), "42"), (str(4294967295 << 32 | 0x02000000), "4294967295"),
(str(42 << 32 | 0x02000001), "*"), (str(42 << 32 | 0x02000000 | 1 << 64), "*"), ("33554432", "*"), ("x", "*"),
):
with self.subTest(direct=game):
env = dict(os.environ, HOME=str(root), STEAM_COMPAT_DATA_PATH="/steam/compatdata/2929927072", SteamAppId="0", SteamGameId=game)
target.write_text("untouched")
subprocess.run(["bash", "-c", script, "test", str(base)], env=env, check=True, capture_output=True)
self.assertEqual(MODULE["game_id"](env), expected if expected != "*" else "2929927072")
self.assertEqual(target.read_text(), expected)
def test_engine_fixes_follow_the_games_files(self):
with tempfile.TemporaryDirectory() as tmp:
@@ -1628,6 +1645,10 @@ class GameEnvironmentTest(unittest.TestCase):
self.assertIsNone(MODULE["game_id"]({"STEAM_COMPAT_DATA_PATH": prefix}))
self.assertEqual(MODULE["game_id"]({"STEAM_COMPAT_DATA_PATH": "/a/compatdata/42/"}), "42")
self.assertEqual(MODULE["game_id"]({"STEAM_COMPAT_DATA_PATH": "/a/compatdata/-1"}), "4294967295")
shared = {"STEAM_COMPAT_DATA_PATH": "/a/compatdata/2929927072", "SteamAppId": "2424921676"}
self.assertEqual(MODULE["game_id"](shared), "2424921676")
self.assertEqual(MODULE["game_id"]({"STEAM_COMPAT_DATA_PATH": "/a/compatdata/2929927072"}), "2929927072")
self.assertEqual(MODULE["game_id"]({"STEAM_COMPAT_DATA_PATH": "/a/compatdata/42", "SteamAppId": "7"}), "42")
def test_launch_reads_updates_preserves_argv_and_does_not_execute_values(self):
with tempfile.TemporaryDirectory() as tmp:
+99
View File
@@ -797,3 +797,102 @@ class GogRegistry(unittest.TestCase):
store.main([str(folder / store.LAUNCHER)])
apply.assert_called_once_with(folder, root + '/compat', '/chosen/proton')
support.assert_called_once_with(folder, root + '/compat', '/chosen/proton')
class Ubisoft(unittest.TestCase):
def setUp(self):
self.tmp = tempfile.TemporaryDirectory()
self.root = Path(self.tmp.name)
self.compat_data = self.root / 'compatdata/2929927072'
(self.compat_data / 'pfx').mkdir(parents=True)
(self.compat_data / 'pfx/system.reg').write_text('WINE REGISTRY Version 2\n')
(self.compat_data / 'pfx/user.reg').write_text('WINE REGISTRY Version 2\n')
self.folder = self.root / 'Games/Stores/Ubisoft/Splinter Cell'
(self.folder / 'system').mkdir(parents=True)
self.sidecar = {'store': 'ubisoft', 'id': 'space-1', 'exe': 'system/SplinterCell.exe', 'extra': {'productId': '109'}}
service = self.root / 'droiddeck-upc.exe'
service.write_bytes(b'MZ')
for patcher in (patch.object(store, 'UBISOFT_SERVICE', service), patch.object(store, 'UBISOFT_CACHE', self.root / 'cache'),
patch.object(store, 'wait_for_server', return_value=True)):
patcher.start()
self.addCleanup(patcher.stop)
def tearDown(self):
self.tmp.cleanup()
def runtime(self):
folder = store.ubisoft_runtime_dir(self.compat_data)
folder.mkdir(parents=True, exist_ok=True)
for name in store.UBISOFT_RUNTIME:
(folder / name).write_bytes(b'MZ')
def answer(self, *_args, **_kwargs):
return {'ok': True, 'ticket': 'PC', 'owned': [82, 109], 'appId': 'app',
'account': {'userId': 'u1', 'username': 'name', 'nameOnPlatform': 'name', 'email': 'e@x', 'country': 'US'}}
def prepare(self, ask_app):
return store.prepare_ubisoft(self.folder, self.sidecar, str(self.compat_data), str(self.root / 'launch'), '/proton', ask_app=ask_app)
def test_an_extracted_runtime_is_not_extracted_again(self):
self.runtime()
with patch.object(store.subprocess, 'run') as run:
self.assertEqual('present', store.install_runtime(str(self.compat_data)))
run.assert_not_called()
def test_the_runtime_comes_from_the_installer_through_7z(self):
installer = self.root / 'UbisoftConnectInstaller.exe'
def run(command, **_kwargs):
self.assertEqual(['7z', 'e', '-y'], command[:3])
self.assertEqual(str(installer), command[4])
out = Path(command[3][2:])
for name in command[5:]:
(out / name).write_bytes(b'MZ')
(self.root / 'cache').mkdir()
with patch.object(store, 'fetch_installer', return_value=installer), patch.object(store.subprocess, 'run', side_effect=run):
self.assertEqual('installed', store.install_runtime(str(self.compat_data)))
self.assertTrue(store.ubisoft_runtime_ready(str(self.compat_data)))
def test_a_launch_registers_the_game_and_writes_the_session_for_the_service(self):
self.runtime()
result = self.prepare(self.answer)
self.assertEqual('runtime present, registered 109, 0 manifest value(s), session ready', result)
reg = (self.compat_data / 'pfx/system.reg').read_text()
for view in ('[Software\\\\Ubisoft\\\\Launcher]', '[Software\\\\Wow6432Node\\\\Ubisoft\\\\Launcher]'):
self.assertIn(view, reg)
self.assertIn('[Software\\\\Wow6432Node\\\\Ubisoft\\\\Launcher\\\\Installs\\\\109]', reg)
self.assertIn('"InstallDir"="C:\\\\Program Files (x86)\\\\Ubisoft\\\\Ubisoft Game Launcher\\\\"', reg)
launch = json.loads((self.folder / store.UBISOFT_LAUNCH).read_text())
self.assertEqual(109, launch['productId'])
self.assertEqual('PC', launch['ticket'])
self.assertEqual([82, 109], launch['owned'])
self.assertEqual(store.windows_path(str(self.folder / 'system/SplinterCell.exe')), launch['exe'])
self.assertEqual('C:/users/steamuser/Saved Games/Ubisoft/u1/109/', launch['saves'])
self.assertTrue((self.compat_data / 'pfx/drive_c/users/steamuser/Saved Games/Ubisoft/u1/109').is_dir())
def test_without_a_session_the_launch_file_is_removed_and_the_game_starts_as_is(self):
self.runtime()
(self.folder / store.UBISOFT_LAUNCH).write_text('{}')
result = self.prepare(lambda *_a, **_k: {'ok': False, 'reason': 'signed-out'})
self.assertEqual('runtime present, registered 109, session signed-out', result)
self.assertFalse((self.folder / store.UBISOFT_LAUNCH).exists())
def test_a_game_without_a_product_is_left_alone(self):
self.sidecar['extra'] = {}
self.assertEqual('no-product', self.prepare(self.answer))
def test_the_manifest_registry_lands_in_both_views_with_the_install_folder_and_language(self):
self.runtime()
registry = [{'key': r'HKEY_LOCAL_MACHINE\SOFTWARE\Ubisoft\Launcher\Installs\109\Language',
'values': [{'name': 'French', 'value': 'fr-FR'}, {'name': 'English', 'value': 'en-US'}]},
{'key': r'HKEY_LOCAL_MACHINE\SOFTWARE\Ubisoft\Splinter Cell\GamePath', 'values': [{'name': '$INSTALL_DIR', 'value': ''}]}]
answer = dict(self.answer(), registry=registry, language='en-US')
result = self.prepare(lambda *_a, **_k: answer)
self.assertEqual('runtime present, registered 109, 4 manifest value(s), session ready', result)
reg = (self.compat_data / 'pfx/system.reg').read_text()
self.assertIn(r'[SOFTWARE\\Wow6432Node\\Ubisoft\\Launcher\\Installs\\109]', reg)
self.assertIn(r'[SOFTWARE\\Ubisoft\\Launcher\\Installs\\109]', reg)
self.assertIn('"Language"="en-US"', reg)
folder = store.windows_path(str(self.folder)).replace('\\', '\\\\')
self.assertIn('"GamePath"="%s\\\\"' % folder, reg)