mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Convert wybren1971's D64 reader and 1541 encoder to work with the new
architecture.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#include "globals.h"
|
||||
#include "flags.h"
|
||||
#include "dataspec.h"
|
||||
#include "sector.h"
|
||||
#include "sectorset.h"
|
||||
#include "imagereader/imagereader.h"
|
||||
#include "fmt/format.h"
|
||||
#include "proto.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
@@ -12,13 +12,13 @@
|
||||
class D64ImageReader : public ImageReader
|
||||
{
|
||||
public:
|
||||
D64ImageReader(const ImageSpec& spec):
|
||||
ImageReader(spec)
|
||||
D64ImageReader(const ImageReaderProto& config):
|
||||
ImageReader(config)
|
||||
{}
|
||||
|
||||
SectorSet readImage()
|
||||
{
|
||||
std::ifstream inputFile(spec.filename, std::ios::in | std::ios::binary);
|
||||
std::ifstream inputFile(_config.filename(), std::ios::in | std::ios::binary);
|
||||
if (!inputFile.is_open())
|
||||
Error() << "cannot open input file";
|
||||
|
||||
@@ -90,10 +90,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<ImageReader> ImageReader::createD64ImageReader(
|
||||
const ImageSpec& spec)
|
||||
std::unique_ptr<ImageReader> ImageReader::createD64ImageReader(const ImageReaderProto& config)
|
||||
{
|
||||
return std::unique_ptr<ImageReader>(new D64ImageReader(spec));
|
||||
return std::unique_ptr<ImageReader>(new D64ImageReader(config));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ std::unique_ptr<ImageReader> ImageReader::create(const ImageReaderProto& config)
|
||||
case ImageReaderProto::kJv3:
|
||||
return ImageReader::createJv3ImageReader(config);
|
||||
|
||||
case ImageReaderProto::kD64:
|
||||
return ImageReader::createD64ImageReader(config);
|
||||
|
||||
default:
|
||||
Error() << "bad input file config";
|
||||
return std::unique_ptr<ImageReader>();
|
||||
@@ -38,6 +41,7 @@ void ImageReader::updateConfigForFilename(ImageReaderProto* proto, const std::st
|
||||
{
|
||||
{".adf", [&]() { proto->mutable_img(); }},
|
||||
{".jv3", [&]() { proto->mutable_jv3(); }},
|
||||
{".d64", [&]() { proto->mutable_d64(); }},
|
||||
{".d81", [&]() { proto->mutable_img(); }},
|
||||
{".diskcopy", [&]() { proto->mutable_diskcopy(); }},
|
||||
{".img", [&]() { proto->mutable_img(); }},
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
static void updateConfigForFilename(ImageReaderProto* proto, const std::string& filename);
|
||||
|
||||
public:
|
||||
static std::unique_ptr<ImageReader> createD64ImageReader(const ImageReaderProto& config);
|
||||
static std::unique_ptr<ImageReader> createDiskCopyImageReader(const ImageReaderProto& config);
|
||||
static std::unique_ptr<ImageReader> createImgImageReader(const ImageReaderProto& config);
|
||||
static std::unique_ptr<ImageReader> createJv3ImageReader(const ImageReaderProto& config);
|
||||
|
||||
@@ -19,6 +19,7 @@ message ImgInputOutputProto {
|
||||
message DiskCopyInputProto {}
|
||||
message ImdInputProto {}
|
||||
message Jv3InputProto {}
|
||||
message D64InputProto {}
|
||||
|
||||
message ImageReaderProto {
|
||||
optional string filename = 1 [(help) = "filename of input sector image"];
|
||||
@@ -27,6 +28,7 @@ message ImageReaderProto {
|
||||
DiskCopyInputProto diskcopy = 3;
|
||||
ImdInputProto imd = 4;
|
||||
Jv3InputProto jv3 = 5;
|
||||
D64InputProto d64 = 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user