openMSX
Classes | Enumerations | Functions
openmsx::DiskImageUtils Namespace Reference

Classes

struct  CHS
 
struct  FatTimeDate
 
struct  SetBootSectorResult
 

Enumerations

enum class  PartitionTableType { SUNRISE_IDE , NEXTOR }
 

Functions

bool hasPartitionTable (const SectorAccessibleDisk &disk)
 Check whether the given disk is partitioned.
 
PartitiongetPartition (const SectorAccessibleDisk &disk, unsigned partition, SectorBuffer &buf)
 Gets the requested partition.
 
void checkSupportedPartition (const SectorAccessibleDisk &disk, unsigned partition)
 Check whether partition is of type FAT12 or FAT16.
 
void format (SectorAccessibleDisk &disk, MSXBootSectorType bootType)
 Format the given disk (= a single partition).
 
void format (SectorAccessibleDisk &disk, MSXBootSectorType bootType, size_t nbSectors)
 
unsigned partition (SectorAccessibleDisk &disk, std::span< const unsigned > sizes, MSXBootSectorType bootType)
 Write a partition table to the given disk and format each partition.
 
FatTimeDate toTimeDate (time_t totalSeconds)
 
time_t fromTimeDate (FatTimeDate timeDate)
 
std::string formatAttrib (MSXDirEntry::AttribValue attrib)
 

Enumeration Type Documentation

◆ PartitionTableType

Enumerator
SUNRISE_IDE 
NEXTOR 

Definition at line 26 of file DiskImageUtils.cc.

Function Documentation

◆ checkSupportedPartition()

void openmsx::DiskImageUtils::checkSupportedPartition ( const SectorAccessibleDisk disk,
unsigned  partition 
)

Check whether partition is of type FAT12 or FAT16.

Definition at line 139 of file DiskImageUtils.cc.

References getPartition(), partition(), and openmsx::Partition::sys_ind.

Referenced by openmsx::DiskManipulator::getDriveNamesForCurrentMachine().

◆ format() [1/2]

void openmsx::DiskImageUtils::format ( SectorAccessibleDisk disk,
MSXBootSectorType  bootType 
)

Format the given disk (= a single partition).

The formatting depends on the size of the image.

Parameters
diskThe disk/partition image to be formatted.
bootTypeThe boot sector type to use.

Definition at line 403 of file DiskImageUtils.cc.

References format(), and openmsx::SectorAccessibleDisk::getNbSectors().

Referenced by openmsx::DiskManipulator::create(), format(), openmsx::GLHQLiteScaler::GLHQLiteScaler(), openmsx::GLHQScaler::GLHQScaler(), partition(), openmsx::RamDSKDiskImage::RamDSKDiskImage(), openmsx::SliderFloat(), openmsx::SliderFloat(), openmsx::GLHQLiteScaler::uploadBlock(), openmsx::GLHQScaler::uploadBlock(), and openmsx::WavWriter::WavWriter().

◆ format() [2/2]

void openmsx::DiskImageUtils::format ( SectorAccessibleDisk disk,
MSXBootSectorType  bootType,
size_t  nbSectors 
)

◆ formatAttrib()

std::string openmsx::DiskImageUtils::formatAttrib ( MSXDirEntry::AttribValue  attrib)

Definition at line 667 of file DiskImageUtils.cc.

References strCat().

◆ fromTimeDate()

time_t openmsx::DiskImageUtils::fromTimeDate ( FatTimeDate  timeDate)

◆ getPartition()

Partition & openmsx::DiskImageUtils::getPartition ( const SectorAccessibleDisk disk,
unsigned  partition,
SectorBuffer buf 
)

Gets the requested partition.

Checks whether: the disk is partitioned the specified partition exists throws a CommandException if one of these conditions is false

Parameters
diskThe disk to check.
partitionPartition number, in range [1..].
bufSector buffer for partition table.
Returns
Reference to partition information struct in sector buffer.

Definition at line 124 of file DiskImageUtils.cc.

References NEXTOR, partition(), openmsx::SectorAccessibleDisk::readSector(), and SUNRISE_IDE.

Referenced by checkSupportedPartition(), openmsx::DiskPartition::DiskPartition(), and openmsx::DiskManipulator::getDriveNamesForCurrentMachine().

◆ hasPartitionTable()

bool openmsx::DiskImageUtils::hasPartitionTable ( const SectorAccessibleDisk disk)

Check whether the given disk is partitioned.

Definition at line 49 of file DiskImageUtils.cc.

References openmsx::SectorAccessibleDisk::readSector().

Referenced by openmsx::DiskManipulator::getDriveNamesForCurrentMachine().

◆ partition()

unsigned openmsx::DiskImageUtils::partition ( SectorAccessibleDisk disk,
std::span< const unsigned >  sizes,
MSXBootSectorType  bootType 
)

Write a partition table to the given disk and format each partition.

Parameters
diskThe disk to partition.
sizesThe number of sectors for each partition.
bootTypeThe boot sector type to use.

Definition at line 618 of file DiskImageUtils.cc.

References openmsx::DOS1, openmsx::DOS2, enumerate(), format(), openmsx::NEXTOR, and UNREACHABLE.

Referenced by checkSupportedPartition(), openmsx::DiskManipulator::create(), openmsx::DiskPartition::DiskPartition(), and getPartition().

◆ toTimeDate()

FatTimeDate openmsx::DiskImageUtils::toTimeDate ( time_t  totalSeconds)

Definition at line 640 of file DiskImageUtils.cc.