diff --git a/src/app.rs b/src/app.rs index 6f55039..2e0212a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -84,7 +84,7 @@ impl Application { let proxy = proxy.clone(); thread::spawn(|| process_gamepad_input(mappings, proxy)); } - Self { + let app = Self { icon, wgpu, client, @@ -106,7 +106,16 @@ impl Application { init_framebuffers: args.frame_buffers, init_registers: args.registers, init_terminal: args.terminal, + }; + if args.player2 { + app.client + .send_command(EmulatorCommand::StartSecondSim(args.rom.clone())); + + app.proxy + .send_event(UserEvent::OpenPlayer2) + .expect("Failed to open Player 2 window"); } + app } fn open(&mut self, event_loop: &ActiveEventLoop, window: Box) { diff --git a/src/config.rs b/src/config.rs index 8ca3273..c762f64 100644 --- a/src/config.rs +++ b/src/config.rs @@ -40,6 +40,9 @@ pub struct CliArgs { /// Watch ROM files for changes, automatically reload #[arg(short, long)] pub watch: bool, + /// Automatically open Player 2 for multiplayer + #[arg(long)] + pub player2: bool, } pub const COLOR_PRESETS: [[Color32; 2]; 3] = [