add writing IMD images functionality

This commit is contained in:
wybren1971
2022-06-19 16:49:31 +02:00
parent fbc39a41f8
commit 4d7ddf3d9e
5 changed files with 14 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ LIBFLUXENGINE_SRCS = \
lib/imagewriter/diskcopyimagewriter.cc \
lib/imagewriter/imagewriter.cc \
lib/imagewriter/imgimagewriter.cc \
lib/imagewriter/imdimagewriter.cc \
lib/imagewriter/ldbsimagewriter.cc \
lib/imagewriter/nsiimagewriter.cc \
lib/imagewriter/rawimagewriter.cc \

View File

@@ -198,10 +198,16 @@ public:
}
//read sector numbering map
sector_skew.clear();
bool blnBase0 = false; //check what first start number of the sector is. Fluxengine expects 1.
for (b = 0; b < header.numSectors; b++)
{
uint8_t t;
t = br.read_8();
if (t == 0x00) blnBase0 = true;
if (blnBase0)
{
t=t+1;
}
sector_skew.push_back(t);
headerPtr++;
}

View File

@@ -35,6 +35,9 @@ std::unique_ptr<ImageWriter> ImageWriter::create(const ImageWriterProto& config)
case ImageWriterProto::kD88:
return ImageWriter::createD88ImageWriter(config);
case ImageWriterProto::kImd:
return ImageWriter::createImdImageWriter(config);
default:
Error() << "bad output image config";
return std::unique_ptr<ImageWriter>();
@@ -52,6 +55,7 @@ void ImageWriter::updateConfigForFilename(ImageWriterProto* proto, const std::st
{".diskcopy", [](auto* proto) { proto->mutable_diskcopy(); }},
{".dsk", [](auto* proto) { proto->mutable_img(); }},
{".img", [](auto* proto) { proto->mutable_img(); }},
{".imd", [](auto* proto) { proto->mutable_imd(); }},
{".ldbs", [](auto* proto) { proto->mutable_ldbs(); }},
{".nsi", [](auto* proto) { proto->mutable_nsi(); }},
{".raw", [](auto* proto) { proto->mutable_raw(); }},

View File

@@ -21,6 +21,7 @@ public:
static std::unique_ptr<ImageWriter> createNsiImageWriter(const ImageWriterProto& config);
static std::unique_ptr<ImageWriter> createRawImageWriter(const ImageWriterProto& config);
static std::unique_ptr<ImageWriter> createD88ImageWriter(const ImageWriterProto& config);
static std::unique_ptr<ImageWriter> createImdImageWriter(const ImageWriterProto& config);
public:
void printMap(const Image& sectors);

View File

@@ -31,6 +31,7 @@ message DiskCopyOutputProto {}
message NsiOutputProto {}
message RawOutputProto {}
message D88OutputProto {}
message ImdOutputProto {}
message ImageWriterProto {
optional string filename = 1 [(help) = "filename of output sector image"];
@@ -42,6 +43,7 @@ message ImageWriterProto {
NsiOutputProto nsi = 6;
RawOutputProto raw = 7;
D88OutputProto d88 = 8;
ImdOutputProto imd = 9;
}
}