diff --git a/frontends/sdl/src/main.rs b/frontends/sdl/src/main.rs index f3afc78a9b082946d10e8b0c197c71897d991004..8782c6c48cbe6c97c0c3d26d12582b39d5cf2bc6 100644 --- a/frontends/sdl/src/main.rs +++ b/frontends/sdl/src/main.rs @@ -789,12 +789,6 @@ fn main() { // parses the provided command line arguments and uses them to // obtain structured values let args = Args::parse(); - let mode = if args.mode == "auto" { - GameBoyMode::Dmg - } else { - GameBoyMode::from_string(&args.mode) - }; - let auto_mode = args.mode == "auto"; // in case the default ROM path is provided and the file does not // exist then fails gracefully @@ -804,6 +798,15 @@ fn main() { return; } + // tries to build the target mode from the mode argument + // parsing it if it does not contain the "auto" value + let mode = if args.mode == "auto" { + GameBoyMode::Dmg + } else { + GameBoyMode::from_string(&args.mode) + }; + let auto_mode = args.mode == "auto"; + // creates a new Game Boy instance and loads both the boot ROM // and the initial game ROM to "start the engine" let mut game_boy = GameBoy::new(Some(mode));