updates to the GameListCtrl add the option to purge the cache, and change iswii to platform (gcm, wii iso, wad)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3334 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2009-06-06 07:36:22 +00:00
parent 7e0568d7ba
commit 33a20fe564
6 changed files with 59 additions and 28 deletions

View File

@ -272,11 +272,12 @@ EVT_MENU(IDM_TOGGLE_LOGWINDOW, CFrame::OnToggleLogWindow)
EVT_MENU(IDM_TOGGLE_CONSOLE, CFrame::OnToggleConsole)
EVT_MENU(IDM_LISTDRIVES, CFrame::GameListChanged)
EVT_MENU(IDM_LISTWII, CFrame::GameListChanged)
EVT_MENU(IDM_LISTGC, CFrame::GameListChanged)
EVT_MENU(IDM_LISTJAP, CFrame::GameListChanged)
EVT_MENU(IDM_LISTPAL, CFrame::GameListChanged)
EVT_MENU(IDM_LISTUSA, CFrame::GameListChanged)
EVT_MENU(IDM_LISTWII, CFrame::GameListChanged)
EVT_MENU(IDM_LISTGC, CFrame::GameListChanged)
EVT_MENU(IDM_LISTJAP, CFrame::GameListChanged)
EVT_MENU(IDM_LISTPAL, CFrame::GameListChanged)
EVT_MENU(IDM_LISTUSA, CFrame::GameListChanged)
EVT_MENU(IDM_PURGECACHE, CFrame::GameListChanged)
EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState)
EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT10, CFrame::OnSaveState)

View File

@ -52,6 +52,7 @@ Core::GetWindowHandle().
#include "Common.h" // Common
#include "FileUtil.h"
#include "FileSearch.h"
#include "Timer.h"
#include "Setup.h"
@ -199,6 +200,8 @@ void CFrame::CreateMenu()
viewMenu->AppendCheckItem(IDM_LISTDRIVES, _T("Show Drives"));
viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives);
#endif
viewMenu->AppendSeparator();
viewMenu->Append(IDM_PURGECACHE, _T("Purge ISO Cache"));
menuBar->Append(viewMenu, _T("&View"));
// Help menu
@ -893,6 +896,20 @@ void CFrame::GameListChanged(wxCommandEvent& event)
case IDM_LISTDRIVES:
SConfig::GetInstance().m_ListDrives = event.IsChecked();
break;
case IDM_PURGECACHE:
CFileSearch::XStringVector Directories;
Directories.push_back(FULL_CACHE_DIR);
CFileSearch::XStringVector Extensions;
Extensions.push_back("*.cache");
CFileSearch FileSearch(Extensions, Directories);
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
for (u32 i = 0; i < rFilenames.size(); i++)
{
File::Delete(rFilenames[i].c_str());
}
break;
}
if (m_GameListCtrl)

View File

@ -78,7 +78,7 @@ bool operator < (const GameListItem &one, const GameListItem &other)
case CGameListCtrl::COLUMN_NOTES: return strcasecmp(one.GetDescription(indexOne).c_str(), other.GetDescription(indexOther).c_str()) < 0;
case CGameListCtrl::COLUMN_COUNTRY: return (one.GetCountry() < other.GetCountry());
case CGameListCtrl::COLUMN_SIZE: return (one.GetFileSize() < other.GetFileSize());
case CGameListCtrl::COLUMN_PLATFORM: return (one.IsWii() < other.IsWii());
case CGameListCtrl::COLUMN_PLATFORM: return (one.GetPlatform() < other.GetPlatform());
default: return strcasecmp(one.GetName(indexOne).c_str(), other.GetName(indexOther).c_str()) < 0;
}
}
@ -372,7 +372,7 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
// Country
SetItemColumnImage(_Index, COLUMN_COUNTRY, m_FlagImageIndex[rISOFile.GetCountry()]);
//Platform
SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.IsWii()]);
SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.GetPlatform()]);
// Background color
SetBackgroundColor();
@ -468,7 +468,6 @@ void CGameListCtrl::ScanForISOs()
// Update with the progress (i) and the message (msg)
bool Cont = dialog.Update(i, msg);
if (!Cont)
{
break;
@ -478,10 +477,17 @@ void CGameListCtrl::ScanForISOs()
{
bool list = true;
if (!SConfig::GetInstance().m_ListWii && ISOFile.IsWii())
list = false;
if (!SConfig::GetInstance().m_ListGC && !ISOFile.IsWii())
list = false;
switch(ISOFile.GetPlatform())
{
case GameListItem::WII_DISC:
if (!SConfig::GetInstance().m_ListWii)
list = false;
break;
default:
if (!SConfig::GetInstance().m_ListGC)
list = false;
break;
}
switch(ISOFile.GetCountry())
{
@ -581,8 +587,8 @@ int wxCALLBACK wxListCompare(long item1, long item2, long sortData)
if (iso1->GetFileSize() < iso2->GetFileSize()) return -1 *t;
return 0;
case CGameListCtrl::COLUMN_PLATFORM:
if(iso1->IsWii() > iso2->IsWii()) return 1 *t;
if(iso1->IsWii() < iso2->IsWii()) return -1 *t;
if(iso1->GetPlatform() > iso2->GetPlatform()) return 1 *t;
if(iso1->GetPlatform() < iso2->GetPlatform()) return -1 *t;
return 0;
}
@ -637,7 +643,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
wxMenu popupMenu;
popupMenu.Append(IDM_PROPERTIES, _("&Properties"));
popupMenu.AppendSeparator();
if (selected_iso->IsWii())
if (selected_iso->GetPlatform() == GameListItem::WII_DISC)
popupMenu.Append(IDM_OPENSAVEFOLDER, _("Open Wii &save folder"));
popupMenu.Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder"));
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO"));
@ -838,7 +844,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
std::string OutputFileName;
BuildCompleteFilename(OutputFileName, (const char *)browseDialog.GetPath().mb_str(wxConvUTF8), FileName);
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), OutputFileName.c_str(), iso->IsWii() ? 1 : 0, 16384, &MultiCompressCB, &progressDialog);
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), OutputFileName.c_str(), (iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0, 16384, &MultiCompressCB, &progressDialog);
}
else if (iso->IsCompressed() && !_compress)
{
@ -931,7 +937,7 @@ void CGameListCtrl::OnCompressGCM(wxCommandEvent& WXUNUSED (event))
if (iso->IsCompressed())
DiscIO::DecompressBlobToFile(iso->GetFileName().c_str(), path.char_str(), &CompressCB, &dialog);
else
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), path.char_str(), iso->IsWii() ? 1 : 0, 16384, &CompressCB, &dialog);
DiscIO::CompressFileToBlob(iso->GetFileName().c_str(), path.char_str(), (iso->GetPlatform() == GameListItem::WII_DISC) ? 1 : 0, 16384, &CompressCB, &dialog);
Update();
}

View File

@ -66,12 +66,14 @@ enum
IDM_PROPERTIES,
IDM_LOAD_WII_MENU,
IDM_LISTWAD,
IDM_LISTWII,
IDM_LISTGC,
IDM_LISTJAP,
IDM_LISTPAL,
IDM_LISTUSA,
IDM_LISTDRIVES,
IDM_PURGECACHE,
IDM_HELPABOUT, // Help menu
IDM_HELPWEBSITE,

View File

@ -32,7 +32,7 @@
#include "ChunkFile.h"
#include "../resources/no_banner.cpp"
#define CACHE_REVISION 0x108
#define CACHE_REVISION 0x109
#define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32
@ -46,7 +46,6 @@ GameListItem::GameListItem(const std::string& _rFileName)
, m_BlobCompressed(false)
, m_pImage(NULL)
, m_ImageSize(0)
, m_IsWii(false)
{
if (LoadFromCache())
@ -59,7 +58,7 @@ GameListItem::GameListItem(const std::string& _rFileName)
if (pVolume != NULL)
{
m_IsWii = DiscIO::IsVolumeWiiDisc(pVolume);
m_Platform = DiscIO::IsVolumeWiiDisc(pVolume) ? WII_DISC : GAMECUBE_DISC;
m_Company = "N/A";
for (int i = 0; i < 6; i++)
@ -71,7 +70,7 @@ GameListItem::GameListItem(const std::string& _rFileName)
m_Country = pVolume->GetCountry();
m_FileSize = File::GetSize(_rFileName.c_str());
m_VolumeSize = pVolume->GetSize();
m_UniqueID = pVolume->GetUniqueID();
m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str());
@ -99,10 +98,9 @@ GameListItem::GameListItem(const std::string& _rFileName)
m_pImage[i * 3 + 0] = (g_ImageTemp[i] & 0xFF0000) >> 16;
m_pImage[i * 3 + 1] = (g_ImageTemp[i] & 0x00FF00) >> 8;
m_pImage[i * 3 + 2] = (g_ImageTemp[i] & 0x0000FF) >> 0;
}
}
}
}
delete pBannerLoader;
}
@ -136,7 +134,6 @@ GameListItem::GameListItem(const std::string& _rFileName)
}
}
GameListItem::~GameListItem()
{
}
@ -169,7 +166,7 @@ void GameListItem::DoState(PointerWrap &p)
p.Do(m_Country);
p.Do(m_BlobCompressed);
p.DoBuffer(&m_pImage, m_ImageSize);
p.Do(m_IsWii);
p.Do(m_Platform);
}
std::string GameListItem::CreateCacheFilename()

View File

@ -35,9 +35,9 @@ public:
const std::string& GetUniqueID() const {return m_UniqueID;}
const std::string GetWiiFSPath() const;
DiscIO::IVolume::ECountry GetCountry() const {return m_Country;}
int GetPlatform() const {return m_Platform;}
const std::string& GetIssues() const {return m_Issues;}
bool IsCompressed() const {return m_BlobCompressed;}
bool IsWii() const {return m_IsWii;}
u64 GetFileSize() const {return m_FileSize;}
u64 GetVolumeSize() const {return m_VolumeSize;}
#if defined(HAVE_WX) && HAVE_WX
@ -45,6 +45,15 @@ public:
#endif
void DoState(PointerWrap &p);
enum
{
GAMECUBE_DISC = 0,
WII_DISC,
WII_WAD,
NUMBER_OF_PLATFORMS
};
private:
std::string m_FileName;
std::string m_Name[6];
@ -57,6 +66,7 @@ private:
u64 m_VolumeSize;
DiscIO::IVolume::ECountry m_Country;
int m_Platform;
#if defined(HAVE_WX) && HAVE_WX
wxImage m_Image;
@ -65,8 +75,6 @@ private:
bool m_BlobCompressed;
u8* m_pImage;
u32 m_ImageSize;
bool m_IsWii;
bool m_Platform;
bool LoadFromCache();
void SaveToCache();