From 9668c0c30e510a347c84a532e8e4a1828835a23b Mon Sep 17 00:00:00 2001 From: redstrate Date: Thu, 2 Dec 2021 14:40:04 -0500 Subject: [PATCH] Add button to use official launcher in certain cases --- src/launchercore.cpp | 9 +++++++++ src/launchercore.h | 3 +++ src/launcherwindow.cpp | 6 +++--- src/squareboot.cpp | 3 +++ src/squarelauncher.cpp | 4 ++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/launchercore.cpp b/src/launchercore.cpp index 33be0c4..8e58ef5 100755 --- a/src/launchercore.cpp +++ b/src/launchercore.cpp @@ -451,4 +451,13 @@ void LauncherCore::saveSettings() { settings.endGroup(); } +} + +void LauncherCore::addUpdateButtons(const ProfileSettings& settings, QMessageBox& messageBox) { + auto launcherButton = messageBox.addButton("Launch Official Launcher", QMessageBox::NoRole); + connect(launcherButton, &QPushButton::clicked, [=] { + launchExecutable(settings, {settings.gamePath + "/boot/ffxivboot64.exe"}); + }); + + messageBox.addButton(QMessageBox::StandardButton::Ok); } \ No newline at end of file diff --git a/src/launchercore.h b/src/launchercore.h index 132360e..e3b3b51 100755 --- a/src/launchercore.h +++ b/src/launchercore.h @@ -6,6 +6,7 @@ #include #include #include +#include class SapphireLauncher; class SquareLauncher; @@ -82,6 +83,8 @@ public: void readWineInfo(ProfileSettings& settings); void saveSettings(); + void addUpdateButtons(const ProfileSettings& settings, QMessageBox& messageBox); + QSettings settings; SapphireLauncher* sapphireLauncher; diff --git a/src/launcherwindow.cpp b/src/launcherwindow.cpp index c7a69dc..1cacc08 100644 --- a/src/launcherwindow.cpp +++ b/src/launcherwindow.cpp @@ -185,15 +185,15 @@ void LauncherWindow::reloadControls() { }); } - const bool isLockedOut = !currentProfile().isSapphire && !core.squareLauncher->isGateOpen; + const bool canLogin = currentProfile().isSapphire || (!currentProfile().isSapphire && core.squareLauncher->isGateOpen); - if(!isLockedOut) { + if(canLogin) { loginButton->setText("Login"); } else { loginButton->setText("Login (Maintenance is in progress)"); } - loginButton->setEnabled(!isLockedOut); + loginButton->setEnabled(canLogin); registerButton->setEnabled(currentProfile().isSapphire); otpEdit->setEnabled(!currentProfile().isSapphire); diff --git a/src/squareboot.cpp b/src/squareboot.cpp index 57a9510..f9a041f 100644 --- a/src/squareboot.cpp +++ b/src/squareboot.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "squarelauncher.h" @@ -31,6 +32,8 @@ void SquareBoot::bootCheck(LoginInformation& info) { launcher.getStored(info); } else { auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Failed to launch. The game may require an update, please use another launcher."); + window.addUpdateButtons(*info.settings, *messageBox); + messageBox->show(); } }); diff --git a/src/squarelauncher.cpp b/src/squarelauncher.cpp index c47b3c1..4d9f031 100644 --- a/src/squarelauncher.cpp +++ b/src/squarelauncher.cpp @@ -84,6 +84,8 @@ void SquareLauncher::login(const LoginInformation& info, const QUrl referer) { if(!terms || !playable) { auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Your game is unplayable. You may need to accept the terms from the official launcher."); + window.addUpdateButtons(*info.settings, *messageBox); + messageBox->show(); } else { SID = parts[1]; @@ -126,6 +128,8 @@ void SquareLauncher::registerSession(const LoginInformation& info) { window.launchGame(*info.settings, 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."); + window.addUpdateButtons(*info.settings, *messageBox); + messageBox->show(); } });