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 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 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
add2213
Update to DXVK 2.4.1
rankynbass Oct 6, 2024
7b873f8
Update submodule
rankynbass Oct 6, 2024
1bb0bbd
Merge branch 'main' into compatibility-rework-2
rankynbass Nov 7, 2024
c0252c2
Update submodule
rankynbass Nov 7, 2024
5feaa62
Copy over compatibility-rework-2 from FFXIVQuickLauncher
rankynbass Nov 7, 2024
f5e1981
Fix broken dxvk version and improve steam deck detection
rankynbass Nov 7, 2024
8fa6c39
Move OSInfo to XL.Common.Unix
rankynbass Nov 7, 2024
8a2e854
Get rid of file find functions
rankynbass Nov 9, 2024
6b1b3e9
More code cleanup:
rankynbass Nov 9, 2024
2f23d0d
Remove debug console writes
rankynbass Nov 9, 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
231 changes: 147 additions & 84 deletions src/XIVLauncher.Common.Unix/Compatibility/CompatibilityTools.cs

Large diffs are not rendered by default.

55 changes: 0 additions & 55 deletions src/XIVLauncher.Common.Unix/Compatibility/Dxvk.cs

This file was deleted.

100 changes: 100 additions & 0 deletions src/XIVLauncher.Common.Unix/Compatibility/DxvkSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
using Serilog;
using XIVLauncher.Common.Unix;

namespace XIVLauncher.Common.Unix.Compatibility;

public class DxvkSettings
{
public bool Enabled { get; }

public string FolderName { get; }

public string DownloadUrl { get; }

public Dictionary<string, string> Environment { get; }

private static bool? mangoHudFound = null;

public DxvkSettings(string folder, string url, string storageFolder, bool async, int maxFrameRate, bool dxvkHudEnabled, string dxvkHudString, bool mangoHudEnabled = false, bool mangoHudCustomIsFile = false, string customMangoHud = "", bool enabled = true)
{
FolderName = folder;
DownloadUrl = url;
Enabled = enabled;

Environment = new Dictionary<string, string>
{
{ "DXVK_LOG_PATH", Path.Combine(storageFolder, "logs") },
};

if (maxFrameRate != 0)
Environment.Add("DXVK_FRAME_RATE", (maxFrameRate).ToString());

if (async)
Environment.Add("DXVK_ASYNC", "1");

var dxvkCachePath = new DirectoryInfo(Path.Combine(storageFolder, "compatibilitytool", "dxvk", "cache"));
if (!dxvkCachePath.Exists) dxvkCachePath.Create();
Environment.Add("DXVK_STATE_CACHE_PATH", Path.Combine(dxvkCachePath.FullName, folder));

if (dxvkHudEnabled)
Environment.Add("DXVK_HUD", DxvkHudStringIsValid(dxvkHudString) ? dxvkHudString : "1");

if (mangoHudEnabled && MangoHudIsInstalled())
{
Environment.Add("MANGOHUD", "1");
if (mangoHudCustomIsFile)
{
if (File.Exists(customMangoHud))
Environment.Add("MANGOHUD_CONFIGFILE", customMangoHud);
else
Environment.Add("MANGOHUD_CONFIG", "");
}
else
{
Environment.Add("MANGOHUD_CONFIG", customMangoHud);
}
}
}

public static bool DxvkHudStringIsValid(string customHud)
{
var ALLOWED_CHARS = "^[0-9a-zA-Z,=.]+$";
var ALLOWED_WORDS = "^(?:devinfo|fps|frametimes|submissions|drawcalls|pipelines|descriptors|memory|gpuload|version|api|cs|compiler|samplers|scale=(?:[0-9])*(?:.(?:[0-9])+)?)$";

if (string.IsNullOrWhiteSpace(customHud)) return false;
if (customHud == "full") return true;
if (customHud == "1") return true;
if (!Regex.IsMatch(customHud, ALLOWED_CHARS)) return false;

string[] hudvars = customHud.Split(",");

return hudvars.All(hudvar => Regex.IsMatch(hudvar, ALLOWED_WORDS));
}

public static bool MangoHudIsInstalled()
{
if (mangoHudFound is null)
{
mangoHudFound = false;
var options = new EnumerationOptions();
options.RecurseSubdirectories = true;
options.MaxRecursionDepth = 5;
foreach (var path in LinuxInfo.LibraryPaths)
{
if (!Directory.Exists(path))
continue;

if (Directory.GetFiles(path, "libMangoHud.so", options).Length > 0)
{
mangoHudFound = true;
break;
}
}
}
return mangoHudFound ?? false;
}
}
32 changes: 19 additions & 13 deletions src/XIVLauncher.Common.Unix/Compatibility/WineSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,38 @@

namespace XIVLauncher.Common.Unix.Compatibility;

public enum WineStartupType
public class WineSettings
{
[SettingsDescription("Managed by XIVLauncher", "The game installation and wine setup is managed by XIVLauncher - you can leave it up to us.")]
Managed,
public bool IsManaged { get; private set; }

[SettingsDescription("Custom", "Point XIVLauncher to a custom location containing wine binaries to run the game with.")]
Custom,
}
public string WineServerPath => Path.Combine(BinPath, "wineserver");

public class WineSettings
{
public WineStartupType StartupType { get; private set; }
public string CustomBinPath { get; private set; }
public string WinePath => File.Exists(Path.Combine(BinPath, "wine64")) ? Path.Combine(BinPath, "wine64") : Path.Combine(BinPath, "wine");

private string BinPath;

public string FolderName;

public string DownloadUrl;

public string EsyncOn { get; private set; }

public string FsyncOn { get; private set; }

public string DebugVars { get; private set; }

public FileInfo LogFile { get; private set; }

public DirectoryInfo Prefix { get; private set; }

public WineSettings(WineStartupType? startupType, string customBinPath, string debugVars, FileInfo logFile, DirectoryInfo prefix, bool? esyncOn, bool? fsyncOn)
public WineSettings(bool isManaged, string customBinPath, string managedFolder, string managedUrl, DirectoryInfo storageFolder, string debugVars, FileInfo logFile, DirectoryInfo prefix, bool? esyncOn, bool? fsyncOn)
{
this.StartupType = startupType ?? WineStartupType.Custom;
this.CustomBinPath = customBinPath;
// storageFolder is the path to .xlcore folder. managedFolder is the foldername inside the tarball that will be downloaded from managedUrl.
IsManaged = isManaged;
FolderName = managedFolder;
DownloadUrl = managedUrl;
BinPath = (isManaged) ? Path.Combine(storageFolder.FullName, "compatibilitytool", "wine", managedFolder, "bin") : customBinPath;

this.EsyncOn = (esyncOn ?? false) ? "1" : "0";
this.FsyncOn = (fsyncOn ?? false) ? "1" : "0";
this.DebugVars = debugVars;
Expand Down
10 changes: 10 additions & 0 deletions src/XIVLauncher.Common.Unix/LinuxContainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace XIVLauncher.Common.Unix;

public enum LinuxContainer
{
none,

flatpak,

snap,
}
12 changes: 12 additions & 0 deletions src/XIVLauncher.Common.Unix/LinuxDistro.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace XIVLauncher.Common.Unix;

public enum LinuxDistro
{
ubuntu,

fedora,

arch,

none,
}
Loading
Loading