Skip to main content

Movie

Struct Movie 

Source
pub struct Movie {
    pub region: Region,
    pub rom_sha256: [u8; 32],
    pub start: StartPoint,
    pub frames: Vec<FrameInput>,
    pub rerecord_count: u32,
}
Expand description

A complete TAS movie: a versioned header, a start point, and the per-frame input stream.

Fields§

§region: Region

Cartridge region the movie was recorded under.

§rom_sha256: [u8; 32]

Full SHA-256 of the ROM the movie was recorded against.

§start: StartPoint

Where playback begins.

§frames: Vec<FrameInput>

Per-frame controller inputs, in playback order.

§rerecord_count: u32

TAS re-record count — how many times the author re-recorded a frame (the TAS piano-roll editor’s edit tally; 0 for a straight linear recording). Round-trips through .rnm (appended after the input stream, so older readers ignore it) and the .fm2 / .bk2 rerecordCount header.

Implementations§

Source§

impl Movie

Source

pub const fn len(&self) -> usize

Number of input frames in the movie.

Source

pub const fn is_empty(&self) -> bool

true if the movie has no input frames.

Source

pub fn serialize(&self) -> Vec<u8>

Serialize the movie to its .rnm byte representation.

Deterministic: the same Movie always produces identical bytes.

Source

pub fn deserialize(bytes: &[u8]) -> Result<Self, MovieError>

Parse a .rnm movie from its byte representation.

§Errors

Returns MovieError for a bad magic, an unsupported container version, an unknown region byte, a frame width this build can’t parse, or a truncated body. Never panics on malformed input.

Source

pub fn seek_to_start(&self, nes: &mut Nes) -> Result<(), MovieError>

Rewind a running emulator to this movie’s start point, ready to replay from frame 0.

For StartPoint::PowerOn this power-cycles nes. For StartPoint::SaveState it restores the embedded snapshot. In both cases the ROM hash is checked against the movie’s recorded hash.

§Errors

Returns MovieError::RomMismatch if nes is running a different ROM, or MovieError::BadSaveState if the embedded snapshot is malformed.

Trait Implementations§

Source§

impl Clone for Movie

Source§

fn clone(&self) -> Movie

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Movie

Source§

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

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

impl PartialEq for Movie

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Movie

Source§

impl StructuralPartialEq for Movie

Auto Trait Implementations§

§

impl Freeze for Movie

§

impl RefUnwindSafe for Movie

§

impl Send for Movie

§

impl Sync for Movie

§

impl Unpin for Movie

§

impl UnsafeUnpin for Movie

§

impl UnwindSafe for Movie

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.