Fix blob type detection for game right-click menu

I forgot to update it after changing how IsCompressed() works.
Also, checking file name extensions is a bad way of checking blob types.
This commit is contained in:
JosJuice 2015-09-27 21:06:19 +02:00
parent be7e0554d2
commit 21cb13828c

View File

@ -862,10 +862,9 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
if (platform == DiscIO::IVolume::GAMECUBE_DISC || platform == DiscIO::IVolume::WII_DISC) if (platform == DiscIO::IVolume::GAMECUBE_DISC || platform == DiscIO::IVolume::WII_DISC)
{ {
if (selected_iso->IsCompressed()) if (selected_iso->GetBlobType() == DiscIO::BlobType::GCZ)
popupMenu.Append(IDM_COMPRESS_ISO, _("Decompress ISO...")); popupMenu.Append(IDM_COMPRESS_ISO, _("Decompress ISO..."));
else if (selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".ciso" && else if (selected_iso->GetBlobType() == DiscIO::BlobType::PLAIN)
selected_iso->GetFileName().substr(selected_iso->GetFileName().find_last_of(".")) != ".wbfs")
popupMenu.Append(IDM_COMPRESS_ISO, _("Compress ISO...")); popupMenu.Append(IDM_COMPRESS_ISO, _("Compress ISO..."));
wxMenuItem* changeDiscItem = popupMenu.Append(IDM_LIST_CHANGE_DISC, _("Change &Disc")); wxMenuItem* changeDiscItem = popupMenu.Append(IDM_LIST_CHANGE_DISC, _("Change &Disc"));
@ -1152,6 +1151,7 @@ void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED (event))
if (!iso) if (!iso)
return; return;
bool is_compressed = iso->GetBlobType() == DiscIO::BlobType::GCZ;
wxString path; wxString path;
std::string FileName, FilePath, FileExtension; std::string FileName, FilePath, FileExtension;
@ -1159,7 +1159,7 @@ void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED (event))
do do
{ {
if (iso->IsCompressed()) if (is_compressed)
{ {
wxString FileType; wxString FileType;
if (iso->GetPlatform() == DiscIO::IVolume::WII_DISC) if (iso->GetPlatform() == DiscIO::IVolume::WII_DISC)
@ -1200,7 +1200,7 @@ void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED (event))
{ {
wxProgressDialog dialog( wxProgressDialog dialog(
iso->IsCompressed() ? _("Decompressing ISO") : _("Compressing ISO"), is_compressed ? _("Decompressing ISO") : _("Compressing ISO"),
_("Working..."), _("Working..."),
1000, 1000,
this, this,
@ -1211,7 +1211,7 @@ void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED (event))
); );
if (iso->IsCompressed()) if (is_compressed)
all_good = DiscIO::DecompressBlobToFile(iso->GetFileName(), all_good = DiscIO::DecompressBlobToFile(iso->GetFileName(),
WxStrToStr(path), &CompressCB, &dialog); WxStrToStr(path), &CompressCB, &dialog);
else else