From 26c2dd2ec980cba42239caa9e24dded318117499 Mon Sep 17 00:00:00 2001 From: luigi__ Date: Fri, 16 Jan 2009 22:41:01 +0000 Subject: [PATCH] Fixed a possible bug with 256-color backgrounds not using extended palettes. --- desmume/src/GPU.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index a68406608..663a5018c 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -1094,7 +1094,6 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y u16 yoff; u16 x = 0; u16 xfin; - u16 palette_size_shift; u16 mosaic = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0); 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; } - palette_size_shift=0; // color: no extended palette if(dispCnt->ExBGxPalette_Enable) // color: extended palette { - palette_size_shift=8; pal = ARM9Mem.ExtPal[gpu->core][gpu->BGExtPalSlot[num]]; 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; ) { - color = T1ReadWord(pal, ((*line) + (tileentry.bits.Palette<ExBGxPalette_Enable) + color = T1ReadWord(pal, ((*line) + (tileentry.bits.Palette<<8)) << 1); + else + color = T1ReadWord(pal, (*line) << 1); + if (*line) gpu->setFinalColorBck(gpu,0,num,dst,color,x);