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 #59

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c6e523a
First successful build and launch.
rankynbass Jun 17, 2023
903ee25
Reposition submodule
rankynbass Jun 17, 2023
8363495
Merge branch 'main' into compatibility-rework
rankynbass Jun 17, 2023
9b05879
Minor fixes
rankynbass Jun 17, 2023
e687d03
Update submodule
rankynbass Jun 17, 2023
3878e84
Merge branch 'main' into compatibility-rework
rankynbass Jun 18, 2023
3de5ce9
Move more login into runners
rankynbass Jun 18, 2023
3a7aca8
More work done
rankynbass Jun 22, 2023
c522e0f
Move WineRunner, DxvkRunner to FFQL repo
rankynbass Jun 24, 2023
272f4d1
Fix gamemode, update submodule
rankynbass Jun 24, 2023
8fd716d
Move MacVideoFix to xlcore
rankynbass Jun 24, 2023
380e62a
Replace directives with GetDistro function
rankynbass Jun 25, 2023
8314140
Move distro function to Program.cs, add flatpak detection
rankynbass Jun 25, 2023
2142c7d
Use Dictionary instead of iterating array
rankynbass Jun 25, 2023
0637558
Fix error by switching to .ContainsKey()
rankynbass Jun 25, 2023
74b4912
Move distro detection to own class, use enum
rankynbass Jun 25, 2023
5d75345
Forgot to save a couple files
rankynbass Jun 25, 2023
94f34c4
Revert "Move MacVideoFix to xlcore"
rankynbass Jun 25, 2023
9067d4e
Merge branch 'main' into compatibility-rework
rankynbass Jun 25, 2023
ad51095
Update submodule so it will build
rankynbass Jun 25, 2023
0098371
Fix slightly wrong WINEDLLOVERRIDE.
rankynbass Jun 26, 2023
6fe1b6b
Changes to match with main XL repo. More to come.
rankynbass Jun 28, 2023
7afb7a2
Remove WineD3D Vulkan
rankynbass Jun 28, 2023
f7162a4
Move Wine, Dxvk, Distro to UnixCompatibility
rankynbass Jun 29, 2023
64a3a62
Cleaned up some Distro-related stuff.
rankynbass Jun 29, 2023
ea617f2
Update submodule
rankynbass Jun 29, 2023
c80b205
Touched up the Wine Tab
rankynbass Jun 29, 2023
c5331d0
Switch to using XIVLauncher.Common.Platform enum
rankynbass Jun 29, 2023
f8a236b
Added some code in Distro for MacOS & FreeBSD.
rankynbass Jun 29, 2023
2334b28
Minor cleanup of code and rewording some options.
rankynbass Jul 1, 2023
ccf30a7
Update submodule
rankynbass Jul 1, 2023
3b07474
Fixed flatpak path for mangohud
rankynbass Jul 1, 2023
92a7cff
Changed default wine to 7.10
rankynbass Jul 8, 2023
7ab0524
Update WineVersion descriptions
rankynbass Jul 8, 2023
22bfcbb
Update submodule
rankynbass Jul 8, 2023
387d17d
Update Distro.cs to correct namespace.
rankynbass Jul 11, 2023
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
11 changes: 5 additions & 6 deletions src/XIVLauncher.Core/Components/MainPage/MainPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using XIVLauncher.Core.Accounts;
using XIVLauncher.Common.Game.Exceptions;
using XIVLauncher.Core.Support;
using XIVLauncher.Core.UnixCompatibility;

namespace XIVLauncher.Core.Components.MainPage;

Expand Down Expand Up @@ -738,15 +739,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);
}

Expand All @@ -756,12 +757,10 @@ 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);
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...";
Expand Down
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
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 @@ -16,9 +16,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,5 +1,7 @@
using System.Collections;
using ImGuiNET;
using XIVLauncher.Common;
using XIVLauncher.Core.UnixCompatibility;

namespace XIVLauncher.Core.Components.SettingsPage.Tabs;

Expand All @@ -12,7 +14,10 @@ public override void Draw()
{
ImGui.TextUnformatted("Generic Information");
ImGui.Separator();
ImGui.TextUnformatted($"Operating System: {Environment.OSVersion}");
if (Distro.Platform == Platform.Linux)
ImGui.TextUnformatted($"Operating System: {Distro.Name} - {Environment.OSVersion}");
else
ImGui.TextUnformatted($"Operating System: {Environment.OSVersion}");
ImGui.TextUnformatted($"Runtime Version: {Environment.Version}");

if (Program.IsSteamDeckHardware)
Expand All @@ -21,9 +26,8 @@ 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

ImGui.Spacing();

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

namespace XIVLauncher.Core.Components.SettingsPage.Tabs;

public class SettingsTabDxvk : SettingsTab
{
private SettingsEntry<DxvkVersion> dxvkVersionSetting;
private SettingsEntry<bool> wineD3DUseVk;
private SettingsEntry<HudType> hudSetting;

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;
},
},
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;
},
},
hudSetting = new SettingsEntry<HudType>("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.HudType, x => Program.Config.HudType = x)
{
CheckVisibility = () => dxvkVersionSetting.Value != DxvkVersion.Disabled,
CheckValidity = x =>
{
if ((x == HudType.MangoHud || x == HudType.MangoHudCustom || x == HudType.MangoHudFull)
&& (HudManager.FindMangoHud() is null))
return "MangoHud not detected.";

return null;
},
CheckWarning = x =>
{
if ((x == HudType.MangoHud || x == HudType.MangoHudCustom || x == HudType.MangoHudFull)
&& (HudManager.FindMangoHud() is not null))
return "WARNING! Using MangoHud, Dalamud AND ReShade all at the same time may result in crashes. Using any two should be safe.";

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 = () => hudSetting.Value == HudType.Custom && dxvkVersionSetting.Value != DxvkVersion.Disabled,
CheckWarning = s =>
{
if(!HudManager.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.MangoHudCustom, s => Program.Config.MangoHudCustom = s)
{
CheckVisibility = () => hudSetting.Value == HudType.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
Expand Up @@ -25,12 +25,6 @@ public override void Draw()

ImGui.Separator();

ImGui.Text("\nReset settings to default.");
if (ImGui.Button("Clear Settings"))
{
Program.ClearSettings(true);
}

ImGui.Text("\nClear the Wine Prefix - delete the ~/.xlcore/wineprefix folder");
if (ImGui.Button("Clear Prefix"))
{
Expand All @@ -55,6 +49,12 @@ public override void Draw()
Program.ClearLogs(true);
}

ImGui.Text("\nReset settings to default.");
if (ImGui.Button("Clear Settings"))
{
Program.ClearSettings(true);
}

ImGui.Text("\nDo all of the above.");
if (ImGui.Button("Clear Everything"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,31 @@
using ImGuiNET;
using XIVLauncher.Common.Unix.Compatibility;
using XIVLauncher.Common.Util;
using XIVLauncher.Core.UnixCompatibility;

namespace XIVLauncher.Core.Components.SettingsPage.Tabs;

public class SettingsTabWine : SettingsTab
{
private SettingsEntry<WineStartupType> startupTypeSetting;
private SettingsEntry<WineType> startupTypeSetting;

public SettingsTabWine()
{
Entries = new SettingsEntry[]
{
startupTypeSetting = new SettingsEntry<WineStartupType>("Wine Version", "Choose how XIVLauncher will start and manage your wine installation.",
() => Program.Config.WineStartupType ?? WineStartupType.Managed, x => Program.Config.WineStartupType = x),
startupTypeSetting = new SettingsEntry<WineType>("Installation Type", "Choose how XIVLauncher will start and manage your game installation.",
() => Program.Config.WineType ?? WineType.Managed, x => Program.Config.WineType = x),

new SettingsEntry<WineVersion>("Wine Version", "Choose a patched wine version.", () => Program.Config.WineVersion ?? WineVersion.Wine7_10, x => Program.Config.WineVersion = x)
{
CheckVisibility = () => startupTypeSetting.Value == WineType.Managed
},

new SettingsEntry<string>("Wine Binary Path",
"Set the path XIVLauncher will use to run applications via wine.\nIt should be an absolute path to a folder containing wine64 and wineserver binaries.",
() => Program.Config.WineBinaryPath, s => Program.Config.WineBinaryPath = s)
{
CheckVisibility = () => startupTypeSetting.Value == WineStartupType.Custom
CheckVisibility = () => startupTypeSetting.Value == WineType.Custom
},

new SettingsEntry<bool>("Enable Feral's GameMode", "Enable launching with Feral Interactive's GameMode CPU optimizations.", () => Program.Config.GameModeEnabled ?? true, b => Program.Config.GameModeEnabled = b)
Expand All @@ -36,8 +42,8 @@ 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)
{
CheckVisibility = () => RuntimeInformation.IsOSPlatform(OSPlatform.Linux),
Expand All @@ -49,10 +55,6 @@ public SettingsTabWine()
return null;
}
},

new SettingsEntry<bool>("Set Windows version to 7", "Default for Wine 8.1+ is Windows 10, but this causes issues with some Dalamud plugins. Windows 7 is recommended for now.", () => Program.Config.SetWin7 ?? true, b => Program.Config.SetWin7 = b),

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 All @@ -67,6 +69,10 @@ public override void Draw()
{
base.Draw();

ImGui.Separator();

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

if (!Program.CompatibilityTools.IsToolDownloaded)
{
ImGui.BeginDisabled();
Expand All @@ -77,7 +83,7 @@ public override void Draw()

if (ImGui.Button("Open prefix"))
{
PlatformHelpers.OpenBrowser(Program.CompatibilityTools.Settings.Prefix.FullName);
PlatformHelpers.OpenBrowser(Program.CompatibilityTools.Prefix.FullName);
}

ImGui.SameLine();
Expand All @@ -94,6 +100,31 @@ public override void Draw()
Program.CompatibilityTools.RunInPrefix("explorer");
}

ImGui.SameLine();

if (ImGui.Button("Open Wine explorer (use WineD3D"))
{
Program.CompatibilityTools.RunInPrefix("explorer", wineD3D: true);

}

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


if (ImGui.Button("Set Wine to Windows 7"))
{
Program.CompatibilityTools.RunInPrefix($"winecfg /v win7", redirectOutput: true, writeLog: true);
}

ImGui.SameLine();

if (ImGui.Button("Set Wine to Windows 10"))
{
Program.CompatibilityTools.RunInPrefix($"winecfg /v win10", redirectOutput: true, writeLog: true);
}

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

if (ImGui.Button("Kill all wine processes"))
{
Program.CompatibilityTools.Kill();
Expand Down
17 changes: 13 additions & 4 deletions src/XIVLauncher.Core/Configuration/ILauncherConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using XIVLauncher.Common.Dalamud;
using XIVLauncher.Common.Game.Patch.Acquisition;
using XIVLauncher.Common.Unix.Compatibility;
using XIVLauncher.Core.UnixCompatibility;

namespace XIVLauncher.Core.Configuration;

Expand Down Expand Up @@ -62,7 +63,11 @@ public interface ILauncherConfig

#region Linux

public WineStartupType? WineStartupType { get; set; }
public WineType? WineType { get; set; }

public WineVersion? WineVersion { get; set; }

public DxvkVersion? DxvkVersion { get; set; }

public string? WineBinaryPath { get; set; }

Expand All @@ -74,16 +79,20 @@ public interface ILauncherConfig

public bool? FSyncEnabled { get; set; }

public Dxvk.DxvkHudType DxvkHudType { get; set; }
public HudType HudType { get; set; }

public string? DxvkHudCustom { get; set; }

public string? MangoHudCustom { get; set; }

public int? DxvkFrameRate { get; set; }

public string? WineDebugVars { get; set; }

public bool? FixLDP { get; set; }

public bool? FixIM { get; set; }

public bool? SetWin7 { get; set; }

#endregion

#region Dalamud
Expand Down
Loading
Loading