Experimental support for dumping all files from a gcm

supports partition 0 on wii discs (disabled) and will fail on dir structures that are too deep
no progress bar yet, so it looks like dolphin does not respond while dumping

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4254 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2009-09-12 09:09:47 +00:00
parent 674334f53e
commit e31cc7d1fe
3 changed files with 69 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "stdafx.h"
#include "Common.h"
#include "FileUtil.h"
#include <string>
@ -117,6 +118,52 @@ bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFi
bool CFileSystemGCWii::ExportAllFiles(const char* _rFullPath) const
{
std::vector<const SFileInfo *> 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;
}

View File

@ -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;

View File

@ -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);