From 8206283755d692ba5d8fb6627699f49b7e69294a Mon Sep 17 00:00:00 2001 From: derrod Date: Mon, 2 Nov 2020 19:08:06 +0100 Subject: [PATCH] [core/cli] Warn/Fail if game requires Uplay Addresses #69 but does not fix it. --- legendary/cli.py | 16 +++++++++------- legendary/core.py | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/legendary/cli.py b/legendary/cli.py index 72d4594..4093b1f 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -618,21 +618,23 @@ class LegendaryCLI: logger.info(f'Reusable size: {analysis.reuse_size / 1024 / 1024:.02f} MiB (chunks) / ' f'{analysis.unchanged / 1024 / 1024:.02f} MiB (unchanged)') - res = self.core.check_installation_conditions(analysis=analysis, install=igame, + res = self.core.check_installation_conditions(analysis=analysis, install=igame, game=game, updating=self.core.is_installed(args.app_name), ignore_space_req=args.ignore_space) - if res.failures: - logger.fatal('Download cannot proceed, the following errors occured:') - for msg in sorted(res.failures): - logger.fatal(msg) - exit(1) + if res.warnings or res.failures: + logger.info('Installation requirements check returned the following results:') if res.warnings: - logger.warning('Installation requirements check returned the following warnings:') for warn in sorted(res.warnings): logger.warning(warn) + if res.failures: + for msg in sorted(res.failures): + logger.fatal(msg) + logger.error('Installation cannot proceed, exiting.') + exit(1) + logger.info('Downloads are resumable, you can interrupt the download with ' 'CTRL-C and resume it using the same command later on.') diff --git a/legendary/core.py b/legendary/core.py index 0717a2e..79bddbf 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -833,6 +833,7 @@ class LegendaryCore: @staticmethod def check_installation_conditions(analysis: AnalysisResult, install: InstalledGame, + game: Game, updating: bool = False, ignore_space_req: bool = False) -> ConditionCheckResult: results = ConditionCheckResult(failures=set(), warnings=set()) @@ -871,6 +872,26 @@ class LegendaryCore: results.failures.add(f'Not enough available disk space!' f'{free_mib:.02f} MiB < {required_mib:.02f} MiB') + # check if the game actually ships the files or just a uplay installer + packed game files + executables = [f for f in analysis.manifest_comparison.added if + f.endswith('.exe') and not f.startswith('Installer/')] + if not any('uplay' not in e.lower() for e in executables): + results.failures.add('This game requires installation via Uplay and does not ship executable game files.') + + # check if the game launches via uplay + if install.executable == 'UplayLaunch.exe': + results.warnings.add('This game requires launching via Uplay, it is recommended to install the game ' + 'via Uplay instead.') + + # check if the game requires linking to an external account first + partner_link = game.metadata.get('customAttributes', {}).get('partnerLinkType', {}).get('value', None) + if partner_link == 'ubisoft': + results.warnings.add('This game requires linking to and activating on a Ubisoft account first, ' + 'this is not currently supported.') + elif partner_link: + results.warnings.add(f'This game requires linking to "{partner_link}", ' + f'this is currently unsupported and the game may not work.') + return results def get_default_install_dir(self):