Add CLI flags to open windows at startup
This commit is contained in:
+8
-22
@@ -1,7 +1,7 @@
|
||||
// hide console in release mode
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use std::{path::PathBuf, process, time::SystemTime};
|
||||
use std::{process, time::SystemTime};
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
use app::Application;
|
||||
@@ -12,7 +12,11 @@ use tracing::error;
|
||||
use tracing_subscriber::{EnvFilter, Layer, layer::SubscriberExt, util::SubscriberInitExt};
|
||||
use winit::event_loop::{ControlFlow, EventLoop};
|
||||
|
||||
use crate::{config::SimConfig, emulator::SimId, persistence::Persistence};
|
||||
use crate::{
|
||||
config::{CliArgs, SimConfig},
|
||||
emulator::SimId,
|
||||
persistence::Persistence,
|
||||
};
|
||||
|
||||
mod app;
|
||||
mod audio;
|
||||
@@ -28,18 +32,6 @@ mod persistence;
|
||||
mod profiler;
|
||||
mod window;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
/// The path to a virtual boy ROM to run.
|
||||
rom: Option<PathBuf>,
|
||||
/// Start a GDB/LLDB debug server on this port.
|
||||
#[arg(short, long)]
|
||||
debug_port: Option<u16>,
|
||||
/// Enable profiling a game
|
||||
#[arg(short, long)]
|
||||
profile: bool,
|
||||
}
|
||||
|
||||
fn init_logger() {
|
||||
let directives = std::env::var("RUST_LOG").unwrap_or("error,lemur=info".into());
|
||||
let filter = EnvFilter::builder().parse_lossy(directives);
|
||||
@@ -101,7 +93,7 @@ fn main() -> Result<()> {
|
||||
#[cfg(windows)]
|
||||
set_process_priority_to_high()?;
|
||||
|
||||
let args = Args::parse();
|
||||
let args = CliArgs::parse();
|
||||
|
||||
let persistence = Persistence::new();
|
||||
|
||||
@@ -139,12 +131,6 @@ fn main() -> Result<()> {
|
||||
let event_loop = EventLoop::with_user_event().build().unwrap();
|
||||
event_loop.set_control_flow(ControlFlow::Poll);
|
||||
let proxy = event_loop.create_proxy();
|
||||
event_loop.run_app(&mut Application::new(
|
||||
client,
|
||||
proxy,
|
||||
persistence,
|
||||
args.debug_port,
|
||||
args.profile,
|
||||
))?;
|
||||
event_loop.run_app(&mut Application::new(client, proxy, persistence, args))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user