ControllerEmu: Make BackgroundInput a global setting through the virtualization

This will allow us to simplify the checks for background input and push
them further down into the architecture, into the ControllerEmu layer.

The new setting isn't actually used yet, though.
This commit is contained in:
Jasper St. Pierre 2014-07-11 10:42:44 -04:00
parent 0d49bf65a7
commit 5abc028ace
5 changed files with 43 additions and 2 deletions

View File

@ -150,6 +150,7 @@ void SConfig::SaveSettings()
SaveCoreSettings(ini); SaveCoreSettings(ini);
SaveMovieSettings(ini); SaveMovieSettings(ini);
SaveDSPSettings(ini); SaveDSPSettings(ini);
SaveInputSettings(ini);
SaveFifoPlayerSettings(ini); SaveFifoPlayerSettings(ini);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
@ -329,6 +330,13 @@ void SConfig::SaveDSPSettings(IniFile& ini)
dsp->Set("CaptureLog", m_DSPCaptureLog); 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) void SConfig::SaveFifoPlayerSettings(IniFile& ini)
{ {
IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer"); IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");
@ -350,6 +358,7 @@ void SConfig::LoadSettings()
LoadCoreSettings(ini); LoadCoreSettings(ini);
LoadMovieSettings(ini); LoadMovieSettings(ini);
LoadDSPSettings(ini); LoadDSPSettings(ini);
LoadInputSettings(ini);
LoadFifoPlayerSettings(ini); LoadFifoPlayerSettings(ini);
m_SYSCONF = new SysConf(); m_SYSCONF = new SysConf();
@ -556,6 +565,13 @@ void SConfig::LoadDSPSettings(IniFile& ini)
dsp->Get("CaptureLog", &m_DSPCaptureLog, false); 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) void SConfig::LoadFifoPlayerSettings(IniFile& ini)
{ {
IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer"); IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");

View File

@ -97,6 +97,9 @@ struct SConfig : NonCopyable
int m_Volume; int m_Volume;
std::string sBackend; std::string sBackend;
// Input settings
bool m_BackgroundInput;
SysConf* m_SYSCONF; SysConf* m_SYSCONF;
// save settings // save settings
@ -122,6 +125,7 @@ private:
void SaveGameListSettings(IniFile& ini); void SaveGameListSettings(IniFile& ini);
void SaveCoreSettings(IniFile& ini); void SaveCoreSettings(IniFile& ini);
void SaveDSPSettings(IniFile& ini); void SaveDSPSettings(IniFile& ini);
void SaveInputSettings(IniFile& ini);
void SaveMovieSettings(IniFile& ini); void SaveMovieSettings(IniFile& ini);
void SaveFifoPlayerSettings(IniFile& ini); void SaveFifoPlayerSettings(IniFile& ini);
@ -132,6 +136,7 @@ private:
void LoadGameListSettings(IniFile& ini); void LoadGameListSettings(IniFile& ini);
void LoadCoreSettings(IniFile& ini); void LoadCoreSettings(IniFile& ini);
void LoadDSPSettings(IniFile& ini); void LoadDSPSettings(IniFile& ini);
void LoadInputSettings(IniFile& ini);
void LoadMovieSettings(IniFile& ini); void LoadMovieSettings(IniFile& ini);
void LoadFifoPlayerSettings(IniFile& ini); void LoadFifoPlayerSettings(IniFile& ini);

View File

@ -79,7 +79,7 @@ GCPad::GCPad(const unsigned int index) : m_index(index)
// options // options
groups.emplace_back(m_options = new ControlGroup(_trans("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 std::string GCPad::GetName() const

View File

@ -313,7 +313,7 @@ Wiimote::Wiimote( const unsigned int index )
// options // options
groups.emplace_back( m_options = new ControlGroup(_trans("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("Sideways Wiimote"), false));
m_options->settings.emplace_back(new ControlGroup::Setting(_trans("Upright Wiimote"), false)); m_options->settings.emplace_back(new ControlGroup::Setting(_trans("Upright Wiimote"), false));

View File

@ -14,6 +14,7 @@
#include <vector> #include <vector>
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Core/ConfigManager.h"
#include "InputCommon/GCPadStatus.h" #include "InputCommon/GCPadStatus.h"
#include "InputCommon/ControllerInterface/ControllerInterface.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) {} ControlGroup(const std::string& _name, const unsigned int _type = GROUP_TYPE_OTHER) : name(_name), type(_type) {}
virtual ~ControlGroup() {} virtual ~ControlGroup() {}