Don't read/store settings directly from/to SYSCONF

Instead of directly reading/storing settings from/to the SYSCONF, we
now store Wii settings to Dolphin's own configuration, and apply them
on boot. This prevents issues with settings not being saved, being
overridden and lost (if the user opens a dialog that writes to the
SYSCONF while a game is running).

This also fixes restoring settings from the config cache after a
graceful shutdown; for some reason, settings were only restored
after a normal shutdown.

Fixes issue 9825 and 9826
This commit is contained in:
Léo Lam
2016-10-07 21:57:07 +02:00
parent 39fd6dcd5b
commit afd2f58e29
17 changed files with 175 additions and 129 deletions

View File

@ -10,7 +10,6 @@
#include "Common/IniFile.h"
#include "Common/NonCopyable.h"
#include "Common/SysConf.h"
#include "Core/HW/EXI_Device.h"
#include "Core/HW/SI_Device.h"
@ -151,6 +150,15 @@ struct SConfig : NonCopyable
int m_bt_passthrough_vid = -1;
std::string m_bt_passthrough_link_keys;
// SYSCONF settings
int m_sensor_bar_position = 0x01;
int m_sensor_bar_sensitivity = 0x03;
int m_speaker_volume = 0x58;
bool m_wiimote_motor = true;
int m_wii_language = 0x01;
int m_wii_aspect_ratio = 0x01;
int m_wii_screensaver = 0x00;
// Fifo Player related settings
bool bLoopFifoReplay = true;
@ -305,14 +313,15 @@ struct SConfig : NonCopyable
bool m_SSLDumpRootCA;
bool m_SSLDumpPeerCert;
SysConf* m_SYSCONF;
// Save settings
void SaveSettings();
// Load settings
void LoadSettings();
void LoadSettingsFromSysconf();
void SaveSettingsToSysconf();
// Return the permanent and somewhat globally used instance of this struct
static SConfig& GetInstance() { return (*m_Instance); }
static void Init();
@ -334,6 +343,7 @@ private:
void SaveNetworkSettings(IniFile& ini);
void SaveAnalyticsSettings(IniFile& ini);
void SaveBluetoothPassthroughSettings(IniFile& ini);
void SaveSysconfSettings(IniFile& ini);
void LoadGeneralSettings(IniFile& ini);
void LoadInterfaceSettings(IniFile& ini);
@ -347,6 +357,7 @@ private:
void LoadNetworkSettings(IniFile& ini);
void LoadAnalyticsSettings(IniFile& ini);
void LoadBluetoothPassthroughSettings(IniFile& ini);
void LoadSysconfSettings(IniFile& ini);
static SConfig* m_Instance;
};