psp port runs, bad colors

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@275 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-10-15 20:50:37 +00:00
parent 2951214ea6
commit 703e4c7bbb
10 changed files with 744 additions and 67 deletions

View file

@ -1,7 +1,15 @@
#if defined(__GP2X__) || defined(PSP)
#include <stdio.h>
#define lprintf printf
#if defined(__GP2X__)
#include <stdio.h>
#define lprintf printf
#elif defined(PSP)
#if 0
#include <stdio.h>
#define lprintf printf
#else
extern void lprintf_f(const char *fmt, ...);
#define lprintf lprintf_f
#endif
#else
#include "giz.h"
#include "giz.h"
#endif

View file

@ -164,7 +164,12 @@ static int parse_hex_color(char *buff)
{
char *endp = buff;
int t = (int) strtoul(buff, &endp, 16);
if (endp != buff) return ((t>>8)&0xf800) | ((t>>5)&0x07e0) | ((t>>3)&0x1f);
if (endp != buff)
#ifdef PSP
return ((t<<8)&0xf800) | ((t>>5)&0x07e0) | ((t>>19)&0x1f);
#else
return ((t>>8)&0xf800) | ((t>>5)&0x07e0) | ((t>>3)&0x1f);
#endif
return -1;
}

View file

@ -80,7 +80,11 @@ void readpng(void *dest, const char *fname, readpng_what what)
int len = width;
while (len--)
{
*dst++ = ((src[0]&0xf8)<<8) | ((src[1]&0xf8)<<3) | (src[2] >> 3);
#ifdef PSP
*dst++ = ((src[2]&0xf8)<<8) | ((src[1]&0xf8)<<3) | (src[0] >> 3); // BGR
#else
*dst++ = ((src[0]&0xf8)<<8) | ((src[1]&0xf8)<<3) | (src[2] >> 3); // RGB
#endif
src += 3;
}
dst += BG_WIDTH - width;