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