resonance 1.0.1
Loading...
Searching...
No Matches
Tools::BuildImage::ImageBuilder Class Reference

Writer of a raw MODE2/2352 image of a volume with replaced files. More...

#include <imagebuilder.h>

Public Member Functions

std::expected< std::uint32_t, Error > write (const std::filesystem::path &output)
 Encode the raw image, write its cue sheet, and check the replaced extents.

Static Public Member Functions

static std::expected< ImageBuilder, Error > plan (Volume &source, std::vector< Replacement > replacements)
 Place each payload and collect the sectors that change.

Detailed Description

Writer of a raw MODE2/2352 image of a volume with replaced files.

A payload fitting its original extent overwrites the extent with zero padding. A larger payload moves to sectors appended after the volume, and the volume size grows with it. Either way the directory record of the file gets the payload's extent, its size, and its modification time. Each directory above the file, up to the root, is raised to that time when it is older, and the primary volume descriptor's modification date becomes the root directory's date when that is newer. Every other date is copied from the input. Every output sector is encoded afresh as a Mode 2 Form 1 data sector, and a two-second postgap follows the volume.

Member Function Documentation

◆ plan()

std::expected< ImageBuilder, Error > Tools::BuildImage::ImageBuilder::plan ( Volume & source,
std::vector< Replacement > replacements )
static

Place each payload and collect the sectors that change.

Parameters
sourceOpen original image or disc root. It must outlive the builder.
replacementsPayloads in placement order.
Returns
The planned image, or an error when a target is missing or its directory record cannot be patched.

◆ write()

std::expected< std::uint32_t, Error > Tools::BuildImage::ImageBuilder::write ( const std::filesystem::path & output)

Encode the raw image, write its cue sheet, and check the replaced extents.

Parameters
outputDestination cue sheet path. The image is written beside it with a .bin suffix.
Returns
Sectors in the output image, including the postgap, or an error when the source ends early, a file cannot be written, a replaced extent does not open with its payload, or the directory record of a replaced file does not have the payload's extent, size, and date.

The documentation for this class was generated from the following file: