Merge pull request #4319 from leoetlino/sysconf

Don't read/store settings directly from/to SYSCONF (and fix config restore)
This commit is contained in:
shuffle2 2016-10-09 02:34:52 -07:00 committed by GitHub
commit c8cb1fa7d7
32 changed files with 191 additions and 129 deletions

View file

@ -9,6 +9,7 @@
#include "AudioCommon/OpenALStream.h" #include "AudioCommon/OpenALStream.h"
#include "AudioCommon/aldlist.h" #include "AudioCommon/aldlist.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"

View file

@ -7,6 +7,7 @@
#include "AudioCommon/WaveFile.h" #include "AudioCommon/WaveFile.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
constexpr size_t WaveFileWriter::BUFFER_SIZE; constexpr size_t WaveFileWriter::BUFFER_SIZE;

View file

@ -31,6 +31,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/Logging/LogManager.h" #include "Common/Logging/LogManager.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ARDecrypt.h" #include "Core/ARDecrypt.h"

View file

@ -10,6 +10,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"

View file

@ -26,7 +26,8 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/SysConf.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Core/BootManager.h" #include "Core/BootManager.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
@ -35,7 +36,6 @@
#include "Core/HW/Sram.h" #include "Core/HW/Sram.h"
#include "Core/HW/WiimoteReal/WiimoteReal.h" #include "Core/HW/WiimoteReal/WiimoteReal.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
#include "Core/Movie.h" #include "Core/Movie.h"
#include "Core/NetPlayProto.h" #include "Core/NetPlayProto.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
@ -149,9 +149,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
config->SelectedLanguage = iSelectedLanguage; config->SelectedLanguage = iSelectedLanguage;
config->iCPUCore = iCPUCore; config->iCPUCore = iCPUCore;
config->m_SYSCONF->SetData("IPL.PGS", bProgressive);
config->m_SYSCONF->SetData("IPL.E60", bPAL60);
// Only change these back if they were actually set by game ini, since they can be changed while a // Only change these back if they were actually set by game ini, since they can be changed while a
// game is running. // game is running.
if (bSetVolume) if (bSetVolume)
@ -279,9 +276,6 @@ bool BootCore(const std::string& _rFilename)
// Wii settings // Wii settings
if (StartUp.bWii) if (StartUp.bWii)
{ {
// Flush possible changes to SYSCONF to file
SConfig::GetInstance().m_SYSCONF->Save();
int source; int source;
for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
{ {
@ -370,19 +364,8 @@ bool BootCore(const std::string& _rFilename)
StartUp.bPAL60 = false; StartUp.bPAL60 = false;
} }
SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", StartUp.bProgressive);
SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", StartUp.bPAL60);
if (StartUp.bWii) if (StartUp.bWii)
{ SConfig::GetInstance().SaveSettingsToSysconf();
// Disable WiiConnect24's standby mode. If it is enabled, it prevents us from receiving
// shutdown commands in the State Transition Manager (STM).
// TODO: remove this if and once Dolphin supports WC24 standby mode.
SConfig::GetInstance().m_SYSCONF->SetData<u8>("IPL.IDL", 0x00);
NOTICE_LOG(BOOT, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown");
RestoreBTInfoSection();
}
// Run the game // Run the game
// Init the core // Init the core
@ -398,10 +381,14 @@ bool BootCore(const std::string& _rFilename)
void Stop() void Stop()
{ {
Core::Stop(); Core::Stop();
RestoreConfig();
}
SConfig& StartUp = SConfig::GetInstance(); void RestoreConfig()
StartUp.m_strUniqueID = "00000000"; {
config_cache.RestoreConfig(&StartUp); SConfig::GetInstance().LoadSettingsFromSysconf();
SConfig::GetInstance().m_strUniqueID = "00000000";
config_cache.RestoreConfig(&SConfig::GetInstance());
} }
} // namespace } // namespace

View file

@ -10,5 +10,9 @@ namespace BootManager
{ {
bool BootCore(const std::string& _rFilename); bool BootCore(const std::string& _rFilename);
// Stop the emulation core and restore the configuration.
void Stop(); void Stop();
// Synchronise Dolphin's configuration with the SYSCONF (which may have changed during emulation),
// and restore settings that were overriden by per-game INIs or for some other reason.
void RestoreConfig();
} }

View file

@ -10,7 +10,10 @@
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/SysConf.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/Boot/Boot_DOL.h" #include "Core/Boot/Boot_DOL.h"
@ -18,6 +21,7 @@
#include "Core/Core.h" // for bWii #include "Core/Core.h" // for bWii
#include "Core/FifoPlayer/FifoDataFile.h" #include "Core/FifoPlayer/FifoDataFile.h"
#include "Core/HW/SI.h" #include "Core/HW/SI.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
@ -25,6 +29,39 @@
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
// Change from IPL.LNG value to IPL.SADR country code.
// http://wiibrew.org/wiki/Country_Codes
static u8 GetSADRCountryCode(DiscIO::Language language)
{
switch (language)
{
case DiscIO::Language::LANGUAGE_JAPANESE:
return 1; // Japan
case DiscIO::Language::LANGUAGE_ENGLISH:
return 49; // USA
case DiscIO::Language::LANGUAGE_GERMAN:
return 78; // Germany
case DiscIO::Language::LANGUAGE_FRENCH:
return 77; // France
case DiscIO::Language::LANGUAGE_SPANISH:
return 105; // Spain
case DiscIO::Language::LANGUAGE_ITALIAN:
return 83; // Italy
case DiscIO::Language::LANGUAGE_DUTCH:
return 94; // Netherlands
case DiscIO::Language::LANGUAGE_SIMPLIFIED_CHINESE:
case DiscIO::Language::LANGUAGE_TRADITIONAL_CHINESE:
return 157; // China
case DiscIO::Language::LANGUAGE_KOREAN:
return 136; // Korea
case DiscIO::Language::LANGUAGE_UNKNOWN:
break;
}
PanicAlert("Invalid language. Defaulting to Japanese.");
return 1;
}
SConfig* SConfig::m_Instance; SConfig* SConfig::m_Instance;
SConfig::SConfig() SConfig::SConfig()
@ -32,6 +69,7 @@ SConfig::SConfig()
LoadDefaults(); LoadDefaults();
// Make sure we have log manager // Make sure we have log manager
LoadSettings(); LoadSettings();
LoadSettingsFromSysconf();
} }
void SConfig::Init() void SConfig::Init()
@ -48,7 +86,6 @@ void SConfig::Shutdown()
SConfig::~SConfig() SConfig::~SConfig()
{ {
SaveSettings(); SaveSettings();
delete m_SYSCONF;
} }
void SConfig::SaveSettings() void SConfig::SaveSettings()
@ -56,7 +93,6 @@ void SConfig::SaveSettings()
NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
IniFile ini; IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
m_SYSCONF->Reload();
SaveGeneralSettings(ini); SaveGeneralSettings(ini);
SaveInterfaceSettings(ini); SaveInterfaceSettings(ini);
@ -70,9 +106,9 @@ void SConfig::SaveSettings()
SaveAnalyticsSettings(ini); SaveAnalyticsSettings(ini);
SaveNetworkSettings(ini); SaveNetworkSettings(ini);
SaveBluetoothPassthroughSettings(ini); SaveBluetoothPassthroughSettings(ini);
SaveSysconfSettings(ini);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
m_SYSCONF->Save();
} }
namespace namespace
@ -334,6 +370,47 @@ void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini)
section->Set("LinkKeys", m_bt_passthrough_link_keys); section->Set("LinkKeys", m_bt_passthrough_link_keys);
} }
void SConfig::SaveSysconfSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("Sysconf");
section->Set("SensorBarPosition", m_sensor_bar_position);
section->Set("SensorBarSensitivity", m_sensor_bar_sensitivity);
section->Set("SpeakerVolume", m_speaker_volume);
section->Set("WiimoteMotor", m_wiimote_motor);
section->Set("WiiLanguage", m_wii_language);
section->Set("AspectRatio", m_wii_aspect_ratio);
section->Set("Screensaver", m_wii_screensaver);
}
void SConfig::SaveSettingsToSysconf()
{
SysConf sysconf;
sysconf.SetData<u8>("IPL.SSV", m_wii_screensaver);
sysconf.SetData<u8>("IPL.LNG", m_wii_language);
u8 country_code = GetSADRCountryCode(static_cast<DiscIO::Language>(m_wii_language));
sysconf.SetArrayData("IPL.SADR", &country_code, 1);
sysconf.SetData<u8>("IPL.AR", m_wii_aspect_ratio);
sysconf.SetData<u8>("BT.BAR", m_sensor_bar_position);
sysconf.SetData<u32>("BT.SENS", m_sensor_bar_sensitivity);
sysconf.SetData<u8>("BT.SPKV", m_speaker_volume);
sysconf.SetData("BT.MOT", m_wiimote_motor);
sysconf.SetData("IPL.PGS", bProgressive);
sysconf.SetData("IPL.E60", bPAL60);
// Disable WiiConnect24's standby mode. If it is enabled, it prevents us from receiving
// shutdown commands in the State Transition Manager (STM).
// TODO: remove this if and once Dolphin supports WC24 standby mode.
sysconf.SetData<u8>("IPL.IDL", 0x00);
NOTICE_LOG(COMMON, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown");
RestoreBTInfoSection(&sysconf);
sysconf.Save();
}
void SConfig::LoadSettings() void SConfig::LoadSettings()
{ {
INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
@ -352,8 +429,7 @@ void SConfig::LoadSettings()
LoadNetworkSettings(ini); LoadNetworkSettings(ini);
LoadAnalyticsSettings(ini); LoadAnalyticsSettings(ini);
LoadBluetoothPassthroughSettings(ini); LoadBluetoothPassthroughSettings(ini);
LoadSysconfSettings(ini);
m_SYSCONF = new SysConf();
} }
void SConfig::LoadGeneralSettings(IniFile& ini) void SConfig::LoadGeneralSettings(IniFile& ini)
@ -626,6 +702,34 @@ void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini)
section->Get("LinkKeys", &m_bt_passthrough_link_keys, ""); section->Get("LinkKeys", &m_bt_passthrough_link_keys, "");
} }
void SConfig::LoadSysconfSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("Sysconf");
section->Get("SensorBarPosition", &m_sensor_bar_position, m_sensor_bar_position);
section->Get("SensorBarSensitivity", &m_sensor_bar_sensitivity, m_sensor_bar_sensitivity);
section->Get("SpeakerVolume", &m_speaker_volume, m_speaker_volume);
section->Get("WiimoteMotor", &m_wiimote_motor, m_wiimote_motor);
section->Get("WiiLanguage", &m_wii_language, m_wii_language);
section->Get("AspectRatio", &m_wii_aspect_ratio, m_wii_aspect_ratio);
section->Get("Screensaver", &m_wii_screensaver, m_wii_screensaver);
}
void SConfig::LoadSettingsFromSysconf()
{
SysConf sysconf;
m_wii_screensaver = sysconf.GetData<u8>("IPL.SSV");
m_wii_language = sysconf.GetData<u8>("IPL.LNG");
m_wii_aspect_ratio = sysconf.GetData<u8>("IPL.AR");
m_sensor_bar_position = sysconf.GetData<u8>("BT.BAR");
m_sensor_bar_sensitivity = sysconf.GetData<u32>("BT.SENS");
m_speaker_volume = sysconf.GetData<u8>("BT.SPKV");
m_wiimote_motor = sysconf.GetData<u8>("BT.MOT") != 0;
bProgressive = sysconf.GetData<u8>("IPL.PGS") != 0;
bPAL60 = sysconf.GetData<u8>("IPL.E60") != 0;
}
void SConfig::LoadDefaults() void SConfig::LoadDefaults()
{ {
bEnableDebugging = false; bEnableDebugging = false;
@ -966,7 +1070,7 @@ DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
{ {
int language_value; int language_value;
if (wii) if (wii)
language_value = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"); language_value = SConfig::GetInstance().m_wii_language;
else else
language_value = SConfig::GetInstance().SelectedLanguage + 1; language_value = SConfig::GetInstance().SelectedLanguage + 1;
DiscIO::Language language = static_cast<DiscIO::Language>(language_value); DiscIO::Language language = static_cast<DiscIO::Language>(language_value);

View file

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

View file

@ -27,6 +27,7 @@
#include "Common/Timer.h" #include "Common/Timer.h"
#include "Core/Analytics.h" #include "Core/Analytics.h"
#include "Core/BootManager.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
@ -248,8 +249,8 @@ bool Init()
if (g_aspect_wide) if (g_aspect_wide)
{ {
IniFile gameIni = _CoreParameter.LoadGameIni(); IniFile gameIni = _CoreParameter.LoadGameIni();
gameIni.GetOrCreateSection("Wii")->Get( gameIni.GetOrCreateSection("Wii")->Get("Widescreen", &g_aspect_wide,
"Widescreen", &g_aspect_wide, !!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR")); !!SConfig::GetInstance().m_wii_aspect_ratio);
} }
s_window_handle = Host_GetRenderHandle(); s_window_handle = Host_GetRenderHandle();
@ -661,9 +662,7 @@ void EmuThread()
// Clear on screen messages that haven't expired // Clear on screen messages that haven't expired
OSD::ClearMessages(); OSD::ClearMessages();
// Reload sysconf file in order to see changes committed during emulation BootManager::RestoreConfig();
if (core_parameter.bWii)
SConfig::GetInstance().m_SYSCONF->Reload();
INFO_LOG(CONSOLE, "Stop [Video Thread]\t\t---- Shutdown complete ----"); INFO_LOG(CONSOLE, "Stop [Video Thread]\t\t---- Shutdown complete ----");
Movie::Shutdown(); Movie::Shutdown();

View file

@ -7,6 +7,7 @@
#include "Core/FifoPlayer/FifoRecorder.h" #include "Core/FifoPlayer/FifoRecorder.h"
#include "Common/MsgHandler.h"
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/FifoPlayer/FifoAnalyzer.h" #include "Core/FifoPlayer/FifoAnalyzer.h"

View file

@ -5,6 +5,7 @@
#include "Core/HW/Sram.h" #include "Core/HW/Sram.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
// english // english

View file

@ -304,7 +304,7 @@ Wiimote::Wiimote(const unsigned int index)
m_hotkeys->AddInput(_trans("Upright Hold"), false); m_hotkeys->AddInput(_trans("Upright Hold"), false);
// TODO: This value should probably be re-read if SYSCONF gets changed // TODO: This value should probably be re-read if SYSCONF gets changed
m_sensor_bar_on_top = SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR") != 0; m_sensor_bar_on_top = SConfig::GetInstance().m_sensor_bar_position != 0;
// --- reset eeprom/register/values to default --- // --- reset eeprom/register/values to default ---
Reset(); Reset();

View file

@ -11,6 +11,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/SysConf.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
@ -18,15 +19,14 @@
constexpr u16 BT_INFO_SECTION_LENGTH = 0x460; constexpr u16 BT_INFO_SECTION_LENGTH = 0x460;
void BackUpBTInfoSection() void BackUpBTInfoSection(SysConf* sysconf)
{ {
const std::string filename = File::GetUserPath(D_SESSION_WIIROOT_IDX) + DIR_SEP WII_BTDINF_BACKUP; const std::string filename = File::GetUserPath(D_SESSION_WIIROOT_IDX) + DIR_SEP WII_BTDINF_BACKUP;
if (File::Exists(filename)) if (File::Exists(filename))
return; return;
File::IOFile backup(filename, "wb"); File::IOFile backup(filename, "wb");
std::vector<u8> section(BT_INFO_SECTION_LENGTH); std::vector<u8> section(BT_INFO_SECTION_LENGTH);
if (!SConfig::GetInstance().m_SYSCONF->GetArrayData("BT.DINF", section.data(), if (!sysconf->GetArrayData("BT.DINF", section.data(), static_cast<u16>(section.size())))
static_cast<u16>(section.size())))
{ {
ERROR_LOG(WII_IPC_WIIMOTE, "Failed to read source BT.DINF section"); ERROR_LOG(WII_IPC_WIIMOTE, "Failed to read source BT.DINF section");
return; return;
@ -35,7 +35,7 @@ void BackUpBTInfoSection()
ERROR_LOG(WII_IPC_WIIMOTE, "Failed to back up BT.DINF section"); ERROR_LOG(WII_IPC_WIIMOTE, "Failed to back up BT.DINF section");
} }
void RestoreBTInfoSection() void RestoreBTInfoSection(SysConf* sysconf)
{ {
const std::string filename = File::GetUserPath(D_SESSION_WIIROOT_IDX) + DIR_SEP WII_BTDINF_BACKUP; const std::string filename = File::GetUserPath(D_SESSION_WIIROOT_IDX) + DIR_SEP WII_BTDINF_BACKUP;
if (!File::Exists(filename)) if (!File::Exists(filename))
@ -47,9 +47,7 @@ void RestoreBTInfoSection()
ERROR_LOG(WII_IPC_WIIMOTE, "Failed to read backed up BT.DINF section"); ERROR_LOG(WII_IPC_WIIMOTE, "Failed to read backed up BT.DINF section");
return; return;
} }
SConfig::GetInstance().m_SYSCONF->SetArrayData("BT.DINF", section.data(), sysconf->SetArrayData("BT.DINF", section.data(), static_cast<u16>(section.size()));
static_cast<u16>(section.size()));
SConfig::GetInstance().m_SYSCONF->Save();
File::Delete(filename); File::Delete(filename);
} }

View file

@ -7,8 +7,10 @@
#include "Core/IPC_HLE/WII_IPC_HLE.h" #include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
void BackUpBTInfoSection(); class SysConf;
void RestoreBTInfoSection();
void BackUpBTInfoSection(SysConf* sysconf);
void RestoreBTInfoSection(SysConf* sysconf);
class CWII_IPC_HLE_Device_usb_oh1_57e_305_base : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_usb_oh1_57e_305_base : public IWII_IPC_HLE_Device
{ {

View file

@ -4,6 +4,7 @@
#include "Core/HW/WII_IPC.h" #include "Core/HW/WII_IPC.h"
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/SysConf.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
@ -33,27 +34,23 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::CWII_IPC_HLE_Device_usb_oh1_57e_305_emu
u32 _DeviceID, const std::string& _rDeviceName) u32 _DeviceID, const std::string& _rDeviceName)
: CWII_IPC_HLE_Device_usb_oh1_57e_305_base(_DeviceID, _rDeviceName) : CWII_IPC_HLE_Device_usb_oh1_57e_305_base(_DeviceID, _rDeviceName)
{ {
SysConf* sysconf; SysConf sysconf;
std::unique_ptr<SysConf> owned_sysconf;
if (Core::g_want_determinism) if (Core::g_want_determinism)
{ {
// See SysConf::UpdateLocation for comment about the Future. // See SysConf::UpdateLocation for comment about the Future.
owned_sysconf.reset(new SysConf()); sysconf.LoadFromFile(File::GetUserPath(D_SESSION_WIIROOT_IDX) +
sysconf = owned_sysconf.get(); DIR_SEP WII_SYSCONF_DIR DIR_SEP WII_SYSCONF);
sysconf->LoadFromFile(File::GetUserPath(D_SESSION_WIIROOT_IDX) +
DIR_SEP WII_SYSCONF_DIR DIR_SEP WII_SYSCONF);
} }
else else
{ {
sysconf = SConfig::GetInstance().m_SYSCONF; BackUpBTInfoSection(&sysconf);
BackUpBTInfoSection();
} }
// Activate only first Wiimote by default // Activate only first Wiimote by default
_conf_pads BT_DINF; _conf_pads BT_DINF;
SetUsbPointer(this); SetUsbPointer(this);
if (!sysconf->GetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads))) if (!sysconf.GetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)))
{ {
PanicAlertT("Trying to read from invalid SYSCONF\nWiimote bt ids are not available"); PanicAlertT("Trying to read from invalid SYSCONF\nWiimote bt ids are not available");
} }
@ -88,7 +85,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305_emu::CWII_IPC_HLE_Device_usb_oh1_57e_305_emu
BT_DINF.num_registered = MAX_BBMOTES; BT_DINF.num_registered = MAX_BBMOTES;
// save now so that when games load sysconf file it includes the new Wiimotes // save now so that when games load sysconf file it includes the new Wiimotes
// and the correct order for connected Wiimotes // and the correct order for connected Wiimotes
if (!sysconf->SetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)) || !sysconf->Save()) if (!sysconf.SetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)) || !sysconf.Save())
PanicAlertT("Failed to write BT.DINF to SYSCONF"); PanicAlertT("Failed to write BT.DINF to SYSCONF");
} }

View file

@ -496,7 +496,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SaveLinkKeys()
if (!config_string.empty()) if (!config_string.empty())
config_string.pop_back(); config_string.pop_back();
SConfig::GetInstance().m_bt_passthrough_link_keys = config_string; SConfig::GetInstance().m_bt_passthrough_link_keys = config_string;
SConfig::GetInstance().SaveSettings();
} }
bool CWII_IPC_HLE_Device_usb_oh1_57e_305_real::OpenDevice(libusb_device* device) bool CWII_IPC_HLE_Device_usb_oh1_57e_305_real::OpenDevice(libusb_device* device)

View file

@ -1482,7 +1482,7 @@ void GetSettings()
s_bNetPlay = NetPlay::IsNetPlayRunning(); s_bNetPlay = NetPlay::IsNetPlayRunning();
if (SConfig::GetInstance().bWii) if (SConfig::GetInstance().bWii)
{ {
s_language = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"); s_language = SConfig::GetInstance().m_wii_language;
} }
else else
{ {

View file

@ -10,6 +10,8 @@
#include "Common/ENetUtil.h" #include "Common/ENetUtil.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/EXI_DeviceIPL.h" #include "Core/HW/EXI_DeviceIPL.h"

View file

@ -7,6 +7,7 @@
#include <string> #include <string>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/PowerPC/JitCommon/JitCache.h" #include "Core/PowerPC/JitCommon/JitCache.h"

View file

@ -9,6 +9,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/PowerPC/PPCAnalyst.h" #include "Core/PowerPC/PPCAnalyst.h"

View file

@ -19,6 +19,7 @@
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/FileSearch.h" #include "Common/FileSearch.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/MsgHandler.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HotkeyManager.h" #include "Core/HotkeyManager.h"
#include "DolphinWX/Config/InterfaceConfigPane.h" #include "DolphinWX/Config/InterfaceConfigPane.h"

View file

@ -223,7 +223,6 @@ void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event)
File::SetUserPath(D_WIIROOT_IDX, nand_path); File::SetUserPath(D_WIIROOT_IDX, nand_path);
m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path)); m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path));
SConfig::GetInstance().m_SYSCONF->UpdateLocation();
DiscIO::CNANDContentManager::Access().ClearCache(); DiscIO::CNANDContentManager::Access().ClearCache();
main_frame->UpdateWiiMenuChoice(); main_frame->UpdateWiiMenuChoice();

View file

@ -12,7 +12,6 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h" #include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "DiscIO/Enums.h"
#include "DolphinWX/Config/WiiConfigPane.h" #include "DolphinWX/Config/WiiConfigPane.h"
#include "DolphinWX/DolphinSlider.h" #include "DolphinWX/DolphinSlider.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
@ -154,18 +153,18 @@ void WiiConfigPane::InitializeGUI()
void WiiConfigPane::LoadGUIValues() void WiiConfigPane::LoadGUIValues()
{ {
m_screensaver_checkbox->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV")); m_screensaver_checkbox->SetValue(!!SConfig::GetInstance().m_wii_screensaver);
m_pal60_mode_checkbox->SetValue(SConfig::GetInstance().bPAL60); m_pal60_mode_checkbox->SetValue(SConfig::GetInstance().bPAL60);
m_aspect_ratio_choice->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR")); m_aspect_ratio_choice->SetSelection(SConfig::GetInstance().m_wii_aspect_ratio);
m_system_language_choice->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG")); m_system_language_choice->SetSelection(SConfig::GetInstance().m_wii_language);
m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard); m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard);
m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard); m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard);
m_bt_sensor_bar_pos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR")); m_bt_sensor_bar_pos->SetSelection(SConfig::GetInstance().m_sensor_bar_position);
m_bt_sensor_bar_sens->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u32>("BT.SENS")); m_bt_sensor_bar_sens->SetValue(SConfig::GetInstance().m_sensor_bar_sensitivity);
m_bt_speaker_volume->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.SPKV")); m_bt_speaker_volume->SetValue(SConfig::GetInstance().m_speaker_volume);
m_bt_wiimote_motor->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<bool>("BT.MOT")); m_bt_wiimote_motor->SetValue(SConfig::GetInstance().m_wiimote_motor);
} }
void WiiConfigPane::RefreshGUI() void WiiConfigPane::RefreshGUI()
@ -186,13 +185,12 @@ void WiiConfigPane::RefreshGUI()
void WiiConfigPane::OnScreenSaverCheckBoxChanged(wxCommandEvent& event) void WiiConfigPane::OnScreenSaverCheckBoxChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", m_screensaver_checkbox->IsChecked()); SConfig::GetInstance().m_wii_screensaver = m_screensaver_checkbox->IsChecked();
} }
void WiiConfigPane::OnPAL60CheckBoxChanged(wxCommandEvent& event) void WiiConfigPane::OnPAL60CheckBoxChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().bPAL60 = m_pal60_mode_checkbox->IsChecked(); SConfig::GetInstance().bPAL60 = m_pal60_mode_checkbox->IsChecked();
SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", m_pal60_mode_checkbox->IsChecked());
} }
void WiiConfigPane::OnSDCardCheckBoxChanged(wxCommandEvent& event) void WiiConfigPane::OnSDCardCheckBoxChanged(wxCommandEvent& event)
@ -208,69 +206,30 @@ void WiiConfigPane::OnConnectKeyboardCheckBoxChanged(wxCommandEvent& event)
void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event) void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event)
{ {
DiscIO::Language wii_system_lang = SConfig::GetInstance().m_wii_language = m_system_language_choice->GetSelection();
static_cast<DiscIO::Language>(m_system_language_choice->GetSelection());
SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", wii_system_lang);
u8 country_code = GetSADRCountryCode(wii_system_lang);
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("IPL.SADR", &country_code, 1))
WxUtils::ShowErrorDialog(_("Failed to update country code in SYSCONF"));
} }
void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event) void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", m_aspect_ratio_choice->GetSelection()); SConfig::GetInstance().m_wii_aspect_ratio = m_aspect_ratio_choice->GetSelection();
} }
void WiiConfigPane::OnSensorBarPosChanged(wxCommandEvent& event) void WiiConfigPane::OnSensorBarPosChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", event.GetInt()); SConfig::GetInstance().m_sensor_bar_position = event.GetInt();
} }
void WiiConfigPane::OnSensorBarSensChanged(wxCommandEvent& event) void WiiConfigPane::OnSensorBarSensChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_SYSCONF->SetData("BT.SENS", event.GetInt()); SConfig::GetInstance().m_sensor_bar_sensitivity = event.GetInt();
} }
void WiiConfigPane::OnSpeakerVolumeChanged(wxCommandEvent& event) void WiiConfigPane::OnSpeakerVolumeChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_SYSCONF->SetData("BT.SPKV", event.GetInt()); SConfig::GetInstance().m_speaker_volume = event.GetInt();
} }
void WiiConfigPane::OnWiimoteMotorChanged(wxCommandEvent& event) void WiiConfigPane::OnWiimoteMotorChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_SYSCONF->SetData("BT.MOT", event.GetInt()); SConfig::GetInstance().m_wiimote_motor = event.IsChecked();
}
// Change from IPL.LNG value to IPL.SADR country code.
// http://wiibrew.org/wiki/Country_Codes
u8 WiiConfigPane::GetSADRCountryCode(DiscIO::Language language)
{
switch (language)
{
case DiscIO::Language::LANGUAGE_JAPANESE:
return 1; // Japan
case DiscIO::Language::LANGUAGE_ENGLISH:
return 49; // USA
case DiscIO::Language::LANGUAGE_GERMAN:
return 78; // Germany
case DiscIO::Language::LANGUAGE_FRENCH:
return 77; // France
case DiscIO::Language::LANGUAGE_SPANISH:
return 105; // Spain
case DiscIO::Language::LANGUAGE_ITALIAN:
return 83; // Italy
case DiscIO::Language::LANGUAGE_DUTCH:
return 94; // Netherlands
case DiscIO::Language::LANGUAGE_SIMPLIFIED_CHINESE:
case DiscIO::Language::LANGUAGE_TRADITIONAL_CHINESE:
return 157; // China
case DiscIO::Language::LANGUAGE_KOREAN:
return 136; // Korea
case DiscIO::Language::LANGUAGE_UNKNOWN:
break;
}
PanicAlert("Invalid language. Defaulting to Japanese.");
return 1;
} }

View file

@ -8,11 +8,6 @@
#include <wx/panel.h> #include <wx/panel.h>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
namespace DiscIO
{
enum class Language;
}
class DolphinSlider; class DolphinSlider;
class wxCheckBox; class wxCheckBox;
class wxChoice; class wxChoice;
@ -40,8 +35,6 @@ private:
void OnSpeakerVolumeChanged(wxCommandEvent&); void OnSpeakerVolumeChanged(wxCommandEvent&);
void OnWiimoteMotorChanged(wxCommandEvent&); void OnWiimoteMotorChanged(wxCommandEvent&);
static u8 GetSADRCountryCode(DiscIO::Language language);
wxArrayString m_system_language_strings; wxArrayString m_system_language_strings;
wxArrayString m_aspect_ratio_strings; wxArrayString m_aspect_ratio_strings;
wxArrayString m_bt_sensor_bar_pos_strings; wxArrayString m_bt_sensor_bar_pos_strings;

View file

@ -1180,7 +1180,7 @@ void CFrame::DoStop()
if (NetPlayDialog::GetNetPlayClient()) if (NetPlayDialog::GetNetPlayClient())
NetPlayDialog::GetNetPlayClient()->Stop(); NetPlayDialog::GetNetPlayClient()->Stop();
BootManager::Stop(); Core::Stop();
UpdateGUI(); UpdateGUI();
} }
} }

View file

@ -32,6 +32,7 @@
#include "Common/FifoQueue.h" #include "Common/FifoQueue.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/MsgHandler.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/EXI_Device.h" #include "Core/HW/EXI_Device.h"

View file

@ -886,10 +886,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
this); this);
progressive_scan_checkbox->SetValue(SConfig::GetInstance().bProgressive); progressive_scan_checkbox->SetValue(SConfig::GetInstance().bProgressive);
// A bit strange behavior, but this needs to stay in sync with the main progressive boolean;
// TODO: Is this still necessary?
SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", SConfig::GetInstance().bProgressive);
szr_misc->Add(progressive_scan_checkbox); szr_misc->Add(progressive_scan_checkbox);
} }

View file

@ -130,9 +130,7 @@ protected:
void Event_ProgressiveScan(wxCommandEvent& ev) void Event_ProgressiveScan(wxCommandEvent& ev)
{ {
SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", ev.GetInt());
SConfig::GetInstance().bProgressive = ev.IsChecked(); SConfig::GetInstance().bProgressive = ev.IsChecked();
ev.Skip(); ev.Skip();
} }

View file

@ -6,6 +6,7 @@
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/MsgHandler.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
#include "InputCommon/ControllerEmu.h" #include "InputCommon/ControllerEmu.h"

View file

@ -9,6 +9,7 @@
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/LogManager.h" #include "Common/Logging/LogManager.h"
#include "Common/MsgHandler.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"

View file

@ -10,6 +10,7 @@
#include <vector> #include <vector>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/MsgHandler.h"
namespace DX11 namespace DX11
{ {

View file

@ -8,6 +8,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"