Config: Port SI device settings to new config system.

This commit is contained in:
Admiral H. Curtiss 2022-01-06 08:08:02 +01:00
commit 5c325eef38
No known key found for this signature in database
GPG key ID: F051B4C4044F33FB
17 changed files with 114 additions and 66 deletions

View file

@ -66,7 +66,6 @@ public:
// alone on restore (false)
bool bSetVolume = false;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads{};
private:
bool valid = false;
@ -77,7 +76,6 @@ private:
int iSyncGpuMinDistance = 0;
float fSyncGpuOverclock = 0;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
};
void ConfigCache::SaveConfig(const SConfig& config)
@ -94,11 +92,8 @@ void ConfigCache::SaveConfig(const SConfig& config)
for (int i = 0; i != MAX_BBMOTES; ++i)
iWiimoteSource[i] = WiimoteCommon::GetSource(i);
std::copy(std::begin(config.m_SIDevice), std::end(config.m_SIDevice), std::begin(Pads));
bSetVolume = false;
bSetWiimoteSource.fill(false);
bSetPads.fill(false);
}
void ConfigCache::RestoreConfig(SConfig* config)
@ -125,12 +120,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
WiimoteCommon::SetSource(i, iWiimoteSource[i]);
}
}
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
if (bSetPads[i])
config->m_SIDevice[i] = Pads[i];
}
}
static ConfigCache config_cache;
@ -161,17 +150,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{
int source;
controls_section->Get(fmt::format("PadType{}", i), &source, -1);
if (source >= SerialInterface::SIDEVICE_NONE && source < SerialInterface::SIDEVICE_COUNT)
{
StartUp.m_SIDevice[i] = static_cast<SerialInterface::SIDevices>(source);
config_cache.bSetPads[i] = true;
}
}
// Wii settings
if (StartUp.bWii)
{