Config: Port remaining Core settings to new config system (partial).

This commit is contained in:
Admiral H. Curtiss
2022-01-03 07:07:32 +01:00
parent 953eb49cd8
commit e08171fa24
32 changed files with 131 additions and 197 deletions

View File

@ -174,7 +174,6 @@ void AdvancedPane::ConnectLayout()
{
connect(m_cpu_emulation_engine_combobox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [](int index) {
SConfig::GetInstance().cpu_core = PowerPC::AvailableCPUCores()[index];
Config::SetBaseOrCurrent(Config::MAIN_CPU_CORE, PowerPC::AvailableCPUCores()[index]);
});
@ -212,17 +211,18 @@ void AdvancedPane::ConnectLayout()
Update();
});
m_custom_rtc_checkbox->setChecked(SConfig::GetInstance().bEnableCustomRTC);
m_custom_rtc_checkbox->setChecked(Config::Get(Config::MAIN_CUSTOM_RTC_ENABLE));
connect(m_custom_rtc_checkbox, &QCheckBox::toggled, [this](bool enable_custom_rtc) {
SConfig::GetInstance().bEnableCustomRTC = enable_custom_rtc;
Config::SetBaseOrCurrent(Config::MAIN_CUSTOM_RTC_ENABLE, enable_custom_rtc);
Update();
});
QDateTime initial_date_time;
initial_date_time.setSecsSinceEpoch(SConfig::GetInstance().m_customRTCValue);
initial_date_time.setSecsSinceEpoch(Config::Get(Config::MAIN_CUSTOM_RTC_VALUE));
m_custom_rtc_datetime->setDateTime(initial_date_time);
connect(m_custom_rtc_datetime, &QDateTimeEdit::dateTimeChanged, [this](QDateTime date_time) {
SConfig::GetInstance().m_customRTCValue = static_cast<u32>(date_time.toSecsSinceEpoch());
Config::SetBaseOrCurrent(Config::MAIN_CUSTOM_RTC_VALUE,
static_cast<u32>(date_time.toSecsSinceEpoch()));
Update();
});
}
@ -232,12 +232,13 @@ void AdvancedPane::Update()
const bool running = Core::GetState() != Core::State::Uninitialized;
const bool enable_cpu_clock_override_widgets = Config::Get(Config::MAIN_OVERCLOCK_ENABLE);
const bool enable_ram_override_widgets = Config::Get(Config::MAIN_RAM_OVERRIDE_ENABLE);
const bool enable_custom_rtc_widgets = SConfig::GetInstance().bEnableCustomRTC && !running;
const bool enable_custom_rtc_widgets = Config::Get(Config::MAIN_CUSTOM_RTC_ENABLE) && !running;
const std::vector<PowerPC::CPUCore>& available_cpu_cores = PowerPC::AvailableCPUCores();
const auto cpu_core = Config::Get(Config::MAIN_CPU_CORE);
for (size_t i = 0; i < available_cpu_cores.size(); ++i)
{
if (available_cpu_cores[i] == SConfig::GetInstance().cpu_core)
if (available_cpu_cores[i] == cpu_core)
m_cpu_emulation_engine_combobox->setCurrentIndex(int(i));
}
m_cpu_emulation_engine_combobox->setEnabled(!running);

View File

@ -13,7 +13,7 @@
#include <QVBoxLayout>
#include "Common/StringUtil.h"
#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h"
BroadbandAdapterSettingsDialog::BroadbandAdapterSettingsDialog(QWidget* parent, Type bba_type)
@ -38,7 +38,7 @@ void BroadbandAdapterSettingsDialog::InitControls()
// interface (physical) like a serial number. "MAC" should be kept in translations.
address_label = new QLabel(tr("Enter new Broadband Adapter MAC address:"));
address_placeholder = QString::fromStdString("aa:bb:cc:dd:ee:ff");
current_address = QString::fromStdString(SConfig::GetInstance().m_bba_mac);
current_address = QString::fromStdString(Config::Get(Config::MAIN_BBA_MAC));
description = new QLabel(tr("For setup instructions, <a "
"href=\"https://wiki.dolphin-emu.org/"
"index.php?title=Broadband_Adapter\">refer to this page</a>."));
@ -51,7 +51,7 @@ void BroadbandAdapterSettingsDialog::InitControls()
case Type::XLinkKai:
address_label = new QLabel(tr("Enter IP address of device running the XLink Kai Client:"));
address_placeholder = QString::fromStdString("127.0.0.1");
current_address = QString::fromStdString(SConfig::GetInstance().m_bba_xlink_ip);
current_address = QString::fromStdString(Config::Get(Config::MAIN_BBA_XLINK_IP));
description =
new QLabel(tr("For setup instructions, <a "
"href=\"https://www.teamxlink.co.uk/wiki/Dolphin\">refer to this page</a>."));
@ -100,11 +100,11 @@ void BroadbandAdapterSettingsDialog::SaveAddress()
tr("The entered MAC address is invalid."));
return;
}
SConfig::GetInstance().m_bba_mac = bba_new_address;
Config::SetBaseOrCurrent(Config::MAIN_BBA_MAC, bba_new_address);
break;
case Type::XLinkKai:
SConfig::GetInstance().m_bba_xlink_ip = bba_new_address;
Config::SetBaseOrCurrent(Config::MAIN_BBA_XLINK_IP, bba_new_address);
break;
}

View File

@ -349,9 +349,10 @@ void GameCubePane::OnConfigPressed(int slot)
}
else
{
path_old = QFileInfo(QString::fromStdString(slot == 0 ? SConfig::GetInstance().m_strGbaCartA :
SConfig::GetInstance().m_strGbaCartB))
.absoluteFilePath();
path_old =
QFileInfo(QString::fromStdString(slot == 0 ? Config::Get(Config::MAIN_AGP_CART_A_PATH) :
Config::Get(Config::MAIN_AGP_CART_B_PATH)))
.absoluteFilePath();
}
if (memcard)
@ -369,11 +370,11 @@ void GameCubePane::OnConfigPressed(int slot)
{
if (slot == SLOT_A_INDEX)
{
SConfig::GetInstance().m_strGbaCartA = path_abs.toStdString();
Config::SetBase(Config::MAIN_AGP_CART_A_PATH, path_abs.toStdString());
}
else
{
SConfig::GetInstance().m_strGbaCartB = path_abs.toStdString();
Config::SetBase(Config::MAIN_AGP_CART_B_PATH, path_abs.toStdString());
}
}
@ -432,11 +433,10 @@ void GameCubePane::BrowseGBASaves()
void GameCubePane::LoadSettings()
{
const SConfig& params = SConfig::GetInstance();
// IPL Settings
m_skip_main_menu->setChecked(params.bHLE_BS2);
m_language_combo->setCurrentIndex(m_language_combo->findData(params.SelectedLanguage));
m_skip_main_menu->setChecked(Config::Get(Config::MAIN_SKIP_IPL));
m_language_combo->setCurrentIndex(
m_language_combo->findData(Config::Get(Config::MAIN_GC_LANGUAGE)));
bool have_menu = false;
@ -478,12 +478,8 @@ void GameCubePane::SaveSettings()
{
Config::ConfigChangeCallbackGuard config_guard;
SConfig& params = SConfig::GetInstance();
// IPL Settings
params.bHLE_BS2 = m_skip_main_menu->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_SKIP_IPL, m_skip_main_menu->isChecked());
params.SelectedLanguage = m_language_combo->currentData().toInt();
Config::SetBaseOrCurrent(Config::MAIN_GC_LANGUAGE, m_language_combo->currentData().toInt());
// Device Settings

View File

@ -254,7 +254,8 @@ void GeneralPane::LoadConfig()
#endif
m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread);
m_checkbox_cheats->setChecked(Settings::Instance().GetCheatsEnabled());
m_checkbox_override_region_settings->setChecked(SConfig::GetInstance().bOverrideRegionSettings);
m_checkbox_override_region_settings->setChecked(
Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS));
m_checkbox_auto_disc_change->setChecked(Config::Get(Config::MAIN_AUTO_DISC_CHANGE));
#ifdef USE_DISCORD_PRESENCE
m_checkbox_discord_presence->setChecked(Config::Get(Config::MAIN_USE_DISCORD_PRESENCE));
@ -348,7 +349,6 @@ void GeneralPane::OnSaveConfig()
settings.bCPUThread = m_checkbox_dualcore->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked());
Settings::Instance().SetCheatsEnabled(m_checkbox_cheats->isChecked());
settings.bOverrideRegionSettings = m_checkbox_override_region_settings->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_REGION_SETTINGS,
m_checkbox_override_region_settings->isChecked());
Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked());