1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 04:07:46 +00:00

Cleaning up my argument mess

This commit is contained in:
Joshua Goins 2022-01-27 11:12:23 -05:00
parent a88f7305d0
commit 0242a77e5e

View file

@ -173,34 +173,21 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
}); });
} }
if(profile.encryptArguments) { const QString argFormat = profile.encryptArguments ? " /%1 =%2" : "%1=%2";
QString argJoined; QString argJoined;
for(auto arg : gameArgs) { for(const auto& arg : gameArgs) {
argJoined += QString(" /%1 =%2").arg(arg.key, arg.value); argJoined += argFormat.arg(arg.key, arg.value);
} }
auto earg = encryptGameArg(argJoined); if(profile.encryptArguments) {
arguments.append(earg); arguments.append(encryptGameArg(argJoined));
launchExecutable(profile, gameProcess, arguments);
} else { } else {
if(profile.enableDalamud) { arguments.append(argJoined);
// nativelauncher requires arg[3] to be the arguments, put inside of a quoted string. if this is encrypted, that's easy but this is not
// TODO: combine with code above (they do the same thing lol)
QString finalArg;
for(auto arg : gameArgs) {
finalArg.append(QString(" %1=%2").arg(arg.key, arg.value));
}
arguments.append(finalArg);
} else {
for(auto arg : gameArgs) {
arguments.append(QString("%1=%2").arg(arg.key, arg.value));
}
} }
launchExecutable(profile, gameProcess, arguments); launchExecutable(profile, gameProcess, arguments);
} }
}
void LauncherCore::launchExecutable(const ProfileSettings& profile, const QStringList args) { void LauncherCore::launchExecutable(const ProfileSettings& profile, const QStringList args) {
auto process = new QProcess(this); auto process = new QProcess(this);