pub struct INesRom {
pub header: INesHeader,
pub prg_rom: Vec<u8>,
pub chr_rom: Vec<u8>,
}Expand description
iNES ROM file.
Fields§
§header: INesHeaderROM header
prg_rom: Vec<u8>PRG-ROM data (program code)
chr_rom: Vec<u8>CHR-ROM data (graphics)
Implementations§
Source§impl INesRom
impl INesRom
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self>
Load an iNES ROM file from disk.
§Errors
Returns an IO error if the file cannot be opened or read, or if the ROM data is invalid.
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, String>
pub fn from_bytes(data: &[u8]) -> Result<Self, String>
Parse iNES ROM from bytes.
§Errors
Returns an error if the data is too small, contains an invalid iNES header, or has invalid PRG-ROM or CHR-ROM sizes.
Sourcepub fn prg_rom_size(&self) -> usize
pub fn prg_rom_size(&self) -> usize
Get PRG-ROM size in bytes.
Sourcepub fn chr_rom_size(&self) -> usize
pub fn chr_rom_size(&self) -> usize
Get CHR-ROM size in bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for INesRom
impl RefUnwindSafe for INesRom
impl Send for INesRom
impl Sync for INesRom
impl Unpin for INesRom
impl UnwindSafe for INesRom
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