Jazz2::AssetPacker::Iso9660Builder class

Generates an ISO 9660 file system.

Writes the plain hierarchy and a Joliet one beside it. Both are needed: the plain one is what the bootstrap of the Dreamcast looks 1ST_READ.BIN up in, and it can only spell names in upper case out of a very small alphabet, which mangles most of the names the game's content uses; the Joliet hierarchy carries them as they really are, and that is the one KallistiOS reads whenever a disc has it.

Files are placed at the end of the volume, where a CD passes the most data per rotation under the head. A disc that is mostly empty therefore reads its content roughly twice as fast as one filled from the inside out, which is what mkdcdisc does by default and what this preserves.

Constructors, destructors, conversion operators

Iso9660Builder()
~Iso9660Builder()

Public functions

void SetSystemArea(ArrayView<const std::uint8_t> data)
Sets the 32 KB system area the volume begins with.
void SetDescriptorTemplates(ArrayView<const std::uint8_t> primary, ArrayView<const std::uint8_t> supplementary)
Sets the volume descriptors the generated ones are derived from.
void SetTrackStartLba(std::uint32_t lba)
Sets the absolute address the track carrying the volume begins at.
auto AddDirectory(StringView path, const std::uint8_t recorded[7]) -> bool
Adds an empty directory, which files added afterwards may be put in.
auto AddFileFromImage(StringView path, std::uint32_t lba, std::uint32_t size, const std::uint8_t recorded[7]) -> bool
Adds a file whose contents are copied from the volume being read.
auto AddDirectoryFromDisk(StringView path, StringView hostPath) -> bool
Adds a directory and everything below it from the file system.
auto GetRequiredSectorCount() -> std::uint32_t
Number of logical sectors the volume needs to hold everything that was added.
auto Write(ISectorSink& sink, std::uint32_t volumeSectorCount, ISectorReader& imageReader) -> bool
Lays the volume out over the specified number of sectors and writes it.

Function documentation

void Jazz2::AssetPacker::Iso9660Builder::SetDescriptorTemplates(ArrayView<const std::uint8_t> primary, ArrayView<const std::uint8_t> supplementary)

Sets the volume descriptors the generated ones are derived from.

Everything that is not a size or an address — the volume label, the publisher, the dates — is taken from these, so a rewritten disc keeps the identity of the one it was made from. The supplementary descriptor may be empty, in which case a Joliet one is derived from the primary.

bool Jazz2::AssetPacker::Iso9660Builder::Write(ISectorSink& sink, std::uint32_t volumeSectorCount, ISectorReader& imageReader)

Lays the volume out over the specified number of sectors and writes it.

Parameters
sink Receives every sector of the volume, from the first one
volumeSectorCount How long the volume is, at least GetRequiredSectorCount() sectors
imageReader Provides the sectors of files added by AddFileFromImage()