Fix Underflow bug, and require game path in arg

This commit is contained in:
Rekai Musuka 2020-07-15 17:37:11 -05:00
parent 6fffa6fac5
commit 3bbd896e18
2 changed files with 4 additions and 3 deletions

View File

@ -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();

View File

@ -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;
}
}
}