diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index ebf5d45598..45770e961c 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -150,6 +150,7 @@ void SConfig::SaveSettings() SaveCoreSettings(ini); SaveMovieSettings(ini); SaveDSPSettings(ini); + SaveInputSettings(ini); SaveFifoPlayerSettings(ini); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); @@ -329,6 +330,13 @@ void SConfig::SaveDSPSettings(IniFile& ini) dsp->Set("CaptureLog", m_DSPCaptureLog); } +void SConfig::SaveInputSettings(IniFile& ini) +{ + IniFile::Section* input = ini.GetOrCreateSection("Input"); + + input->Set("BackgroundInput", m_BackgroundInput); +} + void SConfig::SaveFifoPlayerSettings(IniFile& ini) { IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer"); @@ -350,6 +358,7 @@ void SConfig::LoadSettings() LoadCoreSettings(ini); LoadMovieSettings(ini); LoadDSPSettings(ini); + LoadInputSettings(ini); LoadFifoPlayerSettings(ini); m_SYSCONF = new SysConf(); @@ -556,6 +565,13 @@ void SConfig::LoadDSPSettings(IniFile& ini) dsp->Get("CaptureLog", &m_DSPCaptureLog, false); } +void SConfig::LoadInputSettings(IniFile& ini) +{ + IniFile::Section* input = ini.GetOrCreateSection("Input"); + + input->Get("BackgroundInput", &m_BackgroundInput, false); +} + void SConfig::LoadFifoPlayerSettings(IniFile& ini) { IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer"); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 45139caa71..e867a304d8 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -97,6 +97,9 @@ struct SConfig : NonCopyable int m_Volume; std::string sBackend; + // Input settings + bool m_BackgroundInput; + SysConf* m_SYSCONF; // save settings @@ -122,6 +125,7 @@ private: void SaveGameListSettings(IniFile& ini); void SaveCoreSettings(IniFile& ini); void SaveDSPSettings(IniFile& ini); + void SaveInputSettings(IniFile& ini); void SaveMovieSettings(IniFile& ini); void SaveFifoPlayerSettings(IniFile& ini); @@ -132,6 +136,7 @@ private: void LoadGameListSettings(IniFile& ini); void LoadCoreSettings(IniFile& ini); void LoadDSPSettings(IniFile& ini); + void LoadInputSettings(IniFile& ini); void LoadMovieSettings(IniFile& ini); void LoadFifoPlayerSettings(IniFile& ini); diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp index b95969c0ea..303f2d067b 100644 --- a/Source/Core/Core/HW/GCPadEmu.cpp +++ b/Source/Core/Core/HW/GCPadEmu.cpp @@ -79,7 +79,7 @@ GCPad::GCPad(const unsigned int index) : m_index(index) // options groups.emplace_back(m_options = new ControlGroup(_trans("Options"))); - m_options->settings.emplace_back(new ControlGroup::Setting(_trans("Background Input"), false)); + m_options->settings.emplace_back(new ControlGroup::BackgroundInputSetting(_trans("Background Input"))); } std::string GCPad::GetName() const diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index bc34afac90..fab7409374 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -313,7 +313,7 @@ Wiimote::Wiimote( const unsigned int index ) // options groups.emplace_back( m_options = new ControlGroup(_trans("Options"))); - m_options->settings.emplace_back(new ControlGroup::Setting(_trans("Background Input"), false)); + m_options->settings.emplace_back(new ControlGroup::BackgroundInputSetting(_trans("Background Input"))); m_options->settings.emplace_back(new ControlGroup::Setting(_trans("Sideways Wiimote"), false)); m_options->settings.emplace_back(new ControlGroup::Setting(_trans("Upright Wiimote"), false)); diff --git a/Source/Core/InputCommon/ControllerEmu.h b/Source/Core/InputCommon/ControllerEmu.h index 46f5477ff2..c15574ff6f 100644 --- a/Source/Core/InputCommon/ControllerEmu.h +++ b/Source/Core/InputCommon/ControllerEmu.h @@ -14,6 +14,7 @@ #include #include "Common/IniFile.h" +#include "Core/ConfigManager.h" #include "InputCommon/GCPadStatus.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" @@ -114,6 +115,25 @@ public: } }; + class BackgroundInputSetting : public Setting + { + public: + BackgroundInputSetting(const std::string &_name) : Setting(_name, false) + { + is_virtual = true; + } + + void SetValue(ControlState new_value) override + { + SConfig::GetInstance().m_BackgroundInput = new_value; + } + + ControlState GetValue() override + { + return SConfig::GetInstance().m_BackgroundInput; + } + }; + ControlGroup(const std::string& _name, const unsigned int _type = GROUP_TYPE_OTHER) : name(_name), type(_type) {} virtual ~ControlGroup() {}