working on file drops
This commit is contained in:
parent
25eb6bf446
commit
b958366044
18
src/main.rs
18
src/main.rs
|
@ -30,6 +30,12 @@ use sdl2::messagebox::*;
|
||||||
|
|
||||||
// use cpuprofiler::PROFILER;
|
// use cpuprofiler::PROFILER;
|
||||||
|
|
||||||
|
enum GameExitMode {
|
||||||
|
QuitApplication,
|
||||||
|
NewGame(String),
|
||||||
|
Neither,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), String> {
|
fn main() -> Result<(), String> {
|
||||||
// Set up screen
|
// Set up screen
|
||||||
let sdl_context = sdl2::init()?;
|
let sdl_context = sdl2::init()?;
|
||||||
|
@ -179,10 +185,14 @@ fn process_events(event_pump: &mut EventPump, filepath: &PathBuf, cpu: &mut Cpu)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Event::DropFile{ timestamp: _t, window_id: _w, filename: f } => {
|
Event::DropFile{ timestamp: _t, window_id: _w, filename: f } => {
|
||||||
let p = Path::new(&f).to_path_buf();
|
if f.len() > 4 && &f[f.len()-4..] == ".dat" {
|
||||||
let res: Result<(), String> = load_state(cpu, &p)
|
let p = Path::new(&f).to_path_buf();
|
||||||
.or_else(|e| {println!("{}", e); Ok(())});
|
let res: Result<(), String> = load_state(cpu, &p)
|
||||||
res.unwrap();
|
.or_else(|e| {println!("{}", e); Ok(())});
|
||||||
|
res.unwrap();
|
||||||
|
} else if f.len() > 4 && &f[f.len()-4..] == ".nes" {
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue