1#ifndef DISK_IMAGE_UTILS_HH
2#define DISK_IMAGE_UTILS_HH
15class SectorAccessibleDisk;
25 std::array<uint8_t, 8>
name;
39 std::array<uint8_t, 512-30>
pad;
43 std::array<uint8_t, 9>
pad1;
45 std::array<uint8_t, 512-43>
pad2;
60static_assert(
sizeof(MSXBootSector) == 512);
78 constexpr explicit operator bool()
const {
return value != 0; }
92 [[nodiscard]]
auto base()
const {
return subspan<8>(
filename, 0); }
93 [[nodiscard]]
auto ext ()
const {
return subspan<3>(
filename, 8); }
114static_assert(
alignof(
Partition) == 1,
"must not have alignment requirements");
119 std::array<Partition, 31>
part;
126 std::array<char, 435>
pad;
140 std::array<uint8_t, 512>
raw;
150namespace DiskImageUtils {
bool hasPartitionTable(const SectorAccessibleDisk &disk)
Check whether the given disk is partitioned.
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).
Partition & getPartition(const SectorAccessibleDisk &disk, unsigned partition, SectorBuffer &buf)
Gets the requested partition.
time_t fromTimeDate(FatTimeDate timeDate)
std::string formatAttrib(MSXDirEntry::AttribValue attrib)
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)
This file implemented 3 utility functions:
constexpr auto to_underlying(E e) noexcept
std::array< uint8_t, 512-30 > pad
struct openmsx::MSXBootSector::@0::@2 dos2
union openmsx::MSXBootSector::@0 params
uint8_t extendedBootSignature
struct openmsx::MSXBootSector::@0::@3 extended
std::array< uint8_t, 3 > jumpCode
Endian::L16 hiddenSectors
std::array< uint8_t, 8 > fileSystemType
std::array< uint8_t, 8 > name
struct openmsx::MSXBootSector::@0::@1 dos1
std::array< uint8_t, 11 > volumeLabel
Endian::UA_L16 dirEntries
std::array< uint8_t, 512-62 > padding
std::array< uint8_t, 512-43 > pad2
std::array< uint8_t, 9 > pad1
Endian::L32 hiddenSectors
constexpr AttribValue()=default
constexpr auto operator<=>(const AttribValue &) const =default
constexpr AttribValue(uint8_t v)
friend constexpr AttribValue operator|(AttribValue x, AttribValue y)
friend constexpr AttribValue operator&(AttribValue x, AttribValue y)
std::array< uint8_t, 10 > reserved
bool operator==(const MSXDirEntry &other) const =default
std::array< char, 8+3 > filename
std::array< char, 435 > pad
std::array< Partition, 4 > part
std::array< char, 11 > header
std::array< Partition, 31 > part
std::array< char, 3 > pad
std::array< char, 11 > header
PartitionTableSunrise ptSunrise
std::array< uint8_t, 512 > raw
std::array< MSXDirEntry, 16 > dirEntry
PartitionTableNextor ptNextor