From c9f98d8f2b57f93637bb0aaa9ed33e99dfdff722 Mon Sep 17 00:00:00 2001 From: ayuanx Date: Wed, 9 Dec 2009 14:52:30 +0000 Subject: [PATCH] Reorganized Wiimote Config Dialog a bit to make it more compact Fixed many wrongly named variables Deleted many unreferenced variables wxWidgets cleanup git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4663 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_Wiimote/Src/Config.cpp | 39 +- Source/Plugins/Plugin_Wiimote/Src/Config.h | 22 +- .../Plugin_Wiimote/Src/ConfigBasicDlg.cpp | 18 +- .../Plugin_Wiimote/Src/ConfigBasicDlg.h | 4 +- .../Plugin_Wiimote/Src/ConfigGamepad.cpp | 166 ++- .../Plugin_Wiimote/Src/ConfigPadDlg.cpp | 958 ++++++++---------- .../Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h | 227 +++-- .../Plugin_Wiimote/Src/EmuDefinitions.h | 5 +- .../Plugin_Wiimote/Src/EmuDynamics.cpp | 22 +- Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp | 2 +- .../Plugins/Plugin_Wiimote/Src/FillReport.cpp | 32 +- 11 files changed, 689 insertions(+), 806 deletions(-) diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp index abeb8297cf..f41bda818a 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp @@ -264,7 +264,8 @@ void Config::Load(bool ChangePad) iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini"); // General - iniFile.Get("Settings", "SidewaysDPad", &bSidewaysDPad, false); + iniFile.Get("Settings", "Sideways", &bSideways, false); + iniFile.Get("Settings", "Upright", &bUpright, false); iniFile.Get("Settings", "ExtensionConnected", &iExtensionConnected, EXT_NONE); iniFile.Get("Settings", "MotionPlusConnected", &bMotionPlusConnected, false); @@ -285,10 +286,10 @@ void Config::Load(bool ChangePad) char SectionName[32]; sprintf(SectionName, "Wiimote%i", i + 1); iniFile.Get(SectionName, "NoTriggerFilter", &bNoTriggerFilter, false); - iniFile.Get(SectionName, "TriggerType", &Trigger.Type, Trigger.TRIGGER_OFF); - iniFile.Get(SectionName, "TriggerUpright", &Trigger.Upright, false); - iniFile.Get(SectionName, "TriggerRollRange", &Trigger.Range.Roll, 0); - iniFile.Get(SectionName, "TriggerPitchRange", &Trigger.Range.Pitch, 0); + + iniFile.Get(SectionName, "TiltType", &Tilt.Type, Tilt.OFF); + iniFile.Get(SectionName, "TiltRollRange", &Tilt.Range.Roll, 0); + iniFile.Get(SectionName, "TiltPitchRange", &Tilt.Range.Pitch, 0); // Wiimote for (int x = 0; x < WM_CONTROLS; x++) @@ -304,6 +305,7 @@ void Config::Load(bool ChangePad) iniFile.Get(SectionName, "CcTriggers", &ClassicController.TType, ClassicController.KEYBOARD); for (int x = 0; x < CC_CONTROLS; x++) iniFile.Get(SectionName, ccControlNames[x], &WiiMoteEmu::PadMapping[i].Cc.keyForControls[x], ccDefaultControls[x]); + iniFile.Get(SectionName, "GH3Analog", &GH3Controller.AType, GH3Controller.ANALOG1); for (int x = 0; x < GH3_CONTROLS; x++) iniFile.Get(SectionName, gh3ControlNames[x], &WiiMoteEmu::PadMapping[i].GH3c.keyForControls[x], GH3DefaultControls[x]); @@ -328,8 +330,6 @@ 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); @@ -338,11 +338,13 @@ void Config::Load(bool ChangePad) iniFile.Get(joySectionName.c_str(), "r_trigger", &WiiMoteEmu::PadMapping[i].Axis.Tr, 1005); iniFile.Get(joySectionName.c_str(), "DeadZoneL", &WiiMoteEmu::PadMapping[i].DeadZoneL, 0); iniFile.Get(joySectionName.c_str(), "DeadZoneR", &WiiMoteEmu::PadMapping[i].DeadZoneR, 0); - iniFile.Get(joySectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0); iniFile.Get(joySectionName.c_str(), "Diagonal", &WiiMoteEmu::PadMapping[i].SDiagonal, "100%"); iniFile.Get(joySectionName.c_str(), "Circle2Square", &WiiMoteEmu::PadMapping[i].bCircle2Square, false); + 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(), "RollInvert", &WiiMoteEmu::PadMapping[i].bRollInvert, false); iniFile.Get(joySectionName.c_str(), "PitchInvert", &WiiMoteEmu::PadMapping[i].bPitchInvert, false); + iniFile.Get(joySectionName.c_str(), "TriggerType", &WiiMoteEmu::PadMapping[i].triggertype, 0); } // Load the IR cursor settings if it's avaliable for the GameId, if not load the default settings iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini"); @@ -368,9 +370,10 @@ void Config::Save(int Slot) { IniFile iniFile; iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini"); - iniFile.Set("Settings", "SidewaysDPad", bSidewaysDPad); - iniFile.Set("Settings", "ExtensionConnected", iExtensionConnected); + iniFile.Set("Settings", "Sideways", bSideways); + iniFile.Set("Settings", "Upright", bUpright); iniFile.Set("Settings", "MotionPlusConnected", bMotionPlusConnected); + iniFile.Set("Settings", "ExtensionConnected", iExtensionConnected); iniFile.Set("Real", "Connect", bConnectRealWiimote); iniFile.Set("Real", "Use", bUseRealWiimote); @@ -390,10 +393,9 @@ void Config::Save(int Slot) iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled); iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter); - iniFile.Set(SectionName, "TriggerType", Trigger.Type); - iniFile.Set(SectionName, "TriggerUpright", Trigger.Upright); - iniFile.Set(SectionName, "TriggerRollRange", Trigger.Range.Roll); - iniFile.Set(SectionName, "TriggerPitchRange", Trigger.Range.Pitch); + iniFile.Set(SectionName, "TiltType", Tilt.Type);; + iniFile.Set(SectionName, "TiltRollRange", Tilt.Range.Roll); + iniFile.Set(SectionName, "TiltPitchRange", Tilt.Range.Pitch); // Wiimote for (int x = 0; x < WM_CONTROLS; x++) @@ -410,6 +412,7 @@ void Config::Save(int Slot) iniFile.Set(SectionName, "CcTriggers", ClassicController.TType); for (int x = 0; x < CC_CONTROLS; x++) iniFile.Set(SectionName, ccControlNames[x], WiiMoteEmu::PadMapping[i].Cc.keyForControls[x]); + // GH3 iniFile.Set(SectionName, "GH3Analog", GH3Controller.AType); for (int x = 0; x < GH3_CONTROLS; x++) @@ -429,23 +432,21 @@ 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); iniFile.Set(joySectionName.c_str(), "right_y", WiiMoteEmu::PadMapping[i].Axis.Ry); iniFile.Set(joySectionName.c_str(), "l_trigger", WiiMoteEmu::PadMapping[i].Axis.Tl); iniFile.Set(joySectionName.c_str(), "r_trigger", WiiMoteEmu::PadMapping[i].Axis.Tr); - iniFile.Set(joySectionName.c_str(), "DeadZoneL", WiiMoteEmu::PadMapping[i].DeadZoneL); iniFile.Set(joySectionName.c_str(), "DeadZoneR", WiiMoteEmu::PadMapping[i].DeadZoneR); - //iniFile.Set(joySectionName.c_str(), "controllertype", WiiMoteEmu::PadMapping[i].controllertype); - iniFile.Set(joySectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype); iniFile.Set(joySectionName.c_str(), "Diagonal", WiiMoteEmu::PadMapping[i].SDiagonal); iniFile.Set(joySectionName.c_str(), "Circle2Square", WiiMoteEmu::PadMapping[i].bCircle2Square); + 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(), "RollInvert", WiiMoteEmu::PadMapping[i].bRollInvert); iniFile.Set(joySectionName.c_str(), "PitchInvert", WiiMoteEmu::PadMapping[i].bPitchInvert); + iniFile.Set(joySectionName.c_str(), "TriggerType", WiiMoteEmu::PadMapping[i].triggertype); } iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini"); diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.h b/Source/Plugins/Plugin_Wiimote/Src/Config.h index 5b2e83c2bf..4cb5203659 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.h +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.h @@ -22,6 +22,7 @@ #include #endif +#define AN_CONTROLS 6 #define WM_CONTROLS 16 #define NC_CONTROLS 7 #define CC_CONTROLS 23 @@ -33,7 +34,6 @@ enum EXT_NUNCHUCK, EXT_CLASSIC_CONTROLLER, EXT_GUITARHERO3_CONTROLLER, - EXT_GUITARHEROWT_DRUMS, }; struct Config @@ -42,25 +42,24 @@ struct Config void Load(bool ChangePad = false); void Save(int Slot = -1); - struct PadRange + struct TiltRange { int Roll; int Pitch; }; - struct PadTrigger + struct PadTilt { - enum ETriggerType + enum ETiltType { - TRIGGER_OFF = 0, + OFF = 0, KEYBOARD, ANALOG1, ANALOG2, TRIGGER }; int Type; - bool Upright; - PadRange Range; + TiltRange Range; }; struct PadNunchuck { @@ -90,7 +89,7 @@ struct Config { enum EGH3Stick { - // KEYBOARD, +// KEYBOARD, ANALOG1, ANALOG2 }; @@ -99,10 +98,11 @@ struct Config }; // Emulated Wiimote - bool bSidewaysDPad; + bool bSideways; + bool bUpright; bool bWideScreen; - int iExtensionConnected; bool bMotionPlusConnected; + int iExtensionConnected; // Real Wiimote bool bConnectRealWiimote, bUseRealWiimote, bUpdateRealWiimote; @@ -112,7 +112,7 @@ struct Config // Gamepad bool bNoTriggerFilter; - PadTrigger Trigger; + PadTilt Tilt; PadNunchuck Nunchuck; PadClassicController ClassicController; PadGH3 GH3Controller; diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp index 954d71afa6..ef2eaa5388 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp @@ -33,7 +33,7 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog) EVT_BUTTON(ID_BUTTONRECORDING, WiimoteBasicConfigDialog::ButtonClick) EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteBasicConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(ID_SIDEWAYSWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHOICE(ID_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) @@ -176,11 +176,11 @@ void WiimoteBasicConfigDialog::CreateGUIControls() m_WiimoteOnline[i]->SetToolTip(wxString::Format(wxT("Decide if Wiimote %i shall be detected by the game"), i)); // Emulated Wiimote - m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways Wiimote")); - m_SidewaysDPad[i]->SetValue(g_Config.bSidewaysDPad); - m_SidewaysDPad[i]->SetToolTip(wxT("Treat the sideways position as neutral")); + m_SidewaysWiimote[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSWIIMOTE, wxT("Sideways Wiimote")); + m_SidewaysWiimote[i]->SetValue(g_Config.bSideways); + m_SidewaysWiimote[i]->SetToolTip(wxT("Treat the sideways position as neutral")); m_UprightWiimote[i] = new wxCheckBox(m_Controller[i], ID_UPRIGHTWIIMOTE, wxT("Upright Wiimote")); - m_UprightWiimote[i]->SetValue(g_Config.Trigger.Upright); + m_UprightWiimote[i]->SetValue(g_Config.bUpright); m_UprightWiimote[i]->SetToolTip(wxT("Treat the upright position as neutral")); //IR Pointer @@ -216,7 +216,7 @@ void WiimoteBasicConfigDialog::CreateGUIControls() m_SizeBasic[i]->Add(m_WiimoteOnline[i], 0, wxEXPAND | wxALL, 5); m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Position")); - m_SizeEmu[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | wxALL, 5); + m_SizeEmu[i]->Add(m_SidewaysWiimote[i], 0, wxEXPAND | wxALL, 5); m_SizeEmu[i]->Add(m_UprightWiimote[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5); m_SizeExtensions[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Extension")); @@ -379,11 +379,11 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) if (g_Config.bUseRealWiimote) DoUseReal(); break; - case ID_SIDEWAYSDPAD: - g_Config.bSidewaysDPad = m_SidewaysDPad[Page]->IsChecked(); + case ID_SIDEWAYSWIIMOTE: + g_Config.bSideways = m_SidewaysWiimote[Page]->IsChecked(); break; case ID_UPRIGHTWIIMOTE: - g_Config.Trigger.Upright = m_UprightWiimote[Page]->IsChecked(); + g_Config.bUpright = m_UprightWiimote[Page]->IsChecked(); break; case ID_MOTIONPLUSCONNECTED: diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h index 794f2f28c4..b6f254461b 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h @@ -78,7 +78,7 @@ class WiimoteBasicConfigDialog : public wxDialog *m_SliderTop[4]; // Emulated Wiimote settings - wxCheckBox *m_SidewaysDPad[4], + wxCheckBox *m_SidewaysWiimote[4], *m_UprightWiimote[4], *m_WiimoteOnline[4], *m_WiiMotionPlusConnected[4], @@ -126,7 +126,7 @@ class WiimoteBasicConfigDialog : public wxDialog ID_CONTROLLERPAGE4, // Emulated Wiimote - ID_SIDEWAYSDPAD, + ID_SIDEWAYSWIIMOTE, ID_UPRIGHTWIIMOTE, ID_MOTIONPLUSCONNECTED, ID_EXTCONNECTED, diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp index 4ec047172f..3dab5ab35a 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigGamepad.cpp @@ -38,6 +38,7 @@ void WiimotePadConfigDialog::DoChangeJoystick() // Load the settings for the new Id g_Config.Load(true); + UpdateGUI(Page); // Update the GUI // Open the new pad @@ -99,7 +100,6 @@ void WiimotePadConfigDialog::SetButtonTextAll(int id, char text[128]) }; } - void WiimotePadConfigDialog::SaveButtonMappingAll(int Slot) { for (int i = 0; i < 4; i++) @@ -122,17 +122,8 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller) // Update the enabled checkbox //m_Joyattach[controller]->SetValue(PadMapping[controller].enabled == 1 ? true : false); - - tmp << WiiMoteEmu::PadMapping[controller].Axis.Lx; m_AnalogLeftX[controller]->SetValue(tmp); tmp.clear(); - tmp << WiiMoteEmu::PadMapping[controller].Axis.Ly; m_AnalogLeftY[controller]->SetValue(tmp); tmp.clear(); - tmp << WiiMoteEmu::PadMapping[controller].Axis.Rx; m_AnalogRightX[controller]->SetValue(tmp); tmp.clear(); - tmp << WiiMoteEmu::PadMapping[controller].Axis.Ry; m_AnalogRightY[controller]->SetValue(tmp); tmp.clear(); - - tmp << WiiMoteEmu::PadMapping[controller].Axis.Tl; m_AnalogTriggerL[controller]->SetValue(tmp); tmp.clear(); - tmp << WiiMoteEmu::PadMapping[controller].Axis.Tr; m_AnalogTriggerR[controller]->SetValue(tmp); tmp.clear(); // Update the deadzone and controller type controls - m_TriggerType[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].triggertype); m_ComboDeadZoneLeft[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].DeadZoneL); m_ComboDeadZoneRight[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].DeadZoneR); m_ComboDiagonal[controller]->SetValue(wxString::FromAscii(WiiMoteEmu::PadMapping[controller].SDiagonal.c_str())); @@ -141,12 +132,22 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller) m_RumbleStrength[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].RumbleStrength); m_TiltInvertRoll[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bRollInvert); m_TiltInvertPitch[controller]->SetValue(WiiMoteEmu::PadMapping[controller].bPitchInvert); + m_TriggerType[controller]->SetSelection(WiiMoteEmu::PadMapping[controller].triggertype); + + for (int i = 0; i < AN_CONTROLS; i++) + { + tmp << WiiMoteEmu::PadMapping[controller].Axis.keyForControls[i]; + m_Button_Analog[i][controller]->SetLabel(tmp); + tmp.clear(); + } // Wiimote #ifdef _WIN32 for (int x = 0; x < WM_CONTROLS; x++) + { m_Button_Wiimote[x][controller]->SetLabel(wxString::FromAscii( InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.keyForControls[x]).c_str())); + } if(g_Config.iExtensionConnected == EXT_NUNCHUCK) { for (int x = 0; x < NC_CONTROLS; x++) @@ -203,11 +204,9 @@ void WiimotePadConfigDialog::UpdateGUIButtonMapping(int controller) /* Populate the PadMapping array with the dialog items settings (for example selected joystick, enabled or disabled status and so on) */ - void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int FromSlot) { // Temporary storage - wxString tmp; long value; // Save from or to the same or different slots @@ -223,28 +222,24 @@ void WiimotePadConfigDialog::SaveButtonMapping(int controller, bool DontChangeId WiiMoteEmu::PadMapping[controller].ID = m_Joyname[FromSlot]->GetSelection(); // Set enabled or disable status if (FromSlot == controller) - WiiMoteEmu::PadMapping[controller].enabled = true; //m_Joyattach[FromSlot]->GetValue(); // Only enable one + WiiMoteEmu::PadMapping[controller].enabled = true; // 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(); WiiMoteEmu::PadMapping[controller].SDiagonal = m_ComboDiagonal[FromSlot]->GetLabel().mb_str(); - WiiMoteEmu::PadMapping[controller].bCircle2Square = m_CheckC2S[FromSlot]->IsChecked(); - WiiMoteEmu::PadMapping[controller].bRollInvert = m_TiltInvertRoll[FromSlot]->IsChecked(); - WiiMoteEmu::PadMapping[controller].bPitchInvert = m_TiltInvertPitch[FromSlot]->IsChecked(); + WiiMoteEmu::PadMapping[controller].bCircle2Square = m_CheckC2S[FromSlot]->IsChecked(); + WiiMoteEmu::PadMapping[controller].Rumble = m_CheckRumble[FromSlot]->IsChecked(); + WiiMoteEmu::PadMapping[controller].RumbleStrength = m_RumbleStrength[FromSlot]->GetSelection(); + WiiMoteEmu::PadMapping[controller].bRollInvert = m_TiltInvertRoll[FromSlot]->IsChecked(); + WiiMoteEmu::PadMapping[controller].bPitchInvert = m_TiltInvertPitch[FromSlot]->IsChecked(); + WiiMoteEmu::PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection(); - // The analog buttons - m_AnalogLeftX[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Lx = value; tmp.clear(); - m_AnalogLeftY[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Ly = value; tmp.clear(); - m_AnalogRightX[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Rx = value; tmp.clear(); - m_AnalogRightY[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Ry = value; tmp.clear(); - - // The shoulder buttons - m_AnalogTriggerL[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tl = value; - m_AnalogTriggerR[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tr = value; + for (int i = 0; i < AN_CONTROLS; i++) + { + m_Button_Analog[i][FromSlot]->GetLabel().ToLong(&value); + WiiMoteEmu::PadMapping[controller].Axis.keyForControls[i] = value; + } //DEBUG_LOG(WIIMOTE, "WiiMoteEmu::PadMapping[%i].ID = %i, m_Joyname[%i]->GetSelection() = %i", // controller, WiiMoteEmu::PadMapping[controller].ID, FromSlot, m_Joyname[FromSlot]->GetSelection()); @@ -285,7 +280,7 @@ void WiimotePadConfigDialog::ToBlank(bool _ToBlank) if(_ToBlank) { for(int i = IDB_ANALOG_LEFT_X; i <= IDB_TRIGGER_R; i++) -#if ! defined _WIN32 && ! wxCHECK_VERSION(2, 9, 0) +#if !defined _WIN32 && !wxCHECK_VERSION(2, 9, 0) if(GetButtonText(i, j).ToAscii() == "-1") SetButtonText(i, (char *)"", j); #else @@ -307,9 +302,12 @@ void WiimotePadConfigDialog::SetButtonText(int id, const char text[128], int _Pa { // Set controller value int controller; - if (_Page == -1) controller = Page; else controller = _Page; + if (_Page == -1) controller = Page; + else controller = _Page; - if (IDB_WM_A <= id && id <= IDB_WM_SHAKE) + if (IDB_ANALOG_LEFT_X <= id && id <= IDB_TRIGGER_R) + m_Button_Analog[id - IDB_ANALOG_LEFT_X][controller]->SetLabel(wxString::FromAscii(text)); + else if (IDB_WM_A <= id && id <= IDB_WM_SHAKE) m_Button_Wiimote[id - IDB_WM_A][controller]->SetLabel(wxString::FromAscii(text)); else if (IDB_NC_Z <= id && id <= IDB_NC_SHAKE) m_Button_NunChuck[id - IDB_NC_Z][controller]->SetLabel(wxString::FromAscii(text)); @@ -317,17 +315,7 @@ void WiimotePadConfigDialog::SetButtonText(int id, const char text[128], int _Pa m_Button_Classic[id - IDB_CC_A][controller]->SetLabel(wxString::FromAscii(text)); else if (IDB_GH3_GREEN <= id && id <= IDB_GH3_STRUM_DOWN) m_Button_GH3[id - IDB_GH3_GREEN][controller]->SetLabel(wxString::FromAscii(text)); - else switch(id) - { - case IDB_ANALOG_LEFT_X: m_AnalogLeftX[controller]->SetValue(wxString::FromAscii(text)); break; - case IDB_ANALOG_LEFT_Y: m_AnalogLeftY[controller]->SetValue(wxString::FromAscii(text)); break; - case IDB_ANALOG_RIGHT_X: m_AnalogRightX[controller]->SetValue(wxString::FromAscii(text)); break; - case IDB_ANALOG_RIGHT_Y: m_AnalogRightY[controller]->SetValue(wxString::FromAscii(text)); break; - case IDB_TRIGGER_L: m_AnalogTriggerL[controller]->SetValue(wxString::FromAscii(text)); break; - case IDB_TRIGGER_R: m_AnalogTriggerR[controller]->SetValue(wxString::FromAscii(text)); break; - default: break; - } //DEBUG_LOG(WIIMOTE, "SetButtonText: %s", text); } @@ -338,22 +326,21 @@ wxString WiimotePadConfigDialog::GetButtonText(int id, int _Page) // Set controller value int controller; - if (_Page == -1) controller = Page; else controller = _Page; + if (_Page == -1) controller = Page; + else controller = _Page; - switch(id) - { - // Analog Stick - case IDB_ANALOG_LEFT_X: return m_AnalogLeftX[controller]->GetValue(); - case IDB_ANALOG_LEFT_Y: return m_AnalogLeftY[controller]->GetValue(); - case IDB_ANALOG_RIGHT_X: return m_AnalogRightX[controller]->GetValue(); - case IDB_ANALOG_RIGHT_Y: return m_AnalogRightY[controller]->GetValue(); - - // Shoulder Buttons - case IDB_TRIGGER_L: return m_AnalogTriggerL[controller]->GetValue(); - case IDB_TRIGGER_R: return m_AnalogTriggerR[controller]->GetValue(); + if (IDB_ANALOG_LEFT_X <= id && id <= IDB_TRIGGER_R) + return m_Button_Analog[id - IDB_ANALOG_LEFT_X][controller]->GetLabel(); + else if (IDB_WM_A <= id && id <= IDB_WM_SHAKE) + return m_Button_Wiimote[id - IDB_WM_A][controller]->GetLabel(); + else if (IDB_NC_Z <= id && id <= IDB_NC_SHAKE) + return m_Button_NunChuck[id - IDB_NC_Z][controller]->GetLabel(); + else if (IDB_CC_A <= id && id <= IDB_CC_RD) + return m_Button_Classic[id - IDB_CC_A][controller]->GetLabel(); + else if (IDB_GH3_GREEN <= id && id <= IDB_GH3_STRUM_DOWN) + return m_Button_GH3[id - IDB_GH3_GREEN][controller]->GetLabel(); - default: return wxString(); - } + return wxString(); } @@ -377,8 +364,8 @@ void WiimotePadConfigDialog::GetButtons(wxCommandEvent& event) if (m_ButtonMappingTimer->IsRunning()) return; - OldLabel.clear(); - SetButtonText(event.GetId(), ""); + OldLabel = ((wxButton *)event.GetEventObject())->GetLabel(); + SetButtonText(event.GetId(), ""); DoGetButtons(event.GetId()); } @@ -553,7 +540,6 @@ void WiimotePadConfigDialog::DoGetButtons(int _GetId) } - // Show current input status // Convert the 0x8000 range values to BoxW and BoxH for the plot void WiimotePadConfigDialog::Convert2Box(int &x) @@ -570,29 +556,19 @@ void WiimotePadConfigDialog::PadGetStatus() { //DEBUG_LOG(WIIMOTE, "SDL_WasInit: %i", SDL_WasInit(0)); - /* Return if it's not detected. The ID should never be less than zero here, - it can only be that because of a manual ini file change, but we make - that check anway. */ - if(WiiMoteEmu::PadMapping[Page].ID < 0 || WiiMoteEmu::PadMapping[Page].ID >= SDL_NumJoysticks()) + /* Return if it's not enabled or not detected. The ID should never be less than zero here, + it can only be that because of a manual ini file change, but we make that check anway. */ + if(!WiiMoteEmu::PadMapping[Page].enabled + || WiiMoteEmu::PadMapping[Page].ID < 0 + || WiiMoteEmu::PadMapping[Page].ID >= SDL_NumJoysticks() + ) { - m_TStatusLeftIn[Page]->SetLabel(wxT("Not connected")); - m_TStatusLeftOut[Page]->SetLabel(wxT("Not connected")); - m_TStatusRightIn[Page]->SetLabel(wxT("Not connected")); - m_TStatusRightOut[Page]->SetLabel(wxT("Not connected")); - m_TriggerStatusLx[Page]->SetLabel(wxT("0")); - m_TriggerStatusRx[Page]->SetLabel(wxT("0")); - return; - } - - // Return if it's not enabled - if (!WiiMoteEmu::PadMapping[Page].enabled) - { - m_TStatusLeftIn[Page]->SetLabel(wxT("Not enabled")); - m_TStatusLeftOut[Page]->SetLabel(wxT("Not enabled")); - m_TStatusRightIn[Page]->SetLabel(wxT("Not enabled")); - m_TStatusRightOut[Page]->SetLabel(wxT("Not enabled")); - m_TriggerStatusLx[Page]->SetLabel(wxT("0")); - m_TriggerStatusRx[Page]->SetLabel(wxT("0")); + m_tStatusLeftIn[Page]->SetLabel(wxT("Not connected")); + m_tStatusLeftOut[Page]->SetLabel(wxT("Not connected")); + m_tStatusRightIn[Page]->SetLabel(wxT("Not connected")); + m_tStatusRightOut[Page]->SetLabel(wxT("Not connected")); + m_TriggerStatusL[Page]->SetLabel(wxT("000")); + m_TriggerStatusR[Page]->SetLabel(wxT("000")); return; } @@ -604,12 +580,7 @@ void WiimotePadConfigDialog::PadGetStatus() //if (IsFocus()) WiiMoteEmu::GetJoyState(WiiMoteEmu::PadState[Page], WiiMoteEmu::PadMapping[Page], Page, WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Page].ID).NumButtons); - - // Analog stick - // Set Deadzones perhaps out of function - //int deadzone = (int)(((float)(128.00/100.00)) * (float)(PadMapping[_numPAD].deadzone+1)); - //int deadzone2 = (int)(((float)(-128.00/100.00)) * (float)(PadMapping[_numPAD].deadzone+1)); // Get original values int main_x = WiiMoteEmu::PadState[Page].Axis.Lx; @@ -620,11 +591,13 @@ void WiimotePadConfigDialog::PadGetStatus() // Get adjusted values int main_x_after = main_x, main_y_after = main_y; int right_x_after = right_x, right_y_after = right_y; + // Produce square if(WiiMoteEmu::PadMapping[Page].bCircle2Square) { InputCommon::Square2Circle(main_x_after, main_y_after, Page, WiiMoteEmu::PadMapping[Page].SDiagonal, true); - } + } + // Check dead zone float DeadZoneLeft = (float)WiiMoteEmu::PadMapping[Page].DeadZoneL / 100.0; float DeadZoneRight = (float)WiiMoteEmu::PadMapping[Page].DeadZoneR / 100.0; @@ -667,16 +640,16 @@ void WiimotePadConfigDialog::PadGetStatus() float f_Rx_aft = right_x_after / 32767.0; float f_Ry_aft = right_y_after / 32767.0; - m_TStatusLeftIn[Page]->SetLabel(wxString::Format( + m_tStatusLeftIn[Page]->SetLabel(wxString::Format( wxT("x:%1.2f y:%1.2f"), f_x, f_y )); - m_TStatusLeftOut[Page]->SetLabel(wxString::Format( + m_tStatusLeftOut[Page]->SetLabel(wxString::Format( wxT("x:%1.2f y:%1.2f"), f_x_aft, f_y_aft )); - m_TStatusRightIn[Page]->SetLabel(wxString::Format( + m_tStatusRightIn[Page]->SetLabel(wxString::Format( wxT("x:%1.2f y:%1.2f"), f_Rx, f_Ry )); - m_TStatusRightOut[Page]->SetLabel(wxString::Format( + m_tStatusRightOut[Page]->SetLabel(wxString::Format( wxT("x:%1.2f y:%1.2f"), f_Rx_aft, f_Ry_aft )); @@ -694,13 +667,6 @@ void WiimotePadConfigDialog::PadGetStatus() m_bmpDotRightOut[Page]->SetPosition(wxPoint(right_x_after, right_y_after)); - // Triggers - - // Get the selected keys - long Left, Right; - m_AnalogTriggerL[Page]->GetValue().ToLong(&Left); - m_AnalogTriggerR[Page]->GetValue().ToLong(&Right); - // Get the trigger values int TriggerLeft = WiiMoteEmu::PadState[Page].Axis.Tl; int TriggerRight = WiiMoteEmu::PadState[Page].Axis.Tr; @@ -712,9 +678,9 @@ void WiimotePadConfigDialog::PadGetStatus() TriggerRight = InputCommon::Pad_Convert(TriggerRight); } - m_TriggerStatusLx[Page]->SetLabel(wxString::Format( + m_TriggerStatusL[Page]->SetLabel(wxString::Format( wxT("%03i"), TriggerLeft)); - m_TriggerStatusRx[Page]->SetLabel(wxString::Format( + m_TriggerStatusR[Page]->SetLabel(wxString::Format( wxT("%03i"), TriggerRight)); } diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp index 236e5bc917..5a70ff4f01 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.cpp @@ -30,28 +30,38 @@ enum TriggerType }; BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog) + EVT_CLOSE(WiimotePadConfigDialog::OnClose) EVT_BUTTON(ID_CLOSE, WiimotePadConfigDialog::CloseClick) EVT_BUTTON(ID_APPLY, WiimotePadConfigDialog::CloseClick) + EVT_TIMER(IDTM_BUTTON, WiimotePadConfigDialog::OnButtonTimer) + EVT_TIMER(IDTM_UPDATE_PAD, WiimotePadConfigDialog::UpdatePad) + 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) - EVT_COMBOBOX(ID_TILT_RANGE_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_LEFT_DIAGONAL, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_DEAD_ZONE_LEFT, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_DEAD_ZONE_RIGHT, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(IDC_LEFT_C2S, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_TILT_INVERT_ROLL, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_CHECKBOX(ID_TILT_INVERT_PITCH, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_NUNCHUCK_STICK, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_CC_LEFT_STICK, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_CC_RIGHT_STICK, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_CC_TRIGGERS, WiimotePadConfigDialog::GeneralSettingsChanged) - + EVT_COMBOBOX(IDC_DEAD_ZONE_LEFT, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_DEAD_ZONE_RIGHT, WiimotePadConfigDialog::GeneralSettingsChanged) + 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_TRIGGER_TYPE, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_NUNCHUCK_STICK, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_CC_LEFT_STICK, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_CC_RIGHT_STICK, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_CC_TRIGGERS, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_COMBOBOX(IDC_GH3_ANALOG, WiimotePadConfigDialog::GeneralSettingsChanged) + + // Analog + EVT_BUTTON(IDB_ANALOG_LEFT_X, WiimotePadConfigDialog::GetButtons) EVT_BUTTON(IDB_ANALOG_LEFT_Y, WiimotePadConfigDialog::GetButtons) + EVT_BUTTON(IDB_ANALOG_RIGHT_X, WiimotePadConfigDialog::GetButtons) EVT_BUTTON(IDB_ANALOG_RIGHT_Y, WiimotePadConfigDialog::GetButtons) + EVT_BUTTON(IDB_TRIGGER_L, WiimotePadConfigDialog::GetButtons) EVT_BUTTON(IDB_TRIGGER_R, WiimotePadConfigDialog::GetButtons) + // Wiimote EVT_BUTTON(IDB_WM_A, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_B, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_1, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_2, WiimotePadConfigDialog::OnButtonClick) @@ -78,6 +88,7 @@ BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog) EVT_BUTTON(IDB_CC_LL, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LU, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LR, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_LD, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RL, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RU, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RR, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_CC_RD, WiimotePadConfigDialog::OnButtonClick) + // Guitar Hero 3 EVT_BUTTON(IDB_GH3_GREEN, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_RED, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_YELLOW, WiimotePadConfigDialog::OnButtonClick) @@ -85,24 +96,14 @@ BEGIN_EVENT_TABLE(WiimotePadConfigDialog,wxDialog) EVT_BUTTON(IDB_GH3_ORANGE, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_PLUS, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_MINUS, WiimotePadConfigDialog::OnButtonClick) -// EVT_COMBOBOX(IDB_GH3_WHAMMY, WiimotePadConfigDialog::GeneralSettingsChanged) - EVT_COMBOBOX(IDCB_GH3_ANALOG, WiimotePadConfigDialog::GeneralSettingsChanged) + EVT_BUTTON(IDB_GH3_WHAMMY, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_ANALOG_LEFT, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_ANALOG_RIGHT, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_ANALOG_UP, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_ANALOG_DOWN, WiimotePadConfigDialog::OnButtonClick) EVT_BUTTON(IDB_GH3_STRUM_UP, WiimotePadConfigDialog::OnButtonClick) - EVT_BUTTON(IDB_GH3_STRUM_DOWN, WiimotePadConfigDialog::OnButtonClick) + EVT_BUTTON(IDB_GH3_STRUM_DOWN, WiimotePadConfigDialog::OnButtonClick) - - EVT_BUTTON(IDB_ANALOG_LEFT_X, WiimotePadConfigDialog::GetButtons) - EVT_BUTTON(IDB_ANALOG_LEFT_Y, WiimotePadConfigDialog::GetButtons) - EVT_BUTTON(IDB_ANALOG_RIGHT_X, WiimotePadConfigDialog::GetButtons) - EVT_BUTTON(IDB_ANALOG_RIGHT_Y, WiimotePadConfigDialog::GetButtons) - EVT_BUTTON(IDB_TRIGGER_L, WiimotePadConfigDialog::GetButtons) - EVT_BUTTON(IDB_TRIGGER_R, WiimotePadConfigDialog::GetButtons) - EVT_TIMER(IDTM_BUTTON, WiimotePadConfigDialog::OnButtonTimer) - EVT_TIMER(IDTM_UPDATE_PAD, WiimotePadConfigDialog::UpdatePad) END_EVENT_TABLE() WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, const wxString &title, @@ -111,7 +112,7 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, { #if wxUSE_TIMER m_ButtonMappingTimer = new wxTimer(this, IDTM_BUTTON); - m_UpdatePad = new wxTimer(this, IDTM_UPDATE_PAD); + m_UpdatePadTimer = new wxTimer(this, IDTM_UPDATE_PAD); // Reset values GetButtonWaitingID = 0; @@ -119,7 +120,7 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, // Start the permanent timer const int TimesPerSecond = 10; - m_UpdatePad->Start( floor((double)(1000 / TimesPerSecond)) ); + m_UpdatePadTimer->Start( floor((double)(1000 / TimesPerSecond)) ); #endif ControlsCreated = false; @@ -141,9 +142,15 @@ WiimotePadConfigDialog::WiimotePadConfigDialog(wxWindow *parent, wxWindowID id, WiimotePadConfigDialog::~WiimotePadConfigDialog() { if (m_ButtonMappingTimer) + { delete m_ButtonMappingTimer; - if (m_UpdatePad) - delete m_UpdatePad; + m_ButtonMappingTimer = NULL; + } + if (m_UpdatePadTimer) + { + delete m_UpdatePadTimer; + m_UpdatePadTimer = NULL; + } } void WiimotePadConfigDialog::OnKeyDown(wxKeyEvent& event) @@ -218,8 +225,8 @@ void WiimotePadConfigDialog::OnButtonClick(wxCommandEvent& event) void WiimotePadConfigDialog::OnClose(wxCloseEvent& event) { - if (m_UpdatePad) - m_UpdatePad->Stop(); + if (m_UpdatePadTimer) + m_UpdatePadTimer->Stop(); if (m_ButtonMappingTimer) m_ButtonMappingTimer->Stop(); SaveButtonMappingAll(Page); @@ -239,8 +246,6 @@ void WiimotePadConfigDialog::CloseClick(wxCommandEvent& event) } } - - void WiimotePadConfigDialog::DoSave(bool ChangePad, int Slot) { // Replace "" with "-1" before we are saving @@ -279,9 +284,6 @@ wxBitmap WiimotePadConfigDialog::CreateBitmap() dc.SelectObject(bitmap); // Set outline and fill colors - //wxBrush LightBlueBrush(_T("#0383f0")); - //wxPen LightBluePen(_T("#80c5fd")); - //wxPen LightGrayPen(_T("#909090")); wxPen LightBluePen(_T("#7f9db9")); // Windows XP color dc.SetPen(LightBluePen); dc.SetBrush(*wxWHITE_BRUSH); @@ -291,6 +293,7 @@ wxBitmap WiimotePadConfigDialog::CreateBitmap() dc.SelectObject(wxNullBitmap); return bitmap; } + wxBitmap WiimotePadConfigDialog::CreateBitmapDot() { int w = 2, h = 2; @@ -299,8 +302,6 @@ wxBitmap WiimotePadConfigDialog::CreateBitmapDot() dc.SelectObject(bitmap); // Set outline and fill colors - //wxBrush RedBrush(_T("#0383f0")); - //wxPen RedPen(_T("#80c5fd")); dc.SetPen(*wxRED_PEN); dc.SetBrush(*wxRED_BRUSH); @@ -309,6 +310,7 @@ wxBitmap WiimotePadConfigDialog::CreateBitmapDot() dc.SelectObject(wxNullBitmap); return bitmap; } + wxBitmap WiimotePadConfigDialog::CreateBitmapDeadZone(int Radius) { wxBitmap bitmap(Radius*2, Radius*2); @@ -322,30 +324,23 @@ wxBitmap WiimotePadConfigDialog::CreateBitmapDeadZone(int Radius) //dc.SetBackground(*wxGREEN_BRUSH); dc.Clear(); dc.DrawCircle(Radius, Radius, Radius); - //dc.SelectObject(wxNullBitmap); + dc.SelectObject(wxNullBitmap); return bitmap; } + wxBitmap WiimotePadConfigDialog::CreateBitmapClear() { wxBitmap bitmap(BoxW, BoxH); wxMemoryDC dc; dc.SelectObject(bitmap); - - // Set outline and fill colors - //dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.Clear(); - //dc.DrawRectangle(0, 0, BoxW, BoxH); - //dc.SelectObject(wxNullBitmap); + dc.SelectObject(wxNullBitmap); return bitmap; } - - void WiimotePadConfigDialog::CreatePadGUIControls() { - - // Search for devices and add them to the device list wxArrayString StrJoyname; // The string array if (WiiMoteEmu::NumGoodPads > 0) @@ -358,6 +353,21 @@ void WiimotePadConfigDialog::CreatePadGUIControls() StrJoyname.Add(wxString::FromAscii("")); } + wxArrayString TextDeadZone; + for (int i = 0; i <= 50; i++) + TextDeadZone.Add(wxString::Format(wxT("%i%%"), i)); + + wxArrayString StrDiagonal; + StrDiagonal.Add(wxT("100%")); + StrDiagonal.Add(wxT("95%")); + StrDiagonal.Add(wxT("90%")); + StrDiagonal.Add(wxT("85%")); + StrDiagonal.Add(wxT("80%")); + + wxArrayString StrRumble; + for (int i = 0; i <= 10; i++) + StrRumble.Add(wxString::Format(wxT("%i%%"), i*10)); + // The tilt list wxArrayString StrTilt; StrTilt.Add(wxString::FromAscii("")); @@ -365,6 +375,7 @@ void WiimotePadConfigDialog::CreatePadGUIControls() StrTilt.Add(wxString::FromAscii("Analog 1")); StrTilt.Add(wxString::FromAscii("Analog 2")); StrTilt.Add(wxString::FromAscii("Triggers")); + // The range is in degrees and are set at even 5 degrees values wxArrayString StrTiltRangeRoll, StrTiltRangePitch; StrTiltRangeRoll.Add(wxString::Format(wxT("Free Swing"))); @@ -374,21 +385,6 @@ 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 @@ -405,6 +401,101 @@ void WiimotePadConfigDialog::CreatePadGUIControls() StrCcTriggers.Add(wxString::FromAscii("Keyboard")); StrCcTriggers.Add(wxString::FromAscii("Triggers")); + // GH3 stick list + wxArrayString StrAnalogArray; + StrAnalogArray.Add(wxString::FromAscii("Analog 1")); + StrAnalogArray.Add(wxString::FromAscii("Analog 2")); + + static const wxChar* anText[] = + { + wxT("Left X-Axis"), + wxT("Left Y-Axis"), + wxT("Right X-Axis"), + wxT("Right Y-Axis"), + wxT("Left Trigger"), + wxT("Right Trigger"), + }; + + static const wxChar* wmText[] = + { + wxT("A"), + wxT("B"), + wxT("1"), + wxT("2"), + wxT("+"), + wxT("- "), // Intentional space + wxT("Home"), + wxT("Left"), + wxT("Right"), + wxT("Up"), + wxT("Down"), + wxT("Roll Left"), + wxT("Roll Right"), + wxT("Pitch Up"), + wxT("Pitch Down"), + wxT("Shake"), + }; + + static const wxChar* ncText[] = + { + wxT("Z"), + wxT("C"), + wxT("Left"), + wxT("Right"), + wxT("Up"), + wxT("Down"), + wxT("Shake"), + }; + + static const wxChar* classicText[] = + { + wxT("A"), + wxT("B"), + wxT("X"), + wxT("Y"), + wxT("+"), + wxT("- "), + wxT("Home"), + wxT("Left trigger"), + wxT("Right trigger"), + wxT("Left Z"), + wxT("Right Z"), + wxT("Digital Left"), + wxT("Digital Right"), + wxT("Digital Up"), + wxT("Digital Down"), + wxT("L Left"), + wxT("L Right"), + wxT("L Up"), + wxT("L Down"), + wxT("R Left"), + wxT("R Right"), + wxT("R Up"), + wxT("R Down"), + }; + + static const wxChar* gh3Text[] = + { + wxT("Green"), + wxT("Red"), + wxT("Yellow"), + wxT("Blue"), + wxT("Orange"), + wxT("+"), + wxT("- "), + wxT("Whammy"), + wxT("Left"), //analog stick + wxT("Right"), + wxT("Up"), + wxT("Down"), + wxT("Strum Up"), + wxT("Strum Down"), + }; + + // Configuration controls sizes + static const int TxtW = 50, TxtH = 20, BtW = 70, BtH = 20; + // A small type font + wxFont m_SmallFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); @@ -413,190 +504,111 @@ void WiimotePadConfigDialog::CreatePadGUIControls() m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize); m_Notebook->AddPage(m_Controller[i], wxString::Format(wxT("Wiimote %d"), i+1)); - // A small type font - wxFont m_SmallFont(7, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); - - // Configuration controls sizes - static const int TxtW = 50, TxtH = 20, BtW = 70, BtH = 20; - // Controller m_Joyname[i] = new wxComboBox(m_Controller[i], IDC_JOYNAME, StrJoyname[0], wxDefaultPosition, wxSize(200, -1), StrJoyname, wxCB_READONLY); - + m_Joyname[i]->SetToolTip(wxT("Save your settings and configure another joypad")); + + // Dead zone + m_ComboDeadZoneLabel[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Dead Zone")); + m_ComboDeadZoneLeft[i] = new wxComboBox(m_Controller[i], IDC_DEAD_ZONE_LEFT, TextDeadZone[0], wxDefaultPosition, wxSize(50, -1), TextDeadZone, wxCB_READONLY); + m_ComboDeadZoneRight[i] = new wxComboBox(m_Controller[i], IDC_DEAD_ZONE_RIGHT, TextDeadZone[0], wxDefaultPosition, wxSize(50, -1), TextDeadZone, wxCB_READONLY); + // Circle to square - m_CheckC2S[i] = new wxCheckBox(m_Controller[i], IDC_LEFT_C2S, wxT("Circle To Square")); + m_CheckC2S[i] = new wxCheckBox(m_Controller[i], IDC_STICK_C2S, wxT("Circle To Square")); + m_CheckC2S[i]->SetToolTip(wxT("This will convert a circular stick radius to a square stick radius.\n") + wxT("This can be useful for the pitch and roll emulation.")); // The drop down menu for the circle to square adjustment - m_CheckC2SLabel[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Diagonal")); - - m_ComboDiagonal[i] = new wxComboBox(m_Controller[i], IDCB_LEFT_DIAGONAL, asStatusInSet[0], wxDefaultPosition, wxSize(50, -1), asStatusInSet, wxCB_READONLY); - + m_DiagonalLabel[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Diagonal")); + m_DiagonalLabel[i]->SetToolTip(wxT("To produce a perfect square circle in the 'Out' window you have to manually set\n") + wxT("your diagonal values here from what is shown in the 'In' window.")); + m_ComboDiagonal[i] = new wxComboBox(m_Controller[i], IDC_STICK_DIAGONAL, StrDiagonal[0], wxDefaultPosition, wxSize(50, -1), StrDiagonal, wxCB_READONLY); + + // Rumble 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")); - 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")); - m_CheckC2S[i]->SetToolTip(wxT("This will convert a circular stick radius to a square stick radius.") - wxT(" This can be useful for the pitch and roll emulation.")); - m_CheckC2SLabel[i]->SetToolTip( - wxT("To produce a perfect square circle in the 'Out' window you have to manually set") - wxT("\nyour diagonal values here from what is shown in the 'In' window.")); - // Sizers - 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_sDeadZoneHoriz[i] = new wxBoxSizer(wxHORIZONTAL); + m_sDeadZoneHoriz[i]->Add(m_ComboDeadZoneLeft[i], 0, (wxUP), 0); + m_sDeadZoneHoriz[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); + m_sDeadZone[i] = new wxBoxSizer(wxVERTICAL); + m_sDeadZone[i]->Add(m_ComboDeadZoneLabel[i], 0, wxALIGN_CENTER | (wxUP), 0); + m_sDeadZone[i]->Add(m_sDeadZoneHoriz[i], 0, wxALIGN_CENTER | (wxUP), 2); - m_gCircle2Square[i] = new wxBoxSizer(wxHORIZONTAL); - m_gCircle2Square[i]->Add(m_CheckC2SLabel[i], 0, (wxUP), 4); - m_gCircle2Square[i]->Add(m_ComboDiagonal[i], 0, (wxLEFT), 2); + m_sDiagonal[i] = new wxBoxSizer(wxHORIZONTAL); + m_sDiagonal[i]->Add(m_DiagonalLabel[i], 0, (wxUP), 4); + m_sDiagonal[i]->Add(m_ComboDiagonal[i], 0, (wxLEFT), 2); - m_gCircle2SquareVert[i] = new wxBoxSizer(wxVERTICAL); - m_gCircle2SquareVert[i]->Add(m_CheckC2S[i], 0, wxALIGN_CENTER | (wxUP), 0); - m_gCircle2SquareVert[i]->Add(m_gCircle2Square[i], 0, wxALIGN_CENTER | (wxUP), 2); + m_sCircle2Square[i] = new wxBoxSizer(wxVERTICAL); + m_sCircle2Square[i]->Add(m_CheckC2S[i], 0, wxALIGN_CENTER | (wxUP), 0); + m_sCircle2Square[i]->Add(m_sDiagonal[i], 0, wxALIGN_CENTER | (wxUP), 2); - m_gC2SDeadZone[i] = new wxBoxSizer(wxHORIZONTAL); - m_gC2SDeadZone[i]->Add(m_gDeadZone[i], 0, (wxUP), 0); - m_gC2SDeadZone[i]->Add(m_gCircle2SquareVert[i], 0, (wxLEFT), 8); + m_sC2SDeadZone[i] = new wxBoxSizer(wxHORIZONTAL); + m_sC2SDeadZone[i]->Add(m_sDeadZone[i], 0, (wxUP), 0); + m_sC2SDeadZone[i]->Add(m_sCircle2Square[i], 0, (wxLEFT), 8); - 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_sJoyname[i] = new wxBoxSizer(wxVERTICAL); + m_sJoyname[i]->Add(m_Joyname[i], 0, wxALIGN_CENTER | (wxUP | wxDOWN), 4); + m_sJoyname[i]->Add(m_sC2SDeadZone[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_sRumble[i] = new wxBoxSizer(wxVERTICAL); + m_sRumble[i]->Add(m_CheckRumble[i], 0, wxALIGN_CENTER | (wxUP | wxDOWN), 8); + m_sRumble[i]->Add(m_RumbleStrengthLabel[i], 0, wxALIGN_CENTER | (wxUP), 4); + m_sRumble[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]->Add(m_sJoyname[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); + m_gJoyPad[i]->Add(m_sRumble[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); 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]->SetSelection(g_Config.Tilt.Type); + m_TiltComboInput[i]->SetToolTip(wxT("Control tilting by an analog gamepad stick, an analog trigger or the keyboard.")); - // Controls - m_TiltComboInput[i] = new wxComboBox(m_Controller[i], ID_TILT_INPUT, StrTilt[0], wxDefaultPosition, wxSize(100, -1), StrTilt, wxCB_READONLY); - m_TiltComboRangeRoll[i] = new wxComboBox(m_Controller[i], ID_TILT_RANGE_ROLL, StrTiltRangeRoll[0], wxDefaultPosition, wxSize(75, -1), StrTiltRangeRoll, wxCB_READONLY); - m_TiltComboRangePitch[i] = new wxComboBox(m_Controller[i], ID_TILT_RANGE_PITCH, StrTiltRangePitch[0], wxDefaultPosition, wxSize(75, -1), StrTiltRangePitch, wxCB_READONLY); 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_TiltInvertRoll[i] = new wxCheckBox(m_Controller[i], ID_TILT_INVERT_ROLL, wxT("Invert")); - m_TiltInvertPitch[i] = new wxCheckBox(m_Controller[i], ID_TILT_INVERT_PITCH, wxT("Invert")); + + m_TiltComboRangeRoll[i] = new wxComboBox(m_Controller[i], IDC_TILT_RANGE_ROLL, StrTiltRangeRoll[0], wxDefaultPosition, wxSize(75, -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_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")); // Sizers - m_TiltGrid[i] = new wxGridBagSizer(0, 0); - m_TiltGrid[i]->Add(m_TiltTextRoll[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxTOP), 4); - m_TiltGrid[i]->Add(m_TiltComboRangeRoll[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT), 2); - m_TiltGrid[i]->Add(m_TiltInvertRoll[i], wxGBPosition(0, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4); - - m_TiltGrid[i]->Add(m_TiltTextPitch[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxTOP), 6); - m_TiltGrid[i]->Add(m_TiltComboRangePitch[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxLEFT | wxTOP | wxDOWN), 2); - m_TiltGrid[i]->Add(m_TiltInvertPitch[i], wxGBPosition(1, 2), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4); - - // For additional padding options if needed - //m_TiltHoriz[i] = new wxBoxSizer(wxHORIZONTAL); + 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_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_TiltGrid[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5); + m_gTilt[i]->Add(m_sGridTilt[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5); m_gTilt[i]->AddStretchSpacer(); - //Set values - m_TiltComboInput[i]->SetSelection(g_Config.Trigger.Type); - m_TiltComboRangeRoll[i]->SetValue(wxString::Format(wxT("%i"), g_Config.Trigger.Range.Roll)); - m_TiltComboRangePitch[i]->SetValue(wxString::Format(wxT("%i"), g_Config.Trigger.Range.Pitch)); + // Row 1 Sizers: Connected pads, tilt + m_sHorizController[i] = new wxBoxSizer(wxHORIZONTAL); + m_sHorizController[i]->Add(m_gJoyPad[i], 0, wxEXPAND | (wxLEFT), 5); + m_sHorizController[i]->Add(m_gTilt[i], 0, wxEXPAND | (wxLEFT), 5); - // Tooltips - m_TiltComboInput[i]->SetToolTip(wxT("Control tilting by an analog gamepad stick, an analog trigger or the keyboard.")); - m_TiltComboRangeRoll[i]->SetToolTip(wxT("The maximum roll in degrees. Set to 0 to turn off.")); - m_TiltComboRangePitch[i]->SetToolTip(wxT("The maximum pitch in degrees. Set to 0 to turn off.")); - // Analog triggers - m_gTrigger[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Triggers")); - - m_TriggerStatusL[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left: ")); - m_TriggerStatusR[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Right: ")); - m_TriggerStatusLx[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("000"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); - m_TriggerStatusRx[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("000"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); - - m_tAnalogTriggerInput[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Input")); - m_tAnalogTriggerL[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left")); - m_tAnalogTriggerR[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Right")); - - m_AnalogTriggerL[i] = new wxTextCtrl(m_Controller[i], ID_TRIGGER_L, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE); - m_AnalogTriggerR[i] = new wxTextCtrl(m_Controller[i], ID_TRIGGER_R, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE); - - m_AnalogTriggerL[i]->Enable(false); - m_AnalogTriggerR[i]->Enable(false); - - 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(70, -1), StrTriggerType, wxCB_READONLY); - - m_SizeAnalogTriggerStatusBox[i] = new wxGridBagSizer(0, 0); - m_SizeAnalogTriggerHorizConfig[i] = new wxGridBagSizer(0, 0); - m_SizeAnalogTriggerVertLeft[i] = new wxBoxSizer(wxVERTICAL); - m_SizeAnalogTriggerVertRight[i] = new wxBoxSizer(wxVERTICAL); - m_SizeAnalogTriggerHorizInput[i] = new wxBoxSizer(wxHORIZONTAL); - - // The status text boxes - m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusL[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxUP), 0); - m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusLx[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxUP), 0); - m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusR[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxUP), 0); - m_SizeAnalogTriggerStatusBox[i]->Add(m_TriggerStatusRx[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxUP), 0); - - m_SizeAnalogTriggerHorizConfig[i]->Add(m_tAnalogTriggerL[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxUP), 2); - m_SizeAnalogTriggerHorizConfig[i]->Add(m_AnalogTriggerL[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT | wxRIGHT), 2); - m_SizeAnalogTriggerHorizConfig[i]->Add(m_bAnalogTriggerL[i], wxGBPosition(0, 2), wxGBSpan(1, 1), (wxUP), 2); - m_SizeAnalogTriggerHorizConfig[i]->Add(m_tAnalogTriggerR[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxUP), 4); - m_SizeAnalogTriggerHorizConfig[i]->Add(m_AnalogTriggerR[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxLEFT | wxUP | wxRIGHT), 2); - m_SizeAnalogTriggerHorizConfig[i]->Add(m_bAnalogTriggerR[i], wxGBPosition(1, 2), wxGBSpan(1, 1), (wxUP), 5); - - // The choice box and its name label - m_SizeAnalogTriggerHorizInput[i]->Add(m_tAnalogTriggerInput[i], 0, (wxUP), 3); - m_SizeAnalogTriggerHorizInput[i]->Add(m_TriggerType[i], 0, (wxLEFT), 2); - - // The status text boxes - m_SizeAnalogTriggerVertLeft[i]->AddStretchSpacer(); - m_SizeAnalogTriggerVertLeft[i]->Add(m_SizeAnalogTriggerStatusBox[i]); - m_SizeAnalogTriggerVertLeft[i]->AddStretchSpacer(); - - // The config grid and the input type choice box - m_SizeAnalogTriggerVertRight[i]->Add(m_SizeAnalogTriggerHorizConfig[i], 0, (wxUP), 2); - m_SizeAnalogTriggerVertRight[i]->Add(m_SizeAnalogTriggerHorizInput[i], 0, (wxUP | wxDOWN), 4); - - m_gTrigger[i]->Add(m_SizeAnalogTriggerVertLeft[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5); - m_gTrigger[i]->Add(m_SizeAnalogTriggerVertRight[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5); - - // Row 2 Sizers: Connected pads, tilt, triggers - m_HorizControllerTilt[i] = new wxBoxSizer(wxHORIZONTAL); - 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); - - m_HorizControllerTiltParent[i] = new wxBoxSizer(wxBOTH); - m_HorizControllerTiltParent[i]->Add(m_HorizControllerTilt[i]); - - // Analog sticks - - // Status panels - m_TStatusLeftIn[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("In")); - m_TStatusLeftOut[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Out")); - m_TStatusRightIn[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("In")); - m_TStatusRightOut[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Out")); + // Stick Status Panels + m_tStatusLeftIn[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("In")); + m_tStatusLeftOut[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Out")); + m_tStatusRightIn[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("In")); + m_tStatusRightOut[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Out")); m_pLeftInStatus[i] = new wxPanel(m_Controller[i], wxID_ANY, wxDefaultPosition, wxDefaultSize); m_bmpSquareLeftIn[i] = new wxStaticBitmap(m_pLeftInStatus[i], wxID_ANY, CreateBitmap(), wxDefaultPosition, wxDefaultSize); @@ -616,156 +628,128 @@ void WiimotePadConfigDialog::CreatePadGUIControls() m_bmpSquareRightOut[i] = new wxStaticBitmap(m_pRightOutStatus[i], wxID_ANY, CreateBitmap(), wxDefaultPosition, wxDefaultSize); m_bmpDotRightOut[i] = new wxStaticBitmap(m_pRightOutStatus[i], wxID_ANY, CreateBitmapDot(), wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize); - m_AnalogLeftX[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_LEFT_X, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE); - m_AnalogLeftY[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_LEFT_Y, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE); - m_AnalogRightX[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_RIGHT_X, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE); - m_AnalogRightY[i] = new wxTextCtrl(m_Controller[i], ID_ANALOG_RIGHT_Y, wxT(""), wxDefaultPosition, wxSize(TxtW, TxtH), wxTE_READONLY | wxTE_CENTRE); + // Sizers + m_sGridStickLeft[i] = new wxGridBagSizer(0, 0); + m_sGridStickLeft[i]->Add(m_pLeftInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0); + m_sGridStickLeft[i]->Add(m_pLeftOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 10); + m_sGridStickLeft[i]->Add(m_tStatusLeftIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0); + m_sGridStickLeft[i]->Add(m_tStatusLeftOut[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 10); - m_AnalogLeftX[i]->Enable(false); - m_AnalogLeftY[i]->Enable(false); - m_AnalogRightX[i]->Enable(false); - m_AnalogRightY[i]->Enable(false); + m_sGridStickRight[i] = new wxGridBagSizer(0, 0); + m_sGridStickRight[i]->Add(m_pRightInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0); + m_sGridStickRight[i]->Add(m_pRightOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 10); + m_sGridStickRight[i]->Add(m_tStatusRightIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0); + m_sGridStickRight[i]->Add(m_tStatusRightOut[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 10); - m_bAnalogLeftX[i] = new wxButton(m_Controller[i], IDB_ANALOG_LEFT_X, wxEmptyString, wxDefaultPosition, wxSize(21, 14)); - m_bAnalogLeftY[i] = new wxButton(m_Controller[i], IDB_ANALOG_LEFT_Y, wxEmptyString, wxDefaultPosition, wxSize(21, 14)); - m_bAnalogRightX[i] = new wxButton(m_Controller[i], IDB_ANALOG_RIGHT_X, wxEmptyString, wxDefaultPosition, wxSize(21, 14)); - m_bAnalogRightY[i] = new wxButton(m_Controller[i], IDB_ANALOG_RIGHT_Y, wxEmptyString, wxDefaultPosition, wxSize(21, 14)); + m_gStickLeft[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog 1 Status (In) (Out)")); + m_gStickLeft[i]->Add(m_sGridStickLeft[i], 0, (wxLEFT | wxRIGHT), 5); - m_SizeAnalogLeft[i] = new wxBoxSizer(wxVERTICAL); m_SizeAnalogLeftHorizX[i] = new wxBoxSizer(wxHORIZONTAL); m_SizeAnalogLeftHorizY[i] = new wxBoxSizer(wxHORIZONTAL); - m_SizeAnalogRight[i] = new wxBoxSizer(wxVERTICAL); m_SizeAnalogRightHorizX[i] = new wxBoxSizer(wxHORIZONTAL); m_SizeAnalogRightHorizY[i] = new wxBoxSizer(wxHORIZONTAL); + m_gStickRight[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog 2 Status (In) (Out)")); + m_gStickRight[i]->Add(m_sGridStickRight[i], 0, (wxLEFT | wxRIGHT), 5); - m_tAnalogX[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("X-Axis")); - m_tAnalogX[i + 4] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("X-Axis")); - m_tAnalogY[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Y-Axis")); - m_tAnalogY[i + 4] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Y-Axis")); + // Trigger Status Panels + m_TriggerL[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left: ")); + m_TriggerR[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Right: ")); + m_TriggerStatusL[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("000"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); + m_TriggerStatusR[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("000"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); + m_tTriggerSource[i]= new wxStaticText(m_Controller[i], wxID_ANY, wxT("Input Source")); + m_TriggerType[i] = new wxComboBox(m_Controller[i], IDC_TRIGGER_TYPE, StrTriggerType[0], wxDefaultPosition, wxSize(70, -1), StrTriggerType, wxCB_READONLY); - // Configuration sizers - m_SizeAnalogLeftHorizX[i]->Add(m_tAnalogX[i], 0, (wxUP), 2); - m_SizeAnalogLeftHorizX[i]->Add(m_AnalogLeftX[i], 0, (wxRIGHT), 2); - m_SizeAnalogLeftHorizX[i]->Add(m_bAnalogLeftX[i], 0, (wxUP), 2); - m_SizeAnalogLeftHorizY[i]->Add(m_tAnalogY[i], 0, (wxUP), 4); - m_SizeAnalogLeftHorizY[i]->Add(m_AnalogLeftY[i], 0, (wxUP | wxRIGHT), 2); - m_SizeAnalogLeftHorizY[i]->Add(m_bAnalogLeftY[i], 0, (wxUP), 4); + // Sizers + m_sGridTrigger[i] = new wxGridBagSizer(0, 0); + m_sGridTrigger[i]->Add(m_TriggerL[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxTOP), 4); + m_sGridTrigger[i]->Add(m_TriggerStatusL[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4); + m_sGridTrigger[i]->Add(m_TriggerR[i], wxGBPosition(1, 0), wxGBSpan(1, 1), (wxTOP), 4); + m_sGridTrigger[i]->Add(m_TriggerStatusR[i], wxGBPosition(1, 1), wxGBSpan(1, 1), (wxLEFT | wxTOP), 4); - m_SizeAnalogRightHorizX[i]->Add(m_tAnalogX[i + 4], 0, (wxUP), 2); - m_SizeAnalogRightHorizX[i]->Add(m_AnalogRightX[i], 0, (wxRIGHT), 2); - m_SizeAnalogRightHorizX[i]->Add(m_bAnalogRightX[i], 0, (wxUP), 2); - m_SizeAnalogRightHorizY[i]->Add(m_tAnalogY[i + 4], 0, (wxUP), 4); - m_SizeAnalogRightHorizY[i]->Add(m_AnalogRightY[i], 0, (wxUP | wxRIGHT), 2); - m_SizeAnalogRightHorizY[i]->Add(m_bAnalogRightY[i], 0, (wxUP), 4); + m_gTriggers[i] = new wxStaticBoxSizer (wxVERTICAL, m_Controller[i], wxT("Triggers Status")); + m_gTriggers[i]->AddStretchSpacer(); + m_gTriggers[i]->Add(m_sGridTrigger[i], 0, wxEXPAND | (wxLEFT | wxRIGHT), 5); + m_gTriggers[i]->Add(m_tTriggerSource[i], 0, wxEXPAND | (wxUP | wxLEFT | wxRIGHT), 5); + m_gTriggers[i]->Add(m_TriggerType[i], 0, wxEXPAND | (wxUP | wxLEFT | wxRIGHT), 5); + m_gTriggers[i]->AddStretchSpacer(); - m_SizeAnalogLeft[i]->AddStretchSpacer(); - m_SizeAnalogLeft[i]->Add(m_SizeAnalogLeftHorizX[i], 0, (wxUP), 0); - m_SizeAnalogLeft[i]->Add(m_SizeAnalogLeftHorizY[i], 0, (wxUP), 0); - m_SizeAnalogLeft[i]->AddStretchSpacer(); - m_SizeAnalogRight[i]->AddStretchSpacer(); - m_SizeAnalogRight[i]->Add(m_SizeAnalogRightHorizX[i], 0, (wxUP), 0); - m_SizeAnalogRight[i]->Add(m_SizeAnalogRightHorizY[i], 0, (wxUP), 0); - m_SizeAnalogRight[i]->AddStretchSpacer(); - - // Status sizers - m_GridLeftStick[i] = new wxGridBagSizer(0, 0); - m_GridLeftStick[i]->Add(m_pLeftInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0); - m_GridLeftStick[i]->Add(m_pLeftOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 5); - m_GridLeftStick[i]->Add(m_TStatusLeftIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0); - m_GridLeftStick[i]->Add(m_TStatusLeftOut[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 5); - - m_GridRightStick[i] = new wxGridBagSizer(0, 0); - m_GridRightStick[i]->Add(m_pRightInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0); - m_GridRightStick[i]->Add(m_pRightOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 5); - m_GridRightStick[i]->Add(m_TStatusRightIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0); - m_GridRightStick[i]->Add(m_TStatusRightOut[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 5); - - m_gAnalogLeft[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog 1 (In) (Out)")); - m_gAnalogLeft[i]->Add(m_GridLeftStick[i], 0, (wxLEFT | wxRIGHT), 5); - m_gAnalogLeft[i]->Add(m_SizeAnalogLeft[i], 0, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0); - - m_gAnalogRight[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog 2 (In) (Out)")); - m_gAnalogRight[i]->Add(m_GridRightStick[i], 0, (wxLEFT | wxRIGHT), 5); - m_gAnalogRight[i]->Add(m_SizeAnalogRight[i], 0, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0); - - - // Row 3 Sizers - m_HorizControllers[i] = new wxBoxSizer(wxHORIZONTAL); - //m_HorizControllers[i]->AddStretchSpacer(); - m_HorizControllers[i]->AddSpacer(17); - m_HorizControllers[i]->Add(m_gAnalogLeft[i]); - m_HorizControllers[i]->Add(m_gAnalogRight[i], 0, (wxLEFT), 5); - //m_HorizControllers[i]->AddStretchSpacer(); + // Row 2 Sizers: Analog status + m_sHorizStatus[i] = new wxBoxSizer(wxHORIZONTAL); + m_sHorizStatus[i]->Add(m_gStickLeft[i], 0, wxEXPAND | (wxLEFT), 5); + m_sHorizStatus[i]->Add(m_gStickRight[i], 0, wxEXPAND | (wxLEFT), 5); + m_sHorizStatus[i]->Add(m_gTriggers[i], 0, wxEXPAND | (wxLEFT), 5); - static const wxChar* wMText[] = + // Analog Axes and Triggers Mapping + m_sAnalogLeft[i] = new wxBoxSizer(wxVERTICAL); + m_sAnalogMiddle[i] = new wxBoxSizer(wxVERTICAL); + m_sAnalogRight[i] = new wxBoxSizer(wxVERTICAL); + + for (int x = 0; x < AN_CONTROLS; x++) { - wxT("A"), - wxT("B"), - wxT("1"), - wxT("2"), - wxT("+"), - wxT("- "), // Intentional space - wxT("Home"), - wxT("Left"), - wxT("Right"), - wxT("Up"), - wxT("Down"), - wxT("Roll Left"), - wxT("Roll Right"), - wxT("Pitch Up"), - wxT("Pitch Down"), - wxT("Shake"), - }; + m_statictext_Analog[x][i] = new wxStaticText(m_Controller[i], wxID_ANY, anText[x]); + m_Button_Analog[x][i] = new wxButton(m_Controller[i], x + IDB_ANALOG_LEFT_X, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH)); + m_Button_Analog[x][i]->SetFont(m_SmallFont); + m_Sizer_Analog[x][i] = new wxBoxSizer(wxHORIZONTAL); + m_Sizer_Analog[x][i]->Add(m_statictext_Analog[x][i], 0, (wxUP), 4); + m_Sizer_Analog[x][i]->Add(m_Button_Analog[x][i], 0, (wxLEFT), 2); + if (x < 2) // Make some balance + m_sAnalogLeft[i]->Add(m_Sizer_Analog[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + else if (x < 4) + m_sAnalogMiddle[i]->Add(m_Sizer_Analog[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + else + m_sAnalogRight[i]->Add(m_Sizer_Analog[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + } - - m_SWmVertLeft[i] = new wxBoxSizer(wxVERTICAL); - m_SWmVertRight[i] = new wxBoxSizer(wxVERTICAL); + m_gAnalog[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Analog Axes and Triggers")); + m_gAnalog[i]->Add(m_sAnalogLeft[i], 0, wxALIGN_RIGHT | (wxALL), 0); + m_gAnalog[i]->Add(m_sAnalogMiddle[i], 0, wxALIGN_RIGHT | (wxLEFT), 5); + m_gAnalog[i]->Add(m_sAnalogRight[i], 0, wxALIGN_RIGHT | (wxLEFT), 5); + m_gAnalog[i]->AddSpacer(1); - for ( int x = 0; x < WM_CONTROLS; x++) + // Row 3 Sizes: Analog Mapping + m_sHorizAnalogMapping[i] = new wxBoxSizer(wxHORIZONTAL); + m_sHorizAnalogMapping[i]->Add(m_gAnalog[i], 0, (wxLEFT), 5); + + + // Wiimote Mapping + m_sWmVertLeft[i] = new wxBoxSizer(wxVERTICAL); + m_sWmVertRight[i] = new wxBoxSizer(wxVERTICAL); + + for (int x = 0; x < WM_CONTROLS; x++) { - m_statictext_Wiimote[x][i] = new wxStaticText(m_Controller[i], wxID_ANY, wMText[x]); + m_statictext_Wiimote[x][i] = new wxStaticText(m_Controller[i], wxID_ANY, wmText[x]); m_Button_Wiimote[x][i] = new wxButton(m_Controller[i], x + IDB_WM_A, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH)); m_Button_Wiimote[x][i]->SetFont(m_SmallFont); m_Sizer_Wiimote[x][i] = new wxBoxSizer(wxHORIZONTAL); m_Sizer_Wiimote[x][i]->Add(m_statictext_Wiimote[x][i], 0, (wxUP), 4); m_Sizer_Wiimote[x][i]->Add(m_Button_Wiimote[x][i], 0, (wxLEFT), 2); if (x < 7 || x == WM_CONTROLS -1) // Make some balance - m_SWmVertLeft[i]->Add(m_Sizer_Wiimote[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_sWmVertLeft[i]->Add(m_Sizer_Wiimote[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); else - m_SWmVertRight[i]->Add(m_Sizer_Wiimote[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_sWmVertRight[i]->Add(m_Sizer_Wiimote[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); } m_gWiimote[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Wiimote")); - m_gWiimote[i]->Add(m_SWmVertLeft[i], 0, wxALIGN_RIGHT | (wxALL), 0); - m_gWiimote[i]->Add(m_SWmVertRight[i], 0, wxALIGN_RIGHT | (wxLEFT), 5); + m_gWiimote[i]->Add(m_sWmVertLeft[i], 0, wxALIGN_RIGHT | (wxALL), 0); + m_gWiimote[i]->Add(m_sWmVertRight[i], 0, wxALIGN_RIGHT | (wxLEFT), 5); m_gWiimote[i]->AddSpacer(1); + // Extension Mapping if(g_Config.iExtensionConnected == EXT_NUNCHUCK) { // Stick controls m_NunchuckTextStick[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Stick")); - m_NunchuckComboStick[i] = new wxComboBox(m_Controller[i], IDCB_NUNCHUCK_STICK, StrNunchuck[0], wxDefaultPosition, wxSize(100, -1), StrNunchuck, wxCB_READONLY); + m_NunchuckComboStick[i] = new wxComboBox(m_Controller[i], IDC_NUNCHUCK_STICK, StrNunchuck[0], wxDefaultPosition, wxSize(70, -1), StrNunchuck, wxCB_READONLY); + m_NunchuckComboStick[i]->SetSelection(g_Config.Nunchuck.Type); - - static const wxChar* nCText[] = - { - wxT("Z"), - wxT("C"), - wxT("Left"), - wxT("Right"), - wxT("Up"), - wxT("Down"), - wxT("Shake"), - }; - - m_NunchuckStick[i] = new wxBoxSizer(wxHORIZONTAL); - m_NunchuckStick[i]->Add(m_NunchuckTextStick[i], 0, (wxUP), 4); - m_NunchuckStick[i]->Add(m_NunchuckComboStick[i], 0, (wxLEFT), 2); + m_sNunchuckStick[i] = new wxBoxSizer(wxHORIZONTAL); + m_sNunchuckStick[i]->Add(m_NunchuckTextStick[i], 0, (wxUP), 4); + m_sNunchuckStick[i]->Add(m_NunchuckComboStick[i], 0, (wxLEFT), 2); m_gNunchuck[i] = new wxStaticBoxSizer (wxVERTICAL, m_Controller[i], wxT("Nunchuck")); - m_gNunchuck[i]->Add(m_NunchuckStick[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 2); + m_gNunchuck[i]->Add(m_sNunchuckStick[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 2); m_gNunchuck[i]->AddSpacer(2); - for ( int x = 0; x < NC_CONTROLS; x++) + for (int x = 0; x < NC_CONTROLS; x++) { - m_statictext_NunChuck[x][i] = new wxStaticText(m_Controller[i], wxID_ANY, nCText[x]); + m_statictext_NunChuck[x][i] = new wxStaticText(m_Controller[i], wxID_ANY, ncText[x]); m_Button_NunChuck[x][i] = new wxButton(m_Controller[i], x + IDB_NC_Z, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH)); m_Button_NunChuck[x][i]->SetFont(m_SmallFont); m_Sizer_NunChuck[x][i] = new wxBoxSizer(wxHORIZONTAL); @@ -773,46 +757,21 @@ void WiimotePadConfigDialog::CreatePadGUIControls() m_Sizer_NunChuck[x][i]->Add(m_Button_NunChuck[x][i], 0, wxALIGN_RIGHT | (wxLEFT), 2); m_gNunchuck[i]->Add(m_Sizer_NunChuck[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); } - - m_NunchuckComboStick[i]->SetSelection(g_Config.Nunchuck.Type); } else if(g_Config.iExtensionConnected == EXT_CLASSIC_CONTROLLER) { // Stick controls m_CcTextLeftStick[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Left stick")); - m_CcComboLeftStick[i] = new wxComboBox(m_Controller[i], IDCB_CC_LEFT_STICK, StrNunchuck[0], wxDefaultPosition, wxSize(70, -1), StrNunchuck, wxCB_READONLY); + m_CcComboLeftStick[i] = new wxComboBox(m_Controller[i], IDC_CC_LEFT_STICK, StrNunchuck[0], wxDefaultPosition, wxSize(70, -1), StrNunchuck, wxCB_READONLY); + m_CcComboLeftStick[i]->SetSelection(g_Config.ClassicController.LType); m_CcTextRightStick[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Right stick")); - m_CcComboRightStick[i] = new wxComboBox(m_Controller[i], IDCB_CC_RIGHT_STICK, StrNunchuck[0], wxDefaultPosition, wxSize(70, -1), StrNunchuck, wxCB_READONLY); + m_CcComboRightStick[i] = new wxComboBox(m_Controller[i], IDC_CC_RIGHT_STICK, StrNunchuck[0], wxDefaultPosition, wxSize(70, -1), StrNunchuck, wxCB_READONLY); + m_CcComboRightStick[i]->SetSelection(g_Config.ClassicController.RType); m_CcTextTriggers[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Triggers")); - m_CcComboTriggers[i] = new wxComboBox(m_Controller[i], IDCB_CC_TRIGGERS, StrCcTriggers[0], wxDefaultPosition, wxSize(70, -1), StrCcTriggers, wxCB_READONLY); + m_CcComboTriggers[i] = new wxComboBox(m_Controller[i], IDC_CC_TRIGGERS, StrCcTriggers[0], wxDefaultPosition, wxSize(70, -1), StrCcTriggers, wxCB_READONLY); + m_CcComboTriggers[i]->SetSelection(g_Config.ClassicController.TType); - static const wxChar* classicText[] = - { - wxT("A"), - wxT("B"), - wxT("X"), - wxT("Y"), - wxT("+"), - wxT("- "), - wxT("Home"), - wxT("Left trigger"), - wxT("Right trigger"), - wxT("Left Z"), - wxT("Right Z"), - wxT("Digital Left"), - wxT("Digital Right"), - wxT("Digital Up"), - wxT("Digital Down"), - wxT("L Left"), - wxT("L Right"), - wxT("L Up"), - wxT("L Down"), - wxT("R Left"), - wxT("R Right"), - wxT("R Up"), - wxT("R Down"), - }; - for ( int x = 0; x < CC_CONTROLS; x++) + for (int x = 0; x < CC_CONTROLS; x++) { m_statictext_Classic[x][i] = new wxStaticText(m_Controller[i], wxID_ANY, classicText[x]); m_Button_Classic[x][i] = new wxButton(m_Controller[i], x + IDB_CC_A, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH)); @@ -823,172 +782,114 @@ void WiimotePadConfigDialog::CreatePadGUIControls() } // Sizers - m_SCcLeftStick[i] = new wxBoxSizer(wxHORIZONTAL); - m_SCcLeftStick[i]->Add(m_CcTextLeftStick[i], 0, (wxUP), 4); - m_SCcLeftStick[i]->Add(m_CcComboLeftStick[i], 0, (wxLEFT), 2); + m_sCcLeftStick[i] = new wxBoxSizer(wxHORIZONTAL); + m_sCcLeftStick[i]->Add(m_CcTextLeftStick[i], 0, (wxUP), 4); + m_sCcLeftStick[i]->Add(m_CcComboLeftStick[i], 0, (wxLEFT), 2); - m_SCcRightStick[i] = new wxBoxSizer(wxHORIZONTAL); - m_SCcRightStick[i]->Add(m_CcTextRightStick[i], 0, (wxUP), 4); - m_SCcRightStick[i]->Add(m_CcComboRightStick[i], 0, (wxLEFT), 2); + m_sCcRightStick[i] = new wxBoxSizer(wxHORIZONTAL); + m_sCcRightStick[i]->Add(m_CcTextRightStick[i], 0, (wxUP), 4); + m_sCcRightStick[i]->Add(m_CcComboRightStick[i], 0, (wxLEFT), 2); - m_SCcTriggers[i] = new wxBoxSizer(wxHORIZONTAL); - m_SCcTriggers[i]->Add(m_CcTextTriggers[i], 0, (wxUP), 4); - m_SCcTriggers[i]->Add(m_CcComboTriggers[i], 0, (wxLEFT), 2); + m_sCcTriggers[i] = new wxBoxSizer(wxHORIZONTAL); + m_sCcTriggers[i]->Add(m_CcTextTriggers[i], 0, (wxUP), 4); + m_sCcTriggers[i]->Add(m_CcComboTriggers[i], 0, (wxLEFT), 2); - // The left parent - m_SCcVertLeft[i] = new wxBoxSizer(wxVERTICAL); - m_SCcVertLeft[i]->Add(m_SCcLeftStick[i], 0, wxALIGN_RIGHT | (wxALL), 2); - m_SCcVertLeft[i]->AddSpacer(2); - // Left stick - for ( int x = IDB_CC_LL; x <= IDB_CC_LD; x++) - m_SCcVertLeft[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - // Digital l,r,u,d - for ( int x = IDB_CC_DL; x <= IDB_CC_DD; x++) - m_SCcVertLeft[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_sCcVertLeft[i] = new wxBoxSizer(wxVERTICAL); + m_sCcVertLeft[i]->Add(m_sCcLeftStick[i], 0, wxALIGN_RIGHT | (wxALL), 2); + m_sCcVertLeft[i]->AddSpacer(2); + for (int x = IDB_CC_LL; x <= IDB_CC_LD; x++) + m_sCcVertLeft[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + for (int x = IDB_CC_DL; x <= IDB_CC_DD; x++) + m_sCcVertLeft[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - // The middle parent - m_SCcVertMiddle[i] = new wxBoxSizer(wxVERTICAL); - m_SCcVertMiddle[i]->Add(m_SCcRightStick[i], 0, wxALIGN_RIGHT | (wxALL), 2); - m_SCcVertMiddle[i]->AddSpacer(2); - // Right stick - for ( int x = IDB_CC_RL; x <= IDB_CC_RD; x++) - m_SCcVertMiddle[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - for ( int x = IDB_CC_A; x <= IDB_CC_Y; x++) - m_SCcVertMiddle[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_sCcVertMiddle[i] = new wxBoxSizer(wxVERTICAL); + m_sCcVertMiddle[i]->Add(m_sCcRightStick[i], 0, wxALIGN_RIGHT | (wxALL), 2); + m_sCcVertMiddle[i]->AddSpacer(2); + for (int x = IDB_CC_RL; x <= IDB_CC_RD; x++) + m_sCcVertMiddle[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + for (int x = IDB_CC_A; x <= IDB_CC_Y; x++) + m_sCcVertMiddle[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - // The right parent - m_SCcVertRight[i] = new wxBoxSizer(wxVERTICAL); - m_SCcVertRight[i]->Add(m_SCcTriggers[i], 0, wxALIGN_RIGHT | (wxALL), 2); - m_SCcVertRight[i]->AddSpacer(2); - // Shoulder buttons - for ( int x = IDB_CC_TL; x <= IDB_CC_ZR; x++) - m_SCcVertRight[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - for ( int x = IDB_CC_P; x <= IDB_CC_H; x++) - m_SCcVertRight[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_sCcVertRight[i] = new wxBoxSizer(wxVERTICAL); + m_sCcVertRight[i]->Add(m_sCcTriggers[i], 0, wxALIGN_RIGHT | (wxALL), 2); + m_sCcVertRight[i]->AddSpacer(2); + for (int x = IDB_CC_TL; x <= IDB_CC_ZR; x++) + m_sCcVertRight[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + for (int x = IDB_CC_P; x <= IDB_CC_H; x++) + m_sCcVertRight[i]->Add(m_Sizer_Classic[x - IDB_CC_A][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - // The parent sizer m_gClassicController[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Classic Controller")); - m_gClassicController[i]->Add(m_SCcVertLeft[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - m_gClassicController[i]->Add(m_SCcVertMiddle[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - m_gClassicController[i]->Add(m_SCcVertRight[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - - //Set values - m_CcComboLeftStick[i]->SetSelection(g_Config.ClassicController.LType); - m_CcComboRightStick[i]->SetSelection(g_Config.ClassicController.RType); - m_CcComboTriggers[i]->SetSelection(g_Config.ClassicController.TType); + m_gClassicController[i]->Add(m_sCcVertLeft[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_gClassicController[i]->Add(m_sCcVertMiddle[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_gClassicController[i]->Add(m_sCcVertRight[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); } else if(g_Config.iExtensionConnected == EXT_GUITARHERO3_CONTROLLER) - { - // TODO: fix keyboard input for joystick use the nunchuck array str - wxArrayString tempArraySTR; - tempArraySTR.Add(wxString::FromAscii("Analog 1")); - tempArraySTR.Add(wxString::FromAscii("Analog 2")); - + { // Stick controls - m_tGH3_Analog[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Analog joystick")); - m_GH3ComboAnalog[i] = new wxComboBox(m_Controller[i], IDCB_GH3_ANALOG, tempArraySTR[0], wxDefaultPosition, wxSize(100, -1), tempArraySTR, wxCB_READONLY); + m_tGH3Analog[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Joystick")); + m_GH3ComboAnalog[i] = new wxComboBox(m_Controller[i], IDC_GH3_ANALOG, StrAnalogArray[0], wxDefaultPosition, wxSize(70, -1), StrAnalogArray, wxCB_READONLY); m_GH3ComboAnalog[i]->SetSelection(g_Config.GH3Controller.AType); - static const wxChar* gh3Text[] = + for (int x = 0; x < GH3_CONTROLS; x++) { - wxT("Green"), - wxT("Red"), - wxT("Yellow"), - wxT("Blue"), - wxT("Orange"), - wxT("+"), - wxT("- "), - wxT("Whammy"), - wxT("Left"), //analog stick - wxT("Right"), - wxT("Up"), - wxT("Down"), - wxT("Strum Up"), - wxT("Strum Down"), - }; - - for ( int x = 0; x < GH3_CONTROLS; x++) m_statictext_GH3[x][i] = new wxStaticText(m_Controller[i], wxID_ANY, gh3Text[x]); - - for ( int x = IDB_GH3_GREEN; x <= IDB_GH3_STRUM_DOWN; x++) - { - m_Button_GH3[x - IDB_GH3_GREEN][i] = new wxButton(m_Controller[i], x, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH)); - if (IDB_GH3_WHAMMY <= x && x <= IDB_GH3_ANALOG_DOWN) - m_Button_GH3[x - IDB_GH3_GREEN][i]->Disable(); + m_Button_GH3[x][i] = new wxButton(m_Controller[i], x, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH)); + m_Sizer_GH3[x][i] = new wxBoxSizer(wxHORIZONTAL); + m_Sizer_GH3[x][i]->Add(m_statictext_GH3[x][i], 0, (wxUP), 4); + m_Sizer_GH3[x][i]->Add(m_Button_GH3[x][i], 0, (wxLEFT), 2); } // Sizers - m_sGH3_Analog[i] = new wxBoxSizer(wxHORIZONTAL); - m_sGH3_Analog[i]->Add(m_tGH3_Analog[i], 0, (wxUP), 4); - m_sGH3_Analog[i]->Add(m_GH3ComboAnalog[i], 0, (wxLEFT), 2); + m_sGH3Analog[i] = new wxBoxSizer(wxHORIZONTAL); + m_sGH3Analog[i]->Add(m_tGH3Analog[i], 0, (wxUP), 4); + m_sGH3Analog[i]->Add(m_GH3ComboAnalog[i], 0, (wxLEFT), 2); - for ( int x = 0; x < GH3_CONTROLS; x++) - { - m_sizer_GH3[x][i] = new wxBoxSizer(wxHORIZONTAL); - m_sizer_GH3[x][i]->Add(m_statictext_GH3[x][i], 0, (wxUP), 4); - m_sizer_GH3[x][i]->Add(m_Button_GH3[x][i], 0, (wxLEFT), 2); - } + m_sGH3VertLeft[i] = new wxBoxSizer(wxVERTICAL); + m_sGH3VertLeft[i]->Add(m_sGH3Analog[i], 0, wxALIGN_RIGHT | (wxALL), 2); + m_sGH3VertLeft[i]->AddSpacer(2); + for (int x = IDB_GH3_ANALOG_LEFT; x <= IDB_GH3_STRUM_DOWN; x++) + m_sGH3VertLeft[i]->Add(m_Sizer_GH3[x - IDB_GH3_GREEN][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - // The left parent - m_SGH3VertLeft[i] = new wxBoxSizer(wxVERTICAL); - m_SGH3VertLeft[i]->Add(m_sGH3_Analog[i], 0, wxALIGN_RIGHT | (wxALL), 2); + m_sGH3VertRight[i] = new wxBoxSizer(wxVERTICAL); + for (int x = IDB_GH3_GREEN; x <= IDB_GH3_WHAMMY; x++) + m_sGH3VertRight[i]->Add(m_Sizer_GH3[x - IDB_GH3_GREEN][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - for (int x = IDB_GH3_WHAMMY - IDB_GH3_GREEN; x <= IDB_GH3_ANALOG_DOWN - IDB_GH3_GREEN; x++) - m_SGH3VertLeft[i]->Add(m_sizer_GH3[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - - // The right parent - m_SGH3VertRight[i] = new wxBoxSizer(wxVERTICAL); - - for (int x = 0; x <= IDB_GH3_MINUS - IDB_GH3_GREEN; x++) - m_SGH3VertRight[i]->Add(m_sizer_GH3[x][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - - m_SGH3VertRight[i]->Add(m_sizer_GH3[IDB_GH3_STRUM_UP - IDB_GH3_GREEN][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - m_SGH3VertRight[i]->Add(m_sizer_GH3[IDB_GH3_STRUM_DOWN - IDB_GH3_GREEN][i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - - // The parent sizer m_gGuitarHero3Controller[i] = new wxStaticBoxSizer (wxHORIZONTAL, m_Controller[i], wxT("Guitar Hero 3 Controller")); - m_gGuitarHero3Controller[i]->Add(m_SGH3VertLeft[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); - m_gGuitarHero3Controller[i]->Add(m_SGH3VertRight[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_gGuitarHero3Controller[i]->Add(m_sGH3VertLeft[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); + m_gGuitarHero3Controller[i]->Add(m_sGH3VertRight[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1); } - // Row 4 Sizers - - m_HorizControllerMapping[i] = new wxBoxSizer(wxHORIZONTAL); - m_HorizControllerMapping[i]->Add(m_gWiimote[i], 0, (wxLEFT), 5); + // Row 4 Sizers: Wiimote and Extension Mapping + m_sHorizControllerMapping[i] = new wxBoxSizer(wxHORIZONTAL); + m_sHorizControllerMapping[i]->Add(m_gWiimote[i], 0, (wxLEFT), 5); switch(g_Config.iExtensionConnected) { case EXT_NUNCHUCK: - m_HorizControllerMapping[i]->AddStretchSpacer(2); - m_HorizControllerMapping[i]->Add(m_gNunchuck[i], 0, (wxLEFT), 5); + m_sHorizControllerMapping[i]->Add(m_gNunchuck[i], 0, (wxLEFT), 5); break; case EXT_CLASSIC_CONTROLLER: - m_HorizControllerMapping[i]->Add(m_gClassicController[i], 0, (wxLEFT), 5); + m_sHorizControllerMapping[i]->Add(m_gClassicController[i], 0, (wxLEFT), 5); break; case EXT_GUITARHERO3_CONTROLLER: - m_HorizControllerMapping[i]->Add(m_gGuitarHero3Controller[i], 0, (wxLEFT), 5); + m_sHorizControllerMapping[i]->Add(m_gGuitarHero3Controller[i], 0, (wxLEFT), 5); break; - case EXT_GUITARHEROWT_DRUMS: default: break; } - m_HorizControllerMapping[i]->AddStretchSpacer(2); // Set up sizers and layout - m_SizeParent[i] = new wxBoxSizer(wxVERTICAL); - m_SizeParent[i]->Add(m_HorizControllerTiltParent[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); - m_SizeParent[i]->Add(m_HorizControllers[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); - m_SizeParent[i]->Add(m_HorizControllerMapping[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); - // The sizer m_sMain will be expanded inside m_Controller, m_SizeParent will not + // The sizer m_sMain will be expanded inside m_Controller m_sMain[i] = new wxBoxSizer(wxVERTICAL); - m_sMain[i]->Add(m_SizeParent[i]); + m_sMain[i]->Add(m_sHorizController[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); + m_sMain[i]->Add(m_sHorizStatus[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); + m_sMain[i]->Add(m_sHorizAnalogMapping[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); + m_sMain[i]->Add(m_sHorizControllerMapping[i], 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5); // Set the main sizer m_Controller[i]->SetSizer(m_sMain[i]); } - - m_Apply = new wxButton(this, ID_APPLY, wxT("Apply")); m_Close = new wxButton(this, ID_CLOSE, wxT("Close")); m_Close->SetToolTip(wxT("Apply and Close")); @@ -1021,69 +922,60 @@ void WiimotePadConfigDialog::CreatePadGUIControls() ControlsCreated = true; } - void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) { long TmpValue; switch (event.GetId()) { - case ID_TRIGGER_TYPE: - WiiMoteEmu::PadMapping[Page].triggertype = m_TriggerType[Page]->GetSelection(); - break; - case ID_TILT_INPUT: - g_Config.Trigger.Type = m_TiltComboInput[Page]->GetSelection(); - break; - case ID_TILT_RANGE_ROLL: - if (m_TiltComboRangeRoll[Page]->GetSelection() == 0) - g_Config.Trigger.Range.Roll = 0; - else - { - m_TiltComboRangeRoll[Page]->GetValue().ToLong(&TmpValue); - g_Config.Trigger.Range.Roll = TmpValue; - } - break; - case ID_TILT_RANGE_PITCH: - if (m_TiltComboRangePitch[Page]->GetSelection() == 0) - g_Config.Trigger.Range.Pitch = 0; - else - { - m_TiltComboRangePitch[Page]->GetValue().ToLong(&TmpValue); - g_Config.Trigger.Range.Pitch = TmpValue; - } - break;; case IDC_JOYNAME: DoChangeJoystick(); break; - case IDCB_NUNCHUCK_STICK: + 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; + } + 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; + } + break; + case IDC_NUNCHUCK_STICK: g_Config.Nunchuck.Type = m_NunchuckComboStick[Page]->GetSelection(); break; - case IDCB_CC_LEFT_STICK: + case IDC_CC_LEFT_STICK: g_Config.ClassicController.LType = m_CcComboLeftStick[Page]->GetSelection(); break; - case IDCB_CC_RIGHT_STICK: + case IDC_CC_RIGHT_STICK: g_Config.ClassicController.RType = m_CcComboRightStick[Page]->GetSelection(); break; - case IDCB_CC_TRIGGERS: + case IDC_CC_TRIGGERS: g_Config.ClassicController.TType = m_CcComboTriggers[Page]->GetSelection(); break; - case IDCB_GH3_ANALOG: + case IDC_GH3_ANALOG: g_Config.GH3Controller.AType = m_GH3ComboAnalog[Page]->GetSelection(); break; - // These are defined in PadMapping and we can run the same function to update all of them + case IDC_DEAD_ZONE_LEFT: + case IDC_DEAD_ZONE_RIGHT: + case IDC_STICK_DIAGONAL: + case IDC_STICK_C2S: case IDC_RUMBLE: case IDC_RUMBLE_STRENGTH: - case IDCB_LEFT_DIAGONAL: - case IDC_LEFT_C2S: - case ID_TILT_INVERT_ROLL: - case ID_TILT_INVERT_PITCH: - SaveButtonMappingAll(Page); - break; - case IDCB_DEAD_ZONE_LEFT: - SaveButtonMappingAll(Page); - break; - case IDCB_DEAD_ZONE_RIGHT: + case IDC_TILT_INVERT_ROLL: + case IDC_TILT_INVERT_PITCH: SaveButtonMappingAll(Page); break; } @@ -1094,7 +986,8 @@ void WiimotePadConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) void WiimotePadConfigDialog::UpdateGUI(int Slot) { UpdateGUIButtonMapping(Page); - DoChangeDeadZone(true); DoChangeDeadZone(false); + DoChangeDeadZone(true); + DoChangeDeadZone(false); // Linux has no FindItem() // Disable all pad items if no pads are detected @@ -1102,15 +995,16 @@ void WiimotePadConfigDialog::UpdateGUI(int Slot) { bool PadEnabled = WiiMoteEmu::NumGoodPads != 0; #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_DEAD_ZONE_LEFT)->Enable(PadEnabled); + m_Notebook->FindItem(IDC_DEAD_ZONE_RIGHT)->Enable(PadEnabled); + m_Notebook->FindItem(IDC_STICK_C2S)->Enable(PadEnabled); + m_Notebook->FindItem(IDC_STICK_DIAGONAL)->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); - m_Notebook->FindItem(IDCB_DEAD_ZONE_RIGHT)->Enable(PadEnabled); - m_Notebook->FindItem(ID_TRIGGER_TYPE)->Enable(PadEnabled); + m_Notebook->FindItem(IDC_TRIGGER_TYPE)->Enable(PadEnabled); + for(int i = IDB_ANALOG_LEFT_X; i <= IDB_TRIGGER_R; i++) + m_Notebook->FindItem(i)->Enable(PadEnabled); #endif } } diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h index 79145c8e56..853774f714 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigPadDlg.h @@ -61,97 +61,124 @@ class WiimotePadConfigDialog : public wxDialog void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); } void UpdatePad(wxTimerEvent& WXUNUSED(event)); - wxTimer *m_UpdatePad, + wxTimer *m_UpdatePadTimer, *m_ButtonMappingTimer; - wxStaticBitmap *m_bmpDotLeftIn[4], - *m_bmpDotLeftOut[4], - *m_bmpDotRightIn[4], - *m_bmpDotRightOut[4], - *m_bmpDeadZoneLeftIn[4], - *m_bmpDeadZoneRightIn[4]; + wxStaticBitmap *m_bmpDotLeftIn[4], + *m_bmpDotLeftOut[4], + *m_bmpDotRightIn[4], + *m_bmpDotRightOut[4], + *m_bmpDeadZoneLeftIn[4], + *m_bmpDeadZoneRightIn[4]; private: DECLARE_EVENT_TABLE(); bool ControlsCreated; - int Page, BoxW, BoxH, g_Pressed; + int Page, g_Pressed, BoxW, BoxH; + + wxString OldLabel; wxNotebook *m_Notebook; - wxPanel *m_Controller[4]; - wxButton *m_Close, - *m_Apply; - wxBoxSizer *m_MainSizer, - *m_sMain[4], - *m_SizeParent[4]; - wxCheckBox *m_CheckC2S[4], - *m_CheckRumble[4], - *m_TiltInvertRoll[4], - *m_TiltInvertPitch[4]; + wxPanel *m_Controller[4], + *m_pLeftInStatus[4], + *m_pLeftOutStatus[4], + *m_pRightInStatus[4], + *m_pRightOutStatus[4]; - // Emulated Wiimote key settings - wxBoxSizer *m_HorizControllers[4], - *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], - *m_SizeAnalogLeft[4], - *m_SizeAnalogLeftHorizX[4], - *m_SizeAnalogLeftHorizY[4], - *m_SizeAnalogRight[4], - *m_SizeAnalogRightHorizX[4], - *m_SizeAnalogRightHorizY[4], - *m_SizeAnalogTriggerVertLeft[4], - *m_SizeAnalogTriggerVertRight[4], - *m_SizeAnalogTriggerHorizInput[4], + wxStaticBitmap *m_bmpSquareLeftIn[4], + *m_bmpSquareLeftOut[4], + *m_bmpSquareRightIn[4], + *m_bmpSquareRightOut[4]; + - *m_HorizControllerMapping[4], - *m_Sizer_Wiimote[WM_CONTROLS][4], - *m_SWmVertLeft[4], - *m_SWmVertRight[4], - *m_Sizer_NunChuck[NC_CONTROLS][4], - *m_NunchuckStick[4], - *m_Sizer_Classic[CC_CONTROLS][4], - *m_SCcVertLeft[4], - *m_SCcVertMiddle[4], - *m_SCcVertRight[4], - *m_SCcLeftStick[4], - *m_SCcRightStick[4], - *m_SCcTriggers[4], - *m_sizer_GH3[GH3_CONTROLS][4], - *m_sGH3_Analog[4], - *m_SGH3VertLeft[4], - *m_SGH3VertMiddle[4], - *m_SGH3VertRight[4]; - - 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_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], - *m_bAnalogTriggerL[4], *m_bAnalogTriggerR[4], - // Nunchuck + wxCheckBox *m_CheckC2S[4], + *m_CheckRumble[4], + *m_TiltInvertRoll[4], + *m_TiltInvertPitch[4]; + wxButton *m_Close, *m_Apply, *ClickedButton, + *m_Button_Analog[AN_CONTROLS][4], *m_Button_Wiimote[WM_CONTROLS][4], *m_Button_NunChuck[NC_CONTROLS][4], *m_Button_Classic[CC_CONTROLS][4], - *m_Button_GH3[GH3_CONTROLS][4], - *m_bGH3_Analog[4]; + *m_Button_GH3[GH3_CONTROLS][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_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], + wxComboBox *m_Joyname[4], + *m_ComboDeadZoneLeft[4], + *m_ComboDeadZoneRight[4], + *m_ComboDiagonal[4], + *m_RumbleStrength[4], + *m_TiltComboInput[4], + *m_TiltComboRangeRoll[4], + *m_TiltComboRangePitch[4], + *m_TriggerType[4], + *m_NunchuckComboStick[4], + *m_CcComboLeftStick[4], + *m_CcComboRightStick[4], + *m_CcComboTriggers[4], + *m_GH3ComboAnalog[4]; + wxGridBagSizer *m_sGridTilt[4], + *m_sGridStickLeft[4], + *m_sGridStickRight[4], + *m_sGridTrigger[4]; + + wxBoxSizer *m_MainSizer, + *m_sMain[4], + *m_sDeadZoneHoriz[4], + *m_sDeadZone[4], + *m_sDiagonal[4], + *m_sCircle2Square[4], + *m_sC2SDeadZone[4], + *m_sJoyname[4], + *m_sRumble[4], + *m_sHorizController[4], + *m_sHorizStatus[4], + *m_Sizer_Analog[AN_CONTROLS][4], + *m_sAnalogLeft[4], + *m_sAnalogMiddle[4], + *m_sAnalogRight[4], + *m_sHorizAnalogMapping[4], + *m_Sizer_Wiimote[WM_CONTROLS][4], + *m_sWmVertLeft[4], + *m_sWmVertRight[4], + *m_Sizer_NunChuck[NC_CONTROLS][4], + *m_sNunchuckStick[4], + *m_Sizer_Classic[CC_CONTROLS][4], + *m_sCcLeftStick[4], + *m_sCcRightStick[4], + *m_sCcTriggers[4], + *m_sCcVertLeft[4], + *m_sCcVertMiddle[4], + *m_sCcVertRight[4], + *m_Sizer_GH3[GH3_CONTROLS][4], + *m_sGH3Analog[4], + *m_sGH3VertLeft[4], + *m_sGH3VertRight[4], + *m_sHorizControllerMapping[4]; + + wxStaticBoxSizer *m_gJoyPad[4], + *m_gTilt[4], + *m_gStickLeft[4], + *m_gStickRight[4], + *m_gTriggers[4], + *m_gAnalog[4], + *m_gWiimote[4], + *m_gNunchuck[4], + *m_gClassicController[4], + *m_gGuitarHero3Controller[4]; + + wxStaticText *m_ComboDeadZoneLabel[4], + *m_DiagonalLabel[4], + *m_RumbleStrengthLabel[4], + *m_TiltTextRoll[4], *m_TiltTextPitch[4], + *m_tStatusLeftIn[4], *m_tStatusLeftOut[4], *m_tStatusRightIn[4], *m_tStatusRightOut[4], + *m_TriggerL[4], *m_TriggerR[4], + *m_TriggerStatusL[4], *m_TriggerStatusR[4], + *m_tTriggerSource[4], + *m_statictext_Analog[AN_CONTROLS][4], *m_statictext_Wiimote[WM_CONTROLS][4], *m_statictext_NunChuck[NC_CONTROLS][4], *m_statictext_Classic[CC_CONTROLS][4], @@ -160,30 +187,13 @@ class WiimotePadConfigDialog : public wxDialog *m_CcTextLeftStick[4], *m_CcTextRightStick[4], *m_CcTextTriggers[4], - *m_tGH3_Analog[4]; - - wxButton *ClickedButton; - 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_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]; - wxStaticBoxSizer *m_gAnalogLeft[4], *m_gAnalogRight[4], *m_gTrigger[4], - *m_gWiimote[4], *m_gNunchuck[4], *m_gClassicController[4], *m_gGuitarHero3Controller[4]; - - wxBitmap CreateBitmapDot(); - wxBitmap CreateBitmap(); - wxBitmap CreateBitmapDeadZone(int Radius); - wxBitmap CreateBitmapClear(); + *m_tGH3Analog[4]; enum { ID_CLOSE = 1000, ID_APPLY, - IDTM_EXIT, - IDTM_BUTTON, + IDTM_BUTTON, // Timer IDTM_UPDATE_PAD, // Timer ID_NOTEBOOK, @@ -192,17 +202,16 @@ class WiimotePadConfigDialog : public wxDialog ID_CONTROLLERPAGE3, ID_CONTROLLERPAGE4, + ID_ANALOG_LEFT_X, ID_ANALOG_LEFT_Y, + ID_ANALOG_RIGHT_X, ID_ANALOG_RIGHT_Y, + ID_TRIGGER_L, ID_TRIGGER_R, + // Gamepad IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y, IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y, IDB_TRIGGER_L, IDB_TRIGGER_R, - ID_ANALOG_LEFT_X, ID_ANALOG_LEFT_Y, - ID_ANALOG_RIGHT_X, ID_ANALOG_RIGHT_Y, - ID_TRIGGER_L, ID_TRIGGER_R, - // Wiimote - IDS_WIDTH, IDS_HEIGHT, IDS_LEFT, IDS_TOP, IDB_WM_A, IDB_WM_B, IDB_WM_1, IDB_WM_2, IDB_WM_P, IDB_WM_M, IDB_WM_H, @@ -246,11 +255,24 @@ class WiimotePadConfigDialog : public wxDialog IDB_GH3_STRUM_DOWN, // Gamepad settings - 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, + IDC_JOYNAME, + IDC_RUMBLE, IDC_RUMBLE_STRENGTH, + IDC_DEAD_ZONE_LEFT, IDC_DEAD_ZONE_RIGHT, + IDC_STICK_DIAGONAL, IDC_STICK_C2S, + IDC_TILT_INPUT, + IDC_TILT_RANGE_ROLL, IDC_TILT_RANGE_PITCH, + IDC_TILT_INVERT_ROLL, IDC_TILT_INVERT_PITCH, + IDC_TRIGGER_TYPE, + IDC_NUNCHUCK_STICK, + IDC_CC_LEFT_STICK, IDC_CC_RIGHT_STICK, IDC_CC_TRIGGERS, + IDC_GH3_ANALOG, }; + wxBitmap CreateBitmap(); + wxBitmap CreateBitmapDot(); + wxBitmap CreateBitmapDeadZone(int Radius); + wxBitmap CreateBitmapClear(); + void OnClose(wxCloseEvent& event); void CreatePadGUIControls(); void GeneralSettingsChanged(wxCommandEvent& event); @@ -258,8 +280,8 @@ class WiimotePadConfigDialog : public wxDialog // Gamepad configuration void SetButtonText(int id, const char text[128], int _Page = -1); void SetButtonTextAll(int id, char text[128]); - wxString GetButtonText(int id, int Page = -1); - void GetButtons(wxCommandEvent& event); void DoGetButtons(int); + void GetButtons(wxCommandEvent& event); + void DoGetButtons(int); void SaveButtonMapping(int controller, bool DontChangeId = false, int FromSlot = -1); void SaveButtonMappingAll(int Slot); void SaveKeyboardMapping(int Controller, int Id, int Key); @@ -273,6 +295,7 @@ class WiimotePadConfigDialog : public wxDialog // Configure buttons int GetButtonWaitingID, GetButtonWaitingTimer; + wxString GetButtonText(int id, int Page = -1); }; extern WiimotePadConfigDialog *m_PadConfigFrame; #endif diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h index b826293090..2e8cf4c95e 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDefinitions.h @@ -240,9 +240,8 @@ struct KeyboardGH3GLP #else Green = 48, #endif - Red, Yellow, Blue, - Orange,Plus, Minus, - Whammy, + Red, Yellow, Blue, Orange, + Plus, Minus, Whammy, Al, Ar, Au, Ad, StrumUp, StrumDown, LAST_CONSTANT diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp index c0cba3741b..ed06bdae02 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuDynamics.cpp @@ -92,9 +92,9 @@ void AdjustAngles(int &Roll, int &Pitch) void PitchDegreeToAccelerometer(int Roll, int Pitch, int &_x, int &_y, int &_z) { // Direct mapping for swing, from analog stick to accelerometer - if (g_Config.Trigger.Range.Roll == 0 && g_Config.Trigger.Range.Pitch == 0) + if (g_Config.Tilt.Range.Roll == 0 && g_Config.Tilt.Range.Pitch == 0) { - if (!g_Config.Trigger.Upright) + if (!g_Config.bUpright) { _x -= Roll; _z -= Pitch; @@ -114,13 +114,13 @@ void PitchDegreeToAccelerometer(int Roll, int Pitch, int &_x, int &_y, int &_z) float x, y, z; // In these cases we can use the simple and accurate formula - if(g_Config.Trigger.Range.Pitch == 0) + if(g_Config.Tilt.Range.Pitch == 0) { x = sin(_Roll); y = 0.0f; z = cos(_Roll); } - else if (g_Config.Trigger.Range.Roll == 0) + else if (g_Config.Tilt.Range.Roll == 0) { x = 0.0f; y = sin(_Pitch); @@ -157,16 +157,16 @@ void PitchDegreeToAccelerometer(int Roll, int Pitch, int &_x, int &_y, int &_z) int iy = g_wm.cal_zero.y + (int)(yg * y); int iz = g_wm.cal_zero.z + (int)(zg * z); - if (!g_Config.Trigger.Upright) + if (!g_Config.bUpright) { - if(g_Config.Trigger.Range.Roll != 0) _x = ix; - if(g_Config.Trigger.Range.Pitch != 0) _y = iy; + if(g_Config.Tilt.Range.Roll != 0) _x = ix; + if(g_Config.Tilt.Range.Pitch != 0) _y = iy; _z = iz; } else // Upright wiimote { - if(g_Config.Trigger.Range.Roll != 0) _x = ix; - if(g_Config.Trigger.Range.Pitch != 0) _z = iy; + if(g_Config.Tilt.Range.Roll != 0) _x = ix; + if(g_Config.Tilt.Range.Pitch != 0) _z = iy; _y = 0xFF - iz; } } @@ -188,7 +188,7 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in float y = AccelerometerToG((float)_y, (float)g_wm.cal_zero.y, (float)g_wm.cal_g.y); float z = AccelerometerToG((float)_z, (float)g_wm.cal_zero.z, (float)g_wm.cal_g.z); - if (!g_Config.Trigger.Upright) + if (!g_Config.bUpright) { // If it is over 1g then it is probably accelerating and may not reliable //if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x) @@ -225,7 +225,7 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in if (x < -1.0) x = -1.0; else if (x > 1.0) x = 1.0; if (y < -1.0) y = -1.0; else if (y > 1.0) y = 1.0; if (z < -1.0) z = -1.0; else if (z > 1.0) z = 1.0; - if (!g_Config.Trigger.Upright) + if (!g_Config.bUpright) { Roll = InputCommon::Rad2Deg(atan2(x, z)); Pitch = InputCommon::Rad2Deg(atan2(y, z)); diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index 4873fcf7ed..554241c758 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -636,7 +636,7 @@ void Update() readKeyboard(); // Check if the pad state should be updated - if ((g_Config.Trigger.Type == g_Config.Trigger.TRIGGER || g_Config.Trigger.Type == g_Config.Trigger.ANALOG1 || g_Config.Trigger.Type == g_Config.Trigger.ANALOG2 + if ((g_Config.Tilt.Type == g_Config.Tilt.TRIGGER || g_Config.Tilt.Type == g_Config.Tilt.ANALOG1 || g_Config.Tilt.Type == g_Config.Tilt.ANALOG2 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG1 || g_Config.Nunchuck.Type == g_Config.Nunchuck.ANALOG2 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.LType == g_Config.ClassicController.ANALOG2 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG1 || g_Config.ClassicController.RType == g_Config.ClassicController.ANALOG2) diff --git a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp index 4eb0ea8cf3..222edf3057 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/FillReport.cpp @@ -390,7 +390,7 @@ void FillReportInfo(wm_core& _core) _core.home = IsKey(g_Wiimote_kbd.H) ? 1 : 0; /* Sideways controls (for example for Wario Land) if the Wiimote is intended to be held sideways */ - if(g_Config.bSidewaysDPad) + if(g_Config.bSideways) { _core.left = IsKey(g_Wiimote_kbd.D) ? 1 : 0; _core.up = IsKey(g_Wiimote_kbd.L) ? 1 : 0; @@ -504,11 +504,11 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch) PadStateAdjustments(Lx, Ly, Rx, Ry, Tl, Tr); // Save the Range in degrees, 45 and 90 are good values in some games - int &RollRange = g_Config.Trigger.Range.Roll; - int &PitchRange = g_Config.Trigger.Range.Pitch; + int &RollRange = g_Config.Tilt.Range.Roll; + int &PitchRange = g_Config.Tilt.Range.Pitch; // The trigger currently only controls pitch - if (g_Config.Trigger.Type == g_Config.Trigger.TRIGGER) + if (g_Config.Tilt.Type == g_Config.Tilt.TRIGGER) { // Make the range the same dimension as the analog stick Tl = Tl / 2; @@ -522,7 +522,7 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch) /* For the analog stick roll is by default set to the X-axis, pitch is by default set to the Y-axis. By changing the axis mapping and the invert options this can be altered in any way */ - else if (g_Config.Trigger.Type == g_Config.Trigger.ANALOG1) + else if (g_Config.Tilt.Type == g_Config.Tilt.ANALOG1) { // Adjust the trigger to go between negative and positive values Lx = Lx - 0x80; @@ -554,7 +554,7 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch) void TiltWiimoteKeyboard(int &Roll, int &Pitch) { // Direct map roll/pitch to swing - if (g_Config.Trigger.Range.Roll == 0 && g_Config.Trigger.Range.Pitch == 0) + if (g_Config.Tilt.Range.Roll == 0 && g_Config.Tilt.Range.Pitch == 0) { if (IsKey(g_Wiimote_kbd.ROLL_L)) Roll = -0x80 / 2; @@ -575,13 +575,13 @@ void TiltWiimoteKeyboard(int &Roll, int &Pitch) if (IsKey(g_Wiimote_kbd.ROLL_L)) { // Stop at the upper end of the range - if (Roll < g_Config.Trigger.Range.Roll) + if (Roll < g_Config.Tilt.Range.Roll) Roll += 3; // aim left } else if (IsKey(g_Wiimote_kbd.ROLL_R)) { // Stop at the lower end of the range - if (Roll > -g_Config.Trigger.Range.Roll) + if (Roll > -g_Config.Tilt.Range.Roll) Roll -= 3; // aim right } else @@ -591,13 +591,13 @@ void TiltWiimoteKeyboard(int &Roll, int &Pitch) if (IsKey(g_Wiimote_kbd.PITCH_U)) { // Stop at the upper end of the range - if (Pitch < g_Config.Trigger.Range.Pitch) + if (Pitch < g_Config.Tilt.Range.Pitch) Pitch += 3; // aim up } else if (IsKey(g_Wiimote_kbd.PITCH_D)) { // Stop at the lower end of the range - if (Pitch > -g_Config.Trigger.Range.Pitch) + if (Pitch > -g_Config.Tilt.Range.Pitch) Pitch -= 3; // aim down } else @@ -610,16 +610,16 @@ void TiltWiimoteKeyboard(int &Roll, int &Pitch) void Tilt(int &_x, int &_y, int &_z) { // Check if it's on - if (g_Config.Trigger.Type == g_Config.Trigger.TRIGGER_OFF) return; + if (g_Config.Tilt.Type == g_Config.Tilt.OFF) return; // Select input method and return the x, y, x values - if (g_Config.Trigger.Type == g_Config.Trigger.KEYBOARD) + if (g_Config.Tilt.Type == g_Config.Tilt.KEYBOARD) TiltWiimoteKeyboard(Roll, Pitch); - else if (g_Config.Trigger.Type == g_Config.Trigger.TRIGGER || g_Config.Trigger.Type == g_Config.Trigger.ANALOG1 || g_Config.Trigger.Type == g_Config.Trigger.ANALOG2) + else if (g_Config.Tilt.Type == g_Config.Tilt.TRIGGER || g_Config.Tilt.Type == g_Config.Tilt.ANALOG1 || g_Config.Tilt.Type == g_Config.Tilt.ANALOG2) TiltWiimoteGamepad(Roll, Pitch); // Adjust angles, it's only needed if both roll and pitch is used together - if (g_Config.Trigger.Range.Roll != 0 && g_Config.Trigger.Range.Pitch != 0) + if (g_Config.Tilt.Range.Roll != 0 && g_Config.Tilt.Range.Pitch != 0) AdjustAngles(Roll, Pitch); // Calculate the accelerometer value from this tilt angle @@ -649,7 +649,7 @@ void FillReportAcc(wm_accel& _acc) int acc_y = g_wm.cal_zero.y; int acc_z = g_wm.cal_zero.z; - if (!g_Config.Trigger.Upright) + if (!g_Config.bUpright) acc_z += g_wm.cal_g.z; else // Upright wiimote acc_y -= g_wm.cal_g.y; @@ -754,7 +754,7 @@ void FillReportAcc(wm_accel& _acc) // Rotate IR dot when rolling Wiimote void RotateIRDot(int _Roll, int& _x, int& _y) { - if (g_Config.Trigger.Range.Roll == 0 || _Roll == 0) + if (g_Config.Tilt.Range.Roll == 0 || _Roll == 0) return; // The IR camera resolution is 1023x767