diff --git a/include/SAMdisk.h b/include/SAMdisk.h index 6159cc0..43afe68 100644 --- a/include/SAMdisk.h +++ b/include/SAMdisk.h @@ -271,7 +271,7 @@ typedef struct int base = -1, size = -1, gap3 = -1, interleave = -1, skew = -1, fill = -1; int gaps = -1, gap2 = -1, gap4b = -1, idcrc = -1, gapmask = -1, maxsplice = -1; int cylsfirst = -1, head0 = -1, head1 = -1, steprate = -1, check8k = -1; - int offsets = -1, fix = -1, mt = -1, plladjust = -1; + int offsets = -1, fix = -1, mt = -1, plladjust = -1, hardsectors = -1; int command = 0, hex = 0, debug = 0, verbose = 0, log = 0, force = 0, quick = 0; int merge = 0, repair = 0, trim = 0, calibrate = 0, newdrive = 0, byteswap = 0; diff --git a/src/KryoFlux.cpp b/src/KryoFlux.cpp index 5d6a22f..da084a4 100644 --- a/src/KryoFlux.cpp +++ b/src/KryoFlux.cpp @@ -217,6 +217,7 @@ void KryoFlux::ReadFlux (int revs, FluxData &flux_revs, std::vector uint32_t time = 0, stream_pos = 0; uint32_t ps_per_tick = PS_PER_TICK(SAMPLE_FREQ); std::vector index_offsets; + int hard_indexes = 0; auto itBegin = data.begin(), it = itBegin, itEnd = data.end(); while (it != itEnd) @@ -272,8 +273,13 @@ void KryoFlux::ReadFlux (int revs, FluxData &flux_revs, std::vector { assert(size == 12); - auto pdw = reinterpret_cast(&*it); - index_offsets.push_back(util::letoh(pdw[0])); + // Soft-sectored disks have a single start-of-track index. + // Hard-sectors are combined to achieve the same result. + if (opt.hardsectors <= 1 || !(++hard_indexes % opt.hardsectors)) + { + auto pdw = reinterpret_cast(&*it); + index_offsets.push_back(util::letoh(pdw[0])); + } break; } diff --git a/src/SAMdisk.cpp b/src/SAMdisk.cpp index fe48b6a..3f4f359 100644 --- a/src/SAMdisk.cpp +++ b/src/SAMdisk.cpp @@ -145,6 +145,7 @@ struct option long_options[] = { "cyls", required_argument, nullptr, 'c' }, { "head", required_argument, nullptr, 'h' }, { "sectors", required_argument, nullptr, 's' }, + { "hard-sectors",required_argument,nullptr, 'H' }, { "retries", required_argument, nullptr, 'r' }, { "rescans", optional_argument, nullptr, 'R' }, { "double-step", no_argument, nullptr, 'd' }, @@ -245,7 +246,7 @@ struct option long_options[] = { 0, 0, 0, 0 } }; -static char short_options[] = "?nmdvfLxb:c:h:s:r:R:g:i:k:z:0:1:D:"; +static char short_options[] = "?nmdvfLxb:c:h:s:H:r:R:g:i:k:z:0:1:D:"; bool BadValue (const char *pcszName_) { @@ -285,6 +286,12 @@ bool ParseCommandLine (int argc_, char *argv_[]) opt.sectors = util::str_value(optarg); break; + case 'H': + opt.hardsectors = util::str_value(optarg); + if (opt.hardsectors <= 1) + throw util::exception("invalid hard-sector count '", optarg, "'"); + break; + case 'r': opt.retries = util::str_value(optarg); break;