Radically simplify RawRecord and Sector. It all works, and the results are

better, but I've disabled a bunch of decoders for now.
This commit is contained in:
David Given
2019-04-18 21:47:34 +02:00
parent 4b480ce4f3
commit b158692a3a
12 changed files with 254 additions and 252 deletions

View File

@@ -41,8 +41,12 @@ void readSectorsFromFile(SectorSet& sectors, const Geometry& geometry,
Bytes data(geometry.sectorSize);
inputFile.read((char*) data.begin(), geometry.sectorSize);
sectors.get(track, head, sectorId).reset(
new Sector(Sector::OK, track, head, sectorId, data));
Sector* sector = sectors.get(track, head, sectorId) = new Sector();
sector->status = Sector::OK;
sector->logicalTrack = sector->physicalTrack = track;
sector->logicalSide = sector->physicalSide = head;
sector->logicalSector = sectorId;
sector->data = data;
}
}
}
@@ -64,7 +68,7 @@ void writeSectorsToFile(const SectorSet& sectors, const Geometry& geometry,
std::cout << fmt::format("{}.{:2} ", head, sectorId);
for (int track = 0; track < geometry.tracks; track++)
{
auto sector = sectors.get(track, head, sectorId);
Sector* sector = sectors.get(track, head, sectorId);
if (!sector)
{
std::cout << 'X';
@@ -136,7 +140,7 @@ void writeSectorsToFile(const SectorSet& sectors, const Geometry& geometry,
auto sector = sectors.get(track, head, sectorId);
if (sector)
{
outputFile.seekp(sector->track*trackSize + sector->side*headSize + sector->sector*geometry.sectorSize, std::ios::beg);
outputFile.seekp(sector->logicalTrack*trackSize + sector->logicalSide*headSize + sector->logicalSector*geometry.sectorSize, std::ios::beg);
outputFile.write((const char*) &sector->data[0], sector->data.size());
}
}