openMSX
DMKDiskImage.hh
Go to the documentation of this file.
1 #ifndef DMKDISKIMAGE_HH
2 #define DMKDISKIMAGE_HH
3 
4 #include "Disk.hh"
5 #include <memory>
6 
7 namespace openmsx {
8 
9 class File;
10 
16 class DMKDiskImage final : public Disk
17 {
18 public:
19  DMKDiskImage(Filename filename, std::shared_ptr<File> file);
20 
21  void readTrack(byte track, byte side, RawTrack& output) override;
22  void writeTrackImpl(byte track, byte side, const RawTrack& input) override;
23 
24  // logical sector emulation for SectorAccessibleDisk
25  void readSectorImpl (size_t sector, SectorBuffer& buf) override;
26  void writeSectorImpl(size_t sector, const SectorBuffer& buf) override;
27  [[nodiscard]] size_t getNbSectorsImpl() const override;
28  [[nodiscard]] bool isWriteProtectedImpl() const override;
29  [[nodiscard]] Sha1Sum getSha1SumImpl(FilePool& filepool) override;
30 
31 private:
32  void detectGeometryFallback() override;
33 
34  void seekTrack(byte track, byte side);
35  void doWriteTrack(byte track, byte side, const RawTrack& input);
36  void extendImageToTrack(byte track);
37 
38 private:
39  std::shared_ptr<File> file;
40  unsigned numTracks;
41  unsigned dmkTrackLen;
42  bool singleSided;
43  bool writeProtected;
44 };
45 
46 } // namespace openmsx
47 
48 #endif
openmsx::SectorBuffer
Definition: DiskImageUtils.hh:90
Disk.hh
openmsx::RawTrack
Definition: RawTrack.hh:62
openmsx::Disk
Definition: Disk.hh:13
openmsx::DMKDiskImage::getSha1SumImpl
Sha1Sum getSha1SumImpl(FilePool &filepool) override
Definition: DMKDiskImage.cc:215
openmsx::DMKDiskImage::DMKDiskImage
DMKDiskImage(Filename filename, std::shared_ptr< File > file)
Definition: DMKDiskImage.cc:42
openmsx::filename
constexpr const char *const filename
Definition: FirmwareSwitch.cc:10
openmsx::DMKDiskImage::isWriteProtectedImpl
bool isWriteProtectedImpl() const override
Definition: DMKDiskImage.cc:210
openmsx::DMKDiskImage::readSectorImpl
void readSectorImpl(size_t sector, SectorBuffer &buf) override
Definition: DMKDiskImage.cc:173
openmsx::DMKDiskImage::writeSectorImpl
void writeSectorImpl(size_t sector, const SectorBuffer &buf) override
Definition: DMKDiskImage.cc:188
openmsx::DMKDiskImage::readTrack
void readTrack(byte track, byte side, RawTrack &output) override
Read a full track from this disk image.
Definition: DMKDiskImage.cc:70
openmsx::Sha1Sum
This class represents the result of a sha1 calculation (a 160-bit value).
Definition: sha1.hh:20
openmsx::DMKDiskImage
DMK disk image.
Definition: DMKDiskImage.hh:17
openmsx::DMKDiskImage::getNbSectorsImpl
size_t getNbSectorsImpl() const override
Definition: DMKDiskImage.cc:204
openmsx::FilePool
Definition: FilePool.hh:16
openmsx::Filename
This class represents a filename.
Definition: Filename.hh:18
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::DMKDiskImage::writeTrackImpl
void writeTrackImpl(byte track, byte side, const RawTrack &input) override
Definition: DMKDiskImage.cc:121