nJoy: Added radius option to advanced settings

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3716 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-07-09 00:48:07 +00:00
parent 1c52139d94
commit 8fa315879a
8 changed files with 86 additions and 25 deletions

View File

@ -92,6 +92,15 @@ void PADConfigDialognJoy::PadGetStatus()
main_x_after = main_xy.at(0);
main_y_after = main_xy.at(1);
}
// Adjust radius
if(PadMapping[notebookpage].bRadiusOnOff)
{
// Get the manually configured diagonal distance
int Tmp = atoi (PadMapping[notebookpage].SRadius.substr(0, PadMapping[notebookpage].SRadius.length() - 1).c_str());
float Radius = Tmp / 100.0f;
main_x_after = (int)((float)main_x_after * Radius);
main_y_after = (int)((float)main_y_after * Radius);
}
//
float f_x = main_x / 32767.0;

View File

@ -85,6 +85,8 @@ BEGIN_EVENT_TABLE(PADConfigDialognJoy,wxDialog)
EVT_COMBOBOX(IDC_RUMBLESTRENGTH, PADConfigDialognJoy::ChangeSettings)
// Advanced settings
EVT_COMBOBOX(IDCB_MAINSTICK_RADIUS, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDCB_MAINSTICK_CB_RADIUS, PADConfigDialognJoy::ChangeSettings)
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, PADConfigDialognJoy::ChangeSettings)
EVT_CHECKBOX(IDCB_FILTER_SETTINGS, PADConfigDialognJoy::ChangeSettings)
@ -581,7 +583,9 @@ void PADConfigDialognJoy::UpdateGUI(int _notebookpage)
m_Controller[_notebookpage]->FindItem(IDC_DEADZONE)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDC_CONTROLTYPE)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDC_TRIGGERTYPE)->Enable(Enabled && XInput);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_DIAGONAL)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_RADIUS)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_CB_RADIUS)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_DIAGONAL)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_MAINSTICK_S_TO_C)->Enable(Enabled);
m_Controller[_notebookpage]->FindItem(IDCB_FILTER_SETTINGS)->Enable(Enabled);
#endif
@ -589,6 +593,15 @@ void PADConfigDialognJoy::UpdateGUI(int _notebookpage)
// Replace the harder to understand -1 with "" for the sake of user friendliness
ToBlank();
// Advanced settings
if (g_Config.bShowAdvanced)
{
if (PadMapping[_notebookpage].bRadiusOnOff) m_CoBRadius[_notebookpage]->Enable(true);
else m_CoBRadius[_notebookpage]->Enable(false);
if (PadMapping[_notebookpage].bSquareToCircle) m_CoBDiagonal[_notebookpage]->Enable(true);
else m_CoBDiagonal[_notebookpage]->Enable(false);
}
// Repaint the background
m_Controller[_notebookpage]->Refresh();
}
@ -953,34 +966,49 @@ void PADConfigDialognJoy::CreateGUIControls()
// Populate input status settings
// The label
m_STDiagonal[i] = new wxStaticText(m_Controller[i], IDT_MAINSTICK_DIAGONAL, wxT("Diagonal"));
m_STDiagonal[i]->SetToolTip(wxT(
"To produce a smooth circle in the 'Out' window you have to manually set"
"\nyour diagonal values here from the 'In' window."
));
// The drop down menu
m_gStatusInSettings[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("Main-stick settings"));
m_gStatusInSettingsRadiusH[i] = new wxBoxSizer(wxHORIZONTAL);
wxArrayString asRadius;
asRadius.Add(wxT("100%"));
asRadius.Add(wxT("90%"));
asRadius.Add(wxT("80%"));
asRadius.Add(wxT("70%"));
asRadius.Add(wxT("60%"));
asRadius.Add(wxT("50%"));
m_CoBRadius[i] = new wxComboBox(m_Controller[i], IDCB_MAINSTICK_RADIUS, asRadius[0], wxDefaultPosition, wxDefaultSize, asRadius, wxCB_READONLY);
// The checkbox
m_CBRadius[i] = new wxCheckBox(m_Controller[i], IDCB_MAINSTICK_CB_RADIUS, wxT("Radius"));
m_CBRadius[i]->SetToolTip(wxT(
"This will reduce the stick radius."
));
// The drop down menu);
m_gStatusInSettingsH[i] = new wxBoxSizer(wxHORIZONTAL);
wxArrayString asStatusInSet;
asStatusInSet.Add(wxT("100%"));
asStatusInSet.Add(wxT("95%"));
asStatusInSet.Add(wxT("90%"));
asStatusInSet.Add(wxT("85%"));
asStatusInSet.Add(wxT("80%"));
asStatusInSet.Add(wxT("75%"));
m_CoBDiagonal[i] = new wxComboBox(m_Controller[i], IDCB_MAINSTICK_DIAGONAL, asStatusInSet[0], wxDefaultPosition, wxDefaultSize, asStatusInSet, wxCB_READONLY);
// The checkbox
m_CBS_to_C[i] = new wxCheckBox(m_Controller[i], IDCB_MAINSTICK_S_TO_C, wxT("Square-to-circle"));
m_CBS_to_C[i] = new wxCheckBox(m_Controller[i], IDCB_MAINSTICK_S_TO_C, wxT("Diagonal"));
m_CBS_to_C[i]->SetToolTip(wxT(
"This will convert a square stick radius to a circle stick radius like the one that the actual GameCube pad produce."
" That is also the input the games expect to see."
"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"
" your diagonal values from the 'In' window in the drop down menu."
));
m_gStatusInSettings[i]->Add(m_CBS_to_C[i], 0, (wxALL), 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_gStatusInSettingsH[i]->Add(m_STDiagonal[i], 0, wxTOP, 3);
m_gStatusInSettingsRadiusH[i]->Add(m_CBRadius[i], 0, wxLEFT | wxTOP, 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_CoBDiagonal[i], 0, wxLEFT, 3);
// The trigger values

View File

@ -117,9 +117,10 @@ class PADConfigDialognJoy : public wxDialog
wxStaticText *m_TSControltype[4], *m_TSTriggerType[4];
wxStaticBoxSizer *m_gStatusIn[4], *m_gStatusInSettings[4], *m_gStatusAdvancedSettings[4]; // Advanced settings
wxBoxSizer *m_gStatusInSettingsH[4];
wxBoxSizer *m_gStatusInSettingsH[4], *m_gStatusInSettingsRadiusH[4];
wxGridBagSizer *m_GBAdvancedMainStick[4];
wxStaticText *m_TStatusIn[4], *m_TStatusOut[4], *m_STDiagonal[4];
wxStaticText *m_TStatusIn[4], *m_TStatusOut[4];
wxComboBox *m_CoBRadius[4]; wxCheckBox *m_CBRadius[4];
wxComboBox *m_CoBDiagonal[4]; wxCheckBox *m_CBS_to_C[4];
wxCheckBox *m_CBCheckFocus[4], *m_AdvancedMapFilter[4];
@ -232,7 +233,7 @@ class PADConfigDialognJoy : public wxDialog
IDT_STATUS_IN, IDT_STATUS_OUT,
// Advaced settings
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, IDT_TRIGGERS, IDCB_CHECKFOCUS, IDCB_FILTER_SETTINGS,
#ifdef RERECORDING
ID_RECORDING, ID_PLAYBACK, ID_SAVE_RECORDING,
#endif

View File

@ -77,6 +77,8 @@ void PADConfigDialognJoy::UpdateGUIButtonMapping(int controller)
m_ControlType[controller]->SetSelection(PadMapping[controller].controllertype);
m_TriggerType[controller]->SetSelection(PadMapping[controller].triggertype);
m_Deadzone[controller]->SetSelection(PadMapping[controller].deadzone);
m_CoBRadius[controller]->SetValue(wxString::FromAscii(PadMapping[controller].SRadius.c_str()));
m_CBRadius[controller]->SetValue(PadMapping[controller].bRadiusOnOff);
m_CoBDiagonal[controller]->SetValue(wxString::FromAscii(PadMapping[controller].SDiagonal.c_str()));
m_CBS_to_C[controller]->SetValue(PadMapping[controller].bSquareToCircle);
m_AdvancedMapFilter[controller]->SetValue(g_Config.bNoTriggerFilter);
@ -123,6 +125,8 @@ void PADConfigDialognJoy::SaveButtonMapping(int controller, bool DontChangeId, i
PadMapping[controller].controllertype = m_ControlType[FromSlot]->GetSelection();
PadMapping[controller].triggertype = m_TriggerType[FromSlot]->GetSelection();
PadMapping[controller].deadzone = m_Deadzone[FromSlot]->GetSelection();
PadMapping[controller].SRadius = m_CoBRadius[FromSlot]->GetLabel().mb_str();
PadMapping[controller].bRadiusOnOff = m_CBRadius[FromSlot]->IsChecked();
PadMapping[controller].SDiagonal = m_CoBDiagonal[FromSlot]->GetLabel().mb_str();
PadMapping[controller].bSquareToCircle = m_CBS_to_C[FromSlot]->IsChecked();