From d13893132dea5f580e1459965f6159ebd976e887 Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sat, 31 Aug 2024 14:40:29 -0700 Subject: [PATCH 01/11] Detect nvidia wine dlls needed for dlss --- .../CoreEnvironmentSettings.cs | 28 +++++++++++++++++++ src/XIVLauncher.Core/Program.cs | 4 +++ 2 files changed, 32 insertions(+) diff --git a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs index e54d69eb..d3b0f13f 100644 --- a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs +++ b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs @@ -73,4 +73,32 @@ static public bool IsGameModeInstalled() gameModeInstalled = false; return gameModeInstalled ?? false; } + + static private string? nvidiaWinePath = Environment.GetEnvironmentVariable("XL_NVIDIAWINEPATH"); + + static public string? NvidiaWineDLLPath() + { + if (nvidiaWinePath is not null) + if (File.Exists(Path.Combine(nvidiaWinePath, "nvngx.dll"))) + return nvidiaWinePath; + else + return ""; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + var psi = new ProcessStartInfo("find"); + psi.Arguments = "-L /lib -name \"nvngx.dll\""; + psi.RedirectStandardOutput = true; + var findCmd = new Process(); + findCmd.StartInfo = psi; + findCmd.Start(); + + var output = findCmd.StandardOutput.ReadToEnd(); + var nvngx = new FileInfo(output.Split('\n', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault()); + nvidiaWinePath = nvngx.DirectoryName; + } + else + nvidiaWinePath = ""; + return nvidiaWinePath ?? ""; + } } diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index e35a5a2f..81bf52bb 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -264,6 +264,10 @@ private static void Main(string[] args) CreateCompatToolsInstance(); + Console.WriteLine($"Nvidia Wine Path: {CoreEnvironmentSettings.NvidiaWineDLLPath()}"); + if (!string.IsNullOrEmpty(CoreEnvironmentSettings.NvidiaWineDLLPath())) + Log.Information($"Nvidia Wine DLLs found at: {CoreEnvironmentSettings.NvidiaWineDLLPath()}"); + Log.Debug("Creating Veldrid devices..."); #if DEBUG From 5465894a79a4492e9cffe58982b91919e8fc4944 Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sat, 31 Aug 2024 15:37:57 -0700 Subject: [PATCH 02/11] Add preliminary nvapi support --- .../Configuration/ILauncherConfig.cs | 2 + .../CoreEnvironmentSettings.cs | 11 ++- src/XIVLauncher.Core/Program.cs | 10 +-- .../UnixCompatibility/Dxvk.cs | 76 ++++++++++++++++--- .../UnixCompatibility/Wine.cs | 8 +- 5 files changed, 82 insertions(+), 25 deletions(-) diff --git a/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs b/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs index 9fef0eb1..eb782540 100644 --- a/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs +++ b/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs @@ -77,6 +77,8 @@ public interface ILauncherConfig public string? DxvkVersion { get; set; } + public string? NvapiVersion { get; set; } + public int? DxvkFrameRateLimit { get; set; } public DxvkHud? DxvkHud { get; set; } diff --git a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs index d3b0f13f..29e82cbf 100644 --- a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs +++ b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs @@ -76,13 +76,16 @@ static public bool IsGameModeInstalled() static private string? nvidiaWinePath = Environment.GetEnvironmentVariable("XL_NVIDIAWINEPATH"); + static public bool IsDLSSAvailable => !string.IsNullOrEmpty(NvidiaWineDLLPath()); + static public string? NvidiaWineDLLPath() { if (nvidiaWinePath is not null) - if (File.Exists(Path.Combine(nvidiaWinePath, "nvngx.dll"))) - return nvidiaWinePath; - else - return ""; + { + if (!File.Exists(Path.Combine(nvidiaWinePath, "nvngx.dll"))) + nvidiaWinePath = ""; + return nvidiaWinePath; + } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index 81bf52bb..3d98f969 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -127,12 +127,14 @@ private static void LoadConfig(Storage storage) Config.WineType ??= WineType.Managed; if (!Wine.Versions.ContainsKey(Config.WineVersion ?? "")) - Config.WineVersion = "wine-xiv-staging-fsync-git-8.5.r4.g4211bac7"; + Config.WineVersion = Wine.GetDefaultVersion(); Config.WineBinaryPath ??= "/usr/bin"; Config.WineDebugVars ??= "-all"; if (!Dxvk.Versions.ContainsKey(Config.DxvkVersion ?? "")) - Config.DxvkVersion = "dxvk-async-1.10.3"; + Config.DxvkVersion = Dxvk.GetDefaultVersion(); + if (!Dxvk.NvapiVersions.ContainsKey(Config.NvapiVersion ?? "")) + Config.DxvkVersion = Dxvk.GetDefaultNvapiVersion(); Config.DxvkAsyncEnabled ??= true; Config.DxvkFrameRateLimit ??= 0; Config.DxvkHud ??= DxvkHud.None; @@ -264,10 +266,6 @@ private static void Main(string[] args) CreateCompatToolsInstance(); - Console.WriteLine($"Nvidia Wine Path: {CoreEnvironmentSettings.NvidiaWineDLLPath()}"); - if (!string.IsNullOrEmpty(CoreEnvironmentSettings.NvidiaWineDLLPath())) - Log.Information($"Nvidia Wine DLLs found at: {CoreEnvironmentSettings.NvidiaWineDLLPath()}"); - Log.Debug("Creating Veldrid devices..."); #if DEBUG diff --git a/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs b/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs index db389e25..4cc45bc2 100644 --- a/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs +++ b/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs @@ -17,7 +17,11 @@ public static class Dxvk public static string FolderName => Program.Config.DxvkVersion ?? GetDefaultVersion(); - public static string DownloadUrl => GetDownloadUrl(Program.Config.DxvkVersion); + public static string DownloadUrl => GetDownloadUrl(FolderName); + + public static string NvapiFolderName => Program.Config.NvapiVersion ?? GetDefaultNvapiVersion(); + + public static string NvapiDownloadUrl => GetNvapiDownloadUrl(NvapiFolderName); public static int FrameRateLimit => Program.Config.DxvkFrameRateLimit ?? 0; @@ -59,14 +63,14 @@ public static class Dxvk public static Dictionary> Versions { get; private set; } + public static Dictionary> NvapiVersions { get; private set; } + static Dxvk() { Versions = new Dictionary>(); + NvapiVersions = new Dictionary>(); MangoHudInstalled = DxvkSettings.MangoHudIsInstalled(); - } - public static void Initialize() - { // Add default versions. Versions["dxvk-2.4"] = new Dictionary() { @@ -92,6 +96,29 @@ public static void Initialize() {"label", "Disabled"} }; + NvapiVersions["dxvk-nvapi-v0.7.1"] = new Dictionary() + { + {"name", "dxvk-nvapi 0.7.1"}, {"desc", "dxvk-nvapi 0.7.1. Latest version, should be compatible with latest Nvidia drivers." }, + {"label", "Current"}, {"url", "https://github.com/jp7677/dxvk-nvapi/releases/download/v0.7.1/dxvk-nvapi-v0.7.1.tar.gz"}, + {"mark", "download"} + }; + + NvapiVersions["dxvk-nvapi-v0.6.4"] = new Dictionary() + { + {"name", "dxvk-nvapi 0.6.4"}, {"desc", "dxvk-nvapi 0.6.4. Try this if 0.7.1 doesn't work." }, + {"label", "Current"}, {"url", "https://github.com/jp7677/dxvk-nvapi/releases/download/v0.6.4/dxvk-nvapi-v0.6.4.tar.gz"}, + {"mark", "download"} + }; + + NvapiVersions["DISABLED"] = new Dictionary() + { + {"name", "Disabled"}, {"desc", "Don't use Dxvk-nvapi. DLSS will not be available. (FSR2 mod still works)"}, + {"label", "DLSS Off"} + }; + } + + public static void Initialize() + { var toolDirectory = new DirectoryInfo(Path.Combine(Program.storage.Root.FullName, "compatibilitytool", "dxvk")); if (!toolDirectory.Exists) @@ -104,15 +131,27 @@ public static void Initialize() { if (Directory.Exists(Path.Combine(dxvkDir.FullName, "x64")) && Directory.Exists(Path.Combine(dxvkDir.FullName, "x32"))) { - if (Versions.ContainsKey(dxvkDir.Name)) + if (dxvkDir.Name.Contains("nvapi")) + { + if (NvapiVersions.ContainsKey(dxvkDir.Name)) + { + NvapiVersions[dxvkDir.Name].Remove("mark"); + continue; + } + NvapiVersions[dxvkDir.Name] = new Dictionary() { {"label", "Custom"} }; + } + else { - if (dxvkDir.Name == "DISABLED") - Log.Error("Cannot use custom DXVK with folder name DISABLED. Skipping."); - else - Versions[dxvkDir.Name].Remove("mark"); - continue; + if (Versions.ContainsKey(dxvkDir.Name)) + { + if (dxvkDir.Name == "DISABLED") + Log.Error("Cannot use custom DXVK with folder name DISABLED. Skipping."); + else + Versions[dxvkDir.Name].Remove("mark"); + continue; + } + Versions[dxvkDir.Name] = new Dictionary() { {"label", "Custom"} }; } - Versions[dxvkDir.Name] = new Dictionary() { {"label", "Custom"} }; } } } @@ -134,6 +173,21 @@ public static string GetDefaultVersion() return Versions.First().Key; } + public static string GetNvapiDownloadUrl(string? name) + { + name ??= GetDefaultNvapiVersion(); + if (NvapiVersions.ContainsKey(name)) + return NvapiVersions[name].ContainsKey("url") ? NvapiVersions[name]["url"] : ""; + return Versions[GetDefaultNvapiVersion()].ContainsKey("url") ? Versions[GetDefaultNvapiVersion()]["url"] : ""; + } + + public static string GetDefaultNvapiVersion() + { + if (NvapiVersions.ContainsKey("dxvk-nvapi-v0.7.1")) + return "dxvk-nvapi-v0.7.1"; + return NvapiVersions.First().Key; + } + } public enum DxvkHud diff --git a/src/XIVLauncher.Core/UnixCompatibility/Wine.cs b/src/XIVLauncher.Core/UnixCompatibility/Wine.cs index 3d34dfe7..8e347810 100644 --- a/src/XIVLauncher.Core/UnixCompatibility/Wine.cs +++ b/src/XIVLauncher.Core/UnixCompatibility/Wine.cs @@ -35,10 +35,7 @@ public static class Wine static Wine() { Versions = new Dictionary>(); - } - - public static void Initialize() - { + // Add default versions. Versions["wine-xiv-staging-fsync-git-7.10.r3.g560db77d"] = new Dictionary() { @@ -52,7 +49,10 @@ public static void Initialize() {"label", "Official"}, {"url", $"https://github.com/goatcorp/wine-xiv-git/releases/download/8.5.r4.g4211bac7/wine-xiv-staging-fsync-git-{OSInfo.Package.ToString()}-8.5.r4.g4211bac7.tar.xz"}, {"mark", "Download"} }; + } + public static void Initialize() + { var toolDirectory = new DirectoryInfo(Path.Combine(Program.storage.Root.FullName, "compatibilitytool", "wine")); if (!toolDirectory.Exists) From 9b09d518ed592905f378776e1b6ccd5ee7575f59 Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sat, 31 Aug 2024 16:10:21 -0700 Subject: [PATCH 03/11] Fix incorrect DxvkVersion assignment --- src/XIVLauncher.Core/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index 3d98f969..fd59d721 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -134,7 +134,7 @@ private static void LoadConfig(Storage storage) if (!Dxvk.Versions.ContainsKey(Config.DxvkVersion ?? "")) Config.DxvkVersion = Dxvk.GetDefaultVersion(); if (!Dxvk.NvapiVersions.ContainsKey(Config.NvapiVersion ?? "")) - Config.DxvkVersion = Dxvk.GetDefaultNvapiVersion(); + Config.NvapiVersion = Dxvk.GetDefaultNvapiVersion(); Config.DxvkAsyncEnabled ??= true; Config.DxvkFrameRateLimit ??= 0; Config.DxvkHud ??= DxvkHud.None; From 0651ce1ab0103f28889f67f61028b72b9bab6cd1 Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sat, 31 Aug 2024 19:06:31 -0700 Subject: [PATCH 04/11] Add Nvapi to the UI --- .../Components/SettingsPage/Tabs/SettingsTabDxvk.cs | 12 ++++++++++++ src/XIVLauncher.Core/Program.cs | 4 ++-- src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs | 9 +++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabDxvk.cs b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabDxvk.cs index a8374345..d0ed274a 100644 --- a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabDxvk.cs +++ b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabDxvk.cs @@ -32,6 +32,18 @@ public SettingsTabDxvk() CheckVisibility = () => dxvkVersionSetting.Value != "DISABLED", }, + new DictionarySettingsEntry("Nvapi Version", $"Choose which version of dxvk-nvapi to use. Wine >= 9.0 or Valve Wine (wine-ge/valvebe) >= 8.x are needed for DLSS.", Dxvk.NvapiVersions, () => Program.Config.NvapiVersion ?? Dxvk.GetDefaultNvapiVersion(), s => Program.Config.NvapiVersion = s, Dxvk.GetDefaultVersion()) + { + CheckWarning = s => + { + if (s == "DISABLED") return null; + if (!DxvkSettings.DxvkAllowsNvapi(dxvkVersionSetting.Value)) + return "Nvapi/DLSS requires DXVK 2.0 or greater."; + return null; + }, + CheckVisibility = () => dxvkVersionSetting.Value != "DISABLED" && CoreEnvironmentSettings.IsDLSSAvailable, + }, + dxvkHudSetting = new SettingsEntry("DXVK Overlay", "DXVK Hud is included with DXVK. MangoHud must be installed separately.\nFlatpak users need the flatpak version of MangoHud.", () => Program.Config.DxvkHud ?? DxvkHud.None, x => Program.Config.DxvkHud = x) { CheckVisibility = () => dxvkVersionSetting.Value != "DISABLED", diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index fd59d721..b6c1f0b3 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -368,10 +368,10 @@ private static void Main(string[] args) public static void CreateCompatToolsInstance() { - var dxvkSettings = new DxvkSettings(Dxvk.FolderName, Dxvk.DownloadUrl, storage.Root.FullName, Dxvk.AsyncEnabled, Dxvk.FrameRateLimit, Dxvk.DxvkHudEnabled, Dxvk.DxvkHudString, Dxvk.MangoHudEnabled, Dxvk.MangoHudCustomIsFile, Dxvk.MangoHudString, Dxvk.Enabled); + var dxvkSettings = new DxvkSettings(Dxvk.FolderName, Dxvk.DownloadUrl, storage.Root.FullName, Dxvk.AsyncEnabled, Dxvk.FrameRateLimit, Dxvk.DxvkHudEnabled, Dxvk.DxvkHudString, Dxvk.MangoHudEnabled, Dxvk.MangoHudCustomIsFile, Dxvk.MangoHudString, Dxvk.Enabled, Dxvk.NvapiFolderName, Dxvk.NvapiDownloadUrl, Dxvk.NvngxFolderName); var wineSettings = new WineSettings(Wine.IsManagedWine, Wine.CustomWinePath, Wine.FolderName, Wine.DownloadUrl, storage.Root, Wine.DebugVars, Wine.LogFile, Wine.Prefix, Wine.ESyncEnabled, Wine.FSyncEnabled); var toolsFolder = storage.GetFolder("compatibilitytool"); - CompatibilityTools = new CompatibilityTools(wineSettings, dxvkSettings, Config.GameModeEnabled, toolsFolder, OSInfo.IsFlatpak); + CompatibilityTools = new CompatibilityTools(wineSettings, dxvkSettings, Config.GameModeEnabled, toolsFolder, Config.GamePath, OSInfo.IsFlatpak); } public static void ShowWindow() diff --git a/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs b/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs index 4cc45bc2..b51f9cf3 100644 --- a/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs +++ b/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs @@ -8,6 +8,7 @@ using Serilog; using XIVLauncher.Common; using XIVLauncher.Common.Unix.Compatibility; +using XIVLauncher.Core; namespace XIVLauncher.Core.UnixCompatibility; @@ -19,9 +20,13 @@ public static class Dxvk public static string DownloadUrl => GetDownloadUrl(FolderName); - public static string NvapiFolderName => Program.Config.NvapiVersion ?? GetDefaultNvapiVersion(); + public static string NvapiFolderName => NvapiEnabled ? Program.Config.NvapiVersion ?? GetDefaultNvapiVersion() : ""; - public static string NvapiDownloadUrl => GetNvapiDownloadUrl(NvapiFolderName); + public static string NvapiDownloadUrl => NvapiEnabled ? GetNvapiDownloadUrl(NvapiFolderName) : ""; + + public static string NvngxFolderName => NvapiEnabled ? CoreEnvironmentSettings.NvidiaWineDLLPath() : ""; + + public static bool NvapiEnabled => CoreEnvironmentSettings.IsDLSSAvailable && Program.Config.NvapiVersion != "DISABLED"; public static int FrameRateLimit => Program.Config.DxvkFrameRateLimit ?? 0; From 20265b62450b0b234ebca5979f22233f247e0dc8 Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sat, 31 Aug 2024 19:12:21 -0700 Subject: [PATCH 05/11] Add correct submodule --- lib/FFXIVQuickLauncher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/FFXIVQuickLauncher b/lib/FFXIVQuickLauncher index 04da286c..4d70a8e8 160000 --- a/lib/FFXIVQuickLauncher +++ b/lib/FFXIVQuickLauncher @@ -1 +1 @@ -Subproject commit 04da286ca9442133724a3611172737c24fb97ef4 +Subproject commit 4d70a8e8a133f0f91202044909c8f63f16cbf06c From 109faf3cfeadd200be2f57674f37ac45219bfd3d Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sun, 1 Sep 2024 12:24:19 -0700 Subject: [PATCH 06/11] Add XL_FORCE_DLSS option * The launcher will assume nvngx dlls are in the game folder already * Renamed XL_NVIDIAWINEPTH to XL_NVNGXPATH * Also search ~/.xlcore/compatibilitytool/nvidia for nvngx dlls --- .../CoreEnvironmentSettings.cs | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs index 29e82cbf..0d42bcbd 100644 --- a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs +++ b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs @@ -20,6 +20,8 @@ public static class CoreEnvironmentSettings public static bool? UseSteam => CheckEnvBoolOrNull("XL_USE_STEAM"); // Fix for Steam Deck users who lock themselves out public static bool IsSteamCompatTool => CheckEnvBool("XL_SCT"); + public static bool ForceDLSS => CheckEnvBool("XL_FORCE_DLSS"); // Don't search for nvngx.dll. Assume it's already in the game directory. + private static bool CheckEnvBool(string key) { string val = (System.Environment.GetEnvironmentVariable(key) ?? string.Empty).ToLower(); @@ -74,9 +76,9 @@ static public bool IsGameModeInstalled() return gameModeInstalled ?? false; } - static private string? nvidiaWinePath = Environment.GetEnvironmentVariable("XL_NVIDIAWINEPATH"); + static private string? nvidiaWinePath = ForceDLSS ? "" : Environment.GetEnvironmentVariable("XL_NVNGXPATH"); - static public bool IsDLSSAvailable => !string.IsNullOrEmpty(NvidiaWineDLLPath()); + static public bool IsDLSSAvailable => !string.IsNullOrEmpty(NvidiaWineDLLPath()) || ForceDLSS; static public string? NvidiaWineDLLPath() { @@ -89,19 +91,30 @@ static public bool IsGameModeInstalled() if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - var psi = new ProcessStartInfo("find"); - psi.Arguments = "-L /lib -name \"nvngx.dll\""; - psi.RedirectStandardOutput = true; - var findCmd = new Process(); - findCmd.StartInfo = psi; - findCmd.Start(); + string[] targets = { "/lib", Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".xlcore", "compatibilitytool", "nvidia") }; + foreach (var target in targets) + { + Console.WriteLine($"target = {target}"); + var psi = new ProcessStartInfo("/bin/find"); + psi.Arguments = $"-L {target} -name \"nvngx.dll\""; + psi.RedirectStandardOutput = true; + var findCmd = new Process(); + findCmd.StartInfo = psi; + findCmd.Start(); - var output = findCmd.StandardOutput.ReadToEnd(); - var nvngx = new FileInfo(output.Split('\n', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault()); - nvidiaWinePath = nvngx.DirectoryName; + var output = findCmd.StandardOutput.ReadToEnd(); + if (!string.IsNullOrWhiteSpace(output)) + { + var nvngx = new FileInfo(output.Split('\n', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault()); + nvidiaWinePath = nvngx.DirectoryName; + break; + } + } } else nvidiaWinePath = ""; + nvidiaWinePath ??= ""; + Console.WriteLine($"nvngx path = {nvidiaWinePath}"); return nvidiaWinePath ?? ""; } } From f095ae54d2300c9bfb1e94dcd079b3869c52485e Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sun, 1 Sep 2024 13:27:12 -0700 Subject: [PATCH 07/11] Update submodule --- lib/FFXIVQuickLauncher | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/FFXIVQuickLauncher b/lib/FFXIVQuickLauncher index 4d70a8e8..33f8b423 160000 --- a/lib/FFXIVQuickLauncher +++ b/lib/FFXIVQuickLauncher @@ -1 +1 @@ -Subproject commit 4d70a8e8a133f0f91202044909c8f63f16cbf06c +Subproject commit 33f8b423d03be2103f8386759a152b21dc9c8825 From 33f366570df2db3bedb659f62823c09cceca7060 Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sun, 1 Sep 2024 13:45:54 -0700 Subject: [PATCH 08/11] Code cleanup, remove some extra debug stuff --- .../CoreEnvironmentSettings.cs | 22 +++++++++---------- .../UnixCompatibility/Dxvk.cs | 6 ++--- .../UnixCompatibility/Wine.cs | 16 ++++++++++---- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs index 0d42bcbd..c57eb01a 100644 --- a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs +++ b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs @@ -76,17 +76,17 @@ static public bool IsGameModeInstalled() return gameModeInstalled ?? false; } - static private string? nvidiaWinePath = ForceDLSS ? "" : Environment.GetEnvironmentVariable("XL_NVNGXPATH"); + static private string? nvngxPath = ForceDLSS ? "" : Environment.GetEnvironmentVariable("XL_NVNGXPATH"); static public bool IsDLSSAvailable => !string.IsNullOrEmpty(NvidiaWineDLLPath()) || ForceDLSS; - static public string? NvidiaWineDLLPath() + static public string NvidiaWineDLLPath() { - if (nvidiaWinePath is not null) + if (nvngxPath is not null) { - if (!File.Exists(Path.Combine(nvidiaWinePath, "nvngx.dll"))) - nvidiaWinePath = ""; - return nvidiaWinePath; + if (!File.Exists(Path.Combine(nvngxPath, "nvngx.dll"))) + nvngxPath = ""; + return nvngxPath; } if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) @@ -94,7 +94,6 @@ static public bool IsGameModeInstalled() string[] targets = { "/lib", Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".xlcore", "compatibilitytool", "nvidia") }; foreach (var target in targets) { - Console.WriteLine($"target = {target}"); var psi = new ProcessStartInfo("/bin/find"); psi.Arguments = $"-L {target} -name \"nvngx.dll\""; psi.RedirectStandardOutput = true; @@ -106,15 +105,14 @@ static public bool IsGameModeInstalled() if (!string.IsNullOrWhiteSpace(output)) { var nvngx = new FileInfo(output.Split('\n', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault()); - nvidiaWinePath = nvngx.DirectoryName; + nvngxPath = nvngx.DirectoryName; break; } } } else - nvidiaWinePath = ""; - nvidiaWinePath ??= ""; - Console.WriteLine($"nvngx path = {nvidiaWinePath}"); - return nvidiaWinePath ?? ""; + nvngxPath = ""; + nvngxPath ??= ""; // If nvngxPath is still null, set it to empty string to prevent an infinite loop. + return nvngxPath ?? ""; } } diff --git a/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs b/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs index b51f9cf3..b3e127f2 100644 --- a/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs +++ b/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs @@ -75,7 +75,10 @@ static Dxvk() Versions = new Dictionary>(); NvapiVersions = new Dictionary>(); MangoHudInstalled = DxvkSettings.MangoHudIsInstalled(); + } + public static void Initialize() + { // Add default versions. Versions["dxvk-2.4"] = new Dictionary() { @@ -120,10 +123,7 @@ static Dxvk() {"name", "Disabled"}, {"desc", "Don't use Dxvk-nvapi. DLSS will not be available. (FSR2 mod still works)"}, {"label", "DLSS Off"} }; - } - public static void Initialize() - { var toolDirectory = new DirectoryInfo(Path.Combine(Program.storage.Root.FullName, "compatibilitytool", "dxvk")); if (!toolDirectory.Exists) diff --git a/src/XIVLauncher.Core/UnixCompatibility/Wine.cs b/src/XIVLauncher.Core/UnixCompatibility/Wine.cs index 8e347810..d57961e9 100644 --- a/src/XIVLauncher.Core/UnixCompatibility/Wine.cs +++ b/src/XIVLauncher.Core/UnixCompatibility/Wine.cs @@ -35,7 +35,10 @@ public static class Wine static Wine() { Versions = new Dictionary>(); - + } + + public static void Initialize() + { // Add default versions. Versions["wine-xiv-staging-fsync-git-7.10.r3.g560db77d"] = new Dictionary() { @@ -49,10 +52,13 @@ static Wine() {"label", "Official"}, {"url", $"https://github.com/goatcorp/wine-xiv-git/releases/download/8.5.r4.g4211bac7/wine-xiv-staging-fsync-git-{OSInfo.Package.ToString()}-8.5.r4.g4211bac7.tar.xz"}, {"mark", "Download"} }; - } + Versions["unofficial-wine-xiv-staging-9.13.1"] = new Dictionary() + { + {"name", "Unofficial Wine-XIV 9.13.1"}, {"desc", "Patched version of Wine Staging 9.13. Now with wayland and lsteamclient support added."}, + {"label", "Unofficial"}, {"url", "https://github.com/rankynbass/unofficial-wine-xiv-git/releases/download/v9.13.1/unofficial-wine-xiv-staging-9.13.1.tar.zst"}, + {"mark", "Download"} + }; - public static void Initialize() - { var toolDirectory = new DirectoryInfo(Path.Combine(Program.storage.Root.FullName, "compatibilitytool", "wine")); if (!toolDirectory.Exists) @@ -86,6 +92,8 @@ private static string GetDownloadUrl(string? name) public static string GetDefaultVersion() { + if (Versions.ContainsKey("unofficial-wine-xiv-staging-9.13.1")) + return "unofficial-wine-xiv-staging-9.13.1"; if (Versions.ContainsKey("wine-xiv-staging-fsync-git-8.5.r4.g4211bac7")) return "wine-xiv-staging-fsync-git-8.5.r4.g4211bac7"; if (Versions.ContainsKey("wine-xiv-staging-fsync-git-7.10.r3.g560db77d")) From e203004fba04b164b720d33152c3ad1600e6631b Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Mon, 2 Sep 2024 13:27:48 -0700 Subject: [PATCH 09/11] Add /lib64 to nvngx search path --- lib/FFXIVQuickLauncher | 2 +- .../Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs | 2 +- src/XIVLauncher.Core/CoreEnvironmentSettings.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/FFXIVQuickLauncher b/lib/FFXIVQuickLauncher index 33f8b423..7dc92a11 160000 --- a/lib/FFXIVQuickLauncher +++ b/lib/FFXIVQuickLauncher @@ -1 +1 @@ -Subproject commit 33f8b423d03be2103f8386759a152b21dc9c8825 +Subproject commit 7dc92a110f2f04e915145945371bea034ee67f5a diff --git a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs index f51f9a0c..bd411164 100644 --- a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs +++ b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs @@ -38,7 +38,7 @@ public override void Draw() Program.ClearPrefix(); } - ImGui.Text("\nClear the managed Wine and DXVK installs. Custom versions won't be touched."); + ImGui.Text("\nClear the managed Wine and DXVK installs."); if (ImGui.Button("Clear Wine & DXVK")) { Program.ClearTools(true); diff --git a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs index a047032c..5cb1dd3d 100644 --- a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs +++ b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs @@ -100,7 +100,7 @@ static public string NvidiaWineDLLPath() if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - string[] targets = { "/lib", Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".xlcore", "compatibilitytool", "nvidia") }; + string[] targets = { Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".xlcore", "compatibilitytool", "nvidia"), "/lib64", "/lib", "/usr/lib64", "/usr/lib" }; foreach (var target in targets) { var psi = new ProcessStartInfo("/bin/find"); From f2846282d115e61c88b0362e6231c1f2eb180ceb Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sat, 7 Sep 2024 16:55:38 -0700 Subject: [PATCH 10/11] Add extra WINEDLLOVERRIDE handling --- lib/FFXIVQuickLauncher | 2 +- .../Components/SettingsPage/Tabs/SettingsTabWine.cs | 11 +++++++++++ .../Configuration/ILauncherConfig.cs | 2 ++ src/XIVLauncher.Core/Program.cs | 3 ++- src/XIVLauncher.Core/UnixCompatibility/Wine.cs | 13 ++++++++----- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/lib/FFXIVQuickLauncher b/lib/FFXIVQuickLauncher index 7dc92a11..a7a266c7 160000 --- a/lib/FFXIVQuickLauncher +++ b/lib/FFXIVQuickLauncher @@ -1 +1 @@ -Subproject commit 7dc92a110f2f04e915145945371bea034ee67f5a +Subproject commit a7a266c7356cbe3fab6dbeb2510cc02e780110a8 diff --git a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs index 05e1e8a5..2c9adea5 100644 --- a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs +++ b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabWine.cs @@ -59,6 +59,17 @@ public SettingsTabWine() } }, + new SettingsEntry("Extra WINEDLLOVERRIDES", "Do not use msquic, mscoree, d3d9, d3d10core, d3d11, or dxgi. These are already set.", () => Program.Config.WineDLLOverrides ?? "", s => Program.Config.WineDLLOverrides = s) + { + CheckValidity = s => + { + if (!WineSettings.WineDLLOverrideIsValid(s)) + return "Not a valid WINEDLLOVERRIDE string"; + + return null; + } + }, + 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 eb782540..2790ba42 100644 --- a/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs +++ b/src/XIVLauncher.Core/Configuration/ILauncherConfig.cs @@ -91,6 +91,8 @@ public interface ILauncherConfig public string? MangoHudCustomFile { get; set; } + public string? WineDLLOverrides { get; set; } + public string? WineDebugVars { get; set; } public bool? FixLocale { get; set; } diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index e8f62777..f031911b 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -133,6 +133,7 @@ private static void LoadConfig(Storage storage) if (!Wine.Versions.ContainsKey(Config.WineVersion ?? "")) Config.WineVersion = Wine.GetDefaultVersion(); Config.WineBinaryPath ??= "/usr/bin"; + Config.WineDLLOverrides ??= ""; Config.WineDebugVars ??= "-all"; if (!Dxvk.Versions.ContainsKey(Config.DxvkVersion ?? "")) @@ -382,7 +383,7 @@ private static void Main(string[] args) public static void CreateCompatToolsInstance() { var dxvkSettings = new DxvkSettings(Dxvk.FolderName, Dxvk.DownloadUrl, storage.Root.FullName, Dxvk.AsyncEnabled, Dxvk.FrameRateLimit, Dxvk.DxvkHudEnabled, Dxvk.DxvkHudString, Dxvk.MangoHudEnabled, Dxvk.MangoHudCustomIsFile, Dxvk.MangoHudString, Dxvk.Enabled, Dxvk.NvapiFolderName, Dxvk.NvapiDownloadUrl, Dxvk.NvngxFolderName); - var wineSettings = new WineSettings(Wine.IsManagedWine, Wine.CustomWinePath, Wine.FolderName, Wine.DownloadUrl, storage.Root, Wine.DebugVars, Wine.LogFile, Wine.Prefix, Wine.ESyncEnabled, Wine.FSyncEnabled); + var wineSettings = new WineSettings(Wine.IsManagedWine, Wine.CustomWinePath, Wine.FolderName, Wine.DownloadUrl, Wine.ExtraWineDLLOverrides, storage.Root, Wine.DebugVars, Wine.LogFile, Wine.Prefix, Wine.ESyncEnabled, Wine.FSyncEnabled); var toolsFolder = storage.GetFolder("compatibilitytool"); CompatibilityTools = new CompatibilityTools(wineSettings, dxvkSettings, Config.GameModeEnabled, toolsFolder, Config.GamePath, OSInfo.IsFlatpak); } diff --git a/src/XIVLauncher.Core/UnixCompatibility/Wine.cs b/src/XIVLauncher.Core/UnixCompatibility/Wine.cs index d57961e9..0a5e628e 100644 --- a/src/XIVLauncher.Core/UnixCompatibility/Wine.cs +++ b/src/XIVLauncher.Core/UnixCompatibility/Wine.cs @@ -30,6 +30,8 @@ public static class Wine public static bool FSyncEnabled => Program.Config.FSyncEnabled ?? false; + public static string ExtraWineDLLOverrides => WineSettings.WineDLLOverrideIsValid(Program.Config.WineDLLOverrides) ? Program.Config.WineDLLOverrides ?? "" : ""; + public static Dictionary> Versions { get; private set; } static Wine() @@ -52,10 +54,11 @@ public static void Initialize() {"label", "Official"}, {"url", $"https://github.com/goatcorp/wine-xiv-git/releases/download/8.5.r4.g4211bac7/wine-xiv-staging-fsync-git-{OSInfo.Package.ToString()}-8.5.r4.g4211bac7.tar.xz"}, {"mark", "Download"} }; - Versions["unofficial-wine-xiv-staging-9.13.1"] = new Dictionary() + // Beta version for testing. Needed for DLSS. + Versions["wine-xiv-staging-fsync-git-9.17.r0.g27b121f2"] = new Dictionary() { - {"name", "Unofficial Wine-XIV 9.13.1"}, {"desc", "Patched version of Wine Staging 9.13. Now with wayland and lsteamclient support added."}, - {"label", "Unofficial"}, {"url", "https://github.com/rankynbass/unofficial-wine-xiv-git/releases/download/v9.13.1/unofficial-wine-xiv-staging-9.13.1.tar.zst"}, + {"name", "Wine-XIV 9.17"}, {"desc", "Patched version of Wine Staging 9.17. Now with wayland and lsteamclient support added."}, + {"label", "Testing"}, {"url", $"https://github.com/rankynbass/unofficial-wine-xiv-git/releases/download/beta-9.17.r0.g27b121f2/wine-xiv-staging-fsync-git-{OSInfo.Package.ToString()}-9.17.r0.g27b121f2.tar.xz"}, {"mark", "Download"} }; @@ -92,8 +95,8 @@ private static string GetDownloadUrl(string? name) public static string GetDefaultVersion() { - if (Versions.ContainsKey("unofficial-wine-xiv-staging-9.13.1")) - return "unofficial-wine-xiv-staging-9.13.1"; + if (Versions.ContainsKey("wine-xiv-staging-fsync-git-9.17.r0.g27b121f2")) + return "wine-xiv-staging-fsync-git-9.17.r0.g27b121f2"; if (Versions.ContainsKey("wine-xiv-staging-fsync-git-8.5.r4.g4211bac7")) return "wine-xiv-staging-fsync-git-8.5.r4.g4211bac7"; if (Versions.ContainsKey("wine-xiv-staging-fsync-git-7.10.r3.g560db77d")) From 9a8ab184b7094d4154aa83c8c02be8bf1af2f1dc Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Sat, 7 Sep 2024 17:30:26 -0700 Subject: [PATCH 11/11] Change 'Nvapi Version' to 'Enable DLSS' --- .../Components/SettingsPage/Tabs/SettingsTabDxvk.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabDxvk.cs b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabDxvk.cs index d0ed274a..aabdee9a 100644 --- a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabDxvk.cs +++ b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabDxvk.cs @@ -32,7 +32,7 @@ public SettingsTabDxvk() CheckVisibility = () => dxvkVersionSetting.Value != "DISABLED", }, - new DictionarySettingsEntry("Nvapi Version", $"Choose which version of dxvk-nvapi to use. Wine >= 9.0 or Valve Wine (wine-ge/valvebe) >= 8.x are needed for DLSS.", Dxvk.NvapiVersions, () => Program.Config.NvapiVersion ?? Dxvk.GetDefaultNvapiVersion(), s => Program.Config.NvapiVersion = s, Dxvk.GetDefaultVersion()) + new DictionarySettingsEntry("Enable DLSS (Dxvk-Nvapi)", $"Choose which version of dxvk-nvapi to use. Wine >= 9.0 or Valve Wine (wine-ge/valvebe) >= 8.x are needed for DLSS.", Dxvk.NvapiVersions, () => Program.Config.NvapiVersion ?? Dxvk.GetDefaultNvapiVersion(), s => Program.Config.NvapiVersion = s, Dxvk.GetDefaultVersion()) { CheckWarning = s => {