diff --git a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp index 281c4da65c..83f65a25c9 100644 --- a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp @@ -17,6 +17,7 @@ #include "stdafx.h" #include "Common.h" +#include "FileUtil.h" #include @@ -117,6 +118,52 @@ bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFi bool CFileSystemGCWii::ExportAllFiles(const char* _rFullPath) const { + std::vector fst; + char exportName[512]; + GetFileList(fst); + + for (u64 i = 1; i < fst.size(); i++) + { + if (fst[i]->IsDirectory()) + { + sprintf(exportName, "%s/%s/", _rFullPath, fst[i]->m_FullPath); + DEBUG_LOG(DISCIO, "%s", exportName); + + if (!File::Exists(exportName)) + { + + if (!File::CreateFullPath(exportName)) + { + ERROR_LOG(DISCIO, "Could not create the path %s", exportName); + return false; + } + } + else + { + if (!File::IsDirectory(exportName)) + { + ERROR_LOG(DISCIO, "%s already exists and is not a directory", exportName); + return false; + } + DEBUG_LOG(DISCIO, "folder %s already exists", exportName); + + } + } + else + { + sprintf(exportName, "%s/%s", _rFullPath, fst[i]->m_FullPath); + DEBUG_LOG(DISCIO, "%s", exportName); + if (!File::Exists(exportName)) + { + if (!ExportFile(fst[i]->m_FullPath, exportName)) + ERROR_LOG(DISCIO, "Could not export %s", exportName); + } + else + { + DEBUG_LOG(DISCIO, "%s already exists", exportName); + } + } + } return false; } diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index e3c60c9612..c74e9f14c7 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -58,6 +58,7 @@ BEGIN_EVENT_TABLE(CISOProperties, wxDialog) EVT_TREE_ITEM_RIGHT_CLICK(ID_TREECTRL, CISOProperties::OnRightClickOnTree) EVT_MENU(IDM_EXTRACTFILE, CISOProperties::OnExtractFile) EVT_MENU(IDM_EXTRACTDIR, CISOProperties::OnExtractDir) + EVT_MENU(IDM_EXTRACTALL, CISOProperties::OnExtractAll) EVT_CHOICE(ID_LANG, CISOProperties::OnChangeBannerLang) END_EVENT_TABLE() @@ -565,6 +566,9 @@ void CISOProperties::OnRightClickOnTree(wxTreeEvent& event) ;//popupMenu.Append(IDM_EXTRACTDIR, _("Extract Directory...")); else popupMenu.Append(IDM_EXTRACTFILE, _("Extract File...")); + + if (!DiscIO::IsVolumeWiiDisc(OpenISO)) //disabled on wii until it dumps more than partition 0 + popupMenu.Append(IDM_EXTRACTALL, _("Extract All Files (!!Experimental!!)")); PopupMenu(&popupMenu); event.Skip(); @@ -615,6 +619,22 @@ void CISOProperties::OnExtractDir(wxCommandEvent& WXUNUSED (event)) { } +void CISOProperties::OnExtractAll(wxCommandEvent& WXUNUSED (event)) +{ + if(!AskYesNo("%s", "Warning! this process does not yet have a progress bar.\nDolphin will appear unresponsive until the extraction is complete\nContinue?")) + return; + wxString dirHome; + wxGetHomeDir(&dirHome); + + wxDirDialog dialog(this, _("Browse for a directory to add"), dirHome, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST); + + if (dialog.ShowModal() == wxID_OK) + { + std::string sPath(dialog.GetPath().mb_str()); + pFileSystem->ExportAllFiles(sPath.c_str()); + } +} + void CISOProperties::SetRefresh(wxCommandEvent& event) { bRefreshList = true; diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index df2ea3cb1f..b9ef585b6d 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -212,6 +212,7 @@ class CISOProperties : public wxDialog ID_MAKER, ID_COMMENT, ID_BANNER, + IDM_EXTRACTALL, IDM_EXTRACTDIR, IDM_EXTRACTFILE, IDM_BNRSAVEAS @@ -229,6 +230,7 @@ class CISOProperties : public wxDialog void OnRightClickOnTree(wxTreeEvent& event); void OnExtractFile(wxCommandEvent& event); void OnExtractDir(wxCommandEvent& event); + void OnExtractAll(wxCommandEvent& event); void SetRefresh(wxCommandEvent& event); void OnChangeBannerLang(wxCommandEvent& event);