diff --git a/src/main.rs b/src/main.rs index e17e50e..689c7e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,10 @@ use crate::display::RatatuiDisplay; use crate::emulator::Emulator; +use crate::input::CrossTermInput; use crate::sound::TerminalSound; use env_logger; +use std::env; +use std::path::PathBuf; mod display; mod emulator; @@ -12,10 +15,10 @@ mod stack; fn main() -> Result<(), anyhow::Error> { env_logger::init(); + let rom_path = PathBuf::from(env::args().skip(1).next().expect("rom path not provided.")); - let mut emulator = Emulator::new(RatatuiDisplay::new(), TerminalSound); - - emulator.emulate(String::from("./roms/3-corax+.ch8"))?; + let mut emulator = Emulator::new(RatatuiDisplay::new(), TerminalSound, CrossTermInput::new()); + emulator.emulate(rom_path.to_str().unwrap())?; Ok(()) }