1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Ensure an encoder is created even if no sectors are placed.

This commit is contained in:
Thomas Harte 2020-01-12 22:37:00 -05:00
parent 80fcf5b5c0
commit fab35b360a

View File

@ -174,16 +174,16 @@ class TrackConstructor {
}
}
// Just create an encoder if one doesn't exist. TODO: factor in data rate.
if(!encoder) {
segment.reset(new PCMSegment);
encoder = Storage::Encodings::MFM::GetMFMEncoder(segment->data);
}
// Write out, being wary of potential overlapping sectors, and copying from track_data_ to fill in gaps.
auto location = locations.begin();
track_position = track_data_.begin();
while(location != locations.end()) {
// Just create an encoder if one doesn't exist. TODO: factor in data rate.
if(!encoder) {
segment.reset(new PCMSegment);
encoder = Storage::Encodings::MFM::GetMFMEncoder(segment->data);
}
// Advance to location.position.
while(track_position != location->position) {
encoder->add_byte(*track_position);