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

[Add-Feature] Add custom DXVK_HUD option #1119

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ private Process RunInPrefix(ProcessStartInfo psi, string workingDirectory, IDict
Dxvk.DxvkHudType.None => "0",
Dxvk.DxvkHudType.Fps => "fps",
Dxvk.DxvkHudType.Full => "full",
Dxvk.DxvkHudType.Custom => Settings.DxvkHudCustomString,
_ => throw new ArgumentOutOfRangeException()
};

Expand Down
3 changes: 3 additions & 0 deletions src/XIVLauncher.Common.Unix/Compatibility/Dxvk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,8 @@ public enum DxvkHudType

[SettingsDescription("Full", "Show everything")]
Full,

[SettingsDescription("Custom", "Custom dxvk hud string")]
Custom,
}
}
4 changes: 3 additions & 1 deletion src/XIVLauncher.Common.Unix/Compatibility/WineSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class WineSettings
{
public WineStartupType StartupType { get; private set; }
public string CustomBinPath { get; private set; }
public string DxvkHudCustomString { get; private set; }

public string EsyncOn { get; private set; }
public string FsyncOn { get; private set; }
Expand All @@ -24,10 +25,11 @@ public class WineSettings

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 dxvkHudCustomString, string debugVars, FileInfo logFile, DirectoryInfo prefix, bool? esyncOn, bool? fsyncOn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit nit-picky but there is an extra space before FileInfo here (well and it is better to not have dxvk stuff here as well)

{
this.StartupType = startupType ?? WineStartupType.Custom;
this.CustomBinPath = customBinPath;
this.DxvkHudCustomString = dxvkHudCustomString;
this.EsyncOn = (esyncOn ?? false) ? "1" : "0";
this.FsyncOn = (fsyncOn ?? false) ? "1" : "0";
this.DebugVars = debugVars;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace XIVLauncher.Core.Components.SettingsPage.Tabs;
public class SettingsTabWine : SettingsTab
{
private SettingsEntry<WineStartupType> startupTypeSetting;
private SettingsEntry<Dxvk.DxvkHudType> dxvkOverlaySetting;

public SettingsTabWine()
{
Expand Down Expand Up @@ -52,7 +53,13 @@ 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),
dxvkOverlaySetting = 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>("DXVK custom Overlay",
"Custom DXVK Overlay string. For example fps,frametimes,gpuload,version",
() => Program.Config.DxvkHudCustomString, s => Program.Config.DxvkHudCustomString = s)
{
CheckVisibility = () => dxvkOverlaySetting.Value == Dxvk.DxvkHudType.Custom
},
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 Expand Up @@ -108,7 +115,7 @@ public override void Draw()
public override void Save()
{
base.Save();
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Program.CreateCompatToolsInstance();
}
}
2 changes: 2 additions & 0 deletions src/XIVLauncher.Core/Configuration/ILauncherConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public interface ILauncherConfig

public Dxvk.DxvkHudType DxvkHudType { get; set; }

public string? DxvkHudCustomString { get; set; }

public string? WineDebugVars { get; set; }

#endregion
Expand Down
3 changes: 2 additions & 1 deletion src/XIVLauncher.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ private static void LoadConfig(Storage storage)
Config.DxvkAsyncEnabled ??= true;
Config.ESyncEnabled ??= true;
Config.FSyncEnabled ??= false;
Config.DxvkHudCustomString ??= "fps,frametimes,gpuload,version";

Config.WineStartupType ??= WineStartupType.Managed;
Config.WineBinaryPath ??= "/usr/bin";
Expand Down Expand Up @@ -276,7 +277,7 @@ 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.DxvkHudCustomString, Config.WineDebugVars, wineLogFile, winePrefix, Config.ESyncEnabled, Config.FSyncEnabled);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a better idea to not put dxvk related config into WineSettings, especially considering since we just pass DxvkHudType and DxvkAsyncEnabled into the CompatibilityTools ctor currently.

Ideally DxvkHudCustomString is in there as well, or even better just put all dxvk related settings into their own class like DxvkSettings ,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also consider that dxvk can also be used on windows, even though this is currently not in the scope of what XL provides it is possible, and for example an option in the GShade windows installer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using dxvk on Windows is something we should never support. (It also will crash dalamud)

It honestly led to a support nightmare when the gshade installer started providing it as an option.

DXVK options should only be available for Wine platforms.

var toolsFolder = storage.GetFolder("compatibilitytool");
CompatibilityTools = new CompatibilityTools(wineSettings, Config.DxvkHudType, Config.GameModeEnabled, Config.DxvkAsyncEnabled, toolsFolder);
}
Expand Down