Skip to content

Commit

Permalink
Fix more panics
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Dec 8, 2023
1 parent caddb6b commit fc0c873
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct CPU {
}

impl CPU {
pub fn new(mode: GBMode, rom: [u8; 0x10000]) -> CPU {
pub fn new(mode: GBMode, rom: Vec<u8>) -> CPU {
CPU {
reg: Registers::new(mode),
mem: MMU::new(rom),
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async fn main() -> Result<(), impl std::error::Error> {
println!("Starting \"{game_name}\"...");

// Start CPU
let mut cpu = CPU::new(GBMode::Classic, buffer.clone().try_into().unwrap());
let mut cpu = CPU::new(GBMode::Classic, buffer.clone());

while true {
cpu.cycle();
Expand Down
4 changes: 2 additions & 2 deletions src/mmu.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub struct MMU {
rom: [u8; 0x10000],
rom: Vec<u8>,
gpu: [u8; 0x2000],
wram: [u8; 0x8000],
hram: [u8; 0x7F],
Expand All @@ -8,7 +8,7 @@ pub struct MMU {
}

impl MMU {
pub fn new(rom: [u8; 0x10000]) -> MMU {
pub fn new(rom: Vec<u8>) -> MMU {
MMU {
rom,
gpu: [0; 0x2000],
Expand Down

0 comments on commit fc0c873

Please sign in to comment.