Skip to main content

MovieRecorder

Struct MovieRecorder 

Source
pub struct MovieRecorder { /* private fields */ }
Expand description

Records the per-frame input stream applied to an emulator.

Usage (caller-driven, mirrors the frontend’s per-frame loop):

let mut rec = MovieRecorder::power_on(&nes);
loop {
    nes.set_buttons(0, p1);
    nes.set_buttons(1, p2);
    rec.capture(&nes); // BEFORE run_frame — captures the inputs it consumes
    nes.run_frame();
}
let movie = rec.finish();

Implementations§

Source§

impl MovieRecorder

Source

pub const fn power_on(nes: &Nes) -> Self

Begin recording a movie that starts from a fresh power-on of the ROM nes is running. The caller is responsible for power-cycling nes before the first captured frame so the recording starts from the same state a replay will reconstruct.

Source

pub fn from_current_state(nes: &Nes) -> Self

Begin recording a movie that starts from nes’s current state (a branch point). Captures a snapshot now and embeds it as the start point; the input stream is recorded from here forward.

Source

pub fn capture(&mut self, nes: &Nes)

Record the controller inputs currently held on nes. Call this each frame before Nes::run_frame, after the frontend has applied its set_buttons calls — this captures exactly the inputs the upcoming frame consumes.

Source

pub fn capture_input(&mut self, input: FrameInput)

Record an explicit frame of input (for callers that drive input programmatically rather than through set_buttons).

Source

pub const fn len(&self) -> usize

Number of frames captured so far.

Source

pub const fn is_empty(&self) -> bool

true if no frames have been captured.

Source

pub fn finish(self) -> Movie

Finish recording and produce the Movie.

Trait Implementations§

Source§

impl Clone for MovieRecorder

Source§

fn clone(&self) -> MovieRecorder

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 MovieRecorder

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.