mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-23 20:29:42 +00:00
Added the infrastructure necessary for Oric disks to appear writeable to the machine and to receive changed tracks.
This commit is contained in:
parent
d581294479
commit
632b3c63b1
@ -26,6 +26,11 @@ OricMFMDSK::OricMFMDSK(const char *file_name) :
|
|||||||
throw ErrorNotOricMFMDSK;
|
throw ErrorNotOricMFMDSK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OricMFMDSK::~OricMFMDSK()
|
||||||
|
{
|
||||||
|
flush_updates();
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int OricMFMDSK::get_head_position_count()
|
unsigned int OricMFMDSK::get_head_position_count()
|
||||||
{
|
{
|
||||||
return track_count_;
|
return track_count_;
|
||||||
@ -36,7 +41,12 @@ unsigned int OricMFMDSK::get_head_count()
|
|||||||
return head_count_;
|
return head_count_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Track> 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;
|
long seek_offset = 0;
|
||||||
switch(geometry_type_)
|
switch(geometry_type_)
|
||||||
@ -48,7 +58,12 @@ std::shared_ptr<Track> OricMFMDSK::get_uncached_track_at_position(unsigned int h
|
|||||||
seek_offset = (position * track_count_ * head_count_) + head;
|
seek_offset = (position * track_count_ * head_count_) + head;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fseek(file_, (seek_offset * 6400) + 256, SEEK_SET);
|
return (seek_offset * 6400) + 256;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Track> 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;
|
PCMSegment segment;
|
||||||
|
|
||||||
@ -115,3 +130,7 @@ std::shared_ptr<Track> OricMFMDSK::get_uncached_track_at_position(unsigned int h
|
|||||||
std::shared_ptr<PCMTrack> track(new PCMTrack(segment));
|
std::shared_ptr<PCMTrack> track(new PCMTrack(segment));
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OricMFMDSK::store_updated_track_at_position(unsigned int head, unsigned int position, const std::shared_ptr<Track> &track, std::mutex &file_access_mutex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -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.
|
@throws ErrorNotAcornADF if the file doesn't appear to contain an Acorn .ADF format image.
|
||||||
*/
|
*/
|
||||||
OricMFMDSK(const char *file_name);
|
OricMFMDSK(const char *file_name);
|
||||||
|
~OricMFMDSK();
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ErrorNotOricMFMDSK,
|
ErrorNotOricMFMDSK,
|
||||||
@ -35,9 +36,13 @@ class OricMFMDSK: public Disk, public Storage::FileHolder {
|
|||||||
// implemented to satisfy @c Disk
|
// implemented to satisfy @c Disk
|
||||||
unsigned int get_head_position_count();
|
unsigned int get_head_position_count();
|
||||||
unsigned int get_head_count();
|
unsigned int get_head_count();
|
||||||
|
bool get_is_read_only();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void store_updated_track_at_position(unsigned int head, unsigned int position, const std::shared_ptr<Track> &track, std::mutex &file_access_mutex);
|
||||||
std::shared_ptr<Track> get_uncached_track_at_position(unsigned int head, unsigned int position);
|
std::shared_ptr<Track> 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 head_count_;
|
||||||
uint32_t track_count_;
|
uint32_t track_count_;
|
||||||
uint32_t geometry_type_;
|
uint32_t geometry_type_;
|
||||||
|
Loading…
Reference in New Issue
Block a user