From 62ce62777d6c64c38ed292cd3ac7bfeee8f7182d Mon Sep 17 00:00:00 2001 From: lif <> Date: Thu, 4 Jan 2024 22:52:18 -0800 Subject: [PATCH] fix screen edge partial sprite tile drawing in bigend --- video.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/video.cc b/video.cc index 1bbc6af..0d404b1 100644 --- a/video.cc +++ b/video.cc @@ -245,6 +245,7 @@ static inline void rend_part_tile_Nbpp(u32 bg_comb, u32 px_comb, u16 pxflg = px_comb | tilepal; const u16 *subpal = &paltbl[tilepal]; // Read packed pixel data, skip start pixels + // TODO: account for big-endian byte reversal here u32 tilepix = eswap32(*(u32*)tile_ptr); if (hflip) tilepix <<= (start * 4); else tilepix >>= (start * 4); @@ -1035,7 +1036,7 @@ static inline void render_obj_part_tile_Nbpp( for (u32 i = start; i < end; i++, dest_ptr++) { // Honor hflip by selecting bytes in the correct order u32 sel = hflip ? (7-i) : i; - u8 pval = tile_ptr[sel]; + u8 pval = tile_ptr[swizzle_b(sel)]; // Alhpa mode stacks previous value if (pval) { if (rdtype == FULLCOLOR) @@ -1059,7 +1060,7 @@ static inline void render_obj_part_tile_Nbpp( for (u32 i = start; i < end; i++, dest_ptr++) { u32 selb = hflip ? (3-i/2) : i/2; u32 seln = hflip ? ((i & 1) ^ 1) : (i & 1); - u8 pval = (tile_ptr[selb] >> (seln * 4)) & 0xF; + u8 pval = (tile_ptr[swizzle_b(selb)] >> (seln * 4)) & 0xF; const u16 *subpal = &pal[palette]; if (pval) { if (rdtype == FULLCOLOR)