Fixes Issue 6353 Remove extract apploader/dol from top level

This commit is contained in:
Matthew Parlane 2013-06-17 22:51:15 +12:00
parent 43a4d41889
commit 868c627876
1 changed files with 20 additions and 11 deletions

View File

@ -615,20 +615,22 @@ void CISOProperties::OnRightClickOnTree(wxTreeEvent& event)
if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0
&& m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()) && m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection())
{
popupMenu->Append(IDM_EXTRACTDIR, _("Extract Partition...")); popupMenu->Append(IDM_EXTRACTDIR, _("Extract Partition..."));
}
else if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 1) else if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 1)
popupMenu->Append(IDM_EXTRACTDIR, _("Extract Directory...")); popupMenu->Append(IDM_EXTRACTDIR, _("Extract Directory..."));
else if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 2) else if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 2)
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..."));
if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0
&& m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()) && m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection())
{ {
popupMenu->AppendSeparator();
popupMenu->Append(IDM_EXTRACTAPPLOADER, _("Extract Apploader..."));
popupMenu->Append(IDM_EXTRACTDOL, _("Extract DOL..."));
popupMenu->AppendSeparator(); popupMenu->AppendSeparator();
popupMenu->Append(IDM_CHECKINTEGRITY, _("Check Partition Integrity")); popupMenu->Append(IDM_CHECKINTEGRITY, _("Check Partition Integrity"));
} }
@ -825,19 +827,26 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
return; return;
if (DiscIO::IsVolumeWiiDisc(OpenISO)) if (DiscIO::IsVolumeWiiDisc(OpenISO))
if(WiiDisc.size() > 0) {
wxString Directory = m_Treectrl->GetItemText(m_Treectrl->GetSelection());
std::size_t partitionNum = (std::size_t)wxAtoi(Directory.Mid(Directory.find_first_of("/"), 1));
Directory.Remove(0, Directory.find_first_of("/") +1); // Remove "Partition x/"
if(WiiDisc.size() > partitionNum)
{ {
// Get the filesystem of the LAST partition // Get the filesystem of the LAST partition
FS = WiiDisc.at(WiiDisc.size() - 1).FileSystem; FS = WiiDisc.at(partitionNum).FileSystem;
} }
else else
{ {
PanicAlertT("No partitions found for: %s!", PanicAlertT("Partition doesn't exist: %lu", partitionNum);
WxStrToStr(Path).c_str());
return; return;
} }
}
else else
{
FS = pFileSystem; FS = pFileSystem;
}
bool ret = false; bool ret = false;
if (event.GetId() == IDM_EXTRACTAPPLOADER) if (event.GetId() == IDM_EXTRACTAPPLOADER)