chore: print cartridge info in stderr
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
48e81ff426
commit
4f3fc3136d
|
@ -21,9 +21,12 @@ impl Cartridge {
|
||||||
let mut rom = File::open(path)?;
|
let mut rom = File::open(path)?;
|
||||||
rom.read_to_end(&mut memory)?;
|
rom.read_to_end(&mut memory)?;
|
||||||
|
|
||||||
|
let title = Self::find_title(&memory);
|
||||||
|
eprintln!("Cartridge Title: {:?}", title);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
mbc: Self::detect_mbc(&memory),
|
mbc: Self::detect_mbc(&memory),
|
||||||
title: Self::find_title(&memory),
|
title,
|
||||||
memory,
|
memory,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -34,6 +37,10 @@ impl Cartridge {
|
||||||
let mbc_kind = Self::find_mbc(memory);
|
let mbc_kind = Self::find_mbc(memory);
|
||||||
let ram_byte_count = ram_size.len();
|
let ram_byte_count = ram_size.len();
|
||||||
|
|
||||||
|
eprintln!("Cartridge Ram Size: {} bytes", ram_size.len());
|
||||||
|
eprintln!("Cartridge ROM Size: {} bytes", bank_count.size());
|
||||||
|
eprintln!("MBC Type: {:?}", mbc_kind);
|
||||||
|
|
||||||
match mbc_kind {
|
match mbc_kind {
|
||||||
MbcKind::None => Box::new(NoMbc {}),
|
MbcKind::None => Box::new(NoMbc {}),
|
||||||
MbcKind::Mbc1 => {
|
MbcKind::Mbc1 => {
|
||||||
|
@ -478,7 +485,7 @@ impl Default for BankCount {
|
||||||
|
|
||||||
impl BankCount {
|
impl BankCount {
|
||||||
// https://hacktix.github.io/GBEDG/mbcs/#rom-size
|
// https://hacktix.github.io/GBEDG/mbcs/#rom-size
|
||||||
fn to_byte_count(self) -> u32 {
|
fn size(self) -> u32 {
|
||||||
use BankCount::*;
|
use BankCount::*;
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
|
|
|
@ -17,6 +17,8 @@ pub fn init(boot_path: Option<&str>, rom_path: &str) -> Result<SM83> {
|
||||||
None => SM83::new(),
|
None => SM83::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
eprintln!("Initialized GB Emulator");
|
||||||
|
|
||||||
cpu.load_cartridge(rom_path)?;
|
cpu.load_cartridge(rom_path)?;
|
||||||
Ok(cpu)
|
Ok(cpu)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue