#define PACK_RGB32(r, g, b) \
((((r) & 0xff) << 16) | (((g) & 0xff) << 8) | ((b) & 0xff) | 0xff000000)
-#define UNPACK_R16(c) (((c) >> 9) & 0xf8)
-#define UNPACK_G16(c) (((c) >> 3) & 0xf8)
-#define UNPACK_B16(c) (((c) << 3) & 0xf8)
+#define UNPACK_R16(c) (((c) << 3) & 0xf8)
+#define UNPACK_G16(c) (((c) >> 2) & 0xf8)
+#define UNPACK_B16(c) (((c) >> 7) & 0xf8)
void present(int buf)
{
int i, npix = 240 * 160;
uint32_t *dptr = convbuf;
- uint8_t *sptr = buf ? gba_vram_lfb1 : gba_vram_lfb0;
+ uint8_t *sptr = (uint8_t*)(buf ? gba_vram_lfb1 : gba_vram_lfb0);
for(i=0; i<npix; i++) {
int idx = *sptr++;