Rearranged EmuWiimote & nJoy. Wow they can share one pad at the same time, and they also can be enabled/disabled separately.

So as long as the game supports, you can toggle controller input between them on the fly.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4691 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx
2009-12-14 02:23:14 +00:00
parent 2d10a47c2b
commit 6f1efd4873
20 changed files with 271 additions and 208 deletions

View File

@ -46,10 +46,12 @@ BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog)
EVT_COMBOBOX(IDC_STICK_DIAGONAL, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_STICK_C2S, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDC_TILT_INPUT, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDC_TILT_RANGE_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDC_TILT_RANGE_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_TILT_INVERT_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_TILT_INVERT_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDC_TILT_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_TILT_ROLL_SWING, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDC_TILT_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_TILT_PITCH_SWING, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_TILT_ROLL_INVERT, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(IDC_TILT_PITCH_INVERT, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDC_TRIGGER_TYPE, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDC_NUNCHUCK_STICK, WiimotePadConfigDialog::GeneralSettingsChanged)
EVT_COMBOBOX(IDC_CC_LEFT_STICK, WiimotePadConfigDialog::GeneralSettingsChanged)
@ -127,7 +129,7 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id,
Page = 0;
ClickedButton = NULL;
g_Config.Load();
//g_Config.Load();
CreatePadGUIControls();
SetBackgroundColour(m_Notebook->GetBackgroundColour());
@ -229,6 +231,7 @@ void WiimotePadConfigDialog::OnClose(wxCloseEvent& event)
m_UpdatePadTimer->Stop();
if (m_ButtonMappingTimer)
m_ButtonMappingTimer->Stop();
SaveButtonMappingAll(Page);
EndModal(wxID_CLOSE);
}
@ -378,11 +381,9 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
// The range is in degrees and are set at even 5 degrees values
wxArrayString StrTiltRangeRoll, StrTiltRangePitch;
StrTiltRangeRoll.Add(wxString::Format(wxT("Free Swing")));
for (int i = 1; i < 37; i++)
for (int i = 1; i <= 36; i++)
StrTiltRangeRoll.Add(wxString::Format(wxT("%i"), i*5));
StrTiltRangePitch.Add(wxString::Format(wxT("Free Swing")));
for (int i = 1; i < 37; i++)
for (int i = 1; i <= 36; i++)
StrTiltRangePitch.Add(wxString::Format(wxT("%i"), i*5));
// The Trigger type list
@ -566,36 +567,43 @@ void WiimotePadConfigDialog::CreatePadGUIControls()
m_gJoyPad[i]->AddStretchSpacer();
// Tilt Wiimote
m_TiltComboInput[i] = new wxComboBox(m_Controller[i], IDC_TILT_INPUT, StrTilt[0], wxDefaultPosition, wxSize(100, -1), StrTilt, wxCB_READONLY);
m_TiltComboInput[i] = new wxComboBox(m_Controller[i], IDC_TILT_INPUT, StrTilt[0], wxDefaultPosition, wxSize(80, -1), StrTilt, wxCB_READONLY);
m_TiltComboInput[i]->SetSelection(g_Config.Tilt.Type);
m_TiltComboInput[i]->SetToolTip(wxT("Control tilting by an analog gamepad stick, an analog trigger or the keyboard."));
m_TiltComboInput[i]->SetToolTip(wxT("Control tilting by keyboard or analog stick or trigger"));
m_TiltTextRoll[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Roll L/R"));
m_TiltTextPitch[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Pitch U/D"));
m_TiltComboRangeRoll[i] = new wxComboBox(m_Controller[i], IDC_TILT_RANGE_ROLL, StrTiltRangeRoll[0], wxDefaultPosition, wxSize(75, -1), StrTiltRangeRoll, wxCB_READONLY);
m_TiltComboRangeRoll[i] = new wxComboBox(m_Controller[i], IDC_TILT_ROLL, StrTiltRangeRoll[0], wxDefaultPosition, wxSize(40, -1), StrTiltRangeRoll, wxCB_READONLY);
m_TiltComboRangeRoll[i]->SetValue(wxString::Format(wxT("%i"), g_Config.Tilt.Range.Roll));
m_TiltComboRangeRoll[i]->SetToolTip(wxT("The maximum roll in degrees."));
m_TiltComboRangePitch[i] = new wxComboBox(m_Controller[i], IDC_TILT_RANGE_PITCH, StrTiltRangePitch[0], wxDefaultPosition, wxSize(75, -1), StrTiltRangePitch, wxCB_READONLY);
m_TiltComboRangeRoll[i]->SetToolTip(wxT("The maximum Left/Righ Roll in degrees"));
m_TiltComboRangePitch[i] = new wxComboBox(m_Controller[i], IDC_TILT_PITCH, StrTiltRangePitch[0], wxDefaultPosition, wxSize(40, -1), StrTiltRangePitch, wxCB_READONLY);
m_TiltComboRangePitch[i]->SetValue(wxString::Format(wxT("%i"), g_Config.Tilt.Range.Pitch));
m_TiltComboRangePitch[i]->SetToolTip(wxT("The maximum pitch in degrees."));
m_TiltInvertRoll[i] = new wxCheckBox(m_Controller[i], IDC_TILT_INVERT_ROLL, wxT("Invert"));
m_TiltInvertPitch[i] = new wxCheckBox(m_Controller[i], IDC_TILT_INVERT_PITCH, wxT("Invert"));
m_TiltComboRangePitch[i]->SetToolTip(wxT("The maximum Up/Down Pitch in degrees"));
m_TiltRollSwing[i] = new wxCheckBox(m_Controller[i], IDC_TILT_ROLL_SWING, wxT("Swing"));
m_TiltRollSwing[i]->SetToolTip(wxT("Emulate Left/Right Swing instead of Left/Right Roll"));
m_TiltPitchSwing[i] = new wxCheckBox(m_Controller[i], IDC_TILT_PITCH_SWING, wxT("Swing"));
m_TiltPitchSwing[i]->SetToolTip(wxT("Emulate Up/Down Swing instead of Up/Down Pitch"));
m_TiltRollInvert[i] = new wxCheckBox(m_Controller[i], IDC_TILT_ROLL_INVERT, wxT("Invert"));
m_TiltRollInvert[i]->SetToolTip(wxT("Invert Left/Right direction"));
m_TiltPitchInvert[i] = new wxCheckBox(m_Controller[i], IDC_TILT_PITCH_INVERT, wxT("Invert"));
m_TiltPitchInvert[i]->SetToolTip(wxT("Invert Up/Down direction"));
// Sizers
m_sGridTilt[i] = new wxGridBagSizer(0, 0);
m_sGridTilt[i]->Add(m_TiltTextRoll[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxTOP), 4);
m_sGridTilt[i]->Add(m_TiltComboRangeRoll[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT), 2);
m_sGridTilt[i]->Add(m_TiltInvertRoll[i], wxGBPosition(0, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
m_sGridTilt[i]->Add(m_TiltTextPitch[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxTOP), 4);
m_sGridTilt[i]->Add(m_TiltComboRangePitch[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxLEFT | wxTOP), 2);
m_sGridTilt[i]->Add(m_TiltInvertPitch[i], wxGBPosition(1, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
m_sGridTilt[i]->Add(m_TiltRollInvert[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxTOP), 4);
m_sGridTilt[i]->Add(m_TiltComboRangeRoll[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT | wxRIGHT), 4);
m_sGridTilt[i]->Add(m_TiltRollSwing[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxTOP | wxLEFT | wxRIGHT), 4);
m_sGridTilt[i]->Add(m_TiltTextPitch[i], wxGBPosition(0, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
m_sGridTilt[i]->Add(m_TiltPitchInvert[i], wxGBPosition(1, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
m_sGridTilt[i]->Add(m_TiltComboRangePitch[i], wxGBPosition(0, 3), wxGBSpan(1, 1), (wxLEFT), 4);
m_sGridTilt[i]->Add(m_TiltPitchSwing[i], wxGBPosition(1, 3), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4);
m_gTilt[i] = new wxStaticBoxSizer (wxVERTICAL, m_Controller[i], wxT("Tilt and Swing"));
m_gTilt[i]->AddStretchSpacer();
m_gTilt[i]->Add(m_TiltComboInput[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
m_gTilt[i]->Add(m_sGridTilt[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5);
m_gTilt[i]->Add(m_sGridTilt[i], 0, wxEXPAND | (wxLEFT), 5);
m_gTilt[i]->AddStretchSpacer();
// Row 1 Sizers: Connected pads, tilt
@ -933,23 +941,25 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
case IDC_TILT_INPUT:
g_Config.Tilt.Type = m_TiltComboInput[Page]->GetSelection();
break;
case IDC_TILT_RANGE_ROLL:
if (m_TiltComboRangeRoll[Page]->GetSelection() == 0)
g_Config.Tilt.Range.Roll = 0;
else
{
m_TiltComboRangeRoll[Page]->GetValue().ToLong(&TmpValue);
g_Config.Tilt.Range.Roll = TmpValue;
}
case IDC_TILT_ROLL:
case IDC_TILT_ROLL_SWING:
m_TiltComboRangeRoll[Page]->GetValue().ToLong(&TmpValue);
g_Config.Tilt.Range.RollDegree = TmpValue;
g_Config.Tilt.Range.RollSwing = m_TiltRollSwing[Page]->IsChecked();
g_Config.Tilt.Range.Roll = (g_Config.Tilt.Range.RollSwing) ? 0 : g_Config.Tilt.Range.RollDegree;
break;
case IDC_TILT_RANGE_PITCH:
if (m_TiltComboRangePitch[Page]->GetSelection() == 0)
g_Config.Tilt.Range.Pitch = 0;
else
{
m_TiltComboRangePitch[Page]->GetValue().ToLong(&TmpValue);
g_Config.Tilt.Range.Pitch = TmpValue;
}
case IDC_TILT_PITCH:
case IDC_TILT_PITCH_SWING:
m_TiltComboRangePitch[Page]->GetValue().ToLong(&TmpValue);
g_Config.Tilt.Range.PitchDegree = TmpValue;
g_Config.Tilt.Range.PitchSwing = m_TiltPitchSwing[Page]->IsChecked();
g_Config.Tilt.Range.Pitch = (g_Config.Tilt.Range.PitchSwing) ? 0 : g_Config.Tilt.Range.PitchDegree;
break;
case IDC_TILT_ROLL_INVERT:
g_Config.Tilt.RollInvert = m_TiltRollInvert[Page]->IsChecked();
break;
case IDC_TILT_PITCH_INVERT:
g_Config.Tilt.PitchInvert = m_TiltPitchInvert[Page]->IsChecked();
break;
case IDC_NUNCHUCK_STICK:
g_Config.Nunchuck.Type = m_NunchuckComboStick[Page]->GetSelection();
@ -973,8 +983,6 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
case IDC_STICK_C2S:
case IDC_RUMBLE:
case IDC_RUMBLE_STRENGTH:
case IDC_TILT_INVERT_ROLL:
case IDC_TILT_INVERT_PITCH:
case IDC_TRIGGER_TYPE:
SaveButtonMappingAll(Page);
break;
@ -1003,6 +1011,8 @@ void WiimotePadConfigDialog::UpdateGUI(int Slot)
m_Notebook->FindItem(IDC_RUMBLE)->Enable(PadEnabled);
m_Notebook->FindItem(IDC_RUMBLE_STRENGTH)->Enable(PadEnabled);
m_Notebook->FindItem(IDC_TRIGGER_TYPE)->Enable(PadEnabled);
m_Notebook->FindItem(IDC_TILT_ROLL)->Enable(!g_Config.Tilt.Range.RollSwing);
m_Notebook->FindItem(IDC_TILT_PITCH)->Enable(!g_Config.Tilt.Range.PitchSwing);
for(int i = IDB_ANALOG_LEFT_X; i <= IDB_TRIGGER_R; i++)
m_Notebook->FindItem(i)->Enable(PadEnabled);
#endif