|
|
@ -19,8 +19,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
#define _connect_macro_( b, f, c, s ) (b)->Connect( wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s )
|
|
|
|
#define _connect_macro_( b, f, c, s ) (b)->Connect( wxID_ANY, (c), wxCommandEventHandler( f ), (wxObject*)0, (wxEvtHandler*)s )
|
|
|
|
|
|
|
|
|
|
|
|
static Plugin* g_plugin;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GamepadPage::ConfigExtension( wxCommandEvent& event )
|
|
|
|
void GamepadPage::ConfigExtension( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ControllerEmu::Extension* const ex = ((ExtensionButton*)event.GetEventObject())->extension;
|
|
|
|
ControllerEmu::Extension* const ex = ((ExtensionButton*)event.GetEventObject())->extension;
|
|
|
@ -102,8 +100,9 @@ void PadSettingChoice::UpdateValue()
|
|
|
|
value = float(GetValue()) / 100;
|
|
|
|
value = float(GetValue()) / 100;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ControlDialog::ControlDialog( wxWindow* const parent, ControllerInterface::ControlReference* const ref, const std::vector<ControllerInterface::Device*>& devs )
|
|
|
|
ControlDialog::ControlDialog( wxWindow* const parent, InputPlugin& plugin, ControllerInterface::ControlReference* const ref, const std::vector<ControllerInterface::Device*>& devs )
|
|
|
|
:wxDialog( parent, -1, wxT("Configure Control"), wxDefaultPosition )
|
|
|
|
:wxDialog( parent, -1, wxT("Configure Control"), wxDefaultPosition )
|
|
|
|
|
|
|
|
,m_plugin(plugin)
|
|
|
|
,control_reference(ref)
|
|
|
|
,control_reference(ref)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -144,10 +143,11 @@ ControlButton::ControlButton( wxWindow* const parent, ControllerInterface::Contr
|
|
|
|
SetLabel( wxString::FromAscii( label.c_str() ) );
|
|
|
|
SetLabel( wxString::FromAscii( label.c_str() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ConfigDialog::UpdateProfileComboBox()
|
|
|
|
void InputConfigDialog::UpdateProfileComboBox()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string pname( File::GetUserPath(D_CONFIG_IDX) );
|
|
|
|
std::string pname( File::GetUserPath(D_CONFIG_IDX) );
|
|
|
|
pname += PROFILES_PATH; pname += g_plugin->profile_name;
|
|
|
|
pname += PROFILES_PATH;
|
|
|
|
|
|
|
|
pname += m_plugin.profile_name;
|
|
|
|
|
|
|
|
|
|
|
|
CFileSearch::XStringVector exts;
|
|
|
|
CFileSearch::XStringVector exts;
|
|
|
|
exts.push_back("*.ini");
|
|
|
|
exts.push_back("*.ini");
|
|
|
@ -174,17 +174,17 @@ void ConfigDialog::UpdateProfileComboBox()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ConfigDialog::UpdateControlReferences()
|
|
|
|
void InputConfigDialog::UpdateControlReferences()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::vector< GamepadPage* >::iterator i = m_padpages.begin(),
|
|
|
|
std::vector< GamepadPage* >::iterator i = m_padpages.begin(),
|
|
|
|
e = m_padpages.end();
|
|
|
|
e = m_padpages.end();
|
|
|
|
for ( ; i != e; ++i )
|
|
|
|
for ( ; i != e; ++i )
|
|
|
|
(*i)->controller->UpdateReferences( g_plugin->controller_interface );
|
|
|
|
(*i)->controller->UpdateReferences( m_plugin.controller_interface );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ConfigDialog::ClickSave( wxCommandEvent& event )
|
|
|
|
void InputConfigDialog::ClickSave( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_plugin->SaveConfig();
|
|
|
|
m_plugin.SaveConfig();
|
|
|
|
Close();
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -279,7 +279,7 @@ void GamepadPage::UpdateGUI()
|
|
|
|
|
|
|
|
|
|
|
|
void GamepadPage::ClearAll( wxCommandEvent& event )
|
|
|
|
void GamepadPage::ClearAll( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
|
|
|
|
|
|
|
|
// just load an empty ini section to clear everything :P
|
|
|
|
// just load an empty ini section to clear everything :P
|
|
|
|
IniFile::Section section;
|
|
|
|
IniFile::Section section;
|
|
|
@ -291,7 +291,7 @@ void GamepadPage::ClearAll( wxCommandEvent& event )
|
|
|
|
|
|
|
|
|
|
|
|
UpdateGUI();
|
|
|
|
UpdateGUI();
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlDialog::SetControl( wxCommandEvent& event )
|
|
|
|
void ControlDialog::SetControl( wxCommandEvent& event )
|
|
|
@ -299,9 +299,9 @@ void ControlDialog::SetControl( wxCommandEvent& event )
|
|
|
|
control_reference->control_qualifier.name =
|
|
|
|
control_reference->control_qualifier.name =
|
|
|
|
std::string( control_chooser->textctrl->GetValue().ToAscii() );
|
|
|
|
std::string( control_chooser->textctrl->GetValue().ToAscii() );
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
control_reference->UpdateControls();
|
|
|
|
control_reference->UpdateControls();
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
|
|
|
|
|
|
|
|
control_chooser->UpdateListSelection();
|
|
|
|
control_chooser->UpdateListSelection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -317,9 +317,9 @@ void GamepadPage::SetDevice( wxCommandEvent& event )
|
|
|
|
controller->UpdateDefaultDevice();
|
|
|
|
controller->UpdateDefaultDevice();
|
|
|
|
|
|
|
|
|
|
|
|
// update references
|
|
|
|
// update references
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
controller->UpdateReferences( g_plugin->controller_interface );
|
|
|
|
controller->UpdateReferences( m_plugin.controller_interface );
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ControlDialog::SetDevice( wxCommandEvent& event )
|
|
|
|
void ControlDialog::SetDevice( wxCommandEvent& event )
|
|
|
@ -330,9 +330,9 @@ void ControlDialog::SetDevice( wxCommandEvent& event )
|
|
|
|
device_cbox->SetValue( wxString::FromAscii( control_reference->device_qualifier.ToString().c_str() ) );
|
|
|
|
device_cbox->SetValue( wxString::FromAscii( control_reference->device_qualifier.ToString().c_str() ) );
|
|
|
|
|
|
|
|
|
|
|
|
// update references
|
|
|
|
// update references
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
g_plugin->controller_interface.UpdateReference( control_reference );
|
|
|
|
m_plugin.controller_interface.UpdateReference( control_reference );
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
|
|
|
|
|
|
|
|
// update gui
|
|
|
|
// update gui
|
|
|
|
control_chooser->UpdateListContents();
|
|
|
|
control_chooser->UpdateListContents();
|
|
|
@ -342,26 +342,26 @@ void ControlDialog::ClearControl( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
control_reference->control_qualifier.name.clear();
|
|
|
|
control_reference->control_qualifier.name.clear();
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Leave(); // enter
|
|
|
|
m_plugin.controls_crit.Leave(); // enter
|
|
|
|
control_reference->UpdateControls();
|
|
|
|
control_reference->UpdateControls();
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
|
|
|
|
|
|
|
|
control_chooser->UpdateListSelection();
|
|
|
|
control_chooser->UpdateListSelection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GamepadPage::AdjustSetting( wxCommandEvent& event )
|
|
|
|
void GamepadPage::AdjustSetting( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
|
|
|
|
|
|
|
|
// updates the setting value from the GUI control
|
|
|
|
// updates the setting value from the GUI control
|
|
|
|
(dynamic_cast<PadSetting*>(event.GetEventObject()))->UpdateValue();
|
|
|
|
(dynamic_cast<PadSetting*>(event.GetEventObject()))->UpdateValue();
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GamepadPage::AdjustControlOption( wxCommandEvent& event )
|
|
|
|
void GamepadPage::AdjustControlOption( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
|
|
|
|
|
|
|
|
m_control_dialog->control_reference->range = ControlState( m_control_dialog->control_chooser->range_slider->GetValue() ) / SLIDER_TICK_COUNT;
|
|
|
|
m_control_dialog->control_reference->range = ControlState( m_control_dialog->control_chooser->range_slider->GetValue() ) / SLIDER_TICK_COUNT;
|
|
|
|
|
|
|
|
|
|
|
@ -369,12 +369,12 @@ void GamepadPage::AdjustControlOption( wxCommandEvent& event )
|
|
|
|
((ControllerInterface::InputReference*)m_control_dialog->control_reference)->mode =
|
|
|
|
((ControllerInterface::InputReference*)m_control_dialog->control_reference)->mode =
|
|
|
|
m_control_dialog->control_chooser->mode_cbox->GetSelection();
|
|
|
|
m_control_dialog->control_chooser->mode_cbox->GetSelection();
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GamepadPage::ConfigControl( wxCommandEvent& event )
|
|
|
|
void GamepadPage::ConfigControl( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_control_dialog = new ControlDialog( this, ((ControlButton*)event.GetEventObject())->control_reference, g_plugin->controller_interface.Devices() );
|
|
|
|
m_control_dialog = new ControlDialog( this, m_plugin, ((ControlButton*)event.GetEventObject())->control_reference, m_plugin.controller_interface.Devices() );
|
|
|
|
m_control_dialog->ShowModal();
|
|
|
|
m_control_dialog->ShowModal();
|
|
|
|
m_control_dialog->Destroy();
|
|
|
|
m_control_dialog->Destroy();
|
|
|
|
|
|
|
|
|
|
|
@ -388,11 +388,11 @@ void GamepadPage::ClearControl( wxCommandEvent& event )
|
|
|
|
btn->control_reference->control_qualifier.name.clear();
|
|
|
|
btn->control_reference->control_qualifier.name.clear();
|
|
|
|
btn->control_reference->device_qualifier = controller->default_device;
|
|
|
|
btn->control_reference->device_qualifier = controller->default_device;
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Enter();
|
|
|
|
m_plugin.controls_crit.Enter();
|
|
|
|
if (btn->control_reference->is_input)
|
|
|
|
if (btn->control_reference->is_input)
|
|
|
|
((ControllerInterface::InputReference*)btn->control_reference)->mode = 0;
|
|
|
|
((ControllerInterface::InputReference*)btn->control_reference)->mode = 0;
|
|
|
|
controller->UpdateReferences( g_plugin->controller_interface );
|
|
|
|
controller->UpdateReferences( m_plugin.controller_interface );
|
|
|
|
g_plugin->controls_crit.Leave();
|
|
|
|
m_plugin.controls_crit.Leave();
|
|
|
|
|
|
|
|
|
|
|
|
// update changes
|
|
|
|
// update changes
|
|
|
|
UpdateGUI();
|
|
|
|
UpdateGUI();
|
|
|
@ -416,10 +416,10 @@ void ControlDialog::DetectControl( wxCommandEvent& event )
|
|
|
|
btn->SetLabel(wxT("w"));
|
|
|
|
btn->SetLabel(wxT("w"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
if ( control_reference->Detect( DETECT_WAIT_TIME + (num - 1) * 500, num ) ) // if we got input, update gui
|
|
|
|
if ( control_reference->Detect( DETECT_WAIT_TIME + (num - 1) * 500, num ) ) // if we got input, update gui
|
|
|
|
control_chooser->UpdateListSelection();
|
|
|
|
control_chooser->UpdateListSelection();
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
|
|
|
|
|
|
|
|
btn->SetLabel(lbl);
|
|
|
|
btn->SetLabel(lbl);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -430,9 +430,9 @@ void GamepadPage::DetectControl( wxCommandEvent& event )
|
|
|
|
|
|
|
|
|
|
|
|
btn->SetLabel(wxT("[ waiting ]"));
|
|
|
|
btn->SetLabel(wxT("[ waiting ]"));
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
btn->control_reference->Detect( DETECT_WAIT_TIME );
|
|
|
|
btn->control_reference->Detect( DETECT_WAIT_TIME );
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
|
|
|
|
|
|
|
|
btn->SetLabel(wxString::FromAscii(btn->control_reference->control_qualifier.name.c_str()));
|
|
|
|
btn->SetLabel(wxString::FromAscii(btn->control_reference->control_qualifier.name.c_str()));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -463,9 +463,9 @@ void ControlDialog::SelectControl( wxCommandEvent& event )
|
|
|
|
control_reference->control_qualifier.name =
|
|
|
|
control_reference->control_qualifier.name =
|
|
|
|
std::string( final_label.ToAscii() );
|
|
|
|
std::string( final_label.ToAscii() );
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
control_reference->UpdateControls();
|
|
|
|
control_reference->UpdateControls();
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
|
|
|
|
|
|
|
|
control_chooser->UpdateGUI();
|
|
|
|
control_chooser->UpdateGUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -549,10 +549,10 @@ void GamepadPage::LoadProfile( wxCommandEvent& event )
|
|
|
|
if ( profile_cbox->GetValue().empty() )
|
|
|
|
if ( profile_cbox->GetValue().empty() )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Enter();
|
|
|
|
m_plugin.controls_crit.Enter();
|
|
|
|
|
|
|
|
|
|
|
|
std::string fname( File::GetUserPath(D_CONFIG_IDX) );
|
|
|
|
std::string fname( File::GetUserPath(D_CONFIG_IDX) );
|
|
|
|
fname += PROFILES_PATH; fname += g_plugin->profile_name; fname += '/';
|
|
|
|
fname += PROFILES_PATH; fname += m_plugin.profile_name; fname += '/';
|
|
|
|
fname += profile_cbox->GetValue().ToAscii(); fname += ".ini";
|
|
|
|
fname += profile_cbox->GetValue().ToAscii(); fname += ".ini";
|
|
|
|
|
|
|
|
|
|
|
|
if ( false == File::Exists( fname.c_str() ) )
|
|
|
|
if ( false == File::Exists( fname.c_str() ) )
|
|
|
@ -561,9 +561,9 @@ void GamepadPage::LoadProfile( wxCommandEvent& event )
|
|
|
|
IniFile inifile;
|
|
|
|
IniFile inifile;
|
|
|
|
inifile.Load(fname);
|
|
|
|
inifile.Load(fname);
|
|
|
|
controller->LoadConfig( inifile.GetOrCreateSection("Profile"));
|
|
|
|
controller->LoadConfig( inifile.GetOrCreateSection("Profile"));
|
|
|
|
controller->UpdateReferences( g_plugin->controller_interface );
|
|
|
|
controller->UpdateReferences( m_plugin.controller_interface );
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Leave();
|
|
|
|
m_plugin.controls_crit.Leave();
|
|
|
|
UpdateGUI();
|
|
|
|
UpdateGUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -574,7 +574,7 @@ void GamepadPage::SaveProfile( wxCommandEvent& event )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
std::string fname( File::GetUserPath(D_CONFIG_IDX) );
|
|
|
|
std::string fname( File::GetUserPath(D_CONFIG_IDX) );
|
|
|
|
fname += PROFILES_PATH; fname += g_plugin->profile_name; fname += '/';
|
|
|
|
fname += PROFILES_PATH; fname += m_plugin.profile_name; fname += '/';
|
|
|
|
if ( false == File::Exists( fname.c_str() ) )
|
|
|
|
if ( false == File::Exists( fname.c_str() ) )
|
|
|
|
File::CreateFullPath( fname.c_str() );
|
|
|
|
File::CreateFullPath( fname.c_str() );
|
|
|
|
fname += profile_cbox->GetValue().ToAscii(); fname += ".ini";
|
|
|
|
fname += profile_cbox->GetValue().ToAscii(); fname += ".ini";
|
|
|
@ -596,7 +596,7 @@ void GamepadPage::DeleteProfile( wxCommandEvent& event )
|
|
|
|
|
|
|
|
|
|
|
|
// don't need lock
|
|
|
|
// don't need lock
|
|
|
|
std::string fname( File::GetUserPath(D_CONFIG_IDX) );
|
|
|
|
std::string fname( File::GetUserPath(D_CONFIG_IDX) );
|
|
|
|
fname += PROFILES_PATH; fname += g_plugin->profile_name; fname += '/';
|
|
|
|
fname += PROFILES_PATH; fname += m_plugin.profile_name; fname += '/';
|
|
|
|
fname += profile_cbox->GetValue().ToAscii(); fname += ".ini";
|
|
|
|
fname += profile_cbox->GetValue().ToAscii(); fname += ".ini";
|
|
|
|
if ( File::Exists( fname.c_str() ) )
|
|
|
|
if ( File::Exists( fname.c_str() ) )
|
|
|
|
File::Delete( fname.c_str() );
|
|
|
|
File::Delete( fname.c_str() );
|
|
|
@ -604,7 +604,7 @@ void GamepadPage::DeleteProfile( wxCommandEvent& event )
|
|
|
|
m_config_dialog->UpdateProfileComboBox();
|
|
|
|
m_config_dialog->UpdateProfileComboBox();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ConfigDialog::UpdateDeviceComboBox()
|
|
|
|
void InputConfigDialog::UpdateDeviceComboBox()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::vector< GamepadPage* >::iterator i = m_padpages.begin(),
|
|
|
|
std::vector< GamepadPage* >::iterator i = m_padpages.begin(),
|
|
|
|
e = m_padpages.end();
|
|
|
|
e = m_padpages.end();
|
|
|
@ -612,8 +612,8 @@ void ConfigDialog::UpdateDeviceComboBox()
|
|
|
|
for ( ; i != e; ++i )
|
|
|
|
for ( ; i != e; ++i )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*i)->device_cbox->Clear();
|
|
|
|
(*i)->device_cbox->Clear();
|
|
|
|
std::vector<ControllerInterface::Device*>::const_iterator di = g_plugin->controller_interface.Devices().begin(),
|
|
|
|
std::vector<ControllerInterface::Device*>::const_iterator di = m_plugin.controller_interface.Devices().begin(),
|
|
|
|
de = g_plugin->controller_interface.Devices().end();
|
|
|
|
de = m_plugin.controller_interface.Devices().end();
|
|
|
|
for ( ; di!=de; ++di )
|
|
|
|
for ( ; di!=de; ++di )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dq.FromDevice( *di );
|
|
|
|
dq.FromDevice( *di );
|
|
|
@ -625,12 +625,12 @@ void ConfigDialog::UpdateDeviceComboBox()
|
|
|
|
|
|
|
|
|
|
|
|
void GamepadPage::RefreshDevices( wxCommandEvent& event )
|
|
|
|
void GamepadPage::RefreshDevices( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_plugin->controls_crit.Enter(); // enter
|
|
|
|
m_plugin.controls_crit.Enter(); // enter
|
|
|
|
|
|
|
|
|
|
|
|
// refresh devices
|
|
|
|
// refresh devices
|
|
|
|
// TODO: remove hackery of not deinting SDL
|
|
|
|
// TODO: remove hackery of not deinting SDL
|
|
|
|
g_plugin->controller_interface.DeInit(true);
|
|
|
|
m_plugin.controller_interface.DeInit(true);
|
|
|
|
g_plugin->controller_interface.Init();
|
|
|
|
m_plugin.controller_interface.Init();
|
|
|
|
|
|
|
|
|
|
|
|
// update all control references
|
|
|
|
// update all control references
|
|
|
|
m_config_dialog->UpdateControlReferences();
|
|
|
|
m_config_dialog->UpdateControlReferences();
|
|
|
@ -638,7 +638,7 @@ void GamepadPage::RefreshDevices( wxCommandEvent& event )
|
|
|
|
// update device cbox
|
|
|
|
// update device cbox
|
|
|
|
m_config_dialog->UpdateDeviceComboBox();
|
|
|
|
m_config_dialog->UpdateDeviceComboBox();
|
|
|
|
|
|
|
|
|
|
|
|
g_plugin->controls_crit.Leave(); // leave
|
|
|
|
m_plugin.controls_crit.Leave(); // leave
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ControlGroupBox::ControlGroupBox( ControllerEmu::ControlGroup* const group, wxWindow* const parent, wxWindow* const eventsink )
|
|
|
|
ControlGroupBox::ControlGroupBox( ControllerEmu::ControlGroup* const group, wxWindow* const parent, wxWindow* const eventsink )
|
|
|
@ -843,13 +843,14 @@ ControlGroupsSizer::ControlGroupsSizer( ControllerEmu* const controller, wxWindo
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GamepadPage::GamepadPage( wxWindow* parent, const unsigned int pad_num, ConfigDialog* const config_dialog )
|
|
|
|
GamepadPage::GamepadPage( wxWindow* parent, InputPlugin& plugin, const unsigned int pad_num, InputConfigDialog* const config_dialog )
|
|
|
|
: wxNotebookPage( parent, -1 , wxDefaultPosition, wxDefaultSize )
|
|
|
|
: wxNotebookPage( parent, -1 , wxDefaultPosition, wxDefaultSize )
|
|
|
|
,controller(g_plugin->controllers[pad_num])
|
|
|
|
,m_plugin(plugin)
|
|
|
|
|
|
|
|
,controller(plugin.controllers[pad_num])
|
|
|
|
,m_config_dialog(config_dialog)
|
|
|
|
,m_config_dialog(config_dialog)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
wxBoxSizer* control_group_sizer = new ControlGroupsSizer( g_plugin->controllers[pad_num], this, this, &control_groups );
|
|
|
|
wxBoxSizer* control_group_sizer = new ControlGroupsSizer( m_plugin.controllers[pad_num], this, this, &control_groups );
|
|
|
|
|
|
|
|
|
|
|
|
wxStaticBoxSizer* profile_sbox = new wxStaticBoxSizer( wxHORIZONTAL, this, wxT("Profile") );
|
|
|
|
wxStaticBoxSizer* profile_sbox = new wxStaticBoxSizer( wxHORIZONTAL, this, wxT("Profile") );
|
|
|
|
|
|
|
|
|
|
|
@ -905,32 +906,26 @@ GamepadPage::GamepadPage( wxWindow* parent, const unsigned int pad_num, ConfigDi
|
|
|
|
Layout();
|
|
|
|
Layout();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ConfigDialog::~ConfigDialog()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_update_timer->Stop();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConfigDialog::ConfigDialog( wxWindow* const parent, Plugin& plugin, const std::string& name, const bool _is_game_running )
|
|
|
|
InputConfigDialog::InputConfigDialog( wxWindow* const parent, InputPlugin& plugin, const std::string& name, const bool _is_game_running )
|
|
|
|
: wxDialog( parent, wxID_ANY, wxString::FromAscii(name.c_str()), wxPoint(128,-1), wxDefaultSize )
|
|
|
|
: wxDialog( parent, wxID_ANY, wxString::FromAscii(name.c_str()), wxPoint(128,-1), wxDefaultSize )
|
|
|
|
, is_game_running(_is_game_running)
|
|
|
|
, is_game_running(_is_game_running)
|
|
|
|
, m_plugin(plugin)
|
|
|
|
, m_plugin(plugin)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
g_plugin = &plugin;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pad_notebook = new wxNotebook( this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT );
|
|
|
|
m_pad_notebook = new wxNotebook( this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT );
|
|
|
|
for ( unsigned int i = 0; i < plugin.controllers.size(); ++i )
|
|
|
|
for ( unsigned int i = 0; i < plugin.controllers.size(); ++i )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GamepadPage* gp = new GamepadPage( m_pad_notebook, i, this );
|
|
|
|
GamepadPage* gp = new GamepadPage( m_pad_notebook, m_plugin, i, this );
|
|
|
|
m_padpages.push_back( gp );
|
|
|
|
m_padpages.push_back( gp );
|
|
|
|
m_pad_notebook->AddPage( gp, wxString::FromAscii( g_plugin->gui_name ) + wxT(' ') + wxChar('1'+i) );
|
|
|
|
m_pad_notebook->AddPage( gp, wxString::FromAscii( m_plugin.gui_name ) + wxT(' ') + wxChar('1'+i) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UpdateDeviceComboBox();
|
|
|
|
UpdateDeviceComboBox();
|
|
|
|
UpdateProfileComboBox();
|
|
|
|
UpdateProfileComboBox();
|
|
|
|
|
|
|
|
|
|
|
|
wxButton* const close_button = new wxButton( this, -1, wxT("Save"));
|
|
|
|
wxButton* const close_button = new wxButton( this, -1, wxT("Save"));
|
|
|
|
_connect_macro_(close_button, ConfigDialog::ClickSave, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
|
|
|
_connect_macro_(close_button, InputConfigDialog::ClickSave, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
|
|
|
_connect_macro_(close_button, ConfigDialog::ClickSave, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
|
|
|
_connect_macro_(close_button, InputConfigDialog::ClickSave, wxEVT_COMMAND_BUTTON_CLICKED, this);
|
|
|
|
|
|
|
|
|
|
|
|
wxBoxSizer* btns = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
wxBoxSizer* btns = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
//btns->Add( new wxStaticText( this, -1, wxString::FromAscii(ver.c_str())), 0, wxLEFT|wxTOP, 5 );
|
|
|
|
//btns->Add( new wxStaticText( this, -1, wxString::FromAscii(ver.c_str())), 0, wxLEFT|wxTOP, 5 );
|
|
|
@ -950,8 +945,13 @@ ConfigDialog::ConfigDialog( wxWindow* const parent, Plugin& plugin, const std::s
|
|
|
|
|
|
|
|
|
|
|
|
// live preview update timer
|
|
|
|
// live preview update timer
|
|
|
|
m_update_timer = new wxTimer( this, -1 );
|
|
|
|
m_update_timer = new wxTimer( this, -1 );
|
|
|
|
Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( ConfigDialog::UpdateBitmaps ), (wxObject*)0, this );
|
|
|
|
Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( InputConfigDialog::UpdateBitmaps ), (wxObject*)0, this );
|
|
|
|
m_update_timer->Start( PREVIEW_UPDATE_TIME, wxTIMER_CONTINUOUS);
|
|
|
|
m_update_timer->Start( PREVIEW_UPDATE_TIME, wxTIMER_CONTINUOUS);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InputConfigDialog::~InputConfigDialog()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_update_timer->Stop();
|
|
|
|
|
|
|
|
}
|