mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 19:57:45 +00:00
Make Watchdog an optional feature
This commit is contained in:
parent
fbc2a29b67
commit
5afca07f1e
4 changed files with 46 additions and 12 deletions
|
@ -8,6 +8,14 @@ set(CMAKE_CXX_STANDARD 17)
|
|||
|
||||
find_package(Qt5 COMPONENTS Core Widgets Network CONFIG REQUIRED)
|
||||
|
||||
option(ENABLE_WATCHDOG "Build with Tesseract support (needed for Watchdog)" OFF)
|
||||
|
||||
if(ENABLE_WATCHDOG)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_search_module(TESSERACT REQUIRED tesseract)
|
||||
pkg_search_module(LEPTONICA REQUIRED lept)
|
||||
endif()
|
||||
|
||||
add_subdirectory(external)
|
||||
|
||||
set(SRC
|
||||
|
@ -21,21 +29,23 @@ set(SRC
|
|||
src/assetupdater.cpp
|
||||
src/assetupdater.h
|
||||
src/launcherwindow.cpp
|
||||
src/launcherwindow.h
|
||||
src/watchdog.h
|
||||
src/watchdog.cpp)
|
||||
src/launcherwindow.h)
|
||||
|
||||
set(LIBRARIES
|
||||
Qt5::Core Qt5::Widgets Qt5::Network qt5keychain QuaZip)
|
||||
|
||||
if(UNIX)
|
||||
if(ENABLE_WATCHDOG)
|
||||
set(LIBRARIES ${LIBRARIES} ${TESSERACT_LIBRARIES} ${LEPTONICA_LIBRARIES})
|
||||
|
||||
set(SRC ${SRC}
|
||||
src/watchdog.h
|
||||
src/watchdog.cpp
|
||||
src/gameparser.h
|
||||
src/gameparser.cpp)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
set(LIBRARIES ${LIBRARIES}
|
||||
tesseract
|
||||
lept
|
||||
X11
|
||||
Xcomposite
|
||||
Xrender)
|
||||
|
@ -51,6 +61,12 @@ target_include_directories(xivlauncher PRIVATE
|
|||
${CMAKE_BINARY_DIR}/_deps/qtkeychain-build
|
||||
${CMAKE_BINARY_DIR}/_deps/quazip-src)
|
||||
|
||||
if(ENABLE_WATCHDOG)
|
||||
target_include_directories(xivlauncher PRIVATE ${TESSERACT_INCLUDE_DIRS} ${LEPTONICA_INCLUDE_DIRS})
|
||||
|
||||
target_compile_definitions(xivlauncher PRIVATE ENABLE_WATCHDOG)
|
||||
endif()
|
||||
|
||||
install(TARGETS xivlauncher
|
||||
DESTINATION "${INSTALL_BIN_PATH}"
|
||||
)
|
||||
|
|
|
@ -34,7 +34,10 @@
|
|||
#include "settingswindow.h"
|
||||
#include "blowfish.h"
|
||||
#include "assetupdater.h"
|
||||
|
||||
#ifdef ENABLE_WATCHDOG
|
||||
#include "watchdog.h"
|
||||
#endif
|
||||
|
||||
void LauncherCore::setSSL(QNetworkRequest& request) {
|
||||
QSslConfiguration config;
|
||||
|
@ -370,7 +373,10 @@ LauncherCore::LauncherCore() : settings(QSettings::IniFormat, QSettings::UserSco
|
|||
squareLauncher = new SquareLauncher(*this);
|
||||
squareBoot = new SquareBoot(*this, *squareLauncher);
|
||||
assetUpdater = new AssetUpdater(*this);
|
||||
|
||||
#ifdef ENABLE_WATCHDOG
|
||||
watchdog = new Watchdog(*this);
|
||||
#endif
|
||||
|
||||
readInitialInformation();
|
||||
|
||||
|
@ -382,7 +388,9 @@ LauncherCore::LauncherCore() : settings(QSettings::IniFormat, QSettings::UserSco
|
|||
}
|
||||
|
||||
LauncherCore::~LauncherCore() noexcept {
|
||||
#ifdef ENABLE_WATCHDOG
|
||||
delete watchdog;
|
||||
#endif
|
||||
}
|
||||
|
||||
ProfileSettings LauncherCore::getProfile(int index) const {
|
||||
|
|
|
@ -91,7 +91,7 @@ SettingsWindow::SettingsWindow(LauncherWindow& window, LauncherCore& core, QWidg
|
|||
});
|
||||
gameBoxLayout->addWidget(gameDirectoryButton);
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
#ifdef ENABLE_WATCHDOG
|
||||
enableWatchdog = new QCheckBox("Enable Watchdog (X11 only)");
|
||||
gameBoxLayout->addWidget(enableWatchdog);
|
||||
|
||||
|
@ -354,6 +354,9 @@ void SettingsWindow::reloadControls() {
|
|||
useEsync->setChecked(profile.useEsync);
|
||||
useGamescope->setChecked(profile.useGamescope);
|
||||
useGamemode->setChecked(profile.useGamemode);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_WATCHDOG
|
||||
enableWatchdog->setChecked(profile.enableWatchdog);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
#include <QJsonObject>
|
||||
|
||||
#include "launchercore.h"
|
||||
|
||||
#ifdef ENABLE_WATCHDOG
|
||||
#include "watchdog.h"
|
||||
#endif
|
||||
|
||||
SquareLauncher::SquareLauncher(LauncherCore& window) : window(window) {
|
||||
|
||||
|
@ -124,11 +127,15 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
|
|||
if(reply->rawHeaderList().contains("X-Patch-Unique-Id")) {
|
||||
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
|
||||
} else {
|
||||
auto messageBox = new QMessageBox(QMessageBox::Icon::Critical, "Failed to Login", "Failed the anti-tamper check. Please restore your game to the original state or update the game.");
|
||||
window.addUpdateButtons(*info.settings, *messageBox);
|
||||
|
|
Loading…
Add table
Reference in a new issue