ImageReaders can now contribute config.

This commit is contained in:
dg
2023-05-12 22:20:13 +00:00
parent ff5f019ac1
commit 1d77ba6429
11 changed files with 49 additions and 42 deletions

View File

@@ -78,15 +78,15 @@ public:
if (disktype == 1)
{
/* 5.25" with quarter stepping. */
_fluxConfig.mutable_drive()->set_tracks(160);
_fluxConfig.mutable_drive()->set_heads(1);
_fluxConfig.mutable_drive()->set_head_width(4);
_fluxConfig.mutable_drive()->set_tpi(48 * 4);
_extraConfig.mutable_drive()->set_tracks(160);
_extraConfig.mutable_drive()->set_heads(1);
_extraConfig.mutable_drive()->set_head_width(4);
_extraConfig.mutable_drive()->set_tpi(48 * 4);
}
else
{
/* 3.5". */
_fluxConfig.mutable_drive()->set_tpi(135);
_extraConfig.mutable_drive()->set_tpi(135);
}
Bytes stream = findChunk("STRM");

View File

@@ -37,7 +37,7 @@ public:
{
_proto = loadFl2File(_config.filename());
*_fluxConfig.mutable_drive() = _proto.drive();
*_extraConfig.mutable_drive() = _proto.drive();
}
public:

View File

@@ -59,26 +59,30 @@ public:
static std::unique_ptr<FluxSource> create(const FluxSourceProto& spec);
public:
/* Returns any configuration this flux source might be carrying (e.g. tpi
* of the drive which made the capture). */
/* Returns any configuration this flux source might be carrying (e.g. tpi
* of the drive which made the capture). */
const ConfigProto& getConfig() const
{ return _fluxConfig; }
const ConfigProto& getExtraConfig() const
{
return _extraConfig;
}
/* Read flux from a given track and side. */
/* Read flux from a given track and side. */
virtual std::unique_ptr<FluxSourceIterator> readFlux(
int track, int side) = 0;
/* Recalibrates; seeks to track 0 and ensures the head is in the right place. */
/* Recalibrates; seeks to track 0 and ensures the head is in the right
* place. */
virtual void recalibrate() {}
/* Seeks to a given track (without recalibrating). */
/* Seeks to a given track (without recalibrating). */
virtual void seek(int track) {}
/* Is this real hardware? If so, then flux can be read indefinitely (among other things). */
/* Is this real hardware? If so, then flux can be read indefinitely (among
* other things). */
virtual bool isHardware()
{
@@ -86,7 +90,7 @@ public:
}
protected:
ConfigProto _fluxConfig;
ConfigProto _extraConfig;
};
class EmptyFluxSourceIterator : public FluxSourceIterator

View File

@@ -43,7 +43,7 @@ public:
error("input not a SCP file");
int tpi = (_header.flags & SCP_FLAG_96TPI) ? 96 : 48;
_fluxConfig.mutable_drive()->set_tpi(tpi);
_extraConfig.mutable_drive()->set_tpi(tpi);
_resolution = 25 * (_header.resolution + 1);
int startSide = (_header.heads == 2) ? 1 : 0;