### Authenticate and Start Game with FFXIV Quick Launcher Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Handles the complete login flow, including boot-version checks, gate status, OTP prompting, OAuth authentication, game patching, and Dalamud injection. The `AfterLoginAction` enum dictates the launch mode. This method is typically initiated from the main window's ViewModel. ```csharp // Available AfterLoginAction values: // Start – normal launch with Dalamud // StartWithoutDalamud – skip Dalamud injection // StartWithoutPlugins – inject Dalamud but load no plugins // StartWithoutThird – skip third-party repo plugins only // UpdateOnly – patch game then exit without launching // Repair – run PatchVerifier then optionally launch // Initiated from the main window ViewModel (MVVM command): viewModel.TryLogin( username: "myuser", password: "mypassword", isOtp: true, isSteam: false, doingAutoLogin: false, action: MainWindowViewModel.AfterLoginAction.Start ); ``` ```csharp // The internal Login() method executes these steps: // 1. ProblemCheck.RunCheck() – detect admin-mode / MacType / broken GShade // 2. HandleBootCheck() – check/apply boot patches via aria2 // 3. Verify lease CutOffBootver – killswitch if boot version exceeds threshold // 4. OtpInputDialog.AskForOtp() – prompt user for 6-digit OTP if required // 5. Launcher.Login(...) – OAuth login → returns LoginResult // 6. TryProcessLoginResult() – handle NoService / NoTerms / NeedsPatchGame // 7. StartGameAndAddon() – inject Dalamud, launch addons, wait for exit ``` ```csharp // StartGameAndAddon creates the Dalamud launcher: var dalamudLauncher = new DalamudLauncher( new WindowsDalamudRunner(App.DalamudUpdater.Runtime), App.DalamudUpdater, DalamudLoadMethod.EntryPoint, gamePath: App.Settings.GamePath, configDirectory: new DirectoryInfo(Paths.RoamingPath), pluginDirectory: new DirectoryInfo(Paths.RoamingPath), language: ClientLanguage.English, injectionDelayMs: 0, startInsteadOfInject: false, noPlugins: false, noThird: false, troubleshootingJson: Troubleshooting.GetTroubleshootingJson() ); ``` -------------------------------- ### Read Build Metadata and Detect Game Path Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Use AppUtil to retrieve build-time metadata like version and Git hash. It also auto-detects the game installation path by checking common locations, Steam, and registry keys, returning the path with the highest game version. ```csharp // Read build-time metadata (embedded via AssemblyMetadataAttribute in the csproj): string version = AppUtil.GetAssemblyVersion(); // e.g. "9.1.0.0" string hash = AppUtil.GetGitHash(); // e.g. "abc1234def" string origin = AppUtil.GetBuildOrigin(); // e.g. "goatcorp/FFXIVQuickLauncher" bool isOfficial = origin == "goatcorp/FFXIVQuickLauncher"; // true for official builds // Auto-detect game path from common install locations + registry: string bestPath = AppUtil.TryGamePaths(); // Checks: Program Files (x86)\SquareEnix\FINAL FANTASY XIV - A Realm Reborn // All drive letters under Steam\steamapps\common\... // HKLM\SOFTWARE\...\Uninstall\{2B41E132-...} (SE installer) // HKLM\SOFTWARE\...\Uninstall\Steam App 39210 (paid) // HKLM\SOFTWARE\...\Uninstall\Steam App 312060 (free trial) // Returns the path with the highest observed game version ``` -------------------------------- ### Get Raw Troubleshooting JSON Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Retrieves the raw diagnostic data as a JSON string, which can be embedded in custom reports. The JSON includes details about the launcher, Dalamud, game versions, and integrity checks. ```csharp // Get the raw JSON for embedding in custom reports: string json = Troubleshooting.GetTroubleshootingJson(); // Example output: // { // "When": "2024-06-01T12:34:56", // "IsAutoLogin": true, // "IsUidCache": false, // "DalamudEnabled": true, // "DalamudLoadMethod": 1, // "DalamudInjectionDelay": 0, // "EncryptArguments": true, // "LauncherVersion": "9.1.0.0", // "LauncherHash": "abc1234", // "Official": true, // "DpiAwareness": 0, // "Platform": 0, // "ObservedGameVersion": "2024.05.28.0000.0000", // "ObservedEx1Version": "2024.05.28.0000.0000", // ... // "BckMatch": true, // "IndexIntegrity": 5 // 5 = Success // } ``` -------------------------------- ### Check, Download, and Apply Launcher Self-Updates Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Initiates a check for launcher updates, downloads them if available, and prepares for application. Subscribe to the OnUpdateCheckFinished event to handle the outcome. Access the active lease for feature flags and URLs after the update check. Optionally fetch news or error banners. ```csharp var updates = new Updates(); updates.OnUpdateCheckFinished += (upToDate) => { if (upToDate) Console.WriteLine("Launcher is up to date, proceed to main window."); else Console.WriteLine("Update downloaded; restart pending via changelog window."); }; await updates.Run(downloadPrerelease: false, changelogWindow: myChangelogWindow); if (Updates.UpdateLease != null) { bool dalamudDisabled = Updates.HaveFeatureFlag(Updates.LeaseFeatureFlags.GlobalDisableDalamud); string frontierUrl = Updates.UpdateLease.FrontierUrl; Console.WriteLine($"Frontier URL: {frontierUrl}, Dalamud globally disabled: {dalamudDisabled}"); } var news = await Updates.GetErrorNews(); if (news != null && DateTimeOffset.UtcNow.ToUnixTimeSeconds() <= news.ShowUntil) { Console.WriteLine($"[{(news.IsError ? "ERROR" : "INFO")}] {news.Message}"); } ``` -------------------------------- ### Launcher Settings Interface (ILauncherSettingsV3) Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Access and modify all user-configurable launcher settings through a strongly-typed interface. This is useful for configuring game paths, Dalamud, OTP servers, language, patching, and UX preferences. ```csharp // Typical usage: reading and writing settings via the interface ILauncherSettingsV3 settings = App.Settings; // Game path and auto-login settings.GamePath = new DirectoryInfo(@"C:\Program Files (x86)\SquareEnix\FINAL FANTASY XIV - A Realm Reborn"); settings.AutologinEnabled = true; // Dalamud (in-game plugin framework) settings.InGameAddonEnabled = true; settings.InGameAddonLoadMethod = DalamudLoadMethod.EntryPoint; // or DllInject (Wine/Linux) settings.DalamudInjectionDelayMs = 0; // increase to 4000 if RTSS/SpecialK detected // OTP server support (for third-party OTP apps) settings.OtpServerEnabled = true; settings.OtpAlwaysOnTopEnabled = false; // Language settings settings.Language = ClientLanguage.English; settings.LauncherLanguage = LauncherLanguage.English; settings.AcceptLanguage = "en"; // Patch management settings.PatchPath = new DirectoryInfo(@"C:\XIVPatches"); settings.SpeedLimitBytes = 0; // 0 = unlimited settings.KeepPatches = false; settings.AskBeforePatchInstall = true; // UX tweaks settings.EncryptArguments = true; settings.ExitLauncherAfterGameExit = true; settings.TreatNonZeroExitCodeAsFailure = false; settings.DpiAwareness = DpiAwareness.Unaware; settings.ForceNorthAmerica = false; // Dalamud beta opt-in settings.DalamudBetaKind = "stg"; settings.DalamudBetaKey = "beta-key-here"; // Steam auto-start settings.AutoStartSteam = true; ``` -------------------------------- ### Run Environment Checks Before Launch Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Automatically called before login attempts, this function checks for and offers to fix issues like RUNASADMIN flags, administrator elevation, MacType DLL injection, and broken GShade symlinks. It is skipped on Wine/Linux. ```csharp // Called automatically before every login attempt // Can also be called standalone for diagnostics: ProblemCheck.RunCheck(parentWindow: myWindow); // Internally it checks: // 1. Registry: HKCU\...\AppCompatFlags\Layers for RUNASADMIN entries // → offers to delete them automatically // 2. PlatformHelpers.IsElevated() // → warns once, sets HasComplainedAboutAdmin = true // 3. Process.GetCurrentProcess().Modules contains MacType.dll / MacType64.dll // → shows error and calls Environment.Exit(-1) // 4. GamePath\game\d3d11.dll / dxgi.dll / dinput8.dll symlink validity // → offers elevated delete via cmd.exe runas // 5. GShade installed in d3d11.dll or dinput8.dll mode (should be dxgi.dll) // → offers to move and fix registry key HKLM\SOFTWARE\GShade\Installations... // → uses: cmd.exe /C move "" "\dxgi.dll" // → updates reg: altdxmode = 0 // Example: detecting the elevated-delete path for broken GShade symlinks var d3d11 = new FileInfo(Path.Combine(gameFolderPath, "d3d11.dll")); var dxgi = new FileInfo(Path.Combine(gameFolderPath, "dxgi.dll")); // If either symlink throws IOException on OpenRead(), it is corrupt: try { d3d11.OpenRead(); } catch (IOException) { /* broken – run ElevatedDelete(d3d11, dxgi) */ } ``` -------------------------------- ### Log Troubleshooting Data Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Captures diagnostic information including launcher version, git hash, platform, Dalamud config, and repository versions. This data is Base64-encoded and emitted to the Serilog log. ```csharp // Log troubleshooting data to output.log (called after every game launch): Troubleshooting.LogTroubleshooting(); // Emits: TROUBLESHXLTING:eyJXaGVuIjoiMjAyNC0..." (base64 JSON) ``` ```csharp // Log an exception with context (called from the Serilog event sink): Troubleshooting.LogException(exception, context: "GetLoginFunc/Task"); // Emits: LASTEXCEPTION:eyJXaGVuIjoi... (base64 JSON with When/Info/Context) ``` -------------------------------- ### Account Management with AccountManager Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Manage FFXIV accounts, including loading, saving, adding, removing, and switching between them. Passwords are securely stored in the Windows Credential Manager. Use this for handling multiple game accounts. ```csharp // Initialize with launcher settings var settings = App.Settings; // ILauncherSettingsV3 var accountManager = new AccountManager(settings); // Add a new account (password stored in Windows Credential Manager) var newAccount = new XivAccount("myusername") { SavePassword = true, UseOtp = true, UseSteamServiceAccount = false }; newAccount.Password = "mySecurePassword"; // Written to WCM accountManager.AddAccount(newAccount); // No-op if account already exists with same password // Switch the active account accountManager.CurrentAccount = newAccount; // Persists to settings.CurrentAccountId = "myusername-True-False" // Update a stored password (e.g., after user changes it) accountManager.UpdatePassword(newAccount, "newPassword123"); // Track the last-used OTP to detect duplicate entries accountManager.UpdateLastSuccessfulOtp(newAccount, "123456"); // Remove an account (clears password from WCM first) accountManager.RemoveAccount(newAccount); // Accounts list is automatically saved on any collection change // Manual save/reload: accountManager.Save(); // writes %APPDATA%\XIVLauncher\accountsList.json accountManager.Load(); // reads and deserialises; handles null gracefully ``` -------------------------------- ### Check for Game File Locks Before Patching Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Before patching, check if any processes are locking game files. This function returns false if the user cancels the operation, and true if files are free or the user chooses to ignore the locks. ```csharp // Check for processes locking game files before patching: bool canProceed = AppUtil.TryYellOnGameFilesBeingOpen( parentWindow: myWindow, messageGenerator: n => n == 1 ? "Close the following application to patch the game." : $"Close the following {n} applications to patch the game." ); // Returns false if user cancels, true if files are free or user chose to ignore ``` -------------------------------- ### Generate Support Pack ZIP Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Bundles diagnostic JSON and relevant log files into a timestamped .tspack ZIP archive for sharing with support. This function creates the archive and returns its path. ```csharp // Generate a support pack ZIP (~all logs + trouble.json): string packPath = PackGenerator.SavePack(); // Creates: %APPDATA%\XIVLauncher\trouble-20240601123456.tspack // Contents: trouble.json, output.log, patcher.log, dalamud.log, // dalamud.injector.log, dalamud.boot.log, aria.log Console.WriteLine($"Support pack saved to: {packPath}"); ``` -------------------------------- ### Retrieve TOTP Codes from 1Password Vault (PowerShell) Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt These PowerShell scripts integrate with 1Password CLI to retrieve Time-based One-Time Password (TOTP) codes. They require 1Password 8, the 1Password CLI, and specific launcher settings. The scripts can either submit the OTP directly to the launcher's server or send it to the launcher window. ```powershell # automatic-login.ps1 – retrieve OTP and submit directly to XL's OTP server # (no launcher window shown; requires "Log in automatically" checked in XL) # Ensure your vault item is named "Square Enix" (line 4 of the script) $VaultItem = "Square Enix" # The script calls: op item get "$VaultItem" --otp # which triggers Windows Hello and returns the 6-digit TOTP code, # then POSTs it to http://localhost:6969/ (XIVLauncher OTP server endpoint) # manual-login.ps1 – same vault lookup, but sends OTP to the XL window # (launcher main window remains visible; waits for OTP input port to open) # To convert either script to a pinnable .exe (optional): # Install-Module ps2exe -Scope CurrentUser # Invoke-ps2exe .\automatic-login.ps1 .\XL-AutoLogin.exe # Known issues: # - Windows Hello prompt may minimise if 1Password is also minimised # - Script may fail to retrieve OTP if vault is locked; unlock vault first ``` -------------------------------- ### Check if Updates are Disabled Source: https://context7.com/goatcorp/ffxivquicklauncher/llms.txt Determine if automatic updates are disabled. This can be due to an environment variable (XL_NOAUTOUPDATE=1) or if the build is a Debug configuration. ```csharp // Check if updates are disabled (env var or debug build): bool noUpdates = AppUtil.IsDisableUpdates; // True if XL_NOAUTOUPDATE=1 or compiled as Debug ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.