From 66414075da5e678a82f6b292bda6626b4e294eb5 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sat, 1 May 2021 16:22:44 -0500 Subject: [PATCH] fix(ppu): fix bug when loading sprite pixels into FIFO --- src/ppu.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ppu.rs b/src/ppu.rs index e0bc839..1a03099 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -254,12 +254,12 @@ impl Ppu { }; let start = ((self.x_pos + 8) - attr.x) as usize; - let end = 8 - self.fifo.object.len(); + let end = start + (8 - self.fifo.object.len()); let x_flip = attr.flags.x_flip(); for i in start..end { - let x = if x_flip { end - i } else { i }; + let x = if x_flip { 7 - i } else { i }; let priority = attr.flags.priority(); let shade = palette.shade(tbpp.shade_id(x));