mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
More features/fixes for the TAS Input plugin. Buttons added to window and input is restricted to the 1st controller only (until multicontroller support is added). Fixed bug with sliders not appearing correctly on Linux.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7643 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,230 +1,370 @@
|
|||||||
// Copyright (C) 2011 Dolphin Project.
|
// Copyright (C) 2011 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "TASInputDlg.h"
|
#include "TASInputDlg.h"
|
||||||
#include "Movie.h"
|
#include "Movie.h"
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(TASInputDlg, wxDialog)
|
BEGIN_EVENT_TABLE(TASInputDlg, wxDialog)
|
||||||
|
|
||||||
EVT_SLIDER(ID_MAIN_X_SLIDER, TASInputDlg::UpdateFromSliders)
|
EVT_SLIDER(ID_MAIN_X_SLIDER, TASInputDlg::UpdateFromSliders)
|
||||||
EVT_SLIDER(ID_MAIN_Y_SLIDER, TASInputDlg::UpdateFromSliders)
|
EVT_SLIDER(ID_MAIN_Y_SLIDER, TASInputDlg::UpdateFromSliders)
|
||||||
EVT_SLIDER(ID_C_X_SLIDER, TASInputDlg::UpdateFromSliders)
|
EVT_SLIDER(ID_C_X_SLIDER, TASInputDlg::UpdateFromSliders)
|
||||||
EVT_SLIDER(ID_C_Y_SLIDER, TASInputDlg::UpdateFromSliders)
|
EVT_SLIDER(ID_C_Y_SLIDER, TASInputDlg::UpdateFromSliders)
|
||||||
EVT_SLIDER(ID_L_SLIDER, TASInputDlg::UpdateFromSliders)
|
EVT_SLIDER(ID_L_SLIDER, TASInputDlg::UpdateFromSliders)
|
||||||
EVT_SLIDER(ID_R_SLIDER, TASInputDlg::UpdateFromSliders)
|
EVT_SLIDER(ID_R_SLIDER, TASInputDlg::UpdateFromSliders)
|
||||||
|
|
||||||
EVT_TEXT(ID_MAIN_X_TEXT, TASInputDlg::UpdateFromText)
|
EVT_TEXT(ID_MAIN_X_TEXT, TASInputDlg::UpdateFromText)
|
||||||
EVT_TEXT(ID_MAIN_Y_TEXT, TASInputDlg::UpdateFromText)
|
EVT_TEXT(ID_MAIN_Y_TEXT, TASInputDlg::UpdateFromText)
|
||||||
EVT_TEXT(ID_C_X_TEXT, TASInputDlg::UpdateFromText)
|
EVT_TEXT(ID_C_X_TEXT, TASInputDlg::UpdateFromText)
|
||||||
EVT_TEXT(ID_C_Y_TEXT, TASInputDlg::UpdateFromText)
|
EVT_TEXT(ID_C_Y_TEXT, TASInputDlg::UpdateFromText)
|
||||||
EVT_TEXT(ID_L_TEXT, TASInputDlg::UpdateFromText)
|
EVT_TEXT(ID_L_TEXT, TASInputDlg::UpdateFromText)
|
||||||
EVT_TEXT(ID_R_TEXT, TASInputDlg::UpdateFromText)
|
EVT_TEXT(ID_R_TEXT, TASInputDlg::UpdateFromText)
|
||||||
|
|
||||||
EVT_CLOSE(TASInputDlg::OnCloseWindow)
|
EVT_CLOSE(TASInputDlg::OnCloseWindow)
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
TASInputDlg::TASInputDlg(wxWindow *parent, wxWindowID id, const wxString &title,
|
TASInputDlg::TASInputDlg(wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
const wxPoint &position, const wxSize& size, long style)
|
const wxPoint &position, const wxSize& size, long style)
|
||||||
: wxDialog(parent, id, title, position, size, style)
|
: wxDialog(parent, id, title, position, size, style)
|
||||||
{
|
{
|
||||||
mainX = mainY = cX = cY = 128;
|
wxBoxSizer* const top_box = new wxBoxSizer(wxHORIZONTAL);
|
||||||
lTrig = rTrig = 0;
|
wxBoxSizer* const bottom_box = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
wxStaticBoxSizer* const main_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Main Stick"));
|
||||||
wxBoxSizer* const top_box = new wxBoxSizer(wxHORIZONTAL);
|
wx_mainX_s = new wxSlider(this, ID_MAIN_X_SLIDER, 128, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
|
||||||
wxStaticBoxSizer* const main_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Main Stick"));
|
wx_mainX_s->SetMinSize(wxSize(100,-1));
|
||||||
wx_mainX_s = new wxSlider(this, ID_MAIN_X_SLIDER, 128, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
|
wx_mainX_t = new wxTextCtrl(this, ID_MAIN_X_TEXT, wxT("128"), wxDefaultPosition, wxSize(40, 20));
|
||||||
wx_mainX_t = new wxTextCtrl(this, ID_MAIN_X_TEXT, wxT("128"), wxDefaultPosition, wxSize(40, 20));
|
wx_mainX_t->SetMaxLength(3);
|
||||||
wx_mainX_t->SetMaxLength(3);
|
wx_mainY_s = new wxSlider(this, ID_MAIN_Y_SLIDER, 128, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
||||||
wx_mainY_s = new wxSlider(this, ID_MAIN_Y_SLIDER, 128, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
wx_mainY_s->SetMinSize(wxSize(-1,100));
|
||||||
wx_mainY_t = new wxTextCtrl(this, ID_MAIN_Y_TEXT, wxT("128"), wxDefaultPosition, wxSize(40, 20));
|
wx_mainY_t = new wxTextCtrl(this, ID_MAIN_Y_TEXT, wxT("128"), wxDefaultPosition, wxSize(40, 20));
|
||||||
wx_mainY_t->SetMaxLength(3);
|
wx_mainY_t->SetMaxLength(3);
|
||||||
main_box->Add(wx_mainX_s, 0, wxALIGN_TOP);
|
main_box->Add(wx_mainX_s, 0, wxALIGN_TOP);
|
||||||
main_box->Add(wx_mainX_t, 0, wxALIGN_TOP);
|
main_box->Add(wx_mainX_t, 0, wxALIGN_TOP);
|
||||||
main_box->Add(wx_mainY_s, 0, wxALIGN_CENTER_VERTICAL);
|
main_box->Add(wx_mainY_s, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
main_box->Add(wx_mainY_t, 0, wxALIGN_CENTER_VERTICAL);
|
main_box->Add(wx_mainY_t, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
wxStaticBoxSizer* const c_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("C Stick"));
|
wxStaticBoxSizer* const c_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("C Stick"));
|
||||||
wx_cX_s = new wxSlider(this, ID_C_X_SLIDER, 128, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
|
wx_cX_s = new wxSlider(this, ID_C_X_SLIDER, 128, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL);
|
||||||
wx_cX_t = new wxTextCtrl(this, ID_C_X_TEXT, wxT("128"), wxDefaultPosition, wxSize(40, 20));
|
wx_cX_s->SetMinSize(wxSize(100,-1));
|
||||||
wx_cX_t->SetMaxLength(3);
|
wx_cX_t = new wxTextCtrl(this, ID_C_X_TEXT, wxT("128"), wxDefaultPosition, wxSize(40, 20));
|
||||||
wx_cY_s = new wxSlider(this, ID_C_Y_SLIDER, 128, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
wx_cX_t->SetMaxLength(3);
|
||||||
wx_cY_t = new wxTextCtrl(this, ID_C_Y_TEXT, wxT("128"), wxDefaultPosition, wxSize(40, 20));
|
wx_cY_s = new wxSlider(this, ID_C_Y_SLIDER, 128, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
||||||
wx_cY_t->SetMaxLength(3);
|
wx_cY_s->SetMinSize(wxSize(-1,100));
|
||||||
c_box->Add(wx_cX_s, 0, wxALIGN_TOP);
|
wx_cY_t = new wxTextCtrl(this, ID_C_Y_TEXT, wxT("128"), wxDefaultPosition, wxSize(40, 20));
|
||||||
c_box->Add(wx_cX_t, 0, wxALIGN_TOP);
|
wx_cY_t->SetMaxLength(3);
|
||||||
c_box->Add(wx_cY_s, 0, wxALIGN_CENTER_VERTICAL);
|
c_box->Add(wx_cX_s, 0, wxALIGN_TOP);
|
||||||
c_box->Add(wx_cY_t, 0, wxALIGN_CENTER_VERTICAL);
|
c_box->Add(wx_cX_t, 0, wxALIGN_TOP);
|
||||||
|
c_box->Add(wx_cY_s, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
wxStaticBoxSizer* const shoulder_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Shoulder Buttons"));
|
c_box->Add(wx_cY_t, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
wx_l_s = new wxSlider(this, ID_L_SLIDER, 0, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
|
||||||
wx_l_t = new wxTextCtrl(this, ID_L_TEXT, wxT("0"), wxDefaultPosition, wxSize(40, 20));
|
wxStaticBoxSizer* const shoulder_box = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Shoulder Buttons"));
|
||||||
wx_l_t->SetMaxLength(3);
|
wx_l_s = new wxSlider(this, ID_L_SLIDER, 0, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
||||||
wx_r_s = new wxSlider(this, ID_R_SLIDER, 0, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
wx_l_s->SetMinSize(wxSize(-1,100));
|
||||||
wx_r_t = new wxTextCtrl(this, ID_R_TEXT, wxT("0"), wxDefaultPosition, wxSize(40, 20));
|
wx_l_t = new wxTextCtrl(this, ID_L_TEXT, wxT("0"), wxDefaultPosition, wxSize(40, 20));
|
||||||
wx_r_t->SetMaxLength(3);
|
wx_l_t->SetMaxLength(3);
|
||||||
shoulder_box->Add(wx_l_s, 0, wxALIGN_CENTER_VERTICAL);
|
wx_r_s = new wxSlider(this, ID_R_SLIDER, 0, 0, 255, wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
||||||
shoulder_box->Add(wx_l_t, 0, wxALIGN_CENTER_VERTICAL);
|
wx_r_s->SetMinSize(wxSize(-1,100));
|
||||||
shoulder_box->Add(wx_r_s, 0, wxALIGN_CENTER_VERTICAL);
|
wx_r_t = new wxTextCtrl(this, ID_R_TEXT, wxT("0"), wxDefaultPosition, wxSize(40, 20));
|
||||||
shoulder_box->Add(wx_r_t, 0, wxALIGN_CENTER_VERTICAL);
|
wx_r_t->SetMaxLength(3);
|
||||||
|
shoulder_box->Add(wx_l_s, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
|
shoulder_box->Add(wx_l_t, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
top_box->Add(main_box);
|
shoulder_box->Add(wx_r_s, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
top_box->Add(c_box);
|
shoulder_box->Add(wx_r_t, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
main_szr->Add(top_box);
|
|
||||||
main_szr->Add(shoulder_box);
|
wxStaticBoxSizer* const buttons_box = new wxStaticBoxSizer(wxVERTICAL, this, _("Buttons"));
|
||||||
SetSizerAndFit(main_szr);
|
wxGridSizer* const buttons_grid = new wxGridSizer(4);
|
||||||
}
|
wx_a_button = new wxCheckBox(this,ID_A,_T("A"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
|
wx_b_button = new wxCheckBox(this,ID_B,_T("B"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
void TASInputDlg::ResetValues()
|
wx_x_button = new wxCheckBox(this,ID_X,_T("X"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
{
|
wx_y_button = new wxCheckBox(this,ID_Y,_T("Y"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
mainX = mainY = cX = cY = 128;
|
wx_l_button = new wxCheckBox(this,ID_L,_T("L"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
lTrig = rTrig = 0;
|
wx_r_button = new wxCheckBox(this,ID_R,_T("R"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
|
wx_z_button = new wxCheckBox(this,ID_Z,_T("Z"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
wx_mainX_s->SetValue(128);
|
wx_start_button = new wxCheckBox(this,ID_START,_T("Start"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
wx_mainY_s->SetValue(128);
|
buttons_grid->Add(wx_a_button,false);
|
||||||
wx_cX_s->SetValue(128);
|
buttons_grid->Add(wx_b_button,false);
|
||||||
wx_cY_s->SetValue(128);
|
buttons_grid->Add(wx_x_button,false);
|
||||||
wx_l_s->SetValue(0);
|
buttons_grid->Add(wx_y_button,false);
|
||||||
wx_r_s->SetValue(0);
|
buttons_grid->Add(wx_l_button,false);
|
||||||
|
buttons_grid->Add(wx_r_button,false);
|
||||||
wx_mainX_t->SetValue(wxT("128"));
|
buttons_grid->Add(wx_z_button,false);
|
||||||
wx_mainY_t->SetValue(wxT("128"));
|
buttons_grid->Add(wx_start_button,false);
|
||||||
wx_cX_t->SetValue(wxT("128"));
|
buttons_grid->AddSpacer(5);
|
||||||
wx_cY_t->SetValue(wxT("128"));
|
|
||||||
wx_l_t->SetValue(wxT("0"));
|
wxGridSizer* const buttons_dpad = new wxGridSizer(3);
|
||||||
wx_r_t->SetValue(wxT("0"));
|
wx_up_button = new wxCheckBox(this,ID_UP,_T("Up"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
}
|
wx_right_button = new wxCheckBox(this,ID_RIGHT,_T("Right"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
|
wx_down_button = new wxCheckBox(this,ID_DOWN,_T("Down"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID)
|
wx_left_button = new wxCheckBox(this,ID_LEFT,_T("Left"),wxDefaultPosition,wxDefaultSize,0,wxDefaultValidator,wxCheckBoxNameStr);
|
||||||
{
|
buttons_dpad->AddSpacer(20);
|
||||||
if (!IsShown())
|
buttons_dpad->Add(wx_up_button,false);
|
||||||
return;
|
buttons_dpad->AddSpacer(20);
|
||||||
|
buttons_dpad->Add(wx_left_button,false);
|
||||||
PadStatus->stickX = mainX;
|
buttons_dpad->AddSpacer(20);
|
||||||
PadStatus->stickY = mainY;
|
buttons_dpad->Add(wx_right_button,false);
|
||||||
PadStatus->substickX = cX;
|
buttons_dpad->AddSpacer(20);
|
||||||
PadStatus->substickY = cY;
|
buttons_dpad->Add(wx_down_button,false);
|
||||||
PadStatus->triggerLeft = lTrig;
|
buttons_dpad->AddSpacer(20);
|
||||||
PadStatus->triggerRight = rTrig;
|
buttons_box->Add(buttons_grid);
|
||||||
}
|
buttons_box->Add(buttons_dpad);
|
||||||
|
|
||||||
void TASInputDlg::UpdateFromSliders(wxCommandEvent& event)
|
wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
|
||||||
{
|
top_box->AddSpacer(5);
|
||||||
wxTextCtrl *text;
|
top_box->Add(main_box);
|
||||||
u8 *v;
|
top_box->AddSpacer(5);
|
||||||
|
top_box->Add(c_box);
|
||||||
switch(event.GetId())
|
top_box->AddSpacer(5);
|
||||||
{
|
bottom_box->AddSpacer(5);
|
||||||
case ID_MAIN_X_SLIDER:
|
bottom_box->Add(shoulder_box);
|
||||||
text = wx_mainX_t;
|
bottom_box->AddSpacer(5);
|
||||||
v = &mainX;
|
bottom_box->Add(buttons_box);
|
||||||
break;
|
bottom_box->AddSpacer(5);
|
||||||
|
main_szr->Add(top_box);
|
||||||
case ID_MAIN_Y_SLIDER:
|
main_szr->Add(bottom_box);
|
||||||
text = wx_mainY_t;
|
SetSizerAndFit(main_szr);
|
||||||
v = &mainY;
|
ResetValues();
|
||||||
break;
|
}
|
||||||
|
|
||||||
case ID_C_X_SLIDER:
|
void TASInputDlg::ResetValues()
|
||||||
text = wx_cX_t;
|
{
|
||||||
v = &cX;
|
mainX = mainY = cX = cY = 128;
|
||||||
break;
|
lTrig = rTrig = 0;
|
||||||
|
|
||||||
case ID_C_Y_SLIDER:
|
wx_mainX_s->SetValue(128);
|
||||||
text = wx_cY_t;
|
wx_mainY_s->SetValue(128);
|
||||||
v = &cY;
|
wx_cX_s->SetValue(128);
|
||||||
break;
|
wx_cY_s->SetValue(128);
|
||||||
|
wx_l_s->SetValue(0);
|
||||||
case ID_L_SLIDER:
|
wx_r_s->SetValue(0);
|
||||||
text = wx_l_t;
|
|
||||||
v = &lTrig;
|
wx_mainX_t->SetValue(wxT("128"));
|
||||||
break;
|
wx_mainY_t->SetValue(wxT("128"));
|
||||||
|
wx_cX_t->SetValue(wxT("128"));
|
||||||
case ID_R_SLIDER:
|
wx_cY_t->SetValue(wxT("128"));
|
||||||
text = wx_r_t;
|
wx_l_t->SetValue(wxT("0"));
|
||||||
v = &rTrig;
|
wx_r_t->SetValue(wxT("0"));
|
||||||
break;
|
|
||||||
|
wx_up_button->SetValue(false);
|
||||||
default:
|
wx_down_button->SetValue(false);
|
||||||
return;
|
wx_left_button->SetValue(false);
|
||||||
}
|
wx_right_button->SetValue(false);
|
||||||
|
wx_a_button->SetValue(false);
|
||||||
int value = ((wxSlider *) event.GetEventObject())->GetValue();
|
wx_b_button->SetValue(false);
|
||||||
*v = (u8) value;
|
wx_x_button->SetValue(false);
|
||||||
text->SetValue(wxString::Format(wxT("%i"), value));
|
wx_y_button->SetValue(false);
|
||||||
}
|
wx_l_button->SetValue(false);
|
||||||
|
wx_r_button->SetValue(false);
|
||||||
void TASInputDlg::UpdateFromText(wxCommandEvent& event)
|
wx_z_button->SetValue(false);
|
||||||
{
|
wx_start_button->SetValue(false);
|
||||||
wxSlider *slider;
|
}
|
||||||
u8 *v;
|
|
||||||
|
void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID)
|
||||||
switch(event.GetId())
|
{
|
||||||
{
|
if (!IsShown())
|
||||||
case ID_MAIN_X_TEXT:
|
return;
|
||||||
slider = wx_mainX_s;
|
|
||||||
v = &mainX;
|
// TODO: implement support for more controllers
|
||||||
break;
|
if (controllerID != 0)
|
||||||
|
return;
|
||||||
case ID_MAIN_Y_TEXT:
|
|
||||||
slider = wx_mainY_s;
|
PadStatus->stickX = mainX;
|
||||||
v = &mainY;
|
PadStatus->stickY = mainY;
|
||||||
break;
|
PadStatus->substickX = cX;
|
||||||
|
PadStatus->substickY = cY;
|
||||||
case ID_C_X_TEXT:
|
PadStatus->triggerLeft = lTrig;
|
||||||
slider = wx_cX_s;
|
PadStatus->triggerRight = rTrig;
|
||||||
v = &cX;
|
|
||||||
break;
|
if(wx_up_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_BUTTON_UP;
|
||||||
case ID_C_Y_TEXT:
|
else
|
||||||
slider = wx_cY_s;
|
PadStatus->button &= ~PAD_BUTTON_UP;
|
||||||
v = &cY;
|
|
||||||
break;
|
if(wx_down_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_BUTTON_DOWN;
|
||||||
case ID_L_TEXT:
|
else
|
||||||
slider = wx_l_s;
|
PadStatus->button &= ~PAD_BUTTON_DOWN;
|
||||||
v = &lTrig;
|
|
||||||
break;
|
if(wx_left_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_BUTTON_LEFT;
|
||||||
case ID_R_TEXT:
|
else
|
||||||
slider = wx_r_s;
|
PadStatus->button &= ~PAD_BUTTON_LEFT;
|
||||||
v = &rTrig;
|
|
||||||
break;
|
if(wx_right_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_BUTTON_RIGHT;
|
||||||
default:
|
else
|
||||||
return;
|
PadStatus->button &= ~PAD_BUTTON_RIGHT;
|
||||||
}
|
|
||||||
|
if(wx_a_button->IsChecked())
|
||||||
unsigned long value;
|
{
|
||||||
|
PadStatus->button |= PAD_BUTTON_A;
|
||||||
if (((wxTextCtrl *) event.GetEventObject())->GetValue().ToULong(&value))
|
PadStatus->analogA = 0xFF;
|
||||||
{
|
}
|
||||||
*v = (u8) (value > 255 ? 255 : value);
|
else
|
||||||
slider->SetValue(*v);
|
{
|
||||||
}
|
PadStatus->button &= ~PAD_BUTTON_A;
|
||||||
}
|
PadStatus->analogA = 0x00;
|
||||||
|
}
|
||||||
void TASInputDlg::OnCloseWindow(wxCloseEvent& event)
|
|
||||||
{
|
if(wx_b_button->IsChecked())
|
||||||
if (event.CanVeto())
|
{
|
||||||
{
|
PadStatus->button |= PAD_BUTTON_B;
|
||||||
event.Skip(false);
|
PadStatus->analogB = 0xFF;
|
||||||
this->Show(false);
|
}
|
||||||
ResetValues();
|
else
|
||||||
}
|
{
|
||||||
}
|
PadStatus->button &= ~PAD_BUTTON_B;
|
||||||
|
PadStatus->analogB = 0x00;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(wx_x_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_BUTTON_X;
|
||||||
|
else
|
||||||
|
PadStatus->button &= ~PAD_BUTTON_X;
|
||||||
|
|
||||||
|
if(wx_y_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_BUTTON_Y;
|
||||||
|
else
|
||||||
|
PadStatus->button &= ~PAD_BUTTON_Y;
|
||||||
|
|
||||||
|
if(wx_l_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_TRIGGER_L;
|
||||||
|
else
|
||||||
|
PadStatus->button &= ~PAD_TRIGGER_L;
|
||||||
|
|
||||||
|
if(wx_r_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_TRIGGER_R;
|
||||||
|
else
|
||||||
|
PadStatus->button &= ~PAD_TRIGGER_R;
|
||||||
|
|
||||||
|
if(wx_z_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_TRIGGER_Z;
|
||||||
|
else
|
||||||
|
PadStatus->button &= ~PAD_TRIGGER_Z;
|
||||||
|
|
||||||
|
if(wx_start_button->IsChecked())
|
||||||
|
PadStatus->button |= PAD_BUTTON_START;
|
||||||
|
else
|
||||||
|
PadStatus->button &= ~PAD_BUTTON_START;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TASInputDlg::UpdateFromSliders(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
wxTextCtrl *text;
|
||||||
|
u8 *v;
|
||||||
|
|
||||||
|
switch(event.GetId())
|
||||||
|
{
|
||||||
|
case ID_MAIN_X_SLIDER:
|
||||||
|
text = wx_mainX_t;
|
||||||
|
v = &mainX;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_MAIN_Y_SLIDER:
|
||||||
|
text = wx_mainY_t;
|
||||||
|
v = &mainY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_C_X_SLIDER:
|
||||||
|
text = wx_cX_t;
|
||||||
|
v = &cX;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_C_Y_SLIDER:
|
||||||
|
text = wx_cY_t;
|
||||||
|
v = &cY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_L_SLIDER:
|
||||||
|
text = wx_l_t;
|
||||||
|
v = &lTrig;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_R_SLIDER:
|
||||||
|
text = wx_r_t;
|
||||||
|
v = &rTrig;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int value = ((wxSlider *) event.GetEventObject())->GetValue();
|
||||||
|
*v = (u8) value;
|
||||||
|
text->SetValue(wxString::Format(wxT("%i"), value));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TASInputDlg::UpdateFromText(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
wxSlider *slider;
|
||||||
|
u8 *v;
|
||||||
|
|
||||||
|
switch(event.GetId())
|
||||||
|
{
|
||||||
|
case ID_MAIN_X_TEXT:
|
||||||
|
slider = wx_mainX_s;
|
||||||
|
v = &mainX;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_MAIN_Y_TEXT:
|
||||||
|
slider = wx_mainY_s;
|
||||||
|
v = &mainY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_C_X_TEXT:
|
||||||
|
slider = wx_cX_s;
|
||||||
|
v = &cX;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_C_Y_TEXT:
|
||||||
|
slider = wx_cY_s;
|
||||||
|
v = &cY;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_L_TEXT:
|
||||||
|
slider = wx_l_s;
|
||||||
|
v = &lTrig;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_R_TEXT:
|
||||||
|
slider = wx_r_s;
|
||||||
|
v = &rTrig;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long value;
|
||||||
|
|
||||||
|
if (((wxTextCtrl *) event.GetEventObject())->GetValue().ToULong(&value))
|
||||||
|
{
|
||||||
|
*v = (u8) (value > 255 ? 255 : value);
|
||||||
|
slider->SetValue(*v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TASInputDlg::OnCloseWindow(wxCloseEvent& event)
|
||||||
|
{
|
||||||
|
if (event.CanVeto())
|
||||||
|
{
|
||||||
|
event.Skip(false);
|
||||||
|
this->Show(false);
|
||||||
|
ResetValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,69 +1,82 @@
|
|||||||
// Copyright (C) 2011 Dolphin Project.
|
// Copyright (C) 2011 Dolphin Project.
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU General Public License as published by
|
||||||
// the Free Software Foundation, version 2.0.
|
// the Free Software Foundation, version 2.0.
|
||||||
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License 2.0 for more details.
|
// GNU General Public License 2.0 for more details.
|
||||||
|
|
||||||
// A copy of the GPL 2.0 should have been included with the program.
|
// A copy of the GPL 2.0 should have been included with the program.
|
||||||
// If not, see http://www.gnu.org/licenses/
|
// If not, see http://www.gnu.org/licenses/
|
||||||
|
|
||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#ifndef __TASINPUT_H__
|
#ifndef __TASINPUT_H__
|
||||||
#define __TASINPUT_H__
|
#define __TASINPUT_H__
|
||||||
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "CoreParameter.h"
|
#include "CoreParameter.h"
|
||||||
#include "../../InputCommon/Src/GCPadStatus.h"
|
#include "../../InputCommon/Src/GCPadStatus.h"
|
||||||
|
|
||||||
class TASInputDlg : public wxDialog
|
class TASInputDlg : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TASInputDlg(wxWindow *parent,
|
TASInputDlg(wxWindow *parent,
|
||||||
wxWindowID id = 1,
|
wxWindowID id = 1,
|
||||||
const wxString &title = _("TAS Input"),
|
const wxString &title = _("TAS Input"),
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP);
|
long style = wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP);
|
||||||
|
|
||||||
void OnCloseWindow(wxCloseEvent& event);
|
void OnCloseWindow(wxCloseEvent& event);
|
||||||
void UpdateFromSliders(wxCommandEvent& event);
|
void UpdateFromSliders(wxCommandEvent& event);
|
||||||
void UpdateFromText(wxCommandEvent& event);
|
void UpdateFromText(wxCommandEvent& event);
|
||||||
void ResetValues();
|
void ResetValues();
|
||||||
void GetValues(SPADStatus *PadStatus, int controllerID);
|
void GetValues(SPADStatus *PadStatus, int controllerID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u8 mainX, mainY, cX, cY, lTrig, rTrig;
|
u8 mainX, mainY, cX, cY, lTrig, rTrig;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ID_MAIN_X_SLIDER = 1000,
|
ID_MAIN_X_SLIDER = 1000,
|
||||||
ID_MAIN_X_TEXT,
|
ID_MAIN_X_TEXT,
|
||||||
ID_MAIN_Y_SLIDER,
|
ID_MAIN_Y_SLIDER,
|
||||||
ID_MAIN_Y_TEXT,
|
ID_MAIN_Y_TEXT,
|
||||||
ID_C_X_SLIDER,
|
ID_C_X_SLIDER,
|
||||||
ID_C_X_TEXT,
|
ID_C_X_TEXT,
|
||||||
ID_C_Y_SLIDER,
|
ID_C_Y_SLIDER,
|
||||||
ID_C_Y_TEXT,
|
ID_C_Y_TEXT,
|
||||||
ID_L_SLIDER,
|
ID_L_SLIDER,
|
||||||
ID_L_TEXT,
|
ID_L_TEXT,
|
||||||
ID_R_SLIDER,
|
ID_R_SLIDER,
|
||||||
ID_R_TEXT,
|
ID_R_TEXT,
|
||||||
ID_CLOSE,
|
ID_CLOSE,
|
||||||
};
|
ID_UP,
|
||||||
|
ID_DOWN,
|
||||||
wxSlider *wx_mainX_s, *wx_mainY_s, *wx_cX_s, *wx_cY_s, *wx_l_s, *wx_r_s;
|
ID_LEFT,
|
||||||
wxTextCtrl *wx_mainX_t, *wx_mainY_t, *wx_cX_t, *wx_cY_t, *wx_l_t, *wx_r_t;
|
ID_RIGHT,
|
||||||
|
ID_A,
|
||||||
DECLARE_EVENT_TABLE();
|
ID_B,
|
||||||
};
|
ID_X,
|
||||||
#endif
|
ID_Y,
|
||||||
|
ID_Z,
|
||||||
|
ID_L,
|
||||||
|
ID_R,
|
||||||
|
ID_START,
|
||||||
|
};
|
||||||
|
|
||||||
|
wxSlider *wx_mainX_s, *wx_mainY_s, *wx_cX_s, *wx_cY_s, *wx_l_s, *wx_r_s;
|
||||||
|
wxCheckBox *wx_up_button, *wx_down_button, *wx_left_button, *wx_right_button, *wx_a_button, *wx_b_button, *wx_x_button, *wx_y_button, *wx_l_button, *wx_r_button, *wx_z_button, *wx_start_button;
|
||||||
|
wxTextCtrl *wx_mainX_t, *wx_mainY_t, *wx_cX_t, *wx_cY_t, *wx_l_t, *wx_r_t;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE();
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user