Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility rework 2 #64

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
87fc154
Update WineSettings to accept folder & url
rankynbass Jul 24, 2023
8481dcf
Finish work on WineSettings
rankynbass Jul 24, 2023
7ac1059
Minimal work to allow DxvkSettings class
rankynbass Jul 24, 2023
49f1efc
Minimal work to allow Hud settings
rankynbass Jul 25, 2023
fc3b9ff
Add DXVK tab to Settings page
rankynbass Jul 25, 2023
f960f07
Tweak Dxvk tab, rework for boolean MangoHud check
rankynbass Jul 25, 2023
9b23718
Added OSInfo
rankynbass Jul 26, 2023
825fb44
Removed unnecessary logging line
rankynbass Jul 26, 2023
a433351
Update submodule
rankynbass Jul 26, 2023
8c9baac
Format Wine.cs to match Dxvk.cs
rankynbass Jul 27, 2023
e99c2ac
Allow for wow64 wine builds with no wine64 binary
rankynbass Jul 27, 2023
62ae5d0
Remove redundant async from Wine tab
rankynbass Jul 29, 2023
f93f53c
Add fix for proton-wine 8
rankynbass Jul 30, 2023
0b1e88e
Clean up to match changes in XL.Common.Unix
rankynbass Aug 2, 2023
48ace04
Update submodule
rankynbass Aug 2, 2023
a6ae34f
Submodule update
rankynbass Aug 3, 2023
6250841
Remove unused property
rankynbass Aug 8, 2023
a999a38
Add Dxvk 2.3
rankynbass Sep 5, 2023
8f641c8
Add DXVK custom option. Clean up DXVK tab.
rankynbass Sep 7, 2023
345bed0
Improved version picker
rankynbass Sep 11, 2023
7e58294
Update dxvk warning for multiple DXVK 2 versions
rankynbass Sep 14, 2023
c18ef3b
Rework troubleshooing option to only delete official wine versions, a…
rankynbass Sep 15, 2023
124e9b9
Fix console spam "gamemodeauto:"
rankynbass Sep 22, 2023
48ac1d9
Only check for mangohud installation once
rankynbass Sep 22, 2023
930f2f7
Make Clear Plugins separate from Clear Dalamud
rankynbass Nov 11, 2023
e8fb7cf
Sort custom wine and dxvk alphabetically
rankynbass Nov 11, 2023
2d5e980
Merge branch 'main' into compatibility-rework-2
rankynbass Nov 25, 2023
78376e2
Make gamemode check a separate function
rankynbass Mar 13, 2024
6cfff13
Merge branch 'main' into compatibility-rework-2
rankynbass Mar 14, 2024
a5ba7f5
Add gamemode spamming fix
rankynbass Mar 14, 2024
ab52445
Merge branch 'main' into compatibility-rework-2
rankynbass May 4, 2024
466b881
Set 8.5 as default wine version
rankynbass May 4, 2024
6069621
Merge branch 'main' into compatibility-rework-2
rankynbass Jun 10, 2024
6387cf1
Merge branch 'main' into compatibility-rework-2
rankynbass Jun 20, 2024
0b6d067
Suggest dxvk 2.2 only if 2.3.1 has issues with REST
rankynbass Jun 20, 2024
fe63cc8
Merge latest commits from 'main', update submodue.
rankynbass Jun 29, 2024
d08dd58
Update to DXVK 2.4
rankynbass Aug 31, 2024
5daf2e6
Update submodule
rankynbass Aug 31, 2024
679e1b8
Merge branch 'main' into compatibility-rework-2
rankynbass Sep 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/XIVLauncher.Core/Components/MainPage/MainPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using XIVLauncher.Common.Windows;
using XIVLauncher.Core.Accounts;
using XIVLauncher.Core.Support;
using XIVLauncher.Core.UnixCompatibility;

namespace XIVLauncher.Core.Components.MainPage;

Expand Down Expand Up @@ -751,16 +752,16 @@ public async Task<Process> StartGameAndAddon(Launcher.LoginResult loginResult, b
}
else if (Environment.OSVersion.Platform == PlatformID.Unix)
{
if (App.Settings.WineStartupType == WineStartupType.Custom)
if (App.Settings.WineType.Value == WineType.Custom)
{
if (App.Settings.WineBinaryPath == null)
throw new InvalidOperationException("Custom wine binary path wasn't set.");
else if (!Directory.Exists(App.Settings.WineBinaryPath))
throw new InvalidOperationException("Custom wine binary path is invalid: no such directory.\n" +
"Check path carefully for typos: " + App.Settings.WineBinaryPath);
else if (!File.Exists(Path.Combine(App.Settings.WineBinaryPath, "wine64")))
throw new InvalidOperationException("Custom wine binary path is invalid: no wine64 found at that location.\n" +
"Check path carefully for typos: " + App.Settings.WineBinaryPath);
"Check path carefully for typos: " + App.Settings.WineBinaryPath);
else if (!File.Exists(Path.Combine(App.Settings.WineBinaryPath, "wine64")) && !File.Exists(Path.Combine(App.Settings.WineBinaryPath, "wine")))
throw new InvalidOperationException("Custom wine binary path is invalid: no wine or wine64 found at that location.\n" +
"Check path carefully for typos: " + App.Settings.WineBinaryPath);
}

var signal = new ManualResetEvent(false);
Expand All @@ -769,10 +770,8 @@ public async Task<Process> StartGameAndAddon(Launcher.LoginResult loginResult, b
var _ = Task.Run(async () =>
{
var tempPath = App.Storage.GetFolder("temp");
var winver = (App.Settings.SetWin7 ?? true) ? "win7" : "win10";

await Program.CompatibilityTools.EnsureTool(tempPath).ConfigureAwait(false);
Program.CompatibilityTools.RunInPrefix($"winecfg /v {winver}");

var gameFixApply = new GameFixApply(App.Settings.GamePath, App.Settings.GameConfigPath, Program.CompatibilityTools.Settings.Prefix, tempPath);
gameFixApply.UpdateProgress += (text, hasProgress, progress) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using ImGuiNET;
using XIVLauncher.Core.UnixCompatibility;

namespace XIVLauncher.Core.Components.SettingsPage;

public class DictionarySettingsEntry : SettingsEntry<string>
{
public Dictionary<string, Dictionary<string, string>> Pairs;

public string DefaultValue;

public bool ShowDescription;

public bool ShowItemDescription;

public DictionarySettingsEntry(string name, string description, Dictionary<string, Dictionary<string, string>> pairs, Func<string> load, Action<string?> save, string defaultValue, bool showSelectedDesc = false, bool showItemDesc = true)
: base(name, description, load, save)
{
this.Pairs = pairs;
this.DefaultValue = defaultValue;
this.ShowDescription = showSelectedDesc;
this.ShowItemDescription = showItemDesc;
}


public override void Draw()
{
var nativeValue = this.Value;
string idx = (string)(this.InternalValue ?? DefaultValue);

ImGuiHelpers.TextWrapped(this.Name);

Dictionary<string, Dictionary<string, string>>.KeyCollection keys = Pairs.Keys;
var label = Pairs[idx].ContainsKey("label") ? $"[{Pairs[idx]["label"]}] " : "";
var name = Pairs[idx].ContainsKey("name") ? Pairs[idx]["name"] : idx;
var desc = ShowDescription && Pairs[idx].ContainsKey("desc") ? $" - {Pairs[idx]["desc"]}" : "";
var mark = Pairs[idx].ContainsKey("mark") ? $" *{Pairs[idx]["mark"]}*" : "";

if (ImGui.BeginCombo($"###{Id.ToString()}", $"{label}{name}{desc}{mark}"))
{
foreach ( string key in keys )
{
var itemlabel = Pairs[key].ContainsKey("label") ? $"[{Pairs[key]["label"]}] " : "";
var itemname = Pairs[key].ContainsKey("name") ? Pairs[key]["name"] : key;
var itemdesc = ShowItemDescription && Pairs[key].ContainsKey("desc") ? $" - {Pairs[key]["desc"]}" : "";
var itemmark = Pairs[key].ContainsKey("mark") ? $" *{Pairs[key]["mark"]}*" : "";
if (ImGui.Selectable($"{itemlabel}{itemname}{itemdesc}{itemmark}", idx == key))
{
this.InternalValue = key;
}
}
ImGui.EndCombo();
}

ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey);
if (!string.IsNullOrEmpty(this.Description)) ImGuiHelpers.TextWrapped(this.Description);
ImGui.PopStyleColor();

if (this.CheckValidity != null)
{
var validityMsg = this.CheckValidity.Invoke(this.Value);
this.IsValid = string.IsNullOrEmpty(validityMsg);

if (!this.IsValid)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
ImGui.Text(validityMsg);
ImGui.PopStyleColor();
}
}
else
{
this.IsValid = true;
}

var warningMessage = this.CheckWarning?.Invoke(this.Value);

if (warningMessage != null)
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
ImGui.Text(warningMessage);
ImGui.PopStyleColor();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public override void Draw()
}

ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey);
ImGuiHelpers.TextWrapped(this.Description);
if (!string.IsNullOrWhiteSpace(this.Description)) ImGuiHelpers.TextWrapped(this.Description);
ImGui.PopStyleColor();

if (this.CheckValidity != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class SettingsPage : Page
new SettingsTabGame(),
new SettingsTabPatching(),
new SettingsTabWine(),
new SettingsTabDxvk(),
new SettingsTabDalamud(),
new SettingsTabAbout(),
new SettingsTabDebug(),
Expand Down
5 changes: 3 additions & 2 deletions src/XIVLauncher.Core/Components/SettingsPage/SettingsTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ public override void Draw()
foreach (SettingsEntry settingsEntry in Entries)
{
if (settingsEntry.IsVisible)
{
settingsEntry.Draw();

ImGui.Dummy(new Vector2(10) * ImGuiHelpers.GlobalScale);
ImGui.Dummy(new Vector2(10) * ImGuiHelpers.GlobalScale);
}
}

base.Draw();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Collections;

using ImGuiNET;
using XIVLauncher.Core;
using XIVLauncher.Common;

namespace XIVLauncher.Core.Components.SettingsPage.Tabs;

Expand All @@ -13,18 +15,21 @@ public override void Draw()
{
ImGui.TextUnformatted("Generic Information");
ImGui.Separator();
ImGui.TextUnformatted($"Operating System: {Environment.OSVersion}");
ImGui.TextUnformatted($"Runtime Version: {Environment.Version}");

if (OSInfo.Platform == Platform.Linux)
ImGui.TextUnformatted($"Operating System: {OSInfo.Name} - {Environment.OSVersion}");
else
ImGui.TextUnformatted($"Operating System: {Environment.OSVersion}");
ImGui.TextUnformatted($"Runtime Version: {Environment.Version}");

if (Program.IsSteamDeckHardware)
ImGui.Text("Steam Deck Hardware Detected");

if (Program.IsSteamDeckGamingMode)
ImGui.Text("Steam Deck Gaming Mode Detected");

#if FLATPAK
if (OSInfo.IsFlatpak)
ImGui.Text("Running as a Flatpak");
#endif


ImGui.Spacing();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
using System.Runtime.InteropServices;
using ImGuiNET;
using XIVLauncher.Common.Unix.Compatibility;
using XIVLauncher.Core.UnixCompatibility;

namespace XIVLauncher.Core.Components.SettingsPage.Tabs;

public class SettingsTabDxvk : SettingsTab
{
private DictionarySettingsEntry dxvkVersionSetting;
private SettingsEntry<DxvkHud> dxvkHudSetting;
private SettingsEntry<MangoHud> mangoHudSetting;

private string dxvkPath = Path.Combine(Program.storage.Root.FullName, "compatibilitytool", "dxvk");

public SettingsTabDxvk()
{
Entries = new SettingsEntry[]
{
dxvkVersionSetting = new DictionarySettingsEntry("DXVK Version", $"Choose which version of DXVK to use. Put your custom DXVK in {dxvkPath}\nEntries marked with *Download* will be downloaded when you log in.", Dxvk.Versions, () => Program.Config.DxvkVersion ?? "dxvk-async-1.10.3", s => Program.Config.DxvkVersion = s, Dxvk.GetDefaultVersion())
{
CheckWarning = s =>
{
if (s is null) return null;
if (s.StartsWith("dxvk-2") || s.StartsWith("dxvk-async-2") || s.StartsWith("dxvk-gplasync-v2"))
return "May not work with older graphics cards. AMD users may need to use env variable RADV_PERFTEST=gpl";
return null;
},
},
new SettingsEntry<bool>("Enable DXVK ASYNC", "Enable DXVK ASYNC patch. May not be available on DXVK >= 2.0", () => Program.Config.DxvkAsyncEnabled ?? true, b => Program.Config.DxvkAsyncEnabled = b)
{
CheckVisibility = () => dxvkVersionSetting.Value != "DISABLED",
},

dxvkHudSetting = new SettingsEntry<DxvkHud>("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",
},

new SettingsEntry<string>("DXVK Hud Custom String", "Set a custom string for the built in DXVK Hud. Warning: If it's invalid, the game may hang.", () => Program.Config.DxvkHudCustom ?? Dxvk.DXVK_HUD, s => Program.Config.DxvkHudCustom = s)
{
CheckVisibility = () => dxvkHudSetting.Value == DxvkHud.Custom && dxvkVersionSetting.Value != "DISABLED",
CheckWarning = s =>
{
if(!DxvkSettings.DxvkHudStringIsValid(s))
return "That's not a valid hud string";
return null;
},
},
mangoHudSetting = new SettingsEntry<MangoHud>("MangoHud Overlay", "MangoHud is installed. It is recommended to set Dxvk Overlay to None if using MangoHud.", () => Program.Config.MangoHud ?? MangoHud.None, x => Program.Config.MangoHud = x)
{
CheckVisibility = () => dxvkVersionSetting.Value != "DISABLED" && Dxvk.MangoHudInstalled,
CheckWarning = x =>
{
if (dxvkHudSetting.Value != DxvkHud.None && x != MangoHud.None)
return "Warning! You can run Dxvk Hud and MangoHud at the same time, but you probably shouldn't.\nSet one of them to None.";
return null;
}
},
new SettingsEntry<string>("MangoHud Custom String", "Set a custom string for MangoHud config.", () => Program.Config.MangoHudCustomString ?? Dxvk.MANGOHUD_CONFIG, s => Program.Config.MangoHudCustomString = s)
{
CheckVisibility = () => mangoHudSetting.Value == MangoHud.CustomString && dxvkVersionSetting.Value != "DISABLED" && Dxvk.MangoHudInstalled,
CheckWarning = s =>
{
if (s.Contains(' '))
return "No spaces allowed in MangoHud config";
return null;
}
},
new SettingsEntry<string>("MangoHud Custom Path", "Set a custom path for MangoHud config file.", () => Program.Config.MangoHudCustomFile ?? Dxvk.MANGOHUD_CONFIGFILE, s => Program.Config.MangoHudCustomFile = s)
{
CheckVisibility = () => mangoHudSetting.Value == MangoHud.CustomFile && dxvkVersionSetting.Value != "DISABLED" && Dxvk.MangoHudInstalled,
CheckWarning = s =>
{
if(!File.Exists(s))
return "That's not a valid file.";
return null;
},
},
new NumericSettingsEntry("Frame Rate Limit", "Set a frame rate limit, and DXVK will try not exceed it. Use 0 for unlimited.", () => Program.Config.DxvkFrameRateLimit ?? 0, i => Program.Config.DxvkFrameRateLimit = i, 0, 1000)
{
CheckVisibility = () => dxvkVersionSetting.Value != "DISABLED",
},
};
}

public override SettingsEntry[] Entries { get; }

public override bool IsUnixExclusive => true;

public override string Title => "DXVK";

public override void Save()
{
base.Save();
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Program.CreateCompatToolsInstance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,22 @@ 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);
}

ImGui.Text("\nClear all the files and folders related to Dalamud. Your settings will not be touched,\nbut all your plugins will be uninstalled, including custom repos.");
ImGui.Text("\nClear all the files and folders related to Dalamud. This will not uninstall your plugins or their configurations.");
if (ImGui.Button("Clear Dalamud"))
{
Program.ClearPlugins(true);
Program.ClearDalamud(true);
}

ImGui.Text("\nClear the installedPlugins folder. This will uninstall your plugins, but will not remove their configurations.");
if (ImGui.Button("Clear Plugins"))
{
Program.ClearPlugins();
}

ImGui.Text("\nClear all the log files.");
Expand All @@ -68,6 +74,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"))
{
Expand Down
Loading
Loading