1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 21:07:45 +00:00
astra/launcher/include/squareenixlogin.h
Joshua Goins f99964b2bb Overhaul all the login classes, make the code way clearer
The old pre-async login system (especially SE's) was this weird mess
and it wasn't clear what data was flowing where, etc. Now it's a flat
function with comments and a bit better logging.
2023-10-11 14:13:42 -04:00

57 lines
1.8 KiB
C++

// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <qcorotask.h>
#include "launchercore.h"
#include "patcher.h"
class SquareEnixLogin : public QObject
{
Q_OBJECT
public:
explicit SquareEnixLogin(LauncherCore &window, QObject *parent = nullptr);
/// Begins the login process for official Square Enix servers
/// \param info The required login information
/// \return Arguments used for logging into the game, if successful
QCoro::Task<std::optional<LoginAuth>> login(LoginInformation *info);
private:
/// Checks the gate status to see if the servers are closed for maintenance
/// \return False if the gate is closed, true if open.
QCoro::Task<bool> checkGateStatus();
/// Check for updates to the boot components. Even though we don't use these, it's checked by later login steps.
QCoro::Task<> checkBootUpdates();
using StoredInfo = std::pair<QString, QUrl>;
/// Get the _STORED_ value used in the oauth step
QCoro::Task<std::optional<StoredInfo>> getStoredValue();
/// Logs into the server
/// \return Returns false if the oauth call failed for some reason
QCoro::Task<bool> loginOauth();
/// Registers a new session with the login server and patches the game if necessary
/// \return Returns false if the session registration failed for some reason
QCoro::Task<bool> registerSession();
/// Returns the hashes of the boot components
QCoro::Task<QString> getBootHash();
/// Gets the SHA1 hash of a file
static QString getFileHash(const QString &file);
Patcher *m_patcher = nullptr;
QString m_SID, m_username;
LoginAuth m_auth;
LoginInformation *m_info = nullptr;
LauncherCore &m_launcher;
};