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
DMK disk image.
Definition: DMKDiskImage.hh:17
void writeTrackImpl(byte track, byte side, const RawTrack &input) override
DMKDiskImage(Filename filename, std::shared_ptr< File > file)
Definition: DMKDiskImage.cc:43
Sha1Sum getSha1SumImpl(FilePool &filepool) override
void readSectorImpl(size_t sector, SectorBuffer &buf) override
bool isWriteProtectedImpl() const override
void writeSectorImpl(size_t sector, const SectorBuffer &buf) override
size_t getNbSectorsImpl() const override
void readTrack(byte track, byte side, RawTrack &output) override
Read a full track from this disk image.
Definition: DMKDiskImage.cc:71
This class represents a filename.
Definition: Filename.hh:18
This class represents the result of a sha1 calculation (a 160-bit value).
Definition: sha1.hh:22
This file implemented 3 utility functions:
Definition: Autofire.cc:5
constexpr const char *const filename