Config: Port WiiSDCard setting to new config system.

This commit is contained in:
Admiral H. Curtiss 2022-01-06 04:48:41 +01:00
parent 2aa44b10ba
commit f19cf1753b
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
5 changed files with 9 additions and 12 deletions

View File

@ -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

View File

@ -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);

View File

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

View File

@ -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",

View File

@ -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();