From 02a62d9103ce572d33e6c74b14f2de48846bc05e Mon Sep 17 00:00:00 2001 From: thoduv Date: Mon, 9 Jul 2007 15:44:49 +0000 Subject: [PATCH] I think this fixes the "odd offset problem" for 16 colors text bg (see sgstair's tests). (I hope I didn't broke something...) --- desmume/src/GPU.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/desmume/src/GPU.c b/desmume/src/GPU.c index 4329e667b..93f7bb8ce 100644 --- a/desmume/src/GPU.c +++ b/desmume/src/GPU.c @@ -952,10 +952,24 @@ INLINE void renderline_textBG(const GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, if(tileentry.bits.HFlip) { + u8 currLine; + line += (3 - ((xoff&7)>>1)); + + if((!(7 - (xoff & 7)) & 1)) + { + currLine = *line; + if (currLine&0xF) + { + color = T1ReadWord(pal, ((currLine&0xF) + tilePalette) << 1); + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + } + dst += 2; x++; xoff++; + line--; + } for(; x < xfin; line --) { - u8 currLine = *line; + currLine = *line; if (currLine>>4) { @@ -972,10 +986,24 @@ INLINE void renderline_textBG(const GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, dst += 2; x++; xoff++; } } else { + u8 currLine; + line += ((xoff&7)>>1); + + if(xoff & 1) + { + currLine = *line; + if (currLine>>4) + { + color = T1ReadWord(pal, ((currLine>>4) + tilePalette) << 1); + gpu->setFinalColor(gpu,0,num,dst,color,x,Y); + } + dst += 2; x++; xoff++; + line++; + } for(; x < xfin; line ++) { - u8 currLine = *line; + currLine = *line; if (currLine&0xF) {