From 3f1b5b9761b6a7a33a5c88e6030a700a35de7ca6 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Mon, 23 Sep 2024 03:01:00 +0200 Subject: [PATCH 1/2] Added fix for Gothic Playable Teaser --- gamefixes-steam/950670.py | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 gamefixes-steam/950670.py diff --git a/gamefixes-steam/950670.py b/gamefixes-steam/950670.py new file mode 100644 index 0000000..ff12544 --- /dev/null +++ b/gamefixes-steam/950670.py @@ -0,0 +1,53 @@ +"""Game fix for Gothic Playable Teaser""" + +from pathlib import Path +from protonfixes import util +from protonfixes.logger import log + + +def main() -> None: + """Performance fixes and cleanup of excessive logs""" + modify_settings() + clear_logs() + + +def modify_settings() -> None: + # Assure that the settings folder exists + path = Path('GothicRemake/Saved/Config/WindowsNoEditor/') + if not path.is_dir(): + log(f'Creating settings folder "{path}".') + path.mkdir(parents=True, exist_ok=True) + + # Assure, that the settings file exists + # Necessary defaults will still be created by the game + path = path / 'Engine.ini' + if not path.is_file(): + log(f'Creating empty settings file "{path}".') + path.touch(exist_ok=True) + + # Disable excessive (as in gigabytes) logging + # Disable motion blur / depth of field / lens flare + game_opts = """ + [Core.Log] + Global=off + LogInteractiveProcess=all off + + [SystemSettings] + r.MotionBlur.Max=0 + r.MotionBlurQuality=0 + r.DefaultFeature.MotionBlur=0 + r.DepthOfFieldQuality=0 + r.LensFlareQuality=0 + """ + util.set_ini_options(game_opts, path, 'utf-8', 'game') + + +def clear_logs() -> None: + # Clear all logs > 10 MB + log_files = Path('GothicRemake/Saved/Logs').glob('*.log') + for file in log_files: + file_size = file.stat().st_size # Bytes + file_size = file_size // 1000 // 1000 # Megabytes + if file.is_file() and file_size > 10: + log(f'Removing log file "{file}" with a size of {file_size} MB.') + file.unlink() From 0b5c545707898a459fae2aed80ed3d2373dfe824 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Mon, 23 Sep 2024 03:16:58 +0200 Subject: [PATCH 2/2] Call log.info() explicitly --- gamefixes-steam/950670.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gamefixes-steam/950670.py b/gamefixes-steam/950670.py index ff12544..c131069 100644 --- a/gamefixes-steam/950670.py +++ b/gamefixes-steam/950670.py @@ -15,14 +15,14 @@ def modify_settings() -> None: # Assure that the settings folder exists path = Path('GothicRemake/Saved/Config/WindowsNoEditor/') if not path.is_dir(): - log(f'Creating settings folder "{path}".') + log.info(f'Creating settings folder "{path}".') path.mkdir(parents=True, exist_ok=True) # Assure, that the settings file exists # Necessary defaults will still be created by the game path = path / 'Engine.ini' if not path.is_file(): - log(f'Creating empty settings file "{path}".') + log.info(f'Creating empty settings file "{path}".') path.touch(exist_ok=True) # Disable excessive (as in gigabytes) logging @@ -49,5 +49,5 @@ def clear_logs() -> None: file_size = file.stat().st_size # Bytes file_size = file_size // 1000 // 1000 # Megabytes if file.is_file() and file_size > 10: - log(f'Removing log file "{file}" with a size of {file_size} MB.') + log.info(f'Removing log file "{file}" with a size of {file_size} MB.') file.unlink()