[cli/core] Support launchable DLC/Addons

This commit is contained in:
derrod 2023-12-14 15:05:23 +01:00
parent 691048d481
commit ac6290627c
2 changed files with 13 additions and 3 deletions

View file

@ -568,6 +568,7 @@ class LegendaryCLI:
def launch_game(self, args, extra): def launch_game(self, args, extra):
app_name = self._resolve_aliases(args.app_name) app_name = self._resolve_aliases(args.app_name)
addon_app_name = None
# Interactive CrossOver setup # Interactive CrossOver setup
if args.crossover and sys_platform == 'darwin': if args.crossover and sys_platform == 'darwin':
@ -578,6 +579,13 @@ class LegendaryCLI:
return self._launch_origin(args) return self._launch_origin(args)
igame = self.core.get_installed_game(app_name) igame = self.core.get_installed_game(app_name)
if not igame and (game := self.core.get_game(app_name)) is not None:
# override installed game with base title
if game.is_launchable_addon:
addon_app_name = app_name
app_name = game.metadata['mainGameItem']['releaseInfo'][0]['appId']
igame = self.core.get_installed_game(app_name)
if not igame: if not igame:
logger.error(f'Game {app_name} is not currently installed!') logger.error(f'Game {app_name} is not currently installed!')
exit(1) exit(1)
@ -622,7 +630,8 @@ class LegendaryCLI:
disable_wine=args.no_wine, disable_wine=args.no_wine,
executable_override=args.executable_override, executable_override=args.executable_override,
crossover_app=args.crossover_app, crossover_app=args.crossover_app,
crossover_bottle=args.crossover_bottle) crossover_bottle=args.crossover_bottle,
addon_app_name=addon_app_name)
if args.set_defaults: if args.set_defaults:
self.core.lgd.config[app_name] = dict() self.core.lgd.config[app_name] = dict()

View file

@ -689,9 +689,10 @@ class LegendaryCore:
disable_wine: bool = False, disable_wine: bool = False,
executable_override: str = None, executable_override: str = None,
crossover_app: str = None, crossover_app: str = None,
crossover_bottle: str = None) -> LaunchParameters: crossover_bottle: str = None,
addon_app_name: str = None) -> LaunchParameters:
install = self.lgd.get_installed_game(app_name) install = self.lgd.get_installed_game(app_name)
game = self.lgd.get_game_meta(app_name) game = self.lgd.get_game_meta(addon_app_name if addon_app_name else app_name)
# Disable wine for non-Windows executables (e.g. native macOS) # Disable wine for non-Windows executables (e.g. native macOS)
if not install.platform.startswith('Win'): if not install.platform.startswith('Win'):