Skip to main content

import_bk2

Function import_bk2 

Source
pub fn import_bk2(
    header: &str,
    input_log: &str,
    rom_sha256: [u8; 32],
) -> Result<(Movie, Bk2Meta), Bk2Error>
Expand description

Parse the Header.txt + Input Log.txt text of a .bk2 into a Movie plus the leftover header Bk2Meta.

rom_sha256 is the SHA-256 of the ROM the caller intends to replay against. .bk2 carries only a SHA-1 (SHA1 header), so the authoritative SHA-256 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.bk2 movies start from power-on unless a StartsFromSavestate/StartsFromSaveRam flag is set, and such cross-emulator save blobs are not portable, so they are rejected. This reuses the canonical movie-import power-on alignment the .fm2 path established (a deterministic zeroed-RAM cold boot via Movie::seek_to_start), so imports never desync.

§Errors

Returns Bk2Error for a non-NES platform, an unparseable integer header, a missing LogKey:, an unsupported save-anchored start, or a malformed input-log line. Never panics on malformed input.