From 9fdc7360cdeb89779994af845f53ab26c9a465bd Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Tue, 23 Jul 2013 19:24:05 -0400 Subject: [PATCH] Fix L and R triggers with tas input. Partially copied from revision 1be844406c02, but allows < fully pressed, and without the typo. --- Source/Core/DolphinWX/Src/TASInputDlg.cpp | 62 +++++++++++++++++------ Source/Core/DolphinWX/Src/TASInputDlg.h | 3 +- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/Source/Core/DolphinWX/Src/TASInputDlg.cpp b/Source/Core/DolphinWX/Src/TASInputDlg.cpp index 5bc24f3262..2030965e8b 100644 --- a/Source/Core/DolphinWX/Src/TASInputDlg.cpp +++ b/Source/Core/DolphinWX/Src/TASInputDlg.cpp @@ -31,7 +31,7 @@ TASInputDlg::TASInputDlg(wxWindow *parent, wxWindowID id, const wxString &title, { A_turbo = B_turbo = X_turbo = Y_turbo = Z_turbo = L_turbo = R_turbo = START_turbo = DL_turbo = DR_turbo = DD_turbo = DU_turbo = false; xaxis = yaxis = c_xaxis = c_yaxis = 128; - A_cont = B_cont = X_cont = Y_cont = Z_cont = L_cont = R_cont = START_cont = DL_cont = DR_cont = DD_cont = DU_cont = mstickx = msticky = cstickx = csticky = false; + A_cont = B_cont = X_cont = Y_cont = Z_cont = L_cont = L_button_cont = R_cont = R_button_cont = START_cont = DL_cont = DR_cont = DD_cont = DU_cont = mstickx = msticky = cstickx = csticky = false; wxBoxSizer* const top_box = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* const bottom_box = new wxBoxSizer(wxHORIZONTAL); @@ -364,25 +364,53 @@ void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus) Y_cont = false; } - if(((PadStatus->button & PAD_TRIGGER_L) != 0)) + if(((PadStatus->triggerLeft) != 0)) { - wx_l_button->SetValue(true); + if (PadStatus->triggerLeft == 255) + { + wx_l_button->SetValue(true); + L_button_cont = true; + } + else if (L_slider_cont) + { + wx_l_button->SetValue(false); + L_button_cont = false; + } + + wx_l_s->SetValue(PadStatus->triggerLeft); + wx_l_t->SetValue(wxString::Format(wxT("%i"), PadStatus->triggerLeft)); L_cont = true; } else if(L_cont) { wx_l_button->SetValue(false); + wx_l_s->SetValue(0); + wx_l_t->SetValue(wxT("0")); L_cont = false; } - if(((PadStatus->button & PAD_TRIGGER_R) != 0)) + if(((PadStatus->triggerRight) != 0)) { - wx_r_button->SetValue(true); + if (PadStatus->triggerRight == 255) + { + wx_r_button->SetValue(true); + R_button_cont = true; + } + else if (R_button_cont) + { + wx_r_button->SetValue(false); + R_button_cont = false; + } + + wx_r_s->SetValue(PadStatus->triggerRight); + wx_r_t->SetValue(wxString::Format(wxT("%i"), PadStatus->triggerRight)); R_cont = true; } else if(R_cont) { wx_r_button->SetValue(false); + wx_r_s->SetValue(0); + wx_r_t->SetValue(wxT("0")); R_cont = false; } @@ -409,6 +437,19 @@ void TASInputDlg::GetKeyBoardInput(SPADStatus *PadStatus) } } +void TASInputDlg::SetLandRTriggers() +{ + if (wx_l_button->GetValue()) + lTrig = 255; + else + lTrig = wx_l_s->GetValue(); + + if (wx_r_button->GetValue()) + rTrig = 255; + else + rTrig = wx_r_s->GetValue(); +} + void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID) { if (!IsShown()) @@ -416,6 +457,7 @@ void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID) //TODO:: Make this instant not when polled. GetKeyBoardInput(PadStatus); + SetLandRTriggers(); // TODO: implement support for more controllers if (controllerID != 0) @@ -480,16 +522,6 @@ void TASInputDlg::GetValues(SPADStatus *PadStatus, int controllerID) 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 diff --git a/Source/Core/DolphinWX/Src/TASInputDlg.h b/Source/Core/DolphinWX/Src/TASInputDlg.h index 28b3391463..46f2d50405 100644 --- a/Source/Core/DolphinWX/Src/TASInputDlg.h +++ b/Source/Core/DolphinWX/Src/TASInputDlg.h @@ -33,6 +33,7 @@ class TASInputDlg : public wxDialog void ButtonTurbo(); void GetKeyBoardInput(SPADStatus *PadStatus); bool TextBoxHasFocus(); + void SetLandRTriggers(); bool HasFocus(); wxBitmap CreateStickBitmap(int x, int y); @@ -78,7 +79,7 @@ class TASInputDlg : public wxDialog wxStaticBitmap* static_bitmap_main, *static_bitmap_c; wxBitmap bitmap; bool A_turbo,B_turbo, X_turbo, Y_turbo, Z_turbo, L_turbo, R_turbo, START_turbo,DL_turbo,DR_turbo,DD_turbo,DU_turbo; - bool A_cont,B_cont, X_cont, Y_cont, Z_cont, L_cont, R_cont, START_cont,DL_cont,DR_cont,DD_cont,DU_cont,mstickx,msticky,cstickx,csticky; + bool A_cont,B_cont, X_cont, Y_cont, Z_cont, L_cont, L_button_cont, R_cont, R_button_cont, START_cont,DL_cont,DR_cont,DD_cont,DU_cont,mstickx,msticky,cstickx,csticky; int xaxis,yaxis,c_xaxis,c_yaxis,update,update_axis; DECLARE_EVENT_TABLE();