Skip to main content

Movie

Struct Movie 

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

A recorded TAS movie: a deterministic input log plus everything needed to reproduce the exact power-on/branch-point state it was recorded against.

Fields§

§seed: u64

The System::new seed this recording used (power-on phase alignment, docs/adr/0004) — irrelevant for a StartPoint::SaveState start (the blob already carries its own seed), but always recorded for a uniform format.

§region: Region

The cart’s region at recording time.

§rom_sha256: [u8; 32]

SHA-256 of the exact ROM byte image recorded against — the authoritative “is this the right ROM” check on replay, independent of the cart’s internal parsed representation.

§start: StartPoint

Where replay begins.

§frames: Vec<FrameInput>

The recorded per-frame input log, oldest first.

Implementations§

Source§

impl Movie

Source

pub fn verify_rom(&self, rom: &[u8]) -> Result<(), MovieError>

Verify rom is the exact byte image this movie was recorded against.

§Errors

MovieError::RomMismatch if the hash doesn’t match.

Source

pub fn seek_to_start(&self, sys: &mut System) -> Result<(), MovieError>

Put sys into this movie’s recorded starting position, ready for MoviePlayer::next_frame + System::run_frame to replay the input log.

For StartPoint::PowerOn, sys MUST already be a freshly-constructed System::new(self.seed) with the movie’s ROM installed and never yet stepped — this verifies the seed matches (a mismatch cannot possibly replay identically) and calls System::reset() to boot it. For StartPoint::SaveState, this restores the embedded blob via System::load_state (which carries its own seed).

Callers should call Self::verify_rom separately before this — sys/System retain no raw ROM bytes to hash against, so the ROM-identity check happens at the byte-image level the caller already has (e.g. the frontend’s retained ROM buffer).

§Errors

MovieError::SeedMismatch if sys’s seed doesn’t match a PowerOn movie’s recorded seed; MovieError::SaveState if an embedded save-state fails to decode/restore.

Source

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

Serialize this movie to its on-disk byte format (see the module doc for the layout).

§Panics

Panics if self.frames.len() exceeds u32::MAX (over 2 years of continuous 60fps recording) — a header count that couldn’t round-trip would silently corrupt the file.

Source

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

The inverse of Self::serialize.

§Errors

MovieError::BadMagic if bytes doesn’t lead with the expected magic; MovieError::UnsupportedVersion if the format version is newer than this build understands; MovieError::BadStartPointKind on a corrupt start-point tag; MovieError::Truncated on truncated/corrupt input.

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.