mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Rework the ibm encoder to allow per-track configurations. Rename everything for
consistency.
This commit is contained in:
@@ -3,7 +3,7 @@ syntax = "proto2";
|
||||
import "lib/common.proto";
|
||||
|
||||
message ImgInputOutputProto {
|
||||
message FormatProto {
|
||||
message TrackdataProto {
|
||||
optional int32 track = 1 [(help) = "if present, this format only applies to this track"];
|
||||
optional int32 side = 2 [(help) = "if present, this format only applies to this side"];
|
||||
|
||||
@@ -11,7 +11,7 @@ message ImgInputOutputProto {
|
||||
optional int32 sectors = 4 [(help) = "number of sectors in this track"];
|
||||
}
|
||||
|
||||
repeated FormatProto format = 4 [(help) = "per-track format information (repeatable)"];
|
||||
repeated TrackdataProto trackdata = 4 [(help) = "per-track format information (repeatable)"];
|
||||
optional int32 tracks = 5 [default=80, (help) = "number of tracks in image"];
|
||||
optional int32 sides = 6 [default=2, (help) = "number of sides in image"];
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ public:
|
||||
{
|
||||
for (int side = 0; side < _config.img().sides(); side++)
|
||||
{
|
||||
ImgInputOutputProto::FormatProto format;
|
||||
getTrackFormat(format, track, side);
|
||||
ImgInputOutputProto::TrackdataProto trackdata;
|
||||
getTrackFormat(trackdata, track, side);
|
||||
|
||||
for (int sectorId = 0; sectorId < format.sectors(); sectorId++)
|
||||
for (int sectorId = 0; sectorId < trackdata.sectors(); sectorId++)
|
||||
{
|
||||
Bytes data(format.sector_size());
|
||||
Bytes data(trackdata.sector_size());
|
||||
inputFile.read((char*) data.begin(), data.size());
|
||||
|
||||
std::unique_ptr<Sector>& sector = sectors.get(track, side, sectorId);
|
||||
@@ -57,17 +57,17 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void getTrackFormat(ImgInputOutputProto::FormatProto& format, unsigned track, unsigned side)
|
||||
void getTrackFormat(ImgInputOutputProto::TrackdataProto& trackdata, unsigned track, unsigned side)
|
||||
{
|
||||
format.Clear();
|
||||
for (const ImgInputOutputProto::FormatProto& f : _config.img().format())
|
||||
trackdata.Clear();
|
||||
for (const ImgInputOutputProto::TrackdataProto& f : _config.img().trackdata())
|
||||
{
|
||||
if (f.has_track() && (f.track() != track))
|
||||
continue;
|
||||
if (f.has_side() && (f.side() != side))
|
||||
continue;
|
||||
|
||||
format.MergeFrom(f);
|
||||
trackdata.MergeFrom(f);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user