diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp index 0171a3c93b..e82958fbff 100644 --- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -105,6 +105,7 @@ bool IsSettingSaveable(const Config::Location& config_location) &Config::MAIN_SYNC_ON_SKIP_IDLE.GetLocation(), &Config::MAIN_FASTMEM.GetLocation(), &Config::MAIN_TIMING_VARIANCE.GetLocation(), + &Config::MAIN_WII_SD_CARD.GetLocation(), // UI.General diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 04e55612c7..a201a967b8 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -111,7 +111,6 @@ void SConfig::SaveCoreSettings(IniFile& ini) { core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]); } - core->Set("WiiSDCard", m_WiiSDCard); core->Set("WiiKeyboard", m_WiiKeyboard); core->Set("WiimoteContinuousScanning", m_WiimoteContinuousScanning); core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker); @@ -143,7 +142,6 @@ void SConfig::LoadCoreSettings(IniFile& ini) core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i], (i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE); } - core->Get("WiiSDCard", &m_WiiSDCard, true); core->Get("WiiKeyboard", &m_WiiKeyboard, false); core->Get("WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false); core->Get("WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, false); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index fac71c4020..be4d4fb31a 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -50,7 +50,6 @@ struct BootParameters; struct SConfig { // Wii Devices - bool m_WiiSDCard; bool m_WiiKeyboard; bool m_WiimoteContinuousScanning; bool m_WiimoteEnableSpeaker; diff --git a/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp b/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp index 3355996ff9..c6dcab44e5 100644 --- a/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp +++ b/Source/Core/Core/IOS/SDIO/SDIOSlot0.cpp @@ -16,7 +16,6 @@ #include "Common/SDCardUtil.h" #include "Core/Config/MainSettings.h" #include "Core/Config/SessionSettings.h" -#include "Core/ConfigManager.h" #include "Core/HW/Memmap.h" #include "Core/IOS/IOS.h" #include "Core/IOS/VersionInfo.h" @@ -49,10 +48,10 @@ void SDIOSlot0Device::EventNotify() { if (!m_event) return; - // Accessing SConfig variables like this isn't really threadsafe, - // but this is how it's done all over the place... - if ((SConfig::GetInstance().m_WiiSDCard && m_event->type == EVENT_INSERT) || - (!SConfig::GetInstance().m_WiiSDCard && m_event->type == EVENT_REMOVE)) + + const bool sd_card_inserted = Config::Get(Config::MAIN_WII_SD_CARD); + if ((sd_card_inserted && m_event->type == EVENT_INSERT) || + (!sd_card_inserted && m_event->type == EVENT_REMOVE)) { m_ios.EnqueueIPCReply(m_event->request, m_event->type); m_event.reset(); @@ -440,8 +439,8 @@ IPCReply SDIOSlot0Device::GetStatus(const IOCtlRequest& request) // Evaluate whether a card is currently inserted (config value). // Make sure we don't modify m_status so we don't lose track of whether the card is SDHC. - const u32 status = - SConfig::GetInstance().m_WiiSDCard ? (m_status | CARD_INSERTED) : CARD_NOT_EXIST; + const bool sd_card_inserted = Config::Get(Config::MAIN_WII_SD_CARD); + const u32 status = sd_card_inserted ? (m_status | CARD_INSERTED) : CARD_NOT_EXIST; INFO_LOG_FMT(IOS_SD, "IOCTL_GETSTATUS. Replying that {} card is {}{}", (status & CARD_SDHC) ? "SDHC" : "SD", diff --git a/Source/Core/DolphinQt/Settings.cpp b/Source/Core/DolphinQt/Settings.cpp index 44bcd581b1..1fb1d27ae9 100644 --- a/Source/Core/DolphinQt/Settings.cpp +++ b/Source/Core/DolphinQt/Settings.cpp @@ -696,14 +696,14 @@ void Settings::SetBatchModeEnabled(bool batch) bool Settings::IsSDCardInserted() const { - return SConfig::GetInstance().m_WiiSDCard; + return Config::Get(Config::MAIN_WII_SD_CARD); } void Settings::SetSDCardInserted(bool inserted) { if (IsSDCardInserted() != inserted) { - SConfig::GetInstance().m_WiiSDCard = inserted; + Config::SetBaseOrCurrent(Config::MAIN_WII_SD_CARD, inserted); emit SDCardInsertionChanged(inserted); auto* ios = IOS::HLE::GetIOS();