mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-21 18:42:38 +00:00
nJoy: Fixed bug that would cause the settings to be lost when nJoy was started without any detected gamepad
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2131 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
382b4af74b
commit
60e89dfc6f
5 changed files with 32 additions and 11 deletions
|
@ -372,17 +372,22 @@ void ConfigBox::SetButtonTextAll(int id, char text[128])
|
|||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[notebookpage].ID].Name)
|
||||
SetButtonText(id, text, i);
|
||||
// Safety check to avoid crash
|
||||
if(joyinfo.size() > PadMapping[i].ID)
|
||||
if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[notebookpage].ID].Name)
|
||||
SetButtonText(id, text, i);
|
||||
};
|
||||
}
|
||||
|
||||
void ConfigBox::SaveButtonMappingAll(int Slot)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[Slot].ID].Name)
|
||||
SaveButtonMapping(i, false, Slot);
|
||||
|
||||
{
|
||||
// This can occur when no gamepad is detected
|
||||
if(joyinfo.size() > PadMapping[i].ID)
|
||||
if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[Slot].ID].Name)
|
||||
SaveButtonMapping(i, false, Slot);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigBox::UpdateGUIAll(int Slot)
|
||||
|
@ -394,8 +399,12 @@ void ConfigBox::UpdateGUIAll(int Slot)
|
|||
else
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[Slot].ID].Name)
|
||||
UpdateGUI(i);
|
||||
{
|
||||
// Safety check to avoid crash
|
||||
if(joyinfo.size() > PadMapping[i].ID)
|
||||
if (joyinfo[PadMapping[i].ID].Name == joyinfo[PadMapping[Slot].ID].Name)
|
||||
UpdateGUI(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,6 +464,13 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event )
|
|||
// Called from: CreateGUIControls(), ChangeControllertype()
|
||||
void ConfigBox::UpdateGUI(int _notebookpage)
|
||||
{
|
||||
// If there are no good pads disable the entire notebook
|
||||
if (NumGoodPads == 0)
|
||||
{
|
||||
m_Notebook->Enable(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the GUI from PadMapping[]
|
||||
UpdateGUIKeys(_notebookpage);
|
||||
|
||||
|
@ -596,7 +612,7 @@ void ConfigBox::CreateGUIControls()
|
|||
}
|
||||
else
|
||||
{
|
||||
arrayStringFor_Joyname.Add(wxString::FromAscii("No Joystick detected!"));
|
||||
arrayStringFor_Joyname.Add(wxString::FromAscii("<No Gamepad Detected>"));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue