diff --git a/src/main.rs b/src/main.rs index 982cafe..7b6496a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,8 @@ fn main() { let window = init_window(&event_loop); let mut pixels = init_pixels(&window); - let rom_path = Path::new("./games/c8games/INVADERS"); + let path = std::env::args().nth(1).expect("No Path Provided!"); + let rom_path = Path::new(&path); chip8.load_rom(rom_path).expect("Unable to load ROM"); TimerManager::start(); diff --git a/src/periph.rs b/src/periph.rs index 5e1f908..2cf8729 100644 --- a/src/periph.rs +++ b/src/periph.rs @@ -137,14 +137,14 @@ impl Timer { pub fn tick(&mut self) { if self.enabled { - self.remaining -= 1; - if self.remaining == 0 { self.enabled = false; if self.beep_enabled { Self::beep(); } + } else { + self.remaining -= 1; } } }