1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 19:57:45 +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,33 +173,20 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
});
}
if(profile.encryptArguments) {
const QString argFormat = profile.encryptArguments ? " /%1 =%2" : "%1=%2";
QString argJoined;
for(auto arg : gameArgs) {
argJoined += QString(" /%1 =%2").arg(arg.key, arg.value);
for(const auto& arg : gameArgs) {
argJoined += argFormat.arg(arg.key, arg.value);
}
auto earg = encryptGameArg(argJoined);
arguments.append(earg);
launchExecutable(profile, gameProcess, arguments);
if(profile.encryptArguments) {
arguments.append(encryptGameArg(argJoined));
} else {
if(profile.enableDalamud) {
// 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));
}
arguments.append(argJoined);
}
launchExecutable(profile, gameProcess, arguments);
}
}
void LauncherCore::launchExecutable(const ProfileSettings& profile, const QStringList args) {