diff --git a/Storage/Disk/Formats/OricMFMDSK.cpp b/Storage/Disk/Formats/OricMFMDSK.cpp index c0de30f9e..2f0de70aa 100644 --- a/Storage/Disk/Formats/OricMFMDSK.cpp +++ b/Storage/Disk/Formats/OricMFMDSK.cpp @@ -26,6 +26,11 @@ OricMFMDSK::OricMFMDSK(const char *file_name) : throw ErrorNotOricMFMDSK; } +OricMFMDSK::~OricMFMDSK() +{ + flush_updates(); +} + unsigned int OricMFMDSK::get_head_position_count() { return track_count_; @@ -36,7 +41,12 @@ unsigned int OricMFMDSK::get_head_count() return head_count_; } -std::shared_ptr OricMFMDSK::get_uncached_track_at_position(unsigned int head, unsigned int position) +bool OricMFMDSK::get_is_read_only() +{ + return is_read_only_; +} + +long OricMFMDSK::get_file_offset_for_position(unsigned int head, unsigned int position) { long seek_offset = 0; switch(geometry_type_) @@ -48,7 +58,12 @@ std::shared_ptr OricMFMDSK::get_uncached_track_at_position(unsigned int h seek_offset = (position * track_count_ * head_count_) + head; break; } - fseek(file_, (seek_offset * 6400) + 256, SEEK_SET); + return (seek_offset * 6400) + 256; +} + +std::shared_ptr OricMFMDSK::get_uncached_track_at_position(unsigned int head, unsigned int position) +{ + fseek(file_, get_file_offset_for_position(head, position), SEEK_SET); PCMSegment segment; @@ -115,3 +130,7 @@ std::shared_ptr OricMFMDSK::get_uncached_track_at_position(unsigned int h std::shared_ptr track(new PCMTrack(segment)); return track; } + +void OricMFMDSK::store_updated_track_at_position(unsigned int head, unsigned int position, const std::shared_ptr &track, std::mutex &file_access_mutex) +{ +} diff --git a/Storage/Disk/Formats/OricMFMDSK.hpp b/Storage/Disk/Formats/OricMFMDSK.hpp index f4d944a4b..53dac1904 100644 --- a/Storage/Disk/Formats/OricMFMDSK.hpp +++ b/Storage/Disk/Formats/OricMFMDSK.hpp @@ -27,6 +27,7 @@ class OricMFMDSK: public Disk, public Storage::FileHolder { @throws ErrorNotAcornADF if the file doesn't appear to contain an Acorn .ADF format image. */ OricMFMDSK(const char *file_name); + ~OricMFMDSK(); enum { ErrorNotOricMFMDSK, @@ -35,9 +36,13 @@ class OricMFMDSK: public Disk, public Storage::FileHolder { // implemented to satisfy @c Disk unsigned int get_head_position_count(); unsigned int get_head_count(); + bool get_is_read_only(); private: + void store_updated_track_at_position(unsigned int head, unsigned int position, const std::shared_ptr &track, std::mutex &file_access_mutex); std::shared_ptr get_uncached_track_at_position(unsigned int head, unsigned int position); + long get_file_offset_for_position(unsigned int head, unsigned int position); + uint32_t head_count_; uint32_t track_count_; uint32_t geometry_type_;