From e9f129dbeed9b292ab4d8db1fd80122e3701e317 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Tue, 13 Apr 2021 22:55:11 -0500 Subject: [PATCH] fix(ppu): move frame/pixel buffer from the stack to the heap --- src/ppu.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ppu.rs b/src/ppu.rs index 5537ae2..ea369c4 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -29,7 +29,7 @@ pub struct Ppu { fetcher: PixelFetcher, fifo: FifoRenderer, sprite_buffer: SpriteBuffer, - frame_buf: [u8; GB_WIDTH * GB_HEIGHT * 4], + frame_buf: Box<[u8; GB_WIDTH * GB_HEIGHT * 4]>, x_pos: u8, cycles: Cycle, } @@ -314,7 +314,7 @@ impl Ppu { } pub fn copy_to_gui(&self, frame: &mut [u8]) { - frame.copy_from_slice(&self.frame_buf); + frame.copy_from_slice(self.frame_buf.as_ref()); } } @@ -323,7 +323,7 @@ impl Default for Ppu { Self { vram: Box::new([0u8; VRAM_SIZE]), cycles: 0.into(), - frame_buf: [0; GB_WIDTH * GB_HEIGHT * 4], + frame_buf: Box::new([0; GB_WIDTH * GB_HEIGHT * 4]), int: Default::default(), control: Default::default(), monochrome: Default::default(),