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

Add an option to opt out of Dalamud's mb collection

This commit is contained in:
Joshua Goins 2022-03-13 19:58:58 -04:00
parent 703f66a8d6
commit 585c549050
5 changed files with 26 additions and 9 deletions

View file

@ -37,7 +37,6 @@ struct ProfileSettings {
bool useEsync = false, useGamescope = false, useGamemode = false;
bool useDX9 = false;
bool enableDXVKhud = false;
bool enableDalamud = false;
struct GamescopeOptions {
bool fullscreen = true;
@ -47,6 +46,11 @@ struct ProfileSettings {
int refreshRate = 0;
} gamescope;
struct DalamudOptions {
bool enabled = false;
bool optOutOfMbCollection = false;
} dalamud;
// login
bool encryptArguments = true;
bool isSapphire = false;

View file

@ -55,6 +55,7 @@ private:
QCheckBox* enableDalamudBox = nullptr;
QLabel* dalamudVersionLabel = nullptr;
QLabel* dalamudAssetVersionLabel = nullptr;
QCheckBox* dalamudOptOutBox = nullptr;
bool currentlyReloadingControls = false;

View file

@ -33,7 +33,7 @@ AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher) {
void AssetUpdater::update(const ProfileSettings& profile) {
// non-dalamud users can bypass this process since it's not needed
if(!profile.enableDalamud) {
if(!profile.dalamud.enabled) {
finishedUpdating();
return;
}

View file

@ -64,7 +64,7 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
QString dataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
if(profile.enableDalamud) {
if(profile.dalamud.enabled) {
arguments.push_back(dataDir + "/NativeLauncher.exe");
}
@ -111,7 +111,7 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
gameProcess->setProcessChannelMode(QProcess::MergedChannels);
if(profile.enableDalamud) {
if(profile.dalamud.enabled) {
connect(gameProcess, &QProcess::readyReadStandardOutput, [this, gameProcess, profile] {
QString output = gameProcess->readAllStandardOutput();
bool success;
@ -135,7 +135,7 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
startInfo["DelayInitializeMs"] = 0;
startInfo["GameVersion"] = profile.gameVersion;
startInfo["Language"] = profile.language;
startInfo["OptOutMbCollection"] = false;
startInfo["OptOutMbCollection"] = profile.dalamud.optOutOfMbCollection;
QString argsEncoded = QJsonDocument(startInfo).toJson().toBase64();
@ -358,7 +358,8 @@ void LauncherCore::readInitialInformation() {
profile.gamescope.height = settings.value("gamescopeHeight", defaultSettings.gamescope.height).toInt();
profile.gamescope.refreshRate = settings.value("gamescopeRefreshRate", defaultSettings.gamescope.refreshRate).toInt();
profile.enableDalamud = settings.value("enableDalamud", defaultSettings.enableDalamud).toBool();
profile.dalamud.enabled = settings.value("enableDalamud", defaultSettings.dalamud.enabled).toBool();
profile.dalamud.optOutOfMbCollection = settings.value("dalamudOptOut", defaultSettings.dalamud.optOutOfMbCollection).toBool();
profileSettings[settings.value("index").toInt()] = profile;
@ -544,7 +545,8 @@ void LauncherCore::saveSettings() {
settings.setValue("rememberPassword", profile.rememberPassword);
settings.setValue("useSteam", profile.useSteam);
settings.setValue("enableDalamud", profile.enableDalamud);
settings.setValue("enableDalamud", profile.dalamud.enabled);
settings.setValue("dalamudOptOut", profile.dalamud.optOutOfMbCollection);
settings.setValue("enableWatchdog", profile.enableWatchdog);
settings.endGroup();

View file

@ -364,12 +364,20 @@ SettingsWindow::SettingsWindow(int defaultTab, LauncherWindow& window, LauncherC
enableDalamudBox = new QCheckBox();
connect(enableDalamudBox, &QCheckBox::stateChanged, [=](int) {
getCurrentProfile().enableDalamud = enableDalamudBox->isChecked();
getCurrentProfile().dalamud.enabled = enableDalamudBox->isChecked();
this->core.saveSettings();
});
dalamudBoxLayout->addRow("Enable Dalamud Injection", enableDalamudBox);
dalamudOptOutBox = new QCheckBox();
connect(dalamudOptOutBox, &QCheckBox::stateChanged, [=](int) {
getCurrentProfile().dalamud.optOutOfMbCollection = dalamudOptOutBox->isChecked();
this->core.saveSettings();
});
dalamudBoxLayout->addRow("Opt Out of Automatic Marketboard Collection", dalamudOptOutBox);
dalamudVersionLabel = new QLabel();
dalamudBoxLayout->addRow("Dalamud Version", dalamudVersionLabel);
@ -476,7 +484,7 @@ void SettingsWindow::reloadControls() {
useSteamBox->setChecked(profile.useSteam);
// dalamud
enableDalamudBox->setChecked(profile.enableDalamud);
enableDalamudBox->setChecked(profile.dalamud.enabled);
if(core.dalamudVersion.isEmpty()) {
dalamudVersionLabel->setText("Dalamud is not installed.");
} else {
@ -489,6 +497,8 @@ void SettingsWindow::reloadControls() {
dalamudAssetVersionLabel->setText(QString::number(core.dalamudAssetVersion));
}
dalamudOptOutBox->setChecked(profile.dalamud.optOutOfMbCollection);
window.reloadControls();
currentlyReloadingControls = false;