diff options
Diffstat (limited to 'engines/adl/disk.h')
-rw-r--r-- | engines/adl/disk.h | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/engines/adl/disk.h b/engines/adl/disk.h index 43b9e387ba..1041f0cebd 100644 --- a/engines/adl/disk.h +++ b/engines/adl/disk.h @@ -73,41 +73,41 @@ protected: class DiskImage { public: DiskImage() : - _tracks(0), - _sectorsPerTrack(0), - _bytesPerSector(0) { - _f = new Common::File(); - } + _stream(nullptr), + _mode13(false) { } - virtual ~DiskImage() { - delete _f; + ~DiskImage() { + delete _stream; } - virtual bool open(const Common::String &filename) = 0; - virtual const DataBlockPtr getDataBlock(uint track, uint sector, uint offset = 0, uint size = 0) const = 0; - virtual Common::SeekableReadStream *createReadStream(uint track, uint sector, uint offset = 0, uint size = 0) const = 0; + bool open(const Common::String &filename); + const DataBlockPtr getDataBlock(uint track, uint sector, uint offset = 0, uint size = 0) const; + Common::SeekableReadStream *createReadStream(uint track, uint sector, uint offset = 0, uint size = 0, uint sectorsPerTrackToRead = 16) const; + void setMode13(bool enable) { _mode13 = enable; } protected: class DataBlock : public Adl::DataBlock { public: - DataBlock(const DiskImage *disk, uint track, uint sector, uint offset, uint size) : + DataBlock(const DiskImage *disk, uint track, uint sector, uint offset, uint size, bool mode13) : _track(track), _sector(sector), _offset(offset), _size(size), + _mode13(mode13), _disk(disk) { } Common::SeekableReadStream *createReadStream() const { - return _disk->createReadStream(_track, _sector, _offset, _size); + return _disk->createReadStream(_track, _sector, _offset, _size, (_mode13 ? 13 : 16)); } private: uint _track, _sector, _offset, _size; + bool _mode13; const DiskImage *_disk; }; - Common::File *_f; - uint _tracks, _sectorsPerTrack, _bytesPerSector; + Common::SeekableReadStream *_stream; + bool _mode13; // Older 13-sector format }; // Data in plain files @@ -117,30 +117,6 @@ public: Common::SeekableReadStream *createReadStream(const Common::String &filename, uint offset = 0) const; }; -// .DSK disk image - 35 tracks, 16 sectors per track, 256 bytes per sector -class DiskImage_DSK : public DiskImage { -public: - bool open(const Common::String &filename); - const DataBlockPtr getDataBlock(uint track, uint sector, uint offset = 0, uint size = 0) const; - Common::SeekableReadStream *createReadStream(uint track, uint sector, uint offset = 0, uint size = 0) const; -}; - -// .NIB disk image -class DiskImage_NIB : public DiskImage { -public: - DiskImage_NIB() : _memStream(nullptr) { } - virtual ~DiskImage_NIB() { - delete _memStream; - } - - bool open(const Common::String &filename); - const DataBlockPtr getDataBlock(uint track, uint sector, uint offset = 0, uint size = 0) const; - Common::SeekableReadStream *createReadStream(uint track, uint sector, uint offset = 0, uint size = 0) const; - -private: - Common::SeekableReadStream *_memStream; -}; - // Data in files contained in Apple DOS 3.3 disk image class Files_DOS33 : public Files { public: |