mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
fix: run Xbox games from a short drive letter
The launch view lives under the app's files folder, so games saw an install path like Z:\data\user\0\com.droiddeck.launcher\files\xbox-runtime \views\launch-<n>\droiddeck-xbox-<id>. Forza Horizon checks that length and quits with "Installation path is too long". The view is now mapped to a free drive letter in the prefix (X: first) for the length of the launch.
This commit is contained in:
1 parent
c446566f42
commit
a984d11742
2 files changed
+73
-1
No files matched your search
@@ -136,6 +136,46 @@ class XboxLaunchTest(unittest.TestCase):
|
||||
self.assertNotIn('DROIDDECK_XBOX_COMMAND_FILE', child_env)
|
||||
self.assertEqual(child_env['XODUS_BRIDGE_KEY'], 'runtime-key')
|
||||
|
||||
def test_launch_view_runs_from_a_short_drive_letter(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
root = Path(root)
|
||||
prefix = root / 'compat/pfx'
|
||||
prefix.mkdir(parents=True)
|
||||
runtime = root / 'runtime/windows'; runtime.mkdir(parents=True)
|
||||
for name in xbox['DLLS']:
|
||||
(runtime / name).write_bytes(b'MZ-synthetic')
|
||||
view = root / 'files/xbox-runtime/views/launch-4093691424/droiddeck-xbox-1ZpM3D'
|
||||
(view / 'Bin').mkdir(parents=True)
|
||||
command = root / 'command.json'
|
||||
command.write_text(json.dumps(['/selected/proton', 'waitforexitandrun', '/encrypted/Game.exe']))
|
||||
env = {'STEAM_COMPAT_DATA_PATH': str(prefix.parent), 'DROIDDECK_XBOX_COMMAND_FILE': str(command)}
|
||||
seen = []
|
||||
def call(argv, **kwargs):
|
||||
seen.append((argv, os.readlink(prefix / 'dosdevices/x:')))
|
||||
return 0
|
||||
with patch.dict(os.environ, env), patch.dict(xbox['wine'].__globals__, RUNTIME=runtime.parent), patch('subprocess.run') as initialize, patch('subprocess.call', side_effect=call):
|
||||
initialize.return_value.returncode = 0
|
||||
self.assertEqual(xbox['wine']([str(view / 'Bin/Game.exe')]), 0)
|
||||
self.assertEqual(seen, [(['/selected/proton', 'waitforexitandrun', 'X:\\Bin\\Game.exe'], str(view))])
|
||||
self.assertFalse(os.path.lexists(prefix / 'dosdevices/x:'))
|
||||
|
||||
def test_view_drive_keeps_drives_in_use_and_reuses_a_stale_view(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
root = Path(root)
|
||||
devices = root / 'pfx/dosdevices'; devices.mkdir(parents=True)
|
||||
views = root / 'views'
|
||||
live = views / 'launch-1/droiddeck-xbox-live'; live.mkdir(parents=True)
|
||||
view = views / 'launch-2/droiddeck-xbox-new'; view.mkdir(parents=True)
|
||||
(devices / 'x:').symlink_to(live)
|
||||
(devices / 'w:').symlink_to(root / 'games')
|
||||
(devices / 'v:').symlink_to(views / 'launch-0/droiddeck-xbox-gone')
|
||||
exe, link = xbox['view_drive'](root / 'pfx', str(view / 'Game.exe'))
|
||||
self.assertEqual((exe, link), ('V:\\Game.exe', devices / 'v:'))
|
||||
self.assertEqual(os.readlink(devices / 'v:'), str(view))
|
||||
self.assertEqual(os.readlink(devices / 'x:'), str(live))
|
||||
self.assertEqual(sorted(p.name for p in devices.iterdir()), ['v:', 'w:', 'x:'])
|
||||
self.assertEqual(xbox['view_drive'](root / 'pfx', '/games/Game.exe'), ('/games/Game.exe', None))
|
||||
|
||||
def test_missing_runtime_classes_are_registered_once(self):
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
prefix = Path(root)
|
||||
|
||||
Reference in new issue
Block a user