2024-11-03 16:32:53 +00:00
|
|
|
use std::{path::PathBuf, thread};
|
|
|
|
|
|
|
|
use anyhow::Result;
|
|
|
|
use app::App;
|
|
|
|
use clap::Parser;
|
|
|
|
use emulator::Emulator;
|
|
|
|
use winit::event_loop::{ControlFlow, EventLoop};
|
|
|
|
|
|
|
|
mod app;
|
|
|
|
mod emulator;
|
|
|
|
mod renderer;
|
|
|
|
mod shrooms_vb_core;
|
|
|
|
|
|
|
|
#[derive(Parser)]
|
|
|
|
struct Args {
|
|
|
|
rom: PathBuf,
|
2024-11-02 20:18:41 +00:00
|
|
|
}
|
|
|
|
|
2024-11-03 16:32:53 +00:00
|
|
|
fn main() -> Result<()> {
|
|
|
|
let args = Args::parse();
|
2024-11-02 20:18:41 +00:00
|
|
|
|
2024-11-03 16:32:53 +00:00
|
|
|
let (mut emulator, client) = Emulator::new();
|
|
|
|
emulator.load_rom(&args.rom)?;
|
|
|
|
thread::spawn(move || {
|
|
|
|
emulator.run();
|
|
|
|
});
|
2024-11-02 20:18:41 +00:00
|
|
|
|
|
|
|
let event_loop = EventLoop::new().unwrap();
|
|
|
|
event_loop.set_control_flow(ControlFlow::Poll);
|
2024-11-03 16:32:53 +00:00
|
|
|
event_loop.run_app(&mut App::new(client))?;
|
|
|
|
Ok(())
|
2024-11-02 20:18:41 +00:00
|
|
|
}
|