Emulated Wiimote: Added the pitch left and pitch right keyboard input to the GUI

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2275 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-02-16 09:25:22 +00:00
parent 9afd7fb620
commit a92444d3cc
6 changed files with 37 additions and 11 deletions

View File

@ -182,6 +182,7 @@ struct PadWiimote
int H;
int L, R, U, D;
int Shake;
int PitchL, PitchR;
};
struct PadNunchuck
{

View File

@ -60,6 +60,7 @@ void Config::Load(bool ChangePad)
WmP = 80, WmM = 77, WmH = 72,
WmL = 37, WmR = 39, WmU = 38, WmD = 40, // Regular directional keys
WmShake = 83, // S
WmPitchL = 51, WmPitchR = 52, // 3 and 4
NcZ = 90, NcC = 67,
NcL = 100, NcR = 102, NcU = 104, NcD = 101, // Numpad
@ -70,6 +71,7 @@ void Config::Load(bool ChangePad)
WmP = 0, WmM = 0, WmH = 0,
WmL = 0, WmR = 0, WmU = 0, WmD = 0,
WmShake = 0,
WmPitchL = 0, WmPitchR = 0,
NcZ = 0, NcC = 0, NcL = 0, NcR = 0, NcU = 0, NcD = 0,
NcShake = 0;
@ -99,6 +101,8 @@ void Config::Load(bool ChangePad)
iniFile.Get(SectionName.c_str(), "WmU", &WiiMoteEmu::PadMapping[i].Wm.U, WmU);
iniFile.Get(SectionName.c_str(), "WmD", &WiiMoteEmu::PadMapping[i].Wm.D, WmD);
iniFile.Get(SectionName.c_str(), "WmShake", &WiiMoteEmu::PadMapping[i].Wm.Shake, WmShake);
iniFile.Get(SectionName.c_str(), "WmPitchL", &WiiMoteEmu::PadMapping[i].Wm.PitchL, WmPitchL);
iniFile.Get(SectionName.c_str(), "WmPitchR", &WiiMoteEmu::PadMapping[i].Wm.PitchR, WmPitchR);
// Nunchuck
iniFile.Get(SectionName.c_str(), "NunchuckStick", &Nunchuck.Type, Nunchuck.KEYBOARD);
@ -197,6 +201,8 @@ void Config::Save(int Slot)
iniFile.Set(SectionName.c_str(), "WmU", WiiMoteEmu::PadMapping[i].Wm.U);
iniFile.Set(SectionName.c_str(), "WmD", WiiMoteEmu::PadMapping[i].Wm.D);
iniFile.Set(SectionName.c_str(), "WmShake", WiiMoteEmu::PadMapping[i].Wm.Shake);
iniFile.Set(SectionName.c_str(), "WmPitchL", WiiMoteEmu::PadMapping[i].Wm.PitchL);
iniFile.Set(SectionName.c_str(), "WmPitchR", WiiMoteEmu::PadMapping[i].Wm.PitchR);
// Nunchuck
iniFile.Set(SectionName.c_str(), "NunchuckStick", Nunchuck.Type);

View File

@ -121,7 +121,8 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_BUTTON(IDB_WM_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_R, ConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_U, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_D, ConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_SHAKE, ConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_WM_PITCH_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_WM_PITCH_R, ConfigDialog::OnButtonClick)
// Nunchuck
EVT_BUTTON(IDB_NC_Z, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_C, ConfigDialog::OnButtonClick)
EVT_BUTTON(IDB_NC_L, ConfigDialog::OnButtonClick) EVT_BUTTON(IDB_NC_R, ConfigDialog::OnButtonClick)
@ -923,6 +924,8 @@ void ConfigDialog::CreateGUIControls()
m_tWmU[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Up"));
m_tWmD[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Down"));
m_tWmShake[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Shake"));
m_tWmPitchL[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Pitch Left"));
m_tWmPitchR[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Pitch Right"));
m_bWmA[i] = new wxButton(m_Controller[i], IDB_WM_A, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH));
m_bWmB[i] = new wxButton(m_Controller[i], IDB_WM_B, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH));
@ -936,7 +939,9 @@ void ConfigDialog::CreateGUIControls()
m_bWmU[i] = new wxButton(m_Controller[i], IDB_WM_U, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH));
m_bWmD[i] = new wxButton(m_Controller[i], IDB_WM_D, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH));
m_bWmShake[i] = new wxButton(m_Controller[i], IDB_WM_SHAKE, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH));
m_bWmPitchL[i] = new wxButton(m_Controller[i], IDB_WM_PITCH_L, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH));
m_bWmPitchR[i] = new wxButton(m_Controller[i], IDB_WM_PITCH_R, wxEmptyString, wxDefaultPosition, wxSize(BtW, BtH));
// Set small font
m_bWmA[i]->SetFont(m_SmallFont); m_bWmB[i]->SetFont(m_SmallFont);
m_bWm1[i]->SetFont(m_SmallFont); m_bWm2[i]->SetFont(m_SmallFont);
@ -944,7 +949,8 @@ void ConfigDialog::CreateGUIControls()
m_bWmL[i]->SetFont(m_SmallFont); m_bWmR[i]->SetFont(m_SmallFont);
m_bWmU[i]->SetFont(m_SmallFont); m_bWmD[i]->SetFont(m_SmallFont);
m_bWmShake[i]->SetFont(m_SmallFont);
m_bWmPitchL[i]->SetFont(m_SmallFont); m_bWmPitchR[i]->SetFont(m_SmallFont);
// Sizers
m_SWmVertLeft[i] = new wxBoxSizer(wxVERTICAL); m_SWmVertRight[i] = new wxBoxSizer(wxVERTICAL);
m_SWmA[i] = new wxBoxSizer(wxHORIZONTAL); m_SWmB[i] = new wxBoxSizer(wxHORIZONTAL);
@ -953,6 +959,7 @@ void ConfigDialog::CreateGUIControls()
m_SWmL[i] = new wxBoxSizer(wxHORIZONTAL); m_SWmR[i] = new wxBoxSizer(wxHORIZONTAL);
m_SWmU[i] = new wxBoxSizer(wxHORIZONTAL); m_SWmD[i] = new wxBoxSizer(wxHORIZONTAL);
m_SWmShake[i] = new wxBoxSizer(wxHORIZONTAL);
m_SWmPitchL[i] = new wxBoxSizer(wxHORIZONTAL); m_SWmPitchR[i] = new wxBoxSizer(wxHORIZONTAL);
m_SWmA[i]->Add(m_tWmA[i], 0, (wxUP), 4); m_SWmA[i]->Add(m_bWmA[i], 0, (wxLEFT), 2);
m_SWmB[i]->Add(m_tWmB[i], 0, (wxUP), 4); m_SWmB[i]->Add(m_bWmB[i], 0, (wxLEFT), 2);
@ -966,6 +973,8 @@ void ConfigDialog::CreateGUIControls()
m_SWmU[i]->Add(m_tWmU[i], 0, (wxUP), 4); m_SWmU[i]->Add(m_bWmU[i], 0, (wxLEFT), 2);
m_SWmD[i]->Add(m_tWmD[i], 0, (wxUP), 4); m_SWmD[i]->Add(m_bWmD[i], 0, (wxLEFT), 2);
m_SWmShake[i]->Add(m_tWmShake[i], 0, (wxUP), 4); m_SWmShake[i]->Add(m_bWmShake[i], 0, (wxLEFT), 2);
m_SWmPitchL[i]->Add(m_tWmPitchL[i], 0, (wxUP), 4); m_SWmPitchL[i]->Add(m_bWmPitchL[i], 0, (wxLEFT), 2);
m_SWmPitchR[i]->Add(m_tWmPitchR[i], 0, (wxUP), 4); m_SWmPitchR[i]->Add(m_bWmPitchR[i], 0, (wxLEFT), 2);
m_SWmVertLeft[i]->Add(m_SWmA[i], 0, wxALIGN_RIGHT | (wxALL), 1);
m_SWmVertLeft[i]->Add(m_SWmB[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1);
@ -976,6 +985,10 @@ void ConfigDialog::CreateGUIControls()
m_SWmVertLeft[i]->Add(m_SWmH[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1);
m_SWmVertRight[i]->Add(m_SWmShake[i], 0, wxALIGN_RIGHT | (wxALL), 1);
//m_SWmVertRight[i]->AddSpacer(3);
m_SWmVertRight[i]->Add(m_SWmPitchL[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1);
m_SWmVertRight[i]->Add(m_SWmPitchR[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1);
//m_SWmVertRight[i]->AddSpacer(3);
m_SWmVertRight[i]->Add(m_SWmL[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1);
m_SWmVertRight[i]->Add(m_SWmR[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1);
m_SWmVertRight[i]->Add(m_SWmU[i], 0, wxALIGN_RIGHT | (wxLEFT | wxRIGHT | wxDOWN), 1);

View File

@ -93,7 +93,7 @@ class ConfigDialog : public wxDialog
// Nunchuck
*m_SNcShake[4], *m_SNcZ[4], *m_SNcC[4], *m_SNcL[4], *m_SNcR[4], *m_SNcU[4], *m_SNcD[4],
// Wiimote
*m_SWmVertLeft[4], *m_SWmVertRight[4], *m_SWmShake[4], *m_SWmA[4], *m_SWmB[4], *m_SWm1[4], *m_SWm2[4], *m_SWmP[4], *m_SWmM[4], *m_SWmH[4], *m_SWmL[4], *m_SWmR[4], *m_SWmU[4], *m_SWmD[4],
*m_SWmVertLeft[4], *m_SWmVertRight[4], *m_SWmShake[4], *m_SWmPitchL[4], *m_SWmPitchR[4], *m_SWmA[4], *m_SWmB[4], *m_SWm1[4], *m_SWm2[4], *m_SWmP[4], *m_SWmM[4], *m_SWmH[4], *m_SWmL[4], *m_SWmR[4], *m_SWmU[4], *m_SWmD[4],
*m_HorizControllerMapping[4], *m_NunchuckStick[4];
wxGridBagSizer *m_SizeAnalogTriggerHorizConfig[4], *m_SizeAnalogTriggerStatusBox[4], *m_TiltGrid[4],
*m_GridLeftStick[4], *m_GridRightStick[4];
@ -105,7 +105,7 @@ class ConfigDialog : public wxDialog
// Nunchuck
*m_bNcShake[4], *m_bNcZ[4], *m_bNcC[4], *m_bNcL[4], *m_bNcR[4], *m_bNcU[4], *m_bNcD[4],
// Wiimote
*m_bWmShake[4], *m_bWmA[4], *m_bWmB[4], *m_bWm1[4], *m_bWm2[4], *m_bWmP[4], *m_bWmM[4], *m_bWmH[4], *m_bWmD[4], *m_bWmU[4], *m_bWmR[4], *m_bWmL[4];
*m_bWmShake[4], *m_bWmPitchL[4], *m_bWmPitchR[4], *m_bWmA[4], *m_bWmB[4], *m_bWm1[4], *m_bWm2[4], *m_bWmP[4], *m_bWmM[4], *m_bWmH[4], *m_bWmD[4], *m_bWmU[4], *m_bWmR[4], *m_bWmL[4];
wxStaticText *m_tAnalogX[8], *m_tAnalogY[8], *m_TiltTextRoll[4], *m_TiltTextPitch[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],
@ -113,7 +113,7 @@ class ConfigDialog : public wxDialog
// Nunchuck
*m_tNcShake[4], *m_tNcZ[4], *m_tNcC[4], *m_tNcL[4], *m_tNcR[4], *m_tNcU[4], *m_tNcD[4],
// Wiimote
*m_tWmShake[4], *m_tWmA[4], *m_tWmB[4], *m_tWm1[4], *m_tWm2[4], *m_tWmP[4], *m_tWmM[4], *m_tWmH[4], *m_tWmL[4], *m_tWmR[4], *m_tWmU[4],*m_tWmD[4],
*m_tWmShake[4], *m_tWmPitchL[4], *m_tWmPitchR[4], *m_tWmA[4], *m_tWmB[4], *m_tWm1[4], *m_tWm2[4], *m_tWmP[4], *m_tWmM[4], *m_tWmH[4], *m_tWmL[4], *m_tWmR[4], *m_tWmU[4],*m_tWmD[4],
*m_NunchuckTextStick[5];
wxButton *ClickedButton;
wxString OldLabel;
@ -187,7 +187,7 @@ class ConfigDialog : public wxDialog
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,
IDB_WM_SHAKE,
IDB_WM_SHAKE, IDB_WM_PITCH_L, IDB_WM_PITCH_R,
// Nunchuck
IDB_NC_Z, IDB_NC_C, IDB_NC_L, IDB_NC_R, IDB_NC_U, IDB_NC_D,

View File

@ -172,6 +172,8 @@ void ConfigDialog::UpdateGUIButtonMapping(int controller)
m_bWmU[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.U).c_str()));
m_bWmD[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.D).c_str()));
m_bWmShake[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.Shake).c_str()));
m_bWmPitchL[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.PitchL).c_str()));
m_bWmPitchR[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.PitchR).c_str()));
// Nunchuck
m_bNcZ[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Nc.Z).c_str()));
@ -249,6 +251,8 @@ void ConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
case IDB_WM_U: WiiMoteEmu::PadMapping[Controller].Wm.U = Key; break;
case IDB_WM_D: WiiMoteEmu::PadMapping[Controller].Wm.D = Key; break;
case IDB_WM_SHAKE: WiiMoteEmu::PadMapping[Controller].Wm.Shake = Key; break;
case IDB_WM_PITCH_L: WiiMoteEmu::PadMapping[Controller].Wm.PitchL = Key; break;
case IDB_WM_PITCH_R: WiiMoteEmu::PadMapping[Controller].Wm.PitchR = Key; break;
// Nunchuck
case IDB_NC_Z: WiiMoteEmu::PadMapping[Controller].Nc.Z = Key; break;
@ -323,6 +327,8 @@ void ConfigDialog::SetButtonText(int id, char text[128], int _Page)
case IDB_WM_U: m_bWmU[controller]->SetLabel(wxString::FromAscii(text)); break;
case IDB_WM_D: m_bWmD[controller]->SetLabel(wxString::FromAscii(text)); break;
case IDB_WM_SHAKE: m_bWmShake[controller]->SetLabel(wxString::FromAscii(text)); break;
case IDB_WM_PITCH_L: m_bWmPitchL[controller]->SetLabel(wxString::FromAscii(text)); break;
case IDB_WM_PITCH_R: m_bWmPitchR[controller]->SetLabel(wxString::FromAscii(text)); break;
// Nunchuck
case IDB_NC_Z: m_bNcZ[controller]->SetLabel(wxString::FromAscii(text)); break;

View File

@ -272,8 +272,8 @@ int IsKey(int Key)
case g_Wm.R: return GetAsyncKeyState(PadMapping[0].Wm.R);
case g_Wm.U: return GetAsyncKeyState(PadMapping[0].Wm.U);
case g_Wm.D: return GetAsyncKeyState(PadMapping[0].Wm.D);
case g_Wm.PITCH_L: return GetAsyncKeyState('3');
case g_Wm.PITCH_R: return GetAsyncKeyState('4');
case g_Wm.PITCH_L: return GetAsyncKeyState(PadMapping[0].Wm.PitchL);
case g_Wm.PITCH_R: return GetAsyncKeyState(PadMapping[0].Wm.PitchR);
case g_Wm.SHAKE: return GetAsyncKeyState(PadMapping[0].Wm.Shake);
// Nunchuck
@ -512,13 +512,13 @@ void TiltWiimoteKeyboard(float &Roll, float &Pitch)
if(IsKey(g_Wm.PITCH_L))
{
// Stop at the upper end of the range
if(KbDegree < g_Config.Trigger.Range.Roll)
if(KbDegree < g_Config.Trigger.Range.Pitch)
KbDegree += 3; // aim left
}
else if(IsKey(g_Wm.PITCH_R))
{
// Stop at the lower end of the range
if(KbDegree > -g_Config.Trigger.Range.Roll)
if(KbDegree > -g_Config.Trigger.Range.Pitch)
KbDegree -= 3; // aim right
}