Fixed a possible bug with 256-color backgrounds not using extended palettes.

This commit is contained in:
luigi__ 2009-01-16 22:41:01 +00:00
parent f035b9d331
commit 26c2dd2ec9
1 changed files with 5 additions and 4 deletions

View File

@ -1094,7 +1094,6 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
u16 yoff; u16 yoff;
u16 x = 0; u16 x = 0;
u16 xfin; u16 xfin;
u16 palette_size_shift;
u16 mosaic = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0); u16 mosaic = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0);
s8 line_dir = 1; s8 line_dir = 1;
@ -1257,10 +1256,8 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
return; return;
} }
palette_size_shift=0; // color: no extended palette
if(dispCnt->ExBGxPalette_Enable) // color: extended palette if(dispCnt->ExBGxPalette_Enable) // color: extended palette
{ {
palette_size_shift=8;
pal = ARM9Mem.ExtPal[gpu->core][gpu->BGExtPalSlot[num]]; pal = ARM9Mem.ExtPal[gpu->core][gpu->BGExtPalSlot[num]];
if(!pal) return; if(!pal) return;
} }
@ -1287,7 +1284,11 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
} }
for(; x < xfin; ) for(; x < xfin; )
{ {
color = T1ReadWord(pal, ((*line) + (tileentry.bits.Palette<<palette_size_shift)) << 1); if(dispCnt->ExBGxPalette_Enable)
color = T1ReadWord(pal, ((*line) + (tileentry.bits.Palette<<8)) << 1);
else
color = T1ReadWord(pal, (*line) << 1);
if (*line) if (*line)
gpu->setFinalColorBck(gpu,0,num,dst,color,x); gpu->setFinalColorBck(gpu,0,num,dst,color,x);