1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Add option to launch official client

This commit is contained in:
redstrate 2021-11-02 08:36:30 -04:00
parent 07fff42a00
commit ad294867ca
4 changed files with 37 additions and 21 deletions

View file

@ -33,7 +33,7 @@ void SapphireLauncher::login(QString lobbyUrl, const LoginInformation& info) {
auth.frontierHost = document["frontierHost"].toString();
auth.region = 3;
window.launch(auth);
window.launchGame(auth);
} else {
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Invalid username/password.");
messageBox->show();
@ -64,6 +64,6 @@ void SapphireLauncher::registerAccount(QString lobbyUrl, const LoginInformation&
auth.frontierHost = document["frontierHost"].toString();
auth.region = 3;
window.launch(auth);
window.launchGame(auth);
});
}

View file

@ -121,7 +121,7 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
if(reply->rawHeaderList().contains("X-Patch-Unique-Id")) {
auth.SID = reply->rawHeader("X-Patch-Unique-Id");
window.launch(auth);
window.launchGame(auth);
} else {
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Failed the anti-tamper check. Please restore your game to the original state or update the game.");
messageBox->show();

View file

@ -39,7 +39,30 @@ void LauncherWindow::buildRequest(QNetworkRequest& request) {
request.setRawHeader("Accept-Language", "en-us");
}
void LauncherWindow::launch(const LoginAuth auth) {
void LauncherWindow::launchGame(const LoginAuth auth) {
QList<QString> arguments;
// now for the actual game...
arguments.push_back(gamePath + "\\game\\ffxiv_dx11.exe");
arguments.push_back("DEV.DataPathType=1");
arguments.push_back("DEV.UseSqPack=1");
arguments.push_back(QString("DEV.MaxEntitledExpansionID=%1").arg(auth.maxExpansion));
arguments.push_back(QString("DEV.TestSID=%1").arg(auth.SID));
arguments.push_back(QString("SYS.Region=%1").arg(auth.region));
arguments.push_back(QString("language=%1").arg(language));
arguments.push_back(QString("ver=%1").arg(gameVersion));
if(!auth.lobbyhost.isEmpty()) {
arguments.push_back(QString("DEV.GMServerHost=%1").arg(auth.frontierHost));
for(int i = 1; i < 9; i++)
arguments.push_back(QString("DEV.LobbyHost0%1=%2 DEV.LobbyPort0%1=54994").arg(QString::number(i), auth.lobbyhost));
}
launchExecutable(arguments);
}
void LauncherWindow::launchExecutable(const QStringList args) {
auto process = new QProcess(this);
process->setProcessChannelMode(QProcess::ForwardedChannels);
process->setWorkingDirectory(gamePath + "/game/");
@ -73,22 +96,7 @@ void LauncherWindow::launch(const LoginAuth auth) {
process->setEnvironment(env);
#endif
// now for the actual game...
arguments.push_back(gamePath + "\\game\\ffxiv_dx11.exe");
arguments.push_back("DEV.DataPathType=1");
arguments.push_back("DEV.UseSqPack=1");
arguments.push_back(QString("DEV.MaxEntitledExpansionID=%1").arg(auth.maxExpansion));
arguments.push_back(QString("DEV.TestSID=%1").arg(auth.SID));
arguments.push_back(QString("SYS.Region=%1").arg(auth.region));
arguments.push_back(QString("language=%1").arg(language));
arguments.push_back(QString("ver=%1").arg(gameVersion));
if(!auth.lobbyhost.isEmpty()) {
arguments.push_back(QString("DEV.GMServerHost=%1").arg(auth.frontierHost));
for(int i = 1; i < 9; i++)
arguments.push_back(QString("DEV.LobbyHost0%1=%2 DEV.LobbyPort0%1=54994").arg(QString::number(i), auth.lobbyhost));
}
arguments.append(args);
auto executable = arguments[0];
arguments.removeFirst();
@ -142,6 +150,13 @@ LauncherWindow::LauncherWindow(QWidget* parent) :
window->show();
});
QMenu* toolsMenu = menuBar()->addMenu("Tools");
QAction* launchOfficial = toolsMenu->addAction("Launch Official Client...");
connect(launchOfficial, &QAction::triggered, [=] {
launchExecutable({gamePath + "/boot/ffxivboot64.exe"});
});
const auto savedServerType = settings.value("serverType", 0).toInt();
const auto savedLobbyURL = settings.value("lobbyURL", "127.0.0.1").toString();
const auto shouldRememberUsername = settings.value("rememberUsername", false).toBool();

View file

@ -37,7 +37,8 @@ public:
bool useEsync, useGamescope, useGamemode;
void launch(const LoginAuth auth);
void launchGame(const LoginAuth auth);
void launchExecutable(const QStringList args);
void buildRequest(QNetworkRequest& request);
void setSSL(QNetworkRequest& request);
QString readVersion(QString path);