-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add XL_APPID as an override for using Free Trial #175
Conversation
public static int GetAltAppId(string? appid) | ||
{ | ||
int result; | ||
if (int.TryParse(appid, out result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use if (int.TryParse(appid, out var result))
to make the code a bit more concise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, did this (with uint.TryParse() instead).
@@ -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 int AltAppID => GetAltAppId(System.Environment.GetEnvironmentVariable("XL_APPID")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually nullability is used here to indicate an env var not existing, instead of using a special value (like -1).
Alright, simplified the logic to use uint.TryParse(). If the conversion fails or the value is zero, AltAppId will be set to 0. I could use a nullable here, but the simple fact is that using an AppId of 0 is invalid anyway, so it's just as easy to make sure AltAppId is > 0 instead of checking for 0 and null. |
With the recent changes to the Free Trial / Demo, some users are having problems getting or keeping FFXIV Free Trial in their library. This allows the user to override the first AppID tried with some other number.
AppID will still fall back to the free trial if an invalid number is used, and if the value passed is not a number (or a number <= 0) it will be ignored.
Fun fact, using proton ids such as
XL_APPID=2805730
for proton 9.0 does work. Not sure that would be the best idea, however.