From a7ec1a2562cf6fb7fbdfb13a4555e22c209beaca Mon Sep 17 00:00:00 2001 From: gigaherz Date: Mon, 1 Sep 2008 15:04:59 +0000 Subject: [PATCH] Made banners/icons show up in linux. It doesn't seem to use the right height, but I have to leave now so that will have to wait. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@425 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/src/MemcardManager.cpp | 59 +++++++++++++++++++- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinWX/src/MemcardManager.cpp b/Source/Core/DolphinWX/src/MemcardManager.cpp index 296f324eda..975ebe2375 100644 --- a/Source/Core/DolphinWX/src/MemcardManager.cpp +++ b/Source/Core/DolphinWX/src/MemcardManager.cpp @@ -19,6 +19,58 @@ #include "MemcardManager.h" +#include "wx/mstream.h" + +const u8 hdr[] = { +0x42,0x4D, +0x38,0x30,0x00,0x00, +0x00,0x00,0x00,0x00, +0x36,0x00,0x00,0x00, +0x28,0x00,0x00,0x00, +0x20,0x00,0x00,0x00, //W +0x20,0x00,0x00,0x00, //H +0x01,0x00, +0x20,0x00, +0x00,0x00,0x00,0x00, +0x02,0x30,0x00,0x00, //data size +0x12,0x0B,0x00,0x00, +0x12,0x0B,0x00,0x00, +0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00 +}; + +wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, int width, int height) +{ + int stride = (4*width); + + int bytes = (stride*height) + sizeof(hdr); + + bytes = (bytes+3)&(~3); + + u8 *pdata = new u8[bytes]; + + memset(pdata,0,bytes); + memcpy(pdata,hdr,sizeof(hdr)); + + u8 *pixelData = pdata + sizeof(hdr); + + for(int y=0;yAssignImageList(new wxImageList(96,32),wxIMAGE_LIST_SMALL); m_MemcardList[1]->AssignImageList(new wxImageList(96,32),wxIMAGE_LIST_SMALL); + m_MemcardList[0]-> // mmmm sizer goodness wxBoxSizer* sButtons; @@ -210,7 +263,7 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card) } } - wxBitmap map((char*)pxdata,96,32,32); + wxBitmap map = wxBitmapFromMemoryRGBA((u8*)pxdata,96,32); images[i*2] = list->Add(map); if(numFrames>0) @@ -224,8 +277,8 @@ void CMemcardManager::ReloadMemcard(const char *fileName, int card) } } - wxBitmap icon((char*)pxdata,96,32,32); - images[i*2+1] = list->Add(icon); + wxBitmap map = wxBitmapFromMemoryRGBA((u8*)pxdata,96,32); + images[i*2+1] = list->Add(map); } }