diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2013-01-09 19:59:31 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2013-01-09 20:02:46 -0600 |
| commit | 6598462aba1e614e1ffb279c8e12976e2dab5b45 (patch) | |
| tree | 48614ffd3f6542c0bdd9a626107f5db917fedb1c /Source/Core | |
| parent | 32855a289c2be54da72e846f3b3670d3275c822a (diff) | |
Display error messages when failing to compress/decompress games.
Fixes issue 4681.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DiscIO/Src/CompressedBlob.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Src/GameListCtrl.cpp | 24 |
2 files changed, 25 insertions, 5 deletions
diff --git a/Source/Core/DiscIO/Src/CompressedBlob.cpp b/Source/Core/DiscIO/Src/CompressedBlob.cpp index 1e5077b352..48ce8f10f3 100644 --- a/Source/Core/DiscIO/Src/CompressedBlob.cpp +++ b/Source/Core/DiscIO/Src/CompressedBlob.cpp @@ -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); diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index c67ee83ed3..28051eb390 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -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(); } |
