Display error messages when failing to compress/decompress games.
Fixes issue 4681.
This commit is contained in:
parent
32855a289c
commit
6598462aba
|
@ -296,9 +296,13 @@ bool DecompressBlobToFile(const char* infile, const char* outfile, CompressCB ca
|
|||
}
|
||||
|
||||
CompressedBlobReader* reader = CompressedBlobReader::Create(infile);
|
||||
if (!reader) return false;
|
||||
if (!reader)
|
||||
return false;
|
||||
|
||||
File::IOFile f(outfile, "wb");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
const CompressedBlobHeader &header = reader->GetHeader();
|
||||
u8* buffer = new u8[header.block_size];
|
||||
int progress_monitor = max<int>(1, header.num_blocks / 100);
|
||||
|
|
|
@ -1121,6 +1121,9 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
|||
if (browseDialog.ShowModal() != wxID_OK)
|
||||
return;
|
||||
|
||||
bool all_good = true;
|
||||
|
||||
{
|
||||
wxProgressDialog progressDialog(
|
||||
_compress ? _("Compressing ISO") : _("Decompressing ISO"),
|
||||
_("Working..."),
|
||||
|
@ -1157,7 +1160,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
|||
wxYES_NO) == wxNO)
|
||||
continue;
|
||||
|
||||
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(),
|
||||
all_good &= DiscIO::CompressFileToBlob(iso->GetFileName().c_str(),
|
||||
OutputFileName.c_str(),
|
||||
(iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0,
|
||||
16384, &MultiCompressCB, &progressDialog);
|
||||
|
@ -1185,11 +1188,16 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
|||
wxYES_NO) == wxNO)
|
||||
continue;
|
||||
|
||||
DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
|
||||
all_good &= DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
|
||||
OutputFileName.c_str(), &MultiCompressCB, &progressDialog);
|
||||
}
|
||||
m_currentItem++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!all_good)
|
||||
wxMessageBox(_("Dolphin was unable to complete the requested action."));
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
|
@ -1249,6 +1257,9 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
|
|||
_("Confirm File Overwrite"),
|
||||
wxYES_NO) == wxNO);
|
||||
|
||||
bool all_good = false;
|
||||
|
||||
{
|
||||
wxProgressDialog dialog(
|
||||
iso->IsCompressed() ? _("Decompressing ISO") : _("Compressing ISO"),
|
||||
_("Working..."),
|
||||
|
@ -1259,14 +1270,19 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
|
|||
wxPD_SMOOTH
|
||||
);
|
||||
|
||||
|
||||
if (iso->IsCompressed())
|
||||
DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
|
||||
all_good = DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
|
||||
path.char_str(), &CompressCB, &dialog);
|
||||
else
|
||||
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(),
|
||||
all_good = DiscIO::CompressFileToBlob(iso->GetFileName().c_str(),
|
||||
path.char_str(),
|
||||
(iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0,
|
||||
16384, &CompressCB, &dialog);
|
||||
}
|
||||
|
||||
if (!all_good)
|
||||
wxMessageBox(_("Dolphin was unable to complete the requested action."));
|
||||
|
||||
Update();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue