diff --git a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs index 0d067b25..b5975868 100644 --- a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs +++ b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs @@ -16,6 +16,7 @@ public static class CoreEnvironmentSettings public static bool ClearAll => CheckEnvBool("XL_CLEAR_ALL"); public static bool? UseSteam => CheckEnvBoolOrNull("XL_USE_STEAM"); // Fix for Steam Deck users who lock themselves out public static bool IsSteamCompatTool => CheckEnvBool("XL_SCT"); + public static uint AltAppID => GetAltAppId(System.Environment.GetEnvironmentVariable("XL_APPID")); private static bool CheckEnvBool(string key) { @@ -39,6 +40,14 @@ public static string GetCleanEnvironmentVariable(string envvar, string badstring return string.Join(separator, Array.FindAll(dirty.Split(separator, StringSplitOptions.RemoveEmptyEntries), s => !s.Contains(badstring))); } + public static uint GetAltAppId(string? appid) + { + uint.TryParse(appid, out var result); + + // Will return 0 if appid is invalid (or zero). + return result; + } + public static string GetCType() { if (System.OperatingSystem.IsWindows()) diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index b37dabaa..6a169c2a 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -196,7 +196,15 @@ private static void Main(string[] args) uint appId, altId; string appName, altName; - if (Config.IsFt == true) + // AppId of 0 is invalid (though still a valid uint) + if (CoreEnvironmentSettings.AltAppID > 0) + { + appId = CoreEnvironmentSettings.AltAppID; + altId = STEAM_APP_ID_FT; + appName = $"Override AppId={appId.ToString()}"; + altName = "FFXIV Free Trial"; + } + else if (Config.IsFt == true) { appId = STEAM_APP_ID_FT; altId = STEAM_APP_ID;