From 1841da51f0ea4b6f464a6738387845ba3bb233f9 Mon Sep 17 00:00:00 2001 From: derrod Date: Wed, 13 Dec 2023 23:15:08 +0100 Subject: [PATCH] [core/models] Support additional command line parameters from metadata This should fix things like the fake Fortnite "games" (Lego Fortnite etc.) --- legendary/core.py | 7 +++++++ legendary/models/game.py | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/legendary/core.py b/legendary/core.py index 296da30..34defcd 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -733,6 +733,13 @@ class LegendaryCore: self.log.warning(f'Parsing predefined launch parameters failed with: {e!r}, ' f'input: {install.launch_parameters}') + if meta_args := game.additional_command_line: + try: + params.game_parameters.extend(shlex.split(meta_args.strip(), posix=False)) + except ValueError as e: + self.log.warning(f'Parsing metadata launch parameters failed with: {e!r}, ' + f'input: {install.launch_parameters}') + game_token = '' if not offline: self.log.info('Getting authentication token...') diff --git a/legendary/models/game.py b/legendary/models/game.py index 0d615ce..e1f5e30 100644 --- a/legendary/models/game.py +++ b/legendary/models/game.py @@ -91,6 +91,12 @@ class Game: def supports_mac_cloud_saves(self): return self.metadata and (self.metadata.get('customAttributes', {}).get('CloudSaveFolder_MAC') is not None) + @property + def additional_command_line(self): + if not self.metadata: + return None + return self.metadata.get('customAttributes', {}).get('AdditionalCommandLine', {}).get('value', None) + @property def catalog_item_id(self): if not self.metadata: