mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
* feat: Epic Games Launcher for Linux Install Epic's official Linux launcher (EGLv2) from Epic's CDN with Valve's Steam Runtime 4 and run it under FEX, signed in with the linked Epic account. Epic games launch through a hidden launcher instance so they get the launcher's own arguments, with the exchange-code launch as the fallback, and DroidDeck installs show up in the launcher as installed. In the launcher, touch scrolls like a phone app and the gamepad drives the UI: D-pad and left stick move the selection, A opens, B goes back, the right stick and triggers scroll proportionally, X opens the options menu, Y the keyboard and LB/RB switch tabs. * feat: Epic Games Launcher for Linux Install Epic's official Linux launcher (EGLv2) from Epic's CDN with Valve's Steam Runtime 4 and run it under FEX, signed in with the linked Epic account. Epic games launch through a hidden launcher instance so they get the launcher's own arguments, with the exchange-code launch as the fallback, and DroidDeck installs show up in the launcher as installed. In the launcher, touch scrolls like a phone app and the gamepad drives the UI: D-pad and left stick move the selection, A opens, B goes back, the right stick and triggers scroll proportionally, X opens the options menu, Y the keyboard and LB/RB switch tabs. * Route Epic games through Steam, import launcher installs, offer the second library - Every Epic launch goes Steam -> Epic Games Launcher -> game; Play inside the open launcher hands the game to Steam - Games installed from inside the launcher get a Games-tab entry and launch through Steam; the launcher installs to the last Stores target - Stores install picker offers the Steam second library, with side-by-side choices - uruntime xattr-only failures no longer fail the launcher unpack (app-extract) * Hand launcher Play and Steam links to Steam, wait for FEX on first run Play on a game the launcher just installed is matched to its install record and handed to Steam. Steam games listed in the launcher open steam://rungameid links, which now start the game in a Steam session. Opening the launcher before Steam has downloaded FEX asks Steam for it and starts Steam instead of failing with no-fex. * Address review: FEX check, play-in-Steam action, touch route thread, scroll scale fexReady needs a FEX binary in Steam's FEX tool, not just its folder. The play-in-Steam action stays until the link is handled, so Run Steam at startup can't start a session first. The pad touch route reads the mouse mode without side effects off the main thread and posts the pad update there. Vertical scroll uses the output height. A status-2 unpack counts only when AppRun is there. The xdg-open command is tested end to end for Steam links. * Open the launcher through Steam, recover dropped shortcuts, sign out of both The Epic Games Launcher now runs as its own Steam shortcut, so opening it starts Steam, which opens the launcher, and Play inside it goes to the running Steam. Steam dropped a running shortcut from its library when the game exited after a sleep/wake replay or a server re-logon, and launching it then waited forever at ShowInterstitials. login1 only replays sleep/wake when Steam is asleep. The session restarts Steam when a requested shortcut is missing, and when a game exits with its shortcut gone and nothing else runs. Resuming after a long pause no longer reports failure while traced processes are still waking, so "Steam is paused" goes away on the first tap. Signing out of the launcher signs DroidDeck's Epic store out, and signing out in DroidDeck restarts the launcher signed out and clears the Epic web cookies. * Address review: one session-switch poll, Epic setup can't block a session A new switch confirmation replaces the pending poll instead of adding a second one that could start the session again. Epic library sync and install-folder setup at session start are each guarded, so a bad preference no longer stops the guest from launching. * Uninstall the Epic Games Launcher from the Games tab An Uninstall button next to Launch asks first, closes a running session, and removes the launcher and its runtime. The launcher's sign-in and install records stay, so its games keep their Games-tab entries and a reinstall comes back signed in. Its Steam shortcut goes away on the next Steam start. * Address review: uninstall only after the session has ended The launcher's files are removed only once the session is not running and its phase has ended; a shutdown still in progress after the wait reports failure instead. The confirmation reads the session state from the front-end state. * Find FEX that Steam installed on the second library Steam's tools on a second library live in DroidDeck's private copy, which the session binds over the library. The launcher's FEX check only looked on the shared storage, so with FEX there it always asked Steam for FEX and only Steam opened. It now checks the private copy too. * Start games without Steam, per-game Settings menu with Wine sync "Start without Steam" now really leaves the Steam client out: the game runs in its own Proton/FEX through droiddeck-proton-run in a run session, and the Epic Games Launcher opens on its own with its games playing in it. Run sessions for these games are not pinned to the big cores and get DirectAudio and the added-games list like Steam. The Games tab card is now "Settings", titled "<game> Settings": Start without Steam, FEX preset, Wine sync (ntsync, fsync, esync, wineserver or the app default) and Default, which puts everything changed for the game back to the app's settings. The app-wide Wine sync choice is shown in the Steam settings Session tab. * Address review: uninstall guard, routed games, shortcut matching Opening or reinstalling the Epic Games Launcher waits while it is being uninstalled. Added games that are Steam installs keep their Start without Steam setting under their Steam app id and start as that Steam game. Live shortcut lookups wait for Steam's library to load and match a same-name shortcut by its executable, so no duplicate is added. The session treats the open launcher as itself even when it could not tell its Steam app id. * Address review: drop a queued launcher switch when it is uninstalled A confirmed switch to the Epic Games Launcher that is still waiting for the old session to end is cancelled when the launcher is uninstalled, and never starts while the uninstall runs. The launcher id test sets its environment for its own runs only.
217 lines
10 KiB
Python
217 lines
10 KiB
Python
import importlib.machinery
|
|
import importlib.util
|
|
import json
|
|
from pathlib import Path
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
BIN = Path(__file__).resolve().parents[1] / 'linuxfs/overlay/usr/local/bin'
|
|
|
|
|
|
def load(name):
|
|
loader = importlib.machinery.SourceFileLoader(name, str(BIN / name))
|
|
spec = importlib.util.spec_from_loader(name, loader)
|
|
module = importlib.util.module_from_spec(spec)
|
|
loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
shortcuts = load('droiddeck-steam-shortcuts')
|
|
|
|
APPID = 0x87654321
|
|
GUEST = '/root/Games/PC/Example'
|
|
|
|
|
|
class ShortcutsTest(unittest.TestCase):
|
|
def setUp(self):
|
|
self.temp = tempfile.TemporaryDirectory()
|
|
self.addCleanup(self.temp.cleanup)
|
|
self.root = Path(self.temp.name)
|
|
self.steam = self.root / 'Steam'
|
|
self.config = self.steam / 'userdata/123/config'
|
|
self.config.mkdir(parents=True)
|
|
self.listing = self.root / 'added-games.json'
|
|
|
|
def game(self, exe='Example.exe', seen=0, appid=APPID, name='Example'):
|
|
path = GUEST + '/' + exe
|
|
return dict(name=name, exe=path, folder=GUEST, dir=path.rsplit('/', 1)[0], appid=appid, seen=seen)
|
|
|
|
def run_writer(self, *games):
|
|
self.listing.write_text(json.dumps(list(games)))
|
|
subprocess.run(['python3', str(BIN / 'droiddeck-steam-shortcuts'), str(self.steam), str(self.listing)],
|
|
check=True, capture_output=True)
|
|
return self.entries()
|
|
|
|
def entries(self):
|
|
data = shortcuts.parse((self.config / 'shortcuts.vdf').read_bytes())['shortcuts']
|
|
return {value['appid'] & 0xFFFFFFFF: value for value in data.values()}
|
|
|
|
def steam_edits(self, appid=APPID, **fields):
|
|
path = self.config / 'shortcuts.vdf'
|
|
data = shortcuts.parse(path.read_bytes())['shortcuts']
|
|
for value in data.values():
|
|
if value['appid'] & 0xFFFFFFFF == appid:
|
|
value.update(fields)
|
|
path.write_bytes(shortcuts.write({'shortcuts': data}))
|
|
|
|
def record(self):
|
|
return json.loads((self.config / shortcuts.RECORD).read_text())
|
|
|
|
def test_settings_changed_in_steam_survive_its_restart(self):
|
|
self.run_writer(self.game())
|
|
edits = dict(Exe='"%s/bin/Other.exe"' % GUEST, StartDir='"%s"' % GUEST, LaunchOptions='DXVK_HUD=1 %command%',
|
|
AppName='Example GOTY', icon='/root/custom.png', IsHidden=1, AllowOverlay=0, LastPlayTime=1791372037,
|
|
sortas='example', tags={'0': shortcuts.TAG, '1': 'Favorites'})
|
|
self.steam_edits(**edits)
|
|
entry = self.run_writer(self.game())[APPID]
|
|
for field, value in edits.items():
|
|
self.assertEqual(value, entry[field], field)
|
|
entry = self.run_writer(self.game())[APPID]
|
|
for field, value in edits.items():
|
|
self.assertEqual(value, entry[field], field)
|
|
|
|
def test_steam_edit_is_recorded_for_the_app(self):
|
|
self.run_writer(self.game())
|
|
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST)
|
|
self.run_writer(self.game())
|
|
state = self.record()['games'][str(APPID)]
|
|
self.assertEqual('"%s/Example.exe"' % GUEST, state['app']['Exe'])
|
|
self.assertEqual('"%s/bin/Other.exe"' % GUEST, state['steam']['Exe'])
|
|
self.assertEqual(1, state['rev'])
|
|
self.run_writer(self.game())
|
|
self.assertEqual(1, self.record()['games'][str(APPID)]['rev'])
|
|
|
|
def test_the_app_taking_steams_target_keeps_steams_start_in(self):
|
|
self.run_writer(self.game())
|
|
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST, StartDir='"%s/data"' % GUEST)
|
|
self.run_writer(self.game())
|
|
entry = self.run_writer(self.game('bin/Other.exe', seen=1))[APPID]
|
|
self.assertEqual('"%s/bin/Other.exe"' % GUEST, entry['Exe'])
|
|
self.assertEqual('"%s/data"' % GUEST, entry['StartDir'])
|
|
|
|
def test_an_exe_chosen_in_the_app_replaces_steams_target(self):
|
|
self.run_writer(self.game())
|
|
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST, LaunchOptions='-windowed')
|
|
self.run_writer(self.game())
|
|
entry = self.run_writer(self.game('tools/Launcher.exe'))[APPID]
|
|
self.assertEqual('"%s/tools/Launcher.exe"' % GUEST, entry['Exe'])
|
|
self.assertEqual('"%s/tools"' % GUEST, entry['StartDir'])
|
|
self.assertEqual('-windowed', entry['LaunchOptions'])
|
|
|
|
def test_going_back_to_the_apps_exe_after_taking_steams_wins(self):
|
|
self.run_writer(self.game())
|
|
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST)
|
|
self.run_writer(self.game())
|
|
entry = self.run_writer(self.game(seen=1))[APPID]
|
|
self.assertEqual('"%s/Example.exe"' % GUEST, entry['Exe'])
|
|
self.assertEqual('"%s"' % GUEST, entry['StartDir'])
|
|
|
|
def test_a_later_steam_edit_is_kept_until_the_app_takes_it(self):
|
|
self.run_writer(self.game())
|
|
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST)
|
|
self.run_writer(self.game())
|
|
self.run_writer(self.game(seen=1))
|
|
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST)
|
|
entry = self.run_writer(self.game(seen=1))[APPID]
|
|
self.assertEqual('"%s/bin/Other.exe"' % GUEST, entry['Exe'])
|
|
self.assertEqual(2, self.record()['games'][str(APPID)]['rev'])
|
|
|
|
def test_a_game_that_goes_away_comes_back_with_its_settings(self):
|
|
self.run_writer(self.game())
|
|
self.steam_edits(Exe='"%s/bin/Other.exe"' % GUEST, LaunchOptions='-dx11', LastPlayTime=1791372037)
|
|
self.assertEqual({}, self.run_writer())
|
|
self.assertIn(str(APPID), self.record()['away'])
|
|
entry = self.run_writer(self.game())[APPID]
|
|
self.assertEqual('"%s/bin/Other.exe"' % GUEST, entry['Exe'])
|
|
self.assertEqual('-dx11', entry['LaunchOptions'])
|
|
self.assertEqual(1791372037, entry['LastPlayTime'])
|
|
self.assertEqual({}, self.record()['away'])
|
|
|
|
def test_first_run_keeps_steams_own_fields_and_writes_the_apps_paths(self):
|
|
old = dict(shortcuts.shortcut(self.game('Old.exe')), LaunchOptions='-novid', LastPlayTime=5, sortas='x')
|
|
mine = dict(shortcuts.shortcut(dict(self.game(appid=0x81111111), name='Mine')), tags={'0': 'Personal'})
|
|
(self.config / 'shortcuts.vdf').write_bytes(shortcuts.write({'shortcuts': {'0': mine, '1': old}}))
|
|
entries = self.run_writer(self.game())
|
|
entry = entries[APPID]
|
|
self.assertEqual('"%s/Example.exe"' % GUEST, entry['Exe'])
|
|
self.assertEqual('-novid', entry['LaunchOptions'])
|
|
self.assertEqual(5, entry['LastPlayTime'])
|
|
self.assertEqual('x', entry['sortas'])
|
|
self.assertEqual(mine, entries[0x81111111])
|
|
|
|
def test_a_missing_tag_is_put_back_without_losing_steams(self):
|
|
self.run_writer(self.game())
|
|
self.steam_edits(tags={'1': 'Favorites', '0': shortcuts.TAG})
|
|
entry = self.run_writer(self.game())[APPID]
|
|
self.assertEqual({'1': 'Favorites', '0': shortcuts.TAG}, entry['tags'])
|
|
self.assertEqual({'0': shortcuts.TAG}, shortcuts.merge(shortcuts.shortcut(self.game()), dict(shortcuts.shortcut(self.game()), tags={}), None, 0)[0]['tags'])
|
|
|
|
def test_a_copy_the_running_client_added_of_an_added_game_is_dropped(self):
|
|
self.run_writer(self.game())
|
|
path = self.config / 'shortcuts.vdf'
|
|
data = shortcuts.parse(path.read_bytes())['shortcuts']
|
|
live = dict(shortcuts.shortcut(self.game(appid=0x91234567)), tags={})
|
|
own = dict(shortcuts.shortcut(self.game(exe='Other.exe', appid=0x92345678)), tags={})
|
|
renamed = dict(shortcuts.shortcut(self.game(appid=0x93456789, name='My copy')), tags={})
|
|
data.update({'7': live, '8': own, '9': renamed})
|
|
path.write_bytes(shortcuts.write({'shortcuts': data}))
|
|
entries = self.run_writer(self.game())
|
|
self.assertEqual({APPID, 0x92345678, 0x93456789}, set(entries))
|
|
|
|
def test_a_damaged_record_is_started_over(self):
|
|
self.run_writer(self.game())
|
|
(self.config / shortcuts.RECORD).write_text('{not json')
|
|
self.steam_edits(LaunchOptions='-safe')
|
|
entry = self.run_writer(self.game())[APPID]
|
|
self.assertEqual('-safe', entry['LaunchOptions'])
|
|
self.assertIn(str(APPID), self.record()['games'])
|
|
|
|
def test_games_set_aside_are_bounded(self):
|
|
many = [self.game(appid=0x80000000 + n, name='Game %d' % n) for n in range(shortcuts.AWAY_LIMIT + 4)]
|
|
self.run_writer(*many)
|
|
self.run_writer()
|
|
away = self.record()['away']
|
|
self.assertEqual(shortcuts.AWAY_LIMIT, len(away))
|
|
self.assertNotIn(str(0x80000000), away)
|
|
self.assertIn(str(0x80000000 + shortcuts.AWAY_LIMIT + 3), away)
|
|
|
|
|
|
def test_name_start_in_and_launch_options_set_in_the_app_reach_the_shortcut(self):
|
|
self.run_writer(self.game())
|
|
game = dict(self.game(name='Example: Renamed'), dir=GUEST + '/data', launch='-dx11')
|
|
entry = self.run_writer(game)[APPID]
|
|
self.assertEqual('Example: Renamed', entry['AppName'])
|
|
self.assertEqual('"%s/data"' % GUEST, entry['StartDir'])
|
|
self.assertEqual('-dx11', entry['LaunchOptions'])
|
|
self.assertEqual([APPID], list(self.run_writer(game)))
|
|
|
|
def test_a_target_chosen_in_the_app_updates_the_same_shortcut(self):
|
|
self.run_writer(self.game())
|
|
entries = self.run_writer(self.game('bin/Example64.exe'))
|
|
self.assertEqual([APPID], list(entries))
|
|
self.assertEqual('"%s/bin/Example64.exe"' % GUEST, entries[APPID]['Exe'])
|
|
self.assertEqual('"%s/bin"' % GUEST, entries[APPID]['StartDir'])
|
|
|
|
def test_launch_options_set_in_steam_stay_over_the_apps_old_value(self):
|
|
self.run_writer(dict(self.game(), launch='-dx11'))
|
|
self.steam_edits(LaunchOptions='-vulkan', AppName='Mine')
|
|
entry = self.run_writer(dict(self.game(), launch='-dx11'))[APPID]
|
|
self.assertEqual('-vulkan', entry['LaunchOptions'])
|
|
self.assertEqual('Mine', entry['AppName'])
|
|
steam = self.record()['games'][str(APPID)]['steam']
|
|
self.assertEqual('-vulkan', steam['LaunchOptions'])
|
|
self.assertEqual('Mine', steam['AppName'])
|
|
|
|
def test_an_older_record_without_launch_options_still_takes_the_apps(self):
|
|
self.run_writer(self.game())
|
|
record = self.record()
|
|
del record['games'][str(APPID)]['app']['LaunchOptions']
|
|
(self.config / shortcuts.RECORD).write_text(json.dumps(record))
|
|
entry = self.run_writer(dict(self.game(), launch='-safe'))[APPID]
|
|
self.assertEqual('-safe', entry['LaunchOptions'])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|