From 971f19660909c383f2891d00d2cc70de030d1b7c Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Fri, 24 Jun 2022 23:31:02 -0600 Subject: [PATCH] Add witcher 3 displayport auto-setting --- Wabbajack.Installer/StandardInstaller.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Wabbajack.Installer/StandardInstaller.cs b/Wabbajack.Installer/StandardInstaller.cs index 365fcb60..d14cc889 100644 --- a/Wabbajack.Installer/StandardInstaller.cs +++ b/Wabbajack.Installer/StandardInstaller.cs @@ -393,6 +393,28 @@ public class StandardInstaller : AInstaller { _logger.LogCritical(ex, "Skipping screen size remap for {file} due to parse error.", file); } + + // The Witcher 3 + if (_configuration.Game == Game.Witcher3) + { + var name = (RelativePath)"user.settings"; + foreach (var file in _configuration.Install.Combine("profiles").EnumerateFiles() + .Where(f => f.FileName == name)) + { + try + { + var parser = new FileIniDataParser(new IniDataParser(config)); + var data = parser.ReadFile(file.ToString()); + data["Viewport"]["Resolution"] = + $"{_configuration.SystemParameters!.ScreenWidth}x{_configuration.SystemParameters!.ScreenHeight}"; + parser.WriteFile(file.ToString(), data); + } + catch (Exception ex) + { + _logger.LogInformation(ex, "While remapping user.settings"); + } + } + } } private async Task WriteRemappedFile(RemappedInlineFile directive)