From 7d9d59d9afcf5341697b2c60fba24d6e4921b10f Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 5 Sep 2022 16:59:49 -0400 Subject: [PATCH] Remove the multiple layers of launchExecutable nonsense in core --- launcher/core/include/launchercore.h | 14 ------------ launcher/core/src/launchercore.cpp | 29 ------------------------- launcher/core/src/squarelauncher.cpp | 2 -- launcher/desktop/src/launcherwindow.cpp | 29 ++++++++++++++++++++----- 4 files changed, 24 insertions(+), 50 deletions(-) diff --git a/launcher/core/include/launchercore.h b/launcher/core/include/launchercore.h index 851f9fd..e35606a 100755 --- a/launcher/core/include/launchercore.h +++ b/launcher/core/include/launchercore.h @@ -175,13 +175,6 @@ public: */ void launchGame(const ProfileSettings& settings, const LoginAuth& auth); - void launchExecutable(const ProfileSettings& settings, QStringList args); - - /* - * Used for processes that should be wrapped in gamescope, etc. - */ - void launchGameExecutable(const ProfileSettings& settings, QProcess* process, QStringList args); - /* * This just wraps it in wine if needed. */ @@ -192,11 +185,6 @@ public: bool isGame, bool needsRegistrySetup); - /* - * Launches an external tool. Gamescope for example is intentionally excluded. - */ - void launchExternalTool(const ProfileSettings& settings, QStringList args); - void addRegistryKey(const ProfileSettings& settings, QString key, QString value, QString data); void buildRequest(const ProfileSettings& settings, QNetworkRequest& request); @@ -206,8 +194,6 @@ public: void readWineInfo(ProfileSettings& settings); void saveSettings(); - void addUpdateButtons(const ProfileSettings& settings, QMessageBox& messageBox); - QSettings settings; SapphireLauncher* sapphireLauncher; diff --git a/launcher/core/src/launchercore.cpp b/launcher/core/src/launchercore.cpp index 6a1b53c..9c9744f 100755 --- a/launcher/core/src/launchercore.cpp +++ b/launcher/core/src/launchercore.cpp @@ -172,26 +172,6 @@ QString LauncherCore::getGameArgs(const ProfileSettings& profile, const LoginAut return profile.encryptArguments ? encryptGameArg(argJoined) : argJoined; } -void LauncherCore::launchExecutable(const ProfileSettings& profile, const QStringList args) { - auto process = new QProcess(this); - process->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); - launchExecutable(profile, process, args, true, true); -} - -void LauncherCore::launchExternalTool(const ProfileSettings& profile, const QStringList args) { - auto process = new QProcess(this); - process->setProcessEnvironment(QProcessEnvironment::systemEnvironment()); - launchExecutable(profile, process, args, false, true); -} - -void LauncherCore::launchGameExecutable(const ProfileSettings& profile, QProcess* process, const QStringList args) { - QList arguments; - - arguments.append(args); - - launchExecutable(profile, process, arguments, true, true); -} - void LauncherCore::launchExecutable( const ProfileSettings& profile, QProcess* process, @@ -602,15 +582,6 @@ void LauncherCore::saveSettings() { } } -void LauncherCore::addUpdateButtons(const ProfileSettings& settings, QMessageBox& messageBox) { - auto launcherButton = messageBox.addButton("Launch Official Launcher", QMessageBox::NoRole); - connect(launcherButton, &QPushButton::clicked, [&] { - launchExecutable(settings, {settings.gamePath + "/boot/ffxivboot.exe"}); - }); - - messageBox.addButton(QMessageBox::StandardButton::Ok); -} - bool LauncherCore::checkIfInPath(const QString program) { // TODO: also check /usr/local/bin, /bin32 etc (basically read $PATH) const QString directory = "/usr/bin"; diff --git a/launcher/core/src/squarelauncher.cpp b/launcher/core/src/squarelauncher.cpp index 4ad6245..e7c9a79 100644 --- a/launcher/core/src/squarelauncher.cpp +++ b/launcher/core/src/squarelauncher.cpp @@ -135,7 +135,6 @@ void SquareLauncher::login(const LoginInformation& info, const QUrl& referer) { QMessageBox::Icon::Critical, "Failed to Login", "Your game is unplayable. You need to accept the terms of service from the official launcher."); - window.addUpdateButtons(*info.settings, *messageBox); messageBox->show(); @@ -206,7 +205,6 @@ void SquareLauncher::registerSession(const LoginInformation& info) { 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); messageBox->show(); } diff --git a/launcher/desktop/src/launcherwindow.cpp b/launcher/desktop/src/launcherwindow.cpp index 4e62bba..7b24434 100644 --- a/launcher/desktop/src/launcherwindow.cpp +++ b/launcher/desktop/src/launcherwindow.cpp @@ -84,20 +84,34 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo QString finalArg = encryptGameArg(argJoined); - this->core.launchExecutable( - currentProfile(), {currentProfile().gamePath + "/boot/ffxivlauncher64.exe", finalArg}); + auto launcherProcess = new QProcess(); + this->core.launchExecutable(currentProfile(), + launcherProcess, + {currentProfile().gamePath + "/boot/ffxivlauncher64.exe", finalArg}, + false, + true); }); launchSysInfo = toolsMenu->addAction("Open System Info..."); launchSysInfo->setIcon(QIcon::fromTheme("application-x-executable")); connect(launchSysInfo, &QAction::triggered, [=] { - this->core.launchExecutable(currentProfile(), {currentProfile().gamePath + "/boot/ffxivsysinfo64.exe"}); + auto sysinfoProcess = new QProcess(); + this->core.launchExecutable(currentProfile(), + sysinfoProcess, + {currentProfile().gamePath + "/boot/ffxivsysinfo64.exe"}, + false, + false); }); launchCfgBackup = toolsMenu->addAction("Open Config Backup..."); launchCfgBackup->setIcon(QIcon::fromTheme("application-x-executable")); connect(launchCfgBackup, &QAction::triggered, [=] { - this->core.launchExecutable(currentProfile(), {currentProfile().gamePath + "/boot/ffxivconfig64.exe"}); + auto configProcess = new QProcess(); + this->core.launchExecutable(currentProfile(), + configProcess, + {currentProfile().gamePath + "/boot/ffxivconfig64.exe"}, + false, + false); }); toolsMenu->addSeparator(); @@ -167,7 +181,12 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo wineCfg->setMenuRole(QAction::MenuRole::NoRole); wineCfg->setIcon(QIcon::fromTheme("configure")); connect(wineCfg, &QAction::triggered, [=] { - this->core.launchExternalTool(currentProfile(), {"winecfg.exe"}); + auto configProcess = new QProcess(); + this->core.launchExecutable(currentProfile(), + configProcess, + {"winecfg.exe"}, + false, + false); }); #endif