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>

source

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<'a> Debug for RomHeader<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de: 'a, 'a> Deserialize<'de> for RomHeader<'a>

source§

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>

source§

fn eq(&self, other: &RomHeader<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Serialize for RomHeader<'a>

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> Eq for RomHeader<'a>

source§

impl<'a> StructuralEq for RomHeader<'a>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,