From cb7ea25a185fcc8f9991d2dfce19d256fb553ec8 Mon Sep 17 00:00:00 2001 From: derrod Date: Mon, 14 Dec 2020 08:27:02 +0100 Subject: [PATCH] [core/utils] Add version check to game workarounds Also add more games to the list of optimizations being enabled by default. This will bring Pillars of Eternity down to around ~2 GiB shared memory, which is still too much but without implementing another workaround that adds a prefix filter I cannot really fix this. Certainly better than 24... --- legendary/core.py | 2 +- legendary/utils/game_workarounds.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/legendary/core.py b/legendary/core.py index 7037e45..c813705 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -786,7 +786,7 @@ class LegendaryCore: if not max_shm: max_shm = self.lgd.config.getint('Legendary', 'max_memory', fallback=1024) - if dl_optimizations or is_opt_enabled(game.app_name): + if dl_optimizations or is_opt_enabled(game.app_name, new_manifest.meta.build_version): self.log.info('Download order optimizations are enabled.') process_opt = True else: diff --git a/legendary/utils/game_workarounds.py b/legendary/utils/game_workarounds.py index 0ddb3b6..ee16ec4 100644 --- a/legendary/utils/game_workarounds.py +++ b/legendary/utils/game_workarounds.py @@ -1,13 +1,22 @@ # coding: utf-8 # games where the download order optimizations are enabled by default +# a set() of versions can be specified, empty set means all versions. _optimize_default = { - 'wombat', 'snapdragon' + 'wombat': {}, # world war z + 'snapdragon': {}, # metro exodus + 'honeycreeper': {}, # diabotical + 'bcc75c246fe04e45b0c1f1c3fd52503a': { # pillars of eternity + '1.0.2' # problematic version + } } -def is_opt_enabled(app_name): - return app_name.lower() in _optimize_default +def is_opt_enabled(app_name, version): + if (versions := _optimize_default.get(app_name.lower())) is not None: + if version in versions or not versions: + return True + return False _cyberpunk_sdl = {