diff --git a/launcher/cli/src/cmdinterface.cpp b/launcher/cli/src/cmdinterface.cpp index 993e637..07351f1 100644 --- a/launcher/cli/src/cmdinterface.cpp +++ b/launcher/cli/src/cmdinterface.cpp @@ -59,11 +59,7 @@ bool CMDInterface::parse(QCommandLineParser& parser, LauncherCore& core) { info->username = username; info->password = password; - if (profile.isSapphire) { - core.sapphireLauncher->login(profile.lobbyURL, *info); - } else { - core.squareBoot->bootCheck(*info); - } + core.login(*info); } return true; diff --git a/launcher/core/include/launchercore.h b/launcher/core/include/launchercore.h index 4958a93..62e788b 100755 --- a/launcher/core/include/launchercore.h +++ b/launcher/core/include/launchercore.h @@ -153,6 +153,14 @@ public: int addProfile(); int deleteProfile(QString name); + /* + * Begins the login process, and may call SquareBoot or SapphireLauncher depending on the profile type. + * It's designed to be opaque as possible to the caller. + * + * The login process is asynchronous. + */ + void login(LoginInformation& loginInformation); + /* * Launches the game using the provided authentication. */ diff --git a/launcher/core/src/launchercore.cpp b/launcher/core/src/launchercore.cpp index d125ac5..7b84c6a 100755 --- a/launcher/core/src/launchercore.cpp +++ b/launcher/core/src/launchercore.cpp @@ -723,3 +723,11 @@ void LauncherCore::readGameData(ProfileSettings& profile) { physis_gamedata_free_sheet_header(exh); } } + +void LauncherCore::login(LoginInformation& loginInformation) { + if (loginInformation.settings->isSapphire) { + sapphireLauncher->login(loginInformation.settings->lobbyURL, loginInformation); + } else { + squareBoot->checkGateStatus(&loginInformation); + } +} diff --git a/launcher/desktop/src/autologinwindow.cpp b/launcher/desktop/src/autologinwindow.cpp index 2fc6151..396b1d3 100644 --- a/launcher/desktop/src/autologinwindow.cpp +++ b/launcher/desktop/src/autologinwindow.cpp @@ -93,11 +93,7 @@ AutoLoginWindow::AutoLoginWindow(ProfileSettings& profile, LauncherCore& core, Q free (totp); } - if (profile.isSapphire) { - core.sapphireLauncher->login(profile.lobbyURL, *info); - } else { - core.squareBoot->bootCheck(*info); - } + core.login(*info); close(); autologinTimer->stop(); diff --git a/launcher/desktop/src/launcherwindow.cpp b/launcher/desktop/src/launcherwindow.cpp index c1d8679..4e62bba 100644 --- a/launcher/desktop/src/launcherwindow.cpp +++ b/launcher/desktop/src/launcherwindow.cpp @@ -263,7 +263,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo connect(core.assetUpdater, &AssetUpdater::finishedUpdating, [=] { auto& profile = currentProfile(); - LoginInformation* info = new LoginInformation(); + auto info = new LoginInformation(); info->settings = &profile; info->username = usernameEdit->text(); info->password = passwordEdit->text(); @@ -287,11 +287,7 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo } #endif - if (currentProfile().isSapphire) { - this->core.sapphireLauncher->login(currentProfile().lobbyURL, *info); - } else { - this->core.squareBoot->checkGateStatus(info); - } + this->core.login(*info); }); connect(loginButton, &QPushButton::released, [=] {