mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-02 02:52:30 +02:00
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:
parent
1c52139d94
commit
8fa315879a
@ -205,9 +205,10 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
|
||||
|
||||
#ifdef SHOW_PAD_STATUS
|
||||
// Show the status of all connected pads
|
||||
//if ((g_LastPad == 0 && Controller == 0) || Controller < g_LastPad) Console::ClearScreen();
|
||||
//ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
//if ((g_LastPad == 0 && Controller == 0) || Controller < g_LastPad) Console->ClearScreen();
|
||||
g_LastPad = Controller;
|
||||
DEBUG_LOG(CONSOLE,
|
||||
NOTICE_LOG(CONSOLE,
|
||||
"Pad | Number:%i Enabled:%i Handle:%i\n"
|
||||
"Main Stick | X:%03i Y:%03i\n"
|
||||
"C Stick | X:%03i Y:%03i\n"
|
||||
|
@ -90,8 +90,8 @@ struct CONTROLLER_MAPPING // GC PAD MAPPING
|
||||
int ID; // SDL joystick device ID
|
||||
int controllertype; // Hat: Hat or custom buttons
|
||||
int triggertype; // Triggers range
|
||||
std::string SDiagonal;
|
||||
bool bSquareToCircle;
|
||||
std::string SRadius, SDiagonal;
|
||||
bool bRadiusOnOff, bSquareToCircle;
|
||||
bool rumble;
|
||||
int eventnum; // Linux Event Number, Can't be found dynamically yet
|
||||
};
|
||||
|
@ -174,8 +174,10 @@ void Config::Save(int Slot)
|
||||
file.Set(SectionName.c_str(), "eventnum", PadMapping[i].eventnum);
|
||||
file.Set(SectionName.c_str(), "use_rumble", PadMapping[i].rumble);
|
||||
|
||||
file.Set(SectionName.c_str(), "Radius", PadMapping[i].SRadius);
|
||||
file.Set(SectionName.c_str(), "RadiusOnOff", PadMapping[i].bRadiusOnOff);
|
||||
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);
|
||||
// ======================================
|
||||
|
||||
// Debugging
|
||||
@ -268,6 +270,8 @@ void Config::Load(bool ChangePad, bool ChangeSaveByID)
|
||||
file.Get(SectionName.c_str(), "eventnum", &PadMapping[i].eventnum, 0);
|
||||
file.Get(SectionName.c_str(), "use_rumble", &PadMapping[i].rumble, false);
|
||||
|
||||
file.Get(SectionName.c_str(), "Radius", &PadMapping[i].SRadius, "100%");
|
||||
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(), "SquareToCircle", &Tmp, false); PadMapping[i].bSquareToCircle = Tmp;
|
||||
// =============================
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -451,6 +451,15 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
i_main_stick_x = main_xy.at(0);
|
||||
i_main_stick_y = main_xy.at(1);
|
||||
}
|
||||
// Radius adjustment
|
||||
if (PadMapping[_numPAD].bRadiusOnOff)
|
||||
{
|
||||
// Get the manually configured diagonal distance
|
||||
int Tmp = atoi (PadMapping[_numPAD].SRadius.substr(0, PadMapping[_numPAD].SRadius.length() - 1).c_str());
|
||||
float Radius = Tmp / 100.0f;
|
||||
i_main_stick_x = (int)((float)i_main_stick_x * Radius);
|
||||
i_main_stick_y = (int)((float)i_main_stick_y * Radius);
|
||||
}
|
||||
|
||||
// Convert axis values
|
||||
u8 main_stick_x = InputCommon::Pad_Convert(i_main_stick_x);
|
||||
@ -570,19 +579,24 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
// ----------------------
|
||||
|
||||
// Debugging
|
||||
/*
|
||||
/*
|
||||
// Show the status of all connected pads
|
||||
// if ((LastPad == 0 && _numPAD == 0) || _numPAD < LastPad) Console::ClearScreen();
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
if ((LastPad == 0 && _numPAD == 0) || _numPAD < LastPad) Console->ClearScreen();
|
||||
LastPad = _numPAD;
|
||||
// Console::ClearScreen();
|
||||
INFO_LOG(CONSOLE,
|
||||
// Console->ClearScreen();
|
||||
int X = _pPADStatus->stickX - 128, Y = _pPADStatus->stickY - 128;
|
||||
NOTICE_LOG(CONSOLE,
|
||||
"Pad | Number:%i Enabled:%i Handle:%i\n"
|
||||
"Stick | X:%03i Y:%03i R:%3.0f\n"
|
||||
"Trigger | StatusL:%04x StatusR:%04x TriggerL:%04x TriggerR:%04x TriggerValue:%i\n"
|
||||
"Buttons | Overall:%i A:%i X:%i\n"
|
||||
"======================================================\n",
|
||||
|
||||
_numPAD, PadMapping[_numPAD].enabled, PadState[_numPAD].joy,
|
||||
|
||||
X, Y, sqrt((float)(X*X + Y*Y)),
|
||||
|
||||
_pPADStatus->triggerLeft, _pPADStatus->triggerRight, TriggerLeft, TriggerRight, TriggerValue,
|
||||
|
||||
_pPADStatus->button,
|
||||
|
Loading…
Reference in New Issue
Block a user