mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-26 19:17:52 +00:00
Switches FileHolder to have a usage much closer to FILE *.
Thereby opens a route for file format implementations such as that appearing for CPC DSK that create an in-memory copy and perform a full rewrite.
This commit is contained in:
@@ -21,13 +21,13 @@ SSD::SSD(const char *file_name) : MFMSectorDump(file_name) {
|
||||
// very loose validation: the file needs to be a multiple of 256 bytes
|
||||
// and not ungainly large
|
||||
|
||||
if(file_stats_.st_size & 255) throw ErrorNotSSD;
|
||||
if(file_stats_.st_size < 512) throw ErrorNotSSD;
|
||||
if(file_stats_.st_size > 800*256) throw ErrorNotSSD;
|
||||
if(file_.stats().st_size & 255) throw ErrorNotSSD;
|
||||
if(file_.stats().st_size < 512) throw ErrorNotSSD;
|
||||
if(file_.stats().st_size > 800*256) throw ErrorNotSSD;
|
||||
|
||||
// this has two heads if the suffix is .dsd, one if it's .ssd
|
||||
head_count_ = (tolower(file_name[strlen(file_name) - 3]) == 'd') ? 2 : 1;
|
||||
track_count_ = static_cast<int>(file_stats_.st_size / (256 * 10));
|
||||
track_count_ = static_cast<int>(file_.stats().st_size / (256 * 10));
|
||||
if(track_count_ < 40) track_count_ = 40;
|
||||
else if(track_count_ < 80) track_count_ = 80;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user