From 85b6d50222da0fe16c33d371564a0daaf73df2fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Fri, 1 Jul 2022 11:17:49 +0100
Subject: [PATCH] fix: stack overflow issue

---
 src/ppu.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ppu.rs b/src/ppu.rs
index 5c3193c1..9c0e8ee0 100644
--- a/src/ppu.rs
+++ b/src/ppu.rs
@@ -27,7 +27,7 @@ pub const SCREEN_HEIGHT: usize = 154;
 pub struct Ppu {
     /// The 8 bit based RGBA frame buffer with the
     /// processed set of pixels ready to be displayed on screen.
-    pub frame_buffer: [u8; SCREEN_WIDTH * SCREEN_HEIGHT * RGBA_SIZE],
+    pub frame_buffer: Box<[u8; SCREEN_WIDTH * SCREEN_HEIGHT * RGBA_SIZE]>,
     /// Video dedicated memory (VRAM) where both the tiles and
     /// the sprites are going to be stored.
     pub vram: [u8; VRAM_SIZE],
@@ -69,7 +69,7 @@ pub enum PpuMode {
 impl Ppu {
     pub fn new() -> Ppu {
         Ppu {
-            frame_buffer: [0u8; SCREEN_WIDTH * SCREEN_HEIGHT * RGBA_SIZE],
+            frame_buffer: Box::new([0u8; SCREEN_WIDTH * SCREEN_HEIGHT * RGBA_SIZE]),
             vram: [0u8; VRAM_SIZE],
             hram: [0u8; HRAM_SIZE],
             tiles: [[[0u8; 8]; 8]; TILE_COUNT],
-- 
GitLab