Added code to display the first icon (I tried to display it animated, but failed).

It still uses just one imagelist, so I had to "expand" the icons to 96x32 (adding transparent pixels to the right).
Sorry I don't know how to do this better and it's 4am.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@418 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
gigaherz 2008-09-01 02:10:42 +00:00
parent f0b41b1f0d
commit ead647d422
2 changed files with 31 additions and 14 deletions

View File

@ -176,34 +176,29 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card)
m_MemcardList[card]->InsertColumn(COLUMN_BANNER, _T("Banner")); m_MemcardList[card]->InsertColumn(COLUMN_BANNER, _T("Banner"));
m_MemcardList[card]->InsertColumn(COLUMN_TITLE, _T("Title")); m_MemcardList[card]->InsertColumn(COLUMN_TITLE, _T("Title"));
m_MemcardList[card]->InsertColumn(COLUMN_COMMENT, _T("Comment")); m_MemcardList[card]->InsertColumn(COLUMN_COMMENT, _T("Comment"));
m_MemcardList[card]->InsertColumn(COLUMN_ICON, _T("Icon"));
wxImageList *list=m_MemcardList[card]->GetImageList(wxIMAGE_LIST_SMALL); wxImageList *list=m_MemcardList[card]->GetImageList(wxIMAGE_LIST_SMALL);
list->RemoveAll(); list->RemoveAll();
int nFiles = memoryCard[card]->GetNumFiles(); int nFiles = memoryCard[card]->GetNumFiles();
int *images = new int[nFiles]; int *images = new int[nFiles*2];
for(int i=0;i<nFiles;i++) for(int i=0;i<nFiles;i++)
{ {
static u32 pxdata[96*32]; static u32 pxdata[96*32];
static u8 animDelay[8]; static u8 animDelay[8];
static u32 animData[32*32*8]; static u32 animData[32*32*8];
if(memoryCard[card]->ReadBannerRGBA8(i,pxdata)) int numFrames = memoryCard[card]->ReadAnimRGBA8(i,animData,animDelay);
{
//// it looks better without alpha if(!memoryCard[card]->ReadBannerRGBA8(i,pxdata))
//for(int i=0;i<96*32;i++)
// pxdata[i]|=0xFF000000;
}
else
{ {
memset(pxdata,0,96*32*4); memset(pxdata,0,96*32*4);
int numFrames = memoryCard[card]->ReadAnimRGBA8(i,animData,animDelay);
if(numFrames>0) // just use the first one if(numFrames>0) // just use the first one
{ {
int n = numFrames/2; u32 *icdata = animData;
u32 *icdata = animData+n*32*32;
for(int y=0;y<32;y++) for(int y=0;y<32;y++)
{ {
@ -216,7 +211,22 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card)
} }
wxBitmap map((char*)pxdata,96,32,32); wxBitmap map((char*)pxdata,96,32,32);
images[i] = list->Add(map); images[i*2] = list->Add(map);
if(numFrames>0)
{
memset(pxdata,0,96*32*4);
for(int y=0;y<32;y++)
{
for(int x=0;x<32;x++)
{
pxdata[y*96+x] = animData[y*32+x];
}
}
wxBitmap icon((char*)pxdata,96,32,32);
images[i*2+1] = list->Add(icon);
}
} }
for(int i=0;i<nFiles;i++) for(int i=0;i<nFiles;i++)
@ -231,10 +241,12 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card)
m_MemcardList[card]->SetItem(index, COLUMN_BANNER, wxString::FromAscii("")); m_MemcardList[card]->SetItem(index, COLUMN_BANNER, wxString::FromAscii(""));
m_MemcardList[card]->SetItem(index, COLUMN_TITLE, wxString::FromAscii(title)); m_MemcardList[card]->SetItem(index, COLUMN_TITLE, wxString::FromAscii(title));
m_MemcardList[card]->SetItem(index, COLUMN_COMMENT, wxString::FromAscii(comment)); m_MemcardList[card]->SetItem(index, COLUMN_COMMENT, wxString::FromAscii(comment));
m_MemcardList[card]->SetItem(index, COLUMN_ICON, wxString::FromAscii(""));
if(images[i]>=0) if(images[i]>=0)
{ {
m_MemcardList[card]->SetItemImage(index, images[i]); m_MemcardList[card]->SetItemImage(index, images[i*2]);
m_MemcardList[card]->SetItemColumnImage(index, COLUMN_ICON, images[i*2+1]);
} }
} }
m_MemcardList[card]->Show(); m_MemcardList[card]->Show();

View File

@ -27,7 +27,7 @@
#include "MemoryCards/GCMemcard.h" #include "MemoryCards/GCMemcard.h"
#undef MEMCARD_MANAGER_STYLE #undef MEMCARD_MANAGER_STYLE
#define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER #define MEMCARD_MANAGER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX | wxRESIZE_BORDER | wxMAXIMIZE_BOX
class CMemcardManager class CMemcardManager
: public wxDialog : public wxDialog
@ -51,6 +51,9 @@ class CMemcardManager
wxFilePickerCtrl* m_Memcard1Path; wxFilePickerCtrl* m_Memcard1Path;
wxFilePickerCtrl* m_Memcard2Path; wxFilePickerCtrl* m_Memcard2Path;
wxListCtrl* m_MemcardList[2]; wxListCtrl* m_MemcardList[2];
wxTimer* m_Timer;
int nframe;
enum enum
{ {
@ -70,6 +73,7 @@ class CMemcardManager
COLUMN_BANNER = 0, COLUMN_BANNER = 0,
COLUMN_TITLE, COLUMN_TITLE,
COLUMN_COMMENT, COLUMN_COMMENT,
COLUMN_ICON,
NUMBER_OF_COLUMN NUMBER_OF_COLUMN
}; };
@ -80,6 +84,7 @@ class CMemcardManager
void CopyDeleteClick(wxCommandEvent& event); void CopyDeleteClick(wxCommandEvent& event);
void ReloadMemcard(const char *fileName, int card); void ReloadMemcard(const char *fileName, int card);
void OnPathChange(wxFileDirPickerEvent& event); void OnPathChange(wxFileDirPickerEvent& event);
void OnTimer(wxTimerEvent& event);
}; };
#endif #endif