plat: minifb: Remove junk code
Former-commit-id: ca265f5824a2b0014b81fc0d7ecd18f2bbdc18b0
This commit is contained in:
parent
ab731679ef
commit
1a5903c09c
|
@ -1,5 +1,3 @@
|
||||||
extern crate sdl2;
|
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
@ -86,7 +84,6 @@ fn main() {
|
||||||
|
|
||||||
let skip_bios = matches.occurrences_of("skip_bios") != 0;
|
let skip_bios = matches.occurrences_of("skip_bios") != 0;
|
||||||
let no_framerate_limit = matches.occurrences_of("no_framerate_limit") != 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 bios_path = Path::new(matches.value_of("bios").unwrap_or_default());
|
||||||
let rom_path = Path::new(matches.value_of("game_rom").unwrap());
|
let rom_path = Path::new(matches.value_of("game_rom").unwrap());
|
||||||
|
@ -100,8 +97,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
let cpu = cpu;
|
let cpu = cpu;
|
||||||
|
|
||||||
let sdl_context = sdl2::init().unwrap();
|
|
||||||
|
|
||||||
let minifb = Rc::new(RefCell::new(MiniFb {
|
let minifb = Rc::new(RefCell::new(MiniFb {
|
||||||
window: Window::new(
|
window: Window::new(
|
||||||
"rustboyadvance-ng",
|
"rustboyadvance-ng",
|
||||||
|
@ -126,35 +121,27 @@ fn main() {
|
||||||
minifb.clone(),
|
minifb.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if debug {
|
let frame_time = time::Duration::new(0, 1_000_000_000u32 / 60);
|
||||||
gba.cpu.set_verbose(true);
|
loop {
|
||||||
let mut debugger = Debugger::new(gba);
|
let start_time = time::Instant::now();
|
||||||
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();
|
|
||||||
|
|
||||||
gba.frame();
|
gba.frame();
|
||||||
|
|
||||||
if let Some(fps) = fps_counter.tick() {
|
if let Some(fps) = fps_counter.tick() {
|
||||||
let title = format!("{} ({} fps)", rom_name, fps);
|
let title = format!("{} ({} fps)", rom_name, fps);
|
||||||
// video.borrow_mut().set_window_title(&title);
|
// video.borrow_mut().set_window_title(&title);
|
||||||
minifb.borrow_mut().window.set_title(&title);
|
minifb.borrow_mut().window.set_title(&title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !no_framerate_limit {
|
if !no_framerate_limit {
|
||||||
let time_passed = start_time.elapsed();
|
let time_passed = start_time.elapsed();
|
||||||
let delay = frame_time.checked_sub(time_passed);
|
let delay = frame_time.checked_sub(time_passed);
|
||||||
match delay {
|
match delay {
|
||||||
None => {}
|
None => {}
|
||||||
Some(delay) => {
|
Some(delay) => {
|
||||||
::std::thread::sleep(delay);
|
::std::thread::sleep(delay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue