diff --git a/pcsx2/gui/Panels/BiosSelectorPanel.cpp b/pcsx2/gui/Panels/BiosSelectorPanel.cpp index 5b586da16b..0e1e1d8dee 100644 --- a/pcsx2/gui/Panels/BiosSelectorPanel.cpp +++ b/pcsx2/gui/Panels/BiosSelectorPanel.cpp @@ -155,24 +155,35 @@ bool Panels::BiosSelectorPanel::ValidateEnumerationStatus() m_BiosList.swap(bioslist); + int sel = m_ComboBox->GetSelection(); + if ((sel == wxNOT_FOUND) && !(m_ComboBox->IsEmpty())) + m_ComboBox->SetSelection(0); + return validated; } void Panels::BiosSelectorPanel::DoRefresh() { - if( !m_BiosList ) return; + if (!m_BiosList) return; m_ComboBox->Clear(); - const wxFileName right( g_Conf->FullpathToBios() ); + const wxFileName right(g_Conf->FullpathToBios()); + bool biosSet = false; - for( size_t i=0; iGetCount(); ++i ) + for(size_t i=0; iGetCount(); ++i) { wxString description; - if( !IsBIOS((*m_BiosList)[i], description) ) continue; + if (!IsBIOS((*m_BiosList)[i], description)) continue; int sel = m_ComboBox->Append( description, (void*)i ); - if( wxFileName((*m_BiosList)[i] ) == right ) - m_ComboBox->SetSelection( sel ); + if (wxFileName((*m_BiosList)[i] ) == right) + { + m_ComboBox->SetSelection(sel); + biosSet = true; + } } + + if ((!biosSet) && !(m_ComboBox->IsEmpty())) + m_ComboBox->SetSelection(0); } diff --git a/pcsx2/gui/Panels/PluginSelectorPanel.cpp b/pcsx2/gui/Panels/PluginSelectorPanel.cpp index 308cfdf0f9..1f039a4d35 100644 --- a/pcsx2/gui/Panels/PluginSelectorPanel.cpp +++ b/pcsx2/gui/Panels/PluginSelectorPanel.cpp @@ -579,7 +579,7 @@ bool Panels::PluginSelectorPanel::ValidateEnumerationStatus() m_FileList.swap(pluginlist); - // set the gague length a little shorter than the plugin count. 2 reasons: + // set the gauge length a little shorter than the plugin count. 2 reasons: // * some of the plugins might be duds. // * on high end machines and Win7, the statusbar lags a lot and never gets to 100% before being hidden. @@ -669,7 +669,9 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt ) // (for now we just force it to selection zero if nothing's selected) int emptyBoxes = 0; - const PluginInfo* pi = tbl_PluginInfo; do + const PluginInfo* pi = tbl_PluginInfo; + + do { const PluginsEnum_t pid = pi->id; if( m_ComponentBoxes->Get(pid).GetCount() <= 0 ) @@ -677,7 +679,7 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt ) else if( m_ComponentBoxes->Get(pid).GetSelection() == wxNOT_FOUND ) { - if( pid == PluginId_GS ) + if (pid == PluginId_GS) { int count = (int)m_ComponentBoxes->Get(pid).GetCount(); @@ -699,6 +701,48 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt ) else if( index_sse2 >= 0 ) m_ComponentBoxes->Get(pid).SetSelection( index_sse2 ); else m_ComponentBoxes->Get(pid).SetSelection( 0 ); } + else if (pid == PluginId_PAD) + { + int count = (int)m_ComponentBoxes->Get(pid).GetCount(); + + int index_lilypad = -1; + int index_onepad = -1; + int index_onepad_legacy = -1; + + for( int i = 0; i < count; i++ ) + { + auto str = m_ComponentBoxes->Get(pid).GetString(i).Lower(); + + if (str.Contains("lilypad")) index_lilypad = i; + if (str.Contains("onepad")) + { + if (str.Contains("legacy")) + index_onepad_legacy = i; + else + index_onepad = i; + } + } + + #ifdef _WIN32 + if (index_lilypad >= 0) + m_ComponentBoxes->Get(pid).SetSelection(index_lilypad); + /* else if (index_onepad >= 0) + m_ComponentBoxes->Get(pid).SetSelection(index_onepad); + else if (index_onepad_legacy >= 0) + m_ComponentBoxes->Get(pid).SetSelection(index_onepad_legacy); */ + else + m_ComponentBoxes->Get(pid).SetSelection(0); + #else + if (index_onepad >= 0) + m_ComponentBoxes->Get(pid).SetSelection(index_onepad); + else if (index_onepad_legacy >= 0) + m_ComponentBoxes->Get(pid).SetSelection(index_onepad_legacy); + else if (index_lilypad >= 0) + m_ComponentBoxes->Get(pid).SetSelection(index_lilypad); + else + m_ComponentBoxes->Get(pid).SetSelection(0); + #endif + } else m_ComponentBoxes->Get(pid).SetSelection( 0 );