summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorgigaherz <gigaherz@gmail.com>2008-09-01 15:04:59 +0000
committergigaherz <gigaherz@gmail.com>2008-09-01 15:04:59 +0000
commita7ec1a2562cf6fb7fbdfb13a4555e22c209beaca (patch)
treeb455b4f71ed43ff26a9f6b014cb4be0e2b4c5797 /Source/Core
parentb0f51a0b98cc7ce0a889055b5d040e1bbef822f3 (diff)
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
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/src/MemcardManager.cpp59
1 files 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;y<height;y++)
+ {
+ memcpy(pixelData+y*stride,data+(height-y-1)*stride,stride);
+ }
+
+ *(int*)(pdata+18) = width;
+ *(int*)(pdata+22) = height;
+ *(u32*)(pdata+34) = bytes-sizeof(hdr);
+
+ wxMemoryInputStream is(pdata, bytes);
+ wxBitmap map(wxImage(is, wxBITMAP_TYPE_BMP, -1), -1);
+
+ delete pdata;
+
+ return map;
+}
+
BEGIN_EVENT_TABLE(CMemcardManager, wxDialog)
EVT_CLOSE(CMemcardManager::OnClose)
EVT_BUTTON(ID_COPYRIGHT,CMemcardManager::CopyDeleteClick)
@@ -76,6 +128,7 @@ void CMemcardManager::CreateGUIControls()
m_MemcardList[0]->AssignImageList(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);
}
}