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: RegionCartridge region the movie was recorded under.
rom_sha256: [u8; 32]Full SHA-256 of the ROM the movie was recorded against.
start: StartPointWhere playback begins.
frames: Vec<FrameInput>Per-frame controller inputs, in playback order.
rerecord_count: u32TAS 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
impl Movie
Sourcepub fn serialize(&self) -> Vec<u8> ⓘ
pub fn serialize(&self) -> Vec<u8> ⓘ
Serialize the movie to its .rnm byte representation.
Deterministic: the same Movie always produces identical bytes.
Sourcepub fn deserialize(bytes: &[u8]) -> Result<Self, MovieError>
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.
Sourcepub fn seek_to_start(&self, nes: &mut Nes) -> Result<(), MovieError>
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.