diff --git a/lib/src/processor/memory/mmio/gpu.rs b/lib/src/processor/memory/mmio/gpu.rs index fa7c987..f18a948 100644 --- a/lib/src/processor/memory/mmio/gpu.rs +++ b/lib/src/processor/memory/mmio/gpu.rs @@ -309,12 +309,7 @@ where self.has_window_been_enabled = false; let is_cgb_mode = self.is_cgb_mode(); if let Some(tile_window) = &mut self.tile_window { - tile_window.draw_sprite_window( - self.bg_palette, - &self.vram, - is_cgb_mode, - self.cgb_data.as_ref().map(|v| v.palettes.bg), - ); + tile_window.draw_sprite_window(self.bg_palette, &self.vram, is_cgb_mode); } } diff --git a/lib/src/processor/memory/mmio/gpu/tile_window.rs b/lib/src/processor/memory/mmio/gpu/tile_window.rs index 30d242a..d64bb3a 100644 --- a/lib/src/processor/memory/mmio/gpu/tile_window.rs +++ b/lib/src/processor/memory/mmio/gpu/tile_window.rs @@ -5,8 +5,7 @@ use crate::{ }; use super::{ - cgb::CgbPalette, - types::{BgAttributes, ColourInner, Vram, VramBank}, + types::{BgAttributes, ColourInner, Vram}, Colour, }; @@ -39,7 +38,6 @@ where palette: Palette, memory: &Vram, is_cgb_mode: bool, - cgb_data: Option, ) { for tile_y in 0..16 { self.draw_row( @@ -49,7 +47,6 @@ where palette, memory, is_cgb_mode, - cgb_data, ); } for tile_y in 0..8 { @@ -60,7 +57,6 @@ where palette, memory, is_cgb_mode, - cgb_data, ); } @@ -76,18 +72,12 @@ where palette: Palette, memory: &Vram, is_cgb_mode: bool, - cgb_data: Option, ) { for tile_x in 0..16 { let tile_num = (tile_y * 16) + tile_x; let data_begin = area.get_addr(tile_num); - let attributes = if is_cgb_mode { - memory - .get_with_bank(data_begin, VramBank::Bank1) - .map_or(BgAttributes::default(), BgAttributes::from_byte) - } else { - BgAttributes::default() - }; + let attributes = BgAttributes::default(); + for px_y in 0..8_u16 { let lsbs = memory .get_with_bank((data_begin + (px_y * 2)).unwrap(), attributes.tile_bank) @@ -109,9 +99,8 @@ where palette.map_bits(lsb, msb).0 }; - self.sprite_buffer[real_px_x + (real_px_y * TILE_WINDOW_WIDTH)] = colour - .rgb_bytes(cgb_data.map(|v| (v, attributes.palette)), is_cgb_mode) - .into(); + self.sprite_buffer[real_px_x + (real_px_y * TILE_WINDOW_WIDTH)] = + colour.rgb_bytes(None, is_cgb_mode).into(); } } }