From c18ef3b4847dfe3f8b54faba5c312d6281e49cf0 Mon Sep 17 00:00:00 2001 From: Rankyn Bass Date: Thu, 14 Sep 2023 19:24:56 -0700 Subject: [PATCH] Rework troubleshooing option to only delete official wine versions, and leave custom wine --- .../Tabs/SettingsTabTroubleshooting.cs | 8 ++++- src/XIVLauncher.Core/Program.cs | 19 ++++++++-- .../UnixCompatibility/Dxvk.cs | 36 +++++++++++-------- .../UnixCompatibility/Wine.cs | 28 ++++++++------- 4 files changed, 60 insertions(+), 31 deletions(-) diff --git a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs index c3f4f153..820f3b2f 100644 --- a/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs +++ b/src/XIVLauncher.Core/Components/SettingsPage/Tabs/SettingsTabTroubleshooting.cs @@ -37,7 +37,7 @@ public override void Draw() Program.ClearPrefix(); } - ImGui.Text("\nClear the managed Wine install and DXVK"); + ImGui.Text("\nClear the managed Wine and DXVK installs. Custom versions won't be touched."); if (ImGui.Button("Clear Wine & DXVK")) { Program.ClearTools(true); @@ -61,6 +61,12 @@ public override void Draw() Program.ClearAll(true); } + ImGui.Text("\nOpen the .xlcore folder in your file browser."); + if (ImGui.Button("Open .xlcore")) + { + PlatformHelpers.OpenBrowser(Program.storage.Root.FullName); + } + ImGui.Text("\nGenerate a troubleshooting pack to upload to the official Discord channel"); if (ImGui.Button("Generate tspack")) { diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index 018e800a..48802b43 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -418,9 +418,22 @@ public static void ClearPlugins(bool tsbutton = false) public static void ClearTools(bool tsbutton = false) { - storage.GetFolder("compatibilitytool").Delete(true); - storage.GetFolder("compatibilitytool/wine"); - storage.GetFolder("compatibilitytool/dxvk"); + foreach (var winetool in Wine.Versions) + { + if (winetool.Value.ContainsKey("url")) + if (!string.IsNullOrEmpty(winetool.Value["url"])) + storage.GetFolder($"compatibilitytool/wine/{winetool.Key}").Delete(true); + } + foreach (var dxvktool in Dxvk.Versions) + { + if (dxvktool.Value.ContainsKey("url")) + if (!string.IsNullOrEmpty(dxvktool.Value["url"])) + storage.GetFolder($"compatibilitytool/dxvk/{dxvktool.Key}").Delete(true); + } + // Re-initialize Versions so they get *Download* marks back. + Wine.Initialize(); + Dxvk.Initialize(); + if (tsbutton) CreateCompatToolsInstance(); } diff --git a/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs b/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs index f2c02c9a..a68d3ac3 100644 --- a/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs +++ b/src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs @@ -61,24 +61,30 @@ public static class Dxvk static Dxvk() { - Versions = new Dictionary>() - { - { "dxvk-2.3", new Dictionary() - { {"name", "DXVK 2.3"}, {"desc", "Latest version, using Graphics Pipeline Libs. Async no longer needed."}, - {"label", "Current"}, {"url", "https://github.com/doitsujin/dxvk/releases/download/v2.3/dxvk-2.3.tar.gz"}, - {"mark", "Download" } } }, - { "dxvk-async-1.10.3", new Dictionary() - { {"name", "DXVK 1.10.3"}, {"desc", "Legacy version with high compatibility. Includes async patch."}, - {"label", "Legacy"}, {"url", "https://github.com/Sporif/dxvk-async/releases/download/1.10.3/dxvk-async-1.10.3.tar.gz"}, - {"mark", "Download" } } }, - { "DISABLED", new Dictionary() - { {"name", "WineD3D"}, {"desc", "Use WineD3D (OpenGL) instead of DXVK. For old GPUs without Vulkan support."}, - {"label", "Disabled"} } }, - }; + Versions = new Dictionary>(); } public static void Initialize() { + // Add default versions. + Versions["dxvk-2.3"] = new Dictionary() + { + {"name", "DXVK 2.3"}, {"desc", "Latest version, using Graphics Pipeline Libs. Async no longer needed."}, + {"label", "Current"}, {"url", "https://github.com/doitsujin/dxvk/releases/download/v2.3/dxvk-2.3.tar.gz"}, + {"mark", "Download" } + }; + Versions["dxvk-async-1.10.3"] = new Dictionary() + { + {"name", "DXVK 1.10.3"}, {"desc", "Legacy version with high compatibility. Includes async patch."}, + {"label", "Legacy"}, {"url", "https://github.com/Sporif/dxvk-async/releases/download/1.10.3/dxvk-async-1.10.3.tar.gz"}, + {"mark", "Download" } + }; + Versions["DISABLED"] = new Dictionary() + { + {"name", "WineD3D"}, {"desc", "Use WineD3D (OpenGL) instead of DXVK. For old GPUs without Vulkan support."}, + {"label", "Disabled"} + }; + var toolDirectory = new DirectoryInfo(Path.Combine(Program.storage.Root.FullName, "compatibilitytool", "dxvk")); if (!toolDirectory.Exists) @@ -99,7 +105,7 @@ public static void Initialize() Versions[dxvkDir.Name].Remove("mark"); continue; } - Versions.Add(dxvkDir.Name, new Dictionary() { {"label", "Custom"} }); + Versions[dxvkDir.Name] = new Dictionary() { {"label", "Custom"} }; } } } diff --git a/src/XIVLauncher.Core/UnixCompatibility/Wine.cs b/src/XIVLauncher.Core/UnixCompatibility/Wine.cs index 97827f59..1606f133 100644 --- a/src/XIVLauncher.Core/UnixCompatibility/Wine.cs +++ b/src/XIVLauncher.Core/UnixCompatibility/Wine.cs @@ -34,21 +34,25 @@ public static class Wine static Wine() { - Versions = new Dictionary>() - { - { "wine-xiv-staging-fsync-git-7.10.r3.g560db77d", new Dictionary() - { {"name", "Wine-XIV 7.10"}, {"desc","Patched version of Wine Staging 7.10. Default."}, - {"label", "Official"}, {"url", $"https://github.com/goatcorp/wine-xiv-git/releases/download/7.10.r3.g560db77d/wine-xiv-staging-fsync-git-{OSInfo.Package.ToString()}-7.10.r3.g560db77d.tar.xz"}, - {"mark", "Download"} } }, - { "wine-xiv-staging-fsync-git-8.5.r4.g4211bac7", new Dictionary() - { {"name", "Wine-XIV 8.5"}, {"desc", "Patched version of Wine Staging 8.5. Change Windows version to 7 for best results."}, - {"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 = new Dictionary>(); } public static void Initialize() { + // Add default versions. + Versions["wine-xiv-staging-fsync-git-7.10.r3.g560db77d"] = new Dictionary() + { + {"name", "Wine-XIV 7.10"}, {"desc","Patched version of Wine Staging 7.10. Default."}, + {"label", "Official"}, {"url", $"https://github.com/goatcorp/wine-xiv-git/releases/download/7.10.r3.g560db77d/wine-xiv-staging-fsync-git-{OSInfo.Package.ToString()}-7.10.r3.g560db77d.tar.xz"}, + {"mark", "Download"} + }; + Versions["wine-xiv-staging-fsync-git-8.5.r4.g4211bac7"] = new Dictionary() + { + {"name", "Wine-XIV 8.5"}, {"desc", "Patched version of Wine Staging 8.5. Change Windows version to 7 for best results."}, + {"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"} + }; + var toolDirectory = new DirectoryInfo(Path.Combine(Program.storage.Root.FullName, "compatibilitytool", "wine")); if (!toolDirectory.Exists) @@ -67,7 +71,7 @@ public static void Initialize() Versions[wineDir.Name].Remove("mark"); continue; } - Versions.Add(wineDir.Name, new Dictionary() {{"label", "Custom"}}); + Versions[wineDir.Name] = new Dictionary() { {"label", "Custom"} }; } } }