diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp index 8faef12da2..44b0f85325 100644 --- a/Source/Core/AudioCommon/OpenALStream.cpp +++ b/Source/Core/AudioCommon/OpenALStream.cpp @@ -9,6 +9,7 @@ #include "AudioCommon/OpenALStream.h" #include "AudioCommon/aldlist.h" #include "Common/Logging/Log.h" +#include "Common/MsgHandler.h" #include "Common/Thread.h" #include "Core/ConfigManager.h" diff --git a/Source/Core/AudioCommon/WaveFile.cpp b/Source/Core/AudioCommon/WaveFile.cpp index 5634bd4157..ca37c0e2c4 100644 --- a/Source/Core/AudioCommon/WaveFile.cpp +++ b/Source/Core/AudioCommon/WaveFile.cpp @@ -7,6 +7,7 @@ #include "AudioCommon/WaveFile.h" #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" +#include "Common/MsgHandler.h" #include "Core/ConfigManager.h" constexpr size_t WaveFileWriter::BUFFER_SIZE; diff --git a/Source/Core/Core/ActionReplay.cpp b/Source/Core/Core/ActionReplay.cpp index 0e9b8aff15..8a086eb8e1 100644 --- a/Source/Core/Core/ActionReplay.cpp +++ b/Source/Core/Core/ActionReplay.cpp @@ -31,6 +31,7 @@ #include "Common/CommonTypes.h" #include "Common/IniFile.h" #include "Common/Logging/LogManager.h" +#include "Common/MsgHandler.h" #include "Common/StringUtil.h" #include "Core/ARDecrypt.h" diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 76ab156221..5b719f0bcb 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -10,6 +10,7 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/MathUtil.h" +#include "Common/MsgHandler.h" #include "Common/StringUtil.h" #include "Core/Boot/Boot.h" diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 6324aa40f5..33c00ec892 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -26,7 +26,8 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" -#include "Common/SysConf.h" +#include "Common/Logging/Log.h" +#include "Common/MsgHandler.h" #include "Core/BootManager.h" #include "Core/ConfigManager.h" #include "Core/Core.h" @@ -35,7 +36,6 @@ #include "Core/HW/Sram.h" #include "Core/HW/WiimoteReal/WiimoteReal.h" #include "Core/Host.h" -#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h" #include "Core/Movie.h" #include "Core/NetPlayProto.h" #include "VideoCommon/VideoBackendBase.h" @@ -149,9 +149,6 @@ void ConfigCache::RestoreConfig(SConfig* config) config->SelectedLanguage = iSelectedLanguage; 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 // game is running. if (bSetVolume) @@ -279,9 +276,6 @@ bool BootCore(const std::string& _rFilename) // Wii settings if (StartUp.bWii) { - // Flush possible changes to SYSCONF to file - SConfig::GetInstance().m_SYSCONF->Save(); - int source; for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) { @@ -370,19 +364,8 @@ bool BootCore(const std::string& _rFilename) StartUp.bPAL60 = false; } - SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", StartUp.bProgressive); - SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", StartUp.bPAL60); - if (StartUp.bWii) - { - // 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("IPL.IDL", 0x00); - NOTICE_LOG(BOOT, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown"); - - RestoreBTInfoSection(); - } + SConfig::GetInstance().SaveSettingsToSysconf(); // Run the game // Init the core @@ -398,10 +381,14 @@ bool BootCore(const std::string& _rFilename) void Stop() { Core::Stop(); + RestoreConfig(); +} - SConfig& StartUp = SConfig::GetInstance(); - StartUp.m_strUniqueID = "00000000"; - config_cache.RestoreConfig(&StartUp); +void RestoreConfig() +{ + SConfig::GetInstance().LoadSettingsFromSysconf(); + SConfig::GetInstance().m_strUniqueID = "00000000"; + config_cache.RestoreConfig(&SConfig::GetInstance()); } } // namespace diff --git a/Source/Core/Core/BootManager.h b/Source/Core/Core/BootManager.h index b74eee675a..42dd9d7b49 100644 --- a/Source/Core/Core/BootManager.h +++ b/Source/Core/Core/BootManager.h @@ -10,5 +10,9 @@ namespace BootManager { bool BootCore(const std::string& _rFilename); +// Stop the emulation core and restore the configuration. 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(); } diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index e49b5cbd88..589c1e1b8f 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -10,7 +10,10 @@ #include "Common/CommonPaths.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" +#include "Common/Logging/Log.h" +#include "Common/MsgHandler.h" #include "Common/StringUtil.h" +#include "Common/SysConf.h" #include "Core/Boot/Boot.h" #include "Core/Boot/Boot_DOL.h" @@ -18,6 +21,7 @@ #include "Core/Core.h" // for bWii #include "Core/FifoPlayer/FifoDataFile.h" #include "Core/HW/SI.h" +#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h" #include "Core/PowerPC/PowerPC.h" #include "DiscIO/Enums.h" @@ -25,6 +29,39 @@ #include "DiscIO/Volume.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() @@ -32,6 +69,7 @@ SConfig::SConfig() LoadDefaults(); // Make sure we have log manager LoadSettings(); + LoadSettingsFromSysconf(); } void SConfig::Init() @@ -48,7 +86,6 @@ void SConfig::Shutdown() SConfig::~SConfig() { SaveSettings(); - delete m_SYSCONF; } void SConfig::SaveSettings() @@ -56,7 +93,6 @@ void SConfig::SaveSettings() NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); IniFile ini; ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff - m_SYSCONF->Reload(); SaveGeneralSettings(ini); SaveInterfaceSettings(ini); @@ -70,9 +106,9 @@ void SConfig::SaveSettings() SaveAnalyticsSettings(ini); SaveNetworkSettings(ini); SaveBluetoothPassthroughSettings(ini); + SaveSysconfSettings(ini); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); - m_SYSCONF->Save(); } namespace @@ -334,6 +370,47 @@ void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini) 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("IPL.SSV", m_wii_screensaver); + sysconf.SetData("IPL.LNG", m_wii_language); + u8 country_code = GetSADRCountryCode(static_cast(m_wii_language)); + sysconf.SetArrayData("IPL.SADR", &country_code, 1); + + sysconf.SetData("IPL.AR", m_wii_aspect_ratio); + sysconf.SetData("BT.BAR", m_sensor_bar_position); + sysconf.SetData("BT.SENS", m_sensor_bar_sensitivity); + sysconf.SetData("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("IPL.IDL", 0x00); + NOTICE_LOG(COMMON, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown"); + + RestoreBTInfoSection(&sysconf); + + sysconf.Save(); +} + void SConfig::LoadSettings() { INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); @@ -352,8 +429,7 @@ void SConfig::LoadSettings() LoadNetworkSettings(ini); LoadAnalyticsSettings(ini); LoadBluetoothPassthroughSettings(ini); - - m_SYSCONF = new SysConf(); + LoadSysconfSettings(ini); } void SConfig::LoadGeneralSettings(IniFile& ini) @@ -626,6 +702,34 @@ void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini) 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("IPL.SSV"); + m_wii_language = sysconf.GetData("IPL.LNG"); + m_wii_aspect_ratio = sysconf.GetData("IPL.AR"); + m_sensor_bar_position = sysconf.GetData("BT.BAR"); + m_sensor_bar_sensitivity = sysconf.GetData("BT.SENS"); + m_speaker_volume = sysconf.GetData("BT.SPKV"); + m_wiimote_motor = sysconf.GetData("BT.MOT") != 0; + bProgressive = sysconf.GetData("IPL.PGS") != 0; + bPAL60 = sysconf.GetData("IPL.E60") != 0; +} + void SConfig::LoadDefaults() { bEnableDebugging = false; @@ -966,7 +1070,7 @@ DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const { int language_value; if (wii) - language_value = SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG"); + language_value = SConfig::GetInstance().m_wii_language; else language_value = SConfig::GetInstance().SelectedLanguage + 1; DiscIO::Language language = static_cast(language_value); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index d76cf4d83b..40c3ea95fb 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -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; }; diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index c322997cad..816811d4cb 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -27,6 +27,7 @@ #include "Common/Timer.h" #include "Core/Analytics.h" +#include "Core/BootManager.h" #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/CoreTiming.h" @@ -248,8 +249,8 @@ bool Init() if (g_aspect_wide) { IniFile gameIni = _CoreParameter.LoadGameIni(); - gameIni.GetOrCreateSection("Wii")->Get( - "Widescreen", &g_aspect_wide, !!SConfig::GetInstance().m_SYSCONF->GetData("IPL.AR")); + gameIni.GetOrCreateSection("Wii")->Get("Widescreen", &g_aspect_wide, + !!SConfig::GetInstance().m_wii_aspect_ratio); } s_window_handle = Host_GetRenderHandle(); @@ -661,9 +662,7 @@ void EmuThread() // Clear on screen messages that haven't expired OSD::ClearMessages(); - // Reload sysconf file in order to see changes committed during emulation - if (core_parameter.bWii) - SConfig::GetInstance().m_SYSCONF->Reload(); + BootManager::RestoreConfig(); INFO_LOG(CONSOLE, "Stop [Video Thread]\t\t---- Shutdown complete ----"); Movie::Shutdown(); diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp index 8617b8b700..eb229bafad 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp @@ -7,6 +7,7 @@ #include "Core/FifoPlayer/FifoRecorder.h" +#include "Common/MsgHandler.h" #include "Common/Thread.h" #include "Core/ConfigManager.h" #include "Core/FifoPlayer/FifoAnalyzer.h" diff --git a/Source/Core/Core/HW/Sram.cpp b/Source/Core/Core/HW/Sram.cpp index 21bfea91a2..04bdf5175f 100644 --- a/Source/Core/Core/HW/Sram.cpp +++ b/Source/Core/Core/HW/Sram.cpp @@ -5,6 +5,7 @@ #include "Core/HW/Sram.h" #include "Common/CommonTypes.h" #include "Common/FileUtil.h" +#include "Common/Logging/Log.h" #include "Core/ConfigManager.h" // english diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index 0992d9e11b..28d45e2393 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -304,7 +304,7 @@ Wiimote::Wiimote(const unsigned int index) m_hotkeys->AddInput(_trans("Upright Hold"), false); // TODO: This value should probably be re-read if SYSCONF gets changed - m_sensor_bar_on_top = SConfig::GetInstance().m_SYSCONF->GetData("BT.BAR") != 0; + m_sensor_bar_on_top = SConfig::GetInstance().m_sensor_bar_position != 0; // --- reset eeprom/register/values to default --- Reset(); diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.cpp index 67884c7b8d..9329036ed6 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.cpp @@ -11,6 +11,7 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" +#include "Common/SysConf.h" #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/HW/Memmap.h" @@ -18,15 +19,14 @@ 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; if (File::Exists(filename)) return; File::IOFile backup(filename, "wb"); std::vector section(BT_INFO_SECTION_LENGTH); - if (!SConfig::GetInstance().m_SYSCONF->GetArrayData("BT.DINF", section.data(), - static_cast(section.size()))) + if (!sysconf->GetArrayData("BT.DINF", section.data(), static_cast(section.size()))) { ERROR_LOG(WII_IPC_WIIMOTE, "Failed to read source BT.DINF section"); return; @@ -35,7 +35,7 @@ void BackUpBTInfoSection() 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; if (!File::Exists(filename)) @@ -47,9 +47,7 @@ void RestoreBTInfoSection() ERROR_LOG(WII_IPC_WIIMOTE, "Failed to read backed up BT.DINF section"); return; } - SConfig::GetInstance().m_SYSCONF->SetArrayData("BT.DINF", section.data(), - static_cast(section.size())); - SConfig::GetInstance().m_SYSCONF->Save(); + sysconf->SetArrayData("BT.DINF", section.data(), static_cast(section.size())); File::Delete(filename); } diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h index ea28ad17b9..7a330035f7 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h @@ -7,8 +7,10 @@ #include "Core/IPC_HLE/WII_IPC_HLE.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device.h" -void BackUpBTInfoSection(); -void RestoreBTInfoSection(); +class SysConf; + +void BackUpBTInfoSection(SysConf* sysconf); +void RestoreBTInfoSection(SysConf* sysconf); class CWII_IPC_HLE_Device_usb_oh1_57e_305_base : public IWII_IPC_HLE_Device { diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.cpp index d672464cf4..dcacf8b313 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.cpp @@ -4,6 +4,7 @@ #include "Core/HW/WII_IPC.h" #include "Common/CommonPaths.h" +#include "Common/SysConf.h" #include "Core/ConfigManager.h" #include "Core/Core.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) : CWII_IPC_HLE_Device_usb_oh1_57e_305_base(_DeviceID, _rDeviceName) { - SysConf* sysconf; - std::unique_ptr owned_sysconf; + SysConf sysconf; if (Core::g_want_determinism) { // See SysConf::UpdateLocation for comment about the Future. - owned_sysconf.reset(new SysConf()); - sysconf = owned_sysconf.get(); - sysconf->LoadFromFile(File::GetUserPath(D_SESSION_WIIROOT_IDX) + - 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 { - sysconf = SConfig::GetInstance().m_SYSCONF; - BackUpBTInfoSection(); + BackUpBTInfoSection(&sysconf); } // Activate only first Wiimote by default _conf_pads BT_DINF; 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"); } @@ -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; // save now so that when games load sysconf file it includes the new 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"); } diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.cpp index 27bddc8361..5d250309f6 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.cpp @@ -496,7 +496,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305_real::SaveLinkKeys() if (!config_string.empty()) config_string.pop_back(); 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) diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 5dcab9d449..34bc547d53 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -1482,7 +1482,7 @@ void GetSettings() s_bNetPlay = NetPlay::IsNetPlayRunning(); if (SConfig::GetInstance().bWii) { - s_language = SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG"); + s_language = SConfig::GetInstance().m_wii_language; } else { diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 0942eae2c1..1dbdd9bc96 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -10,6 +10,8 @@ #include "Common/ENetUtil.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" +#include "Common/Logging/Log.h" +#include "Common/MsgHandler.h" #include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/HW/EXI_DeviceIPL.h" diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index 8e6df5d8ce..28949cfdd6 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -7,6 +7,7 @@ #include #include "Common/CommonTypes.h" +#include "Common/Logging/Log.h" #include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/PowerPC/JitCommon/JitCache.h" diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp index ec000df036..7980f39e64 100644 --- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp @@ -9,6 +9,7 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" +#include "Common/MsgHandler.h" #include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/PowerPC/PPCAnalyst.h" diff --git a/Source/Core/DolphinWX/Config/InterfaceConfigPane.cpp b/Source/Core/DolphinWX/Config/InterfaceConfigPane.cpp index 2927114e58..eb3912f306 100644 --- a/Source/Core/DolphinWX/Config/InterfaceConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/InterfaceConfigPane.cpp @@ -19,6 +19,7 @@ #include "Common/CommonPaths.h" #include "Common/FileSearch.h" #include "Common/FileUtil.h" +#include "Common/MsgHandler.h" #include "Core/ConfigManager.h" #include "Core/HotkeyManager.h" #include "DolphinWX/Config/InterfaceConfigPane.h" diff --git a/Source/Core/DolphinWX/Config/PathConfigPane.cpp b/Source/Core/DolphinWX/Config/PathConfigPane.cpp index 08664dee29..a6e33b52f7 100644 --- a/Source/Core/DolphinWX/Config/PathConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/PathConfigPane.cpp @@ -223,7 +223,6 @@ void PathConfigPane::OnNANDRootChanged(wxCommandEvent& event) File::SetUserPath(D_WIIROOT_IDX, nand_path); m_nand_root_dirpicker->SetPath(StrToWxStr(nand_path)); - SConfig::GetInstance().m_SYSCONF->UpdateLocation(); DiscIO::CNANDContentManager::Access().ClearCache(); main_frame->UpdateWiiMenuChoice(); diff --git a/Source/Core/DolphinWX/Config/WiiConfigPane.cpp b/Source/Core/DolphinWX/Config/WiiConfigPane.cpp index c53b5757d2..c5aca6124c 100644 --- a/Source/Core/DolphinWX/Config/WiiConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/WiiConfigPane.cpp @@ -12,7 +12,6 @@ #include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/IPC_HLE/WII_IPC_HLE.h" -#include "DiscIO/Enums.h" #include "DolphinWX/Config/WiiConfigPane.h" #include "DolphinWX/DolphinSlider.h" #include "DolphinWX/WxUtils.h" @@ -154,18 +153,18 @@ void WiiConfigPane::InitializeGUI() void WiiConfigPane::LoadGUIValues() { - m_screensaver_checkbox->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData("IPL.SSV")); + m_screensaver_checkbox->SetValue(!!SConfig::GetInstance().m_wii_screensaver); m_pal60_mode_checkbox->SetValue(SConfig::GetInstance().bPAL60); - m_aspect_ratio_choice->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData("IPL.AR")); - m_system_language_choice->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG")); + m_aspect_ratio_choice->SetSelection(SConfig::GetInstance().m_wii_aspect_ratio); + m_system_language_choice->SetSelection(SConfig::GetInstance().m_wii_language); m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard); m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard); - m_bt_sensor_bar_pos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData("BT.BAR")); - m_bt_sensor_bar_sens->SetValue(SConfig::GetInstance().m_SYSCONF->GetData("BT.SENS")); - m_bt_speaker_volume->SetValue(SConfig::GetInstance().m_SYSCONF->GetData("BT.SPKV")); - m_bt_wiimote_motor->SetValue(SConfig::GetInstance().m_SYSCONF->GetData("BT.MOT")); + m_bt_sensor_bar_pos->SetSelection(SConfig::GetInstance().m_sensor_bar_position); + m_bt_sensor_bar_sens->SetValue(SConfig::GetInstance().m_sensor_bar_sensitivity); + m_bt_speaker_volume->SetValue(SConfig::GetInstance().m_speaker_volume); + m_bt_wiimote_motor->SetValue(SConfig::GetInstance().m_wiimote_motor); } void WiiConfigPane::RefreshGUI() @@ -186,13 +185,12 @@ void WiiConfigPane::RefreshGUI() 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) { 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) @@ -208,69 +206,30 @@ void WiiConfigPane::OnConnectKeyboardCheckBoxChanged(wxCommandEvent& event) void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event) { - DiscIO::Language wii_system_lang = - static_cast(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")); + SConfig::GetInstance().m_wii_language = m_system_language_choice->GetSelection(); } 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) { - SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", event.GetInt()); + SConfig::GetInstance().m_sensor_bar_position = event.GetInt(); } 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) { - SConfig::GetInstance().m_SYSCONF->SetData("BT.SPKV", event.GetInt()); + SConfig::GetInstance().m_speaker_volume = event.GetInt(); } void WiiConfigPane::OnWiimoteMotorChanged(wxCommandEvent& event) { - SConfig::GetInstance().m_SYSCONF->SetData("BT.MOT", event.GetInt()); -} - -// 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; + SConfig::GetInstance().m_wiimote_motor = event.IsChecked(); } diff --git a/Source/Core/DolphinWX/Config/WiiConfigPane.h b/Source/Core/DolphinWX/Config/WiiConfigPane.h index a185751c24..beffa23f99 100644 --- a/Source/Core/DolphinWX/Config/WiiConfigPane.h +++ b/Source/Core/DolphinWX/Config/WiiConfigPane.h @@ -8,11 +8,6 @@ #include #include "Common/CommonTypes.h" -namespace DiscIO -{ -enum class Language; -} - class DolphinSlider; class wxCheckBox; class wxChoice; @@ -40,8 +35,6 @@ private: void OnSpeakerVolumeChanged(wxCommandEvent&); void OnWiimoteMotorChanged(wxCommandEvent&); - static u8 GetSADRCountryCode(DiscIO::Language language); - wxArrayString m_system_language_strings; wxArrayString m_aspect_ratio_strings; wxArrayString m_bt_sensor_bar_pos_strings; diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index f2c47fdb8e..502380762e 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -1180,7 +1180,7 @@ void CFrame::DoStop() if (NetPlayDialog::GetNetPlayClient()) NetPlayDialog::GetNetPlayClient()->Stop(); - BootManager::Stop(); + Core::Stop(); UpdateGUI(); } } diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index 90f60e3c1b..596de8676d 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -32,6 +32,7 @@ #include "Common/FifoQueue.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" +#include "Common/MsgHandler.h" #include "Core/ConfigManager.h" #include "Core/HW/EXI_Device.h" diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index 38fe322b01..b494659ca7 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -886,10 +886,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title) this); 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); } diff --git a/Source/Core/DolphinWX/VideoConfigDiag.h b/Source/Core/DolphinWX/VideoConfigDiag.h index dcff2803e2..e02591956c 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.h +++ b/Source/Core/DolphinWX/VideoConfigDiag.h @@ -130,9 +130,7 @@ protected: void Event_ProgressiveScan(wxCommandEvent& ev) { - SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", ev.GetInt()); SConfig::GetInstance().bProgressive = ev.IsChecked(); - ev.Skip(); } diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index 9df0b71e62..019ddeb414 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -6,6 +6,7 @@ #include "Common/FileUtil.h" #include "Common/IniFile.h" +#include "Common/MsgHandler.h" #include "Core/ConfigManager.h" #include "Core/HW/Wiimote.h" #include "InputCommon/ControllerEmu.h" diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index 4459ec8090..ece3d2d2ee 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -9,6 +9,7 @@ #include "Common/CommonPaths.h" #include "Common/FileUtil.h" #include "Common/Logging/LogManager.h" +#include "Common/MsgHandler.h" #include "Core/ConfigManager.h" #include "Core/HW/Wiimote.h" diff --git a/Source/Core/VideoBackends/D3D/D3DBase.h b/Source/Core/VideoBackends/D3D/D3DBase.h index 52d7b446d0..24c6848434 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.h +++ b/Source/Core/VideoBackends/D3D/D3DBase.h @@ -10,6 +10,7 @@ #include #include "Common/Common.h" +#include "Common/MsgHandler.h" namespace DX11 { diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 13da3ef47a..73e6eafa12 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -8,6 +8,7 @@ #include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" +#include "Common/MsgHandler.h" #include "Common/StringUtil.h" #include "Core/ConfigManager.h" #include "Core/Core.h"