mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 18:30:21 +00:00
Improves validation of suspected sync regions.
This commit is contained in:
parent
41075356e2
commit
992a99d792
@ -60,14 +60,19 @@ std::shared_ptr<::Storage::Disk::Track> NIB::get_track_at_position(::Storage::Di
|
|||||||
for(size_t index = 0; index < track_data.size(); ++index) {
|
for(size_t index = 0; index < track_data.size(); ++index) {
|
||||||
if(track_data[index] == 0xd5 && track_data[(index+1)%track_data.size()] == 0xaa) {
|
if(track_data[index] == 0xd5 && track_data[(index+1)%track_data.size()] == 0xaa) {
|
||||||
size_t start = index - 1;
|
size_t start = index - 1;
|
||||||
while(track_data[start] == 0xff)
|
size_t length = 0;
|
||||||
|
while(track_data[start] == 0xff) {
|
||||||
start = (start + track_data.size() - 1) % track_data.size();
|
start = (start + track_data.size() - 1) % track_data.size();
|
||||||
|
++length;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(length >= 5) {
|
||||||
sync_starts.insert((start + 1) % track_data.size());
|
sync_starts.insert((start + 1) % track_data.size());
|
||||||
if(start > index)
|
if(start > index)
|
||||||
start_index = start;
|
start_index = start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(start_index)
|
if(start_index)
|
||||||
segments.push_back(Encodings::AppleGCR::six_and_two_sync(static_cast<int>(start_index)));
|
segments.push_back(Encodings::AppleGCR::six_and_two_sync(static_cast<int>(start_index)));
|
||||||
|
Loading…
Reference in New Issue
Block a user