Skip to content

Commit

Permalink
feat: add DXVK settings tab
Browse files Browse the repository at this point in the history
* removed a few settings from wine tab
* Added dxvk settings to launcher.ini
* Updated CreateCompatToolsInstance to work with new dxvkSettings
* Requires PR#1205 from FFXIVQuickLauncher
* Suggest doing PR#13, #15 on xlcore, for better look and feel.
  • Loading branch information
rankynbass committed Dec 11, 2022
1 parent 386c6c8 commit 03cf818
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class SettingsPage : Page
new SettingsTabGame(),
new SettingsTabPatching(),
new SettingsTabWine(),
new SettingsTabDXVK(),
new SettingsTabDalamud(),
new SettingsTabAutoStart(),
new SettingsTabAbout(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System.Numerics;
using System.Runtime.InteropServices;
using ImGuiNET;
using XIVLauncher.Common.Unix.Compatibility;
using XIVLauncher.Common.Util;

namespace XIVLauncher.Core.Components.SettingsPage.Tabs;

public class SettingsTabDXVK : SettingsTab
{
private SettingsEntry<Dxvk.DxvkHudType> dxvkHudSetting;

public SettingsTabDXVK()
{
Entries = new SettingsEntry[]
{
new SettingsEntry<Dxvk.DxvkVersion>("DXVK Version", "Choose which version of DXVK to use.", () => Program.Config.DxvkVersion, type => Program.Config.DxvkVersion = type),
new SettingsEntry<bool>("Enable DXVK ASYNC", "Enable DXVK ASYNC patch.", () => Program.Config.DxvkAsyncEnabled ?? true, b => Program.Config.DxvkAsyncEnabled = b),
dxvkHudSetting = new SettingsEntry<Dxvk.DxvkHudType>("DXVK Overlay", "DXVK Hud is included. MangoHud must be installed separately.\nFlatpak XIVLauncher needs flatpak MangoHud.", () => Program.Config.DxvkHudType, type => Program.Config.DxvkHudType = type)
{
CheckValidity = type =>
{
if ((type == Dxvk.DxvkHudType.MangoHud || type == Dxvk.DxvkHudType.MangoHudCustom || type == Dxvk.DxvkHudType.MangoHudFull)
&& (!File.Exists("/usr/lib/mangohud/libMangoHud.so") && !File.Exists("/usr/lib/extensions/vulkan/MangoHud/lib/x86_64-linux-gnu/libMangoHud.so")))
return "MangoHud not detected.";
return null;
}
},
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, s => Program.Config.DxvkHudCustom = s)
{
CheckVisibility = () => dxvkHudSetting.Value == Dxvk.DxvkHudType.Custom,
CheckWarning = s =>
{
if(!DxvkSettings.CheckDxvkHudString(s))
return "That's not a valid hud string";
return null;
},
},
new SettingsEntry<string>("MangoHud Custom Path", "Set a custom path for MangoHud config file.", () => Program.Config.DxvkMangoCustom, s => Program.Config.DxvkMangoCustom = s)
{
CheckVisibility = () => dxvkHudSetting.Value == Dxvk.DxvkHudType.MangoHudCustom,
CheckWarning = s =>
{
if(!DxvkSettings.CheckMangoHudPath(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 to leave unset.", () => Program.Config.DxvkFrameRate ?? 0, i => Program.Config.DxvkFrameRate = i, 0, 1000),
};
}

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 @@ -36,7 +36,6 @@ public SettingsTabWine()
}
},

new SettingsEntry<bool>("Enable DXVK ASYNC", "Enable DXVK ASYNC patch.", () => Program.Config.DxvkAsyncEnabled ?? true, b => Program.Config.DxvkAsyncEnabled = b),
new SettingsEntry<bool>("Enable ESync", "Enable eventfd-based synchronization.", () => Program.Config.ESyncEnabled ?? true, b => Program.Config.ESyncEnabled = b),
new SettingsEntry<bool>("Enable FSync", "Enable fast user mutex (futex2).", () => Program.Config.FSyncEnabled ?? true, b => Program.Config.FSyncEnabled = b)
{
Expand All @@ -50,7 +49,6 @@ public SettingsTabWine()
}
},

new SettingsEntry<Dxvk.DxvkHudType>("DXVK Overlay", "Configure how much of the DXVK overlay is to be shown.", () => Program.Config.DxvkHudType, type => Program.Config.DxvkHudType = type),
new SettingsEntry<string>("WINEDEBUG Variables", "Configure debug logging for wine. Useful for troubleshooting.", () => Program.Config.WineDebugVars ?? string.Empty, s => Program.Config.WineDebugVars = s)
};
}
Expand Down
8 changes: 8 additions & 0 deletions src/XIVLauncher.Core/Configuration/ILauncherConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,22 @@ public interface ILauncherConfig

public bool? GameModeEnabled { get; set; }

public Dxvk.DxvkVersion DxvkVersion { get; set; }

public bool? DxvkAsyncEnabled { get; set; }

public int? DxvkFrameRate { get; set; }

public bool? ESyncEnabled { get; set; }

public bool? FSyncEnabled { get; set; }

public Dxvk.DxvkHudType DxvkHudType { get; set; }

public string? DxvkHudCustom { get; set; }

public string? DxvkMangoCustom { get; set; }

public string? WineDebugVars { get; set; }

#endregion
Expand Down
6 changes: 5 additions & 1 deletion src/XIVLauncher.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,11 @@ private static void LoadConfig(Storage storage)

Config.GameModeEnabled ??= false;
Config.DxvkAsyncEnabled ??= true;
Config.DxvkFrameRate ??= 0;
Config.ESyncEnabled ??= true;
Config.FSyncEnabled ??= false;
Config.DxvkHudCustom ??= "fps,frametimes,gpuload,version";
Config.DxvkMangoCustom ??= Environment.GetEnvironmentVariable("HOME") + "/.config/MangoHud/MangoHud.conf";

Config.WineStartupType ??= WineStartupType.Managed;
Config.WineBinaryPath ??= "/usr/bin";
Expand Down Expand Up @@ -275,7 +278,8 @@ public static void CreateCompatToolsInstance()
var winePrefix = storage.GetFolder("wineprefix");
var wineSettings = new WineSettings(Config.WineStartupType, Config.WineBinaryPath, Config.WineDebugVars, wineLogFile, winePrefix, Config.ESyncEnabled, Config.FSyncEnabled);
var toolsFolder = storage.GetFolder("compatibilitytool");
CompatibilityTools = new CompatibilityTools(wineSettings, Config.DxvkHudType, Config.GameModeEnabled, Config.DxvkAsyncEnabled, toolsFolder);
var dxvkSettings = new DxvkSettings(Config.DxvkHudType, Config.DxvkHudCustom, Config.DxvkMangoCustom, Config.DxvkAsyncEnabled, Config.DxvkFrameRate, Config.DxvkVersion, storage.Root);
CompatibilityTools = new CompatibilityTools(wineSettings, dxvkSettings, Config.GameModeEnabled, toolsFolder);
}

public static void ShowWindow()
Expand Down

0 comments on commit 03cf818

Please sign in to comment.