wram in a box

This commit is contained in:
Alex Janka 2023-10-22 13:04:19 +11:00
parent e6b4d9c254
commit 9b7e52d73f

View file

@ -26,8 +26,8 @@ pub(crate) mod rom;
#[serde_with::serde_as] #[serde_with::serde_as]
#[derive(Serialize, Deserialize, Clone)] #[derive(Serialize, Deserialize, Clone)]
pub struct Wram { pub struct Wram {
#[serde_as(as = "[_; 4096]")] #[serde_as(as = "Box<[_; 4096]>")]
bank_0: [u8; 4096], bank_0: Box<[u8; 4096]>,
banks: WramBanks, banks: WramBanks,
} }
@ -48,7 +48,7 @@ enum WramBanks {
impl Wram { impl Wram {
fn new(cgb: bool) -> Self { fn new(cgb: bool) -> Self {
Self { Self {
bank_0: [0; 4096], bank_0: Box::new([0; 4096]),
banks: if cgb { banks: if cgb {
WramBanks::Cgb { WramBanks::Cgb {
banks: Box::new([[0; 4096]; 8]), banks: Box::new([[0; 4096]; 8]),