Adds a new column to the game control list that shows what platform the game is.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3288 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
death2droid
2009-05-27 06:41:01 +00:00
parent d195dbbe8d
commit f752853009
8 changed files with 839 additions and 2 deletions

View File

@ -39,6 +39,8 @@
#include "../resources/Flag_Italy.xpm"
#include "../resources/Flag_Japan.xpm"
#include "../resources/Flag_USA.xpm"
#include "../resources/Platform_Wii.xpm"
#include "../resources/Platform_Gamecube.xpm"
#endif // USE_XPM_BITMAPS
// ugly that this lib included code from the main
@ -76,6 +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.GetPlatform() < other.GetPlatform());
default: return strcasecmp(one.GetName(indexOne).c_str(), other.GetName(indexOther).c_str()) < 0;
}
}
@ -125,6 +128,12 @@ void CGameListCtrl::InitBitmaps()
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_JAP] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Flag_Europe_xpm));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN] = m_imageListSmall->Add(iconTemp);
m_PlatformImageIndex.resize(2);
iconTemp.CopyFromBitmap(wxBitmap(Platform_Gamecube_xpm));
m_PlatformImageIndex[0] = m_imageListSmall->Add(iconTemp);
iconTemp.CopyFromBitmap(wxBitmap(Platform_Wii_xpm));
m_PlatformImageIndex[1] = m_imageListSmall->Add(iconTemp);
}
void CGameListCtrl::BrowseForDirectory()
@ -186,15 +195,16 @@ void CGameListCtrl::Update()
InsertColumn(COLUMN_COUNTRY, _(""));
InsertColumn(COLUMN_SIZE, _("Size"));
InsertColumn(COLUMN_EMULATION_STATE, _("Emulation"));
InsertColumn(COLUMN_PLATFORM, _("Platform"));
// set initial sizes for columns
SetColumnWidth(COLUMN_BANNER, 106);
SetColumnWidth(COLUMN_TITLE, 150);
SetColumnWidth(COLUMN_COMPANY, 100);
SetColumnWidth(COLUMN_COMPANY, 130);
SetColumnWidth(COLUMN_NOTES, 150);
SetColumnWidth(COLUMN_COUNTRY, 32);
SetColumnWidth(COLUMN_EMULATION_STATE, 130);
SetColumnWidth(COLUMN_PLATFORM, 90);
// add all items
for (int i = 0; i < (int)m_ISOFiles.size(); i++)
@ -361,6 +371,7 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
// Country
SetItemColumnImage(_Index, COLUMN_COUNTRY, m_FlagImageIndex[rISOFile.GetCountry()]);
SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.GetPlatform()]);
// Background color
SetBackgroundColor();
@ -568,6 +579,10 @@ int wxCALLBACK wxListCompare(long item1, long item2, long sortData)
if (iso1->GetFileSize() > iso2->GetFileSize()) return 1 *t;
if (iso1->GetFileSize() < iso2->GetFileSize()) return -1 *t;
return 0;
case CGameListCtrl::COLUMN_PLATFORM:
if(iso1->GetPlatform() > iso2->GetPlatform()) return 1 *t;
if(iso1->GetPlatform() < iso2->GetPlatform()) return -1 *t;
return 0;
}
return 0;
@ -942,6 +957,7 @@ void CGameListCtrl::AutomaticColumnWidth()
+ GetColumnWidth(COLUMN_COUNTRY)
+ GetColumnWidth(COLUMN_SIZE)
+ GetColumnWidth(COLUMN_EMULATION_STATE)
+ GetColumnWidth(COLUMN_PLATFORM)
+ 5); // some pad to keep the horizontal scrollbar away :)
SetColumnWidth(COLUMN_TITLE, wxMax(0.3*resizable, 100));

View File

@ -50,12 +50,14 @@ public:
COLUMN_COUNTRY,
COLUMN_SIZE,
COLUMN_EMULATION_STATE,
COLUMN_PLATFORM,
NUMBER_OF_COLUMN
};
private:
std::vector<int> m_FlagImageIndex;
std::vector<int> m_PlatformImageIndex;
std::vector<GameListItem> m_ISOFiles;
// NetPlay string for the gamelist

View File

@ -47,6 +47,7 @@ GameListItem::GameListItem(const std::string& _rFileName)
, m_pImage(NULL)
, m_ImageSize(0)
, m_IsWii(false)
, m_Platform(false)
{
if (LoadFromCache())
@ -60,6 +61,8 @@ GameListItem::GameListItem(const std::string& _rFileName)
if (pVolume != NULL)
{
m_IsWii = DiscIO::IsVolumeWiiDisc(pVolume);
m_Platform = DiscIO::IsVolumeWiiDisc(pVolume);
m_Company = "N/A";
for (int i = 0; i < 6; i++)
{
@ -169,6 +172,7 @@ void GameListItem::DoState(PointerWrap &p)
p.Do(m_BlobCompressed);
p.DoBuffer(&m_pImage, m_ImageSize);
p.Do(m_IsWii);
p.Do(m_Platform);
}
std::string GameListItem::CreateCacheFilename()

View File

@ -38,6 +38,7 @@ public:
const std::string& GetIssues() const {return m_Issues;}
bool IsCompressed() const {return m_BlobCompressed;}
bool IsWii() const {return m_IsWii;}
bool GetPlatform() const {return m_Platform;}
u64 GetFileSize() const {return m_FileSize;}
u64 GetVolumeSize() const {return m_VolumeSize;}
#if defined(HAVE_WX) && HAVE_WX
@ -66,6 +67,7 @@ private:
u8* m_pImage;
u32 m_ImageSize;
bool m_IsWii;
bool m_Platform;
bool LoadFromCache();
void SaveToCache();