mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +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
@@ -27,6 +27,7 @@ CLASSES = {
|
||||
'Windows.Storage.Streams.DataWriter'),
|
||||
}
|
||||
CLASS_KEY = 'Software\\Microsoft\\WindowsRuntime\\ActivatableClassId\\'
|
||||
VIEW_DRIVES = 'xwvutsrqponmlkjihgfe'
|
||||
|
||||
|
||||
def bridge(upstream):
|
||||
@@ -137,6 +138,29 @@ def register_classes(proton, prefix, env):
|
||||
print('droiddeck-xbox: Windows Runtime class registration failed; launching without it', file=sys.stderr)
|
||||
|
||||
|
||||
def view_drive(prefix, exe):
|
||||
path = Path(exe)
|
||||
view = next((parent for parent in path.parents if parent.name.startswith('droiddeck-xbox-')), None)
|
||||
if not path.is_absolute() or view is None:
|
||||
return exe, None
|
||||
devices = prefix / 'dosdevices'
|
||||
for letter in VIEW_DRIVES:
|
||||
link = devices / (letter + ':')
|
||||
staged = devices / ('.%s-%s' % (letter, secrets.token_hex(4)))
|
||||
try:
|
||||
if os.path.lexists(link) and (os.path.exists(link) or not os.readlink(link).startswith(str(view.parent.parent) + '/')):
|
||||
continue
|
||||
devices.mkdir(parents=True, exist_ok=True)
|
||||
staged.symlink_to(view)
|
||||
os.replace(staged, link)
|
||||
except OSError:
|
||||
if os.path.lexists(staged):
|
||||
staged.unlink()
|
||||
continue
|
||||
return letter.upper() + ':\\' + str(path.relative_to(view)).replace('/', '\\'), link
|
||||
return exe, None
|
||||
|
||||
|
||||
def wine(argv, source_env=None):
|
||||
source_env = os.environ if source_env is None else source_env
|
||||
with open(source_env['DROIDDECK_XBOX_COMMAND_FILE'], encoding='utf-8') as file:
|
||||
@@ -163,7 +187,15 @@ def wine(argv, source_env=None):
|
||||
register_classes(command[0], prefix, env)
|
||||
overrides = ';'.join(name[:-4] + '=n' for name in DLLS if name != 'libnghttp2.dll')
|
||||
env['WINEDLLOVERRIDES'] = overrides + ';' + env.get('WINEDLLOVERRIDES', '')
|
||||
return subprocess.call([*command[:2], argv[0], *command[3:]], env=env)
|
||||
exe, drive = view_drive(prefix, argv[0])
|
||||
try:
|
||||
return subprocess.call([*command[:2], exe, *command[3:]], env=env)
|
||||
finally:
|
||||
if drive is not None:
|
||||
try:
|
||||
drive.unlink()
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def renew_lease(ask, channel, product, lease, stopped):
|
||||
|
||||
Reference in new issue
Block a user