diff --git a/frontends/sdl/src/main.rs b/frontends/sdl/src/main.rs index 8c32a93b8cfb1233e64e355234bf04460af3bc57..4c5ffefb6a87268cd41d2a922705ea981ddfe57c 100644 --- a/frontends/sdl/src/main.rs +++ b/frontends/sdl/src/main.rs @@ -784,12 +784,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 @@ -799,6 +793,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));