diff --git a/launcher/core/include/launchercore.h b/launcher/core/include/launchercore.h index 6c021e2..4958a93 100755 --- a/launcher/core/include/launchercore.h +++ b/launcher/core/include/launchercore.h @@ -153,7 +153,10 @@ public: int addProfile(); 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); @@ -217,6 +220,7 @@ signals: void gameClosed(); private: + void beginGameExecutable(const ProfileSettings& settings, const LoginAuth& auth); bool checkIfInPath(QString program); void readGameData(ProfileSettings& profile); diff --git a/launcher/core/include/watchdog.h b/launcher/core/include/watchdog.h index 4be4386..1b3aacb 100644 --- a/launcher/core/include/watchdog.h +++ b/launcher/core/include/watchdog.h @@ -15,7 +15,7 @@ class Watchdog : public QObject { public: Watchdog(LauncherCore& core) : core(core), QObject(&core) {} - void launchGame(const ProfileSettings& settings, LoginAuth auth); + void launchGame(const ProfileSettings& settings, const LoginAuth& auth); private: LauncherCore& core; diff --git a/launcher/core/src/launchercore.cpp b/launcher/core/src/launchercore.cpp index 19c49d8..d125ac5 100755 --- a/launcher/core/src/launchercore.cpp +++ b/launcher/core/src/launchercore.cpp @@ -59,7 +59,19 @@ void LauncherCore::buildRequest(const ProfileSettings& settings, QNetworkRequest 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 arguments; QString dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); diff --git a/launcher/core/src/squarelauncher.cpp b/launcher/core/src/squarelauncher.cpp index 590c556..4ad6245 100644 --- a/launcher/core/src/squarelauncher.cpp +++ b/launcher/core/src/squarelauncher.cpp @@ -10,10 +10,6 @@ #include "launchercore.h" -#ifdef ENABLE_WATCHDOG - #include "watchdog.h" -#endif - SquareLauncher::SquareLauncher(LauncherCore& window) : window(window), QObject(&window) {} QString getFileHash(const QString& file) { @@ -201,15 +197,7 @@ void SquareLauncher::registerSession(const LoginInformation& info) { auth.SID = reply->rawHeader("X-Patch-Unique-Id"); -#ifdef ENABLE_WATCHDOG - if (info.settings->enableWatchdog) { - window.watchdog->launchGame(*info.settings, auth); - } else { - window.launchGame(*info.settings, auth); - } -#else - window.launchGame(*info.settings, auth); -#endif + window.launchGame(*info.settings, auth); }); patcher->processPatchList(*window.mgr, body); diff --git a/launcher/core/src/watchdog.cpp b/launcher/core/src/watchdog.cpp index 010fc8d..b039fb1 100644 --- a/launcher/core/src/watchdog.cpp +++ b/launcher/core/src/watchdog.cpp @@ -59,7 +59,7 @@ QImage qimageFromXImage(XImage* xi) { return image; } -void Watchdog::launchGame(const ProfileSettings& settings, LoginAuth auth) { +void Watchdog::launchGame(const ProfileSettings& settings, const LoginAuth& auth) { if (icon == nullptr) { icon = new QSystemTrayIcon(); }