Merge pull request #917 from lioncash/input
InputCommon: Rename class InputPlugin to InputConfig
This commit is contained in:
commit
24b5ce2ddc
|
@ -15,20 +15,20 @@
|
|||
namespace Pad
|
||||
{
|
||||
|
||||
static InputPlugin g_plugin("GCPadNew", _trans("Pad"), "GCPad");
|
||||
InputPlugin *GetPlugin()
|
||||
static InputConfig s_config("GCPadNew", _trans("Pad"), "GCPad");
|
||||
InputConfig* GetConfig()
|
||||
{
|
||||
return &g_plugin;
|
||||
return &s_config;
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
std::vector<ControllerEmu*>::const_iterator
|
||||
i = g_plugin.controllers.begin(),
|
||||
e = g_plugin.controllers.end();
|
||||
i = s_config.controllers.begin(),
|
||||
e = s_config.controllers.end();
|
||||
for ( ; i!=e; ++i )
|
||||
delete *i;
|
||||
g_plugin.controllers.clear();
|
||||
s_config.controllers.clear();
|
||||
|
||||
g_controller_interface.Shutdown();
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ void Initialize(void* const hwnd)
|
|||
{
|
||||
// add 4 gcpads
|
||||
for (unsigned int i=0; i<4; ++i)
|
||||
g_plugin.controllers.push_back(new GCPad(i));
|
||||
s_config.controllers.push_back(new GCPad(i));
|
||||
|
||||
g_controller_interface.SetHwnd(hwnd);
|
||||
g_controller_interface.Initialize();
|
||||
|
||||
// load the saved controller config
|
||||
g_plugin.LoadConfig(true);
|
||||
s_config.LoadConfig(true);
|
||||
}
|
||||
|
||||
void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus)
|
||||
|
@ -52,7 +52,7 @@ void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus)
|
|||
memset(_pPADStatus, 0, sizeof(*_pPADStatus));
|
||||
_pPADStatus->err = PAD_ERR_NONE;
|
||||
|
||||
std::unique_lock<std::recursive_mutex> lk(g_plugin.controls_lock, std::try_to_lock);
|
||||
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
|
||||
|
||||
if (!lk.owns_lock())
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus)
|
|||
_last_numPAD = _numPAD;
|
||||
|
||||
// get input
|
||||
((GCPad*)g_plugin.controllers[_numPAD])->GetInput(_pPADStatus);
|
||||
((GCPad*)s_config.controllers[_numPAD])->GetInput(_pPADStatus);
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
|
@ -89,7 +89,7 @@ void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus)
|
|||
//
|
||||
void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lk(g_plugin.controls_lock, std::try_to_lock);
|
||||
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
|
||||
|
||||
if (lk.owns_lock())
|
||||
{
|
||||
|
@ -97,11 +97,11 @@ void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
|||
// set rumble
|
||||
if (1 == _uType && _uStrength > 2)
|
||||
{
|
||||
((GCPad*)g_plugin.controllers[ _numPAD ])->SetOutput(255);
|
||||
((GCPad*)s_config.controllers[ _numPAD ])->SetOutput(255);
|
||||
}
|
||||
else
|
||||
{
|
||||
((GCPad*)g_plugin.controllers[ _numPAD ])->SetOutput(0);
|
||||
((GCPad*)s_config.controllers[ _numPAD ])->SetOutput(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
|||
//
|
||||
void Motor(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
||||
{
|
||||
std::unique_lock<std::recursive_mutex> lk(g_plugin.controls_lock, std::try_to_lock);
|
||||
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
|
||||
|
||||
if (lk.owns_lock())
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ void Motor(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
|||
// set rumble
|
||||
if (_uType == 6)
|
||||
{
|
||||
((GCPad*)g_plugin.controllers[ _numPAD ])->SetMotor(_uStrength);
|
||||
((GCPad*)s_config.controllers[ _numPAD ])->SetMotor(_uStrength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,12 +132,12 @@ void Motor(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
|
|||
bool GetMicButton(u8 pad)
|
||||
{
|
||||
|
||||
std::unique_lock<std::recursive_mutex> lk(g_plugin.controls_lock, std::try_to_lock);
|
||||
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
|
||||
|
||||
if (!lk.owns_lock())
|
||||
return false;
|
||||
|
||||
return ((GCPad*)g_plugin.controllers[pad])->GetMicButton();
|
||||
return ((GCPad*)s_config.controllers[pad])->GetMicButton();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Pad
|
|||
void Shutdown();
|
||||
void Initialize(void* const hwnd);
|
||||
|
||||
InputPlugin *GetPlugin();
|
||||
InputConfig* GetConfig();
|
||||
|
||||
void GetStatus(u8 _numPAD, GCPadStatus* _pPADStatus);
|
||||
void Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength);
|
||||
|
|
|
@ -16,21 +16,21 @@
|
|||
namespace Wiimote
|
||||
{
|
||||
|
||||
static InputPlugin g_plugin(WIIMOTE_INI_NAME, _trans("Wiimote"), "Wiimote");
|
||||
static InputConfig s_config(WIIMOTE_INI_NAME, _trans("Wiimote"), "Wiimote");
|
||||
static int s_last_number = 4;
|
||||
|
||||
InputPlugin *GetPlugin()
|
||||
InputConfig* GetConfig()
|
||||
{
|
||||
return &g_plugin;
|
||||
return &s_config;
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
for (const ControllerEmu* i : g_plugin.controllers)
|
||||
for (const ControllerEmu* i : s_config.controllers)
|
||||
{
|
||||
delete i;
|
||||
}
|
||||
g_plugin.controllers.clear();
|
||||
s_config.controllers.clear();
|
||||
|
||||
WiimoteReal::Stop();
|
||||
|
||||
|
@ -42,13 +42,13 @@ void Initialize(void* const hwnd, bool wait)
|
|||
{
|
||||
// add 4 wiimotes
|
||||
for (unsigned int i = WIIMOTE_CHAN_0; i<MAX_BBMOTES; ++i)
|
||||
g_plugin.controllers.push_back(new WiimoteEmu::Wiimote(i));
|
||||
s_config.controllers.push_back(new WiimoteEmu::Wiimote(i));
|
||||
|
||||
|
||||
g_controller_interface.SetHwnd(hwnd);
|
||||
g_controller_interface.Initialize();
|
||||
|
||||
g_plugin.LoadConfig(false);
|
||||
s_config.LoadConfig(false);
|
||||
|
||||
WiimoteReal::Initialize(wait);
|
||||
|
||||
|
@ -83,7 +83,7 @@ void Pause()
|
|||
void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
|
||||
{
|
||||
if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[_number])
|
||||
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->ControlChannel(_channelID, _pData, _Size);
|
||||
((WiimoteEmu::Wiimote*)s_config.controllers[_number])->ControlChannel(_channelID, _pData, _Size);
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
|
@ -101,7 +101,7 @@ void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
|
|||
void InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size)
|
||||
{
|
||||
if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[_number])
|
||||
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->InterruptChannel(_channelID, _pData, _Size);
|
||||
((WiimoteEmu::Wiimote*)s_config.controllers[_number])->InterruptChannel(_channelID, _pData, _Size);
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
|
@ -115,7 +115,7 @@ void Update(int _number)
|
|||
//PanicAlert( "Wiimote_Update" );
|
||||
|
||||
// TODO: change this to a try_to_lock, and make it give empty input on failure
|
||||
std::lock_guard<std::recursive_mutex> lk(g_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(s_config.controls_lock);
|
||||
|
||||
if (_number <= s_last_number)
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ void Update(int _number)
|
|||
s_last_number = _number;
|
||||
|
||||
if (WIIMOTE_SRC_EMU & g_wiimote_sources[_number])
|
||||
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->Update();
|
||||
((WiimoteEmu::Wiimote*)s_config.controllers[_number])->Update();
|
||||
else
|
||||
WiimoteReal::Update(_number);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void DoState(u8 **ptr, PointerWrap::Mode mode)
|
|||
PointerWrap p(ptr, mode);
|
||||
p.Do(s_last_number);
|
||||
for (unsigned int i=0; i<MAX_BBMOTES; ++i)
|
||||
((WiimoteEmu::Wiimote*)g_plugin.controllers[i])->DoState(p);
|
||||
((WiimoteEmu::Wiimote*)s_config.controllers[i])->DoState(p);
|
||||
}
|
||||
|
||||
// ___________________________________________________________________________
|
||||
|
|
|
@ -42,7 +42,7 @@ void Pause();
|
|||
unsigned int GetAttached();
|
||||
void DoState(u8 **ptr, PointerWrap::Mode mode);
|
||||
void EmuStateChange(EMUSTATE_CHANGE newState);
|
||||
InputPlugin *GetPlugin();
|
||||
InputConfig* GetConfig();
|
||||
|
||||
void ControlChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
void InterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
|
|
@ -158,7 +158,7 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const
|
|||
|
||||
auto const data = static_cast<const u8*>(_data);
|
||||
Report rpt(data, data + size);
|
||||
WiimoteEmu::Wiimote *const wm = (WiimoteEmu::Wiimote*)::Wiimote::GetPlugin()->controllers[index];
|
||||
WiimoteEmu::Wiimote *const wm = (WiimoteEmu::Wiimote*)::Wiimote::GetConfig()->controllers[index];
|
||||
|
||||
// Convert output DATA packets to SET_REPORT packets.
|
||||
// Nintendo Wiimotes work without this translation, but 3rd
|
||||
|
@ -347,7 +347,7 @@ void Wiimote::EmuStop()
|
|||
|
||||
void Wiimote::EmuResume()
|
||||
{
|
||||
WiimoteEmu::Wiimote *const wm = (WiimoteEmu::Wiimote*)::Wiimote::GetPlugin()->controllers[index];
|
||||
WiimoteEmu::Wiimote *const wm = (WiimoteEmu::Wiimote*)::Wiimote::GetConfig()->controllers[index];
|
||||
|
||||
m_last_input_report.clear();
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ extern "C" {
|
|||
#include "DolphinWX/resources/Dolphin.c" // NOLINT: Dolphin icon
|
||||
};
|
||||
|
||||
class InputPlugin;
|
||||
class InputConfig;
|
||||
class wxFrame;
|
||||
|
||||
// Create menu items
|
||||
|
@ -1222,7 +1222,7 @@ void CFrame::OnConfigDSP(wxCommandEvent& WXUNUSED (event))
|
|||
|
||||
void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
InputPlugin *const pad_plugin = Pad::GetPlugin();
|
||||
InputConfig* const pad_plugin = Pad::GetConfig();
|
||||
bool was_init = false;
|
||||
if (g_controller_interface.IsInit()) // check if game is running
|
||||
{
|
||||
|
@ -1250,7 +1250,7 @@ void CFrame::OnConfigPAD(wxCommandEvent& WXUNUSED (event))
|
|||
|
||||
void CFrame::OnConfigWiimote(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
InputPlugin *const wiimote_plugin = Wiimote::GetPlugin();
|
||||
InputConfig* const wiimote_plugin = Wiimote::GetConfig();
|
||||
bool was_init = false;
|
||||
if (g_controller_interface.IsInit()) // check if game is running
|
||||
{
|
||||
|
|
|
@ -133,10 +133,10 @@ void PadSettingSpin::UpdateValue()
|
|||
setting->SetValue(float(((wxSpinCtrl*)wxcontrol)->GetValue()) / 100);
|
||||
}
|
||||
|
||||
ControlDialog::ControlDialog(GamepadPage* const parent, InputPlugin& plugin, ControllerInterface::ControlReference* const ref)
|
||||
ControlDialog::ControlDialog(GamepadPage* const parent, InputConfig& config, ControllerInterface::ControlReference* const ref)
|
||||
: wxDialog(parent, -1, _("Configure Control"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
, control_reference(ref)
|
||||
, m_plugin(plugin)
|
||||
, m_config(config)
|
||||
, m_parent(parent)
|
||||
{
|
||||
m_devq = m_parent->controller->default_device;
|
||||
|
@ -177,7 +177,7 @@ void InputConfigDialog::UpdateProfileComboBox()
|
|||
{
|
||||
std::string pname(File::GetUserPath(D_CONFIG_IDX));
|
||||
pname += PROFILES_PATH;
|
||||
pname += m_plugin.profile_name;
|
||||
pname += m_config.profile_name;
|
||||
|
||||
CFileSearch::XStringVector exts;
|
||||
exts.push_back("*.ini");
|
||||
|
@ -210,7 +210,7 @@ void InputConfigDialog::UpdateControlReferences()
|
|||
|
||||
void InputConfigDialog::ClickSave(wxCommandEvent& event)
|
||||
{
|
||||
m_plugin.SaveConfig();
|
||||
m_config.SaveConfig();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ void GamepadPage::ClearAll(wxCommandEvent&)
|
|||
// no point in using the real ControllerInterface i guess
|
||||
ControllerInterface face;
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
controller->UpdateReferences(face);
|
||||
|
||||
UpdateGUI();
|
||||
|
@ -308,7 +308,7 @@ void GamepadPage::LoadDefaults(wxCommandEvent&)
|
|||
{
|
||||
controller->LoadDefaults(g_controller_interface);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
|
||||
UpdateGUI();
|
||||
|
@ -318,7 +318,7 @@ bool ControlDialog::Validate()
|
|||
{
|
||||
control_reference->expression = WxStrToStr(textctrl->GetValue());
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
|
||||
|
||||
UpdateGUI();
|
||||
|
@ -337,7 +337,7 @@ void GamepadPage::SetDevice(wxCommandEvent&)
|
|||
controller->UpdateDefaultDevice();
|
||||
|
||||
// update references
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ void ControlDialog::ClearControl(wxCommandEvent&)
|
|||
{
|
||||
control_reference->expression.clear();
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
|
||||
|
||||
UpdateGUI();
|
||||
|
@ -418,7 +418,7 @@ void ControlDialog::SetSelectedControl(wxCommandEvent&)
|
|||
textctrl->WriteText(expr);
|
||||
control_reference->expression = textctrl->GetValue();
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
|
||||
|
||||
UpdateGUI();
|
||||
|
@ -453,7 +453,7 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
|
|||
textctrl->WriteText(expr);
|
||||
control_reference->expression = textctrl->GetValue();
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
g_controller_interface.UpdateReference(control_reference, m_parent->controller->default_device);
|
||||
|
||||
UpdateGUI();
|
||||
|
@ -461,19 +461,19 @@ void ControlDialog::AppendControl(wxCommandEvent& event)
|
|||
|
||||
void GamepadPage::AdjustSetting(wxCommandEvent& event)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
((PadSetting*)((wxControl*)event.GetEventObject())->GetClientData())->UpdateValue();
|
||||
}
|
||||
|
||||
void GamepadPage::AdjustControlOption(wxCommandEvent&)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
m_control_dialog->control_reference->range = (ControlState)(m_control_dialog->range_slider->GetValue()) / SLIDER_TICK_COUNT;
|
||||
}
|
||||
|
||||
void GamepadPage::ConfigControl(wxEvent& event)
|
||||
{
|
||||
m_control_dialog = new ControlDialog(this, m_plugin, ((ControlButton*)event.GetEventObject())->control_reference);
|
||||
m_control_dialog = new ControlDialog(this, m_config, ((ControlButton*)event.GetEventObject())->control_reference);
|
||||
m_control_dialog->ShowModal();
|
||||
m_control_dialog->Destroy();
|
||||
|
||||
|
@ -487,7 +487,7 @@ void GamepadPage::ClearControl(wxEvent& event)
|
|||
btn->control_reference->expression.clear();
|
||||
btn->control_reference->range = 1.0f;
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
|
||||
// update changes
|
||||
|
@ -507,7 +507,7 @@ void ControlDialog::DetectControl(wxCommandEvent& event)
|
|||
// This makes the "waiting" text work on Linux. true (only if needed) prevents crash on Windows
|
||||
wxTheApp->Yield(true);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
Device::Control* const ctrl = control_reference->Detect(DETECT_WAIT_TIME, dev);
|
||||
|
||||
// if we got input, select it in the list
|
||||
|
@ -531,7 +531,7 @@ void GamepadPage::DetectControl(wxCommandEvent& event)
|
|||
// This makes the "waiting" text work on Linux. true (only if needed) prevents crash on Windows
|
||||
wxTheApp->Yield(true);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
Device::Control* const ctrl = btn->control_reference->Detect(DETECT_WAIT_TIME, dev);
|
||||
|
||||
// if we got input, update expression and reference
|
||||
|
@ -635,7 +635,7 @@ void GamepadPage::GetProfilePath(std::string& path)
|
|||
|
||||
path = File::GetUserPath(D_CONFIG_IDX);
|
||||
path += PROFILES_PATH;
|
||||
path += m_plugin.profile_name;
|
||||
path += m_config.profile_name;
|
||||
path += '/';
|
||||
path += WxStrToStr(profile_cbox->GetValue());
|
||||
path += ".ini";
|
||||
|
@ -653,7 +653,7 @@ void GamepadPage::LoadProfile(wxCommandEvent&)
|
|||
IniFile inifile;
|
||||
inifile.Load(fname);
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
controller->LoadConfig(inifile.GetOrCreateSection("Profile"));
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
|
||||
|
@ -716,7 +716,7 @@ void InputConfigDialog::UpdateDeviceComboBox()
|
|||
|
||||
void GamepadPage::RefreshDevices(wxCommandEvent&)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lk(m_plugin.controls_lock);
|
||||
std::lock_guard<std::recursive_mutex> lk(m_config.controls_lock);
|
||||
|
||||
// refresh devices
|
||||
g_controller_interface.Shutdown();
|
||||
|
@ -932,14 +932,14 @@ ControlGroupsSizer::ControlGroupsSizer(ControllerEmu* const controller, wxWindow
|
|||
Add(stacked_groups, 0, /*wxEXPAND|*/wxBOTTOM|wxRIGHT, 5);
|
||||
}
|
||||
|
||||
GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned int pad_num, InputConfigDialog* const config_dialog)
|
||||
GamepadPage::GamepadPage(wxWindow* parent, InputConfig& config, const unsigned int pad_num, InputConfigDialog* const config_dialog)
|
||||
: wxPanel(parent, wxID_ANY)
|
||||
,controller(plugin.controllers[pad_num])
|
||||
,controller(config.controllers[pad_num])
|
||||
, m_config_dialog(config_dialog)
|
||||
, m_plugin(plugin)
|
||||
, m_config(config)
|
||||
{
|
||||
|
||||
wxBoxSizer* control_group_sizer = new ControlGroupsSizer(m_plugin.controllers[pad_num], this, this, &control_groups);
|
||||
wxBoxSizer* control_group_sizer = new ControlGroupsSizer(m_config.controllers[pad_num], this, this, &control_groups);
|
||||
|
||||
wxStaticBoxSizer* profile_sbox = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Profile"));
|
||||
|
||||
|
@ -1001,16 +1001,16 @@ GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned i
|
|||
};
|
||||
|
||||
|
||||
InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputPlugin& plugin, const std::string& name, const int tab_num)
|
||||
InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputConfig& config, const std::string& name, const int tab_num)
|
||||
: wxDialog(parent, wxID_ANY, wxGetTranslation(StrToWxStr(name)), wxPoint(128,-1))
|
||||
, m_plugin(plugin)
|
||||
, m_config(config)
|
||||
{
|
||||
m_pad_notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT);
|
||||
for (unsigned int i = 0; i < std::min(plugin.controllers.size(), (size_t)MAX_WIIMOTES); ++i)
|
||||
for (unsigned int i = 0; i < std::min(config.controllers.size(), (size_t)MAX_WIIMOTES); ++i)
|
||||
{
|
||||
GamepadPage* gp = new GamepadPage(m_pad_notebook, m_plugin, i, this);
|
||||
GamepadPage* gp = new GamepadPage(m_pad_notebook, m_config, i, this);
|
||||
m_padpages.push_back(gp);
|
||||
m_pad_notebook->AddPage(gp, wxString::Format("%s %u", wxGetTranslation(StrToWxStr(m_plugin.gui_name)), 1+i));
|
||||
m_pad_notebook->AddPage(gp, wxString::Format("%s %u", wxGetTranslation(StrToWxStr(m_config.gui_name)), 1+i));
|
||||
}
|
||||
|
||||
m_pad_notebook->SetSelection(tab_num);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
#include "InputCommon/ControllerInterface/Device.h"
|
||||
|
||||
class InputPlugin;
|
||||
class InputConfig;
|
||||
class wxComboBox;
|
||||
class wxCommandEvent;
|
||||
class wxEvent;
|
||||
|
@ -95,7 +95,7 @@ class GamepadPage;
|
|||
class ControlDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
ControlDialog(GamepadPage* const parent, InputPlugin& plugin, ControllerInterface::ControlReference* const ref);
|
||||
ControlDialog(GamepadPage* const parent, InputConfig& config, ControllerInterface::ControlReference* const ref);
|
||||
|
||||
wxStaticBoxSizer* CreateControlChooser(GamepadPage* const parent);
|
||||
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
void AppendControl(wxCommandEvent& event);
|
||||
|
||||
ControllerInterface::ControlReference* const control_reference;
|
||||
InputPlugin& m_plugin;
|
||||
InputConfig& m_config;
|
||||
wxComboBox* device_cbox;
|
||||
|
||||
wxTextCtrl* textctrl;
|
||||
|
@ -173,7 +173,7 @@ class GamepadPage : public wxPanel
|
|||
friend class ControlDialog;
|
||||
|
||||
public:
|
||||
GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned int pad_num, InputConfigDialog* const config_dialog);
|
||||
GamepadPage(wxWindow* parent, InputConfig& config, const unsigned int pad_num, InputConfigDialog* const config_dialog);
|
||||
|
||||
void UpdateGUI();
|
||||
|
||||
|
@ -212,13 +212,13 @@ private:
|
|||
|
||||
ControlDialog* m_control_dialog;
|
||||
InputConfigDialog* const m_config_dialog;
|
||||
InputPlugin &m_plugin;
|
||||
InputConfig& m_config;
|
||||
};
|
||||
|
||||
class InputConfigDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
InputConfigDialog(wxWindow* const parent, InputPlugin& plugin, const std::string& name, const int tab_num = 0);
|
||||
InputConfigDialog(wxWindow* const parent, InputConfig& config, const std::string& name, const int tab_num = 0);
|
||||
//~InputConfigDialog();
|
||||
|
||||
bool Destroy() override;
|
||||
|
@ -235,6 +235,6 @@ private:
|
|||
|
||||
wxNotebook* m_pad_notebook;
|
||||
std::vector<GamepadPage*> m_padpages;
|
||||
InputPlugin& m_plugin;
|
||||
InputConfig& m_config;
|
||||
wxTimer* m_update_timer;
|
||||
};
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
#include "DolphinWX/InputConfigDiag.h"
|
||||
#include "DolphinWX/WiimoteConfigDiag.h"
|
||||
|
||||
class InputPlugin;
|
||||
class InputConfig;
|
||||
|
||||
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin)
|
||||
WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputConfig& config)
|
||||
: wxDialog(parent, -1, _("Dolphin Wiimote Configuration"))
|
||||
, m_plugin(plugin)
|
||||
, m_config(config)
|
||||
{
|
||||
wxBoxSizer* const main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
|
@ -230,7 +230,7 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin
|
|||
|
||||
void WiimoteConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev)
|
||||
{
|
||||
InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, m_plugin, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
|
||||
InputConfigDialog* const m_emu_config_diag = new InputConfigDialog(this, m_config, _trans("Dolphin Emulated Wiimote Configuration"), m_wiimote_index_from_conf_bt_id[ev.GetId()]);
|
||||
m_emu_config_diag->ShowModal();
|
||||
m_emu_config_diag->Destroy();
|
||||
}
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
|
||||
class InputPlugin;
|
||||
class InputConfig;
|
||||
class wxButton;
|
||||
class wxWindow;
|
||||
|
||||
class WiimoteConfigDiag : public wxDialog
|
||||
{
|
||||
public:
|
||||
WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin);
|
||||
WiimoteConfigDiag(wxWindow* const parent, InputConfig& config);
|
||||
|
||||
void RefreshRealWiimotes(wxCommandEvent& event);
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
private:
|
||||
void Cancel(wxCommandEvent& event);
|
||||
|
||||
InputPlugin& m_plugin;
|
||||
InputConfig& m_config;
|
||||
|
||||
std::map<wxWindowID, unsigned int> m_wiimote_index_from_ctrl_id;
|
||||
unsigned int m_orig_wiimote_sources[MAX_BBMOTES];
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
#include "Core/HW/Wiimote.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
InputPlugin::~InputPlugin()
|
||||
InputConfig::~InputConfig()
|
||||
{
|
||||
// delete pads
|
||||
for (ControllerEmu* pad : controllers)
|
||||
delete pad;
|
||||
}
|
||||
|
||||
bool InputPlugin::LoadConfig(bool isGC)
|
||||
bool InputConfig::LoadConfig(bool isGC)
|
||||
{
|
||||
IniFile inifile;
|
||||
IniFile game_ini;
|
||||
|
@ -94,7 +94,7 @@ bool InputPlugin::LoadConfig(bool isGC)
|
|||
}
|
||||
}
|
||||
|
||||
void InputPlugin::SaveConfig()
|
||||
void InputConfig::SaveConfig()
|
||||
{
|
||||
std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + ini_name + ".ini";
|
||||
|
||||
|
|
|
@ -14,17 +14,14 @@
|
|||
#include "InputCommon/ControllerEmu.h"
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
||||
// InputPlugin isn't a very good name anymore since it's used by GCPad/Wiimote
|
||||
// which are not even plugins anymore.
|
||||
class InputPlugin
|
||||
class InputConfig
|
||||
{
|
||||
public:
|
||||
|
||||
InputPlugin(const char* const _ini_name, const char* const _gui_name,
|
||||
InputConfig(const char* const _ini_name, const char* const _gui_name,
|
||||
const char* const _profile_name)
|
||||
: ini_name(_ini_name), gui_name(_gui_name), profile_name(_profile_name) {}
|
||||
|
||||
~InputPlugin();
|
||||
~InputConfig();
|
||||
|
||||
bool LoadConfig(bool isGC);
|
||||
void SaveConfig();
|
||||
|
|
Loading…
Reference in New Issue