diff options
| author | LPFaint99 <lpfaint99@gmail.com> | 2009-09-13 09:03:38 +0000 |
|---|---|---|
| committer | LPFaint99 <lpfaint99@gmail.com> | 2009-09-13 09:03:38 +0000 |
| commit | be702ce75064577c744524902c6c6db1ba7a67b2 (patch) | |
| tree | 4c5f281b4f546055fa6e10855ef4e8d12f086102 /Source/Core/DiscIO/Src/FileSystemGCWii.cpp | |
| parent | 512053fa5e06e20ed63e32aa30429a55a02e7d67 (diff) | |
patch by Daco for extracting directory contents from a gcm (which also allows dumping an entire partion other than 0 from a wii disc)
plus a small fix for File::GetSize log
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4258 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DiscIO/Src/FileSystemGCWii.cpp')
| -rw-r--r-- | Source/Core/DiscIO/Src/FileSystemGCWii.cpp | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp index 83f65a25c9..04885c6904 100644 --- a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp @@ -115,18 +115,44 @@ bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFi delete[] buffer; return false; } - -bool CFileSystemGCWii::ExportAllFiles(const char* _rFullPath) const +bool CFileSystemGCWii::ExportDir(const char* _rFullPath, const char* _rExportFolder) const { std::vector<const SFileInfo *> fst; - char exportName[512]; GetFileList(fst); - - for (u64 i = 1; i < fst.size(); i++) + char exportName[512]; + //look for the dir we are going to extract + u32 index[2]; + if (!_rFullPath) + { + //extract all + index[0] = 0; + index[1] = fst.size(); + } + else + { + for(index[0] = 0; index[0] < fst.size();index[0]++) + { + // Note By DacoTaco : i wonder why it doesn't work with just the _rFullPath + if (fst.at(index[0])->m_FullPath == FindFileInfo(_rFullPath)->m_FullPath ) + { + DEBUG_LOG(DISCIO,"Found the Dir at %u",index[0]); + break; + } + } + //now to get the index of last file + index[1] = index[0]; + while(index[1] < fst.at(index[0])->m_FileSize) + { + index[1]++; + } + DEBUG_LOG(DISCIO,"Dir found from %u to %u\nextracting to:\n%s",index[0],index[1],_rExportFolder); + } + //extraction + for (int i = index[0]; i < index[1];i++) { if (fst[i]->IsDirectory()) { - sprintf(exportName, "%s/%s/", _rFullPath, fst[i]->m_FullPath); + sprintf(exportName, "%s/%s/", _rExportFolder, fst[i]->m_FullPath); DEBUG_LOG(DISCIO, "%s", exportName); if (!File::Exists(exportName)) @@ -151,7 +177,7 @@ bool CFileSystemGCWii::ExportAllFiles(const char* _rFullPath) const } else { - sprintf(exportName, "%s/%s", _rFullPath, fst[i]->m_FullPath); + sprintf(exportName, "%s/%s", _rExportFolder, fst[i]->m_FullPath); DEBUG_LOG(DISCIO, "%s", exportName); if (!File::Exists(exportName)) { |
