BootManager: Simplify SaveConfig

Also std::array-ifies C-array members of ConfigCache
This commit is contained in:
Lioncash 2016-01-26 20:22:43 -05:00
parent 9199539798
commit 0c920f175f
1 changed files with 37 additions and 26 deletions

View File

@ -20,6 +20,8 @@
// Includes // Includes
// ---------------- // ----------------
#include <algorithm>
#include <array>
#include <string> #include <string>
#include <vector> #include <vector>
@ -52,20 +54,40 @@ public:
// restore values to the configuration from the cache // restore values to the configuration from the cache
void RestoreConfig(SConfig* config); void RestoreConfig(SConfig* config);
// these store if the relevant setting should be reset back later (true) or if it should be left alone on restore (false) // These store if the relevant setting should be reset back later (true) or if it should be left alone on restore (false)
bool bSetEmulationSpeed, bSetEXIDevice[MAX_EXI_CHANNELS], bSetVolume, bSetPads[MAX_SI_CHANNELS], bSetWiimoteSource[MAX_BBMOTES], bSetFrameSkip; bool bSetEmulationSpeed;
bool bSetVolume;
bool bSetFrameSkip;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource;
std::array<bool, MAX_SI_CHANNELS> bSetPads;
std::array<bool, MAX_EXI_CHANNELS> bSetEXIDevice;
private: private:
bool valid, bCPUThread, bSkipIdle, bSyncGPUOnSkipIdleHack, bFPRF, bAccurateNaNs, bMMU, bDCBZOFF, m_EnableJIT, bool valid;
bSyncGPU, bFastDiscSpeed, bDSPHLE, bHLE_BS2, bProgressive, bPAL60; bool bCPUThread;
bool bSkipIdle;
bool bSyncGPUOnSkipIdleHack;
bool bFPRF;
bool bAccurateNaNs;
bool bMMU;
bool bDCBZOFF;
bool m_EnableJIT;
bool bSyncGPU;
bool bFastDiscSpeed;
bool bDSPHLE;
bool bHLE_BS2;
bool bProgressive;
bool bPAL60;
int iSelectedLanguage; int iSelectedLanguage;
int iCPUCore, Volume; int iCPUCore;
int iWiimoteSource[MAX_BBMOTES]; int Volume;
SIDevices Pads[MAX_SI_CHANNELS]; std::array<int, MAX_BBMOTES> iWiimoteSource;
std::array<SIDevices, MAX_SI_CHANNELS> Pads;
std::array<TEXIDevices, MAX_EXI_CHANNELS> m_EXIDevice;
unsigned int frameSkip; unsigned int frameSkip;
float m_EmulationSpeed; float m_EmulationSpeed;
TEXIDevices m_EXIDevice[MAX_EXI_CHANNELS]; std::string strBackend;
std::string strBackend, sBackend; std::string sBackend;
std::string m_strGPUDeterminismMode; std::string m_strGPUDeterminismMode;
}; };
@ -91,33 +113,22 @@ void ConfigCache::SaveConfig(const SConfig& config)
iCPUCore = config.iCPUCore; iCPUCore = config.iCPUCore;
Volume = config.m_Volume; Volume = config.m_Volume;
for (unsigned int i = 0; i < MAX_BBMOTES; ++i) std::copy(std::begin(g_wiimote_sources), std::end(g_wiimote_sources), std::begin(iWiimoteSource));
{ std::copy(std::begin(config.m_SIDevice), std::end(config.m_SIDevice), std::begin(Pads));
iWiimoteSource[i] = g_wiimote_sources[i]; std::copy(std::begin(config.m_EXIDevice), std::end(config.m_EXIDevice), std::begin(m_EXIDevice));
}
for (unsigned int i = 0; i < MAX_SI_CHANNELS; ++i)
{
Pads[i] = config.m_SIDevice[i];
}
m_EmulationSpeed = config.m_EmulationSpeed; m_EmulationSpeed = config.m_EmulationSpeed;
frameSkip = config.m_FrameSkip; frameSkip = config.m_FrameSkip;
for (unsigned int i = 0; i < MAX_EXI_CHANNELS; ++i)
{
m_EXIDevice[i] = config.m_EXIDevice[i];
}
strBackend = config.m_strVideoBackend; strBackend = config.m_strVideoBackend;
sBackend = config.sBackend; sBackend = config.sBackend;
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode; m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
bSetEmulationSpeed = false; bSetEmulationSpeed = false;
std::fill_n(bSetEXIDevice, (int)MAX_EXI_CHANNELS, false);
bSetVolume = false; bSetVolume = false;
std::fill_n(bSetPads, (int)MAX_SI_CHANNELS, false); bSetWiimoteSource.fill(false);
std::fill_n(bSetWiimoteSource, (int)MAX_BBMOTES, false); bSetPads.fill(false);
bSetEXIDevice.fill(false);
bSetFrameSkip = false; bSetFrameSkip = false;
} }