Clean up and fix some issues with the dialogs for compression and decompression of iso and gcm images. Also added a confirmation to overwrite existing files.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6024 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
949fec41ca
commit
2c6f851bba
|
@ -227,7 +227,7 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
|
||||||
if (inpos != 0)
|
if (inpos != 0)
|
||||||
ratio = (int)(100 * position / inpos);
|
ratio = (int)(100 * position / inpos);
|
||||||
char temp[512];
|
char temp[512];
|
||||||
sprintf(temp, "%i of %i blocks. compression ratio %i%%", i, header.num_blocks, ratio);
|
sprintf(temp, "%i of %i blocks. Compression ratio %i%%", i, header.num_blocks, ratio);
|
||||||
callback(temp, (float)i / (float)header.num_blocks, arg);
|
callback(temp, (float)i / (float)header.num_blocks, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1200,19 +1200,19 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
||||||
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
||||||
);
|
);
|
||||||
|
|
||||||
progressDialog.SetSize(wxSize(600, 180));
|
progressDialog.SetSize(wxSize(340, 180));
|
||||||
progressDialog.CenterOnParent();
|
progressDialog.CenterOnParent();
|
||||||
|
|
||||||
m_currentItem = 0;
|
m_currentItem = 0;
|
||||||
m_numberItem = GetSelectedItemCount();
|
m_numberItem = GetSelectedItemCount();
|
||||||
for (u32 i=0; i<m_numberItem; i++)
|
for (u32 i=0; i < m_numberItem; i++)
|
||||||
{
|
{
|
||||||
const GameListItem *iso = GetSelectedISO();
|
const GameListItem *iso = GetSelectedISO();
|
||||||
|
|
||||||
if (!iso->IsCompressed() && _compress)
|
if (!iso->IsCompressed() && _compress)
|
||||||
{
|
{
|
||||||
std::string FileName;
|
std::string FileName, FileExt;
|
||||||
SplitPath(iso->GetFileName(), NULL, &FileName, NULL);
|
SplitPath(iso->GetFileName(), NULL, &FileName, &FileExt);
|
||||||
m_currentFilename = FileName;
|
m_currentFilename = FileName;
|
||||||
FileName.append(".gcz");
|
FileName.append(".gcz");
|
||||||
|
|
||||||
|
@ -1221,6 +1221,14 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
||||||
(const char *)browseDialog.GetPath().mb_str(wxConvUTF8),
|
(const char *)browseDialog.GetPath().mb_str(wxConvUTF8),
|
||||||
FileName);
|
FileName);
|
||||||
|
|
||||||
|
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) &&
|
||||||
|
wxMessageBox(
|
||||||
|
_("The file ") + wxString::FromAscii(OutputFileName.c_str()) +
|
||||||
|
_(" already exists.\nDo you wish to replace it?"),
|
||||||
|
_("Confirm File Overwrite"),
|
||||||
|
wxYES_NO) == wxNO)
|
||||||
|
continue;
|
||||||
|
|
||||||
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(),
|
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,
|
||||||
|
@ -1228,8 +1236,8 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
||||||
}
|
}
|
||||||
else if (iso->IsCompressed() && !_compress)
|
else if (iso->IsCompressed() && !_compress)
|
||||||
{
|
{
|
||||||
std::string FileName;
|
std::string FileName, FileExt;
|
||||||
SplitPath(iso->GetFileName(), NULL, &FileName, NULL);
|
SplitPath(iso->GetFileName(), NULL, &FileName, &FileExt);
|
||||||
m_currentFilename = FileName;
|
m_currentFilename = FileName;
|
||||||
if (iso->GetPlatform() == GameListItem::WII_DISC)
|
if (iso->GetPlatform() == GameListItem::WII_DISC)
|
||||||
FileName.append(".iso");
|
FileName.append(".iso");
|
||||||
|
@ -1241,6 +1249,14 @@ void CGameListCtrl::CompressSelection(bool _compress)
|
||||||
(const char *)browseDialog.GetPath().mb_str(wxConvUTF8),
|
(const char *)browseDialog.GetPath().mb_str(wxConvUTF8),
|
||||||
FileName);
|
FileName);
|
||||||
|
|
||||||
|
if (wxFileExists(wxString::FromAscii(OutputFileName.c_str())) &&
|
||||||
|
wxMessageBox(
|
||||||
|
_("The file ") + wxString::FromAscii(OutputFileName.c_str()) +
|
||||||
|
_(" already exists.\nDo you wish to replace it?"),
|
||||||
|
_("Confirm File Overwrite"),
|
||||||
|
wxYES_NO) == wxNO)
|
||||||
|
continue;
|
||||||
|
|
||||||
DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
|
DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(),
|
||||||
OutputFileName.c_str(), &MultiCompressCB, &progressDialog);
|
OutputFileName.c_str(), &MultiCompressCB, &progressDialog);
|
||||||
}
|
}
|
||||||
|
@ -1261,40 +1277,44 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
|
||||||
if (!iso)
|
if (!iso)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString path, Ext;
|
wxString path;
|
||||||
|
|
||||||
std::string FileName;
|
std::string FileName, FilePath, FileExtension;
|
||||||
SplitPath(iso->GetFileName(), NULL, &FileName, NULL);
|
SplitPath(iso->GetFileName(), &FilePath, &FileName, &FileExtension);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
if (iso->IsCompressed())
|
if (iso->IsCompressed())
|
||||||
{
|
{
|
||||||
|
wxString Ext;
|
||||||
if (iso->GetPlatform() == GameListItem::WII_DISC)
|
if (iso->GetPlatform() == GameListItem::WII_DISC)
|
||||||
Ext = wxT("*.iso");
|
Ext = wxT("*.iso");
|
||||||
else
|
else
|
||||||
Ext = wxT("*.gcm");
|
Ext = wxT("*.gcm");
|
||||||
|
|
||||||
path = wxFileSelector(
|
path = wxFileSelector(
|
||||||
_T("Save decompressed ISO"),
|
_T("Save decompressed GCM/ISO"),
|
||||||
wxEmptyString, wxString(FileName.c_str(), *wxConvCurrent), wxEmptyString,
|
wxString(FilePath.c_str(), *wxConvCurrent),
|
||||||
|
wxString(FileName.c_str(), *wxConvCurrent) + Ext.After('*'),
|
||||||
|
wxEmptyString,
|
||||||
wxString::Format
|
wxString::Format
|
||||||
(
|
(
|
||||||
_T("All GC/Wii ISO files (%s)|%s|All files (%s)|%s"),
|
_T("All GC/Wii ISO files (%s)|%s|All files (%s)|%s"),
|
||||||
(char *)Ext.After('.').char_str(wxConvUTF8),
|
(wxChar *)Ext.After('.').wchar_str(),
|
||||||
(char *)Ext.char_str(wxConvUTF8),
|
(wxChar *)Ext.wchar_str(),
|
||||||
wxFileSelectorDefaultWildcardStr,
|
wxFileSelectorDefaultWildcardStr,
|
||||||
wxFileSelectorDefaultWildcardStr
|
wxFileSelectorDefaultWildcardStr
|
||||||
),
|
),
|
||||||
wxFD_SAVE,
|
wxFD_SAVE,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
if (!path)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
path = wxFileSelector(
|
path = wxFileSelector(
|
||||||
_T("Save compressed ISO"),
|
_T("Save compressed GCM/ISO"),
|
||||||
wxEmptyString, wxString(FileName.c_str(), *wxConvCurrent), wxEmptyString,
|
wxString(FilePath.c_str(), *wxConvCurrent),
|
||||||
|
wxString(FileName.c_str(), *wxConvCurrent) + _T(".gcz"),
|
||||||
|
wxEmptyString,
|
||||||
wxString::Format
|
wxString::Format
|
||||||
(
|
(
|
||||||
_T("All compressed GC/Wii ISO files (gcz)|*.gcz|All files (%s)|%s"),
|
_T("All compressed GC/Wii ISO files (gcz)|*.gcz|All files (%s)|%s"),
|
||||||
|
@ -1303,10 +1323,14 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
|
||||||
),
|
),
|
||||||
wxFD_SAVE,
|
wxFD_SAVE,
|
||||||
this);
|
this);
|
||||||
|
}
|
||||||
if (!path)
|
if (!path)
|
||||||
return;
|
return;
|
||||||
}
|
} while (wxFileExists(path) &&
|
||||||
|
wxMessageBox(
|
||||||
|
_("The file ") + path + _(" already exists.\nDo you wish to replace it?"),
|
||||||
|
_("Confirm File Overwrite"),
|
||||||
|
wxYES_NO) == wxNO);
|
||||||
|
|
||||||
wxProgressDialog dialog(iso->IsCompressed() ?
|
wxProgressDialog dialog(iso->IsCompressed() ?
|
||||||
_T("Decompressing ISO") : _T("Compressing ISO"),
|
_T("Decompressing ISO") : _T("Compressing ISO"),
|
||||||
|
@ -1320,7 +1344,7 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
|
||||||
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
||||||
);
|
);
|
||||||
|
|
||||||
dialog.SetSize(wxSize(280, 180));
|
dialog.SetSize(wxSize(340, 180));
|
||||||
dialog.CenterOnParent();
|
dialog.CenterOnParent();
|
||||||
|
|
||||||
if (iso->IsCompressed())
|
if (iso->IsCompressed())
|
||||||
|
|
Loading…
Reference in New Issue