mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 03:37:47 +00:00
Remove the multiple layers of launchExecutable nonsense in core
This commit is contained in:
parent
e1e67847b0
commit
7d9d59d9af
4 changed files with 24 additions and 50 deletions
|
@ -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;
|
||||
|
|
|
@ -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<QString> 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";
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue