Skip to main content

import_fm2

Function import_fm2 

Source
pub fn import_fm2(
    text: &str,
    rom_sha256: [u8; 32],
) -> Result<(Movie, Fm2Meta), Fm2Error>
Expand description

Parse .fm2 text into a Movie plus the leftover header Fm2Meta.

rom_sha256 is the SHA-256 of the ROM the caller intends to replay the movie against. The .fm2 format carries only an MD5 (romChecksum), so the authoritative SHA-256 ROM identity must come from the loaded ROM; it is stored verbatim on the returned Movie and is not validated here.

The returned Movie always has StartPoint::PowerOn – FCEUX note B says movies start from power-on unless a savestate key is present, and such cross-emulator save-state blobs are not portable, so a savestate header is rejected.

§Soft reset handling

The per-frame command field’s MOVIECMD_RESET bit (value 1) is parsed (so such lines do not error) but is not represented anywhere on the resulting Movie, because FrameInput has no reset bit. A reset command therefore affects neither the frame count nor playback today.

§Errors

Returns Fm2Error for a missing/wrong version, an unparseable integer header, an unsupported device or savestate start point, or a malformed input-log line (bad pipes, wrong field count, wrong pad length). Never panics on malformed input.