[Soap] Roll back inputcommon changes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2203 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-02-10 12:40:06 +00:00
parent cf5fc063ce
commit 3e9b3b266a
15 changed files with 854 additions and 592 deletions

View File

@ -39,7 +39,7 @@
#include "../nJoy.h"
#include "Images/controller.xpm"
extern bool g_EmulatorRunning;
extern bool emulator_running;
// D-Pad type
static const char* DPadType[] =
@ -74,7 +74,7 @@ BEGIN_EVENT_TABLE(ConfigBox,wxDialog)
// Other settings
EVT_CHECKBOX(IDC_SAVEBYID, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDC_SHOWADVANCED, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDCB_CHECKFOCUS, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDC_CHECKFOCUS, ConfigBox::ChangeSettings)
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings)
EVT_COMBOBOX(IDC_CONTROLTYPE, ConfigBox::ChangeSettings)
EVT_COMBOBOX(IDC_TRIGGERTYPE, ConfigBox::ChangeSettings)
@ -83,7 +83,6 @@ BEGIN_EVENT_TABLE(ConfigBox,wxDialog)
// Advanced settings
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDCB_FILTER_SETTINGS, ConfigBox::ChangeSettings)
EVT_BUTTON(IDB_SHOULDER_L, ConfigBox::GetButtons)
EVT_BUTTON(IDB_SHOULDER_R, ConfigBox::GetButtons)
@ -162,7 +161,7 @@ void ConfigBox::OnKeyDown(wxKeyEvent& event)
void ConfigBox::OnClose(wxCloseEvent& /*event*/)
{
EndModal(0);
if(!g_EmulatorRunning) Shutdown(); // Close pads, unless we are running a game
if(!emulator_running) Shutdown(); // Close pads, unless we are running a game
}
// Call about dialog
@ -292,8 +291,7 @@ void ConfigBox::OnSaveById()
// Change Joystick
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/* Function: When changing the joystick we save and load the settings and update the PadMapping
and PadState array. PadState[].joy is the gamepad handle that is used to access the pad throughout
the plugin. Joyinfo[].joy is only used the first time the pads are checked. */
and PadState array */
void ConfigBox::DoChangeJoystick()
{
// Close the current pad, unless it's used by another slot
@ -427,34 +425,16 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event )
}
SizeWindow();
break;
// Advanced settings
case IDCB_CHECKFOCUS:
case IDC_CHECKFOCUS:
g_Config.bCheckFocus = m_CBCheckFocus[notebookpage]->IsChecked();
for(int i = 0; i < 4; i++)
{
m_CBCheckFocus[i]->SetValue(g_Config.bCheckFocus);
}
break;
case IDCB_FILTER_SETTINGS:
g_Config.bNoTriggerFilter = m_AdvancedMapFilter[notebookpage]->IsChecked();
for(int i = 0; i < 4; i++)
{
m_AdvancedMapFilter[i]->SetValue(g_Config.bNoTriggerFilter);
}
break;
case IDC_CONTROLTYPE:
if(!g_Config.bSaveByID)
{
PadMapping[notebookpage].controllertype = m_ControlType[notebookpage]->GetSelection();
UpdateGUI(notebookpage);
}
case IDC_TRIGGERTYPE:
if(!g_Config.bSaveByID)
{
PadMapping[notebookpage].triggertype = m_TriggerType[notebookpage]->GetSelection();
UpdateGUI(notebookpage);
}
//UpdateGUI(notebookpage);
break;
case IDC_JOYNAME:
@ -492,10 +472,10 @@ void ConfigBox::UpdateGUI(int _notebookpage)
}
// Update the GUI from PadMapping[]
UpdateGUIButtonMapping(_notebookpage);
UpdateGUIKeys(_notebookpage);
// Collect status
bool Hat = (PadMapping[_notebookpage].controllertype == InputCommon::CTL_DPAD_HAT);
bool Hat = (PadMapping[_notebookpage].controllertype == CTL_DPAD_HAT);
long Left, Right;
m_JoyShoulderL[_notebookpage]->GetValue().ToLong(&Left);
m_JoyShoulderR[_notebookpage]->GetValue().ToLong(&Right);
@ -525,7 +505,6 @@ void ConfigBox::UpdateGUI(int _notebookpage)
m_CBSaveByID[_notebookpage]->SetValue(g_Config.bSaveByID);
m_CBShowAdvanced[_notebookpage]->SetValue(g_Config.bShowAdvanced);
m_CBCheckFocus[_notebookpage]->SetValue(g_Config.bCheckFocus);
m_AdvancedMapFilter[_notebookpage]->SetValue(g_Config.bNoTriggerFilter);
LogMsg("Update: %i\n", g_Config.bSaveByID);
@ -541,8 +520,7 @@ void ConfigBox::UpdateGUI(int _notebookpage)
m_Controller[_notebookpage]->FindItem(IDC_CONTROLTYPE)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDC_TRIGGERTYPE)->Enable(Enabled && XInput);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_DIAGONAL)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_S_TO_C)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_FILTER_SETTINGS)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_S_TO_C)->Enable(Enabled);
#endif
// Replace the harder to understand -1 with "" for the sake of user friendliness
@ -641,12 +619,12 @@ void ConfigBox::CreateGUIControls()
// Populate the DPad type and Trigger type list
// -----------------------------
wxArrayString wxAS_DPadType;
wxAS_DPadType.Add(wxString::FromAscii(DPadType[InputCommon::CTL_DPAD_HAT]));
wxAS_DPadType.Add(wxString::FromAscii(DPadType[InputCommon::CTL_DPAD_CUSTOM]));
wxAS_DPadType.Add(wxString::FromAscii(DPadType[CTL_DPAD_HAT]));
wxAS_DPadType.Add(wxString::FromAscii(DPadType[CTL_DPAD_CUSTOM]));
wxArrayString wxAS_TriggerType;
wxAS_TriggerType.Add(wxString::FromAscii(TriggerType[InputCommon::CTL_TRIGGER_SDL]));
wxAS_TriggerType.Add(wxString::FromAscii(TriggerType[InputCommon::CTL_TRIGGER_XINPUT]));
wxAS_TriggerType.Add(wxString::FromAscii(TriggerType[CTL_TRIGGER_SDL]));
wxAS_TriggerType.Add(wxString::FromAscii(TriggerType[CTL_TRIGGER_XINPUT]));
// --------------------------------------------------------------------
// Populate the deadzone list
@ -842,10 +820,12 @@ void ConfigBox::CreateGUIControls()
m_gGenSettingsID[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Settings") );
m_CBSaveByID[i] = new wxCheckBox(m_Controller[i], IDC_SAVEBYID, wxT("Save by ID"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_CBShowAdvanced[i] = new wxCheckBox(m_Controller[i], IDC_SHOWADVANCED, wxT("Show advanced settings"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_CBCheckFocus[i] = new wxCheckBox(m_Controller[i], IDC_CHECKFOCUS, wxT("Allow out of focus input"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Populate general settings 3
m_gGenSettingsID[i]->Add(m_CBSaveByID[i], 0, wxEXPAND | wxALL, 3);
m_gGenSettingsID[i]->Add(m_CBShowAdvanced[i], 0, wxEXPAND | wxALL, 3);
m_gGenSettingsID[i]->Add(m_CBCheckFocus[i], 0, wxEXPAND | wxALL, 3);
// Create tooltips
m_ControlType[i]->SetToolTip(wxT(
@ -860,6 +840,8 @@ void ConfigBox::CreateGUIControls()
"\nto save your settings if you have multiple controllers.")
, i+1
));
m_CBCheckFocus[i]->SetToolTip(wxT(
"Allow gamepad input even when Dolphin is not in focus. Out of focus keyboard input is never allowed."));
// Populate settings
m_sSettings[i] = new wxBoxSizer ( wxHORIZONTAL );
@ -875,13 +857,17 @@ void ConfigBox::CreateGUIControls()
// Advanced settings
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Input status controls
// Populate input status
/**/
// Input status text
CreateAdvancedControls(i);
m_TStatusIn[i] = new wxStaticText(m_Controller[i], IDT_STATUS_IN, wxT("In"));
m_TStatusOut[i] = new wxStaticText(m_Controller[i], IDT_STATUS_OUT, wxT("Out"));
// Sizers
m_gStatusIn[i] = new wxStaticBoxSizer( wxHORIZONTAL, m_Controller[i], wxT("Main-stick (In) (Out)"));
CreateAdvancedControls(i);
m_GBAdvancedMainStick[i] = new wxGridBagSizer(0, 0);
m_GBAdvancedMainStick[i]->Add(m_pInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0);
m_GBAdvancedMainStick[i]->Add(m_pOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 5);
m_GBAdvancedMainStick[i]->Add(m_TStatusIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0);
@ -925,20 +911,6 @@ void ConfigBox::CreateGUIControls()
m_gStatusTriggers[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Trigger values"));
m_TStatusTriggers[i] = new wxStaticText(m_Controller[i], IDT_TRIGGERS, wxT("Left: Right:"));
m_gStatusTriggers[i]->Add(m_TStatusTriggers[i], 0, (wxALL), 4);
m_gStatusAdvancedSettings[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Advanced settings"));
m_CBCheckFocus[i] = new wxCheckBox(m_Controller[i], IDCB_CHECKFOCUS, wxT("Allow out of focus input"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_AdvancedMapFilter[i] = new wxCheckBox(m_Controller[i], IDCB_FILTER_SETTINGS , wxT("No trigger filter"));
m_gStatusAdvancedSettings[i]->Add(m_CBCheckFocus[i], 0, (wxALL), 4);
m_gStatusAdvancedSettings[i]->Add(m_AdvancedMapFilter[i], 0, (wxALL), 4);
// Tool tips
m_CBCheckFocus[i]->SetToolTip(wxT(
"Allow gamepad input even when Dolphin is not in focus. Out of focus keyboard input is never allowed."));
m_AdvancedMapFilter[i]->SetToolTip(wxT(
"This will allow you to map a digital axis to the main stick or the C-stick. If you don't have"
" any analog triggers that will be automatically set when the trigger filter is off."
));
////////////////////////// Advanced settings
@ -961,7 +933,6 @@ void ConfigBox::CreateGUIControls()
m_sMainRight[i]->Add(m_gStatusIn[i], 0, wxEXPAND | (wxLEFT), 2);
m_sMainRight[i]->Add(m_gStatusInSettings[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2);
m_sMainRight[i]->Add(m_gStatusTriggers[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2);
m_sMainRight[i]->Add(m_gStatusAdvancedSettings[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2);
// --------------------------------------------------------------------
// Populate main sizer
@ -975,7 +946,7 @@ void ConfigBox::CreateGUIControls()
m_sMainRight[i]->Show(g_Config.bShowAdvanced);
// Don't allow these changes when running
if(g_EmulatorRunning)
if(emulator_running)
{
m_Joyname[i]->Enable(false);
m_Joyattach[i]->Enable(false);
@ -1008,9 +979,7 @@ void ConfigBox::CreateGUIControls()
// --------------------------------------------------------------------
// Debugging
// -----------------------------
#ifdef SHOW_PAD_STATUS
m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(135, 100), wxDefaultSize);
#endif
//m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(135, 100), wxDefaultSize);
//m_pStatusBar2 = new wxStaticText(this, IDT_DEBUGGING2, wxT("Debugging2"), wxPoint(125, 200), wxDefaultSize);
//m_pStatusBar->SetLabel(wxString::Format("Debugging text"));