nJoy: Allow the same settings for the C-stick

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3722 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-07-09 07:58:36 +00:00
parent 722ee4cd06
commit 8d42378479
7 changed files with 154 additions and 74 deletions

View File

@ -90,8 +90,8 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING
int ID; // SDL joystick device ID int ID; // SDL joystick device ID
int controllertype; // Hat: Hat or custom buttons int controllertype; // Hat: Hat or custom buttons
int triggertype; // Triggers range int triggertype; // Triggers range
std::string SRadius, SDiagonal; std::string SRadius, SDiagonal, SRadiusC, SDiagonalC;
bool bRadiusOnOff, bSquareToCircle; bool bRadiusOnOff, bSquareToCircle, bRadiusOnOffC, bSquareToCircleC;
bool rumble; bool rumble;
int eventnum; // Linux Event Number, Can't be found dynamically yet int eventnum; // Linux Event Number, Can't be found dynamically yet
}; };

View File

@ -178,6 +178,10 @@ void Config::Save(int Slot)
file.Set(SectionName.c_str(), "RadiusOnOff", PadMapping[i].bRadiusOnOff); file.Set(SectionName.c_str(), "RadiusOnOff", PadMapping[i].bRadiusOnOff);
file.Set(SectionName.c_str(), "Diagonal", PadMapping[i].SDiagonal); file.Set(SectionName.c_str(), "Diagonal", PadMapping[i].SDiagonal);
file.Set(SectionName.c_str(), "SquareToCircle", PadMapping[i].bSquareToCircle); file.Set(SectionName.c_str(), "SquareToCircle", PadMapping[i].bSquareToCircle);
file.Set(SectionName.c_str(), "RadiusC", PadMapping[i].SRadiusC);
file.Set(SectionName.c_str(), "RadiusOnOffC", PadMapping[i].bRadiusOnOffC);
file.Set(SectionName.c_str(), "DiagonalC", PadMapping[i].SDiagonalC);
file.Set(SectionName.c_str(), "SquareToCircleC", PadMapping[i].bSquareToCircleC);
// ====================================== // ======================================
// Debugging // Debugging
@ -274,6 +278,10 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID)
file.Get(SectionName.c_str(), "RadiusOnOff", &Tmp, false); PadMapping[i].bRadiusOnOff = Tmp; file.Get(SectionName.c_str(), "RadiusOnOff", &Tmp, false); PadMapping[i].bRadiusOnOff = Tmp;
file.Get(SectionName.c_str(), "Diagonal", &PadMapping[i].SDiagonal, "100%"); file.Get(SectionName.c_str(), "Diagonal", &PadMapping[i].SDiagonal, "100%");
file.Get(SectionName.c_str(), "SquareToCircle", &Tmp, false); PadMapping[i].bSquareToCircle = Tmp; file.Get(SectionName.c_str(), "SquareToCircle", &Tmp, false); PadMapping[i].bSquareToCircle = Tmp;
file.Get(SectionName.c_str(), "RadiusC", &PadMapping[i].SRadiusC, "100%");
file.Get(SectionName.c_str(), "RadiusOnOffC", &Tmp, false); PadMapping[i].bRadiusOnOffC = Tmp;
file.Get(SectionName.c_str(), "DiagonalC", &PadMapping[i].SDiagonalC, "100%");
file.Get(SectionName.c_str(), "SquareToCircleC", &Tmp, false); PadMapping[i].bSquareToCircleC = Tmp;
// ============================= // =============================
// Debugging // Debugging

View File

@ -52,8 +52,8 @@ void PADConfigDialognJoy::PadGetStatus()
because of a manual ini file change, but we make that check anway. */ because of a manual ini file change, but we make that check anway. */
if(PadMapping[notebookpage].ID < 0 || PadMapping[notebookpage].ID >= SDL_NumJoysticks()) if(PadMapping[notebookpage].ID < 0 || PadMapping[notebookpage].ID >= SDL_NumJoysticks())
{ {
m_TStatusIn[notebookpage]->SetLabel(wxT("Not connected")); m_TStatusIn[notebookpage]->SetLabel(wxT("Not connected")); m_TStatusOut[notebookpage]->SetLabel(wxT("Not connected"));
m_TStatusOut[notebookpage]->SetLabel(wxT("Not connected")); m_TStatusInC[notebookpage]->SetLabel(wxT("Not connected")); m_TStatusOutC[notebookpage]->SetLabel(wxT("Not connected"));
m_TStatusTriggers[notebookpage]->SetLabel(wxT("Not connected")); m_TStatusTriggers[notebookpage]->SetLabel(wxT("Not connected"));
return; return;
} }
@ -61,8 +61,8 @@ void PADConfigDialognJoy::PadGetStatus()
// Return if it's not enabled // Return if it's not enabled
if (!PadMapping[notebookpage].enabled) if (!PadMapping[notebookpage].enabled)
{ {
m_TStatusIn[notebookpage]->SetLabel(wxT("Not enabled")); m_TStatusIn[notebookpage]->SetLabel(wxT("Not enabled")); m_TStatusOut[notebookpage]->SetLabel(wxT("Not enabled"));
m_TStatusOut[notebookpage]->SetLabel(wxT("Not enabled")); m_TStatusInC[notebookpage]->SetLabel(wxT("Not enabled")); m_TStatusOutC[notebookpage]->SetLabel(wxT("Not enabled"));
m_TStatusTriggers[notebookpage]->SetLabel(wxT("Not enabled")); m_TStatusTriggers[notebookpage]->SetLabel(wxT("Not enabled"));
return; return;
} }
@ -81,50 +81,52 @@ void PADConfigDialognJoy::PadGetStatus()
// Get original values // Get original values
int main_x = PadState[notebookpage].axis[InputCommon::CTL_MAIN_X]; int main_x = PadState[notebookpage].axis[InputCommon::CTL_MAIN_X];
int main_y = PadState[notebookpage].axis[InputCommon::CTL_MAIN_Y]; int main_y = PadState[notebookpage].axis[InputCommon::CTL_MAIN_Y];
//int sub_x = (PadState[_numPAD].axis[CTL_SUB_X]; int sub_x = PadState[notebookpage].axis[InputCommon::CTL_SUB_X];
//int sub_y = -(PadState[_numPAD].axis[CTL_SUB_Y]; int sub_y = PadState[notebookpage].axis[InputCommon::CTL_SUB_Y];
// Get adjusted values // Get adjusted values
int main_x_after = main_x, main_y_after = main_y; int main_x_after = main_x, main_y_after = main_y;
if(PadMapping[notebookpage].bSquareToCircle) if(PadMapping[notebookpage].bSquareToCircle) InputCommon::Square2Circle(main_x_after, main_y_after, notebookpage, PadMapping[notebookpage].SDiagonal);
{
InputCommon::Square2Circle(main_x_after, main_y_after, notebookpage, PadMapping[notebookpage].SDiagonal);
}
// Adjust radius // Adjust radius
if(PadMapping[notebookpage].bRadiusOnOff) if(PadMapping[notebookpage].bRadiusOnOff) InputCommon::RadiusAdjustment(main_x_after, main_y_after, notebookpage, PadMapping[notebookpage].SRadius);
{ // C-stick
// Get the manually configured diagonal distance int sub_x_after = sub_x, sub_y_after = sub_y;
InputCommon::RadiusAdjustment(main_x_after, main_y_after, notebookpage, PadMapping[notebookpage].SRadius); if(PadMapping[notebookpage].bSquareToCircleC) InputCommon::Square2Circle(sub_x_after, sub_y_after, notebookpage, PadMapping[notebookpage].SDiagonalC);
} if(PadMapping[notebookpage].bRadiusOnOffC) InputCommon::RadiusAdjustment(sub_x_after, sub_y_after, notebookpage, PadMapping[notebookpage].SRadiusC);
// // Convert values
float f_x = main_x / 32767.0; float f_x = main_x / 32767.0;
float f_y = main_y / 32767.0; float f_y = main_y / 32767.0;
float f_x_aft = main_x_after / 32767.0; float f_x_aft = main_x_after / 32767.0;
float f_y_aft = main_y_after / 32767.0; float f_y_aft = main_y_after / 32767.0;
// C-stick
m_TStatusIn[notebookpage]->SetLabel(wxString::Format( float f_x_c = sub_x / 32767.0;
wxT("x:%1.2f y:%1.2f"), float f_y_c = sub_y / 32767.0;
f_x, f_y float f_x_aft_c = sub_x_after / 32767.0;
)); float f_y_aft_c = sub_y_after / 32767.0;
// Print values
m_TStatusOut[notebookpage]->SetLabel(wxString::Format( m_TStatusIn[notebookpage]->SetLabel(wxString::Format(wxT("x:%1.2f y:%1.2f"), f_x, f_y));
wxT("x:%1.2f y:%1.2f"), m_TStatusOut[notebookpage]->SetLabel(wxString::Format(wxT("x:%1.2f y:%1.2f"), f_x_aft, f_y_aft));
f_x_aft, f_y_aft m_TStatusInC[notebookpage]->SetLabel(wxString::Format(wxT("x:%1.2f y:%1.2f"), f_x_c, f_y_c));
)); m_TStatusOutC[notebookpage]->SetLabel(wxString::Format(wxT("x:%1.2f y:%1.2f"), f_x_aft_c, f_y_aft_c));
// Adjust the values for the plot // Adjust the values for the plot
int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2; // Border adjustment // Border adjustment
int BoxW_ = BoxW - 2; int BoxH_ = BoxH - 2;
main_x = (BoxW_ / 2) + (main_x * BoxW_ / (32767 * 2)); main_x = (BoxW_ / 2) + (main_x * BoxW_ / (32767 * 2));
main_y = (BoxH_ / 2) + (main_y * BoxH_ / (32767 * 2)); main_y = (BoxH_ / 2) + (main_y * BoxH_ / (32767 * 2));
int main_x_out = (BoxW_ / 2) + (main_x_after * BoxW_ / (32767 * 2)); int main_x_out = (BoxW_ / 2) + (main_x_after * BoxW_ / (32767 * 2));
int main_y_out = (BoxH_ / 2) + (main_y_after * BoxH_ / (32767 * 2)); int main_y_out = (BoxH_ / 2) + (main_y_after * BoxH_ / (32767 * 2));
// Adjust the dot // Adjust the dot
m_bmpDot[notebookpage]->SetPosition(wxPoint(main_x, main_y)); m_bmpDot[notebookpage]->SetPosition(wxPoint(main_x, main_y));
m_bmpDotOut[notebookpage]->SetPosition(wxPoint(main_x_out, main_y_out)); m_bmpDotOut[notebookpage]->SetPosition(wxPoint(main_x_out, main_y_out));
// C-stick
sub_x = (BoxW_ / 2) + (sub_x * BoxW_ / (32767 * 2));
sub_y = (BoxH_ / 2) + (sub_y * BoxH_ / (32767 * 2));
int sub_x_out = (BoxW_ / 2) + (sub_x_after * BoxW_ / (32767 * 2));
int sub_y_out = (BoxH_ / 2) + (sub_y_after * BoxH_ / (32767 * 2));
m_bmpDotC[notebookpage]->SetPosition(wxPoint(sub_x, sub_y));
m_bmpDotOutC[notebookpage]->SetPosition(wxPoint(sub_x_out, sub_y_out));
///////////////////// Analog stick ///////////////////// Analog stick
@ -282,16 +284,21 @@ void PADConfigDialognJoy::Update()
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PADConfigDialognJoy::CreateAdvancedControls(int i) void PADConfigDialognJoy::CreateAdvancedControls(int i)
{ {
// Main-stick
m_TStatusIn[i] = new wxStaticText(m_Controller[i], IDT_STATUS_IN, wxT("In")); m_TStatusIn[i] = new wxStaticText(m_Controller[i], IDT_STATUS_IN, wxT("In"));
m_TStatusOut[i] = new wxStaticText(m_Controller[i], IDT_STATUS_OUT, wxT("Out")); m_TStatusOut[i] = new wxStaticText(m_Controller[i], IDT_STATUS_OUT, wxT("Out"));
m_gStatusIn[i] = new wxStaticBoxSizer( wxHORIZONTAL, m_Controller[i], wxT("Main-stick (In) (Out)")); m_gStatusIn[i] = new wxStaticBoxSizer( wxHORIZONTAL, m_Controller[i], wxT("Main-stick (In) (Out)"));
// C-stick
m_TStatusInC[i] = new wxStaticText(m_Controller[i], IDT_STATUS_IN, wxT("In"));
m_TStatusOutC[i] = new wxStaticText(m_Controller[i], IDT_STATUS_OUT, wxT("Out"));
m_gStatusInC[i] = new wxStaticBoxSizer( wxHORIZONTAL, m_Controller[i], wxT("C-stick (In) (Out)"));
// Main-stick In-Out
m_pInStatus[i] = new wxPanel(m_Controller[i], ID_INSTATUS1 + i, wxDefaultPosition, wxDefaultSize); m_pInStatus[i] = new wxPanel(m_Controller[i], ID_INSTATUS1 + i, wxDefaultPosition, wxDefaultSize);
m_bmpSquare[i] = new wxStaticBitmap(m_pInStatus[i], ID_STATUSBMP1 + i, CreateBitmap(), m_bmpSquare[i] = new wxStaticBitmap(m_pInStatus[i], ID_STATUSBMP1 + i, CreateBitmap(),
//wxPoint(4, 15), wxSize(70,70)); //wxPoint(4, 15), wxSize(70,70));
//wxPoint(4, 20), wxDefaultSize); //wxPoint(4, 20), wxDefaultSize);
wxDefaultPosition, wxDefaultSize); wxDefaultPosition, wxDefaultSize);
m_bmpDot[i] = new wxStaticBitmap(m_pInStatus[i], ID_STATUSDOTBMP1 + i, CreateBitmapDot(), m_bmpDot[i] = new wxStaticBitmap(m_pInStatus[i], ID_STATUSDOTBMP1 + i, CreateBitmapDot(),
wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize); wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
@ -300,13 +307,33 @@ void PADConfigDialognJoy::CreateAdvancedControls(int i)
//wxPoint(4, 15), wxSize(70,70)); //wxPoint(4, 15), wxSize(70,70));
//wxPoint(4, 20), wxDefaultSize); //wxPoint(4, 20), wxDefaultSize);
wxDefaultPosition, wxDefaultSize); wxDefaultPosition, wxDefaultSize);
// Yes the diagonals for the original GC controller are this narrow (i.e. around 80% of the full radius),
m_bmpAreaOut[i] = new wxStaticBitmap(m_pOutStatus[i], wxID_ANY, CreateBitmapArea(), // it's not a perfect octagon. Some third party GC controllers has a diagonal at 90% however,
// i.e. at around 63,63 rather than 55,55.
m_bmpAreaOut[i] = new wxStaticBitmap(m_pOutStatus[i], wxID_ANY, CreateBitmapArea(100,55),
wxPoint(1, 1), wxDefaultSize); wxPoint(1, 1), wxDefaultSize);
m_bmpDotOut[i] = new wxStaticBitmap(m_pOutStatus[i], ID_STATUSDOTBMP1 + i, CreateBitmapDot(), m_bmpDotOut[i] = new wxStaticBitmap(m_pOutStatus[i], ID_STATUSDOTBMP1 + i, CreateBitmapDot(),
wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize); wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
// C-stick In-Out
m_pInStatusC[i] = new wxPanel(m_Controller[i], ID_INSTATUS1 + i, wxDefaultPosition, wxDefaultSize);
m_bmpSquareC[i] = new wxStaticBitmap(m_pInStatusC[i], wxID_ANY, CreateBitmap(),
//wxPoint(4, 15), wxSize(70,70));
//wxPoint(4, 20), wxDefaultSize);
wxDefaultPosition, wxDefaultSize);
m_bmpDotC[i] = new wxStaticBitmap(m_pInStatusC[i], wxID_ANY, CreateBitmapDot(),
wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
m_pOutStatusC[i] = new wxPanel(m_Controller[i], ID_INSTATUS1 + i, wxDefaultPosition, wxDefaultSize);
m_bmpSquareOutC[i] = new wxStaticBitmap(m_pOutStatusC[i], wxID_ANY, CreateBitmap(),
//wxPoint(4, 15), wxSize(70,70));
//wxPoint(4, 20), wxDefaultSize);
wxDefaultPosition, wxDefaultSize);
m_bmpAreaOutC[i] = new wxStaticBitmap(m_pOutStatusC[i], wxID_ANY, CreateBitmapArea(85,46),
wxPoint(1, 1), wxDefaultSize);
m_bmpDotOutC[i] = new wxStaticBitmap(m_pOutStatusC[i], wxID_ANY, CreateBitmapDot(),
wxPoint(BoxW / 2, BoxH / 2), wxDefaultSize);
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
// Rerecording // Rerecording
// ¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯
@ -389,7 +416,7 @@ wxBitmap PADConfigDialognJoy::CreateBitmapDot()
dc.SelectObject(wxNullBitmap); dc.SelectObject(wxNullBitmap);
return bitmap; return bitmap;
} }
wxBitmap PADConfigDialognJoy::CreateBitmapArea() wxBitmap PADConfigDialognJoy::CreateBitmapArea(int Max, int Diagonal)
{ {
wxBitmap bitmap(BoxW - 2, BoxH - 2); wxBitmap bitmap(BoxW - 2, BoxH - 2);
wxMemoryDC dc; wxMemoryDC dc;
@ -406,13 +433,9 @@ wxBitmap PADConfigDialognJoy::CreateBitmapArea()
dc.Clear(); dc.Clear();
// Create offset for polygon // Create offset for polygon
float Adj = (float)BoxW / 256.0; float Adj = (float)(BoxW-2) / 256.0;
float iAdj = 127.0 * Adj; float iAdj = 127.0 * Adj;
// The polygon corners // The polygon corners
// Yes the diagonals for the original GC controller are this narrow (i.e. around 80% of the full radius),
// it's not a perfect octagon. Some third party GC controllers has a diagonal at 90% however,
// i.e. at around 63,63 rather than 55,55.
float Max = 100.0, Diagonal = 55.0;
wxPoint Points[8]; wxPoint Points[8];
Points[0].x = (int)(0.0 * Adj + iAdj); Points[0].y = (int)(Max * Adj + iAdj); Points[0].x = (int)(0.0 * Adj + iAdj); Points[0].y = (int)(Max * Adj + iAdj);
Points[1].x = (int)(Diagonal * Adj + iAdj); Points[1].y = (int)(Diagonal * Adj + iAdj); Points[1].x = (int)(Diagonal * Adj + iAdj); Points[1].y = (int)(Diagonal * Adj + iAdj);

View File

@ -89,6 +89,11 @@ BEGIN_EVENT_TABLE(PADConfigDialognJoy,wxDialog)
EVT_CHECKBOX(IDCB_MAINSTICK_CB_RADIUS, PADConfigDialognJoy::ChangeSettings) EVT_CHECKBOX(IDCB_MAINSTICK_CB_RADIUS, PADConfigDialognJoy::ChangeSettings)
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, PADConfigDialognJoy::ChangeSettings) EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, PADConfigDialognJoy::ChangeSettings) EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, PADConfigDialognJoy::ChangeSettings)
// C-stick
EVT_COMBOBOX(IDCB_CSTICK_RADIUS, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDCB_CSTICK_CB_RADIUS, PADConfigDialognJoy::ChangeSettings)
EVT_COMBOBOX(IDCB_CSTICK_DIAGONAL, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDCB_CSTICK_S_TO_C, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDCB_FILTER_SETTINGS, PADConfigDialognJoy::ChangeSettings) EVT_CHECKBOX(IDCB_FILTER_SETTINGS, PADConfigDialognJoy::ChangeSettings)
#ifdef RERECORDING #ifdef RERECORDING
EVT_CHECKBOX(ID_RECORDING, PADConfigDialognJoy::ChangeSettings) EVT_CHECKBOX(ID_RECORDING, PADConfigDialognJoy::ChangeSettings)
@ -600,6 +605,10 @@ void PADConfigDialognJoy::UpdateGUI(int _notebookpage)
else m_CoBRadius[_notebookpage]->Enable(false); else m_CoBRadius[_notebookpage]->Enable(false);
if (PadMapping[_notebookpage].bSquareToCircle) m_CoBDiagonal[_notebookpage]->Enable(true); if (PadMapping[_notebookpage].bSquareToCircle) m_CoBDiagonal[_notebookpage]->Enable(true);
else m_CoBDiagonal[_notebookpage]->Enable(false); else m_CoBDiagonal[_notebookpage]->Enable(false);
if (PadMapping[_notebookpage].bRadiusOnOffC) m_CoBRadiusC[_notebookpage]->Enable(true);
else m_CoBRadiusC[_notebookpage]->Enable(false);
if (PadMapping[_notebookpage].bSquareToCircleC) m_CoBDiagonalC[_notebookpage]->Enable(true);
else m_CoBDiagonalC[_notebookpage]->Enable(false);
} }
// Repaint the background // Repaint the background
@ -955,20 +964,29 @@ void PADConfigDialognJoy::CreateGUIControls()
// Input status text // Input status text
CreateAdvancedControls(i); CreateAdvancedControls(i);
// Sizers // Main-stick sizers
m_GBAdvancedMainStick[i] = new wxGridBagSizer(0, 0); m_GBAdvancedMainStick[i] = new wxGridBagSizer(0, 0);
m_GBAdvancedMainStick[i]->Add(m_pInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0); m_GBAdvancedMainStick[i]->Add(m_pInStatus[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0);
m_GBAdvancedMainStick[i]->Add(m_pOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 5); m_GBAdvancedMainStick[i]->Add(m_pOutStatus[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 5);
m_GBAdvancedMainStick[i]->Add(m_TStatusIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0); m_GBAdvancedMainStick[i]->Add(m_TStatusIn[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0);
m_GBAdvancedMainStick[i]->Add(m_TStatusOut[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 5); m_GBAdvancedMainStick[i]->Add(m_TStatusOut[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 5);
// Cstick sizers
m_GBAdvancedCStick[i] = new wxGridBagSizer(0, 0);
m_GBAdvancedCStick[i]->Add(m_pInStatusC[i], wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 0);
m_GBAdvancedCStick[i]->Add(m_pOutStatusC[i], wxGBPosition(0, 1), wxGBSpan(1, 1), wxLEFT, 5);
m_GBAdvancedCStick[i]->Add(m_TStatusInC[i], wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 0);
m_GBAdvancedCStick[i]->Add(m_TStatusOutC[i], wxGBPosition(1, 1), wxGBSpan(1, 1), wxLEFT, 5);
// Add sizers
m_gStatusIn[i]->Add(m_GBAdvancedMainStick[i], 0, wxLEFT, 5); m_gStatusIn[i]->Add(m_GBAdvancedMainStick[i], 0, wxLEFT, 5);
m_gStatusInC[i]->Add(m_GBAdvancedCStick[i], 0, wxLEFT, 5);
// Populate input status settings // Populate input status settings
// The drop down menu // The drop down menu
m_gStatusInSettings[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Main-stick settings")); m_gStatusInSettings[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Main-stick settings"));
m_gStatusInSettingsRadiusH[i] = new wxBoxSizer(wxHORIZONTAL); m_gStatusInSettingsRadiusH[i] = new wxBoxSizer(wxHORIZONTAL);
m_gStatusInSettingsC[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("C-stick settings"));
m_gStatusInSettingsRadiusHC[i] = new wxBoxSizer(wxHORIZONTAL);
wxArrayString asRadius; wxArrayString asRadius;
asRadius.Add(wxT("100%")); asRadius.Add(wxT("100%"));
asRadius.Add(wxT("90%")); asRadius.Add(wxT("90%"));
@ -976,16 +994,20 @@ void PADConfigDialognJoy::CreateGUIControls()
asRadius.Add(wxT("70%")); asRadius.Add(wxT("70%"));
asRadius.Add(wxT("60%")); asRadius.Add(wxT("60%"));
asRadius.Add(wxT("50%")); asRadius.Add(wxT("50%"));
asRadius.Add(wxT("40%"));
m_CoBRadius[i] = new wxComboBox(m_Controller[i], IDCB_MAINSTICK_RADIUS, asRadius[0], wxDefaultPosition, wxDefaultSize, asRadius, wxCB_READONLY); m_CoBRadius[i] = new wxComboBox(m_Controller[i], IDCB_MAINSTICK_RADIUS, asRadius[0], wxDefaultPosition, wxDefaultSize, asRadius, wxCB_READONLY);
m_CoBRadiusC[i] = new wxComboBox(m_Controller[i], IDCB_CSTICK_RADIUS, asRadius[0], wxDefaultPosition, wxDefaultSize, asRadius, wxCB_READONLY);
// The checkbox // The checkbox
m_CBRadius[i] = new wxCheckBox(m_Controller[i], IDCB_MAINSTICK_CB_RADIUS, wxT("Radius")); m_CBRadius[i] = new wxCheckBox(m_Controller[i], IDCB_MAINSTICK_CB_RADIUS, wxT("Radius"));
m_CBRadius[i]->SetToolTip(wxT( m_CBRadiusC[i] = new wxCheckBox(m_Controller[i], IDCB_CSTICK_CB_RADIUS, wxT("Radius"));
"This will reduce the stick radius." wxString CBRadiusToolTip = "This will reduce the stick radius.";
)); m_CBRadius[i]->SetToolTip(CBRadiusToolTip);
m_CBRadiusC[i]->SetToolTip(CBRadiusToolTip);
// The drop down menu); // The drop down menu);
m_gStatusInSettingsH[i] = new wxBoxSizer(wxHORIZONTAL); m_gStatusInSettingsH[i] = new wxBoxSizer(wxHORIZONTAL);
m_gStatusInSettingsHC[i] = new wxBoxSizer(wxHORIZONTAL);
wxArrayString asStatusInSet; wxArrayString asStatusInSet;
asStatusInSet.Add(wxT("100%")); asStatusInSet.Add(wxT("100%"));
asStatusInSet.Add(wxT("95%")); asStatusInSet.Add(wxT("95%"));
@ -994,22 +1016,34 @@ void PADConfigDialognJoy::CreateGUIControls()
asStatusInSet.Add(wxT("80%")); asStatusInSet.Add(wxT("80%"));
asStatusInSet.Add(wxT("75%")); asStatusInSet.Add(wxT("75%"));
m_CoBDiagonal[i] = new wxComboBox(m_Controller[i], IDCB_MAINSTICK_DIAGONAL, asStatusInSet[0], wxDefaultPosition, wxDefaultSize, asStatusInSet, wxCB_READONLY); m_CoBDiagonal[i] = new wxComboBox(m_Controller[i], IDCB_MAINSTICK_DIAGONAL, asStatusInSet[0], wxDefaultPosition, wxDefaultSize, asStatusInSet, wxCB_READONLY);
m_CoBDiagonalC[i] = new wxComboBox(m_Controller[i], IDCB_CSTICK_DIAGONAL, asStatusInSet[0], wxDefaultPosition, wxDefaultSize, asStatusInSet, wxCB_READONLY);
// The checkbox // The checkbox
m_CBS_to_C[i] = new wxCheckBox(m_Controller[i], IDCB_MAINSTICK_S_TO_C, wxT("Diagonal")); m_CBS_to_C[i] = new wxCheckBox(m_Controller[i], IDCB_MAINSTICK_S_TO_C, wxT("Diagonal"));
m_CBS_to_C[i]->SetToolTip(wxT( m_CBS_to_CC[i] = new wxCheckBox(m_Controller[i], IDCB_CSTICK_S_TO_C, wxT("Diagonal"));
wxString CBS_to_CToolTip =
"This will convert a square stick radius to a circle stick radius similar to the octagonal area that the original GameCube pad produce." "This will convert a square stick radius to a circle stick radius similar to the octagonal area that the original GameCube pad produce."
" To produce a smooth circle in the 'Out' window you have to manually set" " To produce a smooth circle in the 'Out' window you have to manually set"
" your diagonal values from the 'In' window in the drop down menu." " your diagonal values from the 'In' window in the drop down menu.";
)); m_CBS_to_C[i]->SetToolTip(CBS_to_CToolTip);
m_CBS_to_CC[i]->SetToolTip(CBS_to_CToolTip);
// Populate sizers
m_gStatusInSettings[i]->Add(m_gStatusInSettingsRadiusH[i], 0, (wxLEFT | wxRIGHT | wxBOTTOM), 4); m_gStatusInSettings[i]->Add(m_gStatusInSettingsRadiusH[i], 0, (wxLEFT | wxRIGHT | wxBOTTOM), 4);
m_gStatusInSettings[i]->Add(m_gStatusInSettingsH[i], 0, (wxLEFT | wxRIGHT | wxBOTTOM), 4); m_gStatusInSettings[i]->Add(m_gStatusInSettingsH[i], 0, (wxLEFT | wxRIGHT | wxBOTTOM), 4);
// C-stick
m_gStatusInSettingsC[i]->Add(m_gStatusInSettingsRadiusHC[i], 0, (wxLEFT | wxRIGHT | wxBOTTOM), 4);
m_gStatusInSettingsC[i]->Add(m_gStatusInSettingsHC[i], 0, (wxLEFT | wxRIGHT | wxBOTTOM), 4);
m_gStatusInSettingsRadiusH[i]->Add(m_CBRadius[i], 0, wxLEFT | wxTOP, 3); m_gStatusInSettingsRadiusH[i]->Add(m_CBRadius[i], 0, wxLEFT | wxTOP, 3);
m_gStatusInSettingsRadiusH[i]->Add(m_CoBRadius[i], 0, wxLEFT, 3); m_gStatusInSettingsRadiusH[i]->Add(m_CoBRadius[i], 0, wxLEFT, 3);
m_gStatusInSettingsH[i]->Add(m_CBS_to_C[i], 0, wxLEFT | wxTOP, 3); m_gStatusInSettingsH[i]->Add(m_CBS_to_C[i], 0, wxLEFT | wxTOP, 3);
m_gStatusInSettingsH[i]->Add(m_CoBDiagonal[i], 0, wxLEFT, 3); m_gStatusInSettingsH[i]->Add(m_CoBDiagonal[i], 0, wxLEFT, 3);
// C-stick
m_gStatusInSettingsRadiusHC[i]->Add(m_CBRadiusC[i], 0, wxLEFT | wxTOP, 3);
m_gStatusInSettingsRadiusHC[i]->Add(m_CoBRadiusC[i], 0, wxLEFT, 3);
m_gStatusInSettingsHC[i]->Add(m_CBS_to_CC[i], 0, wxLEFT | wxTOP, 3);
m_gStatusInSettingsHC[i]->Add(m_CoBDiagonalC[i], 0, wxLEFT, 3);
// The trigger values // The trigger values
m_gStatusTriggers[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Trigger values")); m_gStatusTriggers[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Trigger values"));
@ -1050,6 +1084,8 @@ void PADConfigDialognJoy::CreateGUIControls()
m_sMainRight[i] = new wxBoxSizer(wxVERTICAL); m_sMainRight[i] = new wxBoxSizer(wxVERTICAL);
m_sMainRight[i]->Add(m_gStatusIn[i], 0, wxEXPAND | (wxLEFT), 2); m_sMainRight[i]->Add(m_gStatusIn[i], 0, wxEXPAND | (wxLEFT), 2);
m_sMainRight[i]->Add(m_gStatusInSettings[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2); m_sMainRight[i]->Add(m_gStatusInSettings[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2);
m_sMainRight[i]->Add(m_gStatusInC[i], 0, wxEXPAND | (wxLEFT), 2);
m_sMainRight[i]->Add(m_gStatusInSettingsC[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2);
m_sMainRight[i]->Add(m_gStatusTriggers[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2); m_sMainRight[i]->Add(m_gStatusTriggers[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2);
m_sMainRight[i]->Add(m_gStatusAdvancedSettings[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2); m_sMainRight[i]->Add(m_gStatusAdvancedSettings[i], 0, wxEXPAND | (wxLEFT | wxTOP), 2);
#ifdef RERECORDING #ifdef RERECORDING

View File

@ -89,7 +89,7 @@ class PADConfigDialognJoy : public wxDialog
wxNotebook *m_Notebook; wxNotebook *m_Notebook;
wxBoxSizer * m_MainSizer; wxBoxSizer * m_MainSizer;
wxPanel * m_pKeys[4], * m_pInStatus[4], * m_pOutStatus[4]; wxPanel *m_pKeys[4], *m_pInStatus[4], *m_pOutStatus[4], *m_pInStatusC[4], *m_pOutStatusC[4];
wxBitmap WxStaticBitmap1_BITMAP, WxStaticBitmap1_BITMAPGray; wxBitmap WxStaticBitmap1_BITMAP, WxStaticBitmap1_BITMAPGray;
wxStaticBoxSizer * m_sKeys[4]; wxStaticBoxSizer * m_sKeys[4];
wxBoxSizer *m_sMain[4], *m_sMainLeft[4], *m_sMainRight[4]; wxBoxSizer *m_sMain[4], *m_sMainLeft[4], *m_sMainRight[4];
@ -116,12 +116,12 @@ class PADConfigDialognJoy : public wxDialog
wxCheckBox *m_CBSaveByID[4], *m_CBShowAdvanced[4]; wxCheckBox *m_CBSaveByID[4], *m_CBShowAdvanced[4];
wxStaticText *m_TSControltype[4], *m_TSTriggerType[4]; wxStaticText *m_TSControltype[4], *m_TSTriggerType[4];
wxStaticBoxSizer *m_gStatusIn[4], *m_gStatusInSettings[4], *m_gStatusAdvancedSettings[4]; // Advanced settings wxStaticBoxSizer *m_gStatusIn[4], *m_gStatusInSettings[4], *m_gStatusInC[4], *m_gStatusInSettingsC[4], *m_gStatusAdvancedSettings[4]; // Advanced settings
wxBoxSizer *m_gStatusInSettingsH[4], *m_gStatusInSettingsRadiusH[4]; wxBoxSizer *m_gStatusInSettingsH[4], *m_gStatusInSettingsRadiusH[4], *m_gStatusInSettingsHC[4], *m_gStatusInSettingsRadiusHC[4];
wxGridBagSizer *m_GBAdvancedMainStick[4]; wxGridBagSizer *m_GBAdvancedMainStick[4], *m_GBAdvancedCStick[4];
wxStaticText *m_TStatusIn[4], *m_TStatusOut[4]; wxStaticText *m_TStatusIn[4], *m_TStatusOut[4], *m_TStatusInC[4], *m_TStatusOutC[4];
wxComboBox *m_CoBRadius[4]; wxCheckBox *m_CBRadius[4]; wxComboBox *m_CoBRadius[4], *m_CoBRadiusC[4]; wxCheckBox *m_CBRadius[4], *m_CBRadiusC[4];
wxComboBox *m_CoBDiagonal[4]; wxCheckBox *m_CBS_to_C[4]; wxComboBox *m_CoBDiagonal[4], *m_CoBDiagonalC[4]; wxCheckBox *m_CBS_to_C[4], *m_CBS_to_CC[4];
wxCheckBox *m_CBCheckFocus[4], *m_AdvancedMapFilter[4]; wxCheckBox *m_CBCheckFocus[4], *m_AdvancedMapFilter[4];
wxCheckBox *m_Rumble[4]; // Rumble settings wxCheckBox *m_Rumble[4]; // Rumble settings
@ -193,7 +193,8 @@ class PADConfigDialognJoy : public wxDialog
wxTextCtrl *m_PlaceholderBMP[4]; wxTextCtrl *m_PlaceholderBMP[4];
wxStaticBitmap *m_controllerimage[4], wxStaticBitmap *m_controllerimage[4],
*m_bmpSquare[4], *m_bmpDot[4], *m_bmpSquareOut[4], *m_bmpDotOut[4], *m_bmpAreaOut[4]; *m_bmpSquare[4], *m_bmpDot[4], *m_bmpSquareOut[4], *m_bmpDotOut[4], *m_bmpAreaOut[4],
*m_bmpSquareC[4], *m_bmpDotC[4], *m_bmpSquareOutC[4], *m_bmpDotOutC[4], *m_bmpAreaOutC[4];
int notebookpage; bool ControlsCreated; int notebookpage; bool ControlsCreated;
#ifdef RERECORDING #ifdef RERECORDING
@ -233,7 +234,9 @@ class PADConfigDialognJoy : public wxDialog
IDT_STATUS_IN, IDT_STATUS_OUT, IDT_STATUS_IN, IDT_STATUS_OUT,
// Advaced settings // Advaced settings
IDCB_MAINSTICK_RADIUS, IDCB_MAINSTICK_CB_RADIUS, IDCB_MAINSTICK_DIAGONAL, IDCB_MAINSTICK_S_TO_C, IDT_MAINSTICK_DIAGONAL, IDT_TRIGGERS, IDCB_CHECKFOCUS, IDCB_FILTER_SETTINGS, IDCB_MAINSTICK_RADIUS, IDCB_MAINSTICK_CB_RADIUS, IDCB_MAINSTICK_DIAGONAL, IDCB_MAINSTICK_S_TO_C, IDT_MAINSTICK_DIAGONAL,
IDCB_CSTICK_RADIUS, IDCB_CSTICK_CB_RADIUS, IDCB_CSTICK_DIAGONAL, IDCB_CSTICK_S_TO_C, IDT_CSTICK_DIAGONAL,
IDT_TRIGGERS, IDCB_CHECKFOCUS, IDCB_FILTER_SETTINGS,
#ifdef RERECORDING #ifdef RERECORDING
ID_RECORDING, ID_PLAYBACK, ID_SAVE_RECORDING, ID_RECORDING, ID_PLAYBACK, ID_SAVE_RECORDING,
#endif #endif
@ -339,7 +342,7 @@ class PADConfigDialognJoy : public wxDialog
void SizeWindow(); void SizeWindow();
wxBitmap CreateBitmap(); wxBitmap CreateBitmap();
wxBitmap CreateBitmapDot(); wxBitmap CreateBitmapDot();
wxBitmap CreateBitmapArea(); wxBitmap CreateBitmapArea(int,int);
void PadGetStatus(); void PadGetStatus();
void Update(); void Update();

View File

@ -81,6 +81,11 @@ void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller)
m_CBRadius[controller]->SetValue(PadMapping[controller].bRadiusOnOff); m_CBRadius[controller]->SetValue(PadMapping[controller].bRadiusOnOff);
m_CoBDiagonal[controller]->SetValue(wxString::FromAscii(PadMapping[controller].SDiagonal.c_str())); m_CoBDiagonal[controller]->SetValue(wxString::FromAscii(PadMapping[controller].SDiagonal.c_str()));
m_CBS_to_C[controller]->SetValue(PadMapping[controller].bSquareToCircle); m_CBS_to_C[controller]->SetValue(PadMapping[controller].bSquareToCircle);
// C-stick
m_CoBRadiusC[controller]->SetValue(wxString::FromAscii(PadMapping[controller].SRadiusC.c_str()));
m_CBRadiusC[controller]->SetValue(PadMapping[controller].bRadiusOnOffC);
m_CoBDiagonalC[controller]->SetValue(wxString::FromAscii(PadMapping[controller].SDiagonalC.c_str()));
m_CBS_to_CC[controller]->SetValue(PadMapping[controller].bSquareToCircleC);
m_AdvancedMapFilter[controller]->SetValue(g_Config.bNoTriggerFilter); m_AdvancedMapFilter[controller]->SetValue(g_Config.bNoTriggerFilter);
// Update Rumble checkbox // Update Rumble checkbox
m_Rumble[controller]->SetValue(PadMapping[controller].rumble); m_Rumble[controller]->SetValue(PadMapping[controller].rumble);
@ -129,6 +134,11 @@ void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, i
PadMapping[controller].bRadiusOnOff = m_CBRadius[FromSlot]->IsChecked(); PadMapping[controller].bRadiusOnOff = m_CBRadius[FromSlot]->IsChecked();
PadMapping[controller].SDiagonal = m_CoBDiagonal[FromSlot]->GetLabel().mb_str(); PadMapping[controller].SDiagonal = m_CoBDiagonal[FromSlot]->GetLabel().mb_str();
PadMapping[controller].bSquareToCircle = m_CBS_to_C[FromSlot]->IsChecked(); PadMapping[controller].bSquareToCircle = m_CBS_to_C[FromSlot]->IsChecked();
// C-stick
PadMapping[controller].SRadiusC = m_CoBRadiusC[FromSlot]->GetLabel().mb_str();
PadMapping[controller].bRadiusOnOffC = m_CBRadiusC[FromSlot]->IsChecked();
PadMapping[controller].SDiagonalC = m_CoBDiagonalC[FromSlot]->GetLabel().mb_str();
PadMapping[controller].bSquareToCircleC = m_CBS_to_CC[FromSlot]->IsChecked();
// The analog buttons // The analog buttons
m_JoyAnalogMainX[FromSlot]->GetValue().ToLong(&value); PadMapping[controller].axis[InputCommon::CTL_MAIN_X] = value; tmp.clear(); m_JoyAnalogMainX[FromSlot]->GetValue().ToLong(&value); PadMapping[controller].axis[InputCommon::CTL_MAIN_X] = value; tmp.clear();

View File

@ -445,15 +445,12 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
int TriggerRight = PadState[_numPAD].axis[InputCommon::CTL_R_SHOULDER]; int TriggerRight = PadState[_numPAD].axis[InputCommon::CTL_R_SHOULDER];
// Check if we should make adjustments // Check if we should make adjustments
if (PadMapping[_numPAD].bSquareToCircle) if (PadMapping[_numPAD].bSquareToCircle) InputCommon::Square2Circle(i_main_stick_x, i_main_stick_y, _numPAD, PadMapping[_numPAD].SDiagonal);
{
InputCommon::Square2Circle(i_main_stick_x, i_main_stick_y, _numPAD, PadMapping[_numPAD].SDiagonal);
}
// Radius adjustment // Radius adjustment
if (PadMapping[_numPAD].bRadiusOnOff) if (PadMapping[_numPAD].bRadiusOnOff) InputCommon::RadiusAdjustment(i_main_stick_x, i_main_stick_y, _numPAD, PadMapping[_numPAD].SRadius);
{ // C-stick
InputCommon::RadiusAdjustment(i_main_stick_x, i_main_stick_y, _numPAD, PadMapping[_numPAD].SRadius); if (PadMapping[_numPAD].bSquareToCircleC) InputCommon::Square2Circle(i_sub_stick_x, i_sub_stick_y, _numPAD, PadMapping[_numPAD].SDiagonalC);
} if (PadMapping[_numPAD].bRadiusOnOffC) InputCommon::RadiusAdjustment(i_sub_stick_x, i_sub_stick_y, _numPAD, PadMapping[_numPAD].SRadiusC);
// Convert axis values // Convert axis values
u8 main_stick_x = InputCommon::Pad_Convert(i_main_stick_x); u8 main_stick_x = InputCommon::Pad_Convert(i_main_stick_x);
@ -573,16 +570,18 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
// ---------------------- // ----------------------
// Debugging // Debugging
/* /* */
// Show the status of all connected pads // Show the status of all connected pads
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener(); ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
if ((LastPad == 0 && _numPAD == 0) || _numPAD < LastPad) Console->ClearScreen(); if ((LastPad == 0 && _numPAD == 0) || _numPAD < LastPad) Console->ClearScreen();
LastPad = _numPAD; LastPad = _numPAD;
// Console->ClearScreen(); // Console->ClearScreen();
int X = _pPADStatus->stickX - 128, Y = _pPADStatus->stickY - 128; int X = _pPADStatus->stickX - 128, Y = _pPADStatus->stickY - 128;
int Xc = _pPADStatus->substickX - 128, Yc = _pPADStatus->substickY - 128;
NOTICE_LOG(CONSOLE, NOTICE_LOG(CONSOLE,
"Pad | Number:%i Enabled:%i Handle:%i\n" "Pad | Number:%i Enabled:%i Handle:%i\n"
"Stick | X:%03i Y:%03i R:%3.0f\n" "Stick | X:%03i Y:%03i R:%3.0f\n"
"C-Stick | X:%03i Y:%03i R:%3.0f\n"
"Trigger | StatusL:%04x StatusR:%04x TriggerL:%04x TriggerR:%04x TriggerValue:%i\n" "Trigger | StatusL:%04x StatusR:%04x TriggerL:%04x TriggerR:%04x TriggerValue:%i\n"
"Buttons | Overall:%i A:%i X:%i\n" "Buttons | Overall:%i A:%i X:%i\n"
"======================================================\n", "======================================================\n",
@ -590,6 +589,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
_numPAD, PadMapping[_numPAD].enabled, PadState[_numPAD].joy, _numPAD, PadMapping[_numPAD].enabled, PadState[_numPAD].joy,
X, Y, sqrt((float)(X*X + Y*Y)), X, Y, sqrt((float)(X*X + Y*Y)),
Xc, Yc, sqrt((float)(Xc*Xc + Yc*Yc)),
_pPADStatus->triggerLeft, _pPADStatus->triggerRight, TriggerLeft, TriggerRight, TriggerValue, _pPADStatus->triggerLeft, _pPADStatus->triggerRight, TriggerLeft, TriggerRight, TriggerValue,
@ -597,7 +597,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
PadState[_numPAD].buttons[InputCommon::CTL_A_BUTTON], PadState[_numPAD].buttons[InputCommon::CTL_A_BUTTON],
PadState[_numPAD].buttons[InputCommon::CTL_X_BUTTON] PadState[_numPAD].buttons[InputCommon::CTL_X_BUTTON]
); );
*/
} }