mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Convert all the encoders and imagereaders to the new scheme.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "sector.h"
|
||||
#include "sectorset.h"
|
||||
#include "imagereader/imagereader.h"
|
||||
#include "image.h"
|
||||
#include "fmt/format.h"
|
||||
#include "lib/config.pb.h"
|
||||
#include <algorithm>
|
||||
@@ -81,7 +82,7 @@ public:
|
||||
ImageReader(config)
|
||||
{}
|
||||
|
||||
SectorSet readImage()
|
||||
Image readImage()
|
||||
{
|
||||
std::ifstream inputFile(_config.filename(), std::ios::in | std::ios::binary);
|
||||
if (!inputFile.is_open())
|
||||
@@ -90,7 +91,7 @@ public:
|
||||
inputFile.seekg( 0, std::ios::end);
|
||||
unsigned inputFileSize = inputFile.tellg();
|
||||
unsigned headerPtr = 0;
|
||||
SectorSet sectors;
|
||||
Image image;
|
||||
for (;;)
|
||||
{
|
||||
unsigned dataPtr = headerPtr + 2901*3 + 1;
|
||||
@@ -110,8 +111,7 @@ public:
|
||||
inputFile.read((char*) data.begin(), sectorSize);
|
||||
|
||||
unsigned head = !!(header.flags & JV3_SIDE);
|
||||
std::unique_ptr<Sector>& sector = sectors.get(header.track, head, header.sector);
|
||||
sector.reset(new Sector);
|
||||
Sector* sector = image.put(header.track, head, header.sector);
|
||||
sector->status = Sector::OK;
|
||||
sector->logicalTrack = sector->physicalCylinder = header.track;
|
||||
sector->logicalSide = sector->physicalHead = head;
|
||||
@@ -128,7 +128,8 @@ public:
|
||||
headerPtr = dataPtr;
|
||||
}
|
||||
|
||||
return sectors;
|
||||
image.calculateSize();
|
||||
return image;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user