Random access to the sectors of an ISO disc image.
More...
#include <sourceimage.h>
|
| std::expected< LocatedFile, Error > | find (const std::string &name) override |
| | Locate a file by name anywhere in the tree, ignoring case.
|
| std::expected< std::size_t, Error > | extract (const std::filesystem::path &root) |
| | Copy every file of the ISO9660 tree into a directory.
|
| std::expected< void, Error > | readSector (std::uint32_t lba, std::span< std::uint8_t, kSectorData > sector) override |
| | Read the data bytes of one sector.
|
| std::expected< std::size_t, Error > | readSectors (std::uint32_t lba, std::span< std::uint8_t > sectors) override |
| | Read the data bytes of consecutive sectors, stopping where the medium ends.
|
| std::uint32_t | volumeSectors () const override |
| | Report the sector count of the volume.
|
| virtual | ~Volume ()=default |
| | Release the medium.
|
| std::expected< std::string, Error > | bootExecutable () |
| | Read the name of the executable the disc boots.
|
|
| static std::expected< std::unique_ptr< SourceImage >, Error > | open (const std::filesystem::path &path) |
| | Open an ISO image and verify its primary volume descriptor.
|
| static std::expected< std::string, Error > | parseBoot2 (std::span< const std::uint8_t > data) |
| | Read the executable name from the text of SYSTEM.CNF.
|
| static std::uint32_t | sectorsFor (std::uint64_t size) |
| | Count the sectors that a length in bytes occupies.
|
| static std::string | upperAscii (std::string_view text) |
| | Convert the ASCII letters of a text to upper case.
|
| static std::string | lowerAscii (std::string_view text) |
| | Convert the ASCII letters of a text to lower case.
|
| static std::string | ambiguousName (std::string_view name, const std::vector< std::filesystem::path > &matches) |
| | Describe a name that several files share once case is ignored.
|
| static std::unexpected< Error > | pastEnd (std::uint32_t lba) |
| | Report that a sector lies past the end of the medium.
|
|
| using | Sector = std::array<std::uint8_t, kSectorData> |
| | The data bytes of one sector.
|
| static constexpr std::size_t | kSectorData = 2048 |
| | Data bytes in one sector.
|
| static constexpr std::uint32_t | kPvdSector = 16 |
| | Sector of the primary volume descriptor.
|
| static constexpr std::string_view | kPvdMagic = "CD001" |
| | Identifier of an ISO9660 volume descriptor.
|
| static constexpr std::string_view | kSystemCnf = "SYSTEM.CNF" |
| | Name of the boot configuration file.
|
| static constexpr std::string_view | kPalExecutable = "SCES_517.06" |
| | Executable of the European release.
|
| static constexpr std::string_view | kNtscExecutable = "SCUS_972.58" |
| | Executable of the North American release.
|
Random access to the sectors of an ISO disc image.
◆ open()
| std::expected< std::unique_ptr< SourceImage >, Error > Tools::Common::SourceImage::open |
( |
const std::filesystem::path & | path | ) |
|
|
static |
Open an ISO image and verify its primary volume descriptor.
- Parameters
-
- Returns
- The open image, or an error when the image cannot be opened, the path does not have the .iso suffix, or sector sixteen lacks the descriptor.
◆ find()
| std::expected< LocatedFile, Error > Tools::Common::SourceImage::find |
( |
const std::string & | name | ) |
|
|
overridevirtual |
Locate a file by name anywhere in the tree, ignoring case.
- Parameters
-
| name | File name without the version suffix. |
- Returns
- Extent and containing directory of the match, or an error when the file is missing, several files have the name once case is ignored, or the file spans several extents.
Implements Tools::Common::Volume.
◆ extract()
| std::expected< std::size_t, Error > Tools::Common::SourceImage::extract |
( |
const std::filesystem::path & | root | ) |
|
Copy every file of the ISO9660 tree into a directory.
Each file keeps its path and its name without the version suffix, and its modification time becomes the date of its directory record.
- Parameters
-
| root | Destination directory. It is created when missing. |
- Returns
- Number of files written, or an error when a record cannot be read, a file spans several extents, or a file cannot be written.
◆ readSector()
| std::expected< void, Error > Tools::Common::SourceImage::readSector |
( |
std::uint32_t | lba, |
|
|
std::span< std::uint8_t, kSectorData > | sector ) |
|
overridevirtual |
Read the data bytes of one sector.
- Parameters
-
| lba | Sector number. |
| sector | Destination of the 2048 data bytes. |
- Returns
- Nothing, or an error when the medium ends before the sector.
Implements Tools::Common::Volume.
◆ readSectors()
| std::expected< std::size_t, Error > Tools::Common::SourceImage::readSectors |
( |
std::uint32_t | lba, |
|
|
std::span< std::uint8_t > | sectors ) |
|
overridevirtual |
Read the data bytes of consecutive sectors, stopping where the medium ends.
- Parameters
-
| lba | First sector number. |
| sectors | Destination, a whole number of sectors long. |
- Returns
- Number of sectors read in full, or an error when a source file cannot be read.
Reimplemented from Tools::Common::Volume.
◆ volumeSectors()
| std::uint32_t Tools::Common::SourceImage::volumeSectors |
( |
| ) |
const |
|
nodiscardoverridevirtual |
Report the sector count of the volume.
- Returns
- Sectors described by the primary volume descriptor.
Implements Tools::Common::Volume.
The documentation for this class was generated from the following file: