Add option to search subfolders for iso directories

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2867 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2009-04-05 06:46:18 +00:00
parent 472e67333f
commit b19309fdb3
5 changed files with 32 additions and 1 deletions

View File

@ -62,6 +62,8 @@ void SConfig::SaveSettings()
sprintf(tmp, "GCMPath%i", (int)i);
ini.Set("General", tmp, m_ISOFolder[i]);
}
ini.Set("General", "RecersiveGCMPaths", m_RecersiveISOFolder);
}
@ -165,6 +167,8 @@ void SConfig::LoadSettings()
m_ISOFolder.push_back(tmpPath);
}
}
ini.Get("General", "RecersiveGCMPaths", &m_RecersiveISOFolder, false);
}
{

View File

@ -51,6 +51,7 @@ struct SConfig
// gcm folder
std::vector<std::string>m_ISOFolder;
bool m_RecersiveISOFolder;
SCoreStartupParameter m_LocalCoreStartupParameter;

View File

@ -75,6 +75,7 @@ EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged)
EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged)
EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths)
EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths)
EVT_CHECKBOX(ID_RECERSIVEISOPATH, CConfigMain::RecursiveDirectoryChanged)
EVT_FILEPICKER_CHANGED(ID_DEFAULTISO, CConfigMain::DefaultISOChanged)
EVT_DIRPICKER_CHANGED(ID_DVDROOT, CConfigMain::DVDRootChanged)
@ -441,7 +442,8 @@ void CConfigMain::CreateGUIControls()
AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
RemoveISOPath = new wxButton(PathsPage, ID_REMOVEISOPATH, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0);
RemoveISOPath->Enable(false);
RecersiveISOPath = new wxCheckBox(PathsPage, ID_RECERSIVEISOPATH, wxT("Search Subfolders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
RecersiveISOPath->SetValue(SConfig::GetInstance().m_RecersiveISOFolder);
DefaultISOText = new wxStaticText(PathsPage, ID_DEFAULTISO_TEXT, wxT("Default ISO:"), wxDefaultPosition, wxDefaultSize);
DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, wxT("Choose a default ISO:"),
wxString::Format(wxT("All GC/Wii images (gcm, iso, gcz)|*.gcm;*.iso;*.gcz|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr),
@ -457,6 +459,7 @@ void CConfigMain::CreateGUIControls()
sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0);
sISOButtons = new wxBoxSizer(wxHORIZONTAL);
sISOButtons->Add(RecersiveISOPath, 0, wxALL, 0);
sISOButtons->AddStretchSpacer(1);
sISOButtons->Add(AddISOPath, 0, wxALL, 0);
sISOButtons->Add(RemoveISOPath, 0, wxALL, 0);
@ -838,6 +841,12 @@ void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event)
SConfig::GetInstance().m_ISOFolder.push_back(std::string(ISOPaths->GetStrings()[i].ToAscii()));
}
void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_RecersiveISOFolder = RecersiveISOPath->IsChecked();
bRefreshList = true;
}
void CConfigMain::DefaultISOChanged(wxFileDirPickerEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM = DefaultISO->GetPath().ToAscii();

View File

@ -182,6 +182,7 @@ class CConfigMain
wxListBox* ISOPaths;
wxButton* AddISOPath;
wxButton* RemoveISOPath;
wxCheckBox* RecersiveISOPath;
wxStaticText* DefaultISOText;
wxFilePickerCtrl* DefaultISO;
wxStaticText* DVDRootText;
@ -253,6 +254,7 @@ class CConfigMain
ID_ISOPATHS,
ID_ADDISOPATH,
ID_REMOVEISOPATH,
ID_RECERSIVEISOPATH,
ID_DEFAULTISO_TEXT,
ID_DEFAULTISO,
ID_DVDROOT_TEXT,
@ -286,6 +288,7 @@ class CConfigMain
void ChooseEXIDevice(std::string deviceName, int deviceNum);
void WiiSettingsChanged(wxCommandEvent& event);
void ISOPathsSelectionChanged(wxCommandEvent& event);
void RecursiveDirectoryChanged(wxCommandEvent& event);
void AddRemoveISOPaths(wxCommandEvent& event);
void DefaultISOChanged(wxFileDirPickerEvent& event);
void DVDRootChanged(wxFileDirPickerEvent& event);

View File

@ -375,6 +375,20 @@ void CGameListCtrl::ScanForISOs()
m_ISOFiles.clear();
CFileSearch::XStringVector Directories(SConfig::GetInstance().m_ISOFolder);
if (SConfig::GetInstance().m_RecersiveISOFolder)
{
for (u32 i = 0; i < Directories.size(); i++)
{
File::FSTEntry FST_Temp;
File::ScanDirectoryTree(Directories.at(i).c_str(), FST_Temp);
for (u32 j = 0; j < FST_Temp.children.size(); j++)
{
if (FST_Temp.children.at(j).isDirectory)
Directories.push_back(FST_Temp.children.at(j).physicalName.c_str());
}
}
}
CFileSearch::XStringVector Extensions;
Extensions.push_back("*.iso");
Extensions.push_back("*.gcm");