-
Notifications
You must be signed in to change notification settings - Fork 42
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 #59
Changes from 21 commits
c6e523a
903ee25
8363495
9b05879
e687d03
3878e84
3de5ce9
3a7aca8
c522e0f
272f4d1
8fd716d
380e62a
8314140
2142c7d
0637558
74b4912
5d75345
94f34c4
9067d4e
ad51095
0098371
6fe1b6b
7afb7a2
f7162a4
64a3a62
ea617f2
c80b205
c5331d0
f8a236b
2334b28
ccf30a7
3b07474
92a7cff
7ab0524
22bfcbb
387d17d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -738,15 +738,15 @@ 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 == WineType.Custom) | ||
{ | ||
if (App.Settings.WineBinaryPath == null) | ||
throw new Exception("Custom wine binary path wasn't set."); | ||
else if (!Directory.Exists(App.Settings.WineBinaryPath)) | ||
throw new Exception("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 Exception("Custom wine binary path is invalid: no wine64 found at that location.\n" + | ||
else if (!File.Exists(Path.Combine(App.Settings.WineBinaryPath, "wine64")) && !File.Exists(Path.Combine(App.Settings.WineBinaryPath, "wine"))) | ||
throw new Exception("Custom wine binary path is invalid: no wine or wine64 found at that location.\n" + | ||
"Check path carefully for typos: " + App.Settings.WineBinaryPath); | ||
} | ||
|
||
|
@@ -761,7 +761,17 @@ public async Task<Process> StartGameAndAddon(Launcher.LoginResult loginResult, b | |
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); | ||
if (Program.Config.DxvkVersion == DxvkVersion.Disabled) | ||
{ | ||
if (Program.Config.WineD3DUseVK ?? false) | ||
Program.CompatibilityTools.AddRegistryKey("HKEY_CURRENT_USER\\Software\\Wine\\Direct3D", "renderer", "vulkan"); | ||
else | ||
Program.CompatibilityTools.AddRegistryKey("HKEY_CURRENT_USER\\Software\\Wine\\Direct3D", "renderer", "gl"); | ||
} | ||
|
||
Program.CompatibilityTools.RunInPrefix($"winecfg /v {winver}"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
|
||
var gameFixApply = new GameFixApply(App.Settings.GamePath, App.Settings.GameConfigPath, Program.CompatibilityTools.Prefix, tempPath); | ||
gameFixApply.UpdateProgress += (text, hasProgress, progress) => | ||
{ | ||
App.LoadingPage.Line1 = "Applying game-specific fixes..."; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ public override void Draw() | |
{ | ||
ImGui.TextUnformatted("Generic Information"); | ||
ImGui.Separator(); | ||
ImGui.TextUnformatted($"Operating System: {Environment.OSVersion}"); | ||
ImGui.TextUnformatted($"Operating System: {Distro.Name} - {Environment.OSVersion}"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is should ideally be a XIVLauncher.Common Platform There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might go through and fix all of this at some point; do the full initialization of OS info in the Distro object (maybe rename it), and then change all the Environment.OSVersion.Platform checks to refer to the XIVLauncher.Common Platform value set in said Distro object. But I think there's enough going on atm. For now, I've added in some checks to make sure the Linux-specific stuff only shows up if it's actually on Linux. |
||
ImGui.TextUnformatted($"Runtime Version: {Environment.Version}"); | ||
|
||
if (Program.IsSteamDeckHardware) | ||
|
@@ -21,9 +21,10 @@ public override void Draw() | |
if (Program.IsSteamDeckGamingMode) | ||
ImGui.Text("Steam Deck Gaming Mode Detected"); | ||
|
||
#if FLATPAK | ||
if (Distro.IsFlatpak) | ||
ImGui.Text("Running as a Flatpak"); | ||
#endif | ||
else | ||
ImGui.Text("Running a native build"); | ||
|
||
ImGui.Spacing(); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
using System.IO; | ||
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<DxvkVersion> dxvkVersionSetting; | ||
private SettingsEntry<bool> wineD3DUseVk; | ||
private SettingsEntry<DxvkHudType> dxvkHudSetting; | ||
|
||
public SettingsTabDxvk() | ||
{ | ||
Entries = new SettingsEntry[] | ||
{ | ||
dxvkVersionSetting = new SettingsEntry<DxvkVersion>("DXVK Version", "Choose which version of DXVK to use.", () => Program.Config.DxvkVersion ?? DxvkVersion.v1_10_3, type => Program.Config.DxvkVersion = type) | ||
{ | ||
CheckWarning = type => | ||
{ | ||
if (new [] {DxvkVersion.v2_1, DxvkVersion.v2_2}.Contains(type)) | ||
return "May not work with older graphics cards. AMD users may need to use env variable RADV_PERFTEST=gpl"; | ||
return null; | ||
}, | ||
}, | ||
wineD3DUseVk = new SettingsEntry<bool>("Use WineD3D Vulkan renderer", "Use Vulkan instead of OpenGL for WineD3D. Unstable. May cause system to lock up.", () => Program.Config.WineD3DUseVK ?? false, b => Program.Config.WineD3DUseVK = b) | ||
{ | ||
CheckVisibility = () => dxvkVersionSetting.Value == DxvkVersion.Disabled, | ||
CheckWarning = b => | ||
{ | ||
if (b) | ||
return "WARNING! This is very experimental, and may cause your system to crash or hang. If you still want to use it, disable Dalamud."; | ||
return null; | ||
}, | ||
}, | ||
new SettingsEntry<bool>("Enable DXVK ASYNC", "Enable DXVK ASYNC patch.", () => Program.Config.DxvkAsyncEnabled ?? true, b => Program.Config.DxvkAsyncEnabled = b) | ||
{ | ||
CheckVisibility = () => (new [] {DxvkVersion.v1_10_3, DxvkVersion.v2_0}.Contains(dxvkVersionSetting.Value)), | ||
CheckWarning = b => | ||
{ | ||
if (!b && dxvkVersionSetting.Value == DxvkVersion.v2_0) | ||
return "AMD users may need to use env variable RADV_PERFTEST=gpl"; | ||
return null; | ||
}, | ||
}, | ||
dxvkHudSetting = new SettingsEntry<DxvkHudType>("DXVK Overlay", "DXVK Hud is included with Dxvk. It doesn't work if Dxvk is disabled.\nMangoHud must be installed separately. Flatpak XIVLauncher needs flatpak MangoHud.", () => Program.Config.DxvkHudType, type => Program.Config.DxvkHudType = type) | ||
{ | ||
CheckVisibility = () => dxvkVersionSetting.Value != DxvkVersion.Disabled || wineD3DUseVk.Value, | ||
CheckValidity = type => | ||
{ | ||
if ((type == DxvkHudType.MangoHud || type == DxvkHudType.MangoHudCustom || type == DxvkHudType.MangoHudFull) | ||
&& (!File.Exists("/usr/lib/mangohud/libMangoHud.so") && !File.Exists("/usr/lib64/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 == DxvkHudType.Custom && dxvkVersionSetting.Value != DxvkVersion.Disabled, | ||
CheckWarning = s => | ||
{ | ||
if(!DxvkManager.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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a Linux-only config option, and even then only useful when MangoHUD is actually installed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the moment, there's a function that looks for specific paths where Linux installs MangoHud, and it won't let you save your selection if it doesn't find it (it will show an error). I think the whole DXVK tab is really linux only. Only the Disabled/WineD3D setting would work on MacOS atm (if that), and only if you manually provided a wine release. Maybe there's DXVK for freebsd? Not sure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DXVK is a PE only binary that translates Windows dx calls into Windows Vulkan calls (simplified), so it will run on any platform that supports the necessary Windows Vulkan feature level which is Wine on Linux, FreeBSD, macOS (if the native unix implementation has all needed extensions) and even on Windows itself (where it is sometimes used to provide better frame pacing, or just in general better performance that the native Windows dx driver) |
||
{ | ||
CheckVisibility = () => dxvkHudSetting.Value == DxvkHudType.MangoHudCustom && !(dxvkVersionSetting.Value == DxvkVersion.Disabled && !wineD3DUseVk.Value), | ||
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.DxvkFrameRate ?? 0, i => Program.Config.DxvkFrameRate = i, 0, 1000) | ||
{ | ||
CheckVisibility = () => dxvkVersionSetting.Value != DxvkVersion.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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System.Numerics; | ||
using System.IO; | ||
using System.Collections.Generic; | ||
|
||
namespace XIVLauncher.Core; | ||
|
||
public enum WinePackage | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels a bit weird having the wine package enum inside the Distro file.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's actually used in the WineManager to determine which wine package to download. I've renamed to DistroPackage now. |
||
{ | ||
ubuntu, | ||
|
||
fedora, | ||
|
||
arch, | ||
} | ||
|
||
public static class Distro | ||
{ | ||
public static WinePackage Package { get; private set; } | ||
|
||
public static string Name { get; private set; } | ||
|
||
public static bool IsFlatpak { get; private set; } | ||
|
||
public static void GetInfo() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is called All of this also only makes sense on a target system that needs wine (and even then only on Linux). Each csproj has Also not sure if this needs to be a top-level file here at all, there is also https://github.com/goatcorp/FFXIVQuickLauncher/blob/410cc9ed0624c37879b747ad69ba6e61c18c6f0f/src/XIVLauncher.Common/Platform.cs#L7 |
||
{ | ||
try | ||
{ | ||
if (!File.Exists("/etc/os-release")) | ||
{ | ||
Package = WinePackage.ubuntu; | ||
Name = "Unknown distribution"; | ||
IsFlatpak = false; | ||
return; | ||
} | ||
var osRelease = File.ReadAllLines("/etc/os-release"); | ||
var distro = WinePackage.ubuntu; | ||
var flatpak = false; | ||
var OSInfo = new Dictionary<string, string>(); | ||
foreach (var line in osRelease) | ||
{ | ||
var keyValue = line.Split('=', 2); | ||
if (keyValue.Length == 1) | ||
OSInfo.Add(keyValue[0], ""); | ||
else | ||
OSInfo.Add(keyValue[0], keyValue[1]); | ||
} | ||
|
||
var name = (OSInfo.ContainsKey("NAME") ? OSInfo["NAME"] : "").Trim('"'); | ||
var pretty = (OSInfo.ContainsKey("PRETTY_NAME") ? OSInfo["PRETTY_NAME"] : "").Trim('"'); | ||
var idLike = OSInfo.ContainsKey("ID_LIKE") ? OSInfo["ID_LIKE"] : ""; | ||
if (idLike.Contains("arch")) | ||
distro = WinePackage.arch; | ||
else if (idLike.Contains("fedora")) | ||
distro = WinePackage.fedora; | ||
else | ||
distro = WinePackage.ubuntu; | ||
|
||
var id = OSInfo.ContainsKey("ID") ? OSInfo["ID"] : ""; | ||
if (id.Contains("tumbleweed") || id.Contains("fedora")) | ||
distro = WinePackage.fedora; | ||
if (id == "org.freedesktop.platform") | ||
flatpak = true; | ||
|
||
Package = distro; | ||
Name = pretty == "" ? (name == "" ? "Unknown distribution" : name) : pretty; | ||
IsFlatpak = flatpak; | ||
} | ||
catch | ||
{ | ||
// If there's any kind of error opening the file or even finding it, just go with default. | ||
Package = WinePackage.ubuntu; | ||
Name = "Unknown distribution"; | ||
IsFlatpak = false; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These wine registry calls can be blocking for up to a few seconds, not sure if it is a good idea to put them here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one isn't really that important, and can easily be removed. It's just an option to use WineD3D in Vulkan mode, which is not terribly stable to begin with. As for putting it somewhere else, the only other place is in UnixGameRunner, and it'd still probably lock up for a few seconds. I'm just going to get rid of the WineD3D vulkan stuff. Chances are the only reason someone would want to use WineD3D is to use openGL anyway.