diff --git a/src/gpu.rs b/src/gpu.rs index 1d92f45..34a82a9 100644 --- a/src/gpu.rs +++ b/src/gpu.rs @@ -15,7 +15,7 @@ pub struct GPU { lcdc: LCDC, lcds: LCDS, ram: [u8; 0x4000], - frame_buffer: [[[u8; 3]; SCREEN_W]; SCREEN_H] + frame_buffer: [[[u8; 4]; SCREEN_W]; SCREEN_H] } bitflags! { @@ -67,7 +67,7 @@ impl GPU { lcdc: LCDC::empty(), lcds: LCDS::empty(), ram: [0; 0x4000], - frame_buffer: [[[0; 3]; SCREEN_W]; SCREEN_H] + frame_buffer: [[[0; 4]; SCREEN_W]; SCREEN_H] } } @@ -86,7 +86,7 @@ impl GPU { fn set_rgb(&mut self, x: usize, r: u8, g: u8, b: u8) { // TODO: Color mapping from CGB -> sRGB - self.frame_buffer[self.ly as usize][x] = [r, g, b]; + self.frame_buffer[self.ly as usize][x] = [r, g, b, 0xFF]; } fn draw_bg(&mut self) { diff --git a/src/main.rs b/src/main.rs index 921d66a..fe527fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,7 +59,7 @@ async fn main() -> Result<(), impl std::error::Error> { tokio::spawn(async move { let mut cpu = CPU::new(GBMode::Classic, buffer_copy); - while true { + loop { let cycles = cpu.cycle(); cpu.mem.gpu.cycle();