/// <summary> /// Gets a real SessionID for the supplied credentials. /// </summary> /// <param name="username">Sqare Enix ID</param> /// <param name="password">Password</param> /// <param name="otp">OTP</param> /// <returns></returns> public static string GetRealSid(string username, string password, string otp) { string hashstr = ""; try { hashstr = "ffxivboot.exe/" + GenerateHash(Settings.GetGamePath() + "/boot/ffxivboot.exe") + ",ffxivboot64.exe/" + GenerateHash(Settings.GetGamePath() + "/boot/ffxivboot64.exe") + ",ffxivlauncher.exe/" + GenerateHash(Settings.GetGamePath() + "/boot/ffxivlauncher.exe") + ",ffxivlauncher64.exe/" + GenerateHash(Settings.GetGamePath() + "/boot/ffxivlauncher64.exe") + ",ffxivupdater.exe/" + GenerateHash(Settings.GetGamePath() + "/boot/ffxivupdater.exe") + ",ffxivupdater64.exe/" + GenerateHash(Settings.GetGamePath() + "/boot/ffxivupdater64.exe"); //make the string of hashed files to prove game version//make the string of hashed files to prove game version } catch (Exception exc) { MessageBox.Show("Could not generate hashes. Is your game path correct?\n\n" + exc, "Launch failed", MessageBoxButtons.OK); } WebClient sidClient = new WebClient(); sidClient.Headers.Add("X-Hash-Check", "enabled"); sidClient.Headers.Add("user-agent", UserAgent); sidClient.Headers.Add("Referer", "https://ffxiv-login.square-enix.com/oauth/ffxivarr/login/top?lng=en&rgn=3"); sidClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); InitiateSslTrust(); var url = "https://patch-gamever.ffxiv.com/http/win32/ffxivneo_release_game/" + GetLocalGamever() + "/" + GetSid(username, password, otp); sidClient.UploadString(url, hashstr); //request real session id return(sidClient.ResponseHeaders["X-Patch-Unique-Id"]); }
private static string GetLocalGamever() { try { using (StreamReader sr = new StreamReader(Settings.GetGamePath() + @"/game/ffxivgame.ver")) { string line = sr.ReadToEnd(); return(line); } } catch (Exception) { return("0"); } }
/// <summary> /// Launches FFXIV with the supplied parameters. /// </summary> /// <param name="realsid">Real SessionID</param> /// <param name="language">language(0=japanese,1=english,2=french,3=german)</param> /// <param name="dx11">Runs the game in dx11 mode if true</param> /// <param name="steam">Initializes Steam library if true</param> /// <param name="expansionlevel">current level of expansions loaded(0=ARR/default,1=Heavensward)</param> public static void LaunchGame(string realsid, int language, bool dx11, bool steam, int expansionlevel) { try { if (steam) { SteamNative.Initialize(); if (SteamApi.IsSteamRunning()) { SteamApi.Initialize(39210); } } Process ffxivgame = new Process(); if (dx11) { ffxivgame.StartInfo.FileName = Settings.GetGamePath() + "/game/ffxiv_dx11.exe"; } else { ffxivgame.StartInfo.FileName = Settings.GetGamePath() + "/game/ffxiv.exe"; } ffxivgame.StartInfo.Arguments = $"DEV.TestSID={realsid} DEV.MaxEntitledExpansionID={expansionlevel} language={language} region=1"; ffxivgame.Start(); if (steam) { SteamApi.Uninitialize(); SteamNative.Uninitialize(); } } catch (Exception exc) { MessageBox.Show("Could not launch executable. Is your game path correct?\n\n" + exc, "Launch failed", MessageBoxButtons.OK); } }