From d05e2eb3d639c3974c25d90a1bbf636726710d68 Mon Sep 17 00:00:00 2001 From: kub Date: Tue, 9 Nov 2021 23:33:45 +0100 Subject: [PATCH] sms renderer, fix unaligned bg-filled tiles --- pico/mode4.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pico/mode4.c b/pico/mode4.c index 3827875d..54440e38 100644 --- a/pico/mode4.c +++ b/pico/mode4.c @@ -60,8 +60,14 @@ static int CollisionDetect(u8 *mb, u16 sx, unsigned int pack, int zoomed) static void TileBGM4(u16 sx, int pal) { - u32 *pd = (u32 *)(Pico.est.HighCol + sx); - pd[0] = pd[1] = pal * 0x01010101; + if (sx & 3) { + u8 *pd = (u8 *)(Pico.est.HighCol + sx); + pd[0] = pd[1] = pd[2] = pd[3] = pal; + pd[4] = pd[5] = pd[6] = pd[7] = pal; + } else { + u32 *pd = (u32 *)(Pico.est.HighCol + sx); + pd[0] = pd[1] = pal * 0x01010101; + } } // 8 pixels are arranged in 4 bitplane bytes in a 32 bit word. To pull the -- 2.39.5