Sort out a whole bunch of other things, including cleaning up the way the

verification source is handled.
This commit is contained in:
dg
2023-05-12 23:28:25 +00:00
parent 1d77ba6429
commit dcfcc6271c
56 changed files with 2189 additions and 923 deletions

View File

@@ -5,6 +5,7 @@
#define AESLANIER_SECTOR_LENGTH 256
#define AESLANIER_RECORD_SIZE (AESLANIER_SECTOR_LENGTH + 5)
extern std::unique_ptr<Decoder> createAesLanierDecoder(const DecoderProto& config);
extern std::unique_ptr<Decoder> createAesLanierDecoder(
const DecoderProto& config);
#endif

View File

@@ -17,4 +17,3 @@ extern std::unique_ptr<Encoder> createAgatEncoder(const EncoderProto& config);
extern uint8_t agatChecksum(const Bytes& bytes);
#endif

View File

@@ -17,4 +17,3 @@ extern std::unique_ptr<Decoder> createApple2Decoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createApple2Encoder(const EncoderProto& config);
#endif

View File

@@ -13,7 +13,9 @@
#define BROTHER_TRACKS_PER_120KB_DISK 39
#define BROTHER_SECTORS_PER_TRACK 12
extern std::unique_ptr<Decoder> createBrotherDecoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createBrotherEncoder(const EncoderProto& config);
extern std::unique_ptr<Decoder> createBrotherDecoder(
const DecoderProto& config);
extern std::unique_ptr<Encoder> createBrotherEncoder(
const EncoderProto& config);
#endif

View File

@@ -30,4 +30,3 @@ GCR_ENTRY(0xef, 28) // 11100
GCR_ENTRY(0xf5, 29) // 11101
GCR_ENTRY(0xf7, 30) // 11110
GCR_ENTRY(0xfb, 31) // 11111

View File

@@ -76,4 +76,3 @@ GCR_ENTRY(0x6BAB, 74)
GCR_ENTRY(0xAD5F, 75)
GCR_ENTRY(0xDBED, 76)
GCR_ENTRY(0x55BB, 77)

View File

@@ -27,8 +27,10 @@
#define C64_TRACKS_PER_DISK 40
#define C64_BAM_TRACK 17
extern std::unique_ptr<Decoder> createCommodore64Decoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createCommodore64Encoder(const EncoderProto& config);
extern std::unique_ptr<Decoder> createCommodore64Decoder(
const DecoderProto& config);
extern std::unique_ptr<Encoder> createCommodore64Encoder(
const EncoderProto& config);
extern nanoseconds_t clockPeriodForC64Track(unsigned track);

View File

@@ -5,6 +5,7 @@
#define F85_DATA_RECORD 0xffffcb /* 1111 1111 1111 1111 1100 1101 */
#define F85_SECTOR_LENGTH 512
extern std::unique_ptr<Decoder> createDurangoF85Decoder(const DecoderProto& config);
extern std::unique_ptr<Decoder> createDurangoF85Decoder(
const DecoderProto& config);
#endif

View File

@@ -8,4 +8,3 @@
extern std::unique_ptr<Decoder> createFb100Decoder(const DecoderProto& config);
#endif

View File

@@ -31,9 +31,7 @@ class Decoder;
class DecoderProto;
class EncoderProto;
extern std::unique_ptr<Decoder> createIbmDecoder(
const DecoderProto& config);
extern std::unique_ptr<Encoder> createIbmEncoder(
const EncoderProto& config);
extern std::unique_ptr<Decoder> createIbmDecoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createIbmEncoder(const EncoderProto& config);
#endif

View File

@@ -15,8 +15,9 @@ class Decoder;
class DecoderProto;
class EncoderProto;
extern std::unique_ptr<Decoder> createMacintoshDecoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createMacintoshEncoder(const EncoderProto& config);
extern std::unique_ptr<Decoder> createMacintoshDecoder(
const DecoderProto& config);
extern std::unique_ptr<Encoder> createMacintoshEncoder(
const EncoderProto& config);
#endif

View File

@@ -2,16 +2,19 @@
#define MICROPOLIS_H
#define MICROPOLIS_PAYLOAD_SIZE (256)
#define MICROPOLIS_HEADER_SIZE (1+2+10)
#define MICROPOLIS_ENCODED_SECTOR_SIZE (MICROPOLIS_HEADER_SIZE + MICROPOLIS_PAYLOAD_SIZE + 6)
#define MICROPOLIS_HEADER_SIZE (1 + 2 + 10)
#define MICROPOLIS_ENCODED_SECTOR_SIZE \
(MICROPOLIS_HEADER_SIZE + MICROPOLIS_PAYLOAD_SIZE + 6)
class Decoder;
class Encoder;
class EncoderProto;
class DecoderProto;
extern std::unique_ptr<Decoder> createMicropolisDecoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createMicropolisEncoder(const EncoderProto& config);
extern std::unique_ptr<Decoder> createMicropolisDecoder(
const DecoderProto& config);
extern std::unique_ptr<Encoder> createMicropolisEncoder(
const EncoderProto& config);
extern uint8_t micropolisChecksum(const Bytes& bytes);

View File

@@ -1,7 +1,8 @@
#ifndef NORTHSTAR_H
#define NORTHSTAR_H
/* Northstar floppies are 10-hard sectored disks with a sector format as follows:
/* Northstar floppies are 10-hard sectored disks with a sector format as
* follows:
*
* |----------------------------------|
* | SYNC Byte | Payload | Checksum |
@@ -19,8 +20,12 @@
#define NORTHSTAR_PAYLOAD_SIZE_SD (256)
#define NORTHSTAR_PAYLOAD_SIZE_DD (512)
#define NORTHSTAR_CHECKSUM_SIZE (1)
#define NORTHSTAR_ENCODED_SECTOR_SIZE_SD (NORTHSTAR_HEADER_SIZE_SD + NORTHSTAR_PAYLOAD_SIZE_SD + NORTHSTAR_CHECKSUM_SIZE)
#define NORTHSTAR_ENCODED_SECTOR_SIZE_DD (NORTHSTAR_HEADER_SIZE_DD + NORTHSTAR_PAYLOAD_SIZE_DD + NORTHSTAR_CHECKSUM_SIZE)
#define NORTHSTAR_ENCODED_SECTOR_SIZE_SD \
(NORTHSTAR_HEADER_SIZE_SD + NORTHSTAR_PAYLOAD_SIZE_SD + \
NORTHSTAR_CHECKSUM_SIZE)
#define NORTHSTAR_ENCODED_SECTOR_SIZE_DD \
(NORTHSTAR_HEADER_SIZE_DD + NORTHSTAR_PAYLOAD_SIZE_DD + \
NORTHSTAR_CHECKSUM_SIZE)
class Decoder;
class Encoder;
@@ -29,7 +34,9 @@ class DecoderProto;
extern uint8_t northstarChecksum(const Bytes& bytes);
extern std::unique_ptr<Decoder> createNorthstarDecoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createNorthstarEncoder(const EncoderProto& config);
extern std::unique_ptr<Decoder> createNorthstarDecoder(
const DecoderProto& config);
extern std::unique_ptr<Encoder> createNorthstarEncoder(
const EncoderProto& config);
#endif /* NORTHSTAR */

View File

@@ -1,4 +1,4 @@
#pragma once
extern std::unique_ptr<Decoder> createRolandD20Decoder(const DecoderProto& config);
extern std::unique_ptr<Decoder> createRolandD20Decoder(
const DecoderProto& config);

View File

@@ -7,4 +7,3 @@
extern std::unique_ptr<Decoder> createSmaky6Decoder(const DecoderProto& config);
#endif

View File

@@ -10,9 +10,9 @@ class Decoder;
class DecoderProto;
class EncoderProto;
extern std::unique_ptr<Decoder> createTids990Decoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createTids990Encoder(const EncoderProto& config);
extern std::unique_ptr<Decoder> createTids990Decoder(
const DecoderProto& config);
extern std::unique_ptr<Encoder> createTids990Encoder(
const EncoderProto& config);
#endif

View File

@@ -18,7 +18,9 @@ class DecoderProto;
#define VICTOR9K_SECTOR_LENGTH 512
extern std::unique_ptr<Decoder> createVictor9kDecoder(const DecoderProto& config);
extern std::unique_ptr<Encoder> createVictor9kEncoder(const EncoderProto& config);
extern std::unique_ptr<Decoder> createVictor9kDecoder(
const DecoderProto& config);
extern std::unique_ptr<Encoder> createVictor9kEncoder(
const EncoderProto& config);
#endif

View File

@@ -1,8 +1,7 @@
#ifndef ZILOGMCZ_H
#define ZILOGMCZ_H
extern std::unique_ptr<Decoder> createZilogMczDecoder(const DecoderProto& config);
extern std::unique_ptr<Decoder> createZilogMczDecoder(
const DecoderProto& config);
#endif

View File

@@ -1,10 +1,11 @@
#ifndef A2R_H
#define A2R_H
// The canonical reference for the A2R format is: https://applesaucefdc.com/a2r2-reference/
// All data is stored little-endian
// The canonical reference for the A2R format is:
// https://applesaucefdc.com/a2r2-reference/ All data is stored little-endian
// Note: The first chunk begins at byte offset 8, not 12 as given in a2r2 reference version 2.0.1
// Note: The first chunk begins at byte offset 8, not 12 as given in a2r2
// reference version 2.0.1
#define A2R_CHUNK_INFO (0x4F464E49)
#define A2R_CHUNK_STRM (0x4D525453)
@@ -12,12 +13,14 @@
#define A2R_INFO_CHUNK_VERSION (1)
enum A2RDiskType {
enum A2RDiskType
{
A2R_DISK_525 = 1,
A2R_DISK_35 = 2,
};
enum A2RCaptureType {
enum A2RCaptureType
{
A2R_TIMING = 1,
A2R_BITS = 2,
A2R_XTIMING = 3,

View File

@@ -14,6 +14,7 @@ public:
private:
std::vector<uint8_t> _bitmap;
std::unique_ptr<Agg2D> _painter;
public:
std::string filename;
unsigned width;

View File

@@ -16,9 +16,11 @@ public:
Bytes(const std::string& data);
Bytes(std::initializer_list<uint8_t> data);
Bytes(std::shared_ptr<std::vector<uint8_t>> data);
Bytes(std::shared_ptr<std::vector<uint8_t>> data, unsigned start, unsigned end);
Bytes(std::shared_ptr<std::vector<uint8_t>> data,
unsigned start,
unsigned end);
Bytes* operator = (const Bytes& other);
Bytes* operator=(const Bytes& other);
public:
static Bytes readFromFile(const std::string& filename);
@@ -26,26 +28,59 @@ public:
public:
/* General purpose methods */
unsigned size() const { return _high - _low; }
bool empty() const { return _high == _low; }
unsigned size() const
{
return _high - _low;
}
bool empty() const
{
return _high == _low;
}
bool operator == (const Bytes& other) const
{ return std::equal(cbegin(), cend(), other.cbegin(), other.cend()); }
bool operator==(const Bytes& other) const
{
return std::equal(cbegin(), cend(), other.cbegin(), other.cend());
}
bool operator != (const Bytes& other) const
{ return !(*this == other); }
bool operator!=(const Bytes& other) const
{
return !(*this == other);
}
const uint8_t& operator [] (unsigned offset) const;
const uint8_t* cbegin() const { return _data->data() + _low; }
const uint8_t* cend() const { return _data->data() + _high; }
const uint8_t* begin() const { return _data->data() + _low; }
const uint8_t* end() const { return _data->data() + _high; }
const uint8_t& operator[](unsigned offset) const;
const uint8_t* cbegin() const
{
return _data->data() + _low;
}
const uint8_t* cend() const
{
return _data->data() + _high;
}
const uint8_t* begin() const
{
return _data->data() + _low;
}
const uint8_t* end() const
{
return _data->data() + _high;
}
uint8_t& operator [] (unsigned offset);
uint8_t* begin() { checkWritable(); return _data->data() + _low; }
uint8_t* end() { checkWritable(); return _data->data() + _high; }
uint8_t& operator[](unsigned offset);
uint8_t* begin()
{
checkWritable();
return _data->data() + _low;
}
uint8_t* end()
{
checkWritable();
return _data->data() + _high;
}
operator std::string () const { return std::string(cbegin(), cend()); }
operator std::string() const
{
return std::string(cbegin(), cend());
}
void boundsCheck(unsigned pos) const;
void checkWritable();
@@ -53,7 +88,10 @@ public:
Bytes& resize(unsigned size);
Bytes& clear()
{ resize(0); return *this; }
{
resize(0);
return *this;
}
std::vector<Bytes> split(uint8_t separator) const;
@@ -65,8 +103,8 @@ public:
std::vector<bool> toBits() const;
Bytes reverseBits() const;
Bytes operator + (const Bytes& other);
Bytes operator * (size_t count);
Bytes operator+(const Bytes& other);
Bytes operator*(size_t count);
ByteReader reader() const;
ByteWriter writer();
@@ -83,15 +121,15 @@ private:
class ByteReader
{
public:
ByteReader(const Bytes& bytes):
_bytes(bytes)
{}
ByteReader(const Bytes& bytes): _bytes(bytes) {}
ByteReader(const Bytes&&) = delete;
unsigned pos = 0;
bool eof() const
{ return pos >= _bytes.size(); }
{
return pos >= _bytes.size();
}
ByteReader& seek(unsigned pos)
{
@@ -121,7 +159,7 @@ public:
{
uint8_t b1 = _bytes[pos++];
uint8_t b2 = _bytes[pos++];
return (b1<<8) | b2;
return (b1 << 8) | b2;
}
uint32_t read_be24()
@@ -129,7 +167,7 @@ public:
uint8_t b1 = _bytes[pos++];
uint8_t b2 = _bytes[pos++];
uint8_t b3 = _bytes[pos++];
return (b1<<16) | (b2<<8) | b3;
return (b1 << 16) | (b2 << 8) | b3;
}
uint32_t read_be32()
@@ -138,7 +176,7 @@ public:
uint8_t b2 = _bytes[pos++];
uint8_t b3 = _bytes[pos++];
uint8_t b4 = _bytes[pos++];
return (b1<<24) | (b2<<16) | (b3<<8) | b4;
return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
}
uint64_t read_be48();
@@ -148,7 +186,7 @@ public:
{
uint8_t b1 = _bytes[pos++];
uint8_t b2 = _bytes[pos++];
return (b2<<8) | b1;
return (b2 << 8) | b1;
}
uint32_t read_le24()
@@ -156,7 +194,7 @@ public:
uint8_t b1 = _bytes[pos++];
uint8_t b2 = _bytes[pos++];
uint8_t b3 = _bytes[pos++];
return (b3<<16) | (b2<<8) | b1;
return (b3 << 16) | (b2 << 8) | b1;
}
uint32_t read_le32()
@@ -165,7 +203,7 @@ public:
uint8_t b2 = _bytes[pos++];
uint8_t b3 = _bytes[pos++];
uint8_t b4 = _bytes[pos++];
return (b4<<24) | (b3<<16) | (b2<<8) | b1;
return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
}
private:
@@ -175,9 +213,7 @@ private:
class ByteWriter
{
public:
ByteWriter(Bytes& bytes):
_bytes(bytes)
{}
ByteWriter(Bytes& bytes): _bytes(bytes) {}
ByteWriter(const Bytes&&) = delete;
@@ -205,7 +241,7 @@ public:
ByteWriter& write_be16(uint16_t value)
{
_bytes.adjustBounds(pos+1);
_bytes.adjustBounds(pos + 1);
uint8_t* p = _bytes.begin();
p[pos++] = value >> 8;
p[pos++] = value;
@@ -214,7 +250,7 @@ public:
ByteWriter& write_be24(uint32_t value)
{
_bytes.adjustBounds(pos+2);
_bytes.adjustBounds(pos + 2);
uint8_t* p = _bytes.begin();
p[pos++] = value >> 16;
p[pos++] = value >> 8;
@@ -224,7 +260,7 @@ public:
ByteWriter& write_be32(uint32_t value)
{
_bytes.adjustBounds(pos+3);
_bytes.adjustBounds(pos + 3);
uint8_t* p = _bytes.begin();
p[pos++] = value >> 24;
p[pos++] = value >> 16;
@@ -235,7 +271,7 @@ public:
ByteWriter& write_le16(uint16_t value)
{
_bytes.adjustBounds(pos+1);
_bytes.adjustBounds(pos + 1);
uint8_t* p = _bytes.begin();
p[pos++] = value;
p[pos++] = value >> 8;
@@ -244,7 +280,7 @@ public:
ByteWriter& write_le24(uint32_t value)
{
_bytes.adjustBounds(pos+2);
_bytes.adjustBounds(pos + 2);
uint8_t* p = _bytes.begin();
p[pos++] = value;
p[pos++] = value >> 8;
@@ -254,7 +290,7 @@ public:
ByteWriter& write_le32(uint32_t value)
{
_bytes.adjustBounds(pos+3);
_bytes.adjustBounds(pos + 3);
uint8_t* p = _bytes.begin();
p[pos++] = value;
p[pos++] = value >> 8;
@@ -263,7 +299,7 @@ public:
return *this;
}
ByteWriter& operator += (std::initializer_list<uint8_t> data)
ByteWriter& operator+=(std::initializer_list<uint8_t> data)
{
_bytes.adjustBounds(pos + data.size() - 1);
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
@@ -271,7 +307,7 @@ public:
return *this;
}
ByteWriter& operator += (const std::vector<uint8_t>& data)
ByteWriter& operator+=(const std::vector<uint8_t>& data)
{
_bytes.adjustBounds(pos + data.size() - 1);
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
@@ -279,7 +315,7 @@ public:
return *this;
}
ByteWriter& operator += (const Bytes data)
ByteWriter& operator+=(const Bytes data)
{
_bytes.adjustBounds(pos + data.size() - 1);
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
@@ -287,7 +323,7 @@ public:
return *this;
}
ByteWriter& operator += (std::istream& stream);
ByteWriter& operator+=(std::istream& stream);
ByteWriter& append(const char* data)
{
@@ -316,14 +352,15 @@ private:
class BitWriter
{
public:
BitWriter(ByteWriter& bw):
_bw(bw)
{}
BitWriter(ByteWriter& bw): _bw(bw) {}
BitWriter(ByteWriter&&) = delete;
void push(uint32_t bits, size_t size);
void push(bool bit) { push(bit, 1); }
void push(bool bit)
{
push(bit, 1);
}
void flush();
private:
@@ -335,9 +372,7 @@ private:
class BitReader
{
public:
BitReader(ByteReader& br):
_br(br)
{}
BitReader(ByteReader& br): _br(br) {}
BitReader(ByteReader&&) = delete;
@@ -358,16 +393,16 @@ static inline uint8_t reverse_bits(uint8_t b)
return b;
}
extern uint8_t toByte(
std::vector<bool>::const_iterator start,
extern uint8_t toByte(std::vector<bool>::const_iterator start,
std::vector<bool>::const_iterator end);
extern Bytes toBytes(
std::vector<bool>::const_iterator start,
extern Bytes toBytes(std::vector<bool>::const_iterator start,
std::vector<bool>::const_iterator end);
inline Bytes toBytes(const std::vector<bool>& bits)
{ return toBytes(bits.begin(), bits.end()); }
{
return toBytes(bits.begin(), bits.end());
}
extern std::vector<bool> reverseBits(const std::vector<bool>& bits);

View File

@@ -104,7 +104,7 @@ const OptionProto& Config::findOption(const std::string& optionName)
throw OptionNotFoundException("option name not found");
}
bool Config::isOptionValid(const OptionProto& option)
void Config::checkOptionValid(const OptionProto& option)
{
for (const auto& req : option.requires())
{
@@ -121,10 +121,40 @@ bool Config::isOptionValid(const OptionProto& option)
}
if (!matched)
{
std::stringstream ss;
ss << '[';
bool first = true;
for (auto requiredValue : req.value())
{
if (!first)
ss << ", ";
ss << quote(requiredValue);
first = false;
}
ss << ']';
throw InapplicableOptionException(
fmt::format("option '{}' is inapplicable to this configuration "
"because {}={} could not be met",
option.name(),
req.key(),
ss.str()));
}
}
}
bool Config::isOptionValid(const OptionProto& option)
{
try
{
checkOptionValid(option);
return true;
}
catch (const InapplicableOptionException& e)
{
return false;
}
return true;
}
void Config::applyOption(const OptionProto& option)
@@ -137,10 +167,7 @@ void Config::applyOption(const OptionProto& option)
throw InvalidOptionException(fmt::format(
"option '{}' has an option group inside it, which isn't allowed",
option.name()));
if (!isOptionValid(option))
throw InapplicableOptionException(
fmt::format("option '{}' is inapplicable to this configuration",
option.name()));
checkOptionValid(option);
log("OPTION: {}",
option.has_message() ? option.message() : option.comment());
@@ -148,7 +175,7 @@ void Config::applyOption(const OptionProto& option)
(*this)->MergeFrom(option.config());
}
void Config::setFluxSource(std::string filename)
static void setFluxSourceImpl(std::string filename, FluxSourceProto* proto)
{
static const std::vector<std::pair<std::regex,
std::function<void(const std::string&, FluxSourceProto*)>>>
@@ -212,7 +239,7 @@ void Config::setFluxSource(std::string filename)
std::smatch match;
if (std::regex_match(filename, match, it.first))
{
it.second(match[1], (*this)->mutable_flux_source());
it.second(match[1], proto);
return;
}
}
@@ -220,6 +247,11 @@ void Config::setFluxSource(std::string filename)
error("unrecognised flux filename '{}'", filename);
}
void Config::setFluxSource(std::string filename)
{
setFluxSourceImpl(filename, (*this)->mutable_flux_source());
}
static void setFluxSinkImpl(std::string filename, FluxSinkProto* proto)
{
static const std::vector<std::pair<std::regex,
@@ -287,6 +319,11 @@ void Config::setCopyFluxTo(std::string filename)
filename, (*this)->mutable_decoder()->mutable_copy_flux_to());
}
void Config::setVerificationFluxSource(std::string filename)
{
setFluxSourceImpl(filename, &_verificationFluxSourceProto);
}
void Config::setImageReader(std::string filename)
{
static const std::map<std::string, std::function<void(ImageReaderProto*)>>
@@ -378,6 +415,24 @@ std::shared_ptr<FluxSource>& Config::getFluxSource()
return _fluxSource;
}
bool Config::hasVerificationFluxSource() const
{
return _verificationFluxSourceProto.type() != FluxSourceProto::NOT_SET;
}
std::shared_ptr<FluxSource>& Config::getVerificationFluxSource()
{
if (!_verificationFluxSource)
{
if (!hasVerificationFluxSource())
error("no verification flux source configured");
_verificationFluxSource =
std::shared_ptr(FluxSource::create(_verificationFluxSourceProto));
}
return _verificationFluxSource;
}
bool Config::hasImageReader() const
{
return (*this)->image_reader().type() != ImageReaderProto::NOT_SET;

View File

@@ -2,6 +2,8 @@
#ifdef __cplusplus
#include "lib/fluxsource/fluxsource.pb.h"
class ConfigProto;
class OptionProto;
class FluxSource;
@@ -16,27 +18,35 @@ public:
class OptionNotFoundException : public OptionException
{
public:
OptionNotFoundException(const std::string& message): OptionException(message) {}
OptionNotFoundException(const std::string& message):
OptionException(message)
{
}
};
class InvalidOptionException : public OptionException
{
public:
InvalidOptionException(const std::string& message): OptionException(message) {}
InvalidOptionException(const std::string& message): OptionException(message)
{
}
};
class InapplicableOptionException : public OptionException
{
public:
InapplicableOptionException(const std::string& message): OptionException(message) {}
InapplicableOptionException(const std::string& message):
OptionException(message)
{
}
};
class Config
{
public:
ConfigProto* operator -> () const;
operator ConfigProto* () const;
operator ConfigProto& () const;
ConfigProto* operator->() const;
operator ConfigProto*() const;
operator ConfigProto&() const;
/* Set and get individual config keys. */
@@ -55,6 +65,7 @@ public:
* is valid, and apply an option. */
const OptionProto& findOption(const std::string& option);
void checkOptionValid(const OptionProto& option);
bool isOptionValid(const OptionProto& option);
void applyOption(const OptionProto& option);
@@ -62,6 +73,7 @@ public:
void setFluxSource(std::string value);
void setFluxSink(std::string value);
void setVerificationFluxSource(std::string value);
void setCopyFluxTo(std::string value);
void setImageReader(std::string value);
void setImageWriter(std::string value);
@@ -72,13 +84,16 @@ public:
std::shared_ptr<FluxSource>& getFluxSource();
bool hasImageReader() const;
std::shared_ptr<ImageReader>& getImageReader();
bool hasVerificationFluxSource() const;
std::shared_ptr<FluxSource>& getVerificationFluxSource();
private:
std::shared_ptr<FluxSource> _fluxSource;
std::shared_ptr<ImageReader> _imageReader;
std::shared_ptr<FluxSource> _verificationFluxSource;
FluxSourceProto _verificationFluxSourceProto;
};
extern Config& globalConfig();
#endif

View File

@@ -25,10 +25,13 @@ extern uint16_t crc16ref(uint16_t poly, uint16_t init, const Bytes& bytes);
extern uint32_t crcbrother(const Bytes& bytes);
static inline uint16_t crc16(uint16_t poly, const Bytes& bytes)
{ return crc16(poly, 0xffff, bytes); }
{
return crc16(poly, 0xffff, bytes);
}
static inline uint16_t crc16ref(uint16_t poly, const Bytes& bytes)
{ return crc16ref(poly, 0xffff, bytes); }
{
return crc16ref(poly, 0xffff, bytes);
}
#endif

View File

@@ -6,9 +6,7 @@
class CsvReader
{
public:
CsvReader(std::istream& istream):
_istream(istream)
{}
CsvReader(std::istream& istream): _istream(istream) {}
std::vector<std::string> readLine();
@@ -17,4 +15,3 @@ private:
};
#endif

View File

@@ -6,8 +6,8 @@ class FluxmapReader;
class FluxDecoder
{
public:
FluxDecoder(FluxmapReader* fmr, nanoseconds_t bitcell,
const DecoderProto& config);
FluxDecoder(
FluxmapReader* fmr, nanoseconds_t bitcell, const DecoderProto& config);
bool readBit();
std::vector<bool> readBits(unsigned count);
@@ -17,6 +17,7 @@ public:
{
return readBits(UINT_MAX);
}
private:
nanoseconds_t nextFlux();
@@ -38,4 +39,3 @@ private:
};
#endif

View File

@@ -34,7 +34,9 @@ public:
bool matches(const unsigned* intervals, FluxMatch& match) const override;
unsigned intervals() const override
{ return _intervals.size(); }
{
return _intervals.size();
}
private:
std::vector<unsigned> _intervals;
@@ -56,7 +58,9 @@ public:
bool matches(const unsigned* intervals, FluxMatch& match) const override;
unsigned intervals() const override
{ return _intervals; }
{
return _intervals;
}
private:
unsigned _intervals;
@@ -77,10 +81,14 @@ public:
}
bool eof() const
{ return _pos.bytes == _size; }
{
return _pos.bytes == _size;
}
Fluxmap::Position tell() const
{ return _pos; }
{
return _pos;
}
/* Important! You can only reliably seek to 1 bits. */
void seek(const Fluxmap::Position& pos)
@@ -104,7 +112,8 @@ public:
void seekToIndexMark();
nanoseconds_t seekToPattern(const FluxMatcher& pattern);
nanoseconds_t seekToPattern(const FluxMatcher& pattern, const FluxMatcher*& matching);
nanoseconds_t seekToPattern(
const FluxMatcher& pattern, const FluxMatcher*& matching);
private:
const Fluxmap& _fluxmap;

View File

@@ -8,24 +8,35 @@ public:
std::unique_ptr<std::vector<size_t>> indices):
_bits(std::move(bits)),
_indices(std::move(indices))
{}
{
}
typedef std::vector<bool>::const_iterator const_iterator;
const_iterator begin() const
{ return _bits->begin(); }
{
return _bits->begin();
}
const_iterator end() const
{ return _bits->end(); }
{
return _bits->end();
}
size_t size() const
{ return _bits->size(); }
{
return _bits->size();
}
const bool operator[] (size_t pos) const
{ return _bits->at(pos); }
const bool operator[](size_t pos) const
{
return _bits->at(pos);
}
const std::vector<size_t> indices() const
{ return *_indices; }
{
return *_indices;
}
private:
std::unique_ptr<std::vector<bool>> _bits;

View File

@@ -18,12 +18,15 @@ public:
public:
virtual std::shared_ptr<const Sector> getSector(
std::shared_ptr<const TrackInfo>&, const Image& image, unsigned sectorId);
std::shared_ptr<const TrackInfo>&,
const Image& image,
unsigned sectorId);
virtual std::vector<std::shared_ptr<const Sector>> collectSectors(
std::shared_ptr<const TrackInfo>&, const Image& image);
virtual std::unique_ptr<Fluxmap> encode(std::shared_ptr<const TrackInfo>& trackInfo,
virtual std::unique_ptr<Fluxmap> encode(
std::shared_ptr<const TrackInfo>& trackInfo,
const std::vector<std::shared_ptr<const Sector>>& sectors,
const Image& image) = 0;

View File

@@ -7,4 +7,3 @@ extern FluxFileProto loadFl2File(const std::string filename);
extern void saveFl2File(const std::string filename, FluxFileProto& proto);
#endif

View File

@@ -1,8 +1,10 @@
#include "globals.h"
#include "flags.h"
#include "proto.h"
#include "utils.h"
#include "logger.h"
#include "lib/globals.h"
#include "lib/flags.h"
#include "lib/proto.h"
#include "lib/utils.h"
#include "lib/logger.h"
#include "lib/fluxsource/fluxsource.h"
#include "lib/imagereader/imagereader.h"
#include <google/protobuf/text_format.h>
#include <regex>
#include <fstream>
@@ -192,6 +194,17 @@ std::vector<std::string> FlagGroup::parseFlagsWithFilenames(int argc,
}
}
/* Add any config contributed by the flux and image readers, plus overrides.
*/
if (globalConfig().hasFluxSource())
globalConfig()->MergeFrom(
globalConfig().getFluxSource()->getExtraConfig());
if (globalConfig().hasImageReader())
globalConfig()->MergeFrom(
globalConfig().getImageReader()->getExtraConfig());
applyOverrides();
/* Then apply any default options in groups, likewise applying the
* overrides. */

View File

@@ -18,28 +18,43 @@ class FluxSink
public:
virtual ~FluxSink() {}
static std::unique_ptr<FluxSink> createHardwareFluxSink(const HardwareFluxSinkProto& config);
static std::unique_ptr<FluxSink> createAuFluxSink(const AuFluxSinkProto& config);
static std::unique_ptr<FluxSink> createA2RFluxSink(const A2RFluxSinkProto& config);
static std::unique_ptr<FluxSink> createVcdFluxSink(const VcdFluxSinkProto& config);
static std::unique_ptr<FluxSink> createScpFluxSink(const ScpFluxSinkProto& config);
static std::unique_ptr<FluxSink> createFl2FluxSink(const Fl2FluxSinkProto& config);
static std::unique_ptr<FluxSink> createHardwareFluxSink(
const HardwareFluxSinkProto& config);
static std::unique_ptr<FluxSink> createAuFluxSink(
const AuFluxSinkProto& config);
static std::unique_ptr<FluxSink> createA2RFluxSink(
const A2RFluxSinkProto& config);
static std::unique_ptr<FluxSink> createVcdFluxSink(
const VcdFluxSinkProto& config);
static std::unique_ptr<FluxSink> createScpFluxSink(
const ScpFluxSinkProto& config);
static std::unique_ptr<FluxSink> createFl2FluxSink(
const Fl2FluxSinkProto& config);
static std::unique_ptr<FluxSink> createFl2FluxSink(const std::string& filename);
static std::unique_ptr<FluxSink> createFl2FluxSink(
const std::string& filename);
static std::unique_ptr<FluxSink> create(const FluxSinkProto& config);
public:
/* Writes a fluxmap to a track and side. */
virtual void writeFlux(int track, int side, const Fluxmap& fluxmap) = 0;
virtual operator std::string () const = 0;
/* Returns whether this is writing to real hardware or not. */
virtual bool isHardware() const
{
return false;
}
virtual operator std::string() const = 0;
};
inline std::ostream& operator << (std::ostream& stream, FluxSink& flushSink)
inline std::ostream& operator<<(std::ostream& stream, FluxSink& flushSink)
{
stream << (std::string)flushSink;
return stream;
}
#endif

View File

@@ -39,7 +39,12 @@ public:
return usbWrite(side, fluxmap.rawBytes(), _hardSectorThreshold);
}
operator std::string() const
bool isHardware() const override
{
return true;
}
operator std::string() const override
{
return fmt::format("drive {}", globalConfig()->drive().drive());
}

View File

@@ -1,7 +1,8 @@
#ifndef STREAM_H
#define STREAM_H
extern std::unique_ptr<Fluxmap> readStream(const std::string& dir, unsigned track, unsigned side);
extern std::unique_ptr<Fluxmap> readStream(
const std::string& dir, unsigned track, unsigned side);
extern std::unique_ptr<Fluxmap> readStream(const std::string& path);
extern std::unique_ptr<Fluxmap> readStream(const Bytes& bytes);

View File

@@ -24,7 +24,9 @@
template <class T>
static inline std::vector<T> vector_of(T item)
{ return std::vector<T> { item }; }
{
return std::vector<T>{item};
}
typedef double nanoseconds_t;
class Bytes;
@@ -35,7 +37,7 @@ extern void hexdumpForSrp16(std::ostream& stream, const Bytes& bytes);
struct ErrorException
{
ErrorException(const std::string& message): message(message){}
ErrorException(const std::string& message): message(message) {}
const std::string message;
@@ -43,10 +45,9 @@ struct ErrorException
};
template <typename... Args>
[[ noreturn ]]
inline void error(fmt::string_view fstr, const Args&... args)
[[noreturn]] inline void error(fmt::string_view fstr, const Args&... args)
{
throw ErrorException { fmt::format(fstr, args...) };
throw ErrorException{fmt::format(fstr, args...)};
}
extern void warning(const std::string msg);
@@ -57,8 +58,13 @@ inline void warning(fmt::string_view fstr, const Args&... args)
warning(fmt::format(fstr, args...));
}
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
template <class... Ts>
struct overloaded : Ts...
{
using Ts::operator()...;
};
template <class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;
#include "lib/config.h"

View File

@@ -44,7 +44,10 @@ public:
public:
/* Returns any extra config the image might want to contribute. */
const ConfigProto& getContributedConfig() const;
const ConfigProto& getExtraConfig() const
{
return _extraConfig;
}
/* Directly reads the image. */

View File

@@ -19,7 +19,9 @@ public:
public:
const Bytes& get(uint32_t address) const
{ return blocks.at(address).data; }
{
return blocks.at(address).data;
}
uint32_t put(const Bytes& data, uint32_t type);

View File

@@ -7,7 +7,10 @@
class ProtoPathNotFoundException : public ErrorException
{
public:
ProtoPathNotFoundException(const std::string& message): ErrorException(message) {}
ProtoPathNotFoundException(const std::string& message):
ErrorException(message)
{
}
};
extern void setRange(RangeProto* range, const std::string& data);
@@ -26,8 +29,8 @@ extern std::string getProtoFieldValue(ProtoField& protoField);
extern void setProtoByString(google::protobuf::Message* message,
const std::string& path,
const std::string& value);
extern std::string getProtoByString(google::protobuf::Message* message,
const std::string& path);
extern std::string getProtoByString(
google::protobuf::Message* message, const std::string& path);
extern std::set<unsigned> iterate(const RangeProto& range);
extern std::set<unsigned> iterate(unsigned start, unsigned count);

View File

@@ -19,12 +19,12 @@ struct ScpHeader
enum
{
SCP_FLAG_INDEXED = (1<<0),
SCP_FLAG_96TPI = (1<<1),
SCP_FLAG_360RPM = (1<<2),
SCP_FLAG_NORMALIZED = (1<<3),
SCP_FLAG_READWRITE = (1<<4),
SCP_FLAG_FOOTER = (1<<5)
SCP_FLAG_INDEXED = (1 << 0),
SCP_FLAG_96TPI = (1 << 1),
SCP_FLAG_360RPM = (1 << 2),
SCP_FLAG_NORMALIZED = (1 << 3),
SCP_FLAG_READWRITE = (1 << 4),
SCP_FLAG_FOOTER = (1 << 5)
};
struct ScpTrackHeader

View File

@@ -15,8 +15,7 @@ struct LogicalLocation
std::tuple<int, int, int> key() const
{
return std::make_tuple(
logicalTrack, logicalSide, logicalSector);
return std::make_tuple(logicalTrack, logicalSide, logicalSector);
}
bool operator==(const LogicalLocation& rhs) const
@@ -65,7 +64,7 @@ struct Sector : public LogicalLocation
Sector() {}
Sector(std::shared_ptr<const TrackInfo>& layout, unsigned sectorId=0);
Sector(std::shared_ptr<const TrackInfo>& layout, unsigned sectorId = 0);
Sector(const LogicalLocation& location);
@@ -91,8 +90,7 @@ struct Sector : public LogicalLocation
}
};
extern bool sectorPointerSortPredicate(
const std::shared_ptr<const Sector>& lhs,
extern bool sectorPointerSortPredicate(const std::shared_ptr<const Sector>& lhs,
const std::shared_ptr<const Sector>& rhs);
extern bool sectorPointerEqualsPredicate(
const std::shared_ptr<const Sector>& lhs,

View File

@@ -4,7 +4,7 @@
#define GREASEWEAZLE_VID 0x1209
#define GREASEWEAZLE_PID 0x4d69
#define GREASEWEAZLE_ID ((GREASEWEAZLE_VID<<16) | GREASEWEAZLE_PID)
#define GREASEWEAZLE_ID ((GREASEWEAZLE_VID << 16) | GREASEWEAZLE_PID)
#define EP_OUT 0x02
#define EP_IN 0x83
@@ -13,10 +13,12 @@ extern Bytes fluxEngineToGreaseWeazle(const Bytes& fldata, nanoseconds_t clock);
extern Bytes greaseWeazleToFluxEngine(const Bytes& gwdata, nanoseconds_t clock);
extern Bytes stripPartialRotation(const Bytes& fldata);
/* Copied from https://github.com/keirf/Greaseweazle/blob/master/inc/cdc_acm_protocol.h.
/* Copied from
* https://github.com/keirf/Greaseweazle/blob/master/inc/cdc_acm_protocol.h.
*
* WANING: these headers were originally defined with 'packed', which is a gccism so it's
* been dummied out. Don't use them expecting wire protocol structures. */
* WANING: these headers were originally defined with 'packed', which is a
* gccism so it's been dummied out. Don't use them expecting wire protocol
* structures. */
#define packed /* */
@@ -71,7 +73,6 @@ extern Bytes stripPartialRotation(const Bytes& fldata);
#define CMD_SINK_BYTES 19
#define CMD_MAX 19
/*
* CMD_SET_BUS CODES
*/
@@ -80,7 +81,6 @@ extern Bytes stripPartialRotation(const Bytes& fldata);
#define BUS_SHUGART 2
#define BUS_APPLE2 3
/*
* ACK RETURN CODES
*/
@@ -97,7 +97,6 @@ extern Bytes stripPartialRotation(const Bytes& fldata);
#define ACK_BAD_PIN 10
#define ACK_BAD_CYLINDER 11
/*
* CONTROL-CHANNEL COMMAND SET:
* We abuse SET_LINE_CODING requests over endpoint 0, stashing a command
@@ -133,14 +132,14 @@ extern Bytes stripPartialRotation(const Bytes& fldata);
* Duration is specified by immediately preceding FLUXOP_SPACE opcode(s). */
#define FLUXOP_ASTABLE 3
/*
* COMMAND PACKETS
*/
/* CMD_GET_INFO, index 0 */
#define GETINFO_FIRMWARE 0
struct packed gw_info {
struct packed gw_info
{
uint8_t fw_major;
uint8_t fw_minor;
uint8_t is_main_firmware; /* == 0 -> update bootloader */
@@ -153,15 +152,18 @@ extern struct gw_info gw_info;
/* CMD_GET_INFO, index 1 */
#define GETINFO_BW_STATS 1
struct packed gw_bw_stats {
struct packed {
struct packed gw_bw_stats
{
struct packed
{
uint32_t bytes;
uint32_t usecs;
} min_bw, max_bw;
};
/* CMD_READ_FLUX */
struct packed gw_read_flux {
struct packed gw_read_flux
{
/* Maximum ticks to read for (or 0, for no limit). */
uint32_t ticks;
/* Maximum index pulses to read (or 0, for no limit). */
@@ -169,7 +171,8 @@ struct packed gw_read_flux {
};
/* CMD_WRITE_FLUX */
struct packed gw_write_flux {
struct packed gw_write_flux
{
/* If non-zero, start the write at the index pulse. */
uint8_t cue_at_index;
/* If non-zero, terminate the write at the next index pulse. */
@@ -177,18 +180,21 @@ struct packed gw_write_flux {
};
/* CMD_ERASE_FLUX */
struct packed gw_erase_flux {
struct packed gw_erase_flux
{
uint32_t ticks;
};
/* CMD_SINK_SOURCE_BYTES */
struct packed gw_sink_source_bytes {
struct packed gw_sink_source_bytes
{
uint32_t nr_bytes;
};
/* CMD_{GET,SET}_PARAMS, index 0 */
#define PARAMS_DELAYS 0
struct packed gw_delay {
struct packed gw_delay
{
uint16_t select_delay; /* usec */
uint16_t step_delay; /* usec */
uint16_t seek_settle; /* msec */
@@ -201,4 +207,3 @@ struct packed gw_delay {
#define FW_MODE_NORMAL 1
#endif

View File

@@ -24,4 +24,3 @@ private:
};
#endif

View File

@@ -6,7 +6,10 @@
class Fluxmap;
class GreaseWeazleProto;
namespace libusbp { class device; }
namespace libusbp
{
class device;
}
class USB
{
@@ -19,10 +22,12 @@ public:
virtual nanoseconds_t getRotationalPeriod(int hardSectorCount) = 0;
virtual void testBulkWrite() = 0;
virtual void testBulkRead() = 0;
virtual Bytes read(int side, bool synced, nanoseconds_t readTime,
nanoseconds_t hardSectorThreshold) = 0;
virtual void write(int side, const Bytes& bytes,
virtual Bytes read(int side,
bool synced,
nanoseconds_t readTime,
nanoseconds_t hardSectorThreshold) = 0;
virtual void write(
int side, const Bytes& bytes, nanoseconds_t hardSectorThreshold) = 0;
virtual void erase(int side, nanoseconds_t hardSectorThreshold) = 0;
virtual void setDrive(int drive, bool high_density, int index_mode) = 0;
virtual void measureVoltages(struct voltages_frame* voltages) = 0;
@@ -34,32 +39,62 @@ protected:
extern USB& getUsb();
extern USB* createFluxengineUsb(libusbp::device& device);
extern USB* createGreaseWeazleUsb(const std::string& serialPort, const GreaseWeazleProto& config);
extern USB* createGreaseWeazleUsb(
const std::string& serialPort, const GreaseWeazleProto& config);
static inline int usbGetVersion() { return getUsb().getVersion(); }
static inline void usbRecalibrate() { getUsb().recalibrate(); }
static inline void usbSeek(int track) { getUsb().seek(track); }
static inline void usbTestBulkWrite() { getUsb().testBulkWrite(); }
static inline void usbTestBulkRead() { getUsb().testBulkRead(); }
static inline int usbGetVersion()
{
return getUsb().getVersion();
}
static inline void usbRecalibrate()
{
getUsb().recalibrate();
}
static inline void usbSeek(int track)
{
getUsb().seek(track);
}
static inline void usbTestBulkWrite()
{
getUsb().testBulkWrite();
}
static inline void usbTestBulkRead()
{
getUsb().testBulkRead();
}
static inline void usbErase(int side, nanoseconds_t hardSectorThreshold)
{ getUsb().erase(side, hardSectorThreshold); }
{
getUsb().erase(side, hardSectorThreshold);
}
static inline nanoseconds_t usbGetRotationalPeriod(int hardSectorCount)
{ return getUsb().getRotationalPeriod(hardSectorCount); }
{
return getUsb().getRotationalPeriod(hardSectorCount);
}
static inline Bytes usbRead(int side, bool synced, nanoseconds_t readTime,
static inline Bytes usbRead(int side,
bool synced,
nanoseconds_t readTime,
nanoseconds_t hardSectorThreshold)
{ return getUsb().read(side, synced, readTime, hardSectorThreshold); }
{
return getUsb().read(side, synced, readTime, hardSectorThreshold);
}
static inline void usbWrite(int side, const Bytes& bytes,
nanoseconds_t hardSectorThreshold)
{ getUsb().write(side, bytes, hardSectorThreshold); }
static inline void usbWrite(
int side, const Bytes& bytes, nanoseconds_t hardSectorThreshold)
{
getUsb().write(side, bytes, hardSectorThreshold);
}
static inline void usbSetDrive(int drive, bool high_density, int index_mode)
{ getUsb().setDrive(drive, high_density, index_mode); }
{
getUsb().setDrive(drive, high_density, index_mode);
}
static inline void usbMeasureVoltages(struct voltages_frame* voltages)
{ getUsb().measureVoltages(voltages); }
{
getUsb().measureVoltages(voltages);
}
#endif

View File

@@ -24,4 +24,3 @@ struct CandidateDevice
extern std::vector<std::shared_ptr<CandidateDevice>> findUsbDevices();
#endif

View File

@@ -32,7 +32,7 @@ static StringFlag destFlux({"--dest", "-d"},
[](const auto& value)
{
globalConfig().setFluxSink(value);
globalConfig().setFluxSource(value);
globalConfig().setVerificationFluxSource(value);
});
static StringFlag destTracks({"--cylinders", "-c"},
@@ -62,9 +62,9 @@ int mainWrite(int argc, const char* argv[])
{
if (argc == 1)
showProfiles("write", formats);
globalConfig()->mutable_flux_sink()->set_type(FluxSinkProto::DRIVE);
if (verify)
globalConfig()->mutable_flux_source()->set_type(FluxSourceProto::DRIVE);
globalConfig().setFluxSink("drive:0");
globalConfig().setVerificationFluxSource("drive:0");
flags.parseFlagsWithConfigFiles(argc, argv, formats);
auto& reader = globalConfig().getImageReader();
@@ -76,16 +76,18 @@ int mainWrite(int argc, const char* argv[])
FluxSink::create(globalConfig()->flux_sink()));
std::unique_ptr<Decoder> decoder;
if (globalConfig()->has_decoder() && verify)
std::shared_ptr<FluxSource> verificationFluxSource;
if (globalConfig()->has_decoder() && fluxSink->isHardware() && verify)
{
decoder = Decoder::create(globalConfig()->decoder());
verificationFluxSource = globalConfig().getVerificationFluxSource();
}
std::shared_ptr<FluxSource> fluxSource;
if (verify &&
(globalConfig()->flux_source().type() == FluxSourceProto::DRIVE))
fluxSource = globalConfig().getFluxSource();
writeDiskCommand(
*image, *encoder, *fluxSink, decoder.get(), fluxSource.get());
writeDiskCommand(*image,
*encoder,
*fluxSink,
decoder.get(),
verificationFluxSource.get());
return 0;
}

View File

@@ -4,4 +4,3 @@
extern FlagGroup fileFlags;
#endif

View File

@@ -14,12 +14,17 @@ public:
virtual ~HistogramViewer() {}
public:
void Redraw(const Fluxmap& fluxmap, nanoseconds_t clock=0);
void Redraw(const Fluxmap& fluxmap, nanoseconds_t clock = 0);
void Redraw(const Fluxmap* fluxmap, nanoseconds_t clock=0)
{ Redraw(*fluxmap, clock); }
void Redraw(const Fluxmap* fluxmap, nanoseconds_t clock = 0)
{
Redraw(*fluxmap, clock);
}
nanoseconds_t GetMedian() const { return _data.median; }
nanoseconds_t GetMedian() const
{
return _data.median;
}
private:
void OnPaint(wxPaintEvent&);
@@ -31,4 +36,3 @@ private:
nanoseconds_t _clock;
wxDECLARE_EVENT_TABLE();
};

View File

File diff suppressed because it is too large Load Diff

View File

@@ -245,6 +245,7 @@ public:
std::string filename = _selectedDrive ? "drive:1" : "drive:0";
globalConfig().setFluxSink(filename);
globalConfig().setFluxSource(filename);
globalConfig().setVerificationFluxSource(filename);
break;
}

View File

@@ -152,18 +152,19 @@ public:
FluxSink::create(globalConfig()->flux_sink());
std::unique_ptr<Decoder> decoder;
std::shared_ptr<FluxSource> fluxSource;
if (globalConfig()->has_decoder())
std::shared_ptr<FluxSource> verificationFluxSource;
if (globalConfig()->has_decoder() && fluxSink->isHardware())
{
decoder = Decoder::create(globalConfig()->decoder());
fluxSource = globalConfig().getFluxSource();
verificationFluxSource =
globalConfig().getVerificationFluxSource();
}
writeDiskCommand(*image,
*encoder,
*fluxSink,
decoder.get(),
fluxSource.get());
verificationFluxSource.get());
});
}
catch (const ErrorException& e)

View File

@@ -51,28 +51,45 @@
///////////////////////////////////////////////////////////////////////////////
class MainWindowGen : public wxFrame
{
private:
protected:
private:
protected:
wxMenuBar* menuBar;
wxMenu* m_menu1;
wxMenu* m_menu2;
wxSimplebook* dataNotebook;
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnAboutMenuItem( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExit( wxCommandEvent& event ) { event.Skip(); }
virtual void OnShowLogWindow( wxCommandEvent& event ) { event.Skip(); }
virtual void OnShowConfigWindow( wxCommandEvent& event ) { event.Skip(); }
virtual void OnClose(wxCloseEvent& event)
{
event.Skip();
}
virtual void OnAboutMenuItem(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnExit(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnShowLogWindow(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnShowConfigWindow(wxCommandEvent& event)
{
event.Skip();
}
public:
MainWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("FluxEngine"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 616,607 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
public:
MainWindowGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("FluxEngine"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(616, 607),
long style = wxDEFAULT_FRAME_STYLE | wxRESIZE_BORDER |
wxFULL_REPAINT_ON_RESIZE | wxTAB_TRAVERSAL);
~MainWindowGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -80,24 +97,32 @@ class MainWindowGen : public wxFrame
///////////////////////////////////////////////////////////////////////////////
class TextViewerWindowGen : public wxDialog
{
private:
protected:
private:
protected:
wxTextCtrl* textControl;
wxStdDialogButtonSizer* m_sdbSizer2;
wxButton* m_sdbSizer2OK;
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnClose( wxCommandEvent& event ) { event.Skip(); }
virtual void OnClose(wxCloseEvent& event)
{
event.Skip();
}
virtual void OnClose(wxCommandEvent& event)
{
event.Skip();
}
public:
TextViewerWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 208,143 ), long style = wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER );
public:
TextViewerWindowGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(208, 143),
long style = wxCLOSE_BOX | wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX |
wxMINIMIZE_BOX | wxRESIZE_BORDER);
~TextViewerWindowGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -105,25 +130,33 @@ class TextViewerWindowGen : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class FluxViewerWindowGen : public wxDialog
{
private:
protected:
private:
protected:
FluxViewerControl* fluxviewer;
wxScrollBar* scrollbar;
wxStdDialogButtonSizer* m_sdbSizer2;
wxButton* m_sdbSizer2OK;
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnClose( wxCommandEvent& event ) { event.Skip(); }
virtual void OnClose(wxCloseEvent& event)
{
event.Skip();
}
virtual void OnClose(wxCommandEvent& event)
{
event.Skip();
}
public:
FluxViewerWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,200 ), long style = wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER );
public:
FluxViewerWindowGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(400, 200),
long style = wxCLOSE_BOX | wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX |
wxMINIMIZE_BOX | wxRESIZE_BORDER);
~FluxViewerWindowGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -131,26 +164,37 @@ class FluxViewerWindowGen : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class TextEditorWindowGen : public wxDialog
{
private:
protected:
private:
protected:
wxTextCtrl* textControl;
wxStdDialogButtonSizer* m_sdbSizer2;
wxButton* m_sdbSizer2Save;
wxButton* m_sdbSizer2Cancel;
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSave( wxCommandEvent& event ) { event.Skip(); }
virtual void OnClose(wxCloseEvent& event)
{
event.Skip();
}
virtual void OnCancel(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnSave(wxCommandEvent& event)
{
event.Skip();
}
public:
TextEditorWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER );
public:
TextEditorWindowGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLOSE_BOX | wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX |
wxMINIMIZE_BOX | wxRESIZE_BORDER);
~TextEditorWindowGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -158,9 +202,8 @@ class TextEditorWindowGen : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class FileViewerWindowGen : public wxDialog
{
private:
protected:
private:
protected:
wxNotebook* m_notebook1;
wxPanel* m_panel8;
wxTextCtrl* textControl;
@@ -170,15 +213,21 @@ class FileViewerWindowGen : public wxDialog
wxButton* m_sdbSizer2OK;
// Virtual event handlers, override them in your derived class
virtual void OnClose( wxCommandEvent& event ) { event.Skip(); }
virtual void OnClose(wxCommandEvent& event)
{
event.Skip();
}
public:
FileViewerWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 408,269 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER );
public:
FileViewerWindowGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(408, 269),
long style = wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX | wxMINIMIZE_BOX |
wxRESIZE_BORDER);
~FileViewerWindowGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -186,23 +235,26 @@ class FileViewerWindowGen : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class GetfileDialog : public wxDialog
{
private:
protected:
private:
protected:
wxStaticText* m_staticText7;
wxStaticText* m_staticText9;
public:
public:
wxTextCtrl* filenameText;
wxFilePickerCtrl* targetFilePicker;
wxStdDialogButtonSizer* buttons_;
wxButton* buttons_OK;
wxButton* buttons_Cancel;
GetfileDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Copy file off disk"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
GetfileDialog(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("Copy file off disk"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
~GetfileDialog();
};
///////////////////////////////////////////////////////////////////////////////
@@ -210,24 +262,27 @@ class GetfileDialog : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class FileConflictDialog : public wxDialog
{
private:
protected:
private:
protected:
wxStaticText* m_staticText91;
wxStaticText* m_staticText7;
wxStaticText* m_staticText9;
public:
public:
wxTextCtrl* newNameText;
wxTextCtrl* oldNameText;
wxStdDialogButtonSizer* buttons_;
wxButton* buttons_OK;
wxButton* buttons_Cancel;
FileConflictDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Filename conflict"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
FileConflictDialog(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("Filename conflict"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
~FileConflictDialog();
};
///////////////////////////////////////////////////////////////////////////////
@@ -235,24 +290,27 @@ class FileConflictDialog : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class FileRenameDialog : public wxDialog
{
private:
protected:
private:
protected:
wxStaticText* m_staticText91;
wxStaticText* m_staticText7;
wxStaticText* m_staticText9;
public:
public:
wxTextCtrl* newNameText;
wxTextCtrl* oldNameText;
wxStdDialogButtonSizer* buttons_;
wxButton* buttons_OK;
wxButton* buttons_Cancel;
FileRenameDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Rename or move file"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
FileRenameDialog(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("Rename or move file"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
~FileRenameDialog();
};
///////////////////////////////////////////////////////////////////////////////
@@ -260,22 +318,25 @@ class FileRenameDialog : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class CreateDirectoryDialog : public wxDialog
{
private:
protected:
private:
protected:
wxStaticText* m_staticText91;
wxStaticText* m_staticText9;
public:
public:
wxTextCtrl* newNameText;
wxStdDialogButtonSizer* buttons_;
wxButton* buttons_OK;
wxButton* buttons_Cancel;
CreateDirectoryDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Create new directory"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
CreateDirectoryDialog(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("Create new directory"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
~CreateDirectoryDialog();
};
///////////////////////////////////////////////////////////////////////////////
@@ -283,23 +344,26 @@ class CreateDirectoryDialog : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class FormatDialog : public wxDialog
{
private:
protected:
private:
protected:
wxStaticText* m_staticText91;
wxStaticText* m_staticText7;
public:
public:
wxTextCtrl* volumeNameText;
wxCheckBox* quickFormatCheckBox;
wxStdDialogButtonSizer* buttons_;
wxButton* buttons_OK;
wxButton* buttons_Cancel;
FormatDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Format disk"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
FormatDialog(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxT("Format disk"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE);
~FormatDialog();
};
///////////////////////////////////////////////////////////////////////////////
@@ -307,9 +371,8 @@ class FormatDialog : public wxDialog
///////////////////////////////////////////////////////////////////////////////
class IdlePanelGen : public wxPanel
{
private:
protected:
private:
protected:
wxStaticBitmap* applicationBitmap;
wxPanel* sourceIconPanel;
wxSimplebook* sourceBook;
@@ -323,21 +386,44 @@ class IdlePanelGen : public wxPanel
wxButton* exploreButton;
// Virtual event handlers, override them in your derived class
virtual void OnControlsChanged( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCustomConfigurationButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnReadButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnWriteButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowseButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFormatButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExploreButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnControlsChanged(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnCustomConfigurationButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnReadButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnWriteButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowseButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnFormatButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnExploreButton(wxCommandEvent& event)
{
event.Skip();
}
public:
IdlePanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
public:
IdlePanelGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(-1, -1),
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~IdlePanelGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -345,9 +431,8 @@ class IdlePanelGen : public wxPanel
///////////////////////////////////////////////////////////////////////////////
class ImagerPanelGen : public wxPanel
{
private:
protected:
private:
protected:
wxAuiToolBar* imagerToolbar;
wxAuiToolBarItem* imagerBackTool;
VisualisationControl* visualiser;
@@ -357,18 +442,32 @@ class ImagerPanelGen : public wxPanel
wxButton* imagerGoAgainButton;
// Virtual event handlers, override them in your derived class
virtual void OnBackButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveImageButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSaveFluxButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnImagerGoAgainButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBackButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnSaveImageButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnSaveFluxButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnImagerGoAgainButton(wxCommandEvent& event)
{
event.Skip();
}
public:
ImagerPanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
public:
ImagerPanelGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(500, 300),
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~ImagerPanelGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -376,9 +475,8 @@ class ImagerPanelGen : public wxPanel
///////////////////////////////////////////////////////////////////////////////
class BrowserPanelGen : public wxPanel
{
private:
protected:
private:
protected:
wxAuiToolBar* browserToolbar;
wxAuiToolBarItem* browserBackTool;
wxAuiToolBarItem* browserInfoTool;
@@ -401,44 +499,97 @@ class BrowserPanelGen : public wxPanel
wxStaticText* m_staticText12;
// Virtual event handlers, override them in your derived class
virtual void OnBackButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserInfoButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserViewButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserSaveButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserAddMenuItem( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserNewDirectoryMenuItem( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserRenameMenuItem( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserDeleteMenuItem( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserFormatButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserBeginDrag( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnBrowserDrop( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnBrowserDropPossible( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnBrowserFilenameChanged( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnBrowserDirectoryExpanding( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnBrowserSelectionChanged( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnBrowserDiscardButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowserCommitButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBackButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserInfoButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserViewButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserSaveButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserAddMenuItem(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserNewDirectoryMenuItem(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserRenameMenuItem(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserDeleteMenuItem(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserFormatButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserBeginDrag(wxDataViewEvent& event)
{
event.Skip();
}
virtual void OnBrowserDrop(wxDataViewEvent& event)
{
event.Skip();
}
virtual void OnBrowserDropPossible(wxDataViewEvent& event)
{
event.Skip();
}
virtual void OnBrowserFilenameChanged(wxDataViewEvent& event)
{
event.Skip();
}
virtual void OnBrowserDirectoryExpanding(wxDataViewEvent& event)
{
event.Skip();
}
virtual void OnBrowserSelectionChanged(wxDataViewEvent& event)
{
event.Skip();
}
virtual void OnBrowserDiscardButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnBrowserCommitButton(wxCommandEvent& event)
{
event.Skip();
}
public:
BrowserPanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
public:
BrowserPanelGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(500, 300),
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~BrowserPanelGen();
void browserMoreMenuButtonOnDropDownMenu( wxAuiToolBarEvent &event )
void browserMoreMenuButtonOnDropDownMenu(wxAuiToolBarEvent& event)
{
if ( event.IsDropDownClicked() )
if (event.IsDropDownClicked())
{
browserToolbar->SetToolSticky( event.GetId(), true );
wxRect rect = browserToolbar->GetToolRect( event.GetId() );
wxPoint pt = browserToolbar->ClientToScreen( rect.GetBottomLeft() );
pt = ScreenToClient( pt );
browserToolbar->PopupMenu( browserMoreMenu, pt );
browserToolbar->SetToolSticky( event.GetId(), false );
browserToolbar->SetToolSticky(event.GetId(), true);
wxRect rect = browserToolbar->GetToolRect(event.GetId());
wxPoint pt = browserToolbar->ClientToScreen(rect.GetBottomLeft());
pt = ScreenToClient(pt);
browserToolbar->PopupMenu(browserMoreMenu, pt);
browserToolbar->SetToolSticky(event.GetId(), false);
}
}
};
///////////////////////////////////////////////////////////////////////////////
@@ -446,9 +597,8 @@ class BrowserPanelGen : public wxPanel
///////////////////////////////////////////////////////////////////////////////
class ExplorerPanelGen : public wxPanel
{
private:
protected:
private:
protected:
wxAuiToolBar* explorerToolbar;
wxAuiToolBarItem* explorerBackTool;
wxAuiToolBarItem* explorerRefreshTool;
@@ -471,20 +621,40 @@ class ExplorerPanelGen : public wxPanel
wxTextCtrl* explorerText;
// Virtual event handlers, override them in your derived class
virtual void OnBackButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExplorerRefreshButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExplorerSettingChange( wxSpinEvent& event ) { event.Skip(); }
virtual void OnExplorerSettingChange( wxSpinDoubleEvent& event ) { event.Skip(); }
virtual void OnGuessClockButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExplorerSettingChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBackButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnExplorerRefreshButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnExplorerSettingChange(wxSpinEvent& event)
{
event.Skip();
}
virtual void OnExplorerSettingChange(wxSpinDoubleEvent& event)
{
event.Skip();
}
virtual void OnGuessClockButton(wxCommandEvent& event)
{
event.Skip();
}
virtual void OnExplorerSettingChange(wxCommandEvent& event)
{
event.Skip();
}
public:
ExplorerPanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 620,426 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
public:
ExplorerPanelGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(620, 426),
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~ExplorerPanelGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -492,21 +662,24 @@ class ExplorerPanelGen : public wxPanel
///////////////////////////////////////////////////////////////////////////////
class HardwareSourcePanelGen : public wxPanel
{
private:
protected:
private:
protected:
wxStaticText* m_staticText30;
wxStaticText* m_staticText29;
public:
public:
wxStaticText* label;
wxCheckBox* highDensityToggle;
wxChoice* driveTypeChoice;
HardwareSourcePanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
HardwareSourcePanelGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(-1, -1),
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~HardwareSourcePanelGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -514,19 +687,22 @@ class HardwareSourcePanelGen : public wxPanel
///////////////////////////////////////////////////////////////////////////////
class FluxfileSourcePanelGen : public wxPanel
{
private:
protected:
private:
protected:
wxStaticText* m_staticText28;
wxStaticText* m_staticText27;
public:
public:
wxFilePickerCtrl* fluxImagePicker;
FluxfileSourcePanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
FluxfileSourcePanelGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(-1, -1),
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~FluxfileSourcePanelGen();
};
///////////////////////////////////////////////////////////////////////////////
@@ -534,18 +710,20 @@ class FluxfileSourcePanelGen : public wxPanel
///////////////////////////////////////////////////////////////////////////////
class ImagefileSourcePanelGen : public wxPanel
{
private:
protected:
private:
protected:
wxStaticText* m_staticText29;
wxStaticText* m_staticText28;
public:
public:
wxFilePickerCtrl* diskImagePicker;
ImagefileSourcePanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
ImagefileSourcePanelGen(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(-1, -1),
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~ImagefileSourcePanelGen();
};

View File

@@ -11,4 +11,3 @@ extern RangeFlag requiredSectors;
extern int mainReadIBM(int argc, const char* argv[]);
#endif

View File

@@ -2,7 +2,8 @@
#define TESTS_H
class AssertionError
{};
{
};
template <class T>
class Subject
@@ -11,7 +12,9 @@ public:
Subject(const std::string& filename, int lineno, T value):
_filename(filename),
_lineno(lineno),
_value(value) {}
_value(value)
{
}
public:
void isEqualTo(T wanted)
@@ -35,4 +38,3 @@ private:
#define assertThat(value) Subject(__FILE__, __LINE__, value)
#endif