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: u64The 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: RegionThe 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: StartPointWhere replay begins.
frames: Vec<FrameInput>The recorded per-frame input log, oldest first.
Implementations§
Source§impl Movie
impl Movie
Sourcepub fn verify_rom(&self, rom: &[u8]) -> Result<(), MovieError>
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.
Sourcepub fn seek_to_start(&self, sys: &mut System) -> Result<(), MovieError>
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.
Sourcepub fn serialize(&self) -> Vec<u8> ⓘ
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.
Sourcepub fn deserialize(bytes: &[u8]) -> Result<Self, MovieError>
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§
impl Eq for Movie
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.