2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2011 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:43:35 +00:00
|
|
|
// Refer to the license.txt file included.
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/dcmemory.h>
|
|
|
|
#include <wx/dialog.h>
|
2014-09-15 03:42:32 +00:00
|
|
|
#include <wx/sizer.h>
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-09-15 03:42:32 +00:00
|
|
|
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "InputCommon/GCPadStatus.h"
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
class wxCheckBox;
|
|
|
|
class wxSlider;
|
|
|
|
class wxStaticBitmap;
|
|
|
|
class wxTextCtrl;
|
|
|
|
|
2011-06-27 19:44:27 +00:00
|
|
|
class TASInputDlg : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
2014-08-13 21:42:11 +00:00
|
|
|
TASInputDlg(wxWindow* parent,
|
2014-12-02 03:56:18 +00:00
|
|
|
wxWindowID id = wxID_ANY,
|
2014-09-15 03:42:32 +00:00
|
|
|
const wxString& title = _("TAS Input"),
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP);
|
2011-06-27 19:44:27 +00:00
|
|
|
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
|
|
|
void UpdateFromSliders(wxCommandEvent& event);
|
|
|
|
void UpdateFromText(wxCommandEvent& event);
|
2013-06-25 15:04:28 +00:00
|
|
|
void OnMouseDownL(wxMouseEvent& event);
|
2012-01-22 00:39:17 +00:00
|
|
|
void OnMouseUpR(wxMouseEvent& event);
|
2014-09-15 03:42:32 +00:00
|
|
|
void OnRightClickSlider(wxMouseEvent& event);
|
2011-06-27 19:44:27 +00:00
|
|
|
void ResetValues();
|
2014-09-15 03:42:32 +00:00
|
|
|
void GetValues(GCPadStatus* PadStatus);
|
2014-10-31 08:34:30 +00:00
|
|
|
void GetValues(u8* data, WiimoteEmu::ReportFeatures rptf, int ext, const wiimote_key key);
|
2012-05-26 06:09:50 +00:00
|
|
|
void SetTurbo(wxMouseEvent& event);
|
|
|
|
void ButtonTurbo();
|
2014-07-11 02:02:32 +00:00
|
|
|
void GetKeyBoardInput(GCPadStatus* PadStatus);
|
2014-10-31 08:34:30 +00:00
|
|
|
void GetKeyBoardInput(u8* data, WiimoteEmu::ReportFeatures rptf, int ext, const wiimote_key key);
|
2014-09-15 03:42:32 +00:00
|
|
|
void CreateGCLayout();
|
2014-10-31 08:34:30 +00:00
|
|
|
void CreateWiiLayout(int num);
|
2012-01-22 00:39:17 +00:00
|
|
|
wxBitmap CreateStickBitmap(int x, int y);
|
2014-10-25 01:59:16 +00:00
|
|
|
void SetWiiButtons(u16* butt);
|
2015-04-11 02:14:21 +00:00
|
|
|
void HandleExtensionChange();
|
2012-01-22 00:39:17 +00:00
|
|
|
|
2011-06-27 19:44:27 +00:00
|
|
|
private:
|
2014-10-18 03:42:46 +00:00
|
|
|
const int ID_C_STICK = 1001;
|
|
|
|
const int ID_MAIN_STICK = 1002;
|
2015-04-11 02:14:21 +00:00
|
|
|
const int ID_CC_L_STICK = 1003;
|
|
|
|
const int ID_CC_R_STICK = 1004;
|
|
|
|
int m_eleID = 1005;
|
2014-09-15 03:42:32 +00:00
|
|
|
|
|
|
|
struct Control
|
|
|
|
{
|
2014-10-18 03:42:46 +00:00
|
|
|
wxTextCtrl* text;
|
|
|
|
wxSlider* slider;
|
2014-09-15 03:42:32 +00:00
|
|
|
int value = -1;
|
2014-10-18 03:42:46 +00:00
|
|
|
int text_id;
|
|
|
|
int slider_id;
|
2014-09-15 03:42:32 +00:00
|
|
|
u32 range;
|
2014-10-18 03:42:46 +00:00
|
|
|
u32 default_value = 128;
|
|
|
|
bool set_by_keyboard = false;
|
2014-10-31 08:34:30 +00:00
|
|
|
bool reverse = false;
|
2014-09-15 03:42:32 +00:00
|
|
|
};
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-09-15 03:42:32 +00:00
|
|
|
struct Button
|
2011-06-27 19:44:27 +00:00
|
|
|
{
|
2014-10-18 03:42:46 +00:00
|
|
|
wxCheckBox* checkbox;
|
2016-05-01 12:09:58 +00:00
|
|
|
bool is_checked = false;
|
2015-09-07 09:15:23 +00:00
|
|
|
bool value = false;
|
2014-10-18 03:42:46 +00:00
|
|
|
bool set_by_keyboard = false;
|
|
|
|
bool turbo_on = false;
|
|
|
|
int id;
|
2011-06-27 19:44:27 +00:00
|
|
|
};
|
|
|
|
|
2014-09-15 03:42:32 +00:00
|
|
|
struct Stick
|
|
|
|
{
|
|
|
|
wxStaticBitmap* bitmap;
|
2014-10-18 03:42:46 +00:00
|
|
|
Control x_cont;
|
|
|
|
Control y_cont;
|
2014-09-15 03:42:32 +00:00
|
|
|
};
|
|
|
|
|
2015-04-11 02:14:21 +00:00
|
|
|
wxBoxSizer* CreateCCLayout();
|
2015-08-12 05:05:18 +00:00
|
|
|
void FinishLayout();
|
2015-09-07 09:15:23 +00:00
|
|
|
void SetStickValue(Control* stick, int CurrentValue, int center = 128);
|
2014-09-15 03:42:32 +00:00
|
|
|
void SetButtonValue(Button* button, bool CurrentState);
|
2015-04-11 02:14:21 +00:00
|
|
|
void SetSliderValue(Control* control, int CurrentValue);
|
2014-10-31 08:34:30 +00:00
|
|
|
void CreateBaseLayout();
|
2015-04-11 02:14:21 +00:00
|
|
|
void UpdateStickBitmap(Stick stick);
|
2015-09-07 09:15:23 +00:00
|
|
|
void InvalidateButton(Button* button);
|
|
|
|
void InvalidateControl(Control* button);
|
2016-05-01 12:09:58 +00:00
|
|
|
void InvalidateExtension();
|
2015-09-07 09:15:23 +00:00
|
|
|
void UpdateFromInvalidatedButton(wxCommandEvent& event);
|
|
|
|
void UpdateFromInvalidatedControl(wxCommandEvent& event);
|
2016-05-01 12:09:58 +00:00
|
|
|
void UpdateFromInvalidatedExtension(wxThreadEvent& event);
|
|
|
|
void OnCheckboxToggle(wxCommandEvent& event);
|
2015-04-11 02:14:21 +00:00
|
|
|
Stick* FindStickByID(int id);
|
2014-10-31 08:34:30 +00:00
|
|
|
Stick CreateStick(int id_stick, int xRange, int yRange, u32 defaultX, u32 defaultY, bool reverseX, bool reverseY);
|
2014-10-19 03:00:56 +00:00
|
|
|
wxStaticBoxSizer* CreateStickLayout(Stick* tempStick, const wxString& title);
|
2014-10-31 08:34:30 +00:00
|
|
|
wxStaticBoxSizer* CreateAccelLayout(Control* x, Control* y, Control* z, const wxString& title);
|
2014-09-15 03:42:32 +00:00
|
|
|
Button CreateButton(const std::string& name);
|
2014-10-31 08:34:30 +00:00
|
|
|
Control CreateControl(long style, int width, int height, bool reverse = false, u32 range = 255, u32 default_value = 128);
|
2014-09-15 03:42:32 +00:00
|
|
|
|
2015-04-11 02:14:21 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
CC_L_STICK_X,
|
|
|
|
CC_L_STICK_Y,
|
|
|
|
CC_R_STICK_X,
|
|
|
|
CC_R_STICK_Y,
|
|
|
|
CC_L_TRIGGER,
|
|
|
|
CC_R_TRIGGER,
|
|
|
|
};
|
|
|
|
|
|
|
|
Control m_l_cont, m_r_cont, m_x_cont, m_y_cont, m_z_cont, m_nx_cont, m_ny_cont, m_nz_cont, m_cc_l, m_cc_r;
|
2014-10-18 03:42:46 +00:00
|
|
|
Button m_a, m_b, m_x, m_y, m_z, m_l, m_r, m_c;
|
|
|
|
Button m_start, m_plus, m_minus, m_one, m_two, m_home;
|
|
|
|
Button m_dpad_up, m_dpad_down, m_dpad_left, m_dpad_right;
|
|
|
|
Stick m_main_stick, m_c_stick;
|
2014-09-15 03:42:32 +00:00
|
|
|
|
2015-04-11 02:14:21 +00:00
|
|
|
Stick m_cc_l_stick, m_cc_r_stick;
|
|
|
|
|
|
|
|
Button* m_buttons[13];
|
|
|
|
Button m_cc_buttons[15];
|
2014-10-18 03:42:46 +00:00
|
|
|
Control* m_controls[10];
|
2015-04-11 02:14:21 +00:00
|
|
|
Control* m_cc_controls[6];
|
2014-10-18 03:42:46 +00:00
|
|
|
static const int m_gc_pad_buttons_bitmask[12];
|
2015-04-11 02:14:21 +00:00
|
|
|
static const int m_wii_buttons_bitmask[11];
|
|
|
|
static const int m_cc_buttons_bitmask[15];
|
|
|
|
static const std::string m_cc_button_names[15];
|
2014-10-31 08:34:30 +00:00
|
|
|
u8 m_ext = 0;
|
|
|
|
wxBoxSizer* m_main_szr;
|
|
|
|
wxBoxSizer* m_wiimote_szr;
|
|
|
|
wxBoxSizer* m_ext_szr;
|
2015-04-11 02:14:21 +00:00
|
|
|
wxBoxSizer* m_cc_szr;
|
2014-10-31 08:34:30 +00:00
|
|
|
wxStaticBoxSizer* m_main_stick_szr;
|
|
|
|
wxStaticBoxSizer* m_c_stick_szr;
|
2015-04-11 02:14:21 +00:00
|
|
|
wxStaticBoxSizer* m_cc_l_stick_szr;
|
|
|
|
wxStaticBoxSizer* m_cc_r_stick_szr;
|
2014-09-15 03:42:32 +00:00
|
|
|
|
2014-10-18 03:42:46 +00:00
|
|
|
bool m_has_layout = false;
|
2014-09-15 03:42:32 +00:00
|
|
|
|
2015-04-10 03:15:15 +00:00
|
|
|
wxGridSizer* m_buttons_dpad;
|
2011-06-27 19:44:27 +00:00
|
|
|
};
|