Struct gameboy_rom::header::RomHeader
source · pub struct RomHeader<'a> {Show 15 fields
pub begin_code_execution_point: &'a [u8],
pub scrolling_graphic: &'a [u8],
pub game_title: &'a str,
pub gameboy_color: GameboyColorCompatibility,
pub licensee_code_new: [u8; 2],
pub super_gameboy: bool,
pub rom_type: RomType,
pub rom_size: u16,
pub ram_banks: u8,
pub ram_bank_size: u16,
pub japanese: bool,
pub licensee_code: u8,
pub mask_rom_version: u8,
pub complement: u8,
pub checksum: u16,
}
Expand description
Metadata about the ROM
Fields§
§begin_code_execution_point: &'a [u8]
§scrolling_graphic: &'a [u8]
Logo at the start, should match Nintendo Logo
game_title: &'a str
up to 10 ASCII characters
gameboy_color: GameboyColorCompatibility
gbc bit
licensee_code_new: [u8; 2]
2 ASCII hex digits or zeros
super_gameboy: bool
sgb bit
rom_type: RomType
how the data after the header will be parsed
rom_size: u16
How many 16KB ROM banks to use
ram_banks: u8
How many RAM banks are available on the cart
ram_bank_size: u16
The size of the RAM bank in bytes (normal values are 2kB and 8kB)
japanese: bool
jp bit
licensee_code: u8
§mask_rom_version: u8
§complement: u8
§checksum: u16
the sum of all bytes in the ROM except these two bytes, truncated to 2 bytes
Implementations§
source§impl<'a> RomHeader<'a>
impl<'a> RomHeader<'a>
sourcepub fn validate(&self) -> Result<(), HeaderValidationError>
pub fn validate(&self) -> Result<(), HeaderValidationError>
checks that the ROM header is internally consistent. warning: this doesn’t guarantee that the entire ROM header is well formed TODO: consider parsing into unvalidated form (just segmented bytes and then doing a translation step…)
Trait Implementations§
source§impl<'de: 'a, 'a> Deserialize<'de> for RomHeader<'a>
impl<'de: 'a, 'a> Deserialize<'de> for RomHeader<'a>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'a> PartialEq<RomHeader<'a>> for RomHeader<'a>
impl<'a> PartialEq<RomHeader<'a>> for RomHeader<'a>
impl<'a> Eq for RomHeader<'a>
impl<'a> StructuralEq for RomHeader<'a>
impl<'a> StructuralPartialEq for RomHeader<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for RomHeader<'a>
impl<'a> Send for RomHeader<'a>
impl<'a> Sync for RomHeader<'a>
impl<'a> Unpin for RomHeader<'a>
impl<'a> UnwindSafe for RomHeader<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more