mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +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 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.
|
* This just wraps it in wine if needed.
|
||||||
*/
|
*/
|
||||||
|
@ -192,11 +185,6 @@ public:
|
||||||
bool isGame,
|
bool isGame,
|
||||||
bool needsRegistrySetup);
|
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 addRegistryKey(const ProfileSettings& settings, QString key, QString value, QString data);
|
||||||
|
|
||||||
void buildRequest(const ProfileSettings& settings, QNetworkRequest& request);
|
void buildRequest(const ProfileSettings& settings, QNetworkRequest& request);
|
||||||
|
@ -206,8 +194,6 @@ public:
|
||||||
void readWineInfo(ProfileSettings& settings);
|
void readWineInfo(ProfileSettings& settings);
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
void addUpdateButtons(const ProfileSettings& settings, QMessageBox& messageBox);
|
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
SapphireLauncher* sapphireLauncher;
|
SapphireLauncher* sapphireLauncher;
|
||||||
|
|
|
@ -172,26 +172,6 @@ QString LauncherCore::getGameArgs(const ProfileSettings& profile, const LoginAut
|
||||||
return profile.encryptArguments ? encryptGameArg(argJoined) : argJoined;
|
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(
|
void LauncherCore::launchExecutable(
|
||||||
const ProfileSettings& profile,
|
const ProfileSettings& profile,
|
||||||
QProcess* process,
|
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) {
|
bool LauncherCore::checkIfInPath(const QString program) {
|
||||||
// TODO: also check /usr/local/bin, /bin32 etc (basically read $PATH)
|
// TODO: also check /usr/local/bin, /bin32 etc (basically read $PATH)
|
||||||
const QString directory = "/usr/bin";
|
const QString directory = "/usr/bin";
|
||||||
|
|
|
@ -135,7 +135,6 @@ void SquareLauncher::login(const LoginInformation& info, const QUrl& referer) {
|
||||||
QMessageBox::Icon::Critical,
|
QMessageBox::Icon::Critical,
|
||||||
"Failed to Login",
|
"Failed to Login",
|
||||||
"Your game is unplayable. You need to accept the terms of service from the official launcher.");
|
"Your game is unplayable. You need to accept the terms of service from the official launcher.");
|
||||||
window.addUpdateButtons(*info.settings, *messageBox);
|
|
||||||
|
|
||||||
messageBox->show();
|
messageBox->show();
|
||||||
|
|
||||||
|
@ -206,7 +205,6 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
|
||||||
QMessageBox::Icon::Critical,
|
QMessageBox::Icon::Critical,
|
||||||
"Failed to Login",
|
"Failed to Login",
|
||||||
"Failed the anti-tamper check. Please restore your game to the original state or update the game.");
|
"Failed the anti-tamper check. Please restore your game to the original state or update the game.");
|
||||||
window.addUpdateButtons(*info.settings, *messageBox);
|
|
||||||
|
|
||||||
messageBox->show();
|
messageBox->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,20 +84,34 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
|
|
||||||
QString finalArg = encryptGameArg(argJoined);
|
QString finalArg = encryptGameArg(argJoined);
|
||||||
|
|
||||||
this->core.launchExecutable(
|
auto launcherProcess = new QProcess();
|
||||||
currentProfile(), {currentProfile().gamePath + "/boot/ffxivlauncher64.exe", finalArg});
|
this->core.launchExecutable(currentProfile(),
|
||||||
|
launcherProcess,
|
||||||
|
{currentProfile().gamePath + "/boot/ffxivlauncher64.exe", finalArg},
|
||||||
|
false,
|
||||||
|
true);
|
||||||
});
|
});
|
||||||
|
|
||||||
launchSysInfo = toolsMenu->addAction("Open System Info...");
|
launchSysInfo = toolsMenu->addAction("Open System Info...");
|
||||||
launchSysInfo->setIcon(QIcon::fromTheme("application-x-executable"));
|
launchSysInfo->setIcon(QIcon::fromTheme("application-x-executable"));
|
||||||
connect(launchSysInfo, &QAction::triggered, [=] {
|
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 = toolsMenu->addAction("Open Config Backup...");
|
||||||
launchCfgBackup->setIcon(QIcon::fromTheme("application-x-executable"));
|
launchCfgBackup->setIcon(QIcon::fromTheme("application-x-executable"));
|
||||||
connect(launchCfgBackup, &QAction::triggered, [=] {
|
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();
|
toolsMenu->addSeparator();
|
||||||
|
@ -167,7 +181,12 @@ LauncherWindow::LauncherWindow(LauncherCore& core, QWidget* parent) : QMainWindo
|
||||||
wineCfg->setMenuRole(QAction::MenuRole::NoRole);
|
wineCfg->setMenuRole(QAction::MenuRole::NoRole);
|
||||||
wineCfg->setIcon(QIcon::fromTheme("configure"));
|
wineCfg->setIcon(QIcon::fromTheme("configure"));
|
||||||
connect(wineCfg, &QAction::triggered, [=] {
|
connect(wineCfg, &QAction::triggered, [=] {
|
||||||
this->core.launchExternalTool(currentProfile(), {"winecfg.exe"});
|
auto configProcess = new QProcess();
|
||||||
|
this->core.launchExecutable(currentProfile(),
|
||||||
|
configProcess,
|
||||||
|
{"winecfg.exe"},
|
||||||
|
false,
|
||||||
|
false);
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue