From db98709de001ae34eac0ed805621bde3c4e95489 Mon Sep 17 00:00:00 2001 From: ayuanx Date: Sun, 6 Dec 2009 01:15:13 +0000 Subject: [PATCH] Implemented Pad Rumble for Emu WiiMote, Currently this function is still quite basic and rough. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4649 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/InputCommon/Src/SDL.h | 2 + Source/Plugins/Plugin_Wiimote/Src/Config.cpp | 6 +- .../Plugin_Wiimote/Src/ConfigGamepad.cpp | 4 ++ .../Plugin_Wiimote/Src/ConfigPadDlg.cpp | 70 +++++++++++++------ .../Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h | 11 +-- .../Plugin_Wiimote/Src/EmuDynamics.cpp | 14 ++-- .../Plugin_Wiimote/Src/EmuSubroutines.cpp | 9 ++- .../Plugins/Plugin_Wiimote/Src/FillReport.cpp | 2 +- 8 files changed, 81 insertions(+), 37 deletions(-) diff --git a/Source/Core/InputCommon/Src/SDL.h b/Source/Core/InputCommon/Src/SDL.h index 40c121f96f..964a1fe3f9 100644 --- a/Source/Core/InputCommon/Src/SDL.h +++ b/Source/Core/InputCommon/Src/SDL.h @@ -217,6 +217,8 @@ struct CONTROLLER_MAPPING_NEW // GC PAD MAPPING PadClassicController Cc; PadGH3Controller GH3c; bool enabled; // Pad attached? + bool Rumble; + int RumbleStrength; int DeadZoneL; // Analog 1 Deadzone int DeadZoneR; // Analog 2 Deadzone int ID; // SDL joystick device ID diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp index d2fa3b1a13..003f650b32 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp @@ -315,6 +315,8 @@ void Config::Load(bool ChangePad) // Create a section name std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; + iniFile.Get(joySectionName.c_str(), "Rumble", &WiiMoteEmu::PadMapping[i].Rumble, true); + iniFile.Get(joySectionName.c_str(), "RumbleStrength", &WiiMoteEmu::PadMapping[i].RumbleStrength, 10); iniFile.Get(joySectionName.c_str(), "left_x", &WiiMoteEmu::PadMapping[i].Axis.Lx, 0); iniFile.Get(joySectionName.c_str(), "left_y", &WiiMoteEmu::PadMapping[i].Axis.Ly, 1); iniFile.Get(joySectionName.c_str(), "right_x", &WiiMoteEmu::PadMapping[i].Axis.Rx, 2); @@ -374,7 +376,7 @@ void Config::Save(int Slot) sprintf(SectionName, "Wiimote%i", i + 1); iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled); - iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter); + iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter); iniFile.Set(SectionName, "TriggerType", Trigger.Type); iniFile.Set(SectionName, "TriggerUpright", Trigger.Upright); iniFile.Set(SectionName, "TriggerRollRange", Trigger.Range.Roll); @@ -414,6 +416,8 @@ void Config::Save(int Slot) // Create a new section name after the joypad name std::string joySectionName = WiiMoteEmu::joyinfo[WiiMoteEmu::PadMapping[i].ID].Name; + iniFile.Set(joySectionName.c_str(), "Rumble", WiiMoteEmu::PadMapping[i].Rumble); + iniFile.Set(joySectionName.c_str(), "RumbleStrength", WiiMoteEmu::PadMapping[i].RumbleStrength); iniFile.Set(joySectionName.c_str(), "left_x", WiiMoteEmu::PadMapping[i].Axis.Lx); iniFile.Set(joySectionName.c_str(), "left_y", WiiMoteEmu::PadMapping[i].Axis.Ly); iniFile.Set(joySectionName.c_str(), "right_x", WiiMoteEmu::PadMapping[i].Axis.Rx); diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp index fee51a7d2a..becebdcfd7 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp @@ -137,6 +137,8 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller) m_ComboDeadZoneRight[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].DeadZoneR); m_ComboDiagonal[controller]->SetValue(wxString::FromAscii(WiiMoteEmu::PadMapping[controller].SDiagonal.c_str())); m_CheckC2S[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bCircle2Square); + m_CheckRumble[controller]->SetValue(WiiMoteEmu::PadMapping[controller].Rumble); + m_RumbleStrength[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].RumbleStrength); m_TiltInvertRoll[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bRollInvert); m_TiltInvertPitch[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bPitchInvert); @@ -224,6 +226,8 @@ void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId WiiMoteEmu::PadMapping[controller].enabled = true; //m_Joyattach[FromSlot]->GetValue(); // Only enable one // Set other settings //WiiMoteEmu::PadMapping[controller].controllertype = m_ControlType[FromSlot]->GetSelection(); + WiiMoteEmu::PadMapping[controller].Rumble = m_CheckRumble[FromSlot]->IsChecked(); + WiiMoteEmu::PadMapping[controller].RumbleStrength = m_RumbleStrength[FromSlot]->GetSelection(); WiiMoteEmu::PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection(); WiiMoteEmu::PadMapping[controller].DeadZoneL = m_ComboDeadZoneLeft[FromSlot]->GetSelection(); WiiMoteEmu::PadMapping[controller].DeadZoneR = m_ComboDeadZoneRight[FromSlot]->GetSelection(); diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp index 39b2f75bb7..376cf1cd05 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp @@ -34,7 +34,9 @@ BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog) EVT_BUTTON(ID_CLOSE, WiimotePadConfigDialog::CloseClick) EVT_BUTTON(ID_APPLY, WiimotePadConfigDialog::CloseClick) - EVT_COMBOBOX(IDC_JOYNAME, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_JOYNAME, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(IDC_RUMBLE, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_RUMBLE_STRENGTH, WiimotePadConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(ID_TRIGGER_TYPE, WiimotePadConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(ID_TILT_INPUT, WiimotePadConfigDialog::GeneralSettingsChanged) EVT_COMBOBOX(ID_TILT_RANGE_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged) @@ -370,6 +372,21 @@ void WiimotePadConfigDialog::CreatePadGUIControls() for (int i = 1; i < 37; i++) StrTiltRangePitch.Add(wxString::Format(wxT("%i"), i*5)); + wxArrayString TextDeadZone; + for (int i = 0; i <= 50; i++) + TextDeadZone.Add(wxString::Format(wxT("%i%%"), i)); + + wxArrayString StrRumble; + for (int i = 0; i <= 10; i++) + StrRumble.Add(wxString::Format(wxT("%i%%"), i*10)); + + wxArrayString asStatusInSet; + asStatusInSet.Add(wxT("100%")); + asStatusInSet.Add(wxT("95%")); + asStatusInSet.Add(wxT("90%")); + asStatusInSet.Add(wxT("85%")); + asStatusInSet.Add(wxT("80%")); + // The Trigger type list wxArrayString StrTriggerType; StrTriggerType.Add(wxString::FromAscii("SDL")); // -0x8000 to 0x7fff @@ -400,7 +417,6 @@ void WiimotePadConfigDialog::CreatePadGUIControls() // Configuration controls sizes static const int TxtW = 50, TxtH = 19, BtW = 75, BtH = 20; - // Controller m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, StrJoyname[0], wxDefaultPosition, wxSize(200, -1), StrJoyname, wxCB_READONLY); @@ -409,20 +425,17 @@ void WiimotePadConfigDialog::CreatePadGUIControls() // The drop down menu for the circle to square adjustment m_CheckC2SLabel[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Diagonal")); - wxArrayString asStatusInSet; - asStatusInSet.Add(wxT("100%")); - asStatusInSet.Add(wxT("95%")); - asStatusInSet.Add(wxT("90%")); - asStatusInSet.Add(wxT("85%")); - asStatusInSet.Add(wxT("80%")); - m_ComboDiagonal[i] = new wxComboBox(m_Controller[i], IDCB_LEFT_DIAGONAL, asStatusInSet[0], wxDefaultPosition, wxSize(75, -1), asStatusInSet, wxCB_READONLY); + + m_ComboDiagonal[i] = new wxComboBox(m_Controller[i], IDCB_LEFT_DIAGONAL, asStatusInSet[0], wxDefaultPosition, wxSize(50, -1), asStatusInSet, wxCB_READONLY); + + m_CheckRumble[i] = new wxCheckBox(m_Controller[i], IDC_RUMBLE, wxT("Rumble")); + m_RumbleStrengthLabel[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Strength")); + m_RumbleStrength[i] = new wxComboBox(m_Controller[i], IDC_RUMBLE_STRENGTH, StrRumble[0], wxDefaultPosition, wxSize(50, -1), StrRumble, wxCB_READONLY); // Dead zone m_ComboDeadZoneLabel[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Dead Zone")); - wxArrayString TextDeadZone; - for (int j = 0; j <= 50; j++) TextDeadZone.Add(wxString::Format(wxT("%i%%"), j)); - m_ComboDeadZoneLeft[i] = new wxComboBox(m_Controller[i], IDCB_DEAD_ZONE_LEFT, TextDeadZone[0], wxDefaultPosition, wxSize(70, -1), TextDeadZone, wxCB_READONLY); - m_ComboDeadZoneRight[i] = new wxComboBox(m_Controller[i], IDCB_DEAD_ZONE_RIGHT, TextDeadZone[0], wxDefaultPosition, wxSize(70, -1), TextDeadZone, wxCB_READONLY); + m_ComboDeadZoneLeft[i] = new wxComboBox(m_Controller[i], IDCB_DEAD_ZONE_LEFT, TextDeadZone[0], wxDefaultPosition, wxSize(50, -1), TextDeadZone, wxCB_READONLY); + m_ComboDeadZoneRight[i] = new wxComboBox(m_Controller[i], IDCB_DEAD_ZONE_RIGHT, TextDeadZone[0], wxDefaultPosition, wxSize(50, -1), TextDeadZone, wxCB_READONLY); // Tooltips m_Joyname[i]->SetToolTip(wxT("Save your settings and configure another joypad")); @@ -433,10 +446,11 @@ void WiimotePadConfigDialog::CreatePadGUIControls() wxT("\nyour diagonal values here from what is shown in the 'In' window.")); // Sizers - m_gDeadZone[i] = new wxBoxSizer(wxVERTICAL); m_gDeadZoneHoriz[i] = new wxBoxSizer(wxHORIZONTAL); m_gDeadZoneHoriz[i]->Add(m_ComboDeadZoneLeft[i], 0, (wxUP), 0); m_gDeadZoneHoriz[i]->Add(m_ComboDeadZoneRight[i], 0, (wxUP), 0); + + m_gDeadZone[i] = new wxBoxSizer(wxVERTICAL); m_gDeadZone[i]->Add(m_ComboDeadZoneLabel[i], 0, wxALIGN_CENTER | (wxUP), 0); m_gDeadZone[i]->Add(m_gDeadZoneHoriz[i], 0, wxALIGN_CENTER | (wxUP), 2); @@ -452,12 +466,20 @@ void WiimotePadConfigDialog::CreatePadGUIControls() m_gC2SDeadZone[i]->Add(m_gDeadZone[i], 0, (wxUP), 0); m_gC2SDeadZone[i]->Add(m_gCircle2SquareVert[i], 0, (wxLEFT), 8); - m_gJoyname[i] = new wxStaticBoxSizer (wxVERTICAL, m_Controller[i], wxT("Gamepad")); - m_gJoyname[i]->AddStretchSpacer(); - m_gJoyname[i]->Add(m_Joyname[i], 0, wxALIGN_CENTER | (wxLEFT | wxRIGHT | wxDOWN), 5); - m_gJoyname[i]->Add(m_gC2SDeadZone[i], 0, wxALIGN_CENTER | (wxLEFT | wxRIGHT | wxDOWN), 5); - m_gJoyname[i]->AddStretchSpacer(); + m_gJoyname[i] = new wxBoxSizer(wxVERTICAL); + m_gJoyname[i]->Add(m_Joyname[i], 0, wxALIGN_CENTER | (wxUP | wxDOWN), 4); + m_gJoyname[i]->Add(m_gC2SDeadZone[i], 0, (wxUP | wxDOWN), 4); + m_gRumble[i] = new wxBoxSizer(wxVERTICAL); + m_gRumble[i]->Add(m_CheckRumble[i], 0, wxALIGN_CENTER | (wxUP | wxDOWN), 8); + m_gRumble[i]->Add(m_RumbleStrengthLabel[i], 0, wxALIGN_CENTER | (wxUP), 4); + m_gRumble[i]->Add(m_RumbleStrength[i], 0, (wxUP | wxDOWN), 2); + + m_gJoyPad[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Gamepad")); + m_gJoyPad[i]->AddStretchSpacer(); + m_gJoyPad[i]->Add(m_gJoyname[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); + m_gJoyPad[i]->Add(m_gRumble[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); + m_gJoyPad[i]->AddStretchSpacer(); // Tilt Wiimote @@ -520,7 +542,7 @@ void WiimotePadConfigDialog::CreatePadGUIControls() m_bAnalogTriggerL[i] = new wxButton(m_Controller[i], IDB_TRIGGER_L, wxEmptyString, wxDefaultPosition, wxSize(21, 14)); m_bAnalogTriggerR[i] = new wxButton(m_Controller[i], IDB_TRIGGER_R, wxEmptyString, wxDefaultPosition, wxSize(21, 14)); - m_TriggerType[i] = new wxComboBox(m_Controller[i], ID_TRIGGER_TYPE, StrTriggerType[0], wxDefaultPosition, wxSize(75, -1), StrTriggerType, wxCB_READONLY); + m_TriggerType[i] = new wxComboBox(m_Controller[i], ID_TRIGGER_TYPE, StrTriggerType[0], wxDefaultPosition, wxSize(70, -1), StrTriggerType, wxCB_READONLY); m_SizeAnalogTriggerStatusBox[i] = new wxGridBagSizer(0, 0); m_SizeAnalogTriggerHorizConfig[i] = new wxGridBagSizer(0, 0); @@ -559,7 +581,7 @@ void WiimotePadConfigDialog::CreatePadGUIControls() // Row 2 Sizers: Connected pads, tilt, triggers m_HorizControllerTilt[i] = new wxBoxSizer(wxHORIZONTAL); - m_HorizControllerTilt[i]->Add(m_gJoyname[i], 0, wxALIGN_CENTER | wxEXPAND, 0); + m_HorizControllerTilt[i]->Add(m_gJoyPad[i], 0, wxEXPAND | (wxLEFT), 5); m_HorizControllerTilt[i]->Add(m_gTilt[i], 0, wxEXPAND | (wxLEFT), 5); m_HorizControllerTilt[i]->Add(m_gTrigger[i], 0, wxEXPAND | (wxLEFT), 5); @@ -1022,7 +1044,7 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) m_TiltComboRangePitch[Page]->GetValue().ToLong(&TmpValue); g_Config.Trigger.Range.Pitch = TmpValue; } - break; + break;; case IDC_JOYNAME: DoChangeJoystick(); break; @@ -1043,6 +1065,8 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) break; // These are defined in PadMapping and we can run the same function to update all of them + case IDC_RUMBLE: + case IDC_RUMBLE_STRENGTH: case IDCB_LEFT_DIAGONAL: case IDC_LEFT_C2S: case ID_TILT_INVERT_ROLL: @@ -1073,6 +1097,8 @@ void WiimotePadConfigDialog::UpdateGUI(int Slot) #ifdef _WIN32 for(int i = IDB_ANALOG_LEFT_X; i <= IDB_TRIGGER_R; i++) m_Notebook->FindItem(i)->Enable(PadEnabled); m_Notebook->FindItem(IDC_JOYNAME)->Enable(PadEnabled); + m_Notebook->FindItem(IDC_RUMBLE)->Enable(PadEnabled); + m_Notebook->FindItem(IDC_RUMBLE_STRENGTH)->Enable(PadEnabled); m_Notebook->FindItem(IDC_LEFT_C2S)->Enable(PadEnabled); m_Notebook->FindItem(IDCB_LEFT_DIAGONAL)->Enable(PadEnabled); m_Notebook->FindItem(IDCB_DEAD_ZONE_LEFT)->Enable(PadEnabled); diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h index edf122f472..71796615f1 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h @@ -86,6 +86,7 @@ class WiimotePadConfigDialog : public wxDialog *m_SizeParent[4]; wxCheckBox *m_CheckC2S[4], + *m_CheckRumble[4], *m_TiltInvertRoll[4], *m_TiltInvertPitch[4]; @@ -94,8 +95,10 @@ class WiimotePadConfigDialog : public wxDialog *m_gC2SDeadZone[4], *m_gCircle2Square[4], *m_gCircle2SquareVert[4], + *m_gRumble[4], *m_gDeadZone[4], *m_gDeadZoneHoriz[4], + *m_gJoyname[4], *m_HorizControllerTiltParent[4], *m_HorizControllerTilt[4], *m_TiltHoriz[4], @@ -130,7 +133,7 @@ class WiimotePadConfigDialog : public wxDialog wxGridBagSizer *m_SizeAnalogTriggerHorizConfig[4], *m_SizeAnalogTriggerStatusBox[4], *m_TiltGrid[4], *m_GridLeftStick[4], *m_GridRightStick[4]; - wxStaticBoxSizer *m_SizeBasic[4], *m_SizeEmu[4], *m_SizeReal[4], *m_SizeExtensions[4], *m_SizerIRPointer[4], *m_gTilt[4], *m_gJoyname[4]; + wxStaticBoxSizer *m_SizeBasic[4], *m_SizeEmu[4], *m_SizeReal[4], *m_SizeExtensions[4], *m_SizerIRPointer[4], *m_gTilt[4], *m_gJoyPad[4]; wxTextCtrl *m_AnalogLeftX[4], *m_AnalogLeftY[4], *m_AnalogRightX[4], *m_AnalogRightY[4], *m_AnalogTriggerL[4], *m_AnalogTriggerR[4]; wxButton *m_bAnalogLeftX[4], *m_bAnalogLeftY[4], *m_bAnalogRightX[4], *m_bAnalogRightY[4], @@ -144,7 +147,7 @@ class WiimotePadConfigDialog : public wxDialog *m_bGH3_Analog[4]; wxStaticText *m_TextScreenWidth[4], *m_TextScreenHeight[4], *m_TextScreenLeft[4], *m_TextScreenTop[4], *m_TextAR[4], - *m_tAnalogX[8], *m_tAnalogY[8], *m_TiltTextRoll[4], *m_TiltTextPitch[4], + *m_tAnalogX[8], *m_tAnalogY[8], *m_TiltTextRoll[4], *m_TiltTextPitch[4], *m_RumbleStrengthLabel[4], *m_CheckC2SLabel[4], *m_ComboDeadZoneLabel[4], *m_TStatusLeftIn[4], *m_TStatusLeftOut[4], *m_TStatusRightIn[4], *m_TStatusRightOut[4], *m_TriggerStatusL[4], *m_TriggerStatusR[4], *m_TriggerStatusLx[4], *m_TriggerStatusRx[4], *m_tAnalogTriggerInput[4], *m_tAnalogTriggerL[4], *m_tAnalogTriggerR[4], @@ -163,7 +166,7 @@ class WiimotePadConfigDialog : public wxDialog wxString OldLabel; wxComboBox *m_TiltComboInput[4], *m_TiltComboRangeRoll[4], *m_TiltComboRangePitch[4], *m_Joyname[4], *m_ComboDiagonal[4], *m_ComboDeadZoneLeft[4], *m_ComboDeadZoneRight[4], *m_TriggerType[4], - *m_NunchuckComboStick[4], *m_CcComboLeftStick[4], *m_CcComboRightStick[4], *m_CcComboTriggers[4], *m_GH3ComboAnalog[4]; + *m_RumbleStrength[4], *m_NunchuckComboStick[4], *m_CcComboLeftStick[4], *m_CcComboRightStick[4], *m_CcComboTriggers[4], *m_GH3ComboAnalog[4]; wxPanel *m_pLeftInStatus[4], *m_pLeftOutStatus[4], *m_pRightInStatus[4], *m_pRightOutStatus[4]; wxStaticBitmap *m_bmpSquareLeftIn[4], *m_bmpSquareLeftOut[4], *m_bmpSquareRightIn[4], *m_bmpSquareRightOut[4]; @@ -241,7 +244,7 @@ class WiimotePadConfigDialog : public wxDialog IDB_GH3_STRUM_DOWN, // Gamepad settings - IDC_JOYNAME, IDC_LEFT_C2S, IDCB_LEFT_DIAGONAL, IDCB_DEAD_ZONE_LEFT, IDCB_DEAD_ZONE_RIGHT, + IDC_JOYNAME, IDC_RUMBLE, IDC_RUMBLE_STRENGTH, IDC_LEFT_C2S, IDCB_LEFT_DIAGONAL, IDCB_DEAD_ZONE_LEFT, IDCB_DEAD_ZONE_RIGHT, ID_TRIGGER_TYPE, ID_TILT_INPUT, ID_TILT_RANGE_ROLL, ID_TILT_RANGE_PITCH, ID_TILT_INVERT_ROLL, ID_TILT_INVERT_PITCH, IDCB_NUNCHUCK_STICK, IDCB_CC_LEFT_STICK, IDCB_CC_RIGHT_STICK, IDCB_CC_TRIGGERS, IDCB_GH3_ANALOG, }; diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp index 472700ccba..ad07c0fdf9 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp @@ -92,27 +92,27 @@ void AdjustAngles(int &Roll, int &Pitch) void PitchDegreeToAccelerometer(int Roll, int Pitch, u8 &_x, u8 &_y, u8 &_z) { // Direct mapping from analog stick to x/y accelerometer - if (g_Config.Trigger.Range.Pitch == 0 && g_Config.Trigger.Range.Roll == 0) + if (g_Config.Trigger.Range.Roll == 0 && g_Config.Trigger.Range.Pitch == 0) { if (abs(Roll) <= abs(g_wm.cal_g.x)) Roll = 0; - if (abs(Pitch) <= abs(g_wm.cal_g.y)) + if (abs(Pitch) <= abs(g_wm.cal_g.z)) Pitch = 0; int ix = g_wm.cal_zero.x + Roll; - int iy = g_wm.cal_zero.y + Pitch; + int iz = g_wm.cal_zero.z + g_wm.cal_g.z + Pitch; if (ix > 0xFF) ix = 0xFF; if (ix < 0x00) ix = 0x00; - if (iy > 0xFF) iy = 0xFF; - if (iy < 0x00) iy = 0x00; + if (iz > 0xFF) iz = 0xFF; + if (iz < 0x00) iz = 0x00; if (!g_Config.Trigger.Upright) { _x = ix; - _y = iy; + _z = iz; } else { _x = ix; - _z = iy; + _y = iz; } return; } diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp index 38d64709c5..0f65dee9bc 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuSubroutines.cpp @@ -46,6 +46,8 @@ extern SWiimoteInitialize g_WiimoteInitialize; namespace WiiMoteEmu { +extern void PAD_Rumble(u8 _numPAD, unsigned int _uType); + /* Here we process the Output Reports that the Wii sends. Our response will be an Input Report back to the Wii. Input and Output is from the Wii's perspective, Output means data to the Wiimote (from the Wii), Input means @@ -67,9 +69,12 @@ void HidOutputReport(u16 _channelID, wm_report* sr) switch(sr->wm) { case WM_RUMBLE: // 0x10 - // TODO: Implement rumble + { + // TODO: need more accurate rumble + const int Page = 0; + PAD_Rumble(Page, sr->data[0]); break; - + } case WM_LEDS: // 0x11 WmLeds(_channelID, (wm_leds*)sr->data); break; diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp index 89e2744f3b..d0b71c209e 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp @@ -555,7 +555,7 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch) void TiltWiimoteKeyboard(int &Roll, int &Pitch) { #ifdef _WIN32 - // Direct map keyboard pitch to roll + // Direct map keyboard pitch left/right to swing left/right if (g_Config.Trigger.Range.Roll == 0 && g_Config.Trigger.Range.Pitch == 0) { if (IsKey(g_Wiimote_kbd.PITCH_L))