Config: Port WiimoteContinuousScanning setting to new config system.

This commit is contained in:
Admiral H. Curtiss 2022-01-06 05:06:33 +01:00
parent b2da738c81
commit 8c554d2e64
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
5 changed files with 6 additions and 7 deletions

View File

@ -107,6 +107,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::MAIN_TIMING_VARIANCE.GetLocation(), &Config::MAIN_TIMING_VARIANCE.GetLocation(),
&Config::MAIN_WII_SD_CARD.GetLocation(), &Config::MAIN_WII_SD_CARD.GetLocation(),
&Config::MAIN_WII_KEYBOARD.GetLocation(), &Config::MAIN_WII_KEYBOARD.GetLocation(),
&Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING.GetLocation(),
// UI.General // UI.General

View File

@ -111,7 +111,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
{ {
core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]); core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]);
} }
core->Set("WiimoteContinuousScanning", m_WiimoteContinuousScanning);
core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker); core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
core->Set("WiimoteControllerInterface", connect_wiimotes_for_ciface); core->Set("WiimoteControllerInterface", connect_wiimotes_for_ciface);
core->Set("MMU", bMMU); core->Set("MMU", bMMU);
@ -141,7 +140,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i], core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i],
(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE); (i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
} }
core->Get("WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
core->Get("WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, false); core->Get("WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, false);
core->Get("WiimoteControllerInterface", &connect_wiimotes_for_ciface, false); core->Get("WiimoteControllerInterface", &connect_wiimotes_for_ciface, false);
core->Get("MMU", &bMMU, bMMU); core->Get("MMU", &bMMU, bMMU);

View File

@ -50,7 +50,6 @@ struct BootParameters;
struct SConfig struct SConfig
{ {
// Wii Devices // Wii Devices
bool m_WiimoteContinuousScanning;
bool m_WiimoteEnableSpeaker; bool m_WiimoteEnableSpeaker;
bool connect_wiimotes_for_ciface; bool connect_wiimotes_for_ciface;

View File

@ -843,7 +843,7 @@ void Initialize(::Wiimote::InitializeMode init_mode)
s_wiimote_scanner.StartThread(); s_wiimote_scanner.StartThread();
} }
if (SConfig::GetInstance().m_WiimoteContinuousScanning) if (Config::Get(Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING))
s_wiimote_scanner.SetScanMode(WiimoteScanMode::CONTINUOUSLY_SCAN); s_wiimote_scanner.SetScanMode(WiimoteScanMode::CONTINUOUSLY_SCAN);
else else
s_wiimote_scanner.SetScanMode(WiimoteScanMode::DO_NOT_SCAN); s_wiimote_scanner.SetScanMode(WiimoteScanMode::DO_NOT_SCAN);
@ -957,7 +957,7 @@ static void HandleWiimoteDisconnect(int index)
// This is called from the GUI thread // This is called from the GUI thread
void Refresh() void Refresh()
{ {
if (!SConfig::GetInstance().m_WiimoteContinuousScanning) if (!Config::Get(Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING))
s_wiimote_scanner.SetScanMode(WiimoteScanMode::SCAN_ONCE); s_wiimote_scanner.SetScanMode(WiimoteScanMode::SCAN_ONCE);
} }

View File

@ -307,7 +307,7 @@ void WiimoteControllersWidget::LoadSettings()
WiimoteSource::Real); WiimoteSource::Real);
m_wiimote_speaker_data->setChecked(SConfig::GetInstance().m_WiimoteEnableSpeaker); m_wiimote_speaker_data->setChecked(SConfig::GetInstance().m_WiimoteEnableSpeaker);
m_wiimote_ciface->setChecked(SConfig::GetInstance().connect_wiimotes_for_ciface); m_wiimote_ciface->setChecked(SConfig::GetInstance().connect_wiimotes_for_ciface);
m_wiimote_continuous_scanning->setChecked(SConfig::GetInstance().m_WiimoteContinuousScanning); m_wiimote_continuous_scanning->setChecked(Config::Get(Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING));
if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED)) if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
m_wiimote_passthrough->setChecked(true); m_wiimote_passthrough->setChecked(true);
@ -321,7 +321,8 @@ void WiimoteControllersWidget::SaveSettings()
{ {
SConfig::GetInstance().m_WiimoteEnableSpeaker = m_wiimote_speaker_data->isChecked(); SConfig::GetInstance().m_WiimoteEnableSpeaker = m_wiimote_speaker_data->isChecked();
SConfig::GetInstance().connect_wiimotes_for_ciface = m_wiimote_ciface->isChecked(); SConfig::GetInstance().connect_wiimotes_for_ciface = m_wiimote_ciface->isChecked();
SConfig::GetInstance().m_WiimoteContinuousScanning = m_wiimote_continuous_scanning->isChecked(); Config::SetBaseOrCurrent(Config::MAIN_WIIMOTE_CONTINUOUS_SCANNING,
m_wiimote_continuous_scanning->isChecked());
Config::SetBaseOrCurrent(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED, Config::SetBaseOrCurrent(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED,
m_wiimote_passthrough->isChecked()); m_wiimote_passthrough->isChecked());