move file init

This commit is contained in:
Alex Janka 2023-03-11 20:44:55 +11:00
parent 3d5ae32960
commit 0baf6dc436

View file

@ -106,27 +106,6 @@ 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 {
rom: RomFile::Raw(
include_bytes!("../../test-roms/Tetris.gb")
.to_vec()
.to_vec(),
),
save_path: None,
no_save: true,
bootrom,
connect_serial: false,
verbose: false,
};
if let Some(ref mut vars) = self.vars { if let Some(ref mut vars) = self.vars {
let (output, rx) = AudioOutput::new( let (output, rx) = AudioOutput::new(
buffer_config.sample_rate, buffer_config.sample_rate,
@ -138,6 +117,27 @@ impl Plugin for GameboyEmu {
vars.emulator_core.replace_output(output); vars.emulator_core.replace_output(output);
vars.rx = rx; vars.rx = rx;
} else { } else {
let bootrom = if INCLUDE_BOOTROM {
Some(RomFile::Raw(
include_bytes!("../../bootrom/dmg_boot.bin").to_vec(),
))
} else {
None
};
let options = gb_emu_lib::Options {
rom: RomFile::Raw(
include_bytes!("../../test-roms/Tetris.gb")
.to_vec()
.to_vec(),
),
save_path: None,
no_save: true,
bootrom,
connect_serial: false,
verbose: false,
};
let (sender, receiver) = channel::<EmulatorMessage>(); let (sender, receiver) = channel::<EmulatorMessage>();
let (output, rx) = AudioOutput::new( let (output, rx) = AudioOutput::new(