From dcfcc6271c6499e5875e482a105a83318405971f Mon Sep 17 00:00:00 2001 From: dg Date: Fri, 12 May 2023 23:28:25 +0000 Subject: [PATCH] Sort out a whole bunch of other things, including cleaning up the way the verification source is handled. --- arch/aeslanier/aeslanier.h | 7 +- arch/agat/agat.h | 1 - arch/apple2/apple2.h | 9 +- arch/brother/brother.h | 20 +- arch/brother/data_gcr.h | 21 +- arch/brother/header_gcr.h | 1 - arch/c64/c64.h | 30 +- arch/f85/f85.h | 7 +- arch/fb100/fb100.h | 1 - arch/ibm/ibm.h | 6 +- arch/macintosh/macintosh.h | 15 +- arch/micropolis/micropolis.h | 13 +- arch/northstar/northstar.h | 31 +- arch/rolandd20/rolandd20.h | 4 +- arch/smaky6/smaky6.h | 1 - arch/tids990/tids990.h | 14 +- arch/victor9k/victor9k.h | 8 +- arch/zilogmcz/zilogmcz.h | 5 +- lib/a2r.h | 13 +- lib/bitmap.h | 9 +- lib/bytes.h | 183 ++--- lib/config.cc | 75 ++- lib/config.h | 73 +- lib/crc.h | 15 +- lib/csvreader.h | 9 +- lib/decoders/decoders.h | 8 +- lib/decoders/fluxdecoder.h | 46 +- lib/decoders/fluxmapreader.h | 25 +- lib/decoders/rawbits.h | 25 +- lib/encoders/encoders.h | 7 +- lib/fl2.h | 1 - lib/flags.cc | 23 +- lib/fluxsink/fluxsink.h | 39 +- lib/fluxsink/hardwarefluxsink.cc | 7 +- lib/fluxsource/kryoflux.h | 3 +- lib/globals.h | 26 +- lib/imagereader/imagereader.h | 5 +- lib/ldbs.h | 8 +- lib/proto.h | 9 +- lib/scp.h | 16 +- lib/sector.h | 14 +- lib/usb/greaseweazle.h | 125 ++-- lib/usb/serial.h | 19 +- lib/usb/usb.h | 99 ++- lib/usb/usbfinder.h | 15 +- src/fe-write.cc | 26 +- src/fileutils.h | 1 - src/gui/fluxviewercontrol.h | 2 +- src/gui/gui.h | 14 +- src/gui/histogramviewer.h | 22 +- src/gui/icon.png.h | 1063 +++++++++++++++++++++++++++--- src/gui/idlepanel.cc | 1 + src/gui/imagerpanel.cc | 9 +- src/gui/layout.h | 844 ++++++++++++++---------- src/readibm.h | 1 - tests/tests.h | 38 +- 56 files changed, 2189 insertions(+), 923 deletions(-) diff --git a/arch/aeslanier/aeslanier.h b/arch/aeslanier/aeslanier.h index 3a7c24c5..76b7371e 100644 --- a/arch/aeslanier/aeslanier.h +++ b/arch/aeslanier/aeslanier.h @@ -2,9 +2,10 @@ #define AESLANIER_H #define AESLANIER_RECORD_SEPARATOR 0x55555122 -#define AESLANIER_SECTOR_LENGTH 256 -#define AESLANIER_RECORD_SIZE (AESLANIER_SECTOR_LENGTH + 5) +#define AESLANIER_SECTOR_LENGTH 256 +#define AESLANIER_RECORD_SIZE (AESLANIER_SECTOR_LENGTH + 5) -extern std::unique_ptr createAesLanierDecoder(const DecoderProto& config); +extern std::unique_ptr createAesLanierDecoder( + const DecoderProto& config); #endif diff --git a/arch/agat/agat.h b/arch/agat/agat.h index 8786b062..0d3a50c1 100644 --- a/arch/agat/agat.h +++ b/arch/agat/agat.h @@ -17,4 +17,3 @@ extern std::unique_ptr createAgatEncoder(const EncoderProto& config); extern uint8_t agatChecksum(const Bytes& bytes); #endif - diff --git a/arch/apple2/apple2.h b/arch/apple2/apple2.h index d932535b..861ad865 100644 --- a/arch/apple2/apple2.h +++ b/arch/apple2/apple2.h @@ -5,16 +5,15 @@ #include "decoders/decoders.h" #include "encoders/encoders.h" -#define APPLE2_SECTOR_RECORD 0xd5aa96 -#define APPLE2_DATA_RECORD 0xd5aaad +#define APPLE2_SECTOR_RECORD 0xd5aa96 +#define APPLE2_DATA_RECORD 0xd5aaad -#define APPLE2_SECTOR_LENGTH 256 +#define APPLE2_SECTOR_LENGTH 256 #define APPLE2_ENCODED_SECTOR_LENGTH 342 -#define APPLE2_SECTORS 16 +#define APPLE2_SECTORS 16 extern std::unique_ptr createApple2Decoder(const DecoderProto& config); extern std::unique_ptr createApple2Encoder(const EncoderProto& config); #endif - diff --git a/arch/brother/brother.h b/arch/brother/brother.h index cd8d3630..3818c6c9 100644 --- a/arch/brother/brother.h +++ b/arch/brother/brother.h @@ -3,17 +3,19 @@ /* Brother word processor format (or at least, one of them) */ -#define BROTHER_SECTOR_RECORD 0xFFFFFD57 -#define BROTHER_DATA_RECORD 0xFFFFFDDB -#define BROTHER_DATA_RECORD_PAYLOAD 256 -#define BROTHER_DATA_RECORD_CHECKSUM 3 +#define BROTHER_SECTOR_RECORD 0xFFFFFD57 +#define BROTHER_DATA_RECORD 0xFFFFFDDB +#define BROTHER_DATA_RECORD_PAYLOAD 256 +#define BROTHER_DATA_RECORD_CHECKSUM 3 #define BROTHER_DATA_RECORD_ENCODED_SIZE 415 -#define BROTHER_TRACKS_PER_240KB_DISK 78 -#define BROTHER_TRACKS_PER_120KB_DISK 39 -#define BROTHER_SECTORS_PER_TRACK 12 +#define BROTHER_TRACKS_PER_240KB_DISK 78 +#define BROTHER_TRACKS_PER_120KB_DISK 39 +#define BROTHER_SECTORS_PER_TRACK 12 -extern std::unique_ptr createBrotherDecoder(const DecoderProto& config); -extern std::unique_ptr createBrotherEncoder(const EncoderProto& config); +extern std::unique_ptr createBrotherDecoder( + const DecoderProto& config); +extern std::unique_ptr createBrotherEncoder( + const EncoderProto& config); #endif diff --git a/arch/brother/data_gcr.h b/arch/brother/data_gcr.h index b203b730..6cab0cb1 100644 --- a/arch/brother/data_gcr.h +++ b/arch/brother/data_gcr.h @@ -1,13 +1,13 @@ -GCR_ENTRY(0x55, 0) // 00000 -GCR_ENTRY(0x57, 1) // 00001 -GCR_ENTRY(0x5b, 2) // 00010 -GCR_ENTRY(0x5d, 3) // 00011 -GCR_ENTRY(0x5f, 4) // 00100 -GCR_ENTRY(0x6b, 5) // 00101 -GCR_ENTRY(0x6d, 6) // 00110 -GCR_ENTRY(0x6f, 7) // 00111 -GCR_ENTRY(0x75, 8) // 01000 -GCR_ENTRY(0x77, 9) // 01001 +GCR_ENTRY(0x55, 0) // 00000 +GCR_ENTRY(0x57, 1) // 00001 +GCR_ENTRY(0x5b, 2) // 00010 +GCR_ENTRY(0x5d, 3) // 00011 +GCR_ENTRY(0x5f, 4) // 00100 +GCR_ENTRY(0x6b, 5) // 00101 +GCR_ENTRY(0x6d, 6) // 00110 +GCR_ENTRY(0x6f, 7) // 00111 +GCR_ENTRY(0x75, 8) // 01000 +GCR_ENTRY(0x77, 9) // 01001 GCR_ENTRY(0x7b, 10) // 01010 GCR_ENTRY(0x7d, 11) // 01011 GCR_ENTRY(0x7f, 12) // 01100 @@ -30,4 +30,3 @@ GCR_ENTRY(0xef, 28) // 11100 GCR_ENTRY(0xf5, 29) // 11101 GCR_ENTRY(0xf7, 30) // 11110 GCR_ENTRY(0xfb, 31) // 11111 - diff --git a/arch/brother/header_gcr.h b/arch/brother/header_gcr.h index b90a434e..831b8f86 100644 --- a/arch/brother/header_gcr.h +++ b/arch/brother/header_gcr.h @@ -76,4 +76,3 @@ GCR_ENTRY(0x6BAB, 74) GCR_ENTRY(0xAD5F, 75) GCR_ENTRY(0xDBED, 76) GCR_ENTRY(0x55BB, 77) - diff --git a/arch/c64/c64.h b/arch/c64/c64.h index 5d40797a..968af367 100644 --- a/arch/c64/c64.h +++ b/arch/c64/c64.h @@ -4,11 +4,11 @@ #include "decoders/decoders.h" #include "encoders/encoders.h" -#define C64_SECTOR_RECORD 0xffd49 -#define C64_DATA_RECORD 0xffd57 -#define C64_SECTOR_LENGTH 256 +#define C64_SECTOR_RECORD 0xffd49 +#define C64_DATA_RECORD 0xffd57 +#define C64_SECTOR_LENGTH 256 -/* Source: http://www.unusedino.de/ec64/technical/formats/g64.html +/* Source: http://www.unusedino.de/ec64/technical/formats/g64.html 1. Header sync FF FF FF FF FF (40 'on' bits, not GCR) 2. Header info 52 54 B5 29 4B 7A 5E 95 55 55 (10 GCR bytes) 3. Header gap 55 55 55 55 55 55 55 55 55 (9 bytes, never read) @@ -17,18 +17,20 @@ 6. Inter-sector gap 55 55 55 55...55 55 (4 to 12 bytes, never read) 1. Header sync (SYNC for the next sector) */ -#define C64_HEADER_DATA_SYNC 0xFF -#define C64_HEADER_BLOCK_ID 0x08 -#define C64_DATA_BLOCK_ID 0x07 -#define C64_HEADER_GAP 0x55 -#define C64_INTER_SECTOR_GAP 0x55 -#define C64_PADDING 0x0F +#define C64_HEADER_DATA_SYNC 0xFF +#define C64_HEADER_BLOCK_ID 0x08 +#define C64_DATA_BLOCK_ID 0x07 +#define C64_HEADER_GAP 0x55 +#define C64_INTER_SECTOR_GAP 0x55 +#define C64_PADDING 0x0F -#define C64_TRACKS_PER_DISK 40 -#define C64_BAM_TRACK 17 +#define C64_TRACKS_PER_DISK 40 +#define C64_BAM_TRACK 17 -extern std::unique_ptr createCommodore64Decoder(const DecoderProto& config); -extern std::unique_ptr createCommodore64Encoder(const EncoderProto& config); +extern std::unique_ptr createCommodore64Decoder( + const DecoderProto& config); +extern std::unique_ptr createCommodore64Encoder( + const EncoderProto& config); extern nanoseconds_t clockPeriodForC64Track(unsigned track); diff --git a/arch/f85/f85.h b/arch/f85/f85.h index cd8df070..f720723f 100644 --- a/arch/f85/f85.h +++ b/arch/f85/f85.h @@ -2,9 +2,10 @@ #define F85_H #define F85_SECTOR_RECORD 0xffffce /* 1111 1111 1111 1111 1100 1110 */ -#define F85_DATA_RECORD 0xffffcb /* 1111 1111 1111 1111 1100 1101 */ -#define F85_SECTOR_LENGTH 512 +#define F85_DATA_RECORD 0xffffcb /* 1111 1111 1111 1111 1100 1101 */ +#define F85_SECTOR_LENGTH 512 -extern std::unique_ptr createDurangoF85Decoder(const DecoderProto& config); +extern std::unique_ptr createDurangoF85Decoder( + const DecoderProto& config); #endif diff --git a/arch/fb100/fb100.h b/arch/fb100/fb100.h index 6f032624..7dbc22ec 100644 --- a/arch/fb100/fb100.h +++ b/arch/fb100/fb100.h @@ -8,4 +8,3 @@ extern std::unique_ptr createFb100Decoder(const DecoderProto& config); #endif - diff --git a/arch/ibm/ibm.h b/arch/ibm/ibm.h index 3ffe4d43..60bf1eca 100644 --- a/arch/ibm/ibm.h +++ b/arch/ibm/ibm.h @@ -31,9 +31,7 @@ class Decoder; class DecoderProto; class EncoderProto; -extern std::unique_ptr createIbmDecoder( - const DecoderProto& config); -extern std::unique_ptr createIbmEncoder( - const EncoderProto& config); +extern std::unique_ptr createIbmDecoder(const DecoderProto& config); +extern std::unique_ptr createIbmEncoder(const EncoderProto& config); #endif diff --git a/arch/macintosh/macintosh.h b/arch/macintosh/macintosh.h index 3404b1d9..7da7467c 100644 --- a/arch/macintosh/macintosh.h +++ b/arch/macintosh/macintosh.h @@ -1,12 +1,12 @@ #ifndef MACINTOSH_H #define MACINTOSH_H -#define MAC_SECTOR_RECORD 0xd5aa96 /* 1101 0101 1010 1010 1001 0110 */ -#define MAC_DATA_RECORD 0xd5aaad /* 1101 0101 1010 1010 1010 1101 */ +#define MAC_SECTOR_RECORD 0xd5aa96 /* 1101 0101 1010 1010 1001 0110 */ +#define MAC_DATA_RECORD 0xd5aaad /* 1101 0101 1010 1010 1010 1101 */ -#define MAC_SECTOR_LENGTH 524 /* yes, really */ +#define MAC_SECTOR_LENGTH 524 /* yes, really */ #define MAC_ENCODED_SECTOR_LENGTH 703 -#define MAC_FORMAT_BYTE 0x22 +#define MAC_FORMAT_BYTE 0x22 #define MAC_TRACKS_PER_DISK 80 @@ -15,8 +15,9 @@ class Decoder; class DecoderProto; class EncoderProto; -extern std::unique_ptr createMacintoshDecoder(const DecoderProto& config); -extern std::unique_ptr createMacintoshEncoder(const EncoderProto& config); +extern std::unique_ptr createMacintoshDecoder( + const DecoderProto& config); +extern std::unique_ptr createMacintoshEncoder( + const EncoderProto& config); #endif - diff --git a/arch/micropolis/micropolis.h b/arch/micropolis/micropolis.h index 841507e5..af60bbc9 100644 --- a/arch/micropolis/micropolis.h +++ b/arch/micropolis/micropolis.h @@ -1,17 +1,20 @@ #ifndef MICROPOLIS_H #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_PAYLOAD_SIZE (256) +#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 createMicropolisDecoder(const DecoderProto& config); -extern std::unique_ptr createMicropolisEncoder(const EncoderProto& config); +extern std::unique_ptr createMicropolisDecoder( + const DecoderProto& config); +extern std::unique_ptr createMicropolisEncoder( + const EncoderProto& config); extern uint8_t micropolisChecksum(const Bytes& bytes); diff --git a/arch/northstar/northstar.h b/arch/northstar/northstar.h index ec3a6480..2b0335e3 100644 --- a/arch/northstar/northstar.h +++ b/arch/northstar/northstar.h @@ -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 | @@ -12,15 +13,19 @@ * */ -#define NORTHSTAR_PREAMBLE_SIZE_SD (16) -#define NORTHSTAR_PREAMBLE_SIZE_DD (32) -#define NORTHSTAR_HEADER_SIZE_SD (1) -#define NORTHSTAR_HEADER_SIZE_DD (2) -#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_PREAMBLE_SIZE_SD (16) +#define NORTHSTAR_PREAMBLE_SIZE_DD (32) +#define NORTHSTAR_HEADER_SIZE_SD (1) +#define NORTHSTAR_HEADER_SIZE_DD (2) +#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) class Decoder; class Encoder; @@ -29,7 +34,9 @@ class DecoderProto; extern uint8_t northstarChecksum(const Bytes& bytes); -extern std::unique_ptr createNorthstarDecoder(const DecoderProto& config); -extern std::unique_ptr createNorthstarEncoder(const EncoderProto& config); +extern std::unique_ptr createNorthstarDecoder( + const DecoderProto& config); +extern std::unique_ptr createNorthstarEncoder( + const EncoderProto& config); #endif /* NORTHSTAR */ diff --git a/arch/rolandd20/rolandd20.h b/arch/rolandd20/rolandd20.h index 7075d035..f8dcfb34 100644 --- a/arch/rolandd20/rolandd20.h +++ b/arch/rolandd20/rolandd20.h @@ -1,4 +1,4 @@ #pragma once -extern std::unique_ptr createRolandD20Decoder(const DecoderProto& config); - +extern std::unique_ptr createRolandD20Decoder( + const DecoderProto& config); diff --git a/arch/smaky6/smaky6.h b/arch/smaky6/smaky6.h index becca90e..b7b28919 100644 --- a/arch/smaky6/smaky6.h +++ b/arch/smaky6/smaky6.h @@ -7,4 +7,3 @@ extern std::unique_ptr createSmaky6Decoder(const DecoderProto& config); #endif - diff --git a/arch/tids990/tids990.h b/arch/tids990/tids990.h index 975b05d8..43589115 100644 --- a/arch/tids990/tids990.h +++ b/arch/tids990/tids990.h @@ -1,18 +1,18 @@ #ifndef TIDS990_H #define TIDS990_H -#define TIDS990_PAYLOAD_SIZE 288 /* bytes */ -#define TIDS990_SECTOR_RECORD_SIZE 10 /* bytes */ -#define TIDS990_DATA_RECORD_SIZE (TIDS990_PAYLOAD_SIZE + 4) /* bytes */ +#define TIDS990_PAYLOAD_SIZE 288 /* bytes */ +#define TIDS990_SECTOR_RECORD_SIZE 10 /* bytes */ +#define TIDS990_DATA_RECORD_SIZE (TIDS990_PAYLOAD_SIZE + 4) /* bytes */ class Encoder; class Decoder; class DecoderProto; class EncoderProto; -extern std::unique_ptr createTids990Decoder(const DecoderProto& config); -extern std::unique_ptr createTids990Encoder(const EncoderProto& config); +extern std::unique_ptr createTids990Decoder( + const DecoderProto& config); +extern std::unique_ptr createTids990Encoder( + const EncoderProto& config); #endif - - diff --git a/arch/victor9k/victor9k.h b/arch/victor9k/victor9k.h index 8c5de7dd..548c1e9e 100644 --- a/arch/victor9k/victor9k.h +++ b/arch/victor9k/victor9k.h @@ -13,12 +13,14 @@ class DecoderProto; /* ... 1101 0100 1001 * ^^ ^^^^ ^^^^ ten bit IO byte */ -#define VICTOR9K_DATA_RECORD 0xfffffd49 +#define VICTOR9K_DATA_RECORD 0xfffffd49 #define VICTOR9K_DATA_ID 0x8 #define VICTOR9K_SECTOR_LENGTH 512 -extern std::unique_ptr createVictor9kDecoder(const DecoderProto& config); -extern std::unique_ptr createVictor9kEncoder(const EncoderProto& config); +extern std::unique_ptr createVictor9kDecoder( + const DecoderProto& config); +extern std::unique_ptr createVictor9kEncoder( + const EncoderProto& config); #endif diff --git a/arch/zilogmcz/zilogmcz.h b/arch/zilogmcz/zilogmcz.h index 7aed964a..45901849 100644 --- a/arch/zilogmcz/zilogmcz.h +++ b/arch/zilogmcz/zilogmcz.h @@ -1,8 +1,7 @@ #ifndef ZILOGMCZ_H #define ZILOGMCZ_H -extern std::unique_ptr createZilogMczDecoder(const DecoderProto& config); +extern std::unique_ptr createZilogMczDecoder( + const DecoderProto& config); #endif - - diff --git a/lib/a2r.h b/lib/a2r.h index 5b6dc20e..8730be09 100644 --- a/lib/a2r.h +++ b/lib/a2r.h @@ -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, diff --git a/lib/bitmap.h b/lib/bitmap.h index 2e684588..1484f5a8 100644 --- a/lib/bitmap.h +++ b/lib/bitmap.h @@ -8,12 +8,13 @@ class Bitmap public: Bitmap(const std::string filename, unsigned width, unsigned height); - Agg2D& painter(); - void save(); + Agg2D& painter(); + void save(); private: - std::vector _bitmap; - std::unique_ptr _painter; + std::vector _bitmap; + std::unique_ptr _painter; + public: std::string filename; unsigned width; diff --git a/lib/bytes.h b/lib/bytes.h index cf30ad55..36c2a890 100644 --- a/lib/bytes.h +++ b/lib/bytes.h @@ -16,36 +16,71 @@ public: Bytes(const std::string& data); Bytes(std::initializer_list data); Bytes(std::shared_ptr> data); - Bytes(std::shared_ptr> data, unsigned start, unsigned end); + Bytes(std::shared_ptr> data, + unsigned start, + unsigned end); - Bytes* operator = (const Bytes& other); + Bytes* operator=(const Bytes& other); public: - static Bytes readFromFile(const std::string& filename); + static Bytes readFromFile(const std::string& filename); 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,26 +88,29 @@ public: Bytes& resize(unsigned size); Bytes& clear() - { resize(0); return *this; } + { + resize(0); + return *this; + } - std::vector split(uint8_t separator) const; + std::vector split(uint8_t separator) const; Bytes slice(unsigned start, unsigned len) const; Bytes slice(unsigned start) const; Bytes swab() const; Bytes compress() const; Bytes decompress() const; - std::vector toBits() const; - Bytes reverseBits() const; + std::vector 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(); void writeToFile(const std::string& filename) const; - void writeTo(std::ostream& stream) const; + void writeTo(std::ostream& stream) const; private: std::shared_ptr> _data; @@ -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 data) + ByteWriter& operator+=(std::initializer_list 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& data) + ByteWriter& operator+=(const std::vector& 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,17 +323,17 @@ public: return *this; } - ByteWriter& operator += (std::istream& stream); + ByteWriter& operator+=(std::istream& stream); - ByteWriter& append(const char* data) - { - return *this += Bytes((const uint8_t*)data, strlen(data)); - } + ByteWriter& append(const char* data) + { + return *this += Bytes((const uint8_t*)data, strlen(data)); + } - ByteWriter& append(const std::string& data) - { - return *this += Bytes(data); - } + ByteWriter& append(const std::string& data) + { + return *this += Bytes(data); + } ByteWriter& append(const Bytes 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,19 +372,17 @@ private: class BitReader { public: - BitReader(ByteReader& br): - _br(br) - {} + BitReader(ByteReader& br): _br(br) {} - BitReader(ByteReader&&) = delete; + BitReader(ByteReader&&) = delete; - bool get(); - bool eof(); + bool get(); + bool eof(); private: - uint8_t _fifo = 0; - size_t _bitcount = 0; - ByteReader& _br; + uint8_t _fifo = 0; + size_t _bitcount = 0; + ByteReader& _br; }; static inline uint8_t reverse_bits(uint8_t b) @@ -358,16 +393,16 @@ static inline uint8_t reverse_bits(uint8_t b) return b; } -extern uint8_t toByte( - std::vector::const_iterator start, +extern uint8_t toByte(std::vector::const_iterator start, std::vector::const_iterator end); -extern Bytes toBytes( - std::vector::const_iterator start, +extern Bytes toBytes(std::vector::const_iterator start, std::vector::const_iterator end); inline Bytes toBytes(const std::vector& bits) -{ return toBytes(bits.begin(), bits.end()); } +{ + return toBytes(bits.begin(), bits.end()); +} extern std::vector reverseBits(const std::vector& bits); diff --git a/lib/config.cc b/lib/config.cc index 337d25ab..2616eb3b 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -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) - return false; - } + { + std::stringstream ss; + ss << '['; + bool first = true; + for (auto requiredValue : req.value()) + { + if (!first) + ss << ", "; + ss << quote(requiredValue); + first = false; + } + ss << ']'; - return true; + 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; + } } 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>> @@ -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::vectormutable_decoder()->mutable_copy_flux_to()); } +void Config::setVerificationFluxSource(std::string filename) +{ + setFluxSourceImpl(filename, &_verificationFluxSourceProto); +} + void Config::setImageReader(std::string filename) { static const std::map> @@ -378,6 +415,24 @@ std::shared_ptr& Config::getFluxSource() return _fluxSource; } +bool Config::hasVerificationFluxSource() const +{ + return _verificationFluxSourceProto.type() != FluxSourceProto::NOT_SET; +} + +std::shared_ptr& 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; diff --git a/lib/config.h b/lib/config.h index ec712cab..8a3098dc 100644 --- a/lib/config.h +++ b/lib/config.h @@ -2,6 +2,8 @@ #ifdef __cplusplus +#include "lib/fluxsource/fluxsource.pb.h" + class ConfigProto; class OptionProto; class FluxSource; @@ -16,69 +18,82 @@ 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. */ + /* Set and get individual config keys. */ - void set(std::string key, std::string value); - std::string get(std::string key); + void set(std::string key, std::string value); + std::string get(std::string key); - /* Reset the entire configuration. */ + /* Reset the entire configuration. */ - void clear(); + void clear(); - /* Merge in one config file. */ + /* Merge in one config file. */ - void readConfigFile(std::string filename); + void readConfigFile(std::string filename); /* Option management: look up an option by name, determine whether an option * is valid, and apply an option. */ - const OptionProto& findOption(const std::string& option); - bool isOptionValid(const OptionProto& option); + const OptionProto& findOption(const std::string& option); + void checkOptionValid(const OptionProto& option); + bool isOptionValid(const OptionProto& option); void applyOption(const OptionProto& option); - /* Adjust overall inputs and outputs. */ + /* Adjust overall inputs and outputs. */ - void setFluxSource(std::string value); - void setFluxSink(std::string value); - void setCopyFluxTo(std::string value); - void setImageReader(std::string value); - void setImageWriter(std::string value); + 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); - /* Fetch the sources, opening them if necessary. */ + /* Fetch the sources, opening them if necessary. */ - bool hasFluxSource() const; - std::shared_ptr& getFluxSource(); - bool hasImageReader() const; - std::shared_ptr& getImageReader(); + bool hasFluxSource() const; + std::shared_ptr& getFluxSource(); + bool hasImageReader() const; + std::shared_ptr& getImageReader(); + bool hasVerificationFluxSource() const; + std::shared_ptr& getVerificationFluxSource(); private: - std::shared_ptr _fluxSource; - std::shared_ptr _imageReader; + std::shared_ptr _fluxSource; + std::shared_ptr _imageReader; + std::shared_ptr _verificationFluxSource; + FluxSourceProto _verificationFluxSourceProto; }; extern Config& globalConfig(); #endif - diff --git a/lib/crc.h b/lib/crc.h index e892908f..28302c46 100644 --- a/lib/crc.h +++ b/lib/crc.h @@ -1,10 +1,10 @@ #ifndef CRC_H #define CRC_H -#define CCITT_POLY 0x1021 -#define MODBUS_POLY 0x8005 +#define CCITT_POLY 0x1021 +#define MODBUS_POLY 0x8005 #define MODBUS_POLY_REF 0xa001 -#define BROTHER_POLY 0x000201 +#define BROTHER_POLY 0x000201 struct crcspec { @@ -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 - diff --git a/lib/csvreader.h b/lib/csvreader.h index b3f439e3..37dae097 100644 --- a/lib/csvreader.h +++ b/lib/csvreader.h @@ -6,15 +6,12 @@ class CsvReader { public: - CsvReader(std::istream& istream): - _istream(istream) - {} + CsvReader(std::istream& istream): _istream(istream) {} - std::vector readLine(); + std::vector readLine(); private: - std::istream& _istream; + std::istream& _istream; }; #endif - diff --git a/lib/decoders/decoders.h b/lib/decoders/decoders.h index 45db1ada..2be8d76a 100644 --- a/lib/decoders/decoders.h +++ b/lib/decoders/decoders.h @@ -71,10 +71,10 @@ public: return _fmr->tell(); } - void rewind() - { - _fmr->rewind(); - } + void rewind() + { + _fmr->rewind(); + } void seek(const Fluxmap::Position& pos) { diff --git a/lib/decoders/fluxdecoder.h b/lib/decoders/fluxdecoder.h index d832f53e..539338f0 100644 --- a/lib/decoders/fluxdecoder.h +++ b/lib/decoders/fluxdecoder.h @@ -6,36 +6,36 @@ 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(); + bool readBit(); std::vector readBits(unsigned count); std::vector readBits(const Fluxmap::Position& until); std::vector readBits() - { - return readBits(UINT_MAX); - } -private: - nanoseconds_t nextFlux(); + { + return readBits(UINT_MAX); + } private: - FluxmapReader* _fmr; - double _pll_phase; - double _pll_adjust; - double _flux_scale; - nanoseconds_t _clock = 0; - nanoseconds_t _clock_centre; - nanoseconds_t _clock_min; - nanoseconds_t _clock_max; - nanoseconds_t _flux = 0; - unsigned _clocked_zeroes = 0; - unsigned _goodbits = 0; - bool _index = false; - bool _sync_lost = false; - int _leading_zeroes; + nanoseconds_t nextFlux(); + +private: + FluxmapReader* _fmr; + double _pll_phase; + double _pll_adjust; + double _flux_scale; + nanoseconds_t _clock = 0; + nanoseconds_t _clock_centre; + nanoseconds_t _clock_min; + nanoseconds_t _clock_max; + nanoseconds_t _flux = 0; + unsigned _clocked_zeroes = 0; + unsigned _goodbits = 0; + bool _index = false; + bool _sync_lost = false; + int _leading_zeroes; }; #endif - diff --git a/lib/decoders/fluxmapreader.h b/lib/decoders/fluxmapreader.h index 7401579e..35036eda 100644 --- a/lib/decoders/fluxmapreader.h +++ b/lib/decoders/fluxmapreader.h @@ -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 _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) @@ -94,24 +102,25 @@ public: } void getNextEvent(int& event, unsigned& ticks); - void skipToEvent(int event); + void skipToEvent(int event); bool findEvent(int event, unsigned& ticks); unsigned readInterval(nanoseconds_t clock); /* with debounce support */ /* Important! You can only reliably seek to 1 bits. */ void seek(nanoseconds_t ns); - void seekToByte(unsigned byte); + void seekToByte(unsigned byte); 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; const uint8_t* _bytes; const size_t _size; Fluxmap::Position _pos; - const DecoderProto& _config; + const DecoderProto& _config; }; #endif diff --git a/lib/decoders/rawbits.h b/lib/decoders/rawbits.h index 4d652abc..abb0a5c7 100644 --- a/lib/decoders/rawbits.h +++ b/lib/decoders/rawbits.h @@ -8,24 +8,35 @@ public: std::unique_ptr> indices): _bits(std::move(bits)), _indices(std::move(indices)) - {} + { + } typedef std::vector::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 indices() const - { return *_indices; } + { + return *_indices; + } private: std::unique_ptr> _bits; diff --git a/lib/encoders/encoders.h b/lib/encoders/encoders.h index 22adf8dc..f3345af8 100644 --- a/lib/encoders/encoders.h +++ b/lib/encoders/encoders.h @@ -18,12 +18,15 @@ public: public: virtual std::shared_ptr getSector( - std::shared_ptr&, const Image& image, unsigned sectorId); + std::shared_ptr&, + const Image& image, + unsigned sectorId); virtual std::vector> collectSectors( std::shared_ptr&, const Image& image); - virtual std::unique_ptr encode(std::shared_ptr& trackInfo, + virtual std::unique_ptr encode( + std::shared_ptr& trackInfo, const std::vector>& sectors, const Image& image) = 0; diff --git a/lib/fl2.h b/lib/fl2.h index 0ea4ecfd..66674cda 100644 --- a/lib/fl2.h +++ b/lib/fl2.h @@ -7,4 +7,3 @@ extern FluxFileProto loadFl2File(const std::string filename); extern void saveFl2File(const std::string filename, FluxFileProto& proto); #endif - diff --git a/lib/flags.cc b/lib/flags.cc index 86229c48..e02bbfc8 100644 --- a/lib/flags.cc +++ b/lib/flags.cc @@ -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 #include #include @@ -192,6 +194,17 @@ std::vector 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. */ diff --git a/lib/fluxsink/fluxsink.h b/lib/fluxsink/fluxsink.h index 2c30bf98..8ffb7616 100644 --- a/lib/fluxsink/fluxsink.h +++ b/lib/fluxsink/fluxsink.h @@ -18,28 +18,43 @@ class FluxSink public: virtual ~FluxSink() {} - static std::unique_ptr createHardwareFluxSink(const HardwareFluxSinkProto& config); - static std::unique_ptr createAuFluxSink(const AuFluxSinkProto& config); - static std::unique_ptr createA2RFluxSink(const A2RFluxSinkProto& config); - static std::unique_ptr createVcdFluxSink(const VcdFluxSinkProto& config); - static std::unique_ptr createScpFluxSink(const ScpFluxSinkProto& config); - static std::unique_ptr createFl2FluxSink(const Fl2FluxSinkProto& config); + static std::unique_ptr createHardwareFluxSink( + const HardwareFluxSinkProto& config); + static std::unique_ptr createAuFluxSink( + const AuFluxSinkProto& config); + static std::unique_ptr createA2RFluxSink( + const A2RFluxSinkProto& config); + static std::unique_ptr createVcdFluxSink( + const VcdFluxSinkProto& config); + static std::unique_ptr createScpFluxSink( + const ScpFluxSinkProto& config); + static std::unique_ptr createFl2FluxSink( + const Fl2FluxSinkProto& config); - static std::unique_ptr createFl2FluxSink(const std::string& filename); + static std::unique_ptr createFl2FluxSink( + const std::string& filename); static std::unique_ptr 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; + stream << (std::string)flushSink; + return stream; } #endif - diff --git a/lib/fluxsink/hardwarefluxsink.cc b/lib/fluxsink/hardwarefluxsink.cc index fecf2dd4..58c25722 100644 --- a/lib/fluxsink/hardwarefluxsink.cc +++ b/lib/fluxsink/hardwarefluxsink.cc @@ -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()); } diff --git a/lib/fluxsource/kryoflux.h b/lib/fluxsource/kryoflux.h index 00724456..800fd790 100644 --- a/lib/fluxsource/kryoflux.h +++ b/lib/fluxsource/kryoflux.h @@ -1,7 +1,8 @@ #ifndef STREAM_H #define STREAM_H -extern std::unique_ptr readStream(const std::string& dir, unsigned track, unsigned side); +extern std::unique_ptr readStream( + const std::string& dir, unsigned track, unsigned side); extern std::unique_ptr readStream(const std::string& path); extern std::unique_ptr readStream(const Bytes& bytes); diff --git a/lib/globals.h b/lib/globals.h index 5ed89056..6ca81763 100644 --- a/lib/globals.h +++ b/lib/globals.h @@ -24,7 +24,9 @@ template static inline std::vector vector_of(T item) -{ return std::vector { item }; } +{ + return std::vector{item}; +} typedef double nanoseconds_t; class Bytes; @@ -35,18 +37,17 @@ 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; + const std::string message; - void print() const; + void print() const; }; template -[[ 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); @@ -54,11 +55,16 @@ extern void warning(const std::string msg); template inline void warning(fmt::string_view fstr, const Args&... args) { - warning(fmt::format(fstr, args...)); + warning(fmt::format(fstr, args...)); } -template struct overloaded : Ts... { using Ts::operator()...; }; -template overloaded(Ts...) -> overloaded; +template +struct overloaded : Ts... +{ + using Ts::operator()...; +}; +template +overloaded(Ts...) -> overloaded; #include "lib/config.h" diff --git a/lib/imagereader/imagereader.h b/lib/imagereader/imagereader.h index c01513db..0ae0225e 100644 --- a/lib/imagereader/imagereader.h +++ b/lib/imagereader/imagereader.h @@ -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. */ diff --git a/lib/ldbs.h b/lib/ldbs.h index 1842e1dc..5e88eb24 100644 --- a/lib/ldbs.h +++ b/lib/ldbs.h @@ -7,8 +7,8 @@ class Bytes; * http://www.seasip.info/Unix/LibDsk/ldbs.html */ -#define LDBS_FILE_MAGIC 0x4C425301 /* "LBS\01" */ -#define LDBS_FILE_TYPE 0x44534B02 /* "DSK\02" */ +#define LDBS_FILE_MAGIC 0x4C425301 /* "LBS\01" */ +#define LDBS_FILE_TYPE 0x44534B02 /* "DSK\02" */ #define LDBS_BLOCK_MAGIC 0x4C444201 /* "LDB\01" */ #define LDBS_TRACK_BLOCK 0x44495201 /* "DIR\01" */ @@ -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); diff --git a/lib/proto.h b/lib/proto.h index 71439d5d..fe22521a 100644 --- a/lib/proto.h +++ b/lib/proto.h @@ -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 iterate(const RangeProto& range); extern std::set iterate(unsigned start, unsigned count); diff --git a/lib/scp.h b/lib/scp.h index 5bf9f5de..01d41f94 100644 --- a/lib/scp.h +++ b/lib/scp.h @@ -19,18 +19,18 @@ 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 { - char track_id[3]; // 'TRK' - uint8_t strack; // SCP track number + char track_id[3]; // 'TRK' + uint8_t strack; // SCP track number }; struct ScpTrackRevolution diff --git a/lib/sector.h b/lib/sector.h index d5fd269e..a288ff7c 100644 --- a/lib/sector.h +++ b/lib/sector.h @@ -9,14 +9,13 @@ class TrackInfo; struct LogicalLocation { - unsigned logicalTrack; - unsigned logicalSide; - unsigned logicalSector; + unsigned logicalTrack; + unsigned logicalSide; + unsigned logicalSector; std::tuple 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& layout, unsigned sectorId=0); + Sector(std::shared_ptr& layout, unsigned sectorId = 0); Sector(const LogicalLocation& location); @@ -91,8 +90,7 @@ struct Sector : public LogicalLocation } }; -extern bool sectorPointerSortPredicate( - const std::shared_ptr& lhs, +extern bool sectorPointerSortPredicate(const std::shared_ptr& lhs, const std::shared_ptr& rhs); extern bool sectorPointerEqualsPredicate( const std::shared_ptr& lhs, diff --git a/lib/usb/greaseweazle.h b/lib/usb/greaseweazle.h index ba8427dc..37ac30b7 100644 --- a/lib/usb/greaseweazle.h +++ b/lib/usb/greaseweazle.h @@ -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 /* */ @@ -25,90 +27,87 @@ extern Bytes stripPartialRotation(const Bytes& fldata); */ /* CMD_GET_INFO, length=3, idx. Returns 32 bytes after ACK. */ -#define CMD_GET_INFO 0 -/* [BOOTLOADER] CMD_UPDATE, length=6, . +#define CMD_GET_INFO 0 +/* [BOOTLOADER] CMD_UPDATE, length=6, . * Host follows with bytes. * Bootloader finally returns a status byte, 0 on success. */ /* [MAIN FIRMWARE] CMD_UPDATE, length=10, , 0xdeafbee3. * Host follows with bytes. * Main firmware finally returns a status byte, 0 on success. */ -#define CMD_UPDATE 1 +#define CMD_UPDATE 1 /* CMD_SEEK, length=3, cyl#. Seek to cyl# on selected drive. */ -#define CMD_SEEK 2 +#define CMD_SEEK 2 /* CMD_HEAD, length=3, head# (0=bottom) */ -#define CMD_HEAD 3 +#define CMD_HEAD 3 /* CMD_SET_PARAMS, length=3+nr, idx, */ -#define CMD_SET_PARAMS 4 +#define CMD_SET_PARAMS 4 /* CMD_GET_PARAMS, length=4, idx, nr_bytes. Returns nr_bytes after ACK. */ -#define CMD_GET_PARAMS 5 +#define CMD_GET_PARAMS 5 /* CMD_MOTOR, length=4, drive#, on/off. Turn on/off a drive motor. */ -#define CMD_MOTOR 6 +#define CMD_MOTOR 6 /* CMD_READ_FLUX, length=2-8. Argument is gw_read_flux. * Returns flux readings until EOStream. */ -#define CMD_READ_FLUX 7 +#define CMD_READ_FLUX 7 /* CMD_WRITE_FLUX, length=2-4. Argument is gw_write_flux. * Host follows with flux readings until EOStream. */ -#define CMD_WRITE_FLUX 8 +#define CMD_WRITE_FLUX 8 /* CMD_GET_FLUX_STATUS, length=2. Last read/write status returned in ACK. */ #define CMD_GET_FLUX_STATUS 9 /* CMD_SWITCH_FW_MODE, length=3, */ #define CMD_SWITCH_FW_MODE 11 /* CMD_SELECT, length=3, drive#. Select drive# as current unit. */ -#define CMD_SELECT 12 +#define CMD_SELECT 12 /* CMD_DESELECT, length=2. Deselect current unit (if any). */ -#define CMD_DESELECT 13 +#define CMD_DESELECT 13 /* CMD_SET_BUS_TYPE, length=3, bus_type. Set the bus type. */ -#define CMD_SET_BUS_TYPE 14 +#define CMD_SET_BUS_TYPE 14 /* CMD_SET_PIN, length=4, pin#, level. */ -#define CMD_SET_PIN 15 +#define CMD_SET_PIN 15 /* CMD_RESET, length=2. Reset all state to initial (power on) values. */ -#define CMD_RESET 16 +#define CMD_RESET 16 /* CMD_ERASE_FLUX, length=6. Argument is gw_erase_flux. */ -#define CMD_ERASE_FLUX 17 +#define CMD_ERASE_FLUX 17 /* CMD_SOURCE_BYTES, length=6. Argument is gw_sink_source_bytes. */ -#define CMD_SOURCE_BYTES 18 +#define CMD_SOURCE_BYTES 18 /* CMD_SINK_BYTES, length=6. Argument is gw_sink_source_bytes. */ -#define CMD_SINK_BYTES 19 -#define CMD_MAX 19 - +#define CMD_SINK_BYTES 19 +#define CMD_MAX 19 /* * CMD_SET_BUS CODES */ -#define BUS_NONE 0 -#define BUS_IBMPC 1 -#define BUS_SHUGART 2 -#define BUS_APPLE2 3 - +#define BUS_NONE 0 +#define BUS_IBMPC 1 +#define BUS_SHUGART 2 +#define BUS_APPLE2 3 /* * ACK RETURN CODES */ -#define ACK_OKAY 0 -#define ACK_BAD_COMMAND 1 -#define ACK_NO_INDEX 2 -#define ACK_NO_TRK0 3 -#define ACK_FLUX_OVERFLOW 4 -#define ACK_FLUX_UNDERFLOW 5 -#define ACK_WRPROT 6 -#define ACK_NO_UNIT 7 -#define ACK_NO_BUS 8 -#define ACK_BAD_UNIT 9 -#define ACK_BAD_PIN 10 -#define ACK_BAD_CYLINDER 11 - +#define ACK_OKAY 0 +#define ACK_BAD_COMMAND 1 +#define ACK_NO_INDEX 2 +#define ACK_NO_TRK0 3 +#define ACK_FLUX_OVERFLOW 4 +#define ACK_FLUX_UNDERFLOW 5 +#define ACK_WRPROT 6 +#define ACK_NO_UNIT 7 +#define ACK_NO_BUS 8 +#define ACK_BAD_UNIT 9 +#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 * in the baud-rate field. */ -#define BAUD_NORMAL 9600 -#define BAUD_CLEAR_COMMS 10000 +#define BAUD_NORMAL 9600 +#define BAUD_CLEAR_COMMS 10000 /* * Flux stream opcodes. Preceded by 0xFF byte. - * + * * Argument types: * N28: 28-bit non-negative integer N, encoded as 4 bytes b0,b1,b2,b3: * b0 = (uint8_t)(1 | (N << 1)) @@ -120,19 +119,18 @@ extern Bytes stripPartialRotation(const Bytes& fldata); * Args: * +4 [N28]: ticks to index, relative to sample cursor. * Signals an index pulse in the read stream. Sample cursor is unaffected. */ -#define FLUXOP_INDEX 1 +#define FLUXOP_INDEX 1 /* FLUXOP_SPACE [CMD_READ_FLUX, CMD_WRITE_FLUX] * Args: * +4 [N28]: ticks to increment the sample cursor. * Increments the sample cursor with no intervening flux transitions. */ -#define FLUXOP_SPACE 2 +#define FLUXOP_SPACE 2 /* FLUXOP_ASTABLE [CMD_WRITE_FLUX] * Args: * +4 [N28]: astable period. - * Generate regular flux transitions at specified astable period. + * Generate regular flux transitions at specified astable period. * Duration is specified by immediately preceding FLUXOP_SPACE opcode(s). */ -#define FLUXOP_ASTABLE 3 - +#define FLUXOP_ASTABLE 3 /* * COMMAND PACKETS @@ -140,7 +138,8 @@ extern Bytes stripPartialRotation(const Bytes& fldata); /* 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 */ @@ -198,7 +204,6 @@ struct packed gw_delay { /* CMD_SWITCH_FW_MODE */ #define FW_MODE_BOOTLOADER 0 -#define FW_MODE_NORMAL 1 +#define FW_MODE_NORMAL 1 #endif - diff --git a/lib/usb/serial.h b/lib/usb/serial.h index 71014fcc..15e1d8e9 100644 --- a/lib/usb/serial.h +++ b/lib/usb/serial.h @@ -4,18 +4,18 @@ class SerialPort { public: - static std::unique_ptr openSerialPort(const std::string& path); + static std::unique_ptr openSerialPort(const std::string& path); public: - virtual ~SerialPort(); - virtual ssize_t readImpl(uint8_t* buffer, size_t len) = 0; - virtual ssize_t write(const uint8_t* buffer, size_t len) = 0; + virtual ~SerialPort(); + virtual ssize_t readImpl(uint8_t* buffer, size_t len) = 0; + virtual ssize_t write(const uint8_t* buffer, size_t len) = 0; - void read(uint8_t* buffer, size_t len); - void read(Bytes& bytes); - Bytes readBytes(size_t count); - uint8_t readByte(); - void write(const Bytes& bytes); + void read(uint8_t* buffer, size_t len); + void read(Bytes& bytes); + Bytes readBytes(size_t count); + uint8_t readByte(); + void write(const Bytes& bytes); private: uint8_t _readbuffer[4096]; @@ -24,4 +24,3 @@ private: }; #endif - diff --git a/lib/usb/usb.h b/lib/usb/usb.h index f76baad8..4d08dfcc 100644 --- a/lib/usb/usb.h +++ b/lib/usb/usb.h @@ -6,60 +6,95 @@ class Fluxmap; class GreaseWeazleProto; -namespace libusbp { class device; } +namespace libusbp +{ + class device; +} class USB { public: - virtual ~USB(); + virtual ~USB(); - virtual int getVersion() = 0; - virtual void recalibrate() = 0; - virtual void seek(int track) = 0; - 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, - 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; + virtual int getVersion() = 0; + virtual void recalibrate() = 0; + virtual void seek(int track) = 0; + 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, 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; protected: - std::string usberror(int i); + std::string usberror(int i); }; 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, - nanoseconds_t hardSectorThreshold) -{ return getUsb().read(side, synced, readTime, hardSectorThreshold); } +static inline Bytes usbRead(int side, + bool synced, + nanoseconds_t readTime, + nanoseconds_t 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 diff --git a/lib/usb/usbfinder.h b/lib/usb/usbfinder.h index 3784c0ee..2034a7d8 100644 --- a/lib/usb/usbfinder.h +++ b/lib/usb/usbfinder.h @@ -6,22 +6,21 @@ enum DeviceType { - DEVICE_FLUXENGINE, - DEVICE_GREASEWEAZLE + DEVICE_FLUXENGINE, + DEVICE_GREASEWEAZLE }; extern std::string getDeviceName(DeviceType type); struct CandidateDevice { - DeviceType type; - libusbp::device device; - uint32_t id; - std::string serial; - std::string serialPort; + DeviceType type; + libusbp::device device; + uint32_t id; + std::string serial; + std::string serialPort; }; extern std::vector> findUsbDevices(); #endif - diff --git a/src/fe-write.cc b/src/fe-write.cc index d768540f..4ebfe577 100644 --- a/src/fe-write.cc +++ b/src/fe-write.cc @@ -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; - if (globalConfig()->has_decoder() && verify) + std::shared_ptr verificationFluxSource; + if (globalConfig()->has_decoder() && fluxSink->isHardware() && verify) + { decoder = Decoder::create(globalConfig()->decoder()); + verificationFluxSource = globalConfig().getVerificationFluxSource(); + } - std::shared_ptr 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; } diff --git a/src/fileutils.h b/src/fileutils.h index 39471195..8594973b 100644 --- a/src/fileutils.h +++ b/src/fileutils.h @@ -4,4 +4,3 @@ extern FlagGroup fileFlags; #endif - diff --git a/src/gui/fluxviewercontrol.h b/src/gui/fluxviewercontrol.h index 705950ad..d667aff8 100644 --- a/src/gui/fluxviewercontrol.h +++ b/src/gui/fluxviewercontrol.h @@ -48,7 +48,7 @@ private: nanoseconds_t _scrollPosition = 0; nanoseconds_t _totalDuration = 0; double _nanosecondsPerPixel = 0; - std::set _events; + std::set _events; std::vector _densityMap; int _dragStartX = -1; nanoseconds_t _dragStartPosition = -1; diff --git a/src/gui/gui.h b/src/gui/gui.h index 357c6b27..3e53583a 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -83,7 +83,7 @@ public: virtual void StartFormatting() = 0; virtual void StartExploring() = 0; - virtual void SafeFit() = 0; + virtual void SafeFit() = 0; virtual void SetPage(int page) = 0; virtual void PrepareConfig() = 0; virtual void ClearLog() = 0; @@ -112,17 +112,17 @@ public: _mainWindow->ClearLog(); } - void SafeFit() - { - _mainWindow->SafeFit(); - } + void SafeFit() + { + _mainWindow->SafeFit(); + } void StartIdle() { _mainWindow->StartIdle(); } - void StartReading() + void StartReading() { _mainWindow->StartReading(); } @@ -161,7 +161,7 @@ public: virtual void Start() = 0; virtual void PrepareConfig() = 0; - virtual const wxBitmap GetBitmap() = 0; + virtual const wxBitmap GetBitmap() = 0; }; class ImagerPanel : public PanelComponent diff --git a/src/gui/histogramviewer.h b/src/gui/histogramviewer.h index 8c663dc2..cefb2ce7 100644 --- a/src/gui/histogramviewer.h +++ b/src/gui/histogramviewer.h @@ -14,21 +14,25 @@ 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&); private: - bool _blank = true; - Fluxmap::ClockData _data; - wxFont _font; - nanoseconds_t _clock; + bool _blank = true; + Fluxmap::ClockData _data; + wxFont _font; + nanoseconds_t _clock; wxDECLARE_EVENT_TABLE(); }; - diff --git a/src/gui/icon.png.h b/src/gui/icon.png.h index 4d76b49a..83326b5c 100644 --- a/src/gui/icon.png.h +++ b/src/gui/icon.png.h @@ -5,113 +5,968 @@ #include #include -static const unsigned char icon_png[] = -{ - 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, - 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x00, 0x40, 0x08, 0x06, 0x00, 0x00, 0x00, 0xAA, - 0x69, 0x71, 0xDE, 0x00, 0x00, 0x03, 0x80, 0x49, 0x44, 0x41, - 0x54, 0x78, 0x9C, 0xD5, 0x9B, 0x5B, 0x9A, 0xA3, 0x20, 0x10, - 0x85, 0x0F, 0xF3, 0xCD, 0x6A, 0xDC, 0x4F, 0xBB, 0x9D, 0x90, - 0xED, 0x98, 0xFD, 0x64, 0x3B, 0xCC, 0x43, 0x02, 0x2D, 0x25, - 0x97, 0x2A, 0x28, 0xC0, 0x39, 0x2F, 0x1D, 0x6D, 0x29, 0xF8, - 0x8F, 0x65, 0x81, 0xC6, 0x00, 0x6B, 0xE5, 0x16, 0xF7, 0x8F, - 0x3F, 0x0B, 0xFB, 0x76, 0xD6, 0x5A, 0x60, 0xB1, 0x09, 0x66, - 0x51, 0xBF, 0x1E, 0x1E, 0x00, 0xF0, 0xFD, 0xBC, 0x64, 0x2C, - 0x2B, 0x3A, 0x8D, 0xE0, 0xBD, 0x56, 0x99, 0x30, 0xBB, 0xC3, - 0x24, 0xBC, 0xD7, 0x0A, 0x13, 0x66, 0xD6, 0x80, 0x22, 0xFC, - 0xE7, 0x08, 0x07, 0x4C, 0xAE, 0x09, 0xB3, 0xDC, 0xAE, 0xC2, - 0xDB, 0xC7, 0xE3, 0x77, 0xC3, 0x18, 0x60, 0xD2, 0xD8, 0x66, - 0x74, 0x22, 0x83, 0xF7, 0x9A, 0x64, 0xC2, 0xE8, 0x0E, 0xDA, - 0xE0, 0xBD, 0x26, 0x98, 0x30, 0x32, 0x78, 0x1F, 0xBC, 0xD7, - 0x60, 0x13, 0x46, 0x05, 0xD6, 0x81, 0xF7, 0x1A, 0x68, 0xC2, - 0x88, 0x59, 0xA0, 0x09, 0xDE, 0x9A, 0x67, 0x21, 0xE2, 0xB8, - 0xD9, 0x41, 0xDB, 0x80, 0x66, 0x78, 0xEB, 0x1E, 0x97, 0x7D, - 0x71, 0xE4, 0x31, 0x26, 0xFC, 0x55, 0x8C, 0xA5, 0x72, 0xE6, - 0xFD, 0x36, 0x35, 0xE4, 0xD3, 0x83, 0x03, 0x8C, 0x71, 0x50, - 0xBC, 0x1C, 0xB4, 0x02, 0xA9, 0xA6, 0x7D, 0x12, 0xFE, 0x2C, - 0xC5, 0x9A, 0xA0, 0x11, 0x64, 0x2E, 0xBC, 0x97, 0x92, 0x09, - 0xBD, 0x01, 0xD6, 0xC0, 0x7B, 0x29, 0x98, 0xD0, 0x53, 0x04, - 0xF5, 0xAB, 0xBD, 0x78, 0x04, 0xFD, 0x85, 0xB1, 0xD5, 0x3D, - 0x75, 0xF8, 0xDC, 0xD9, 0x2F, 0x16, 0x45, 0xAF, 0x8E, 0x4C, - 0x68, 0x69, 0x34, 0xF4, 0xCC, 0x5B, 0xF7, 0x08, 0xD3, 0x22, - 0x0B, 0xDE, 0xAB, 0xD1, 0x04, 0x69, 0x83, 0x25, 0x69, 0x3F, - 0xB2, 0x30, 0x4A, 0x6A, 0x40, 0xD7, 0x22, 0x27, 0x05, 0xC1, - 0x01, 0x4B, 0xB6, 0xCB, 0x19, 0xDA, 0x50, 0x13, 0xB8, 0x0B, - 0xA1, 0xE6, 0xB5, 0x7D, 0x2B, 0x78, 0xB6, 0x6D, 0x62, 0xD5, - 0x18, 0x49, 0xB8, 0x58, 0xE2, 0x64, 0x40, 0xFD, 0x49, 0x0E, - 0x00, 0xFB, 0x2C, 0xA7, 0x79, 0xEE, 0x7A, 0x2E, 0xC1, 0x84, - 0x36, 0xE4, 0x6F, 0xED, 0x78, 0x49, 0x26, 0xD4, 0x5C, 0x62, - 0xC1, 0x47, 0x83, 0xC8, 0x65, 0x42, 0xE6, 0xCC, 0xB5, 0xD6, - 0x87, 0xD4, 0xBD, 0xC3, 0x25, 0x3E, 0xA3, 0x26, 0x94, 0x32, - 0xA0, 0x0A, 0xBF, 0x6D, 0x1B, 0xB6, 0x6D, 0x8B, 0x07, 0x92, - 0xC8, 0x84, 0x52, 0xDA, 0x4A, 0x32, 0x22, 0xDB, 0x26, 0x17, - 0x9F, 0x91, 0x09, 0x39, 0x77, 0x58, 0xF0, 0x67, 0xBD, 0xDF, - 0xEF, 0x78, 0x50, 0xCC, 0xFB, 0xFD, 0x73, 0x06, 0x9C, 0x21, - 0xB8, 0xAB, 0xC5, 0x6A, 0x4D, 0x00, 0x8A, 0x99, 0x90, 0xCA, - 0x00, 0x31, 0x3C, 0x10, 0x1E, 0x69, 0xFF, 0x6E, 0x57, 0x6A, - 0x02, 0xD0, 0x0E, 0x7F, 0xAE, 0x09, 0xAC, 0x82, 0x5A, 0xC8, - 0x04, 0xEA, 0x4A, 0x13, 0xFC, 0xBE, 0xEF, 0x70, 0xCE, 0xC1, - 0x18, 0x73, 0x35, 0xA2, 0x90, 0x09, 0xC5, 0x4B, 0x83, 0x51, - 0x1B, 0xC4, 0xB3, 0x44, 0x22, 0x13, 0xCE, 0x19, 0xD0, 0x05, - 0x0F, 0x00, 0xCE, 0x39, 0x51, 0x26, 0xF4, 0xC2, 0xA7, 0x66, - 0x89, 0x6C, 0xCC, 0xE7, 0xD3, 0x8F, 0x2D, 0xCA, 0x84, 0xB3, - 0x1B, 0x45, 0x03, 0x6A, 0xF0, 0x51, 0x50, 0x61, 0x26, 0x44, - 0xC7, 0xD1, 0x07, 0x24, 0x27, 0xD0, 0x6A, 0xDB, 0x02, 0x7C, - 0xB4, 0x7D, 0xFA, 0x06, 0x8A, 0xB5, 0x12, 0x94, 0xC0, 0x03, - 0xF2, 0x4C, 0x08, 0xC7, 0x90, 0x55, 0xA3, 0xE4, 0xF6, 0x98, - 0x0B, 0x0F, 0x20, 0xCA, 0x84, 0xAA, 0x01, 0x12, 0xF8, 0xD7, - 0xEB, 0x15, 0x3E, 0xB7, 0x98, 0x10, 0x15, 0x42, 0x52, 0xF0, - 0xB8, 0xED, 0x72, 0xFD, 0x59, 0x6B, 0xA3, 0x6B, 0xDF, 0x9B, - 0x50, 0x34, 0xA0, 0x05, 0xBE, 0xD7, 0x04, 0xAA, 0x5A, 0x36, - 0x48, 0xE0, 0xCF, 0x26, 0xF8, 0xCB, 0x20, 0x3B, 0x0B, 0xB4, - 0x9E, 0x79, 0xAF, 0x9F, 0x9F, 0x9F, 0xF0, 0xB9, 0xB7, 0x26, - 0xE4, 0xEA, 0x80, 0x30, 0xED, 0x8D, 0xB5, 0xD6, 0x7D, 0x3F, - 0x03, 0xDF, 0x1A, 0x90, 0x5A, 0x1C, 0xB8, 0xE3, 0x38, 0x2E, - 0x3B, 0x25, 0xF0, 0x5E, 0xBD, 0x26, 0xD0, 0xAA, 0x9E, 0x5B, - 0x37, 0x44, 0x6D, 0x6A, 0x97, 0x19, 0xF9, 0x0A, 0x3E, 0x75, - 0x09, 0x98, 0x7D, 0xDF, 0xA3, 0x1D, 0x2D, 0xF0, 0x54, 0xE2, - 0x29, 0x72, 0x02, 0xFC, 0x65, 0x83, 0xC8, 0x1D, 0xC7, 0xD1, - 0x0C, 0x7F, 0x3E, 0xFB, 0x51, 0x87, 0x8C, 0x4C, 0x28, 0xDD, - 0x38, 0x69, 0xC2, 0x27, 0x77, 0x10, 0x39, 0x4D, 0xF8, 0xD0, - 0x69, 0xC1, 0x84, 0x99, 0xF0, 0xD9, 0x9D, 0x44, 0x91, 0x09, - 0xBD, 0xF0, 0xA1, 0x63, 0x41, 0x4D, 0x18, 0x05, 0x5F, 0xFC, - 0x07, 0x51, 0x30, 0x81, 0x5B, 0xF4, 0x38, 0xEA, 0x99, 0x1D, - 0x80, 0x7E, 0xF8, 0xEA, 0x3F, 0x89, 0x8A, 0x26, 0x48, 0xE1, - 0xC3, 0x00, 0x1A, 0x4D, 0xD0, 0x80, 0x67, 0x1D, 0x40, 0x94, - 0x34, 0xA1, 0x15, 0x3E, 0x0C, 0x42, 0x7A, 0x17, 0xA9, 0x04, - 0xCF, 0x3E, 0x88, 0x28, 0x32, 0xA1, 0x17, 0x3E, 0x0C, 0x84, - 0x69, 0x82, 0x26, 0xBC, 0xE8, 0x40, 0xA2, 0xE4, 0xEC, 0x00, - 0x7C, 0x40, 0x72, 0xFF, 0xAB, 0x0E, 0xA6, 0x62, 0x82, 0x36, - 0xBC, 0xF8, 0x60, 0xA2, 0xA9, 0x26, 0x8C, 0x80, 0x6F, 0x6A, - 0x40, 0x14, 0x4C, 0xA0, 0xD0, 0xAD, 0x26, 0x18, 0x63, 0x70, - 0x1C, 0xC7, 0xE5, 0x19, 0x63, 0x49, 0x3D, 0x6F, 0x98, 0xAA, - 0xBC, 0x1F, 0xA0, 0x65, 0x82, 0x87, 0xF7, 0xE2, 0x98, 0xD0, - 0xFB, 0x7A, 0xAD, 0xDA, 0x1B, 0x22, 0xBD, 0x26, 0x50, 0x78, - 0xAF, 0x92, 0x09, 0x1A, 0xEF, 0x16, 0x6B, 0xBE, 0x7A, 0xD6, - 0x6C, 0xC2, 0x2A, 0x78, 0x95, 0x00, 0x44, 0x62, 0x13, 0x56, - 0xC2, 0xAB, 0x05, 0x21, 0xCA, 0x9A, 0x70, 0xE9, 0x7C, 0x31, - 0xBC, 0x6A, 0x20, 0xA2, 0xAA, 0x09, 0x77, 0x80, 0x57, 0x0F, - 0x46, 0x54, 0x5C, 0x27, 0xDC, 0x01, 0x7E, 0x48, 0x40, 0xA2, - 0x8B, 0x09, 0x77, 0x82, 0x1F, 0x16, 0x94, 0x28, 0xBA, 0x1C, - 0xEE, 0x04, 0x3F, 0x34, 0x30, 0x91, 0x03, 0x70, 0x3B, 0x78, - 0x60, 0xDE, 0x6F, 0x86, 0x92, 0x10, 0xAB, 0xE1, 0xA7, 0x74, - 0x40, 0x14, 0x1E, 0xB9, 0xDF, 0x01, 0x1E, 0x98, 0xFF, 0xCB, - 0x51, 0x03, 0xDC, 0x07, 0x7E, 0x6A, 0x47, 0x44, 0xB7, 0xF9, - 0xF1, 0xE4, 0x2A, 0x03, 0x80, 0x1B, 0xFD, 0x7C, 0x76, 0xA5, - 0xDC, 0xF7, 0xFB, 0xBA, 0xAE, 0x17, 0x9E, 0xFF, 0x77, 0x2D, - 0x85, 0xFF, 0x07, 0xE6, 0x6F, 0xFC, 0xB7, 0xE2, 0xFB, 0x3A, - 0x0B, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, - 0x42, 0x60, 0x82, +static const unsigned char icon_png[] = { + 0x89, + 0x50, + 0x4E, + 0x47, + 0x0D, + 0x0A, + 0x1A, + 0x0A, + 0x00, + 0x00, + 0x00, + 0x0D, + 0x49, + 0x48, + 0x44, + 0x52, + 0x00, + 0x00, + 0x00, + 0x40, + 0x00, + 0x00, + 0x00, + 0x40, + 0x08, + 0x06, + 0x00, + 0x00, + 0x00, + 0xAA, + 0x69, + 0x71, + 0xDE, + 0x00, + 0x00, + 0x03, + 0x80, + 0x49, + 0x44, + 0x41, + 0x54, + 0x78, + 0x9C, + 0xD5, + 0x9B, + 0x5B, + 0x9A, + 0xA3, + 0x20, + 0x10, + 0x85, + 0x0F, + 0xF3, + 0xCD, + 0x6A, + 0xDC, + 0x4F, + 0xBB, + 0x9D, + 0x90, + 0xED, + 0x98, + 0xFD, + 0x64, + 0x3B, + 0xCC, + 0x43, + 0x02, + 0x2D, + 0x25, + 0x97, + 0x2A, + 0x28, + 0xC0, + 0x39, + 0x2F, + 0x1D, + 0x6D, + 0x29, + 0xF8, + 0x8F, + 0x65, + 0x81, + 0xC6, + 0x00, + 0x6B, + 0xE5, + 0x16, + 0xF7, + 0x8F, + 0x3F, + 0x0B, + 0xFB, + 0x76, + 0xD6, + 0x5A, + 0x60, + 0xB1, + 0x09, + 0x66, + 0x51, + 0xBF, + 0x1E, + 0x1E, + 0x00, + 0xF0, + 0xFD, + 0xBC, + 0x64, + 0x2C, + 0x2B, + 0x3A, + 0x8D, + 0xE0, + 0xBD, + 0x56, + 0x99, + 0x30, + 0xBB, + 0xC3, + 0x24, + 0xBC, + 0xD7, + 0x0A, + 0x13, + 0x66, + 0xD6, + 0x80, + 0x22, + 0xFC, + 0xE7, + 0x08, + 0x07, + 0x4C, + 0xAE, + 0x09, + 0xB3, + 0xDC, + 0xAE, + 0xC2, + 0xDB, + 0xC7, + 0xE3, + 0x77, + 0xC3, + 0x18, + 0x60, + 0xD2, + 0xD8, + 0x66, + 0x74, + 0x22, + 0x83, + 0xF7, + 0x9A, + 0x64, + 0xC2, + 0xE8, + 0x0E, + 0xDA, + 0xE0, + 0xBD, + 0x26, + 0x98, + 0x30, + 0x32, + 0x78, + 0x1F, + 0xBC, + 0xD7, + 0x60, + 0x13, + 0x46, + 0x05, + 0xD6, + 0x81, + 0xF7, + 0x1A, + 0x68, + 0xC2, + 0x88, + 0x59, + 0xA0, + 0x09, + 0xDE, + 0x9A, + 0x67, + 0x21, + 0xE2, + 0xB8, + 0xD9, + 0x41, + 0xDB, + 0x80, + 0x66, + 0x78, + 0xEB, + 0x1E, + 0x97, + 0x7D, + 0x71, + 0xE4, + 0x31, + 0x26, + 0xFC, + 0x55, + 0x8C, + 0xA5, + 0x72, + 0xE6, + 0xFD, + 0x36, + 0x35, + 0xE4, + 0xD3, + 0x83, + 0x03, + 0x8C, + 0x71, + 0x50, + 0xBC, + 0x1C, + 0xB4, + 0x02, + 0xA9, + 0xA6, + 0x7D, + 0x12, + 0xFE, + 0x2C, + 0xC5, + 0x9A, + 0xA0, + 0x11, + 0x64, + 0x2E, + 0xBC, + 0x97, + 0x92, + 0x09, + 0xBD, + 0x01, + 0xD6, + 0xC0, + 0x7B, + 0x29, + 0x98, + 0xD0, + 0x53, + 0x04, + 0xF5, + 0xAB, + 0xBD, + 0x78, + 0x04, + 0xFD, + 0x85, + 0xB1, + 0xD5, + 0x3D, + 0x75, + 0xF8, + 0xDC, + 0xD9, + 0x2F, + 0x16, + 0x45, + 0xAF, + 0x8E, + 0x4C, + 0x68, + 0x69, + 0x34, + 0xF4, + 0xCC, + 0x5B, + 0xF7, + 0x08, + 0xD3, + 0x22, + 0x0B, + 0xDE, + 0xAB, + 0xD1, + 0x04, + 0x69, + 0x83, + 0x25, + 0x69, + 0x3F, + 0xB2, + 0x30, + 0x4A, + 0x6A, + 0x40, + 0xD7, + 0x22, + 0x27, + 0x05, + 0xC1, + 0x01, + 0x4B, + 0xB6, + 0xCB, + 0x19, + 0xDA, + 0x50, + 0x13, + 0xB8, + 0x0B, + 0xA1, + 0xE6, + 0xB5, + 0x7D, + 0x2B, + 0x78, + 0xB6, + 0x6D, + 0x62, + 0xD5, + 0x18, + 0x49, + 0xB8, + 0x58, + 0xE2, + 0x64, + 0x40, + 0xFD, + 0x49, + 0x0E, + 0x00, + 0xFB, + 0x2C, + 0xA7, + 0x79, + 0xEE, + 0x7A, + 0x2E, + 0xC1, + 0x84, + 0x36, + 0xE4, + 0x6F, + 0xED, + 0x78, + 0x49, + 0x26, + 0xD4, + 0x5C, + 0x62, + 0xC1, + 0x47, + 0x83, + 0xC8, + 0x65, + 0x42, + 0xE6, + 0xCC, + 0xB5, + 0xD6, + 0x87, + 0xD4, + 0xBD, + 0xC3, + 0x25, + 0x3E, + 0xA3, + 0x26, + 0x94, + 0x32, + 0xA0, + 0x0A, + 0xBF, + 0x6D, + 0x1B, + 0xB6, + 0x6D, + 0x8B, + 0x07, + 0x92, + 0xC8, + 0x84, + 0x52, + 0xDA, + 0x4A, + 0x32, + 0x22, + 0xDB, + 0x26, + 0x17, + 0x9F, + 0x91, + 0x09, + 0x39, + 0x77, + 0x58, + 0xF0, + 0x67, + 0xBD, + 0xDF, + 0xEF, + 0x78, + 0x50, + 0xCC, + 0xFB, + 0xFD, + 0x73, + 0x06, + 0x9C, + 0x21, + 0xB8, + 0xAB, + 0xC5, + 0x6A, + 0x4D, + 0x00, + 0x8A, + 0x99, + 0x90, + 0xCA, + 0x00, + 0x31, + 0x3C, + 0x10, + 0x1E, + 0x69, + 0xFF, + 0x6E, + 0x57, + 0x6A, + 0x02, + 0xD0, + 0x0E, + 0x7F, + 0xAE, + 0x09, + 0xAC, + 0x82, + 0x5A, + 0xC8, + 0x04, + 0xEA, + 0x4A, + 0x13, + 0xFC, + 0xBE, + 0xEF, + 0x70, + 0xCE, + 0xC1, + 0x18, + 0x73, + 0x35, + 0xA2, + 0x90, + 0x09, + 0xC5, + 0x4B, + 0x83, + 0x51, + 0x1B, + 0xC4, + 0xB3, + 0x44, + 0x22, + 0x13, + 0xCE, + 0x19, + 0xD0, + 0x05, + 0x0F, + 0x00, + 0xCE, + 0x39, + 0x51, + 0x26, + 0xF4, + 0xC2, + 0xA7, + 0x66, + 0x89, + 0x6C, + 0xCC, + 0xE7, + 0xD3, + 0x8F, + 0x2D, + 0xCA, + 0x84, + 0xB3, + 0x1B, + 0x45, + 0x03, + 0x6A, + 0xF0, + 0x51, + 0x50, + 0x61, + 0x26, + 0x44, + 0xC7, + 0xD1, + 0x07, + 0x24, + 0x27, + 0xD0, + 0x6A, + 0xDB, + 0x02, + 0x7C, + 0xB4, + 0x7D, + 0xFA, + 0x06, + 0x8A, + 0xB5, + 0x12, + 0x94, + 0xC0, + 0x03, + 0xF2, + 0x4C, + 0x08, + 0xC7, + 0x90, + 0x55, + 0xA3, + 0xE4, + 0xF6, + 0x98, + 0x0B, + 0x0F, + 0x20, + 0xCA, + 0x84, + 0xAA, + 0x01, + 0x12, + 0xF8, + 0xD7, + 0xEB, + 0x15, + 0x3E, + 0xB7, + 0x98, + 0x10, + 0x15, + 0x42, + 0x52, + 0xF0, + 0xB8, + 0xED, + 0x72, + 0xFD, + 0x59, + 0x6B, + 0xA3, + 0x6B, + 0xDF, + 0x9B, + 0x50, + 0x34, + 0xA0, + 0x05, + 0xBE, + 0xD7, + 0x04, + 0xAA, + 0x5A, + 0x36, + 0x48, + 0xE0, + 0xCF, + 0x26, + 0xF8, + 0xCB, + 0x20, + 0x3B, + 0x0B, + 0xB4, + 0x9E, + 0x79, + 0xAF, + 0x9F, + 0x9F, + 0x9F, + 0xF0, + 0xB9, + 0xB7, + 0x26, + 0xE4, + 0xEA, + 0x80, + 0x30, + 0xED, + 0x8D, + 0xB5, + 0xD6, + 0x7D, + 0x3F, + 0x03, + 0xDF, + 0x1A, + 0x90, + 0x5A, + 0x1C, + 0xB8, + 0xE3, + 0x38, + 0x2E, + 0x3B, + 0x25, + 0xF0, + 0x5E, + 0xBD, + 0x26, + 0xD0, + 0xAA, + 0x9E, + 0x5B, + 0x37, + 0x44, + 0x6D, + 0x6A, + 0x97, + 0x19, + 0xF9, + 0x0A, + 0x3E, + 0x75, + 0x09, + 0x98, + 0x7D, + 0xDF, + 0xA3, + 0x1D, + 0x2D, + 0xF0, + 0x54, + 0xE2, + 0x29, + 0x72, + 0x02, + 0xFC, + 0x65, + 0x83, + 0xC8, + 0x1D, + 0xC7, + 0xD1, + 0x0C, + 0x7F, + 0x3E, + 0xFB, + 0x51, + 0x87, + 0x8C, + 0x4C, + 0x28, + 0xDD, + 0x38, + 0x69, + 0xC2, + 0x27, + 0x77, + 0x10, + 0x39, + 0x4D, + 0xF8, + 0xD0, + 0x69, + 0xC1, + 0x84, + 0x99, + 0xF0, + 0xD9, + 0x9D, + 0x44, + 0x91, + 0x09, + 0xBD, + 0xF0, + 0xA1, + 0x63, + 0x41, + 0x4D, + 0x18, + 0x05, + 0x5F, + 0xFC, + 0x07, + 0x51, + 0x30, + 0x81, + 0x5B, + 0xF4, + 0x38, + 0xEA, + 0x99, + 0x1D, + 0x80, + 0x7E, + 0xF8, + 0xEA, + 0x3F, + 0x89, + 0x8A, + 0x26, + 0x48, + 0xE1, + 0xC3, + 0x00, + 0x1A, + 0x4D, + 0xD0, + 0x80, + 0x67, + 0x1D, + 0x40, + 0x94, + 0x34, + 0xA1, + 0x15, + 0x3E, + 0x0C, + 0x42, + 0x7A, + 0x17, + 0xA9, + 0x04, + 0xCF, + 0x3E, + 0x88, + 0x28, + 0x32, + 0xA1, + 0x17, + 0x3E, + 0x0C, + 0x84, + 0x69, + 0x82, + 0x26, + 0xBC, + 0xE8, + 0x40, + 0xA2, + 0xE4, + 0xEC, + 0x00, + 0x7C, + 0x40, + 0x72, + 0xFF, + 0xAB, + 0x0E, + 0xA6, + 0x62, + 0x82, + 0x36, + 0xBC, + 0xF8, + 0x60, + 0xA2, + 0xA9, + 0x26, + 0x8C, + 0x80, + 0x6F, + 0x6A, + 0x40, + 0x14, + 0x4C, + 0xA0, + 0xD0, + 0xAD, + 0x26, + 0x18, + 0x63, + 0x70, + 0x1C, + 0xC7, + 0xE5, + 0x19, + 0x63, + 0x49, + 0x3D, + 0x6F, + 0x98, + 0xAA, + 0xBC, + 0x1F, + 0xA0, + 0x65, + 0x82, + 0x87, + 0xF7, + 0xE2, + 0x98, + 0xD0, + 0xFB, + 0x7A, + 0xAD, + 0xDA, + 0x1B, + 0x22, + 0xBD, + 0x26, + 0x50, + 0x78, + 0xAF, + 0x92, + 0x09, + 0x1A, + 0xEF, + 0x16, + 0x6B, + 0xBE, + 0x7A, + 0xD6, + 0x6C, + 0xC2, + 0x2A, + 0x78, + 0x95, + 0x00, + 0x44, + 0x62, + 0x13, + 0x56, + 0xC2, + 0xAB, + 0x05, + 0x21, + 0xCA, + 0x9A, + 0x70, + 0xE9, + 0x7C, + 0x31, + 0xBC, + 0x6A, + 0x20, + 0xA2, + 0xAA, + 0x09, + 0x77, + 0x80, + 0x57, + 0x0F, + 0x46, + 0x54, + 0x5C, + 0x27, + 0xDC, + 0x01, + 0x7E, + 0x48, + 0x40, + 0xA2, + 0x8B, + 0x09, + 0x77, + 0x82, + 0x1F, + 0x16, + 0x94, + 0x28, + 0xBA, + 0x1C, + 0xEE, + 0x04, + 0x3F, + 0x34, + 0x30, + 0x91, + 0x03, + 0x70, + 0x3B, + 0x78, + 0x60, + 0xDE, + 0x6F, + 0x86, + 0x92, + 0x10, + 0xAB, + 0xE1, + 0xA7, + 0x74, + 0x40, + 0x14, + 0x1E, + 0xB9, + 0xDF, + 0x01, + 0x1E, + 0x98, + 0xFF, + 0xCB, + 0x51, + 0x03, + 0xDC, + 0x07, + 0x7E, + 0x6A, + 0x47, + 0x44, + 0xB7, + 0xF9, + 0xF1, + 0xE4, + 0x2A, + 0x03, + 0x80, + 0x1B, + 0xFD, + 0x7C, + 0x76, + 0xA5, + 0xDC, + 0xF7, + 0xFB, + 0xBA, + 0xAE, + 0x17, + 0x9E, + 0xFF, + 0x77, + 0x2D, + 0x85, + 0xFF, + 0x07, + 0xE6, + 0x6F, + 0xFC, + 0xB7, + 0xE2, + 0xFB, + 0x3A, + 0x0B, + 0x00, + 0x00, + 0x00, + 0x00, + 0x49, + 0x45, + 0x4E, + 0x44, + 0xAE, + 0x42, + 0x60, + 0x82, }; wxBitmap& icon_png_to_wx_bitmap() { - static wxMemoryInputStream memIStream( icon_png, sizeof( icon_png ) ); - static wxImage image( memIStream, wxBITMAP_TYPE_PNG ); - static wxBitmap bmp( image ); - return bmp; + static wxMemoryInputStream memIStream(icon_png, sizeof(icon_png)); + static wxImage image(memIStream, wxBITMAP_TYPE_PNG); + static wxBitmap bmp(image); + return bmp; } - -#endif //ICON_PNG_H +#endif // ICON_PNG_H diff --git a/src/gui/idlepanel.cc b/src/gui/idlepanel.cc index b54dadfc..cfea5a62 100644 --- a/src/gui/idlepanel.cc +++ b/src/gui/idlepanel.cc @@ -245,6 +245,7 @@ public: std::string filename = _selectedDrive ? "drive:1" : "drive:0"; globalConfig().setFluxSink(filename); globalConfig().setFluxSource(filename); + globalConfig().setVerificationFluxSource(filename); break; } diff --git a/src/gui/imagerpanel.cc b/src/gui/imagerpanel.cc index abca08a6..fd677eb9 100644 --- a/src/gui/imagerpanel.cc +++ b/src/gui/imagerpanel.cc @@ -152,18 +152,19 @@ public: FluxSink::create(globalConfig()->flux_sink()); std::unique_ptr decoder; - std::shared_ptr fluxSource; - if (globalConfig()->has_decoder()) + std::shared_ptr 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) diff --git a/src/gui/layout.h b/src/gui/layout.h index a8f3d57b..2c4ad4f5 100644 --- a/src/gui/layout.h +++ b/src/gui/layout.h @@ -51,28 +51,45 @@ /////////////////////////////////////////////////////////////////////////////// class MainWindowGen : public wxFrame { - private: +private: +protected: + wxMenuBar* menuBar; + wxMenu* m_menu1; + wxMenu* m_menu2; + wxSimplebook* dataNotebook; - 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 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(); } - - - 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(); +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: +private: +protected: + wxTextCtrl* textControl; + wxStdDialogButtonSizer* m_sdbSizer2; + wxButton* m_sdbSizer2OK; - 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 event handlers, override them in your derived class - 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 ); - - ~TextViewerWindowGen(); +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: +private: +protected: + FluxViewerControl* fluxviewer; + wxScrollBar* scrollbar; + wxStdDialogButtonSizer* m_sdbSizer2; + wxButton* m_sdbSizer2OK; - 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 event handlers, override them in your derived class - 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 ); - - ~FluxViewerWindowGen(); +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: +private: +protected: + wxTextCtrl* textControl; + wxStdDialogButtonSizer* m_sdbSizer2; + wxButton* m_sdbSizer2Save; + wxButton* m_sdbSizer2Cancel; - 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 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(); } - - - 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(); +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,27 +202,32 @@ class TextEditorWindowGen : public wxDialog /////////////////////////////////////////////////////////////////////////////// class FileViewerWindowGen : public wxDialog { - private: +private: +protected: + wxNotebook* m_notebook1; + wxPanel* m_panel8; + wxTextCtrl* textControl; + wxPanel* m_panel7; + wxTextCtrl* hexControl; + wxStdDialogButtonSizer* m_sdbSizer2; + wxButton* m_sdbSizer2OK; - protected: - wxNotebook* m_notebook1; - wxPanel* m_panel8; - wxTextCtrl* textControl; - wxPanel* m_panel7; - wxTextCtrl* hexControl; - wxStdDialogButtonSizer* m_sdbSizer2; - wxButton* m_sdbSizer2OK; + // Virtual event handlers, override them in your derived class + virtual void OnClose(wxCommandEvent& event) + { + event.Skip(); + } - // Virtual event handlers, override them in your derived class - 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 ); - - ~FileViewerWindowGen(); +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: +private: +protected: + wxStaticText* m_staticText7; + wxStaticText* m_staticText9; - protected: - wxStaticText* m_staticText7; - wxStaticText* m_staticText9; +public: + wxTextCtrl* filenameText; + wxFilePickerCtrl* targetFilePicker; + wxStdDialogButtonSizer* buttons_; + wxButton* buttons_OK; + wxButton* buttons_Cancel; - 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(); + 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: +private: +protected: + wxStaticText* m_staticText91; + wxStaticText* m_staticText7; + wxStaticText* m_staticText9; - protected: - wxStaticText* m_staticText91; - wxStaticText* m_staticText7; - wxStaticText* m_staticText9; +public: + wxTextCtrl* newNameText; + wxTextCtrl* oldNameText; + wxStdDialogButtonSizer* buttons_; + wxButton* buttons_OK; + wxButton* buttons_Cancel; - 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(); + 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: +private: +protected: + wxStaticText* m_staticText91; + wxStaticText* m_staticText7; + wxStaticText* m_staticText9; - protected: - wxStaticText* m_staticText91; - wxStaticText* m_staticText7; - wxStaticText* m_staticText9; +public: + wxTextCtrl* newNameText; + wxTextCtrl* oldNameText; + wxStdDialogButtonSizer* buttons_; + wxButton* buttons_OK; + wxButton* buttons_Cancel; - 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(); + 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: +private: +protected: + wxStaticText* m_staticText91; + wxStaticText* m_staticText9; - protected: - wxStaticText* m_staticText91; - wxStaticText* m_staticText9; +public: + wxTextCtrl* newNameText; + wxStdDialogButtonSizer* buttons_; + wxButton* buttons_OK; + wxButton* buttons_Cancel; - 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(); + 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: +private: +protected: + wxStaticText* m_staticText91; + wxStaticText* m_staticText7; - protected: - wxStaticText* m_staticText91; - wxStaticText* m_staticText7; +public: + wxTextCtrl* volumeNameText; + wxCheckBox* quickFormatCheckBox; + wxStdDialogButtonSizer* buttons_; + wxButton* buttons_OK; + wxButton* buttons_Cancel; - 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(); + 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,37 +371,59 @@ class FormatDialog : public wxDialog /////////////////////////////////////////////////////////////////////////////// class IdlePanelGen : public wxPanel { - private: +private: +protected: + wxStaticBitmap* applicationBitmap; + wxPanel* sourceIconPanel; + wxSimplebook* sourceBook; + wxChoice* formatChoice; + wxButton* customConfigurationButton; + wxPanel* formatOptionsContainer; + wxButton* readButton; + wxButton* writeButton; + wxButton* browseButton; + wxButton* formatButton; + wxButton* exploreButton; - protected: - wxStaticBitmap* applicationBitmap; - wxPanel* sourceIconPanel; - wxSimplebook* sourceBook; - wxChoice* formatChoice; - wxButton* customConfigurationButton; - wxPanel* formatOptionsContainer; - wxButton* readButton; - wxButton* writeButton; - wxButton* browseButton; - wxButton* formatButton; - 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 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(); } - - - 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(); +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,30 +431,43 @@ class IdlePanelGen : public wxPanel /////////////////////////////////////////////////////////////////////////////// class ImagerPanelGen : public wxPanel { - private: +private: +protected: + wxAuiToolBar* imagerToolbar; + wxAuiToolBarItem* imagerBackTool; + VisualisationControl* visualiser; + wxButton* imagerSaveImageButton; + wxButton* imagerSaveFluxButton; + HistogramViewer* histogram; + wxButton* imagerGoAgainButton; - protected: - wxAuiToolBar* imagerToolbar; - wxAuiToolBarItem* imagerBackTool; - VisualisationControl* visualiser; - wxButton* imagerSaveImageButton; - wxButton* imagerSaveFluxButton; - HistogramViewer* histogram; - 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 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(); } - - - 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(); +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,69 +475,121 @@ class ImagerPanelGen : public wxPanel /////////////////////////////////////////////////////////////////////////////// class BrowserPanelGen : public wxPanel { - private: +private: +protected: + wxAuiToolBar* browserToolbar; + wxAuiToolBarItem* browserBackTool; + wxAuiToolBarItem* browserInfoTool; + wxAuiToolBarItem* browserViewTool; + wxAuiToolBarItem* browserSaveTool; + wxAuiToolBarItem* browserMoreMenuButton; + wxMenu* browserMoreMenu; + wxMenuItem* browserAddMenuItem; + wxMenuItem* browserNewDirectoryMenuItem; + wxMenuItem* browserRenameMenuItem; + wxMenuItem* browserDeleteMenuItem; + wxAuiToolBarItem* browserFormatTool; + wxDataViewCtrl* browserTree; + wxDataViewColumn* m_dataViewColumn1; + wxDataViewColumn* m_dataViewColumn2; + wxDataViewColumn* m_dataViewColumn3; + wxGauge* diskSpaceGauge; + wxButton* browserDiscardButton; + wxButton* browserCommitButton; + wxStaticText* m_staticText12; - protected: - wxAuiToolBar* browserToolbar; - wxAuiToolBarItem* browserBackTool; - wxAuiToolBarItem* browserInfoTool; - wxAuiToolBarItem* browserViewTool; - wxAuiToolBarItem* browserSaveTool; - wxAuiToolBarItem* browserMoreMenuButton; - wxMenu* browserMoreMenu; - wxMenuItem* browserAddMenuItem; - wxMenuItem* browserNewDirectoryMenuItem; - wxMenuItem* browserRenameMenuItem; - wxMenuItem* browserDeleteMenuItem; - wxAuiToolBarItem* browserFormatTool; - wxDataViewCtrl* browserTree; - wxDataViewColumn* m_dataViewColumn1; - wxDataViewColumn* m_dataViewColumn2; - wxDataViewColumn* m_dataViewColumn3; - wxGauge* diskSpaceGauge; - wxButton* browserDiscardButton; - wxButton* browserCommitButton; - 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 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(); } +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(); - 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 ) - { - 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 ); - } - } - + void browserMoreMenuButtonOnDropDownMenu(wxAuiToolBarEvent& event) + { + 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); + } + } }; /////////////////////////////////////////////////////////////////////////////// @@ -446,45 +597,64 @@ class BrowserPanelGen : public wxPanel /////////////////////////////////////////////////////////////////////////////// class ExplorerPanelGen : public wxPanel { - private: +private: +protected: + wxAuiToolBar* explorerToolbar; + wxAuiToolBarItem* explorerBackTool; + wxAuiToolBarItem* explorerRefreshTool; + wxStaticText* m_staticText22; + wxSpinCtrl* explorerTrackSpinCtrl; + wxStaticText* m_staticText26; + wxSpinCtrl* explorerSideSpinCtrl; + wxStaticText* m_staticText231; + wxSpinCtrlDouble* explorerStartTimeSpinCtrl; + wxStaticText* m_staticText24; + wxButton* guessButton; + wxSpinCtrlDouble* explorerClockSpinCtrl; + wxStaticText* m_staticText25; + wxSpinCtrl* explorerBitOffsetSpinCtrl; + wxStaticText* m_staticText27; + wxChoice* explorerDecodeChoice; + wxStaticText* m_staticText241; + wxCheckBox* explorerReverseCheckBox; + HistogramViewer* histogram; + wxTextCtrl* explorerText; - protected: - wxAuiToolBar* explorerToolbar; - wxAuiToolBarItem* explorerBackTool; - wxAuiToolBarItem* explorerRefreshTool; - wxStaticText* m_staticText22; - wxSpinCtrl* explorerTrackSpinCtrl; - wxStaticText* m_staticText26; - wxSpinCtrl* explorerSideSpinCtrl; - wxStaticText* m_staticText231; - wxSpinCtrlDouble* explorerStartTimeSpinCtrl; - wxStaticText* m_staticText24; - wxButton* guessButton; - wxSpinCtrlDouble* explorerClockSpinCtrl; - wxStaticText* m_staticText25; - wxSpinCtrl* explorerBitOffsetSpinCtrl; - wxStaticText* m_staticText27; - wxChoice* explorerDecodeChoice; - wxStaticText* m_staticText241; - wxCheckBox* explorerReverseCheckBox; - HistogramViewer* histogram; - 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 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(); } - - - 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(); +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: +private: +protected: + wxStaticText* m_staticText30; + wxStaticText* m_staticText29; - protected: - wxStaticText* m_staticText30; - wxStaticText* m_staticText29; +public: + wxStaticText* label; + wxCheckBox* highDensityToggle; + wxChoice* driveTypeChoice; - 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(); + 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: +private: +protected: + wxStaticText* m_staticText28; + wxStaticText* m_staticText27; - protected: - wxStaticText* m_staticText28; - wxStaticText* m_staticText27; +public: + wxFilePickerCtrl* fluxImagePicker; - 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(); + 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: +private: +protected: + wxStaticText* m_staticText29; + wxStaticText* m_staticText28; - protected: - wxStaticText* m_staticText29; - wxStaticText* m_staticText28; +public: + wxFilePickerCtrl* diskImagePicker; - 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(); + 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(); }; - diff --git a/src/readibm.h b/src/readibm.h index 22dd7a05..0d42ef8e 100644 --- a/src/readibm.h +++ b/src/readibm.h @@ -11,4 +11,3 @@ extern RangeFlag requiredSectors; extern int mainReadIBM(int argc, const char* argv[]); #endif - diff --git a/tests/tests.h b/tests/tests.h index a563e8b3..6e3eb328 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -2,37 +2,39 @@ #define TESTS_H class AssertionError -{}; +{ +}; template class Subject { public: - Subject(const std::string& filename, int lineno, T value): - _filename(filename), - _lineno(lineno), - _value(value) {} + Subject(const std::string& filename, int lineno, T value): + _filename(filename), + _lineno(lineno), + _value(value) + { + } public: - void isEqualTo(T wanted) - { - if (_value != wanted) - fail(fmt::format("wanted {}, got {}", wanted, _value)); - } + void isEqualTo(T wanted) + { + if (_value != wanted) + fail(fmt::format("wanted {}, got {}", wanted, _value)); + } private: - void fail(const std::string& message) - { - error("assertion failed: {}: {}: {}", _filename, _lineno, message); - } + void fail(const std::string& message) + { + error("assertion failed: {}: {}: {}", _filename, _lineno, message); + } private: - const std::string _filename; - int _lineno; - T _value; + const std::string _filename; + int _lineno; + T _value; }; #define assertThat(value) Subject(__FILE__, __LINE__, value) #endif -