diff --git a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs index c543c281..3ecd7d54 100644 --- a/src/XIVLauncher.Core/CoreEnvironmentSettings.cs +++ b/src/XIVLauncher.Core/CoreEnvironmentSettings.cs @@ -16,7 +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 int AltAppID => GetAltAppId(System.Environment.GetEnvironmentVariable("XL_APPID")); + public static uint AltAppID => GetAltAppId(System.Environment.GetEnvironmentVariable("XL_APPID")); private static bool CheckEnvBool(string key) { @@ -40,13 +40,13 @@ 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 int GetAltAppId(string? appid) + public static uint GetAltAppId(string? appid) { - int result; - if (int.TryParse(appid, out result)) - return result; - else - return -1; + uint result; + uint.TryParse(appid, out result); + + // Will return 0 if appid is invalid (or zero). + return result; } public static string GetCType() diff --git a/src/XIVLauncher.Core/Program.cs b/src/XIVLauncher.Core/Program.cs index f32407e0..6a169c2a 100644 --- a/src/XIVLauncher.Core/Program.cs +++ b/src/XIVLauncher.Core/Program.cs @@ -196,9 +196,10 @@ private static void Main(string[] args) uint appId, altId; string appName, altName; + // AppId of 0 is invalid (though still a valid uint) if (CoreEnvironmentSettings.AltAppID > 0) { - appId = (uint)CoreEnvironmentSettings.AltAppID; + appId = CoreEnvironmentSettings.AltAppID; altId = STEAM_APP_ID_FT; appName = $"Override AppId={appId.ToString()}"; altName = "FFXIV Free Trial";