Skip to content

Commit

Permalink
Fix broken dxvk version and improve steam deck detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rankynbass committed Nov 7, 2024
1 parent 5feaa62 commit f5e1981
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/XIVLauncher.Core/CoreEnvironmentSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ namespace XIVLauncher.Core;
public static class CoreEnvironmentSettings
{
public static bool? IsDeck => CheckEnvBoolOrNull("XL_DECK");
public static bool IsSteamDeckVar => CheckEnvBool("SteamDeck");
public static bool? IsDeckGameMode => CheckEnvBoolOrNull("XL_GAMEMODE");
public static bool IsSteamGamepadUIVar => CheckEnvBool("SteamGamepadUI");
public static bool? IsDeckFirstRun => CheckEnvBoolOrNull("XL_FIRSTRUN");
public static bool IsUpgrade => CheckEnvBool("XL_SHOW_UPGRADE");
public static bool ClearSettings => CheckEnvBool("XL_CLEAR_SETTINGS");
Expand All @@ -21,6 +23,10 @@ public static class CoreEnvironmentSettings
public static bool IsSteamCompatTool => CheckEnvBool("XL_SCT");
public static uint SteamAppId => GetAppId(System.Environment.GetEnvironmentVariable("SteamAppId"));
public static uint AltAppID => GetAppId(System.Environment.GetEnvironmentVariable("XL_APPID"));
public static string HOME => System.Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
public static string XDG_CONFIG_HOME => string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("XDG_CONFIG_HOME")) ? Path.Combine(HOME, ".config") : System.Environment.GetEnvironmentVariable("XDG_CONFIG_HOME") ?? "";
public static string XDG_DATA_HOME => string.IsNullOrEmpty(System.Environment.GetEnvironmentVariable("XDG_DATA_HOME")) ? Path.Combine(HOME, ".local", "share") : System.Environment.GetEnvironmentVariable("XDG_DATA_HOME") ?? "";


private static bool CheckEnvBool(string key)
{
Expand Down
5 changes: 3 additions & 2 deletions src/XIVLauncher.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ sealed class Program
public static DirectoryInfo DotnetRuntime => storage.GetFolder("runtime");

// TODO: We don't have the steamworks api for this yet.
// SteamDeck=1 on Steam Deck by default. SteamGamepadUI=1 in Big Picture / Gaming Mode.
public static bool IsSteamDeckHardware => CoreEnvironmentSettings.IsDeck.HasValue ?
CoreEnvironmentSettings.IsDeck.Value :
Directory.Exists("/home/deck") || (CoreEnvironmentSettings.IsDeckGameMode ?? false) || (CoreEnvironmentSettings.IsDeckFirstRun ?? false);
CoreEnvironmentSettings.IsSteamDeckVar || (CoreEnvironmentSettings.IsDeckGameMode ?? false) || (CoreEnvironmentSettings.IsDeckFirstRun ?? false);
public static bool IsSteamDeckGamingMode => CoreEnvironmentSettings.IsDeckGameMode.HasValue ?
CoreEnvironmentSettings.IsDeckGameMode.Value :
Steam != null && Steam.IsValid && Steam.IsRunningOnSteamDeck();
Steam != null && Steam.IsValid && Steam.IsRunningOnSteamDeck() && CoreEnvironmentSettings.IsSteamGamepadUIVar;

private const string APP_NAME = "xlcore";

Expand Down
10 changes: 5 additions & 5 deletions src/XIVLauncher.Core/UnixCompatibility/Dxvk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static class Dxvk
public static string DxvkHudString => Program.Config.DxvkHud switch
{
DxvkHud.None => "",
DxvkHud.Custom => Program.Config.DxvkHudCustom,
DxvkHud.Custom => Program.Config.DxvkHudCustom ?? "",
DxvkHud.Default => "1",
DxvkHud.Fps => "fps",
DxvkHud.Full => "full",
Expand All @@ -46,16 +46,16 @@ public static class Dxvk
MangoHud.None => "",
MangoHud.Default => "",
MangoHud.Full => "full",
MangoHud.CustomString => Program.Config.MangoHudCustomString,
MangoHud.CustomFile => Program.Config.MangoHudCustomFile,
MangoHud.CustomString => Program.Config.MangoHudCustomString ?? "",
MangoHud.CustomFile => Program.Config.MangoHudCustomFile ?? "",
_ => throw new ArgumentOutOfRangeException(),
};

public static string DXVK_HUD => "fps,frametimes,gpuload,version";

public static string MANGOHUD_CONFIG => "ram,vram,resolution,vulkan_driver,engine_version,wine,frame_timing=0";

public static string MANGOHUD_CONFIGFILE => Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".config", "MangoHud", "MangoHud.conf");
public static string MANGOHUD_CONFIGFILE => Path.Combine(CoreEnvironmentSettings.XDG_CONFIG_HOME, "MangoHud", "MangoHud.conf");

public static Dictionary<string, Dictionary<string, string>> Versions { get; private set; }

Expand All @@ -68,7 +68,7 @@ static Dxvk()
public static void Initialize()
{
// Add default versions.
Versions["dxvk-2.4"] = new Dictionary<string, string>()
Versions["dxvk-2.4.1"] = new Dictionary<string, string>()
{
{"name", "DXVK 2.4.1"}, {"desc", "Latest version, using Graphics Pipeline Libs. Async no longer needed."},
{"label", "Current"}, {"url", "https://github.com/doitsujin/dxvk/releases/download/v2.4.1/dxvk-2.4.1.tar.gz"},
Expand Down

0 comments on commit f5e1981

Please sign in to comment.