diff --git a/src/XIVLauncher.Common.Unix/Compatibility/CompatibilityTools.cs b/src/XIVLauncher.Common.Unix/Compatibility/CompatibilityTools.cs index 33b6759be..3c3cc608b 100644 --- a/src/XIVLauncher.Common.Unix/Compatibility/CompatibilityTools.cs +++ b/src/XIVLauncher.Common.Unix/Compatibility/CompatibilityTools.cs @@ -44,6 +44,7 @@ public class CompatibilityTools public bool IsToolDownloaded => File.Exists(Wine64Path) && Settings.Prefix.Exists; private readonly Dxvk.DxvkHudType hudType; + private readonly string dxvkFPSLimit; private readonly bool gamemodeOn; private readonly string dxvkAsyncOn; @@ -183,6 +184,7 @@ private Process RunInPrefix(ProcessStartInfo psi, string workingDirectory, IDict wineEnviromentVariables.Add("DXVK_HUD", dxvkHud); wineEnviromentVariables.Add("DXVK_ASYNC", dxvkAsyncOn); + wineEnviromentVariables.Add("DXVK_FRAME_RATE", Settings.DxvkFPSLimit); wineEnviromentVariables.Add("WINEESYNC", Settings.EsyncOn); wineEnviromentVariables.Add("WINEFSYNC", Settings.FsyncOn); diff --git a/src/XIVLauncher.Common.Unix/Compatibility/WineSettings.cs b/src/XIVLauncher.Common.Unix/Compatibility/WineSettings.cs index 9b122f7aa..0987879a5 100644 --- a/src/XIVLauncher.Common.Unix/Compatibility/WineSettings.cs +++ b/src/XIVLauncher.Common.Unix/Compatibility/WineSettings.cs @@ -19,15 +19,18 @@ public class WineSettings public string EsyncOn { get; private set; } public string FsyncOn { get; private set; } + public string DxvkFPSLimit { get; private set; } + public string DebugVars { get; private set; } public FileInfo LogFile { get; private set; } public DirectoryInfo Prefix { get; private set; } - public WineSettings(WineStartupType? startupType, string customBinPath, string debugVars, FileInfo logFile, DirectoryInfo prefix, bool? esyncOn, bool? fsyncOn) + public WineSettings(WineStartupType? startupType, string customBinPath, string debugVars, FileInfo logFile, DirectoryInfo prefix, bool? esyncOn, bool? fsyncOn, string dxvkFPSLimit) { this.StartupType = startupType ?? WineStartupType.Custom; this.CustomBinPath = customBinPath; + this.DxvkFPSLimit = dxvkFPSLimit; this.EsyncOn = (esyncOn ?? false) ? "1" : "0"; this.FsyncOn = (fsyncOn ?? false) ? "1" : "0"; this.DebugVars = debugVars; diff --git a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs index 10d5f9d17..d43b429cc 100644 --- a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs +++ b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs @@ -1,4 +1,5 @@ using System.Numerics; +using System.Text.RegularExpressions; using System.Runtime.InteropServices; using ImGuiNET; using XIVLauncher.Common.Unix.Compatibility; @@ -51,7 +52,10 @@ public SettingsTabWine() return null; } }, - + new SettingsEntry("DXVK Frame Limit", "Configure how many frames DXVK should be limited to. Set to 0 for unlimited.", () => Program.Config.DxvkFrameRate ?? "0", s => Program.Config.DxvkFrameRate = s) + { + CheckValidity = s => Regex.IsMatch(s, @"^\d{1,3}$") ? null : "Please specify a valid integer below 999." + }, new SettingsEntry("DXVK Overlay", "Configure how much of the DXVK overlay is to be shown.", () => Program.Config.DxvkHudType, type => Program.Config.DxvkHudType = type), new SettingsEntry("WINEDEBUG Variables", "Configure debug logging for wine. Useful for troubleshooting.", () => Program.Config.WineDebugVars ?? string.Empty, s => Program.Config.WineDebugVars = s) }; diff --git a/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs b/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs index bd72c4e2e..e1de2b311 100644 --- a/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs +++ b/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs @@ -72,6 +72,8 @@ public interface ILauncherConfig public bool? FSyncEnabled { get; set; } + public string DxvkFrameRate { get; set; } + public Dxvk.DxvkHudType DxvkHudType { get; set; } public string? WineDebugVars { get; set; } diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index 010eac228..ffb238f95 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -113,6 +113,7 @@ private static void LoadConfig(Storage storage) Config.GameModeEnabled ??= false; Config.DxvkAsyncEnabled ??= true; + Config.DxvkFrameRate ??= "0"; Config.ESyncEnabled ??= true; Config.FSyncEnabled ??= false; @@ -276,7 +277,8 @@ public static void CreateCompatToolsInstance() { var wineLogFile = new FileInfo(Path.Combine(storage.GetFolder("logs").FullName, "wine.log")); var winePrefix = storage.GetFolder("wineprefix"); - var wineSettings = new WineSettings(Config.WineStartupType, Config.WineBinaryPath, Config.WineDebugVars, wineLogFile, winePrefix, Config.ESyncEnabled, Config.FSyncEnabled); + var wineSettings = new WineSettings(Config.WineStartupType, Config.WineBinaryPath, Config.WineDebugVars, wineLogFile, winePrefix, Config.ESyncEnabled, Config.FSyncEnabled, + Config.DxvkFrameRate); var toolsFolder = storage.GetFolder("compatibilitytool"); CompatibilityTools = new CompatibilityTools(wineSettings, Config.DxvkHudType, Config.GameModeEnabled, Config.DxvkAsyncEnabled, toolsFolder); }