Make menu items functional
This commit is contained in:
+13
-5
@@ -1,4 +1,4 @@
|
||||
use std::{path::PathBuf, thread};
|
||||
use std::{path::PathBuf, process, thread};
|
||||
|
||||
use anyhow::Result;
|
||||
use app::App;
|
||||
@@ -14,16 +14,24 @@ mod shrooms_vb_core;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
rom: PathBuf,
|
||||
rom: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse();
|
||||
|
||||
let (builder, client) = EmulatorBuilder::new();
|
||||
let builder = builder.with_rom(&args.rom);
|
||||
let (mut builder, client) = EmulatorBuilder::new();
|
||||
if let Some(path) = args.rom {
|
||||
builder = builder.with_rom(&path);
|
||||
}
|
||||
thread::spawn(move || {
|
||||
let mut emulator = builder.build().unwrap();
|
||||
let mut emulator = match builder.build() {
|
||||
Ok(e) => e,
|
||||
Err(err) => {
|
||||
eprintln!("Error initializing emulator: {err}");
|
||||
process::exit(1);
|
||||
}
|
||||
};
|
||||
emulator.run();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user