easily switchable bootrom

This commit is contained in:
Alex Janka 2023-03-09 10:39:00 +11:00
parent 77ee67a0fd
commit bfb895ef4c

View file

@ -33,6 +33,7 @@ type FrameReceiver = Mutex<Option<Receiver<Vec<[u8; 4]>>>>;
type JoypadSender = Mutex<Option<Sender<(JoypadButtons, bool)>>>; type JoypadSender = Mutex<Option<Sender<(JoypadButtons, bool)>>>;
const FRAMES_TO_BUFFER: usize = 1; const FRAMES_TO_BUFFER: usize = 1;
const INCLUDE_BOOTROM: bool = false;
impl Plugin for GameboyEmu { impl Plugin for GameboyEmu {
const NAME: &'static str = "Gameboy"; const NAME: &'static str = "Gameboy";
@ -104,6 +105,14 @@ impl Plugin for GameboyEmu {
buffer_config: &BufferConfig, buffer_config: &BufferConfig,
_context: &mut impl InitContext<Self>, _context: &mut impl InitContext<Self>,
) -> bool { ) -> bool {
let bootrom = if INCLUDE_BOOTROM {
Some(RomFile::Raw(
include_bytes!("../../bootrom/dmg_boot.bin").to_vec(),
))
} else {
None
};
let options = gb_emu_lib::Options { let options = gb_emu_lib::Options {
rom: RomFile::Raw( rom: RomFile::Raw(
include_bytes!("../../test-roms/Tetris.gb") include_bytes!("../../test-roms/Tetris.gb")
@ -112,9 +121,7 @@ impl Plugin for GameboyEmu {
), ),
save_path: None, save_path: None,
no_save: true, no_save: true,
bootrom: Some(RomFile::Raw( bootrom,
include_bytes!("../../bootrom/dmg_boot.bin").to_vec(),
)),
connect_serial: false, connect_serial: false,
verbose: false, verbose: false,
cycle_count: false, cycle_count: false,