Skip to content

Commit 80153d0

Browse files
committed
[cli/utils] Add Cyberpunk 2077 language pack hack
1 parent 1640a47 commit 80153d0

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

legendary/cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from legendary.utils.cli import get_boolean_choice
2525
from legendary.utils.custom_parser import AliasedSubParsersAction
2626
from legendary.utils.lfs import validate_files
27+
from legendary.utils.game_workarounds import cyber_prompt_2077
2728

2829
# todo custom formatter for cli logger (clean info, highlighted error/warning)
2930
logging.basicConfig(
@@ -577,6 +578,16 @@ def install_game(self, args):
577578
else:
578579
logger.info(f'Using existing repair file: {repair_file}')
579580

581+
# Workaround for Cyberpunk 2077 preload
582+
if game.app_name.startswith('Ginger'):
583+
if not self.core.is_installed(game.app_name):
584+
args.install_tag = cyber_prompt_2077()
585+
if game.app_name not in self.core.lgd.config:
586+
self.core.lgd.config[game.app_name] = dict()
587+
self.core.lgd.config.set(game.app_name, 'install_tags', ','.join(args.install_tag))
588+
else:
589+
args.install_tag = self.core.lgd.config.get(game.app_name, 'install_tags', fallback='').split(',')
590+
580591
logger.info('Preparing download...')
581592
# todo use status queue to print progress from CLI
582593
# This has become a little ridiculous hasn't it?

legendary/utils/game_workarounds.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,39 @@
88

99
def is_opt_enabled(app_name):
1010
return app_name.lower() in _optimize_default
11+
12+
13+
_cyberpunk_sdl = {
14+
'de': {'tags': ['voice_de_de'], 'name': 'Deutsch'},
15+
'es': {'tags': ['voice_es_es'], 'name': 'español (España)'},
16+
'fr': {'tags': ['voice_fr_fr'], 'name': 'français'},
17+
'it': {'tags': ['voice_it_it'], 'name': 'italiano'},
18+
'ja': {'tags': ['voice_ja_jp'], 'name': '日本語'},
19+
'ko': {'tags': ['voice_ko_kr'], 'name': '한국어'},
20+
'pl': {'tags': ['voice_pl_pl'], 'name': 'polski'},
21+
'pt': {'tags': ['voice_pt_br'], 'name': 'português brasileiro'},
22+
'ru': {'tags': ['voice_ru_ru'], 'name': 'русский'},
23+
'zh': {'tags': ['voice_zh_cn'], 'name': '中文(中国)'}
24+
}
25+
26+
27+
def cyber_prompt_2077():
28+
print('You are about to install Cyberpunk 2077, this game supports selective downloads for langauge packs.')
29+
print('The following language packs are available:')
30+
for tag, info in _cyberpunk_sdl.items():
31+
print(' *', tag, '-', info['name'])
32+
33+
print('Please enter a comma-separated list of language packs to install (leave blank for english only)')
34+
choices = input('Additional languages [e.g. de,fr]: ')
35+
if not choices:
36+
return ['']
37+
38+
tags = ['']
39+
for c in choices.split(','):
40+
c = c.strip()
41+
if c in _cyberpunk_sdl:
42+
tags.extend(_cyberpunk_sdl[c]['tags'])
43+
else:
44+
print('Invalid tag:', c)
45+
46+
return tags

0 commit comments

Comments
 (0)