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"
|
2009-12-27 19:31:02 +00:00
|
|
|
#include "wiimote_hid.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,
|
2010-02-25 06:12:35 +00:00
|
|
|
wxWindowID id = wxID_ANY,
|
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
|
|
|
|
2009-02-12 16:43:35 +00:00
|
|
|
void Convert2Box(int &x);
|
2009-02-09 13:10:29 +00:00
|
|
|
|
2009-12-09 14:52:30 +00:00
|
|
|
wxTimer *m_UpdatePadTimer,
|
2009-07-05 04:29:00 +00:00
|
|
|
*m_ButtonMappingTimer;
|
|
|
|
|
2009-12-27 19:31:02 +00:00
|
|
|
wxStaticBitmap *m_bmpDotLeftIn[MAX_WIIMOTES],
|
|
|
|
*m_bmpDotLeftOut[MAX_WIIMOTES],
|
|
|
|
*m_bmpDotRightIn[MAX_WIIMOTES],
|
|
|
|
*m_bmpDotRightOut[MAX_WIIMOTES],
|
|
|
|
*m_bmpDeadZoneLeftIn[MAX_WIIMOTES],
|
|
|
|
*m_bmpDeadZoneRightIn[MAX_WIIMOTES];
|
2009-11-29 17:58:52 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2009-12-27 19:31:02 +00:00
|
|
|
// <It's important that the internal ordering of these are unchanged>
|
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-12-27 19:31:02 +00:00
|
|
|
// Gamepad
|
|
|
|
IDB_ANALOG_LEFT_X, IDB_ANALOG_LEFT_Y,
|
|
|
|
IDB_ANALOG_RIGHT_X, IDB_ANALOG_RIGHT_Y,
|
|
|
|
IDB_TRIGGER_L, IDB_TRIGGER_R,
|
|
|
|
|
2010-02-25 06:12:35 +00:00
|
|
|
IDTM_BUTTON = 1000, // Timer
|
2009-12-27 19:31:02 +00:00
|
|
|
IDTM_UPDATE_PAD, // Timer
|
|
|
|
|
|
|
|
ID_NOTEBOOK,
|
|
|
|
ID_CONTROLLERPAGE1,
|
|
|
|
ID_CONTROLLERPAGE2,
|
|
|
|
ID_CONTROLLERPAGE3,
|
|
|
|
ID_CONTROLLERPAGE4,
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2010-01-22 23:19:16 +00:00
|
|
|
bool m_ControlsCreated;
|
2009-12-27 19:31:02 +00:00
|
|
|
int m_Page, BoxW, BoxH;
|
|
|
|
|
|
|
|
wxString OldLabel;
|
|
|
|
|
|
|
|
wxNotebook *m_Notebook;
|
|
|
|
|
|
|
|
wxPanel *m_Controller[MAX_WIIMOTES],
|
|
|
|
*m_pLeftInStatus[MAX_WIIMOTES],
|
|
|
|
*m_pLeftOutStatus[MAX_WIIMOTES],
|
|
|
|
*m_pRightInStatus[MAX_WIIMOTES],
|
|
|
|
*m_pRightOutStatus[MAX_WIIMOTES];
|
|
|
|
|
|
|
|
wxStaticBitmap *m_bmpSquareLeftIn[MAX_WIIMOTES],
|
|
|
|
*m_bmpSquareLeftOut[MAX_WIIMOTES],
|
|
|
|
*m_bmpSquareRightIn[MAX_WIIMOTES],
|
|
|
|
*m_bmpSquareRightOut[MAX_WIIMOTES];
|
|
|
|
|
|
|
|
wxCheckBox *m_CheckC2S[MAX_WIIMOTES],
|
|
|
|
*m_CheckRumble[MAX_WIIMOTES],
|
|
|
|
*m_TiltRollSwing[MAX_WIIMOTES],
|
|
|
|
*m_TiltPitchSwing[MAX_WIIMOTES],
|
|
|
|
*m_TiltRollInvert[MAX_WIIMOTES],
|
|
|
|
*m_TiltPitchInvert[MAX_WIIMOTES];
|
|
|
|
|
|
|
|
wxButton *m_Close, *m_Apply, *ClickedButton,
|
|
|
|
*m_Button_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][MAX_WIIMOTES],
|
|
|
|
*m_Button_Wiimote[IDB_WM_SHAKE - IDB_WM_A + 1][MAX_WIIMOTES],
|
|
|
|
*m_Button_NunChuck[IDB_NC_SHAKE - IDB_NC_Z + 1][MAX_WIIMOTES],
|
|
|
|
*m_Button_Classic[IDB_CC_RD - IDB_CC_A + 1][MAX_WIIMOTES],
|
|
|
|
*m_Button_GH3[IDB_GH3_STRUM_DOWN - IDB_GH3_GREEN + 1][MAX_WIIMOTES];
|
|
|
|
|
2010-02-22 01:08:42 +00:00
|
|
|
wxChoice *m_Joyname[MAX_WIIMOTES],
|
2009-12-27 19:31:02 +00:00
|
|
|
*m_ComboDeadZoneLeft[MAX_WIIMOTES],
|
|
|
|
*m_ComboDeadZoneRight[MAX_WIIMOTES],
|
|
|
|
*m_ComboDiagonal[MAX_WIIMOTES],
|
|
|
|
*m_RumbleStrength[MAX_WIIMOTES],
|
|
|
|
*m_TiltTypeWM[MAX_WIIMOTES],
|
|
|
|
*m_TiltTypeNC[MAX_WIIMOTES],
|
|
|
|
*m_TiltComboRangeRoll[MAX_WIIMOTES],
|
|
|
|
*m_TiltComboRangePitch[MAX_WIIMOTES],
|
|
|
|
*m_TriggerType[MAX_WIIMOTES],
|
|
|
|
*m_NunchuckComboStick[MAX_WIIMOTES],
|
|
|
|
*m_CcComboLeftStick[MAX_WIIMOTES],
|
|
|
|
*m_CcComboRightStick[MAX_WIIMOTES],
|
|
|
|
*m_CcComboTriggers[MAX_WIIMOTES],
|
|
|
|
*m_GH3ComboAnalog[MAX_WIIMOTES];
|
|
|
|
|
|
|
|
wxGridBagSizer *m_sGridTilt[MAX_WIIMOTES],
|
|
|
|
*m_sGridStickLeft[MAX_WIIMOTES],
|
|
|
|
*m_sGridStickRight[MAX_WIIMOTES],
|
|
|
|
*m_sGridTrigger[MAX_WIIMOTES];
|
|
|
|
|
|
|
|
wxBoxSizer *m_MainSizer,
|
|
|
|
*m_sMain[MAX_WIIMOTES],
|
|
|
|
*m_sDeadZoneHoriz[MAX_WIIMOTES],
|
|
|
|
*m_sDeadZone[MAX_WIIMOTES],
|
|
|
|
*m_sDiagonal[MAX_WIIMOTES],
|
|
|
|
*m_sCircle2Square[MAX_WIIMOTES],
|
|
|
|
*m_sC2SDeadZone[MAX_WIIMOTES],
|
|
|
|
*m_sJoyname[MAX_WIIMOTES],
|
|
|
|
*m_sRumble[MAX_WIIMOTES],
|
|
|
|
*m_sTiltType[MAX_WIIMOTES],
|
|
|
|
*m_sHorizController[MAX_WIIMOTES],
|
|
|
|
*m_sHorizStatus[MAX_WIIMOTES],
|
|
|
|
*m_Sizer_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][MAX_WIIMOTES],
|
|
|
|
*m_sAnalogLeft[MAX_WIIMOTES],
|
|
|
|
*m_sAnalogMiddle[MAX_WIIMOTES],
|
|
|
|
*m_sAnalogRight[MAX_WIIMOTES],
|
|
|
|
*m_sHorizAnalogMapping[MAX_WIIMOTES],
|
|
|
|
*m_Sizer_Wiimote[IDB_WM_SHAKE - IDB_WM_A + 1][MAX_WIIMOTES],
|
|
|
|
*m_sWmVertLeft[MAX_WIIMOTES],
|
|
|
|
*m_sWmVertRight[MAX_WIIMOTES],
|
|
|
|
*m_Sizer_NunChuck[IDB_NC_SHAKE - IDB_NC_Z + 1][MAX_WIIMOTES],
|
|
|
|
*m_sNunchuckStick[MAX_WIIMOTES],
|
|
|
|
*m_sNCVertLeft[MAX_WIIMOTES],
|
|
|
|
*m_sNCVertRight[MAX_WIIMOTES],
|
|
|
|
*m_Sizer_Classic[IDB_CC_RD - IDB_CC_A + 1][MAX_WIIMOTES],
|
|
|
|
*m_sCcLeftStick[MAX_WIIMOTES],
|
|
|
|
*m_sCcRightStick[MAX_WIIMOTES],
|
|
|
|
*m_sCcTriggers[MAX_WIIMOTES],
|
|
|
|
*m_sCcVertLeft[MAX_WIIMOTES],
|
|
|
|
*m_sCcVertMiddle[MAX_WIIMOTES],
|
|
|
|
*m_sCcVertRight[MAX_WIIMOTES],
|
|
|
|
*m_Sizer_GH3[IDB_GH3_STRUM_DOWN - IDB_GH3_GREEN + 1][MAX_WIIMOTES],
|
|
|
|
*m_sGH3Analog[MAX_WIIMOTES],
|
|
|
|
*m_sGH3VertLeft[MAX_WIIMOTES],
|
|
|
|
*m_sGH3VertRight[MAX_WIIMOTES],
|
|
|
|
*m_sHorizControllerMapping[MAX_WIIMOTES];
|
|
|
|
|
|
|
|
wxStaticBoxSizer *m_gJoyPad[MAX_WIIMOTES],
|
|
|
|
*m_gTilt[MAX_WIIMOTES],
|
|
|
|
*m_gStickLeft[MAX_WIIMOTES],
|
|
|
|
*m_gStickRight[MAX_WIIMOTES],
|
|
|
|
*m_gTriggers[MAX_WIIMOTES],
|
|
|
|
*m_gAnalog[MAX_WIIMOTES],
|
|
|
|
*m_gWiimote[MAX_WIIMOTES],
|
|
|
|
*m_gNunchuck[MAX_WIIMOTES],
|
|
|
|
*m_gClassicController[MAX_WIIMOTES],
|
|
|
|
*m_gGuitarHero3Controller[MAX_WIIMOTES];
|
|
|
|
|
|
|
|
wxStaticText *m_ComboDeadZoneLabel[MAX_WIIMOTES],
|
|
|
|
*m_DiagonalLabel[MAX_WIIMOTES],
|
|
|
|
*m_RumbleStrengthLabel[MAX_WIIMOTES],
|
|
|
|
*m_tTiltTypeWM[MAX_WIIMOTES], *m_tTiltTypeNC[MAX_WIIMOTES],
|
|
|
|
*m_TiltTextRoll[MAX_WIIMOTES], *m_TiltTextPitch[MAX_WIIMOTES],
|
|
|
|
*m_tStatusLeftIn[MAX_WIIMOTES], *m_tStatusLeftOut[MAX_WIIMOTES],
|
|
|
|
*m_tStatusRightIn[MAX_WIIMOTES], *m_tStatusRightOut[MAX_WIIMOTES],
|
|
|
|
*m_TriggerL[MAX_WIIMOTES], *m_TriggerR[MAX_WIIMOTES],
|
|
|
|
*m_TriggerStatusL[MAX_WIIMOTES], *m_TriggerStatusR[MAX_WIIMOTES],
|
|
|
|
*m_tTriggerSource[MAX_WIIMOTES],
|
|
|
|
*m_statictext_Analog[IDB_TRIGGER_R - IDB_ANALOG_LEFT_X + 1][MAX_WIIMOTES],
|
|
|
|
*m_statictext_Wiimote[IDB_WM_SHAKE - IDB_WM_A + 1][MAX_WIIMOTES],
|
2010-05-07 22:39:06 +00:00
|
|
|
*m_statictext_Nunchuk[IDB_NC_SHAKE - IDB_NC_Z + 1][MAX_WIIMOTES],
|
2009-12-27 19:31:02 +00:00
|
|
|
*m_statictext_Classic[IDB_CC_RD - IDB_CC_A + 1][MAX_WIIMOTES],
|
|
|
|
*m_statictext_GH3[IDB_GH3_STRUM_DOWN - IDB_GH3_GREEN + 1][MAX_WIIMOTES],
|
|
|
|
*m_NunchuckTextStick[5],
|
|
|
|
*m_CcTextLeftStick[MAX_WIIMOTES],
|
|
|
|
*m_CcTextRightStick[MAX_WIIMOTES],
|
|
|
|
*m_CcTextTriggers[MAX_WIIMOTES],
|
|
|
|
*m_tGH3Analog[MAX_WIIMOTES];
|
|
|
|
|
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-12-27 19:31:02 +00:00
|
|
|
void CloseClick(wxCommandEvent& event);
|
2009-07-05 04:29:00 +00:00
|
|
|
void CreatePadGUIControls();
|
2009-12-27 19:31:02 +00:00
|
|
|
void UpdateGUI();
|
|
|
|
void NotebookPageChanged(wxNotebookEvent& event);
|
|
|
|
void OnButtonTimer(wxTimerEvent& WXUNUSED(event)) { DoGetButtons(GetButtonWaitingID); }
|
|
|
|
void OnKeyDown(wxKeyEvent& event);
|
|
|
|
void OnButtonClick(wxCommandEvent& event);
|
2010-01-22 23:19:16 +00:00
|
|
|
void OnAxisClick(wxCommandEvent& event);
|
2009-02-20 03:49:57 +00:00
|
|
|
void GeneralSettingsChanged(wxCommandEvent& event);
|
2009-12-27 19:31:02 +00:00
|
|
|
void SaveButtonMapping(int Id, int Key);
|
2009-01-25 23:07:15 +00:00
|
|
|
|
2009-02-09 13:10:29 +00:00
|
|
|
// Gamepad configuration
|
2009-12-27 19:31:02 +00:00
|
|
|
void SetButtonText(int id,const wxString &str);
|
|
|
|
wxString GetButtonText(int id);
|
2010-01-22 23:19:16 +00:00
|
|
|
|
2009-12-13 04:31:38 +00:00
|
|
|
void DoGetButtons(int id);
|
2010-03-17 01:54:40 +00:00
|
|
|
void EndGetButtons();
|
2009-12-27 19:31:02 +00:00
|
|
|
void UpdatePadInfo(wxTimerEvent& WXUNUSED(event));
|
|
|
|
void ToBlank(bool ToBlank, int Id);
|
|
|
|
void DoChangeDeadZone();
|
2009-02-09 13:10:29 +00:00
|
|
|
|
|
|
|
// Configure buttons
|
2009-12-17 16:14:48 +00:00
|
|
|
int GetButtonWaitingID, GetButtonWaitingTimer, g_Pressed;
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|
2009-07-05 04:29:00 +00:00
|
|
|
extern WiimotePadConfigDialog *m_PadConfigFrame;
|
|
|
|
#endif
|