mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[cli/core] Add option to override platform when downloading
This can be used to download Mac or 32-bit builds if desired. For example: legendary download Corydalis --platform Mac Will download the Slime Rancher macOS build. Closes #12
This commit is contained in:
parent
79dc7d03a4
commit
e0b4769af2
|
@ -172,6 +172,9 @@ class LegendaryCLI:
|
||||||
logger.error(f'Update requested for "{args.app_name}", but app not installed!')
|
logger.error(f'Update requested for "{args.app_name}", but app not installed!')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
if args.platform_override:
|
||||||
|
args.no_install = True
|
||||||
|
|
||||||
game = self.core.get_game(args.app_name, update_meta=True)
|
game = self.core.get_game(args.app_name, update_meta=True)
|
||||||
|
|
||||||
if not game:
|
if not game:
|
||||||
|
@ -199,7 +202,8 @@ class LegendaryCLI:
|
||||||
disable_patching=args.disable_patching,
|
disable_patching=args.disable_patching,
|
||||||
override_manifest=args.override_manifest,
|
override_manifest=args.override_manifest,
|
||||||
override_old_manifest=args.override_old_manifest,
|
override_old_manifest=args.override_old_manifest,
|
||||||
override_base_url=args.override_base_url)
|
override_base_url=args.override_base_url,
|
||||||
|
platform_override=args.platform_override)
|
||||||
|
|
||||||
# game is either up to date or hasn't changed, so we have nothing to do
|
# game is either up to date or hasn't changed, so we have nothing to do
|
||||||
if not analysis.dl_size:
|
if not analysis.dl_size:
|
||||||
|
@ -372,6 +376,8 @@ def main():
|
||||||
help='Abort if game is not already installed (for automation)')
|
help='Abort if game is not already installed (for automation)')
|
||||||
install_parser.add_argument('--dlm-debug', dest='dlm_debug', action='store_true',
|
install_parser.add_argument('--dlm-debug', dest='dlm_debug', action='store_true',
|
||||||
help='Set download manager and worker processes\' loglevel to debug')
|
help='Set download manager and worker processes\' loglevel to debug')
|
||||||
|
install_parser.add_argument('--platform', dest='platform_override', action='store', metavar='<Platform>',
|
||||||
|
type=str, help='Platform override for download (disables install)')
|
||||||
|
|
||||||
launch_parser.add_argument('--offline', dest='offline', action='store_true',
|
launch_parser.add_argument('--offline', dest='offline', action='store_true',
|
||||||
default=False, help='Skip login and launch game without online authentication')
|
default=False, help='Skip login and launch game without online authentication')
|
||||||
|
|
|
@ -302,7 +302,8 @@ class LegendaryCore:
|
||||||
status_q: Queue = None, max_shm: int = 0, max_workers: int = 0,
|
status_q: Queue = None, max_shm: int = 0, max_workers: int = 0,
|
||||||
force: bool = False, disable_patching: bool = False, game_folder: str = '',
|
force: bool = False, disable_patching: bool = False, game_folder: str = '',
|
||||||
override_manifest: str = '', override_old_manifest: str = '',
|
override_manifest: str = '', override_old_manifest: str = '',
|
||||||
override_base_url: str = '') -> (DLManager, AnalysisResult, ManifestMeta):
|
override_base_url: str = '', platform_override: str = '',
|
||||||
|
) -> (DLManager, AnalysisResult, ManifestMeta):
|
||||||
|
|
||||||
# load old manifest
|
# load old manifest
|
||||||
old_manifest = None
|
old_manifest = None
|
||||||
|
@ -336,9 +337,10 @@ class LegendaryCore:
|
||||||
new_manifest_data = f.read()
|
new_manifest_data = f.read()
|
||||||
else:
|
else:
|
||||||
# get latest manifest from API
|
# get latest manifest from API
|
||||||
|
platform = 'Windows' if not platform_override else platform_override
|
||||||
m_api_r = self.egs.get_game_manifest(game.asset_info.namespace,
|
m_api_r = self.egs.get_game_manifest(game.asset_info.namespace,
|
||||||
game.asset_info.catalog_item_id,
|
game.asset_info.catalog_item_id,
|
||||||
game.app_name)
|
game.app_name, platform)
|
||||||
|
|
||||||
# never seen this outside the launcher itself, but if it happens: PANIC!
|
# never seen this outside the launcher itself, but if it happens: PANIC!
|
||||||
if len(m_api_r['elements']) > 1:
|
if len(m_api_r['elements']) > 1:
|
||||||
|
|
Loading…
Reference in a new issue