From 27051f75f7129ecd858f1e0fc28a03e3ba17bb7e Mon Sep 17 00:00:00 2001 From: zish <37426682+Zi-SH@users.noreply.github.com> Date: Sun, 29 May 2022 18:14:10 -0400 Subject: [PATCH 1/2] Added support for DXVK_FRAME_RATE --- .../Compatibility/CompatibilityTools.cs | 2 ++ src/XIVLauncher.Common.Unix/Compatibility/WineSettings.cs | 5 ++++- .../Components/SettingsPage/Tabs/SettingsTabWine.cs | 7 ++++++- src/XIVLauncher.Core/Configuration/ILauncherConfig.cs | 2 ++ src/XIVLauncher.Core/Program.cs | 4 +++- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/XIVLauncher.Common.Unix/Compatibility/CompatibilityTools.cs b/src/XIVLauncher.Common.Unix/Compatibility/CompatibilityTools.cs index f9e59afcb..34e85c8dd 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 = "", 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 a1b2f15e7..0c8b782f6 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,11 @@ 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) + { + CheckVisibility = () => RuntimeInformation.IsOSPlatform(OSPlatform.Linux), + 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 169342921..2cf7b5719 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); } From 21c03aa6337f7beea166d9dac4c1531cf8ab4cf6 Mon Sep 17 00:00:00 2001 From: zish <37426682+Zi-SH@users.noreply.github.com> Date: Sat, 4 Jun 2022 15:32:45 -0400 Subject: [PATCH 2/2] Removed Linux-only option --- .../Components/SettingsPage/Tabs/SettingsTabWine.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs index 0c8b782f6..b2831931e 100644 --- a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs +++ b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs @@ -54,7 +54,6 @@ public SettingsTabWine() }, 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) { - CheckVisibility = () => RuntimeInformation.IsOSPlatform(OSPlatform.Linux), 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),