Skip to content

Commit

Permalink
Merge pull request #175 from rankynbass/add-XL_APPID
Browse files Browse the repository at this point in the history
  • Loading branch information
reiichi001 authored Aug 31, 2024
2 parents 56cbeca + 5cb374a commit 48d54d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/XIVLauncher.Core/CoreEnvironmentSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -39,6 +40,14 @@ public static string GetCleanEnvironmentVariable(string envvar, string badstring
return string.Join(separator, Array.FindAll<string>(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())
Expand Down
10 changes: 9 additions & 1 deletion src/XIVLauncher.Core/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 48d54d7

Please sign in to comment.