nJoy: Configuration bugfixes, and show the digital shoulder button status in the advanced settings to

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1945 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-01-20 06:38:29 +00:00
parent 00bca8d807
commit 6f4cbb89f9
7 changed files with 55 additions and 30 deletions

View File

@ -91,7 +91,7 @@ void ConfigBox::PadGetStatus()
int main_x_after = main_x, main_y_after = main_y;
if(g_Config.bSquareToCircle.at(notebookpage))
{
std::vector<int> main_xy = Pad_Square_to_Circle(main_x, main_y);
std::vector<int> main_xy = Pad_Square_to_Circle(main_x, main_y, notebookpage);
main_x_after = main_xy.at(0);
main_y_after = main_xy.at(1);
}
@ -130,6 +130,14 @@ void ConfigBox::PadGetStatus()
//////////////////////////////////////
// Triggers
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int TriggerValue = 255;
if (joystate[notebookpage].halfpress) TriggerValue = 100;
// Get the selected keys
long Left, Right;
m_JoyShoulderL[notebookpage]->GetValue().ToLong(&Left);
m_JoyShoulderR[notebookpage]->GetValue().ToLong(&Right);
int SDLTriggerLeft = joystate[notebookpage].axis[CTL_L_SHOULDER];
int SDLTriggerRight = joystate[notebookpage].axis[CTL_R_SHOULDER];
@ -137,8 +145,12 @@ void ConfigBox::PadGetStatus()
u8 TriggerLeft = Pad_Convert(SDLTriggerLeft, TriggerType);
u8 TriggerRight = Pad_Convert(SDLTriggerRight, TriggerType);
// Get the digital values
if(Left < 1000 && joystate[notebookpage].buttons[CTL_L_SHOULDER]) TriggerLeft = TriggerValue;
if(Right < 1000 && joystate[notebookpage].buttons[CTL_R_SHOULDER]) TriggerRight = TriggerValue;
m_TStatusTriggers[notebookpage]->SetLabel(wxString::Format(
wxT("Left:%03i Right:%03i"),
wxT("Left:%03i Right:%03i"),
TriggerLeft, TriggerRight
));
///////////////////// Triggers
@ -173,6 +185,10 @@ std::string ShowStatus(int VirtualController)
int Hats = joyinfo[PhysicalDevice].NumHats;
int Buttons = joyinfo[PhysicalDevice].NumButtons;
// More status
int controllertype = joysticks[VirtualController].controllertype;
int triggertype = joysticks[VirtualController].triggertype;
// Update the internal values
SDL_JoystickUpdate();
@ -194,13 +210,15 @@ std::string ShowStatus(int VirtualController)
}
return StringFromFormat(
"joysticks.ID: %i %i %i %i\n"
"joysticks.ID: %i %i %i %i\n"
"joysticks.controllertype, triggertype: %i %i\n"
"Handles: %i %i %i %i\n"
"Axes: %s\n"
"Hats: %s\n"
"But: %s\n"
"Device: Ax: %i Balls:%i But:%i Hats:%i",
joysticks[0].ID, joysticks[1].ID, joysticks[2].ID, joysticks[3].ID,
controllertype, triggertype,
(int)joy0, (int)joy1, (int)joy2, (int)joy3,
StrAxes.c_str(), StrHats.c_str(), StrBut.c_str(),
Axes, Balls, Hats, Buttons

View File

@ -236,10 +236,12 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event )
break;
case IDCB_MAINSTICK_DIAGONAL:
g_Config.SDiagonal = m_CoBDiagonal[notebookpage]->GetLabel().mb_str();
g_Config.SDiagonal.at(notebookpage) = m_CoBDiagonal[notebookpage]->GetLabel().mb_str();
break;
case IDCB_MAINSTICK_S_TO_C:
g_Config.bSquareToCircle.at(notebookpage) = m_CBS_to_C[notebookpage]->IsChecked();
break;
}
}
@ -268,6 +270,11 @@ void ConfigBox::UpdateGUI(int _notebookpage)
// Controller type settings
bool Hat = (joysticks[_notebookpage].controllertype == CTL_DPAD_HAT);
long Left, Right;
m_JoyShoulderL[_notebookpage]->GetValue().ToLong(&Left);
m_JoyShoulderR[_notebookpage]->GetValue().ToLong(&Right);
bool AnalogTrigger = (Left >= 1000 || Right >= 1000);
m_JoyDpadUp[_notebookpage]->Show(!Hat);
m_JoyDpadLeft[_notebookpage]->Show(!Hat);
m_JoyDpadRight[_notebookpage]->Show(!Hat);
@ -284,13 +291,15 @@ void ConfigBox::UpdateGUI(int _notebookpage)
m_bJoyDpadDown[_notebookpage]->SetToolTip(Hat ?
wxT("Select a hat by pressing the hat in any direction") : wxT(""));
m_TriggerType[_notebookpage]->Enable(AnalogTrigger);
// General settings
m_CBSaveByID[_notebookpage]->SetValue(g_Config.bSaveByID.at(_notebookpage));
m_CBSaveByIDNotice[_notebookpage]->SetValue(g_Config.bSaveByIDNotice);
m_CBShowAdvanced[_notebookpage]->SetValue(g_Config.bShowAdvanced);
// Advanced settings
m_CoBDiagonal[_notebookpage]->SetValue(wxString::FromAscii(g_Config.SDiagonal.c_str()));
m_CoBDiagonal[_notebookpage]->SetValue(wxString::FromAscii(g_Config.SDiagonal.at(_notebookpage).c_str()));
m_CBS_to_C[_notebookpage]->SetValue(g_Config.bSquareToCircle.at(_notebookpage));
// There is no FindItem in linux so this doesn't work
@ -454,7 +463,7 @@ void ConfigBox::CreateGUIControls()
// Populate all four pages
for(int i=0; i<4 ;i++)
for(int i = 0; i < 4; i++)
{
// --------------------------------------------------------------------
// Populate keys sizer
@ -623,7 +632,7 @@ void ConfigBox::CreateGUIControls()
m_TriggerType[i] = new wxComboBox(m_Controller[i], IDC_TRIGGERTYPE, wxAS_TriggerType[0], wxDefaultPosition, wxDefaultSize, wxAS_TriggerType, wxCB_READONLY);
// Populate general settings 2 (controller typ)
m_gGenSettings[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("D-Pad and Trigger"));
m_gGenSettings[i] = new wxStaticBoxSizer( wxVERTICAL, m_Controller[i], wxT("D-Pad and Analog Trigger"));
m_gGBGenSettings[i] = new wxGridBagSizer(0, 0);
m_gGBGenSettings[i]->Add(m_TSControltype[i], wxGBPosition(0, 0), wxGBSpan(1, 1), (wxTOP), 4);
m_gGBGenSettings[i]->Add(m_ControlType[i], wxGBPosition(0, 1), wxGBSpan(1, 1), (wxBOTTOM | wxLEFT), 2);
@ -649,8 +658,9 @@ void ConfigBox::CreateGUIControls()
"Use a 'hat' on your gamepad or configure a custom button for each direction."
));
m_TriggerType[i]->SetToolTip(wxT(
"You can look under 'Trigger values' in the advanced settings to see which of these modes work for your gamepad."
" If it works the unpressed to pressed range should be 0 - 255."
"This is for the analog trigger settings. You can look under 'Trigger values' in the advanced settings to see"
" which of these modes work for your gamepad. If it works correctly the unpressed to pressed range should be"
" 0 to 255."
));
m_CBSaveByID[i]->SetToolTip(wxString::Format(wxT(
"Map these settings to the selected controller device instead of to the"

View File

@ -144,7 +144,7 @@ void ConfigBox::SaveButtonMapping(int controller)
joysticks[controller].enabled = m_Joyattach[controller]->GetValue();
joysticks[controller].controllertype = m_ControlType[controller]->GetSelection();
joysticks[controller].triggertype = m_TriggerType[controller]->GetSelection();
joysticks[controller].deadzone = m_Deadzone[controller]->GetSelection();
joysticks[controller].deadzone = m_Deadzone[controller]->GetSelection();
}
@ -154,6 +154,7 @@ void ConfigBox::SaveButtonMapping(int controller)
void ConfigBox::ChangeControllertype(wxCommandEvent& event)
{
SaveButtonMapping(notebookpage);
UpdateGUI(notebookpage);
}