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

Allow updating even if the worlds are closed

This allows updating in expansion maintenance periods. Also adds more
documentation in squareenixlogin.cpp::login.
This commit is contained in:
Joshua Goins 2024-06-26 23:43:41 -04:00
parent f543dd433e
commit fe5fa786d7

View file

@ -31,29 +31,37 @@ QCoro::Task<std::optional<LoginAuth>> SquareEnixLogin::login(LoginInformation *i
Q_ASSERT(info != nullptr); Q_ASSERT(info != nullptr);
m_info = info; m_info = info;
if (!co_await checkGateStatus()) { // First, let's check for boot updates. While not technically required for us, it's needed for later hash checking.
co_return std::nullopt; // It's also a really good idea anyway, in case the official launcher is needed.
}
// There seems to be a limitation in their boot patching system.
// Their server can only give one patch a time, so the boot process must keep trying to patch until
// there is no patches left.
while (m_lastRunHasPatched) { while (m_lastRunHasPatched) {
// There seems to be a limitation in their boot patching system.
// Their server can only give one patch a time, so the boot process must keep trying to patch until
// there is no patches left.
co_await checkBootUpdates(); co_await checkBootUpdates();
} }
// Then check if we can even login.
if (!co_await checkLoginStatus()) { if (!co_await checkLoginStatus()) {
co_return std::nullopt; co_return std::nullopt;
} }
// Login with through the oauth API. This gives us some information like a temporary SID, region and expansion information
if (!co_await loginOAuth()) { if (!co_await loginOAuth()) {
co_return std::nullopt; co_return std::nullopt;
} }
// Register the session with the server. This method also updates the game as necessary.
if (!co_await registerSession()) { if (!co_await registerSession()) {
co_return std::nullopt; co_return std::nullopt;
} }
// Finally, double check the *world* status to make sure we don't try to log in during maintenance.
// Doing it late here ensures we handle cases where the patch is available during maintenance (like during expansion launches)
// but stops before trying to log in when you're not supposed to.
if (!co_await checkGateStatus()) {
co_return std::nullopt;
}
co_return m_auth; co_return m_auth;
} }