feat: don't embed gb boot rom in emulator

This commit is contained in:
2021-01-27 22:07:31 -06:00
parent c29c71a8c2
commit b053260c8b
3 changed files with 18 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ use super::serial::Serial;
use super::sound::Sound;
use super::timer::Timer;
use super::work_ram::{VariableWorkRAM, WorkRAM};
use std::{convert::TryInto, fs::File, io::Read};
#[derive(Debug, Clone)]
pub struct Bus {
@@ -40,9 +41,15 @@ impl Default for Bus {
}
impl Bus {
pub fn with_boot() -> Self {
pub fn with_boot(path: &str) -> Self {
let mut file = File::open(path).unwrap();
let mut buf = Vec::with_capacity(256);
file.read_to_end(&mut buf).unwrap();
let boot_rom: [u8; 256] = buf.try_into().unwrap();
Self {
boot: Some(include_bytes!("../bin/DMG_ROM.bin").to_owned()),
boot: Some(boot_rom),
..Default::default()
}
}