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  size_t getNbSectorsImpl() const override;
28  bool isWriteProtectedImpl() const override;
29  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  std::shared_ptr<File> file;
39  unsigned numTracks;
40  unsigned dmkTrackLen;
41  bool singleSided;
42  bool writeProtected;
43 };
44 
45 } // namespace openmsx
46 
47 #endif
size_t getNbSectorsImpl() const override
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
void readTrack(byte track, byte side, RawTrack &output) override
Read a full track from this disk image.
Definition: DMKDiskImage.cc:75
bool isWriteProtectedImpl() const override
DMKDiskImage(Filename filename, std::shared_ptr< File > file)
Definition: DMKDiskImage.cc:47
Sha1Sum getSha1SumImpl(FilePool &filepool) override
This class represents the result of a sha1 calculation (a 160-bit value).
Definition: sha1.hh:19
void readSectorImpl(size_t sector, SectorBuffer &buf) override
This class represents a filename.
Definition: Filename.hh:17
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void writeSectorImpl(size_t sector, const SectorBuffer &buf) override
DMK disk image.
Definition: DMKDiskImage.hh:16
void writeTrackImpl(byte track, byte side, const RawTrack &input) override