Skip to main content

BoardDescription

Struct BoardDescription 

Source
#[non_exhaustive]
pub struct BoardDescription { pub mapper_id: u16, pub submapper: u8, pub mirroring: Mirroring, pub console_type: ConsoleType, pub vs_dual_system: bool, pub prg_ram_size: u32, pub chr_ram_size: u32, pub has_battery: bool, pub has_trainer: bool, pub prg_rom_len: u32, pub chr_rom_len: u32, pub nametable_wiring_bits: u8, }
Expand description

What the cartridge header told the core to build, after any load-time correction: the facts that change emulation and that a host cannot apply.

Region is not here: a movie has always recorded it in its fixed header, and netplay folds it into config_digest beside this.

#[non_exhaustive] since v3.0.0 (T-API-EXTENSIBLE): build one with BoardDescription::capture. v2.9.9 added three fields to it, each a break; a later field no longer is.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§mapper_id: u16

iNES / NES 2.0 mapper number.

§submapper: u8

NES 2.0 submapper (0 for iNES 1.0).

§mirroring: Mirroring

Header mirroring.

§console_type: ConsoleType

Console type (NES / Vs. System / PlayChoice-10 / extended).

§vs_dual_system: bool

Whether the header marks a Vs. DualSystem board.

§prg_ram_size: u32

PRG-RAM bytes (volatile + battery).

§chr_ram_size: u32

CHR-RAM bytes.

§has_battery: bool

Battery-backed save RAM present.

§has_trainer: bool

512-byte trainer present.

§prg_rom_len: u32

PRG-ROM bytes. The ROM identity hashes the body after the header, so the same body split differently between PRG and CHR (2 x 16 KiB + 4 x 8 KiB against 1 x 16 KiB + 6 x 8 KiB) shared an identity and a description until v2.9.9 (core re-audit NC-10).

§chr_rom_len: u32

CHR-ROM bytes (0 for CHR-RAM boards); see prg_rom_len.

§nametable_wiring_bits: u8

The raw header nametable bits mappers 30 and 218 wire from (rustynes_mappers::Cartridge::nametable_wiring_bits); v2.9.9.

Implementations§

Source§

impl BoardDescription

Source

pub fn capture(nes: &Nes) -> Self

The board nes was built from.

Source

pub fn first_difference(&self, other: &Self) -> Option<&'static str>

The first field that differs between self (recorded) and other (the host’s), or None when the boards agree.

Source

pub fn write_to(&self, w: &mut BinWriter)

Append the canonical encoding to w (u16 mapper, submapper, mirroring, console type, DualSystem, u32 PRG-RAM, u32 CHR-RAM, battery, trainer, and from v2.9.9 u32 PRG-ROM, u32 CHR-ROM and the wiring byte).

Source

pub fn read_from(r: &mut BinReader<'_>) -> Result<Self, OptionsDecodeError>

Decode what Self::write_to wrote. Strict, as HardwareOptions::read_from.

§Errors

A fixed description of the first malformed field, or "truncated".

Trait Implementations§

Source§

impl Clone for BoardDescription

Source§

fn clone(&self) -> BoardDescription

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BoardDescription

Source§

impl Debug for BoardDescription

Source§

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

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

impl Eq for BoardDescription

Source§

impl Hash for BoardDescription

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BoardDescription

Source§

fn eq(&self, other: &BoardDescription) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BoardDescription

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.