diff --git a/legendary/cli.py b/legendary/cli.py index da98c8a..0fb68f5 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -24,6 +24,7 @@ from legendary.models.game import SaveGameStatus, VerifyResult from legendary.utils.cli import get_boolean_choice from legendary.utils.custom_parser import AliasedSubParsersAction from legendary.utils.lfs import validate_files +from legendary.utils.game_workarounds import cyber_prompt_2077 # todo custom formatter for cli logger (clean info, highlighted error/warning) logging.basicConfig( @@ -577,6 +578,16 @@ class LegendaryCLI: else: logger.info(f'Using existing repair file: {repair_file}') + # Workaround for Cyberpunk 2077 preload + if game.app_name.startswith('Ginger'): + if not self.core.is_installed(game.app_name): + args.install_tag = cyber_prompt_2077() + if game.app_name not in self.core.lgd.config: + self.core.lgd.config[game.app_name] = dict() + self.core.lgd.config.set(game.app_name, 'install_tags', ','.join(args.install_tag)) + else: + args.install_tag = self.core.lgd.config.get(game.app_name, 'install_tags', fallback='').split(',') + logger.info('Preparing download...') # todo use status queue to print progress from CLI # This has become a little ridiculous hasn't it? diff --git a/legendary/utils/game_workarounds.py b/legendary/utils/game_workarounds.py index 3da0d66..0ddb3b6 100644 --- a/legendary/utils/game_workarounds.py +++ b/legendary/utils/game_workarounds.py @@ -8,3 +8,39 @@ _optimize_default = { def is_opt_enabled(app_name): return app_name.lower() in _optimize_default + + +_cyberpunk_sdl = { + 'de': {'tags': ['voice_de_de'], 'name': 'Deutsch'}, + 'es': {'tags': ['voice_es_es'], 'name': 'español (España)'}, + 'fr': {'tags': ['voice_fr_fr'], 'name': 'français'}, + 'it': {'tags': ['voice_it_it'], 'name': 'italiano'}, + 'ja': {'tags': ['voice_ja_jp'], 'name': '日本語'}, + 'ko': {'tags': ['voice_ko_kr'], 'name': '한국어'}, + 'pl': {'tags': ['voice_pl_pl'], 'name': 'polski'}, + 'pt': {'tags': ['voice_pt_br'], 'name': 'português brasileiro'}, + 'ru': {'tags': ['voice_ru_ru'], 'name': 'русский'}, + 'zh': {'tags': ['voice_zh_cn'], 'name': '中文(中国)'} +} + + +def cyber_prompt_2077(): + print('You are about to install Cyberpunk 2077, this game supports selective downloads for langauge packs.') + print('The following language packs are available:') + for tag, info in _cyberpunk_sdl.items(): + print(' *', tag, '-', info['name']) + + print('Please enter a comma-separated list of language packs to install (leave blank for english only)') + choices = input('Additional languages [e.g. de,fr]: ') + if not choices: + return [''] + + tags = [''] + for c in choices.split(','): + c = c.strip() + if c in _cyberpunk_sdl: + tags.extend(_cyberpunk_sdl[c]['tags']) + else: + print('Invalid tag:', c) + + return tags