mirror of
https://github.com/redstrate/Astra.git
synced 2025-06-08 15:07:45 +00:00
Don't depend on specific launcher impls to handle launching watchdog
This commit is contained in:
parent
72338db4b9
commit
bf87010aca
5 changed files with 21 additions and 17 deletions
|
@ -153,7 +153,10 @@ public:
|
||||||
int addProfile();
|
int addProfile();
|
||||||
int deleteProfile(QString name);
|
int deleteProfile(QString name);
|
||||||
|
|
||||||
void launchGame(const ProfileSettings& settings, LoginAuth auth);
|
/*
|
||||||
|
* Launches the game using the provided authentication.
|
||||||
|
*/
|
||||||
|
void launchGame(const ProfileSettings& settings, const LoginAuth& auth);
|
||||||
|
|
||||||
void launchExecutable(const ProfileSettings& settings, QStringList args);
|
void launchExecutable(const ProfileSettings& settings, QStringList args);
|
||||||
|
|
||||||
|
@ -217,6 +220,7 @@ signals:
|
||||||
void gameClosed();
|
void gameClosed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void beginGameExecutable(const ProfileSettings& settings, const LoginAuth& auth);
|
||||||
bool checkIfInPath(QString program);
|
bool checkIfInPath(QString program);
|
||||||
void readGameData(ProfileSettings& profile);
|
void readGameData(ProfileSettings& profile);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Watchdog : public QObject {
|
||||||
public:
|
public:
|
||||||
Watchdog(LauncherCore& core) : core(core), QObject(&core) {}
|
Watchdog(LauncherCore& core) : core(core), QObject(&core) {}
|
||||||
|
|
||||||
void launchGame(const ProfileSettings& settings, LoginAuth auth);
|
void launchGame(const ProfileSettings& settings, const LoginAuth& auth);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LauncherCore& core;
|
LauncherCore& core;
|
||||||
|
|
|
@ -59,7 +59,19 @@ void LauncherCore::buildRequest(const ProfileSettings& settings, QNetworkRequest
|
||||||
request.setRawHeader("Accept-Language", "en-us");
|
request.setRawHeader("Accept-Language", "en-us");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth auth) {
|
void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth& auth) {
|
||||||
|
#ifdef ENABLE_WATCHDOG
|
||||||
|
if (info.settings->enableWatchdog) {
|
||||||
|
watchdog->launchGame(profile, auth);
|
||||||
|
} else {
|
||||||
|
beginGameExecutable(profile, auth);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
beginGameExecutable(profile, auth);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void LauncherCore::beginGameExecutable(const ProfileSettings& profile, const LoginAuth& auth) {
|
||||||
QList<QString> arguments;
|
QList<QString> arguments;
|
||||||
|
|
||||||
QString dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
QString dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||||
|
|
|
@ -10,10 +10,6 @@
|
||||||
|
|
||||||
#include "launchercore.h"
|
#include "launchercore.h"
|
||||||
|
|
||||||
#ifdef ENABLE_WATCHDOG
|
|
||||||
#include "watchdog.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SquareLauncher::SquareLauncher(LauncherCore& window) : window(window), QObject(&window) {}
|
SquareLauncher::SquareLauncher(LauncherCore& window) : window(window), QObject(&window) {}
|
||||||
|
|
||||||
QString getFileHash(const QString& file) {
|
QString getFileHash(const QString& file) {
|
||||||
|
@ -201,15 +197,7 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
|
||||||
|
|
||||||
auth.SID = reply->rawHeader("X-Patch-Unique-Id");
|
auth.SID = reply->rawHeader("X-Patch-Unique-Id");
|
||||||
|
|
||||||
#ifdef ENABLE_WATCHDOG
|
window.launchGame(*info.settings, auth);
|
||||||
if (info.settings->enableWatchdog) {
|
|
||||||
window.watchdog->launchGame(*info.settings, auth);
|
|
||||||
} else {
|
|
||||||
window.launchGame(*info.settings, auth);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
window.launchGame(*info.settings, auth);
|
|
||||||
#endif
|
|
||||||
});
|
});
|
||||||
|
|
||||||
patcher->processPatchList(*window.mgr, body);
|
patcher->processPatchList(*window.mgr, body);
|
||||||
|
|
|
@ -59,7 +59,7 @@ QImage qimageFromXImage(XImage* xi) {
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Watchdog::launchGame(const ProfileSettings& settings, LoginAuth auth) {
|
void Watchdog::launchGame(const ProfileSettings& settings, const LoginAuth& auth) {
|
||||||
if (icon == nullptr) {
|
if (icon == nullptr) {
|
||||||
icon = new QSystemTrayIcon();
|
icon = new QSystemTrayIcon();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue