2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2009-07-05 04:29:00 +00:00
|
|
|
#ifndef __PADCONFIGDIALOG_h__
|
|
|
|
#define __PADCONFIGDIALOG_h__
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-01-28 16:09:08 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
#include <wx/button.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/combobox.h>
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/notebook.h>
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include <wx/gbsizer.h>
|
2009-07-10 05:30:19 +00:00
|
|
|
#include "Config.h"
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2009-07-09 06:50:22 +00:00
|
|
|
#if defined(HAVE_X11) && HAVE_X11
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
#include <X11/keysym.h>
|
|
|
|
#include <X11/XKBlib.h>
|
|
|
|
#include "X11InputBase.h"
|
|
|
|
#endif
|
|
|
|
|
2009-07-06 00:27:32 +00:00
|
|
|
class WiimotePadConfigDialog : public wxDialog
|
2008-12-08 04:46:09 +00:00
|
|
|
{
|
|
|
|
public:
|
2009-07-05 04:29:00 +00:00
|
|
|
WiimotePadConfigDialog(wxWindow *parent,
|
2009-07-02 19:00:27 +00:00
|
|
|
wxWindowID id = 1,
|
2008-12-08 04:46:09 +00:00
|
|
|
const wxString &title = wxT("Wii Remote Plugin Configuration"),
|
2009-07-02 19:00:27 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2009-02-15 18:23:42 +00:00
|
|
|
long style = wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS);
|
2009-11-29 17:58:52 +00:00
|
|
|
virtual ~WiimotePadConfigDialog();
|
2009-01-26 07:01:43 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
void CloseClick(wxCommandEvent& event);
|
2009-07-05 04:29:00 +00:00
|
|
|
void UpdateGUI(int Slot = 0);
|
|
|
|
void UpdateGUIButtonMapping(int controller);
|
|
|
|
void UpdateControls();
|
2009-01-28 16:09:08 +00:00
|
|
|
void OnKeyDown(wxKeyEvent& event);
|
2009-02-12 16:43:35 +00:00
|
|
|
void Convert2Box(int &x);
|
2009-01-28 16:09:08 +00:00
|
|
|
void ConvertToString();
|
2009-02-09 13:10:29 +00:00
|
|
|
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
|
|
|
|
void UpdatePad(wxTimerEvent& WXUNUSED(event));
|
|
|
|
|
2009-12-09 14:52:30 +00:00
|
|
|
wxTimer *m_UpdatePadTimer,
|
2009-07-05 04:29:00 +00:00
|
|
|
*m_ButtonMappingTimer;
|
|
|
|
|
2009-12-09 14:52:30 +00:00
|
|
|
wxStaticBitmap *m_bmpDotLeftIn[4],
|
|
|
|
*m_bmpDotLeftOut[4],
|
|
|
|
*m_bmpDotRightIn[4],
|
|
|
|
*m_bmpDotRightOut[4],
|
|
|
|
*m_bmpDeadZoneLeftIn[4],
|
|
|
|
*m_bmpDeadZoneRightIn[4];
|
2009-11-29 17:58:52 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
|
2009-07-05 04:29:00 +00:00
|
|
|
bool ControlsCreated;
|
2009-12-17 16:14:48 +00:00
|
|
|
int Page, BoxW, BoxH;
|
2009-12-09 14:52:30 +00:00
|
|
|
|
|
|
|
wxString OldLabel;
|
2009-01-28 16:09:08 +00:00
|
|
|
|
2009-02-04 13:35:28 +00:00
|
|
|
wxNotebook *m_Notebook;
|
2009-07-10 05:30:19 +00:00
|
|
|
|
2009-12-09 14:52:30 +00:00
|
|
|
wxPanel *m_Controller[4],
|
|
|
|
*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];
|
|
|
|
|
|
|
|
|
|
|
|
wxCheckBox *m_CheckC2S[4],
|
|
|
|
*m_CheckRumble[4],
|
2009-12-14 02:23:14 +00:00
|
|
|
*m_TiltRollSwing[4],
|
|
|
|
*m_TiltPitchSwing[4],
|
|
|
|
*m_TiltRollInvert[4],
|
|
|
|
*m_TiltPitchInvert[4];
|
2009-12-09 14:52:30 +00:00
|
|
|
|
|
|
|
wxButton *m_Close, *m_Apply, *ClickedButton,
|
|
|
|
*m_Button_Analog[AN_CONTROLS][4],
|
2009-07-10 05:30:19 +00:00
|
|
|
*m_Button_Wiimote[WM_CONTROLS][4],
|
|
|
|
*m_Button_NunChuck[NC_CONTROLS][4],
|
|
|
|
*m_Button_Classic[CC_CONTROLS][4],
|
2009-12-09 14:52:30 +00:00
|
|
|
*m_Button_GH3[GH3_CONTROLS][4];
|
|
|
|
|
|
|
|
wxComboBox *m_Joyname[4],
|
|
|
|
*m_ComboDeadZoneLeft[4],
|
|
|
|
*m_ComboDeadZoneRight[4],
|
|
|
|
*m_ComboDiagonal[4],
|
|
|
|
*m_RumbleStrength[4],
|
2009-12-17 14:15:56 +00:00
|
|
|
*m_TiltTypeWM[4],
|
|
|
|
*m_TiltTypeNC[4],
|
2009-12-09 14:52:30 +00:00
|
|
|
*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];
|
2009-07-10 05:30:19 +00:00
|
|
|
|
2009-12-09 14:52:30 +00:00
|
|
|
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],
|
2009-12-17 14:15:56 +00:00
|
|
|
*m_sTiltType[4],
|
2009-12-09 14:52:30 +00:00
|
|
|
*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],
|
2009-12-17 14:15:56 +00:00
|
|
|
*m_sNCVertLeft[4],
|
|
|
|
*m_sNCVertRight[4],
|
2009-12-09 14:52:30 +00:00
|
|
|
*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],
|
2009-12-17 14:15:56 +00:00
|
|
|
*m_tTiltTypeWM[4], *m_tTiltTypeNC[4],
|
2009-12-09 14:52:30 +00:00
|
|
|
*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],
|
2009-07-10 05:30:19 +00:00
|
|
|
*m_statictext_Wiimote[WM_CONTROLS][4],
|
|
|
|
*m_statictext_NunChuck[NC_CONTROLS][4],
|
|
|
|
*m_statictext_Classic[CC_CONTROLS][4],
|
2009-07-09 04:19:49 +00:00
|
|
|
*m_statictext_GH3[GH3_CONTROLS][4],
|
2009-07-10 05:30:19 +00:00
|
|
|
*m_NunchuckTextStick[5],
|
|
|
|
*m_CcTextLeftStick[4],
|
|
|
|
*m_CcTextRightStick[4],
|
|
|
|
*m_CcTextTriggers[4],
|
2009-12-09 14:52:30 +00:00
|
|
|
*m_tGH3Analog[4];
|
2009-01-25 23:07:15 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID_CLOSE = 1000,
|
2009-01-29 08:35:29 +00:00
|
|
|
ID_APPLY,
|
2009-12-09 14:52:30 +00:00
|
|
|
IDTM_BUTTON, // Timer
|
2009-11-14 17:08:32 +00:00
|
|
|
IDTM_UPDATE_PAD, // Timer
|
|
|
|
|
2009-07-05 04:29:00 +00:00
|
|
|
ID_NOTEBOOK,
|
|
|
|
ID_CONTROLLERPAGE1,
|
|
|
|
ID_CONTROLLERPAGE2,
|
|
|
|
ID_CONTROLLERPAGE3,
|
|
|
|
ID_CONTROLLERPAGE4,
|
2009-02-06 06:15:59 +00:00
|
|
|
|
2009-02-09 13:10:29 +00:00
|
|
|
// Gamepad <It's important that the internal ordering of these are unchanged>
|
|
|
|
IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y,
|
|
|
|
IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y,
|
|
|
|
IDB_TRIGGER_L, IDB_TRIGGER_R,
|
|
|
|
|
2009-02-15 18:23:42 +00:00
|
|
|
// Wiimote
|
|
|
|
IDB_WM_A, IDB_WM_B,
|
|
|
|
IDB_WM_1, IDB_WM_2,
|
|
|
|
IDB_WM_P, IDB_WM_M, IDB_WM_H,
|
|
|
|
IDB_WM_L, IDB_WM_R, IDB_WM_U, IDB_WM_D,
|
2009-12-08 19:58:19 +00:00
|
|
|
IDB_WM_ROLL_L, IDB_WM_ROLL_R,
|
|
|
|
IDB_WM_PITCH_U, IDB_WM_PITCH_D,
|
|
|
|
IDB_WM_SHAKE,
|
2009-02-15 18:23:42 +00:00
|
|
|
|
|
|
|
// Nunchuck
|
2009-07-10 05:30:19 +00:00
|
|
|
IDB_NC_Z,
|
|
|
|
IDB_NC_C,
|
|
|
|
IDB_NC_L,
|
|
|
|
IDB_NC_R,
|
|
|
|
IDB_NC_U,
|
|
|
|
IDB_NC_D,
|
2009-12-17 14:15:56 +00:00
|
|
|
IDB_NC_ROLL_L, IDB_NC_ROLL_R,
|
|
|
|
IDB_NC_PITCH_U, IDB_NC_PITCH_D,
|
2009-02-15 18:23:42 +00:00
|
|
|
IDB_NC_SHAKE,
|
|
|
|
|
|
|
|
// Classic Controller
|
|
|
|
IDB_CC_A, IDB_CC_B,
|
|
|
|
IDB_CC_X, IDB_CC_Y,
|
2009-02-24 02:40:17 +00:00
|
|
|
IDB_CC_P, IDB_CC_M, IDB_CC_H,
|
2009-11-09 07:46:43 +00:00
|
|
|
IDB_CC_TL, IDB_CC_TR, IDB_CC_ZL, IDB_CC_ZR, // Shoulder triggers and Zs
|
|
|
|
IDB_CC_DL, IDB_CC_DR, IDB_CC_DU, IDB_CC_DD, // Digital pad
|
|
|
|
IDB_CC_LL, IDB_CC_LR, IDB_CC_LU, IDB_CC_LD, // Left analog stick
|
|
|
|
IDB_CC_RL, IDB_CC_RR, IDB_CC_RU, IDB_CC_RD, // Right analog stick
|
2009-02-15 18:23:42 +00:00
|
|
|
|
2009-07-09 03:58:53 +00:00
|
|
|
// Guitar Hero 3 Controller
|
|
|
|
IDB_GH3_GREEN,
|
|
|
|
IDB_GH3_RED,
|
|
|
|
IDB_GH3_YELLOW,
|
|
|
|
IDB_GH3_BLUE,
|
|
|
|
IDB_GH3_ORANGE,
|
|
|
|
IDB_GH3_PLUS,
|
|
|
|
IDB_GH3_MINUS,
|
|
|
|
IDB_GH3_WHAMMY,
|
|
|
|
IDB_GH3_ANALOG_LEFT,
|
|
|
|
IDB_GH3_ANALOG_RIGHT,
|
2009-11-09 07:46:43 +00:00
|
|
|
IDB_GH3_ANALOG_UP,
|
2009-07-09 03:58:53 +00:00
|
|
|
IDB_GH3_ANALOG_DOWN,
|
|
|
|
IDB_GH3_STRUM_UP,
|
|
|
|
IDB_GH3_STRUM_DOWN,
|
|
|
|
|
2009-02-09 13:10:29 +00:00
|
|
|
// Gamepad settings
|
2009-12-09 14:52:30 +00:00
|
|
|
IDC_JOYNAME,
|
|
|
|
IDC_RUMBLE, IDC_RUMBLE_STRENGTH,
|
|
|
|
IDC_DEAD_ZONE_LEFT, IDC_DEAD_ZONE_RIGHT,
|
|
|
|
IDC_STICK_DIAGONAL, IDC_STICK_C2S,
|
2009-12-17 14:15:56 +00:00
|
|
|
IDC_TILT_TYPE_WM, IDC_TILT_TYPE_NC,
|
2009-12-14 02:23:14 +00:00
|
|
|
IDC_TILT_ROLL, IDC_TILT_ROLL_SWING,
|
|
|
|
IDC_TILT_PITCH, IDC_TILT_PITCH_SWING,
|
|
|
|
IDC_TILT_ROLL_INVERT, IDC_TILT_PITCH_INVERT,
|
2009-12-09 14:52:30 +00:00
|
|
|
IDC_TRIGGER_TYPE,
|
|
|
|
IDC_NUNCHUCK_STICK,
|
|
|
|
IDC_CC_LEFT_STICK, IDC_CC_RIGHT_STICK, IDC_CC_TRIGGERS,
|
|
|
|
IDC_GH3_ANALOG,
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|
|
|
|
|
2009-12-09 14:52:30 +00:00
|
|
|
wxBitmap CreateBitmap();
|
|
|
|
wxBitmap CreateBitmapDot();
|
|
|
|
wxBitmap CreateBitmapDeadZone(int Radius);
|
|
|
|
wxBitmap CreateBitmapClear();
|
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
void OnClose(wxCloseEvent& event);
|
2009-07-05 04:29:00 +00:00
|
|
|
void CreatePadGUIControls();
|
2009-02-20 03:49:57 +00:00
|
|
|
void GeneralSettingsChanged(wxCommandEvent& event);
|
2009-01-25 23:07:15 +00:00
|
|
|
|
2009-02-09 13:10:29 +00:00
|
|
|
// Gamepad configuration
|
2009-11-29 17:58:52 +00:00
|
|
|
void SetButtonText(int id, const char text[128], int _Page = -1);
|
|
|
|
void SetButtonTextAll(int id, char text[128]);
|
2009-12-13 04:31:38 +00:00
|
|
|
void GetButtons(wxCommandEvent& btn_event);
|
|
|
|
void DoGetButtons(int id);
|
2009-11-29 17:58:52 +00:00
|
|
|
void SaveButtonMapping(int controller, bool DontChangeId = false, int FromSlot = -1);
|
|
|
|
void SaveButtonMappingAll(int Slot);
|
2009-02-15 18:23:42 +00:00
|
|
|
void SaveKeyboardMapping(int Controller, int Id, int Key);
|
2009-02-09 13:10:29 +00:00
|
|
|
void ToBlank(bool ToBlank = true);
|
|
|
|
void PadGetStatus();
|
2009-02-10 17:25:08 +00:00
|
|
|
void DoSave(bool ChangePad = false, int Slot = -1);
|
2009-11-29 17:58:52 +00:00
|
|
|
void DoChangeJoystick();
|
|
|
|
void PadOpen(int Open); void PadClose(int Close);
|
|
|
|
void DoChangeDeadZone(bool Left);
|
2009-02-15 18:23:42 +00:00
|
|
|
void OnButtonClick(wxCommandEvent& event);
|
2009-02-09 13:10:29 +00:00
|
|
|
|
|
|
|
// Configure buttons
|
2009-12-17 16:14:48 +00:00
|
|
|
int GetButtonWaitingID, GetButtonWaitingTimer, g_Pressed;
|
2009-12-09 14:52:30 +00:00
|
|
|
wxString GetButtonText(int id, int Page = -1);
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|
2009-07-05 04:29:00 +00:00
|
|
|
extern WiimotePadConfigDialog *m_PadConfigFrame;
|
|
|
|
#endif
|