From 1a5903c09cb137558387a91c37c5d172ad4b5fde Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Mon, 30 Dec 2019 00:28:32 +0200 Subject: [PATCH] plat: minifb: Remove junk code Former-commit-id: ca265f5824a2b0014b81fc0d7ecd18f2bbdc18b0 --- src/plat/minifb/main.rs | 49 +++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/src/plat/minifb/main.rs b/src/plat/minifb/main.rs index e84a4ca..e2a3a59 100644 --- a/src/plat/minifb/main.rs +++ b/src/plat/minifb/main.rs @@ -1,5 +1,3 @@ -extern crate sdl2; - use std::cell::RefCell; use std::rc::Rc; @@ -86,7 +84,6 @@ fn main() { let skip_bios = matches.occurrences_of("skip_bios") != 0; let no_framerate_limit = matches.occurrences_of("no_framerate_limit") != 0; - let debug = matches.occurrences_of("debug") != 0; let bios_path = Path::new(matches.value_of("bios").unwrap_or_default()); let rom_path = Path::new(matches.value_of("game_rom").unwrap()); @@ -100,8 +97,6 @@ fn main() { } let cpu = cpu; - let sdl_context = sdl2::init().unwrap(); - let minifb = Rc::new(RefCell::new(MiniFb { window: Window::new( "rustboyadvance-ng", @@ -126,35 +121,27 @@ fn main() { minifb.clone(), ); - if debug { - gba.cpu.set_verbose(true); - let mut debugger = Debugger::new(gba); - println!("starting debugger..."); - debugger.repl(matches.value_of("script_file")).unwrap(); - println!("ending debugger..."); - } else { - let frame_time = time::Duration::new(0, 1_000_000_000u32 / 60); - loop { - let start_time = time::Instant::now(); + let frame_time = time::Duration::new(0, 1_000_000_000u32 / 60); + loop { + let start_time = time::Instant::now(); - gba.frame(); + gba.frame(); - if let Some(fps) = fps_counter.tick() { - let title = format!("{} ({} fps)", rom_name, fps); - // video.borrow_mut().set_window_title(&title); - minifb.borrow_mut().window.set_title(&title); - } + if let Some(fps) = fps_counter.tick() { + let title = format!("{} ({} fps)", rom_name, fps); + // video.borrow_mut().set_window_title(&title); + minifb.borrow_mut().window.set_title(&title); + } - if !no_framerate_limit { - let time_passed = start_time.elapsed(); - let delay = frame_time.checked_sub(time_passed); - match delay { - None => {} - Some(delay) => { - ::std::thread::sleep(delay); - } - }; - } + if !no_framerate_limit { + let time_passed = start_time.elapsed(); + let delay = frame_time.checked_sub(time_passed); + match delay { + None => {} + Some(delay) => { + ::std::thread::sleep(delay); + } + }; } } }