get $CGB_BOOTROM/$DMG_BOOTROM from env

This commit is contained in:
Alex Janka 2023-05-18 11:01:18 +10:00
parent 6d0870d90d
commit 74dc5ccfb4

View file

@ -23,7 +23,7 @@ mod camera;
mod debug;
mod window;
/// Gameboy (DMG-A/B/C) emulator
/// Gameboy (DMG/CGB) emulator
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
#[command(group(ArgGroup::new("saves").args(["save","no_save"])))]
@ -128,7 +128,16 @@ impl EmulatorHandler {
} else {
SerialTarget::None
})
.with_bootrom(args.bootrom.map(RomFile::Path), args.show_bootrom)
.with_bootrom(
args.bootrom
.or(if args.dmg {
std::env::var("DMG_BOOTROM").ok()
} else {
std::env::var("CGB_BOOTROM").ok()
})
.map(RomFile::Path),
args.show_bootrom,
)
.with_no_save(args.no_save)
.with_tile_window(tile_window)
.with_cgb_mode(!args.dmg);