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 strup to 10 ASCII characters
gameboy_color: GameboyColorCompatibilitygbc bit
licensee_code_new: [u8; 2]2 ASCII hex digits or zeros
super_gameboy: boolsgb bit
rom_type: RomTypehow the data after the header will be parsed
rom_size: u16How many 16KB ROM banks to use
ram_banks: u8How many RAM banks are available on the cart
ram_bank_size: u16The size of the RAM bank in bytes (normal values are 2kB and 8kB)
japanese: booljp bit
licensee_code: u8§mask_rom_version: u8§complement: u8§checksum: u16the 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 for RomHeader<'a>
impl<'a> PartialEq for RomHeader<'a>
impl<'a> Eq for RomHeader<'a>
impl<'a> StructuralPartialEq for RomHeader<'a>
Auto Trait Implementations§
impl<'a> Freeze for RomHeader<'a>
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> UnsafeUnpin 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