Use override-based setting for online fixes

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2023-08-04 16:00:02 +01:00
parent c37e1fb9f1
commit d48dd7eb6a
No known key found for this signature in database
GPG Key ID: 5E39D70B4C93C38E
6 changed files with 69 additions and 20 deletions

View File

@ -614,6 +614,9 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// Mod loader settings
m_settings->registerSetting("DisableQuiltBeacon", false);
// Legacy settings
m_settings->registerSetting("OnlineFixes", true);
// Native library workarounds
m_settings->registerSetting("UseNativeOpenAL", false);
m_settings->registerSetting("UseNativeGLFW", false);

View File

@ -191,6 +191,10 @@ void MinecraftInstance::loadSpecificSettings()
auto modLoaderSettings = m_settings->registerSetting("OverrideModLoaderSettings", false);
m_settings->registerOverride(global_settings->getSetting("DisableQuiltBeacon"), modLoaderSettings);
// Legacy-related options
auto legacySettings = m_settings->registerSetting("OverrideLegacySettings", true);
m_settings->registerOverride(global_settings->getSetting("OnlineFixes"), legacySettings);
m_settings->set("InstanceType", "OneSix");
}
@ -202,8 +206,6 @@ void MinecraftInstance::loadSpecificSettings()
m_settings->registerSetting("UseAccountForInstance", false);
m_settings->registerSetting("InstanceAccountId", "");
m_settings->registerSetting("OnlineFixes", true);
qDebug() << "Instance-type specific settings were loaded!";
setSpecificSettingsLoaded(true);

View File

@ -103,6 +103,9 @@ void MinecraftPage::applySettings()
// Mod loader settings
s->set("DisableQuiltBeacon", ui->disableQuiltBeaconCheckBox->isChecked());
// Legacy settings
s->set("OnlineFixes", ui->onlineFixes->isChecked());
}
void MinecraftPage::loadSettings()
@ -143,6 +146,8 @@ void MinecraftPage::loadSettings()
ui->quitAfterGameStopCheck->setChecked(s->get("QuitAfterGameStop").toBool());
ui->disableQuiltBeaconCheckBox->setChecked(s->get("DisableQuiltBeacon").toBool());
ui->onlineFixes->setChecked(s->get("OnlineFixes").toBool());
}
void MinecraftPage::retranslate()

View File

@ -198,11 +198,30 @@
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QCheckBox" name="disableQuiltBeaconCheckBox">
<property name="toolTip">
<string>Disable Quilt loader's beacon for counting monthly active users</string>
</property>
<property name="text">
<string>Disable Quilt Loader Beacon</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="legacySettingsGroupBox">
<property name="title">
<string>Legacy settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="onlineFixes">
<property name="toolTip">
<string>Disable Quilt loader's beacon for counting monthly active users</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Emulates usages of old online services which are no longer operating.&lt;/p&gt;&lt;p&gt;This currently allows modern skins to be used.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable online fixes</string>
</property>
</widget>
</item>

View File

@ -290,8 +290,13 @@ void InstanceSettingsPage::applySettings()
m_settings->reset("DisableQuiltBeacon");
}
bool onlineFixes = ui->onlineFixes->isChecked();
m_settings->set("OnlineFixes", onlineFixes);
bool overrideLegacySettings = ui->legacySettingsGroupBox->isChecked();
m_settings->set("OverrideLegacySettings", overrideLegacySettings);
if (overrideLegacySettings) {
m_settings->set("OnlineFixes", ui->onlineFixes->isChecked());
} else {
m_settings->reset("OnlineFixes");
}
// FIXME: This should probably be called by a signal instead
m_instance->updateRuntimeContext();
@ -398,8 +403,8 @@ void InstanceSettingsPage::loadSettings()
ui->modLoaderSettingsGroupBox->setChecked(m_settings->get("OverrideModLoaderSettings").toBool());
ui->disableQuiltBeaconCheckBox->setChecked(m_settings->get("DisableQuiltBeacon").toBool());
ui->legacySettingsGroupBox->setChecked(m_settings->get("OverrideLegacySettings").toBool());
ui->onlineFixes->setChecked(m_settings->get("OnlineFixes").toBool());
ui->onlineFixes->setVisible(m_instance->traits().contains("legacyServices"));
}
void InstanceSettingsPage::on_javaDetectBtn_clicked()

View File

@ -543,23 +543,48 @@
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QGroupBox" name="modLoaderSettingsGroupBox">
<property name="title">
<string>Mod loader settings</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="title">
<string>Mod loader settings</string>
</property>
<layout class="QVBoxLayout" name="VerticalLayout_16">
<item>
<widget class="QCheckBox" name="disableQuiltBeaconCheckBox">
<property name="toolTip">
<string>Disable Quilt loader's beacon for counting monthly active users</string>
</property>
<property name="text">
<string>Disable Quilt Loader Beacon</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="legacySettingsGroupBox">
<property name="title">
<string>Legacy settings</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
<item>
<widget class="QCheckBox" name="onlineFixes">
<property name="toolTip">
<string>Disable Quilt loader's beacon for counting monthly active users</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Emulates usages of old online services which are no longer operating.&lt;/p&gt;&lt;p&gt;This currently allows modern skins to be used.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable online fixes</string>
</property>
</widget>
</item>
@ -668,16 +693,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="onlineFixes">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Fixes usages of old online services which are no longer operating by emulating them or redirecting to their modern counterparts.&lt;/p&gt;&lt;p&gt;This currently only allows modern skins to be used.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Enable online fixes</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacerMiscellaneous">
<property name="orientation">