pub struct MoviePlayer { /* private fields */ }Expand description
Replays a recorded Movie’s input log against a System already positioned at its start
point (via Movie::seek_to_start).
Owns the Movie (rather than borrowing it) specifically so a long-lived host — the
frontend’s per-frame drive, holding a player across many real frames — can store one without
a self-referential lifetime; Self::movie hands it back if the caller needs it afterward
(e.g. to re-verify the ROM hash, or to inspect how many frames were recorded).
Implementations§
Source§impl MoviePlayer
impl MoviePlayer
Sourcepub fn next_frame(&mut self) -> Option<FrameInput>
pub fn next_frame(&mut self) -> Option<FrameInput>
Advance the playback cursor and return the next recorded frame’s input, or None if the
movie is exhausted (the caller should stop).
Deliberately does NOT touch a System/Bus itself (unlike an earlier design) — a host
that drives input through its own abstraction (e.g. rustysnes-frontend’s EmuCore:: set_pad, which EmuCore::run_frame re-applies from its OWN retained pad state every
call) needs to feed the returned FrameInput through THAT abstraction, not have this
reach around it and write Bus::set_joypad directly — the two would race for who “wins”
depending on call order. A caller working with a bare System directly (as the
determinism-replay test does) can just call sys.bus.set_joypad(0, f.p1) /
set_joypad(1, f.p2) itself with the returned value.
Sourcepub const fn frames_remaining(&self) -> usize
pub const fn frames_remaining(&self) -> usize
Frames not yet applied.
Sourcepub const fn is_finished(&self) -> bool
pub const fn is_finished(&self) -> bool
Whether every recorded frame has been applied.