allow for extracting apploader/dol from gc/wii images without having to extract the whole fst. for now, the wii extraction just comes from partition 1.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4746 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-12-29 13:59:38 +00:00
parent 7816bc6900
commit 37b9fed89e
3 changed files with 39 additions and 4 deletions

View File

@ -118,9 +118,9 @@ bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFi
bool CFileSystemGCWii::ExportApploader(const char* _rExportFolder) const bool CFileSystemGCWii::ExportApploader(const char* _rExportFolder) const
{ {
u32 AppSize = Read32(0x2440 + 0x14) << m_OffsetShift;// apploader size u32 AppSize = Read32(0x2440 + 0x14);// apploader size
AppSize += Read32(0x2440 + 0x18) << m_OffsetShift; // + trailer size AppSize += Read32(0x2440 + 0x18); // + trailer size
AppSize += 0x20; // + header size AppSize += 0x20; // + header size
DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize); DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize);
u8* buffer = new u8[AppSize]; u8* buffer = new u8[AppSize];

View File

@ -65,6 +65,8 @@ BEGIN_EVENT_TABLE(CISOProperties, wxDialog)
EVT_MENU(IDM_EXTRACTFILE, CISOProperties::OnExtractFile) EVT_MENU(IDM_EXTRACTFILE, CISOProperties::OnExtractFile)
EVT_MENU(IDM_EXTRACTDIR, CISOProperties::OnExtractDir) EVT_MENU(IDM_EXTRACTDIR, CISOProperties::OnExtractDir)
EVT_MENU(IDM_EXTRACTALL, CISOProperties::OnExtractDir) EVT_MENU(IDM_EXTRACTALL, CISOProperties::OnExtractDir)
EVT_MENU(IDM_EXTRACTAPPLOADER, CISOProperties::OnExtractDataFromHeader)
EVT_MENU(IDM_EXTRACTDOL, CISOProperties::OnExtractDataFromHeader)
EVT_CHOICE(ID_LANG, CISOProperties::OnChangeBannerLang) EVT_CHOICE(ID_LANG, CISOProperties::OnChangeBannerLang)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -565,6 +567,9 @@ void CISOProperties::OnRightClickOnTree(wxTreeEvent& event)
popupMenu->Append(IDM_EXTRACTFILE, _("Extract File...")); popupMenu->Append(IDM_EXTRACTFILE, _("Extract File..."));
popupMenu->Append(IDM_EXTRACTALL, _("Extract All Files...")); popupMenu->Append(IDM_EXTRACTALL, _("Extract All Files..."));
popupMenu->AppendSeparator();
popupMenu->Append(IDM_EXTRACTAPPLOADER, _("Extract Apploader..."));
popupMenu->Append(IDM_EXTRACTDOL, _("Extract DOL..."));
PopupMenu(popupMenu); PopupMenu(popupMenu);
@ -634,7 +639,6 @@ void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolde
index[0] = 0; index[0] = 0;
index[1] = (u32)fst.size(); index[1] = (u32)fst.size();
// Add buttons to do this without dumping whole disc, sometime
FS->ExportApploader(_rExportFolder); FS->ExportApploader(_rExportFolder);
if (!DiscIO::IsVolumeWiiDisc(OpenISO)) if (!DiscIO::IsVolumeWiiDisc(OpenISO))
FS->ExportDOL(_rExportFolder); FS->ExportDOL(_rExportFolder);
@ -745,6 +749,34 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
ExportDir(Directory.mb_str(), Path.mb_str()); ExportDir(Directory.mb_str(), Path.mb_str());
} }
void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
{
std::vector<const DiscIO::SFileInfo *> fst;
DiscIO::IFileSystem *FS = 0;
wxString Path = wxDirSelector(wxT("Choose the folder to extract to"));
if (Path.empty())
return;
if (DiscIO::IsVolumeWiiDisc(OpenISO))
FS = WiiDisc.at(1).FileSystem;
else
FS = pFileSystem;
bool ret = false;
if (event.GetId() == IDM_EXTRACTAPPLOADER)
{
ret = FS->ExportApploader(Path.mb_str());
}
else if (event.GetId() == IDM_EXTRACTDOL)
{
ret = FS->ExportDOL(Path.mb_str());
}
if (!ret)
PanicAlert("Failed to extract to %s!", Path.mb_str());
}
void CISOProperties::SetRefresh(wxCommandEvent& event) void CISOProperties::SetRefresh(wxCommandEvent& event)
{ {
bRefreshList = true; bRefreshList = true;

View File

@ -216,6 +216,8 @@ class CISOProperties : public wxDialog
IDM_EXTRACTDIR, IDM_EXTRACTDIR,
IDM_EXTRACTALL, IDM_EXTRACTALL,
IDM_EXTRACTFILE, IDM_EXTRACTFILE,
IDM_EXTRACTAPPLOADER,
IDM_EXTRACTDOL,
IDM_BNRSAVEAS IDM_BNRSAVEAS
}; };
@ -231,6 +233,7 @@ class CISOProperties : public wxDialog
void OnRightClickOnTree(wxTreeEvent& event); void OnRightClickOnTree(wxTreeEvent& event);
void OnExtractFile(wxCommandEvent& event); void OnExtractFile(wxCommandEvent& event);
void OnExtractDir(wxCommandEvent& event); void OnExtractDir(wxCommandEvent& event);
void OnExtractDataFromHeader(wxCommandEvent& event);
void SetRefresh(wxCommandEvent& event); void SetRefresh(wxCommandEvent& event);
void OnChangeBannerLang(wxCommandEvent& event); void OnChangeBannerLang(wxCommandEvent& event);