more Pandora porting work

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@560 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2008-07-23 11:21:08 +00:00
parent 3a3947cd90
commit e55f0cbba1
8 changed files with 1108 additions and 265 deletions

View file

@ -1138,6 +1138,37 @@ static void BackFill(int reg7, int sh)
unsigned short HighPal[0x100];
void PicoDoHighPal555(int sh)
{
unsigned short *pal=HighPal;
int i, t;
Pico.m.dirtyPal = 0;
{
unsigned int *spal=(void *)Pico.cram;
unsigned int *dpal=(void *)HighPal;
for (i = 0x3f/2; i >= 0; i--)
#ifdef USE_BGR555
dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);
#else
dpal[i] = ((spal[i]&0x000f000f)<<12)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)>>7);
#endif
}
if (sh)
{
// shadowed pixels
for (i = 0x3f; i >= 0; i--)
pal[0x40|i] = pal[0xc0|i] = (unsigned short)((pal[i]>>1)&0x738e);
// hilighted pixels
for (i = 0x3f; i >= 0; i--) {
t=pal[i]&0xe71c;t+=0x4208;if(t&0x20)t|=0x1c;if(t&0x800)t|=0x700;if(t&0x10000)t|=0xe000;t&=0xe71c;
pal[0x80|i]=(unsigned short)t;
}
}
}
#ifndef _ASM_DRAW_C
static void FinalizeLineBGR444(int sh)
{
@ -1182,34 +1213,10 @@ static void FinalizeLineRGB555(int sh)
unsigned short *pd=DrawLineDest;
unsigned char *ps=HighCol+8;
unsigned short *pal=HighPal;
int len, i, t, dirtyPal = Pico.m.dirtyPal;
int len;
if (dirtyPal)
{
unsigned int *spal=(void *)Pico.cram;
unsigned int *dpal=(void *)HighPal;
for (i = 0x3f/2; i >= 0; i--)
#ifdef USE_BGR555
dpal[i] = ((spal[i]&0x000f000f)<< 1)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)<<4);
#else
dpal[i] = ((spal[i]&0x000f000f)<<12)|((spal[i]&0x00f000f0)<<3)|((spal[i]&0x0f000f00)>>7);
#endif
Pico.m.dirtyPal = 0;
}
if (sh)
{
if (dirtyPal) {
// shadowed pixels
for (i = 0x3f; i >= 0; i--)
pal[0x40|i] = pal[0xc0|i] = (unsigned short)((pal[i]>>1)&0x738e);
// hilighted pixels
for (i = 0x3f; i >= 0; i--) {
t=pal[i]&0xe71c;t+=0x4208;if(t&0x20)t|=0x1c;if(t&0x800)t|=0x700;if(t&0x10000)t|=0xe000;t&=0xe71c;
pal[0x80|i]=(unsigned short)t;
}
}
}
if (Pico.m.dirtyPal)
PicoDoHighPal555(sh);
if (Pico.video.reg[12]&1) {
len = 320;
@ -1220,7 +1227,7 @@ static void FinalizeLineRGB555(int sh)
{
#ifndef PSP
int mask=0xff;
int i, mask=0xff;
if (!sh && (rendstatus & PDRAW_ACC_SPRITES))
mask=0x3f; // accurate sprites, upper bits are priority stuff

View file

@ -150,6 +150,8 @@ void PicoDrawSetColorFormat(int which); // 0=BGR444, 1=RGB555, 2=8bit(HighPal pa
extern void *DrawLineDest;
#if OVERRIDE_HIGHCOL
extern unsigned char *HighCol;
#else
extern unsigned char HighCol[8+320+8];
#endif
extern int (*PicoScanBegin)(unsigned int num);
extern int (*PicoScanEnd)(unsigned int num);
@ -157,6 +159,7 @@ extern int (*PicoScanEnd)(unsigned int num);
#ifdef _ASM_DRAW_C
void vidConvCpyRGB565(void *to, void *from, int pixels);
#endif
void PicoDoHighPal555(int sh);
extern int PicoDrawMask;
#define PDRAW_LAYERB_ON (1<<2)
#define PDRAW_LAYERA_ON (1<<3)