mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-24 11:11:02 -07:00
Sort out a whole bunch of other things, including cleaning up the way the
verification source is handled.
This commit is contained in:
@@ -2,9 +2,10 @@
|
|||||||
#define AESLANIER_H
|
#define AESLANIER_H
|
||||||
|
|
||||||
#define AESLANIER_RECORD_SEPARATOR 0x55555122
|
#define AESLANIER_RECORD_SEPARATOR 0x55555122
|
||||||
#define AESLANIER_SECTOR_LENGTH 256
|
#define AESLANIER_SECTOR_LENGTH 256
|
||||||
#define AESLANIER_RECORD_SIZE (AESLANIER_SECTOR_LENGTH + 5)
|
#define AESLANIER_RECORD_SIZE (AESLANIER_SECTOR_LENGTH + 5)
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createAesLanierDecoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createAesLanierDecoder(
|
||||||
|
const DecoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,4 +17,3 @@ extern std::unique_ptr<Encoder> createAgatEncoder(const EncoderProto& config);
|
|||||||
extern uint8_t agatChecksum(const Bytes& bytes);
|
extern uint8_t agatChecksum(const Bytes& bytes);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,15 @@
|
|||||||
#include "decoders/decoders.h"
|
#include "decoders/decoders.h"
|
||||||
#include "encoders/encoders.h"
|
#include "encoders/encoders.h"
|
||||||
|
|
||||||
#define APPLE2_SECTOR_RECORD 0xd5aa96
|
#define APPLE2_SECTOR_RECORD 0xd5aa96
|
||||||
#define APPLE2_DATA_RECORD 0xd5aaad
|
#define APPLE2_DATA_RECORD 0xd5aaad
|
||||||
|
|
||||||
#define APPLE2_SECTOR_LENGTH 256
|
#define APPLE2_SECTOR_LENGTH 256
|
||||||
#define APPLE2_ENCODED_SECTOR_LENGTH 342
|
#define APPLE2_ENCODED_SECTOR_LENGTH 342
|
||||||
|
|
||||||
#define APPLE2_SECTORS 16
|
#define APPLE2_SECTORS 16
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createApple2Decoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createApple2Decoder(const DecoderProto& config);
|
||||||
extern std::unique_ptr<Encoder> createApple2Encoder(const EncoderProto& config);
|
extern std::unique_ptr<Encoder> createApple2Encoder(const EncoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,19 @@
|
|||||||
|
|
||||||
/* Brother word processor format (or at least, one of them) */
|
/* Brother word processor format (or at least, one of them) */
|
||||||
|
|
||||||
#define BROTHER_SECTOR_RECORD 0xFFFFFD57
|
#define BROTHER_SECTOR_RECORD 0xFFFFFD57
|
||||||
#define BROTHER_DATA_RECORD 0xFFFFFDDB
|
#define BROTHER_DATA_RECORD 0xFFFFFDDB
|
||||||
#define BROTHER_DATA_RECORD_PAYLOAD 256
|
#define BROTHER_DATA_RECORD_PAYLOAD 256
|
||||||
#define BROTHER_DATA_RECORD_CHECKSUM 3
|
#define BROTHER_DATA_RECORD_CHECKSUM 3
|
||||||
#define BROTHER_DATA_RECORD_ENCODED_SIZE 415
|
#define BROTHER_DATA_RECORD_ENCODED_SIZE 415
|
||||||
|
|
||||||
#define BROTHER_TRACKS_PER_240KB_DISK 78
|
#define BROTHER_TRACKS_PER_240KB_DISK 78
|
||||||
#define BROTHER_TRACKS_PER_120KB_DISK 39
|
#define BROTHER_TRACKS_PER_120KB_DISK 39
|
||||||
#define BROTHER_SECTORS_PER_TRACK 12
|
#define BROTHER_SECTORS_PER_TRACK 12
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createBrotherDecoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createBrotherDecoder(
|
||||||
extern std::unique_ptr<Encoder> createBrotherEncoder(const EncoderProto& config);
|
const DecoderProto& config);
|
||||||
|
extern std::unique_ptr<Encoder> createBrotherEncoder(
|
||||||
|
const EncoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
GCR_ENTRY(0x55, 0) // 00000
|
GCR_ENTRY(0x55, 0) // 00000
|
||||||
GCR_ENTRY(0x57, 1) // 00001
|
GCR_ENTRY(0x57, 1) // 00001
|
||||||
GCR_ENTRY(0x5b, 2) // 00010
|
GCR_ENTRY(0x5b, 2) // 00010
|
||||||
GCR_ENTRY(0x5d, 3) // 00011
|
GCR_ENTRY(0x5d, 3) // 00011
|
||||||
GCR_ENTRY(0x5f, 4) // 00100
|
GCR_ENTRY(0x5f, 4) // 00100
|
||||||
GCR_ENTRY(0x6b, 5) // 00101
|
GCR_ENTRY(0x6b, 5) // 00101
|
||||||
GCR_ENTRY(0x6d, 6) // 00110
|
GCR_ENTRY(0x6d, 6) // 00110
|
||||||
GCR_ENTRY(0x6f, 7) // 00111
|
GCR_ENTRY(0x6f, 7) // 00111
|
||||||
GCR_ENTRY(0x75, 8) // 01000
|
GCR_ENTRY(0x75, 8) // 01000
|
||||||
GCR_ENTRY(0x77, 9) // 01001
|
GCR_ENTRY(0x77, 9) // 01001
|
||||||
GCR_ENTRY(0x7b, 10) // 01010
|
GCR_ENTRY(0x7b, 10) // 01010
|
||||||
GCR_ENTRY(0x7d, 11) // 01011
|
GCR_ENTRY(0x7d, 11) // 01011
|
||||||
GCR_ENTRY(0x7f, 12) // 01100
|
GCR_ENTRY(0x7f, 12) // 01100
|
||||||
@@ -30,4 +30,3 @@ GCR_ENTRY(0xef, 28) // 11100
|
|||||||
GCR_ENTRY(0xf5, 29) // 11101
|
GCR_ENTRY(0xf5, 29) // 11101
|
||||||
GCR_ENTRY(0xf7, 30) // 11110
|
GCR_ENTRY(0xf7, 30) // 11110
|
||||||
GCR_ENTRY(0xfb, 31) // 11111
|
GCR_ENTRY(0xfb, 31) // 11111
|
||||||
|
|
||||||
|
|||||||
@@ -76,4 +76,3 @@ GCR_ENTRY(0x6BAB, 74)
|
|||||||
GCR_ENTRY(0xAD5F, 75)
|
GCR_ENTRY(0xAD5F, 75)
|
||||||
GCR_ENTRY(0xDBED, 76)
|
GCR_ENTRY(0xDBED, 76)
|
||||||
GCR_ENTRY(0x55BB, 77)
|
GCR_ENTRY(0x55BB, 77)
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
#include "decoders/decoders.h"
|
#include "decoders/decoders.h"
|
||||||
#include "encoders/encoders.h"
|
#include "encoders/encoders.h"
|
||||||
|
|
||||||
#define C64_SECTOR_RECORD 0xffd49
|
#define C64_SECTOR_RECORD 0xffd49
|
||||||
#define C64_DATA_RECORD 0xffd57
|
#define C64_DATA_RECORD 0xffd57
|
||||||
#define C64_SECTOR_LENGTH 256
|
#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)
|
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)
|
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)
|
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)
|
6. Inter-sector gap 55 55 55 55...55 55 (4 to 12 bytes, never read)
|
||||||
1. Header sync (SYNC for the next sector)
|
1. Header sync (SYNC for the next sector)
|
||||||
*/
|
*/
|
||||||
#define C64_HEADER_DATA_SYNC 0xFF
|
#define C64_HEADER_DATA_SYNC 0xFF
|
||||||
#define C64_HEADER_BLOCK_ID 0x08
|
#define C64_HEADER_BLOCK_ID 0x08
|
||||||
#define C64_DATA_BLOCK_ID 0x07
|
#define C64_DATA_BLOCK_ID 0x07
|
||||||
#define C64_HEADER_GAP 0x55
|
#define C64_HEADER_GAP 0x55
|
||||||
#define C64_INTER_SECTOR_GAP 0x55
|
#define C64_INTER_SECTOR_GAP 0x55
|
||||||
#define C64_PADDING 0x0F
|
#define C64_PADDING 0x0F
|
||||||
|
|
||||||
#define C64_TRACKS_PER_DISK 40
|
#define C64_TRACKS_PER_DISK 40
|
||||||
#define C64_BAM_TRACK 17
|
#define C64_BAM_TRACK 17
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createCommodore64Decoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createCommodore64Decoder(
|
||||||
extern std::unique_ptr<Encoder> createCommodore64Encoder(const EncoderProto& config);
|
const DecoderProto& config);
|
||||||
|
extern std::unique_ptr<Encoder> createCommodore64Encoder(
|
||||||
|
const EncoderProto& config);
|
||||||
|
|
||||||
extern nanoseconds_t clockPeriodForC64Track(unsigned track);
|
extern nanoseconds_t clockPeriodForC64Track(unsigned track);
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
#define F85_H
|
#define F85_H
|
||||||
|
|
||||||
#define F85_SECTOR_RECORD 0xffffce /* 1111 1111 1111 1111 1100 1110 */
|
#define F85_SECTOR_RECORD 0xffffce /* 1111 1111 1111 1111 1100 1110 */
|
||||||
#define F85_DATA_RECORD 0xffffcb /* 1111 1111 1111 1111 1100 1101 */
|
#define F85_DATA_RECORD 0xffffcb /* 1111 1111 1111 1111 1100 1101 */
|
||||||
#define F85_SECTOR_LENGTH 512
|
#define F85_SECTOR_LENGTH 512
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createDurangoF85Decoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createDurangoF85Decoder(
|
||||||
|
const DecoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,4 +8,3 @@
|
|||||||
extern std::unique_ptr<Decoder> createFb100Decoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createFb100Decoder(const DecoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,7 @@ class Decoder;
|
|||||||
class DecoderProto;
|
class DecoderProto;
|
||||||
class EncoderProto;
|
class EncoderProto;
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createIbmDecoder(
|
extern std::unique_ptr<Decoder> createIbmDecoder(const DecoderProto& config);
|
||||||
const DecoderProto& config);
|
extern std::unique_ptr<Encoder> createIbmEncoder(const EncoderProto& config);
|
||||||
extern std::unique_ptr<Encoder> createIbmEncoder(
|
|
||||||
const EncoderProto& config);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#ifndef MACINTOSH_H
|
#ifndef MACINTOSH_H
|
||||||
#define MACINTOSH_H
|
#define MACINTOSH_H
|
||||||
|
|
||||||
#define MAC_SECTOR_RECORD 0xd5aa96 /* 1101 0101 1010 1010 1001 0110 */
|
#define MAC_SECTOR_RECORD 0xd5aa96 /* 1101 0101 1010 1010 1001 0110 */
|
||||||
#define MAC_DATA_RECORD 0xd5aaad /* 1101 0101 1010 1010 1010 1101 */
|
#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_ENCODED_SECTOR_LENGTH 703
|
||||||
#define MAC_FORMAT_BYTE 0x22
|
#define MAC_FORMAT_BYTE 0x22
|
||||||
|
|
||||||
#define MAC_TRACKS_PER_DISK 80
|
#define MAC_TRACKS_PER_DISK 80
|
||||||
|
|
||||||
@@ -15,8 +15,9 @@ class Decoder;
|
|||||||
class DecoderProto;
|
class DecoderProto;
|
||||||
class EncoderProto;
|
class EncoderProto;
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createMacintoshDecoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createMacintoshDecoder(
|
||||||
extern std::unique_ptr<Encoder> createMacintoshEncoder(const EncoderProto& config);
|
const DecoderProto& config);
|
||||||
|
extern std::unique_ptr<Encoder> createMacintoshEncoder(
|
||||||
|
const EncoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
#ifndef MICROPOLIS_H
|
#ifndef MICROPOLIS_H
|
||||||
#define MICROPOLIS_H
|
#define MICROPOLIS_H
|
||||||
|
|
||||||
#define MICROPOLIS_PAYLOAD_SIZE (256)
|
#define MICROPOLIS_PAYLOAD_SIZE (256)
|
||||||
#define MICROPOLIS_HEADER_SIZE (1+2+10)
|
#define MICROPOLIS_HEADER_SIZE (1 + 2 + 10)
|
||||||
#define MICROPOLIS_ENCODED_SECTOR_SIZE (MICROPOLIS_HEADER_SIZE + MICROPOLIS_PAYLOAD_SIZE + 6)
|
#define MICROPOLIS_ENCODED_SECTOR_SIZE \
|
||||||
|
(MICROPOLIS_HEADER_SIZE + MICROPOLIS_PAYLOAD_SIZE + 6)
|
||||||
|
|
||||||
class Decoder;
|
class Decoder;
|
||||||
class Encoder;
|
class Encoder;
|
||||||
class EncoderProto;
|
class EncoderProto;
|
||||||
class DecoderProto;
|
class DecoderProto;
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createMicropolisDecoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createMicropolisDecoder(
|
||||||
extern std::unique_ptr<Encoder> createMicropolisEncoder(const EncoderProto& config);
|
const DecoderProto& config);
|
||||||
|
extern std::unique_ptr<Encoder> createMicropolisEncoder(
|
||||||
|
const EncoderProto& config);
|
||||||
|
|
||||||
extern uint8_t micropolisChecksum(const Bytes& bytes);
|
extern uint8_t micropolisChecksum(const Bytes& bytes);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#ifndef NORTHSTAR_H
|
#ifndef NORTHSTAR_H
|
||||||
#define 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 |
|
* | SYNC Byte | Payload | Checksum |
|
||||||
@@ -12,15 +13,19 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NORTHSTAR_PREAMBLE_SIZE_SD (16)
|
#define NORTHSTAR_PREAMBLE_SIZE_SD (16)
|
||||||
#define NORTHSTAR_PREAMBLE_SIZE_DD (32)
|
#define NORTHSTAR_PREAMBLE_SIZE_DD (32)
|
||||||
#define NORTHSTAR_HEADER_SIZE_SD (1)
|
#define NORTHSTAR_HEADER_SIZE_SD (1)
|
||||||
#define NORTHSTAR_HEADER_SIZE_DD (2)
|
#define NORTHSTAR_HEADER_SIZE_DD (2)
|
||||||
#define NORTHSTAR_PAYLOAD_SIZE_SD (256)
|
#define NORTHSTAR_PAYLOAD_SIZE_SD (256)
|
||||||
#define NORTHSTAR_PAYLOAD_SIZE_DD (512)
|
#define NORTHSTAR_PAYLOAD_SIZE_DD (512)
|
||||||
#define NORTHSTAR_CHECKSUM_SIZE (1)
|
#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_SD \
|
||||||
#define NORTHSTAR_ENCODED_SECTOR_SIZE_DD (NORTHSTAR_HEADER_SIZE_DD + NORTHSTAR_PAYLOAD_SIZE_DD + NORTHSTAR_CHECKSUM_SIZE)
|
(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 Decoder;
|
||||||
class Encoder;
|
class Encoder;
|
||||||
@@ -29,7 +34,9 @@ class DecoderProto;
|
|||||||
|
|
||||||
extern uint8_t northstarChecksum(const Bytes& bytes);
|
extern uint8_t northstarChecksum(const Bytes& bytes);
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createNorthstarDecoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createNorthstarDecoder(
|
||||||
extern std::unique_ptr<Encoder> createNorthstarEncoder(const EncoderProto& config);
|
const DecoderProto& config);
|
||||||
|
extern std::unique_ptr<Encoder> createNorthstarEncoder(
|
||||||
|
const EncoderProto& config);
|
||||||
|
|
||||||
#endif /* NORTHSTAR */
|
#endif /* NORTHSTAR */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createRolandD20Decoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createRolandD20Decoder(
|
||||||
|
const DecoderProto& config);
|
||||||
|
|||||||
@@ -7,4 +7,3 @@
|
|||||||
extern std::unique_ptr<Decoder> createSmaky6Decoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createSmaky6Decoder(const DecoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
#ifndef TIDS990_H
|
#ifndef TIDS990_H
|
||||||
#define TIDS990_H
|
#define TIDS990_H
|
||||||
|
|
||||||
#define TIDS990_PAYLOAD_SIZE 288 /* bytes */
|
#define TIDS990_PAYLOAD_SIZE 288 /* bytes */
|
||||||
#define TIDS990_SECTOR_RECORD_SIZE 10 /* bytes */
|
#define TIDS990_SECTOR_RECORD_SIZE 10 /* bytes */
|
||||||
#define TIDS990_DATA_RECORD_SIZE (TIDS990_PAYLOAD_SIZE + 4) /* bytes */
|
#define TIDS990_DATA_RECORD_SIZE (TIDS990_PAYLOAD_SIZE + 4) /* bytes */
|
||||||
|
|
||||||
class Encoder;
|
class Encoder;
|
||||||
class Decoder;
|
class Decoder;
|
||||||
class DecoderProto;
|
class DecoderProto;
|
||||||
class EncoderProto;
|
class EncoderProto;
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createTids990Decoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createTids990Decoder(
|
||||||
extern std::unique_ptr<Encoder> createTids990Encoder(const EncoderProto& config);
|
const DecoderProto& config);
|
||||||
|
extern std::unique_ptr<Encoder> createTids990Encoder(
|
||||||
|
const EncoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ class DecoderProto;
|
|||||||
|
|
||||||
/* ... 1101 0100 1001
|
/* ... 1101 0100 1001
|
||||||
* ^^ ^^^^ ^^^^ ten bit IO byte */
|
* ^^ ^^^^ ^^^^ ten bit IO byte */
|
||||||
#define VICTOR9K_DATA_RECORD 0xfffffd49
|
#define VICTOR9K_DATA_RECORD 0xfffffd49
|
||||||
#define VICTOR9K_DATA_ID 0x8
|
#define VICTOR9K_DATA_ID 0x8
|
||||||
|
|
||||||
#define VICTOR9K_SECTOR_LENGTH 512
|
#define VICTOR9K_SECTOR_LENGTH 512
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createVictor9kDecoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createVictor9kDecoder(
|
||||||
extern std::unique_ptr<Encoder> createVictor9kEncoder(const EncoderProto& config);
|
const DecoderProto& config);
|
||||||
|
extern std::unique_ptr<Encoder> createVictor9kEncoder(
|
||||||
|
const EncoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#ifndef ZILOGMCZ_H
|
#ifndef ZILOGMCZ_H
|
||||||
#define ZILOGMCZ_H
|
#define ZILOGMCZ_H
|
||||||
|
|
||||||
extern std::unique_ptr<Decoder> createZilogMczDecoder(const DecoderProto& config);
|
extern std::unique_ptr<Decoder> createZilogMczDecoder(
|
||||||
|
const DecoderProto& config);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
13
lib/a2r.h
13
lib/a2r.h
@@ -1,10 +1,11 @@
|
|||||||
#ifndef A2R_H
|
#ifndef A2R_H
|
||||||
#define A2R_H
|
#define A2R_H
|
||||||
|
|
||||||
// The canonical reference for the A2R format is: https://applesaucefdc.com/a2r2-reference/
|
// The canonical reference for the A2R format is:
|
||||||
// All data is stored little-endian
|
// 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_INFO (0x4F464E49)
|
||||||
#define A2R_CHUNK_STRM (0x4D525453)
|
#define A2R_CHUNK_STRM (0x4D525453)
|
||||||
@@ -12,12 +13,14 @@
|
|||||||
|
|
||||||
#define A2R_INFO_CHUNK_VERSION (1)
|
#define A2R_INFO_CHUNK_VERSION (1)
|
||||||
|
|
||||||
enum A2RDiskType {
|
enum A2RDiskType
|
||||||
|
{
|
||||||
A2R_DISK_525 = 1,
|
A2R_DISK_525 = 1,
|
||||||
A2R_DISK_35 = 2,
|
A2R_DISK_35 = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum A2RCaptureType {
|
enum A2RCaptureType
|
||||||
|
{
|
||||||
A2R_TIMING = 1,
|
A2R_TIMING = 1,
|
||||||
A2R_BITS = 2,
|
A2R_BITS = 2,
|
||||||
A2R_XTIMING = 3,
|
A2R_XTIMING = 3,
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ class Bitmap
|
|||||||
public:
|
public:
|
||||||
Bitmap(const std::string filename, unsigned width, unsigned height);
|
Bitmap(const std::string filename, unsigned width, unsigned height);
|
||||||
|
|
||||||
Agg2D& painter();
|
Agg2D& painter();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<uint8_t> _bitmap;
|
std::vector<uint8_t> _bitmap;
|
||||||
std::unique_ptr<Agg2D> _painter;
|
std::unique_ptr<Agg2D> _painter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string filename;
|
std::string filename;
|
||||||
unsigned width;
|
unsigned width;
|
||||||
|
|||||||
183
lib/bytes.h
183
lib/bytes.h
@@ -16,36 +16,71 @@ public:
|
|||||||
Bytes(const std::string& data);
|
Bytes(const std::string& data);
|
||||||
Bytes(std::initializer_list<uint8_t> data);
|
Bytes(std::initializer_list<uint8_t> data);
|
||||||
Bytes(std::shared_ptr<std::vector<uint8_t>> data);
|
Bytes(std::shared_ptr<std::vector<uint8_t>> data);
|
||||||
Bytes(std::shared_ptr<std::vector<uint8_t>> data, unsigned start, unsigned end);
|
Bytes(std::shared_ptr<std::vector<uint8_t>> data,
|
||||||
|
unsigned start,
|
||||||
|
unsigned end);
|
||||||
|
|
||||||
Bytes* operator = (const Bytes& other);
|
Bytes* operator=(const Bytes& other);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Bytes readFromFile(const std::string& filename);
|
static Bytes readFromFile(const std::string& filename);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* General purpose methods */
|
/* General purpose methods */
|
||||||
|
|
||||||
unsigned size() const { return _high - _low; }
|
unsigned size() const
|
||||||
bool empty() const { return _high == _low; }
|
{
|
||||||
|
return _high - _low;
|
||||||
|
}
|
||||||
|
bool empty() const
|
||||||
|
{
|
||||||
|
return _high == _low;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator == (const Bytes& other) const
|
bool operator==(const Bytes& other) const
|
||||||
{ return std::equal(cbegin(), cend(), other.cbegin(), other.cend()); }
|
{
|
||||||
|
return std::equal(cbegin(), cend(), other.cbegin(), other.cend());
|
||||||
|
}
|
||||||
|
|
||||||
bool operator != (const Bytes& other) const
|
bool operator!=(const Bytes& other) const
|
||||||
{ return !(*this == other); }
|
{
|
||||||
|
return !(*this == other);
|
||||||
|
}
|
||||||
|
|
||||||
const uint8_t& operator [] (unsigned offset) const;
|
const uint8_t& operator[](unsigned offset) const;
|
||||||
const uint8_t* cbegin() const { return _data->data() + _low; }
|
const uint8_t* cbegin() const
|
||||||
const uint8_t* cend() const { return _data->data() + _high; }
|
{
|
||||||
const uint8_t* begin() const { return _data->data() + _low; }
|
return _data->data() + _low;
|
||||||
const uint8_t* end() const { return _data->data() + _high; }
|
}
|
||||||
|
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& operator[](unsigned offset);
|
||||||
uint8_t* begin() { checkWritable(); return _data->data() + _low; }
|
uint8_t* begin()
|
||||||
uint8_t* end() { checkWritable(); return _data->data() + _high; }
|
{
|
||||||
|
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 boundsCheck(unsigned pos) const;
|
||||||
void checkWritable();
|
void checkWritable();
|
||||||
@@ -53,26 +88,29 @@ public:
|
|||||||
Bytes& resize(unsigned size);
|
Bytes& resize(unsigned size);
|
||||||
|
|
||||||
Bytes& clear()
|
Bytes& clear()
|
||||||
{ resize(0); return *this; }
|
{
|
||||||
|
resize(0);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Bytes> split(uint8_t separator) const;
|
std::vector<Bytes> split(uint8_t separator) const;
|
||||||
|
|
||||||
Bytes slice(unsigned start, unsigned len) const;
|
Bytes slice(unsigned start, unsigned len) const;
|
||||||
Bytes slice(unsigned start) const;
|
Bytes slice(unsigned start) const;
|
||||||
Bytes swab() const;
|
Bytes swab() const;
|
||||||
Bytes compress() const;
|
Bytes compress() const;
|
||||||
Bytes decompress() const;
|
Bytes decompress() const;
|
||||||
std::vector<bool> toBits() const;
|
std::vector<bool> toBits() const;
|
||||||
Bytes reverseBits() const;
|
Bytes reverseBits() const;
|
||||||
|
|
||||||
Bytes operator + (const Bytes& other);
|
Bytes operator+(const Bytes& other);
|
||||||
Bytes operator * (size_t count);
|
Bytes operator*(size_t count);
|
||||||
|
|
||||||
ByteReader reader() const;
|
ByteReader reader() const;
|
||||||
ByteWriter writer();
|
ByteWriter writer();
|
||||||
|
|
||||||
void writeToFile(const std::string& filename) const;
|
void writeToFile(const std::string& filename) const;
|
||||||
void writeTo(std::ostream& stream) const;
|
void writeTo(std::ostream& stream) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<std::vector<uint8_t>> _data;
|
std::shared_ptr<std::vector<uint8_t>> _data;
|
||||||
@@ -83,15 +121,15 @@ private:
|
|||||||
class ByteReader
|
class ByteReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ByteReader(const Bytes& bytes):
|
ByteReader(const Bytes& bytes): _bytes(bytes) {}
|
||||||
_bytes(bytes)
|
|
||||||
{}
|
|
||||||
|
|
||||||
ByteReader(const Bytes&&) = delete;
|
ByteReader(const Bytes&&) = delete;
|
||||||
|
|
||||||
unsigned pos = 0;
|
unsigned pos = 0;
|
||||||
bool eof() const
|
bool eof() const
|
||||||
{ return pos >= _bytes.size(); }
|
{
|
||||||
|
return pos >= _bytes.size();
|
||||||
|
}
|
||||||
|
|
||||||
ByteReader& seek(unsigned pos)
|
ByteReader& seek(unsigned pos)
|
||||||
{
|
{
|
||||||
@@ -121,7 +159,7 @@ public:
|
|||||||
{
|
{
|
||||||
uint8_t b1 = _bytes[pos++];
|
uint8_t b1 = _bytes[pos++];
|
||||||
uint8_t b2 = _bytes[pos++];
|
uint8_t b2 = _bytes[pos++];
|
||||||
return (b1<<8) | b2;
|
return (b1 << 8) | b2;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t read_be24()
|
uint32_t read_be24()
|
||||||
@@ -129,7 +167,7 @@ public:
|
|||||||
uint8_t b1 = _bytes[pos++];
|
uint8_t b1 = _bytes[pos++];
|
||||||
uint8_t b2 = _bytes[pos++];
|
uint8_t b2 = _bytes[pos++];
|
||||||
uint8_t b3 = _bytes[pos++];
|
uint8_t b3 = _bytes[pos++];
|
||||||
return (b1<<16) | (b2<<8) | b3;
|
return (b1 << 16) | (b2 << 8) | b3;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t read_be32()
|
uint32_t read_be32()
|
||||||
@@ -138,7 +176,7 @@ public:
|
|||||||
uint8_t b2 = _bytes[pos++];
|
uint8_t b2 = _bytes[pos++];
|
||||||
uint8_t b3 = _bytes[pos++];
|
uint8_t b3 = _bytes[pos++];
|
||||||
uint8_t b4 = _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();
|
uint64_t read_be48();
|
||||||
@@ -148,7 +186,7 @@ public:
|
|||||||
{
|
{
|
||||||
uint8_t b1 = _bytes[pos++];
|
uint8_t b1 = _bytes[pos++];
|
||||||
uint8_t b2 = _bytes[pos++];
|
uint8_t b2 = _bytes[pos++];
|
||||||
return (b2<<8) | b1;
|
return (b2 << 8) | b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t read_le24()
|
uint32_t read_le24()
|
||||||
@@ -156,7 +194,7 @@ public:
|
|||||||
uint8_t b1 = _bytes[pos++];
|
uint8_t b1 = _bytes[pos++];
|
||||||
uint8_t b2 = _bytes[pos++];
|
uint8_t b2 = _bytes[pos++];
|
||||||
uint8_t b3 = _bytes[pos++];
|
uint8_t b3 = _bytes[pos++];
|
||||||
return (b3<<16) | (b2<<8) | b1;
|
return (b3 << 16) | (b2 << 8) | b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t read_le32()
|
uint32_t read_le32()
|
||||||
@@ -165,7 +203,7 @@ public:
|
|||||||
uint8_t b2 = _bytes[pos++];
|
uint8_t b2 = _bytes[pos++];
|
||||||
uint8_t b3 = _bytes[pos++];
|
uint8_t b3 = _bytes[pos++];
|
||||||
uint8_t b4 = _bytes[pos++];
|
uint8_t b4 = _bytes[pos++];
|
||||||
return (b4<<24) | (b3<<16) | (b2<<8) | b1;
|
return (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -175,9 +213,7 @@ private:
|
|||||||
class ByteWriter
|
class ByteWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ByteWriter(Bytes& bytes):
|
ByteWriter(Bytes& bytes): _bytes(bytes) {}
|
||||||
_bytes(bytes)
|
|
||||||
{}
|
|
||||||
|
|
||||||
ByteWriter(const Bytes&&) = delete;
|
ByteWriter(const Bytes&&) = delete;
|
||||||
|
|
||||||
@@ -205,7 +241,7 @@ public:
|
|||||||
|
|
||||||
ByteWriter& write_be16(uint16_t value)
|
ByteWriter& write_be16(uint16_t value)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos+1);
|
_bytes.adjustBounds(pos + 1);
|
||||||
uint8_t* p = _bytes.begin();
|
uint8_t* p = _bytes.begin();
|
||||||
p[pos++] = value >> 8;
|
p[pos++] = value >> 8;
|
||||||
p[pos++] = value;
|
p[pos++] = value;
|
||||||
@@ -214,7 +250,7 @@ public:
|
|||||||
|
|
||||||
ByteWriter& write_be24(uint32_t value)
|
ByteWriter& write_be24(uint32_t value)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos+2);
|
_bytes.adjustBounds(pos + 2);
|
||||||
uint8_t* p = _bytes.begin();
|
uint8_t* p = _bytes.begin();
|
||||||
p[pos++] = value >> 16;
|
p[pos++] = value >> 16;
|
||||||
p[pos++] = value >> 8;
|
p[pos++] = value >> 8;
|
||||||
@@ -224,7 +260,7 @@ public:
|
|||||||
|
|
||||||
ByteWriter& write_be32(uint32_t value)
|
ByteWriter& write_be32(uint32_t value)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos+3);
|
_bytes.adjustBounds(pos + 3);
|
||||||
uint8_t* p = _bytes.begin();
|
uint8_t* p = _bytes.begin();
|
||||||
p[pos++] = value >> 24;
|
p[pos++] = value >> 24;
|
||||||
p[pos++] = value >> 16;
|
p[pos++] = value >> 16;
|
||||||
@@ -235,7 +271,7 @@ public:
|
|||||||
|
|
||||||
ByteWriter& write_le16(uint16_t value)
|
ByteWriter& write_le16(uint16_t value)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos+1);
|
_bytes.adjustBounds(pos + 1);
|
||||||
uint8_t* p = _bytes.begin();
|
uint8_t* p = _bytes.begin();
|
||||||
p[pos++] = value;
|
p[pos++] = value;
|
||||||
p[pos++] = value >> 8;
|
p[pos++] = value >> 8;
|
||||||
@@ -244,7 +280,7 @@ public:
|
|||||||
|
|
||||||
ByteWriter& write_le24(uint32_t value)
|
ByteWriter& write_le24(uint32_t value)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos+2);
|
_bytes.adjustBounds(pos + 2);
|
||||||
uint8_t* p = _bytes.begin();
|
uint8_t* p = _bytes.begin();
|
||||||
p[pos++] = value;
|
p[pos++] = value;
|
||||||
p[pos++] = value >> 8;
|
p[pos++] = value >> 8;
|
||||||
@@ -254,7 +290,7 @@ public:
|
|||||||
|
|
||||||
ByteWriter& write_le32(uint32_t value)
|
ByteWriter& write_le32(uint32_t value)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos+3);
|
_bytes.adjustBounds(pos + 3);
|
||||||
uint8_t* p = _bytes.begin();
|
uint8_t* p = _bytes.begin();
|
||||||
p[pos++] = value;
|
p[pos++] = value;
|
||||||
p[pos++] = value >> 8;
|
p[pos++] = value >> 8;
|
||||||
@@ -263,7 +299,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteWriter& operator += (std::initializer_list<uint8_t> data)
|
ByteWriter& operator+=(std::initializer_list<uint8_t> data)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos + data.size() - 1);
|
_bytes.adjustBounds(pos + data.size() - 1);
|
||||||
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
|
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
|
||||||
@@ -271,7 +307,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteWriter& operator += (const std::vector<uint8_t>& data)
|
ByteWriter& operator+=(const std::vector<uint8_t>& data)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos + data.size() - 1);
|
_bytes.adjustBounds(pos + data.size() - 1);
|
||||||
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
|
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
|
||||||
@@ -279,7 +315,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteWriter& operator += (const Bytes data)
|
ByteWriter& operator+=(const Bytes data)
|
||||||
{
|
{
|
||||||
_bytes.adjustBounds(pos + data.size() - 1);
|
_bytes.adjustBounds(pos + data.size() - 1);
|
||||||
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
|
std::copy(data.begin(), data.end(), _bytes.begin() + pos);
|
||||||
@@ -287,17 +323,17 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteWriter& operator += (std::istream& stream);
|
ByteWriter& operator+=(std::istream& stream);
|
||||||
|
|
||||||
ByteWriter& append(const char* data)
|
ByteWriter& append(const char* data)
|
||||||
{
|
{
|
||||||
return *this += Bytes((const uint8_t*)data, strlen(data));
|
return *this += Bytes((const uint8_t*)data, strlen(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteWriter& append(const std::string& data)
|
ByteWriter& append(const std::string& data)
|
||||||
{
|
{
|
||||||
return *this += Bytes(data);
|
return *this += Bytes(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteWriter& append(const Bytes data)
|
ByteWriter& append(const Bytes data)
|
||||||
{
|
{
|
||||||
@@ -316,14 +352,15 @@ private:
|
|||||||
class BitWriter
|
class BitWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BitWriter(ByteWriter& bw):
|
BitWriter(ByteWriter& bw): _bw(bw) {}
|
||||||
_bw(bw)
|
|
||||||
{}
|
|
||||||
|
|
||||||
BitWriter(ByteWriter&&) = delete;
|
BitWriter(ByteWriter&&) = delete;
|
||||||
|
|
||||||
void push(uint32_t bits, size_t size);
|
void push(uint32_t bits, size_t size);
|
||||||
void push(bool bit) { push(bit, 1); }
|
void push(bool bit)
|
||||||
|
{
|
||||||
|
push(bit, 1);
|
||||||
|
}
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -335,19 +372,17 @@ private:
|
|||||||
class BitReader
|
class BitReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BitReader(ByteReader& br):
|
BitReader(ByteReader& br): _br(br) {}
|
||||||
_br(br)
|
|
||||||
{}
|
|
||||||
|
|
||||||
BitReader(ByteReader&&) = delete;
|
BitReader(ByteReader&&) = delete;
|
||||||
|
|
||||||
bool get();
|
bool get();
|
||||||
bool eof();
|
bool eof();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _fifo = 0;
|
uint8_t _fifo = 0;
|
||||||
size_t _bitcount = 0;
|
size_t _bitcount = 0;
|
||||||
ByteReader& _br;
|
ByteReader& _br;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline uint8_t reverse_bits(uint8_t b)
|
static inline uint8_t reverse_bits(uint8_t b)
|
||||||
@@ -358,16 +393,16 @@ static inline uint8_t reverse_bits(uint8_t b)
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint8_t toByte(
|
extern uint8_t toByte(std::vector<bool>::const_iterator start,
|
||||||
std::vector<bool>::const_iterator start,
|
|
||||||
std::vector<bool>::const_iterator end);
|
std::vector<bool>::const_iterator end);
|
||||||
|
|
||||||
extern Bytes toBytes(
|
extern Bytes toBytes(std::vector<bool>::const_iterator start,
|
||||||
std::vector<bool>::const_iterator start,
|
|
||||||
std::vector<bool>::const_iterator end);
|
std::vector<bool>::const_iterator end);
|
||||||
|
|
||||||
inline Bytes toBytes(const std::vector<bool>& bits)
|
inline Bytes toBytes(const std::vector<bool>& bits)
|
||||||
{ return toBytes(bits.begin(), bits.end()); }
|
{
|
||||||
|
return toBytes(bits.begin(), bits.end());
|
||||||
|
}
|
||||||
|
|
||||||
extern std::vector<bool> reverseBits(const std::vector<bool>& bits);
|
extern std::vector<bool> reverseBits(const std::vector<bool>& bits);
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ const OptionProto& Config::findOption(const std::string& optionName)
|
|||||||
throw OptionNotFoundException("option name not found");
|
throw OptionNotFoundException("option name not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Config::isOptionValid(const OptionProto& option)
|
void Config::checkOptionValid(const OptionProto& option)
|
||||||
{
|
{
|
||||||
for (const auto& req : option.requires())
|
for (const auto& req : option.requires())
|
||||||
{
|
{
|
||||||
@@ -121,10 +121,40 @@ bool Config::isOptionValid(const OptionProto& option)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!matched)
|
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)
|
void Config::applyOption(const OptionProto& option)
|
||||||
@@ -137,10 +167,7 @@ void Config::applyOption(const OptionProto& option)
|
|||||||
throw InvalidOptionException(fmt::format(
|
throw InvalidOptionException(fmt::format(
|
||||||
"option '{}' has an option group inside it, which isn't allowed",
|
"option '{}' has an option group inside it, which isn't allowed",
|
||||||
option.name()));
|
option.name()));
|
||||||
if (!isOptionValid(option))
|
checkOptionValid(option);
|
||||||
throw InapplicableOptionException(
|
|
||||||
fmt::format("option '{}' is inapplicable to this configuration",
|
|
||||||
option.name()));
|
|
||||||
|
|
||||||
log("OPTION: {}",
|
log("OPTION: {}",
|
||||||
option.has_message() ? option.message() : option.comment());
|
option.has_message() ? option.message() : option.comment());
|
||||||
@@ -148,7 +175,7 @@ void Config::applyOption(const OptionProto& option)
|
|||||||
(*this)->MergeFrom(option.config());
|
(*this)->MergeFrom(option.config());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::setFluxSource(std::string filename)
|
static void setFluxSourceImpl(std::string filename, FluxSourceProto* proto)
|
||||||
{
|
{
|
||||||
static const std::vector<std::pair<std::regex,
|
static const std::vector<std::pair<std::regex,
|
||||||
std::function<void(const std::string&, FluxSourceProto*)>>>
|
std::function<void(const std::string&, FluxSourceProto*)>>>
|
||||||
@@ -212,7 +239,7 @@ void Config::setFluxSource(std::string filename)
|
|||||||
std::smatch match;
|
std::smatch match;
|
||||||
if (std::regex_match(filename, match, it.first))
|
if (std::regex_match(filename, match, it.first))
|
||||||
{
|
{
|
||||||
it.second(match[1], (*this)->mutable_flux_source());
|
it.second(match[1], proto);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,6 +247,11 @@ void Config::setFluxSource(std::string filename)
|
|||||||
error("unrecognised flux filename '{}'", 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 void setFluxSinkImpl(std::string filename, FluxSinkProto* proto)
|
||||||
{
|
{
|
||||||
static const std::vector<std::pair<std::regex,
|
static const std::vector<std::pair<std::regex,
|
||||||
@@ -287,6 +319,11 @@ void Config::setCopyFluxTo(std::string filename)
|
|||||||
filename, (*this)->mutable_decoder()->mutable_copy_flux_to());
|
filename, (*this)->mutable_decoder()->mutable_copy_flux_to());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Config::setVerificationFluxSource(std::string filename)
|
||||||
|
{
|
||||||
|
setFluxSourceImpl(filename, &_verificationFluxSourceProto);
|
||||||
|
}
|
||||||
|
|
||||||
void Config::setImageReader(std::string filename)
|
void Config::setImageReader(std::string filename)
|
||||||
{
|
{
|
||||||
static const std::map<std::string, std::function<void(ImageReaderProto*)>>
|
static const std::map<std::string, std::function<void(ImageReaderProto*)>>
|
||||||
@@ -378,6 +415,24 @@ std::shared_ptr<FluxSource>& Config::getFluxSource()
|
|||||||
return _fluxSource;
|
return _fluxSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Config::hasVerificationFluxSource() const
|
||||||
|
{
|
||||||
|
return _verificationFluxSourceProto.type() != FluxSourceProto::NOT_SET;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<FluxSource>& Config::getVerificationFluxSource()
|
||||||
|
{
|
||||||
|
if (!_verificationFluxSource)
|
||||||
|
{
|
||||||
|
if (!hasVerificationFluxSource())
|
||||||
|
error("no verification flux source configured");
|
||||||
|
|
||||||
|
_verificationFluxSource =
|
||||||
|
std::shared_ptr(FluxSource::create(_verificationFluxSourceProto));
|
||||||
|
}
|
||||||
|
return _verificationFluxSource;
|
||||||
|
}
|
||||||
|
|
||||||
bool Config::hasImageReader() const
|
bool Config::hasImageReader() const
|
||||||
{
|
{
|
||||||
return (*this)->image_reader().type() != ImageReaderProto::NOT_SET;
|
return (*this)->image_reader().type() != ImageReaderProto::NOT_SET;
|
||||||
|
|||||||
73
lib/config.h
73
lib/config.h
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include "lib/fluxsource/fluxsource.pb.h"
|
||||||
|
|
||||||
class ConfigProto;
|
class ConfigProto;
|
||||||
class OptionProto;
|
class OptionProto;
|
||||||
class FluxSource;
|
class FluxSource;
|
||||||
@@ -16,69 +18,82 @@ public:
|
|||||||
class OptionNotFoundException : public OptionException
|
class OptionNotFoundException : public OptionException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OptionNotFoundException(const std::string& message): OptionException(message) {}
|
OptionNotFoundException(const std::string& message):
|
||||||
|
OptionException(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InvalidOptionException : public OptionException
|
class InvalidOptionException : public OptionException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InvalidOptionException(const std::string& message): OptionException(message) {}
|
InvalidOptionException(const std::string& message): OptionException(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InapplicableOptionException : public OptionException
|
class InapplicableOptionException : public OptionException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InapplicableOptionException(const std::string& message): OptionException(message) {}
|
InapplicableOptionException(const std::string& message):
|
||||||
|
OptionException(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConfigProto* operator -> () const;
|
ConfigProto* operator->() const;
|
||||||
operator ConfigProto* () const;
|
operator ConfigProto*() 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);
|
void set(std::string key, std::string value);
|
||||||
std::string get(std::string key);
|
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
|
/* Option management: look up an option by name, determine whether an option
|
||||||
* is valid, and apply an option. */
|
* is valid, and apply an option. */
|
||||||
|
|
||||||
const OptionProto& findOption(const std::string& option);
|
const OptionProto& findOption(const std::string& option);
|
||||||
bool isOptionValid(const OptionProto& option);
|
void checkOptionValid(const OptionProto& option);
|
||||||
|
bool isOptionValid(const OptionProto& option);
|
||||||
void applyOption(const OptionProto& option);
|
void applyOption(const OptionProto& option);
|
||||||
|
|
||||||
/* Adjust overall inputs and outputs. */
|
/* Adjust overall inputs and outputs. */
|
||||||
|
|
||||||
void setFluxSource(std::string value);
|
void setFluxSource(std::string value);
|
||||||
void setFluxSink(std::string value);
|
void setFluxSink(std::string value);
|
||||||
void setCopyFluxTo(std::string value);
|
void setVerificationFluxSource(std::string value);
|
||||||
void setImageReader(std::string value);
|
void setCopyFluxTo(std::string value);
|
||||||
void setImageWriter(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;
|
bool hasFluxSource() const;
|
||||||
std::shared_ptr<FluxSource>& getFluxSource();
|
std::shared_ptr<FluxSource>& getFluxSource();
|
||||||
bool hasImageReader() const;
|
bool hasImageReader() const;
|
||||||
std::shared_ptr<ImageReader>& getImageReader();
|
std::shared_ptr<ImageReader>& getImageReader();
|
||||||
|
bool hasVerificationFluxSource() const;
|
||||||
|
std::shared_ptr<FluxSource>& getVerificationFluxSource();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<FluxSource> _fluxSource;
|
std::shared_ptr<FluxSource> _fluxSource;
|
||||||
std::shared_ptr<ImageReader> _imageReader;
|
std::shared_ptr<ImageReader> _imageReader;
|
||||||
|
std::shared_ptr<FluxSource> _verificationFluxSource;
|
||||||
|
FluxSourceProto _verificationFluxSourceProto;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Config& globalConfig();
|
extern Config& globalConfig();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
15
lib/crc.h
15
lib/crc.h
@@ -1,10 +1,10 @@
|
|||||||
#ifndef CRC_H
|
#ifndef CRC_H
|
||||||
#define CRC_H
|
#define CRC_H
|
||||||
|
|
||||||
#define CCITT_POLY 0x1021
|
#define CCITT_POLY 0x1021
|
||||||
#define MODBUS_POLY 0x8005
|
#define MODBUS_POLY 0x8005
|
||||||
#define MODBUS_POLY_REF 0xa001
|
#define MODBUS_POLY_REF 0xa001
|
||||||
#define BROTHER_POLY 0x000201
|
#define BROTHER_POLY 0x000201
|
||||||
|
|
||||||
struct crcspec
|
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);
|
extern uint32_t crcbrother(const Bytes& bytes);
|
||||||
|
|
||||||
static inline uint16_t crc16(uint16_t poly, 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)
|
static inline uint16_t crc16ref(uint16_t poly, const Bytes& bytes)
|
||||||
{ return crc16ref(poly, 0xffff, bytes); }
|
{
|
||||||
|
return crc16ref(poly, 0xffff, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -6,15 +6,12 @@
|
|||||||
class CsvReader
|
class CsvReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CsvReader(std::istream& istream):
|
CsvReader(std::istream& istream): _istream(istream) {}
|
||||||
_istream(istream)
|
|
||||||
{}
|
|
||||||
|
|
||||||
std::vector<std::string> readLine();
|
std::vector<std::string> readLine();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::istream& _istream;
|
std::istream& _istream;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -71,10 +71,10 @@ public:
|
|||||||
return _fmr->tell();
|
return _fmr->tell();
|
||||||
}
|
}
|
||||||
|
|
||||||
void rewind()
|
void rewind()
|
||||||
{
|
{
|
||||||
_fmr->rewind();
|
_fmr->rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
void seek(const Fluxmap::Position& pos)
|
void seek(const Fluxmap::Position& pos)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,36 +6,36 @@ class FluxmapReader;
|
|||||||
class FluxDecoder
|
class FluxDecoder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FluxDecoder(FluxmapReader* fmr, nanoseconds_t bitcell,
|
FluxDecoder(
|
||||||
const DecoderProto& config);
|
FluxmapReader* fmr, nanoseconds_t bitcell, const DecoderProto& config);
|
||||||
|
|
||||||
bool readBit();
|
bool readBit();
|
||||||
std::vector<bool> readBits(unsigned count);
|
std::vector<bool> readBits(unsigned count);
|
||||||
std::vector<bool> readBits(const Fluxmap::Position& until);
|
std::vector<bool> readBits(const Fluxmap::Position& until);
|
||||||
|
|
||||||
std::vector<bool> readBits()
|
std::vector<bool> readBits()
|
||||||
{
|
{
|
||||||
return readBits(UINT_MAX);
|
return readBits(UINT_MAX);
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
nanoseconds_t nextFlux();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FluxmapReader* _fmr;
|
nanoseconds_t nextFlux();
|
||||||
double _pll_phase;
|
|
||||||
double _pll_adjust;
|
private:
|
||||||
double _flux_scale;
|
FluxmapReader* _fmr;
|
||||||
nanoseconds_t _clock = 0;
|
double _pll_phase;
|
||||||
nanoseconds_t _clock_centre;
|
double _pll_adjust;
|
||||||
nanoseconds_t _clock_min;
|
double _flux_scale;
|
||||||
nanoseconds_t _clock_max;
|
nanoseconds_t _clock = 0;
|
||||||
nanoseconds_t _flux = 0;
|
nanoseconds_t _clock_centre;
|
||||||
unsigned _clocked_zeroes = 0;
|
nanoseconds_t _clock_min;
|
||||||
unsigned _goodbits = 0;
|
nanoseconds_t _clock_max;
|
||||||
bool _index = false;
|
nanoseconds_t _flux = 0;
|
||||||
bool _sync_lost = false;
|
unsigned _clocked_zeroes = 0;
|
||||||
int _leading_zeroes;
|
unsigned _goodbits = 0;
|
||||||
|
bool _index = false;
|
||||||
|
bool _sync_lost = false;
|
||||||
|
int _leading_zeroes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ public:
|
|||||||
bool matches(const unsigned* intervals, FluxMatch& match) const override;
|
bool matches(const unsigned* intervals, FluxMatch& match) const override;
|
||||||
|
|
||||||
unsigned intervals() const override
|
unsigned intervals() const override
|
||||||
{ return _intervals.size(); }
|
{
|
||||||
|
return _intervals.size();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<unsigned> _intervals;
|
std::vector<unsigned> _intervals;
|
||||||
@@ -56,7 +58,9 @@ public:
|
|||||||
bool matches(const unsigned* intervals, FluxMatch& match) const override;
|
bool matches(const unsigned* intervals, FluxMatch& match) const override;
|
||||||
|
|
||||||
unsigned intervals() const override
|
unsigned intervals() const override
|
||||||
{ return _intervals; }
|
{
|
||||||
|
return _intervals;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned _intervals;
|
unsigned _intervals;
|
||||||
@@ -77,10 +81,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool eof() const
|
bool eof() const
|
||||||
{ return _pos.bytes == _size; }
|
{
|
||||||
|
return _pos.bytes == _size;
|
||||||
|
}
|
||||||
|
|
||||||
Fluxmap::Position tell() const
|
Fluxmap::Position tell() const
|
||||||
{ return _pos; }
|
{
|
||||||
|
return _pos;
|
||||||
|
}
|
||||||
|
|
||||||
/* Important! You can only reliably seek to 1 bits. */
|
/* Important! You can only reliably seek to 1 bits. */
|
||||||
void seek(const Fluxmap::Position& pos)
|
void seek(const Fluxmap::Position& pos)
|
||||||
@@ -94,24 +102,25 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void getNextEvent(int& event, unsigned& ticks);
|
void getNextEvent(int& event, unsigned& ticks);
|
||||||
void skipToEvent(int event);
|
void skipToEvent(int event);
|
||||||
bool findEvent(int event, unsigned& ticks);
|
bool findEvent(int event, unsigned& ticks);
|
||||||
unsigned readInterval(nanoseconds_t clock); /* with debounce support */
|
unsigned readInterval(nanoseconds_t clock); /* with debounce support */
|
||||||
|
|
||||||
/* Important! You can only reliably seek to 1 bits. */
|
/* Important! You can only reliably seek to 1 bits. */
|
||||||
void seek(nanoseconds_t ns);
|
void seek(nanoseconds_t ns);
|
||||||
void seekToByte(unsigned byte);
|
void seekToByte(unsigned byte);
|
||||||
|
|
||||||
void seekToIndexMark();
|
void seekToIndexMark();
|
||||||
nanoseconds_t seekToPattern(const FluxMatcher& pattern);
|
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:
|
private:
|
||||||
const Fluxmap& _fluxmap;
|
const Fluxmap& _fluxmap;
|
||||||
const uint8_t* _bytes;
|
const uint8_t* _bytes;
|
||||||
const size_t _size;
|
const size_t _size;
|
||||||
Fluxmap::Position _pos;
|
Fluxmap::Position _pos;
|
||||||
const DecoderProto& _config;
|
const DecoderProto& _config;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,24 +8,35 @@ public:
|
|||||||
std::unique_ptr<std::vector<size_t>> indices):
|
std::unique_ptr<std::vector<size_t>> indices):
|
||||||
_bits(std::move(bits)),
|
_bits(std::move(bits)),
|
||||||
_indices(std::move(indices))
|
_indices(std::move(indices))
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
typedef std::vector<bool>::const_iterator const_iterator;
|
typedef std::vector<bool>::const_iterator const_iterator;
|
||||||
|
|
||||||
const_iterator begin() const
|
const_iterator begin() const
|
||||||
{ return _bits->begin(); }
|
{
|
||||||
|
return _bits->begin();
|
||||||
|
}
|
||||||
|
|
||||||
const_iterator end() const
|
const_iterator end() const
|
||||||
{ return _bits->end(); }
|
{
|
||||||
|
return _bits->end();
|
||||||
|
}
|
||||||
|
|
||||||
size_t size() const
|
size_t size() const
|
||||||
{ return _bits->size(); }
|
{
|
||||||
|
return _bits->size();
|
||||||
|
}
|
||||||
|
|
||||||
const bool operator[] (size_t pos) const
|
const bool operator[](size_t pos) const
|
||||||
{ return _bits->at(pos); }
|
{
|
||||||
|
return _bits->at(pos);
|
||||||
|
}
|
||||||
|
|
||||||
const std::vector<size_t> indices() const
|
const std::vector<size_t> indices() const
|
||||||
{ return *_indices; }
|
{
|
||||||
|
return *_indices;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<std::vector<bool>> _bits;
|
std::unique_ptr<std::vector<bool>> _bits;
|
||||||
|
|||||||
@@ -18,12 +18,15 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual std::shared_ptr<const Sector> getSector(
|
virtual std::shared_ptr<const Sector> getSector(
|
||||||
std::shared_ptr<const TrackInfo>&, const Image& image, unsigned sectorId);
|
std::shared_ptr<const TrackInfo>&,
|
||||||
|
const Image& image,
|
||||||
|
unsigned sectorId);
|
||||||
|
|
||||||
virtual std::vector<std::shared_ptr<const Sector>> collectSectors(
|
virtual std::vector<std::shared_ptr<const Sector>> collectSectors(
|
||||||
std::shared_ptr<const TrackInfo>&, const Image& image);
|
std::shared_ptr<const TrackInfo>&, const Image& image);
|
||||||
|
|
||||||
virtual std::unique_ptr<Fluxmap> encode(std::shared_ptr<const TrackInfo>& trackInfo,
|
virtual std::unique_ptr<Fluxmap> encode(
|
||||||
|
std::shared_ptr<const TrackInfo>& trackInfo,
|
||||||
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
const std::vector<std::shared_ptr<const Sector>>& sectors,
|
||||||
const Image& image) = 0;
|
const Image& image) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -7,4 +7,3 @@ extern FluxFileProto loadFl2File(const std::string filename);
|
|||||||
extern void saveFl2File(const std::string filename, FluxFileProto& proto);
|
extern void saveFl2File(const std::string filename, FluxFileProto& proto);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
23
lib/flags.cc
23
lib/flags.cc
@@ -1,8 +1,10 @@
|
|||||||
#include "globals.h"
|
#include "lib/globals.h"
|
||||||
#include "flags.h"
|
#include "lib/flags.h"
|
||||||
#include "proto.h"
|
#include "lib/proto.h"
|
||||||
#include "utils.h"
|
#include "lib/utils.h"
|
||||||
#include "logger.h"
|
#include "lib/logger.h"
|
||||||
|
#include "lib/fluxsource/fluxsource.h"
|
||||||
|
#include "lib/imagereader/imagereader.h"
|
||||||
#include <google/protobuf/text_format.h>
|
#include <google/protobuf/text_format.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -192,6 +194,17 @@ std::vector<std::string> FlagGroup::parseFlagsWithFilenames(int argc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add any config contributed by the flux and image readers, plus overrides.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (globalConfig().hasFluxSource())
|
||||||
|
globalConfig()->MergeFrom(
|
||||||
|
globalConfig().getFluxSource()->getExtraConfig());
|
||||||
|
if (globalConfig().hasImageReader())
|
||||||
|
globalConfig()->MergeFrom(
|
||||||
|
globalConfig().getImageReader()->getExtraConfig());
|
||||||
|
applyOverrides();
|
||||||
|
|
||||||
/* Then apply any default options in groups, likewise applying the
|
/* Then apply any default options in groups, likewise applying the
|
||||||
* overrides. */
|
* overrides. */
|
||||||
|
|
||||||
|
|||||||
@@ -18,28 +18,43 @@ class FluxSink
|
|||||||
public:
|
public:
|
||||||
virtual ~FluxSink() {}
|
virtual ~FluxSink() {}
|
||||||
|
|
||||||
static std::unique_ptr<FluxSink> createHardwareFluxSink(const HardwareFluxSinkProto& config);
|
static std::unique_ptr<FluxSink> createHardwareFluxSink(
|
||||||
static std::unique_ptr<FluxSink> createAuFluxSink(const AuFluxSinkProto& config);
|
const HardwareFluxSinkProto& config);
|
||||||
static std::unique_ptr<FluxSink> createA2RFluxSink(const A2RFluxSinkProto& config);
|
static std::unique_ptr<FluxSink> createAuFluxSink(
|
||||||
static std::unique_ptr<FluxSink> createVcdFluxSink(const VcdFluxSinkProto& config);
|
const AuFluxSinkProto& config);
|
||||||
static std::unique_ptr<FluxSink> createScpFluxSink(const ScpFluxSinkProto& config);
|
static std::unique_ptr<FluxSink> createA2RFluxSink(
|
||||||
static std::unique_ptr<FluxSink> createFl2FluxSink(const Fl2FluxSinkProto& config);
|
const A2RFluxSinkProto& config);
|
||||||
|
static std::unique_ptr<FluxSink> createVcdFluxSink(
|
||||||
|
const VcdFluxSinkProto& config);
|
||||||
|
static std::unique_ptr<FluxSink> createScpFluxSink(
|
||||||
|
const ScpFluxSinkProto& config);
|
||||||
|
static std::unique_ptr<FluxSink> createFl2FluxSink(
|
||||||
|
const Fl2FluxSinkProto& config);
|
||||||
|
|
||||||
static std::unique_ptr<FluxSink> createFl2FluxSink(const std::string& filename);
|
static std::unique_ptr<FluxSink> createFl2FluxSink(
|
||||||
|
const std::string& filename);
|
||||||
|
|
||||||
static std::unique_ptr<FluxSink> create(const FluxSinkProto& config);
|
static std::unique_ptr<FluxSink> create(const FluxSinkProto& config);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/* Writes a fluxmap to a track and side. */
|
||||||
|
|
||||||
virtual void writeFlux(int track, int side, const Fluxmap& fluxmap) = 0;
|
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;
|
stream << (std::string)flushSink;
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,12 @@ public:
|
|||||||
return usbWrite(side, fluxmap.rawBytes(), _hardSectorThreshold);
|
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());
|
return fmt::format("drive {}", globalConfig()->drive().drive());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#ifndef STREAM_H
|
#ifndef STREAM_H
|
||||||
#define STREAM_H
|
#define STREAM_H
|
||||||
|
|
||||||
extern std::unique_ptr<Fluxmap> readStream(const std::string& dir, unsigned track, unsigned side);
|
extern std::unique_ptr<Fluxmap> readStream(
|
||||||
|
const std::string& dir, unsigned track, unsigned side);
|
||||||
extern std::unique_ptr<Fluxmap> readStream(const std::string& path);
|
extern std::unique_ptr<Fluxmap> readStream(const std::string& path);
|
||||||
extern std::unique_ptr<Fluxmap> readStream(const Bytes& bytes);
|
extern std::unique_ptr<Fluxmap> readStream(const Bytes& bytes);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static inline std::vector<T> vector_of(T item)
|
static inline std::vector<T> vector_of(T item)
|
||||||
{ return std::vector<T> { item }; }
|
{
|
||||||
|
return std::vector<T>{item};
|
||||||
|
}
|
||||||
|
|
||||||
typedef double nanoseconds_t;
|
typedef double nanoseconds_t;
|
||||||
class Bytes;
|
class Bytes;
|
||||||
@@ -35,18 +37,17 @@ extern void hexdumpForSrp16(std::ostream& stream, const Bytes& bytes);
|
|||||||
|
|
||||||
struct ErrorException
|
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 <typename... Args>
|
template <typename... Args>
|
||||||
[[ noreturn ]]
|
[[noreturn]] inline void error(fmt::string_view fstr, const Args&... args)
|
||||||
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);
|
extern void warning(const std::string msg);
|
||||||
@@ -54,11 +55,16 @@ extern void warning(const std::string msg);
|
|||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
inline void warning(fmt::string_view fstr, const Args&... args)
|
inline void warning(fmt::string_view fstr, const Args&... args)
|
||||||
{
|
{
|
||||||
warning(fmt::format(fstr, args...));
|
warning(fmt::format(fstr, args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
template <class... Ts>
|
||||||
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
struct overloaded : Ts...
|
||||||
|
{
|
||||||
|
using Ts::operator()...;
|
||||||
|
};
|
||||||
|
template <class... Ts>
|
||||||
|
overloaded(Ts...) -> overloaded<Ts...>;
|
||||||
|
|
||||||
#include "lib/config.h"
|
#include "lib/config.h"
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,10 @@ public:
|
|||||||
public:
|
public:
|
||||||
/* Returns any extra config the image might want to contribute. */
|
/* Returns any extra config the image might want to contribute. */
|
||||||
|
|
||||||
const ConfigProto& getContributedConfig() const;
|
const ConfigProto& getExtraConfig() const
|
||||||
|
{
|
||||||
|
return _extraConfig;
|
||||||
|
}
|
||||||
|
|
||||||
/* Directly reads the image. */
|
/* Directly reads the image. */
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ class Bytes;
|
|||||||
* http://www.seasip.info/Unix/LibDsk/ldbs.html
|
* http://www.seasip.info/Unix/LibDsk/ldbs.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LDBS_FILE_MAGIC 0x4C425301 /* "LBS\01" */
|
#define LDBS_FILE_MAGIC 0x4C425301 /* "LBS\01" */
|
||||||
#define LDBS_FILE_TYPE 0x44534B02 /* "DSK\02" */
|
#define LDBS_FILE_TYPE 0x44534B02 /* "DSK\02" */
|
||||||
#define LDBS_BLOCK_MAGIC 0x4C444201 /* "LDB\01" */
|
#define LDBS_BLOCK_MAGIC 0x4C444201 /* "LDB\01" */
|
||||||
#define LDBS_TRACK_BLOCK 0x44495201 /* "DIR\01" */
|
#define LDBS_TRACK_BLOCK 0x44495201 /* "DIR\01" */
|
||||||
|
|
||||||
@@ -19,7 +19,9 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
const Bytes& get(uint32_t address) const
|
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);
|
uint32_t put(const Bytes& data, uint32_t type);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,10 @@
|
|||||||
class ProtoPathNotFoundException : public ErrorException
|
class ProtoPathNotFoundException : public ErrorException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProtoPathNotFoundException(const std::string& message): ErrorException(message) {}
|
ProtoPathNotFoundException(const std::string& message):
|
||||||
|
ErrorException(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void setRange(RangeProto* range, const std::string& data);
|
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,
|
extern void setProtoByString(google::protobuf::Message* message,
|
||||||
const std::string& path,
|
const std::string& path,
|
||||||
const std::string& value);
|
const std::string& value);
|
||||||
extern std::string getProtoByString(google::protobuf::Message* message,
|
extern std::string getProtoByString(
|
||||||
const std::string& path);
|
google::protobuf::Message* message, const std::string& path);
|
||||||
|
|
||||||
extern std::set<unsigned> iterate(const RangeProto& range);
|
extern std::set<unsigned> iterate(const RangeProto& range);
|
||||||
extern std::set<unsigned> iterate(unsigned start, unsigned count);
|
extern std::set<unsigned> iterate(unsigned start, unsigned count);
|
||||||
|
|||||||
16
lib/scp.h
16
lib/scp.h
@@ -19,18 +19,18 @@ struct ScpHeader
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SCP_FLAG_INDEXED = (1<<0),
|
SCP_FLAG_INDEXED = (1 << 0),
|
||||||
SCP_FLAG_96TPI = (1<<1),
|
SCP_FLAG_96TPI = (1 << 1),
|
||||||
SCP_FLAG_360RPM = (1<<2),
|
SCP_FLAG_360RPM = (1 << 2),
|
||||||
SCP_FLAG_NORMALIZED = (1<<3),
|
SCP_FLAG_NORMALIZED = (1 << 3),
|
||||||
SCP_FLAG_READWRITE = (1<<4),
|
SCP_FLAG_READWRITE = (1 << 4),
|
||||||
SCP_FLAG_FOOTER = (1<<5)
|
SCP_FLAG_FOOTER = (1 << 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScpTrackHeader
|
struct ScpTrackHeader
|
||||||
{
|
{
|
||||||
char track_id[3]; // 'TRK'
|
char track_id[3]; // 'TRK'
|
||||||
uint8_t strack; // SCP track number
|
uint8_t strack; // SCP track number
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScpTrackRevolution
|
struct ScpTrackRevolution
|
||||||
|
|||||||
14
lib/sector.h
14
lib/sector.h
@@ -9,14 +9,13 @@ class TrackInfo;
|
|||||||
|
|
||||||
struct LogicalLocation
|
struct LogicalLocation
|
||||||
{
|
{
|
||||||
unsigned logicalTrack;
|
unsigned logicalTrack;
|
||||||
unsigned logicalSide;
|
unsigned logicalSide;
|
||||||
unsigned logicalSector;
|
unsigned logicalSector;
|
||||||
|
|
||||||
std::tuple<int, int, int> key() const
|
std::tuple<int, int, int> key() const
|
||||||
{
|
{
|
||||||
return std::make_tuple(
|
return std::make_tuple(logicalTrack, logicalSide, logicalSector);
|
||||||
logicalTrack, logicalSide, logicalSector);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const LogicalLocation& rhs) const
|
bool operator==(const LogicalLocation& rhs) const
|
||||||
@@ -65,7 +64,7 @@ struct Sector : public LogicalLocation
|
|||||||
|
|
||||||
Sector() {}
|
Sector() {}
|
||||||
|
|
||||||
Sector(std::shared_ptr<const TrackInfo>& layout, unsigned sectorId=0);
|
Sector(std::shared_ptr<const TrackInfo>& layout, unsigned sectorId = 0);
|
||||||
|
|
||||||
Sector(const LogicalLocation& location);
|
Sector(const LogicalLocation& location);
|
||||||
|
|
||||||
@@ -91,8 +90,7 @@ struct Sector : public LogicalLocation
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool sectorPointerSortPredicate(
|
extern bool sectorPointerSortPredicate(const std::shared_ptr<const Sector>& lhs,
|
||||||
const std::shared_ptr<const Sector>& lhs,
|
|
||||||
const std::shared_ptr<const Sector>& rhs);
|
const std::shared_ptr<const Sector>& rhs);
|
||||||
extern bool sectorPointerEqualsPredicate(
|
extern bool sectorPointerEqualsPredicate(
|
||||||
const std::shared_ptr<const Sector>& lhs,
|
const std::shared_ptr<const Sector>& lhs,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#define GREASEWEAZLE_VID 0x1209
|
#define GREASEWEAZLE_VID 0x1209
|
||||||
#define GREASEWEAZLE_PID 0x4d69
|
#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_OUT 0x02
|
||||||
#define EP_IN 0x83
|
#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 greaseWeazleToFluxEngine(const Bytes& gwdata, nanoseconds_t clock);
|
||||||
extern Bytes stripPartialRotation(const Bytes& fldata);
|
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
|
* WANING: these headers were originally defined with 'packed', which is a
|
||||||
* been dummied out. Don't use them expecting wire protocol structures. */
|
* gccism so it's been dummied out. Don't use them expecting wire protocol
|
||||||
|
* structures. */
|
||||||
|
|
||||||
#define packed /* */
|
#define packed /* */
|
||||||
|
|
||||||
@@ -25,90 +27,87 @@ extern Bytes stripPartialRotation(const Bytes& fldata);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* CMD_GET_INFO, length=3, idx. Returns 32 bytes after ACK. */
|
/* CMD_GET_INFO, length=3, idx. Returns 32 bytes after ACK. */
|
||||||
#define CMD_GET_INFO 0
|
#define CMD_GET_INFO 0
|
||||||
/* [BOOTLOADER] CMD_UPDATE, length=6, <update_len>.
|
/* [BOOTLOADER] CMD_UPDATE, length=6, <update_len>.
|
||||||
* Host follows with <update_len> bytes.
|
* Host follows with <update_len> bytes.
|
||||||
* Bootloader finally returns a status byte, 0 on success. */
|
* Bootloader finally returns a status byte, 0 on success. */
|
||||||
/* [MAIN FIRMWARE] CMD_UPDATE, length=10, <update_len>, 0xdeafbee3.
|
/* [MAIN FIRMWARE] CMD_UPDATE, length=10, <update_len>, 0xdeafbee3.
|
||||||
* Host follows with <update_len> bytes.
|
* Host follows with <update_len> bytes.
|
||||||
* Main firmware finally returns a status byte, 0 on success. */
|
* 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. */
|
/* 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) */
|
/* CMD_HEAD, length=3, head# (0=bottom) */
|
||||||
#define CMD_HEAD 3
|
#define CMD_HEAD 3
|
||||||
/* CMD_SET_PARAMS, length=3+nr, idx, <nr bytes> */
|
/* CMD_SET_PARAMS, length=3+nr, idx, <nr bytes> */
|
||||||
#define CMD_SET_PARAMS 4
|
#define CMD_SET_PARAMS 4
|
||||||
/* CMD_GET_PARAMS, length=4, idx, nr_bytes. Returns nr_bytes after ACK. */
|
/* 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. */
|
/* 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.
|
/* CMD_READ_FLUX, length=2-8. Argument is gw_read_flux.
|
||||||
* Returns flux readings until EOStream. */
|
* 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.
|
/* CMD_WRITE_FLUX, length=2-4. Argument is gw_write_flux.
|
||||||
* Host follows with flux readings until EOStream. */
|
* 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. */
|
/* CMD_GET_FLUX_STATUS, length=2. Last read/write status returned in ACK. */
|
||||||
#define CMD_GET_FLUX_STATUS 9
|
#define CMD_GET_FLUX_STATUS 9
|
||||||
/* CMD_SWITCH_FW_MODE, length=3, <mode> */
|
/* CMD_SWITCH_FW_MODE, length=3, <mode> */
|
||||||
#define CMD_SWITCH_FW_MODE 11
|
#define CMD_SWITCH_FW_MODE 11
|
||||||
/* CMD_SELECT, length=3, drive#. Select drive# as current unit. */
|
/* 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). */
|
/* 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. */
|
/* 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. */
|
/* 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. */
|
/* 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. */
|
/* 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. */
|
/* 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. */
|
/* CMD_SINK_BYTES, length=6. Argument is gw_sink_source_bytes. */
|
||||||
#define CMD_SINK_BYTES 19
|
#define CMD_SINK_BYTES 19
|
||||||
#define CMD_MAX 19
|
#define CMD_MAX 19
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CMD_SET_BUS CODES
|
* CMD_SET_BUS CODES
|
||||||
*/
|
*/
|
||||||
#define BUS_NONE 0
|
#define BUS_NONE 0
|
||||||
#define BUS_IBMPC 1
|
#define BUS_IBMPC 1
|
||||||
#define BUS_SHUGART 2
|
#define BUS_SHUGART 2
|
||||||
#define BUS_APPLE2 3
|
#define BUS_APPLE2 3
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ACK RETURN CODES
|
* ACK RETURN CODES
|
||||||
*/
|
*/
|
||||||
#define ACK_OKAY 0
|
#define ACK_OKAY 0
|
||||||
#define ACK_BAD_COMMAND 1
|
#define ACK_BAD_COMMAND 1
|
||||||
#define ACK_NO_INDEX 2
|
#define ACK_NO_INDEX 2
|
||||||
#define ACK_NO_TRK0 3
|
#define ACK_NO_TRK0 3
|
||||||
#define ACK_FLUX_OVERFLOW 4
|
#define ACK_FLUX_OVERFLOW 4
|
||||||
#define ACK_FLUX_UNDERFLOW 5
|
#define ACK_FLUX_UNDERFLOW 5
|
||||||
#define ACK_WRPROT 6
|
#define ACK_WRPROT 6
|
||||||
#define ACK_NO_UNIT 7
|
#define ACK_NO_UNIT 7
|
||||||
#define ACK_NO_BUS 8
|
#define ACK_NO_BUS 8
|
||||||
#define ACK_BAD_UNIT 9
|
#define ACK_BAD_UNIT 9
|
||||||
#define ACK_BAD_PIN 10
|
#define ACK_BAD_PIN 10
|
||||||
#define ACK_BAD_CYLINDER 11
|
#define ACK_BAD_CYLINDER 11
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CONTROL-CHANNEL COMMAND SET:
|
* CONTROL-CHANNEL COMMAND SET:
|
||||||
* We abuse SET_LINE_CODING requests over endpoint 0, stashing a command
|
* We abuse SET_LINE_CODING requests over endpoint 0, stashing a command
|
||||||
* in the baud-rate field.
|
* in the baud-rate field.
|
||||||
*/
|
*/
|
||||||
#define BAUD_NORMAL 9600
|
#define BAUD_NORMAL 9600
|
||||||
#define BAUD_CLEAR_COMMS 10000
|
#define BAUD_CLEAR_COMMS 10000
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flux stream opcodes. Preceded by 0xFF byte.
|
* Flux stream opcodes. Preceded by 0xFF byte.
|
||||||
*
|
*
|
||||||
* Argument types:
|
* Argument types:
|
||||||
* N28: 28-bit non-negative integer N, encoded as 4 bytes b0,b1,b2,b3:
|
* N28: 28-bit non-negative integer N, encoded as 4 bytes b0,b1,b2,b3:
|
||||||
* b0 = (uint8_t)(1 | (N << 1))
|
* b0 = (uint8_t)(1 | (N << 1))
|
||||||
@@ -120,19 +119,18 @@ extern Bytes stripPartialRotation(const Bytes& fldata);
|
|||||||
* Args:
|
* Args:
|
||||||
* +4 [N28]: ticks to index, relative to sample cursor.
|
* +4 [N28]: ticks to index, relative to sample cursor.
|
||||||
* Signals an index pulse in the read stream. Sample cursor is unaffected. */
|
* 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]
|
/* FLUXOP_SPACE [CMD_READ_FLUX, CMD_WRITE_FLUX]
|
||||||
* Args:
|
* Args:
|
||||||
* +4 [N28]: ticks to increment the sample cursor.
|
* +4 [N28]: ticks to increment the sample cursor.
|
||||||
* Increments the sample cursor with no intervening flux transitions. */
|
* Increments the sample cursor with no intervening flux transitions. */
|
||||||
#define FLUXOP_SPACE 2
|
#define FLUXOP_SPACE 2
|
||||||
/* FLUXOP_ASTABLE [CMD_WRITE_FLUX]
|
/* FLUXOP_ASTABLE [CMD_WRITE_FLUX]
|
||||||
* Args:
|
* Args:
|
||||||
* +4 [N28]: astable period.
|
* +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). */
|
* Duration is specified by immediately preceding FLUXOP_SPACE opcode(s). */
|
||||||
#define FLUXOP_ASTABLE 3
|
#define FLUXOP_ASTABLE 3
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* COMMAND PACKETS
|
* COMMAND PACKETS
|
||||||
@@ -140,7 +138,8 @@ extern Bytes stripPartialRotation(const Bytes& fldata);
|
|||||||
|
|
||||||
/* CMD_GET_INFO, index 0 */
|
/* CMD_GET_INFO, index 0 */
|
||||||
#define GETINFO_FIRMWARE 0
|
#define GETINFO_FIRMWARE 0
|
||||||
struct packed gw_info {
|
struct packed gw_info
|
||||||
|
{
|
||||||
uint8_t fw_major;
|
uint8_t fw_major;
|
||||||
uint8_t fw_minor;
|
uint8_t fw_minor;
|
||||||
uint8_t is_main_firmware; /* == 0 -> update bootloader */
|
uint8_t is_main_firmware; /* == 0 -> update bootloader */
|
||||||
@@ -153,15 +152,18 @@ extern struct gw_info gw_info;
|
|||||||
|
|
||||||
/* CMD_GET_INFO, index 1 */
|
/* CMD_GET_INFO, index 1 */
|
||||||
#define GETINFO_BW_STATS 1
|
#define GETINFO_BW_STATS 1
|
||||||
struct packed gw_bw_stats {
|
struct packed gw_bw_stats
|
||||||
struct packed {
|
{
|
||||||
|
struct packed
|
||||||
|
{
|
||||||
uint32_t bytes;
|
uint32_t bytes;
|
||||||
uint32_t usecs;
|
uint32_t usecs;
|
||||||
} min_bw, max_bw;
|
} min_bw, max_bw;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* CMD_READ_FLUX */
|
/* CMD_READ_FLUX */
|
||||||
struct packed gw_read_flux {
|
struct packed gw_read_flux
|
||||||
|
{
|
||||||
/* Maximum ticks to read for (or 0, for no limit). */
|
/* Maximum ticks to read for (or 0, for no limit). */
|
||||||
uint32_t ticks;
|
uint32_t ticks;
|
||||||
/* Maximum index pulses to read (or 0, for no limit). */
|
/* Maximum index pulses to read (or 0, for no limit). */
|
||||||
@@ -169,7 +171,8 @@ struct packed gw_read_flux {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* CMD_WRITE_FLUX */
|
/* CMD_WRITE_FLUX */
|
||||||
struct packed gw_write_flux {
|
struct packed gw_write_flux
|
||||||
|
{
|
||||||
/* If non-zero, start the write at the index pulse. */
|
/* If non-zero, start the write at the index pulse. */
|
||||||
uint8_t cue_at_index;
|
uint8_t cue_at_index;
|
||||||
/* If non-zero, terminate the write at the next index pulse. */
|
/* If non-zero, terminate the write at the next index pulse. */
|
||||||
@@ -177,18 +180,21 @@ struct packed gw_write_flux {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* CMD_ERASE_FLUX */
|
/* CMD_ERASE_FLUX */
|
||||||
struct packed gw_erase_flux {
|
struct packed gw_erase_flux
|
||||||
|
{
|
||||||
uint32_t ticks;
|
uint32_t ticks;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* CMD_SINK_SOURCE_BYTES */
|
/* CMD_SINK_SOURCE_BYTES */
|
||||||
struct packed gw_sink_source_bytes {
|
struct packed gw_sink_source_bytes
|
||||||
|
{
|
||||||
uint32_t nr_bytes;
|
uint32_t nr_bytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* CMD_{GET,SET}_PARAMS, index 0 */
|
/* CMD_{GET,SET}_PARAMS, index 0 */
|
||||||
#define PARAMS_DELAYS 0
|
#define PARAMS_DELAYS 0
|
||||||
struct packed gw_delay {
|
struct packed gw_delay
|
||||||
|
{
|
||||||
uint16_t select_delay; /* usec */
|
uint16_t select_delay; /* usec */
|
||||||
uint16_t step_delay; /* usec */
|
uint16_t step_delay; /* usec */
|
||||||
uint16_t seek_settle; /* msec */
|
uint16_t seek_settle; /* msec */
|
||||||
@@ -198,7 +204,6 @@ struct packed gw_delay {
|
|||||||
|
|
||||||
/* CMD_SWITCH_FW_MODE */
|
/* CMD_SWITCH_FW_MODE */
|
||||||
#define FW_MODE_BOOTLOADER 0
|
#define FW_MODE_BOOTLOADER 0
|
||||||
#define FW_MODE_NORMAL 1
|
#define FW_MODE_NORMAL 1
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -4,18 +4,18 @@
|
|||||||
class SerialPort
|
class SerialPort
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<SerialPort> openSerialPort(const std::string& path);
|
static std::unique_ptr<SerialPort> openSerialPort(const std::string& path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~SerialPort();
|
virtual ~SerialPort();
|
||||||
virtual ssize_t readImpl(uint8_t* buffer, size_t len) = 0;
|
virtual ssize_t readImpl(uint8_t* buffer, size_t len) = 0;
|
||||||
virtual ssize_t write(const 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(uint8_t* buffer, size_t len);
|
||||||
void read(Bytes& bytes);
|
void read(Bytes& bytes);
|
||||||
Bytes readBytes(size_t count);
|
Bytes readBytes(size_t count);
|
||||||
uint8_t readByte();
|
uint8_t readByte();
|
||||||
void write(const Bytes& bytes);
|
void write(const Bytes& bytes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _readbuffer[4096];
|
uint8_t _readbuffer[4096];
|
||||||
@@ -24,4 +24,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -6,60 +6,95 @@
|
|||||||
|
|
||||||
class Fluxmap;
|
class Fluxmap;
|
||||||
class GreaseWeazleProto;
|
class GreaseWeazleProto;
|
||||||
namespace libusbp { class device; }
|
namespace libusbp
|
||||||
|
{
|
||||||
|
class device;
|
||||||
|
}
|
||||||
|
|
||||||
class USB
|
class USB
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~USB();
|
virtual ~USB();
|
||||||
|
|
||||||
virtual int getVersion() = 0;
|
virtual int getVersion() = 0;
|
||||||
virtual void recalibrate() = 0;
|
virtual void recalibrate() = 0;
|
||||||
virtual void seek(int track) = 0;
|
virtual void seek(int track) = 0;
|
||||||
virtual nanoseconds_t getRotationalPeriod(int hardSectorCount) = 0;
|
virtual nanoseconds_t getRotationalPeriod(int hardSectorCount) = 0;
|
||||||
virtual void testBulkWrite() = 0;
|
virtual void testBulkWrite() = 0;
|
||||||
virtual void testBulkRead() = 0;
|
virtual void testBulkRead() = 0;
|
||||||
virtual Bytes read(int side, bool synced, nanoseconds_t readTime,
|
virtual Bytes read(int side,
|
||||||
nanoseconds_t hardSectorThreshold) = 0;
|
bool synced,
|
||||||
virtual void write(int side, const Bytes& bytes,
|
nanoseconds_t readTime,
|
||||||
nanoseconds_t hardSectorThreshold) = 0;
|
nanoseconds_t hardSectorThreshold) = 0;
|
||||||
virtual void erase(int side, nanoseconds_t hardSectorThreshold) = 0;
|
virtual void write(
|
||||||
virtual void setDrive(int drive, bool high_density, int index_mode) = 0;
|
int side, const Bytes& bytes, nanoseconds_t hardSectorThreshold) = 0;
|
||||||
virtual void measureVoltages(struct voltages_frame* voltages) = 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:
|
protected:
|
||||||
std::string usberror(int i);
|
std::string usberror(int i);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern USB& getUsb();
|
extern USB& getUsb();
|
||||||
|
|
||||||
extern USB* createFluxengineUsb(libusbp::device& device);
|
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 int usbGetVersion()
|
||||||
static inline void usbRecalibrate() { getUsb().recalibrate(); }
|
{
|
||||||
static inline void usbSeek(int track) { getUsb().seek(track); }
|
return getUsb().getVersion();
|
||||||
static inline void usbTestBulkWrite() { getUsb().testBulkWrite(); }
|
}
|
||||||
static inline void usbTestBulkRead() { getUsb().testBulkRead(); }
|
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)
|
static inline void usbErase(int side, nanoseconds_t hardSectorThreshold)
|
||||||
{ getUsb().erase(side, hardSectorThreshold); }
|
{
|
||||||
|
getUsb().erase(side, hardSectorThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
static inline nanoseconds_t usbGetRotationalPeriod(int hardSectorCount)
|
static inline nanoseconds_t usbGetRotationalPeriod(int hardSectorCount)
|
||||||
{ return getUsb().getRotationalPeriod(hardSectorCount); }
|
{
|
||||||
|
return getUsb().getRotationalPeriod(hardSectorCount);
|
||||||
|
}
|
||||||
|
|
||||||
static inline Bytes usbRead(int side, bool synced, nanoseconds_t readTime,
|
static inline Bytes usbRead(int side,
|
||||||
nanoseconds_t hardSectorThreshold)
|
bool synced,
|
||||||
{ return getUsb().read(side, synced, readTime, hardSectorThreshold); }
|
nanoseconds_t readTime,
|
||||||
|
nanoseconds_t hardSectorThreshold)
|
||||||
|
{
|
||||||
|
return getUsb().read(side, synced, readTime, hardSectorThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void usbWrite(int side, const Bytes& bytes,
|
static inline void usbWrite(
|
||||||
nanoseconds_t hardSectorThreshold)
|
int side, const Bytes& bytes, nanoseconds_t hardSectorThreshold)
|
||||||
{ getUsb().write(side, bytes, hardSectorThreshold); }
|
{
|
||||||
|
getUsb().write(side, bytes, hardSectorThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void usbSetDrive(int drive, bool high_density, int index_mode)
|
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)
|
static inline void usbMeasureVoltages(struct voltages_frame* voltages)
|
||||||
{ getUsb().measureVoltages(voltages); }
|
{
|
||||||
|
getUsb().measureVoltages(voltages);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,22 +6,21 @@
|
|||||||
|
|
||||||
enum DeviceType
|
enum DeviceType
|
||||||
{
|
{
|
||||||
DEVICE_FLUXENGINE,
|
DEVICE_FLUXENGINE,
|
||||||
DEVICE_GREASEWEAZLE
|
DEVICE_GREASEWEAZLE
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::string getDeviceName(DeviceType type);
|
extern std::string getDeviceName(DeviceType type);
|
||||||
|
|
||||||
struct CandidateDevice
|
struct CandidateDevice
|
||||||
{
|
{
|
||||||
DeviceType type;
|
DeviceType type;
|
||||||
libusbp::device device;
|
libusbp::device device;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
std::string serial;
|
std::string serial;
|
||||||
std::string serialPort;
|
std::string serialPort;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<std::shared_ptr<CandidateDevice>> findUsbDevices();
|
extern std::vector<std::shared_ptr<CandidateDevice>> findUsbDevices();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ static StringFlag destFlux({"--dest", "-d"},
|
|||||||
[](const auto& value)
|
[](const auto& value)
|
||||||
{
|
{
|
||||||
globalConfig().setFluxSink(value);
|
globalConfig().setFluxSink(value);
|
||||||
globalConfig().setFluxSource(value);
|
globalConfig().setVerificationFluxSource(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
static StringFlag destTracks({"--cylinders", "-c"},
|
static StringFlag destTracks({"--cylinders", "-c"},
|
||||||
@@ -62,9 +62,9 @@ int mainWrite(int argc, const char* argv[])
|
|||||||
{
|
{
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
showProfiles("write", formats);
|
showProfiles("write", formats);
|
||||||
globalConfig()->mutable_flux_sink()->set_type(FluxSinkProto::DRIVE);
|
globalConfig().setFluxSink("drive:0");
|
||||||
if (verify)
|
globalConfig().setVerificationFluxSource("drive:0");
|
||||||
globalConfig()->mutable_flux_source()->set_type(FluxSourceProto::DRIVE);
|
|
||||||
flags.parseFlagsWithConfigFiles(argc, argv, formats);
|
flags.parseFlagsWithConfigFiles(argc, argv, formats);
|
||||||
|
|
||||||
auto& reader = globalConfig().getImageReader();
|
auto& reader = globalConfig().getImageReader();
|
||||||
@@ -76,16 +76,18 @@ int mainWrite(int argc, const char* argv[])
|
|||||||
FluxSink::create(globalConfig()->flux_sink()));
|
FluxSink::create(globalConfig()->flux_sink()));
|
||||||
|
|
||||||
std::unique_ptr<Decoder> decoder;
|
std::unique_ptr<Decoder> decoder;
|
||||||
if (globalConfig()->has_decoder() && verify)
|
std::shared_ptr<FluxSource> verificationFluxSource;
|
||||||
|
if (globalConfig()->has_decoder() && fluxSink->isHardware() && verify)
|
||||||
|
{
|
||||||
decoder = Decoder::create(globalConfig()->decoder());
|
decoder = Decoder::create(globalConfig()->decoder());
|
||||||
|
verificationFluxSource = globalConfig().getVerificationFluxSource();
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<FluxSource> fluxSource;
|
writeDiskCommand(*image,
|
||||||
if (verify &&
|
*encoder,
|
||||||
(globalConfig()->flux_source().type() == FluxSourceProto::DRIVE))
|
*fluxSink,
|
||||||
fluxSource = globalConfig().getFluxSource();
|
decoder.get(),
|
||||||
|
verificationFluxSource.get());
|
||||||
writeDiskCommand(
|
|
||||||
*image, *encoder, *fluxSink, decoder.get(), fluxSource.get());
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,3 @@
|
|||||||
extern FlagGroup fileFlags;
|
extern FlagGroup fileFlags;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ private:
|
|||||||
nanoseconds_t _scrollPosition = 0;
|
nanoseconds_t _scrollPosition = 0;
|
||||||
nanoseconds_t _totalDuration = 0;
|
nanoseconds_t _totalDuration = 0;
|
||||||
double _nanosecondsPerPixel = 0;
|
double _nanosecondsPerPixel = 0;
|
||||||
std::set<nanoseconds_t> _events;
|
std::set<nanoseconds_t> _events;
|
||||||
std::vector<float> _densityMap;
|
std::vector<float> _densityMap;
|
||||||
int _dragStartX = -1;
|
int _dragStartX = -1;
|
||||||
nanoseconds_t _dragStartPosition = -1;
|
nanoseconds_t _dragStartPosition = -1;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
virtual void StartFormatting() = 0;
|
virtual void StartFormatting() = 0;
|
||||||
virtual void StartExploring() = 0;
|
virtual void StartExploring() = 0;
|
||||||
|
|
||||||
virtual void SafeFit() = 0;
|
virtual void SafeFit() = 0;
|
||||||
virtual void SetPage(int page) = 0;
|
virtual void SetPage(int page) = 0;
|
||||||
virtual void PrepareConfig() = 0;
|
virtual void PrepareConfig() = 0;
|
||||||
virtual void ClearLog() = 0;
|
virtual void ClearLog() = 0;
|
||||||
@@ -112,17 +112,17 @@ public:
|
|||||||
_mainWindow->ClearLog();
|
_mainWindow->ClearLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SafeFit()
|
void SafeFit()
|
||||||
{
|
{
|
||||||
_mainWindow->SafeFit();
|
_mainWindow->SafeFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartIdle()
|
void StartIdle()
|
||||||
{
|
{
|
||||||
_mainWindow->StartIdle();
|
_mainWindow->StartIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartReading()
|
void StartReading()
|
||||||
{
|
{
|
||||||
_mainWindow->StartReading();
|
_mainWindow->StartReading();
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ public:
|
|||||||
virtual void Start() = 0;
|
virtual void Start() = 0;
|
||||||
|
|
||||||
virtual void PrepareConfig() = 0;
|
virtual void PrepareConfig() = 0;
|
||||||
virtual const wxBitmap GetBitmap() = 0;
|
virtual const wxBitmap GetBitmap() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ImagerPanel : public PanelComponent
|
class ImagerPanel : public PanelComponent
|
||||||
|
|||||||
@@ -14,21 +14,25 @@ public:
|
|||||||
virtual ~HistogramViewer() {}
|
virtual ~HistogramViewer() {}
|
||||||
|
|
||||||
public:
|
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)
|
void Redraw(const Fluxmap* fluxmap, nanoseconds_t clock = 0)
|
||||||
{ Redraw(*fluxmap, clock); }
|
{
|
||||||
|
Redraw(*fluxmap, clock);
|
||||||
|
}
|
||||||
|
|
||||||
nanoseconds_t GetMedian() const { return _data.median; }
|
nanoseconds_t GetMedian() const
|
||||||
|
{
|
||||||
|
return _data.median;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnPaint(wxPaintEvent&);
|
void OnPaint(wxPaintEvent&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _blank = true;
|
bool _blank = true;
|
||||||
Fluxmap::ClockData _data;
|
Fluxmap::ClockData _data;
|
||||||
wxFont _font;
|
wxFont _font;
|
||||||
nanoseconds_t _clock;
|
nanoseconds_t _clock;
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1063
src/gui/icon.png.h
1063
src/gui/icon.png.h
File diff suppressed because it is too large
Load Diff
@@ -245,6 +245,7 @@ public:
|
|||||||
std::string filename = _selectedDrive ? "drive:1" : "drive:0";
|
std::string filename = _selectedDrive ? "drive:1" : "drive:0";
|
||||||
globalConfig().setFluxSink(filename);
|
globalConfig().setFluxSink(filename);
|
||||||
globalConfig().setFluxSource(filename);
|
globalConfig().setFluxSource(filename);
|
||||||
|
globalConfig().setVerificationFluxSource(filename);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,18 +152,19 @@ public:
|
|||||||
FluxSink::create(globalConfig()->flux_sink());
|
FluxSink::create(globalConfig()->flux_sink());
|
||||||
|
|
||||||
std::unique_ptr<Decoder> decoder;
|
std::unique_ptr<Decoder> decoder;
|
||||||
std::shared_ptr<FluxSource> fluxSource;
|
std::shared_ptr<FluxSource> verificationFluxSource;
|
||||||
if (globalConfig()->has_decoder())
|
if (globalConfig()->has_decoder() && fluxSink->isHardware())
|
||||||
{
|
{
|
||||||
decoder = Decoder::create(globalConfig()->decoder());
|
decoder = Decoder::create(globalConfig()->decoder());
|
||||||
fluxSource = globalConfig().getFluxSource();
|
verificationFluxSource =
|
||||||
|
globalConfig().getVerificationFluxSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
writeDiskCommand(*image,
|
writeDiskCommand(*image,
|
||||||
*encoder,
|
*encoder,
|
||||||
*fluxSink,
|
*fluxSink,
|
||||||
decoder.get(),
|
decoder.get(),
|
||||||
fluxSource.get());
|
verificationFluxSource.get());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (const ErrorException& e)
|
catch (const ErrorException& e)
|
||||||
|
|||||||
844
src/gui/layout.h
844
src/gui/layout.h
@@ -51,28 +51,45 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class MainWindowGen : public wxFrame
|
class MainWindowGen : public wxFrame
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxMenuBar* menuBar;
|
||||||
|
wxMenu* m_menu1;
|
||||||
|
wxMenu* m_menu2;
|
||||||
|
wxSimplebook* dataNotebook;
|
||||||
|
|
||||||
protected:
|
// Virtual event handlers, override them in your derived class
|
||||||
wxMenuBar* menuBar;
|
virtual void OnClose(wxCloseEvent& event)
|
||||||
wxMenu* m_menu1;
|
{
|
||||||
wxMenu* m_menu2;
|
event.Skip();
|
||||||
wxSimplebook* dataNotebook;
|
}
|
||||||
|
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
|
public:
|
||||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
MainWindowGen(wxWindow* parent,
|
||||||
virtual void OnAboutMenuItem( wxCommandEvent& event ) { event.Skip(); }
|
wxWindowID id = wxID_ANY,
|
||||||
virtual void OnExit( wxCommandEvent& event ) { event.Skip(); }
|
const wxString& title = wxT("FluxEngine"),
|
||||||
virtual void OnShowLogWindow( wxCommandEvent& event ) { event.Skip(); }
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
virtual void OnShowConfigWindow( wxCommandEvent& event ) { event.Skip(); }
|
const wxSize& size = wxSize(616, 607),
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE | wxRESIZE_BORDER |
|
||||||
|
wxFULL_REPAINT_ON_RESIZE | wxTAB_TRAVERSAL);
|
||||||
public:
|
|
||||||
|
|
||||||
MainWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("FluxEngine"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 616,607 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL );
|
|
||||||
|
|
||||||
~MainWindowGen();
|
|
||||||
|
|
||||||
|
~MainWindowGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -80,24 +97,32 @@ class MainWindowGen : public wxFrame
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class TextViewerWindowGen : public wxDialog
|
class TextViewerWindowGen : public wxDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxTextCtrl* textControl;
|
||||||
|
wxStdDialogButtonSizer* m_sdbSizer2;
|
||||||
|
wxButton* m_sdbSizer2OK;
|
||||||
|
|
||||||
protected:
|
// Virtual event handlers, override them in your derived class
|
||||||
wxTextCtrl* textControl;
|
virtual void OnClose(wxCloseEvent& event)
|
||||||
wxStdDialogButtonSizer* m_sdbSizer2;
|
{
|
||||||
wxButton* m_sdbSizer2OK;
|
event.Skip();
|
||||||
|
}
|
||||||
|
virtual void OnClose(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
// Virtual event handlers, override them in your derived class
|
public:
|
||||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
TextViewerWindowGen(wxWindow* parent,
|
||||||
virtual void OnClose( wxCommandEvent& event ) { event.Skip(); }
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxString& title = wxEmptyString,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
public:
|
const wxSize& size = wxSize(208, 143),
|
||||||
|
long style = wxCLOSE_BOX | wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX |
|
||||||
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 );
|
wxMINIMIZE_BOX | wxRESIZE_BORDER);
|
||||||
|
|
||||||
~TextViewerWindowGen();
|
|
||||||
|
|
||||||
|
~TextViewerWindowGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -105,25 +130,33 @@ class TextViewerWindowGen : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class FluxViewerWindowGen : public wxDialog
|
class FluxViewerWindowGen : public wxDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
FluxViewerControl* fluxviewer;
|
||||||
|
wxScrollBar* scrollbar;
|
||||||
|
wxStdDialogButtonSizer* m_sdbSizer2;
|
||||||
|
wxButton* m_sdbSizer2OK;
|
||||||
|
|
||||||
protected:
|
// Virtual event handlers, override them in your derived class
|
||||||
FluxViewerControl* fluxviewer;
|
virtual void OnClose(wxCloseEvent& event)
|
||||||
wxScrollBar* scrollbar;
|
{
|
||||||
wxStdDialogButtonSizer* m_sdbSizer2;
|
event.Skip();
|
||||||
wxButton* m_sdbSizer2OK;
|
}
|
||||||
|
virtual void OnClose(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
// Virtual event handlers, override them in your derived class
|
public:
|
||||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
FluxViewerWindowGen(wxWindow* parent,
|
||||||
virtual void OnClose( wxCommandEvent& event ) { event.Skip(); }
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxString& title = wxEmptyString,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
public:
|
const wxSize& size = wxSize(400, 200),
|
||||||
|
long style = wxCLOSE_BOX | wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX |
|
||||||
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 );
|
wxMINIMIZE_BOX | wxRESIZE_BORDER);
|
||||||
|
|
||||||
~FluxViewerWindowGen();
|
|
||||||
|
|
||||||
|
~FluxViewerWindowGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -131,26 +164,37 @@ class FluxViewerWindowGen : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class TextEditorWindowGen : public wxDialog
|
class TextEditorWindowGen : public wxDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxTextCtrl* textControl;
|
||||||
|
wxStdDialogButtonSizer* m_sdbSizer2;
|
||||||
|
wxButton* m_sdbSizer2Save;
|
||||||
|
wxButton* m_sdbSizer2Cancel;
|
||||||
|
|
||||||
protected:
|
// Virtual event handlers, override them in your derived class
|
||||||
wxTextCtrl* textControl;
|
virtual void OnClose(wxCloseEvent& event)
|
||||||
wxStdDialogButtonSizer* m_sdbSizer2;
|
{
|
||||||
wxButton* m_sdbSizer2Save;
|
event.Skip();
|
||||||
wxButton* m_sdbSizer2Cancel;
|
}
|
||||||
|
virtual void OnCancel(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
virtual void OnSave(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
// Virtual event handlers, override them in your derived class
|
public:
|
||||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
TextEditorWindowGen(wxWindow* parent,
|
||||||
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
|
wxWindowID id = wxID_ANY,
|
||||||
virtual void OnSave( wxCommandEvent& event ) { event.Skip(); }
|
const wxString& title = wxEmptyString,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
public:
|
long style = wxCLOSE_BOX | wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX |
|
||||||
|
wxMINIMIZE_BOX | wxRESIZE_BORDER);
|
||||||
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();
|
|
||||||
|
|
||||||
|
~TextEditorWindowGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -158,27 +202,32 @@ class TextEditorWindowGen : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class FileViewerWindowGen : 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:
|
// Virtual event handlers, override them in your derived class
|
||||||
wxNotebook* m_notebook1;
|
virtual void OnClose(wxCommandEvent& event)
|
||||||
wxPanel* m_panel8;
|
{
|
||||||
wxTextCtrl* textControl;
|
event.Skip();
|
||||||
wxPanel* m_panel7;
|
}
|
||||||
wxTextCtrl* hexControl;
|
|
||||||
wxStdDialogButtonSizer* m_sdbSizer2;
|
|
||||||
wxButton* m_sdbSizer2OK;
|
|
||||||
|
|
||||||
// Virtual event handlers, override them in your derived class
|
public:
|
||||||
virtual void OnClose( wxCommandEvent& event ) { event.Skip(); }
|
FileViewerWindowGen(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxString& title = wxEmptyString,
|
||||||
public:
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxSize(408, 269),
|
||||||
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 );
|
long style = wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX | wxMINIMIZE_BOX |
|
||||||
|
wxRESIZE_BORDER);
|
||||||
~FileViewerWindowGen();
|
|
||||||
|
|
||||||
|
~FileViewerWindowGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -186,23 +235,26 @@ class FileViewerWindowGen : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class GetfileDialog : public wxDialog
|
class GetfileDialog : public wxDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticText7;
|
||||||
|
wxStaticText* m_staticText9;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
wxStaticText* m_staticText7;
|
wxTextCtrl* filenameText;
|
||||||
wxStaticText* m_staticText9;
|
wxFilePickerCtrl* targetFilePicker;
|
||||||
|
wxStdDialogButtonSizer* buttons_;
|
||||||
|
wxButton* buttons_OK;
|
||||||
|
wxButton* buttons_Cancel;
|
||||||
|
|
||||||
public:
|
GetfileDialog(wxWindow* parent,
|
||||||
wxTextCtrl* filenameText;
|
wxWindowID id = wxID_ANY,
|
||||||
wxFilePickerCtrl* targetFilePicker;
|
const wxString& title = wxT("Copy file off disk"),
|
||||||
wxStdDialogButtonSizer* buttons_;
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
wxButton* buttons_OK;
|
const wxSize& size = wxDefaultSize,
|
||||||
wxButton* buttons_Cancel;
|
long style = wxDEFAULT_DIALOG_STYLE);
|
||||||
|
|
||||||
GetfileDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Copy file off disk"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
|
||||||
|
|
||||||
~GetfileDialog();
|
|
||||||
|
|
||||||
|
~GetfileDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -210,24 +262,27 @@ class GetfileDialog : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class FileConflictDialog : public wxDialog
|
class FileConflictDialog : public wxDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticText91;
|
||||||
|
wxStaticText* m_staticText7;
|
||||||
|
wxStaticText* m_staticText9;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
wxStaticText* m_staticText91;
|
wxTextCtrl* newNameText;
|
||||||
wxStaticText* m_staticText7;
|
wxTextCtrl* oldNameText;
|
||||||
wxStaticText* m_staticText9;
|
wxStdDialogButtonSizer* buttons_;
|
||||||
|
wxButton* buttons_OK;
|
||||||
|
wxButton* buttons_Cancel;
|
||||||
|
|
||||||
public:
|
FileConflictDialog(wxWindow* parent,
|
||||||
wxTextCtrl* newNameText;
|
wxWindowID id = wxID_ANY,
|
||||||
wxTextCtrl* oldNameText;
|
const wxString& title = wxT("Filename conflict"),
|
||||||
wxStdDialogButtonSizer* buttons_;
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
wxButton* buttons_OK;
|
const wxSize& size = wxDefaultSize,
|
||||||
wxButton* buttons_Cancel;
|
long style = wxDEFAULT_DIALOG_STYLE);
|
||||||
|
|
||||||
FileConflictDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Filename conflict"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
|
||||||
|
|
||||||
~FileConflictDialog();
|
|
||||||
|
|
||||||
|
~FileConflictDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -235,24 +290,27 @@ class FileConflictDialog : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class FileRenameDialog : public wxDialog
|
class FileRenameDialog : public wxDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticText91;
|
||||||
|
wxStaticText* m_staticText7;
|
||||||
|
wxStaticText* m_staticText9;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
wxStaticText* m_staticText91;
|
wxTextCtrl* newNameText;
|
||||||
wxStaticText* m_staticText7;
|
wxTextCtrl* oldNameText;
|
||||||
wxStaticText* m_staticText9;
|
wxStdDialogButtonSizer* buttons_;
|
||||||
|
wxButton* buttons_OK;
|
||||||
|
wxButton* buttons_Cancel;
|
||||||
|
|
||||||
public:
|
FileRenameDialog(wxWindow* parent,
|
||||||
wxTextCtrl* newNameText;
|
wxWindowID id = wxID_ANY,
|
||||||
wxTextCtrl* oldNameText;
|
const wxString& title = wxT("Rename or move file"),
|
||||||
wxStdDialogButtonSizer* buttons_;
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
wxButton* buttons_OK;
|
const wxSize& size = wxDefaultSize,
|
||||||
wxButton* buttons_Cancel;
|
long style = wxDEFAULT_DIALOG_STYLE);
|
||||||
|
|
||||||
FileRenameDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Rename or move file"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
|
||||||
|
|
||||||
~FileRenameDialog();
|
|
||||||
|
|
||||||
|
~FileRenameDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -260,22 +318,25 @@ class FileRenameDialog : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class CreateDirectoryDialog : public wxDialog
|
class CreateDirectoryDialog : public wxDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticText91;
|
||||||
|
wxStaticText* m_staticText9;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
wxStaticText* m_staticText91;
|
wxTextCtrl* newNameText;
|
||||||
wxStaticText* m_staticText9;
|
wxStdDialogButtonSizer* buttons_;
|
||||||
|
wxButton* buttons_OK;
|
||||||
|
wxButton* buttons_Cancel;
|
||||||
|
|
||||||
public:
|
CreateDirectoryDialog(wxWindow* parent,
|
||||||
wxTextCtrl* newNameText;
|
wxWindowID id = wxID_ANY,
|
||||||
wxStdDialogButtonSizer* buttons_;
|
const wxString& title = wxT("Create new directory"),
|
||||||
wxButton* buttons_OK;
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
wxButton* buttons_Cancel;
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_DIALOG_STYLE);
|
||||||
CreateDirectoryDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Create new directory"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
|
||||||
|
|
||||||
~CreateDirectoryDialog();
|
|
||||||
|
|
||||||
|
~CreateDirectoryDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -283,23 +344,26 @@ class CreateDirectoryDialog : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class FormatDialog : public wxDialog
|
class FormatDialog : public wxDialog
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticText91;
|
||||||
|
wxStaticText* m_staticText7;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
wxStaticText* m_staticText91;
|
wxTextCtrl* volumeNameText;
|
||||||
wxStaticText* m_staticText7;
|
wxCheckBox* quickFormatCheckBox;
|
||||||
|
wxStdDialogButtonSizer* buttons_;
|
||||||
|
wxButton* buttons_OK;
|
||||||
|
wxButton* buttons_Cancel;
|
||||||
|
|
||||||
public:
|
FormatDialog(wxWindow* parent,
|
||||||
wxTextCtrl* volumeNameText;
|
wxWindowID id = wxID_ANY,
|
||||||
wxCheckBox* quickFormatCheckBox;
|
const wxString& title = wxT("Format disk"),
|
||||||
wxStdDialogButtonSizer* buttons_;
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
wxButton* buttons_OK;
|
const wxSize& size = wxDefaultSize,
|
||||||
wxButton* buttons_Cancel;
|
long style = wxDEFAULT_DIALOG_STYLE);
|
||||||
|
|
||||||
FormatDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Format disk"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
|
||||||
|
|
||||||
~FormatDialog();
|
|
||||||
|
|
||||||
|
~FormatDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -307,37 +371,59 @@ class FormatDialog : public wxDialog
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class IdlePanelGen : public wxPanel
|
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:
|
// Virtual event handlers, override them in your derived class
|
||||||
wxStaticBitmap* applicationBitmap;
|
virtual void OnControlsChanged(wxCommandEvent& event)
|
||||||
wxPanel* sourceIconPanel;
|
{
|
||||||
wxSimplebook* sourceBook;
|
event.Skip();
|
||||||
wxChoice* formatChoice;
|
}
|
||||||
wxButton* customConfigurationButton;
|
virtual void OnCustomConfigurationButton(wxCommandEvent& event)
|
||||||
wxPanel* formatOptionsContainer;
|
{
|
||||||
wxButton* readButton;
|
event.Skip();
|
||||||
wxButton* writeButton;
|
}
|
||||||
wxButton* browseButton;
|
virtual void OnReadButton(wxCommandEvent& event)
|
||||||
wxButton* formatButton;
|
{
|
||||||
wxButton* exploreButton;
|
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
|
public:
|
||||||
virtual void OnControlsChanged( wxCommandEvent& event ) { event.Skip(); }
|
IdlePanelGen(wxWindow* parent,
|
||||||
virtual void OnCustomConfigurationButton( wxCommandEvent& event ) { event.Skip(); }
|
wxWindowID id = wxID_ANY,
|
||||||
virtual void OnReadButton( wxCommandEvent& event ) { event.Skip(); }
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
virtual void OnWriteButton( wxCommandEvent& event ) { event.Skip(); }
|
const wxSize& size = wxSize(-1, -1),
|
||||||
virtual void OnBrowseButton( wxCommandEvent& event ) { event.Skip(); }
|
long style = wxTAB_TRAVERSAL,
|
||||||
virtual void OnFormatButton( wxCommandEvent& event ) { event.Skip(); }
|
const wxString& name = wxEmptyString);
|
||||||
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();
|
|
||||||
|
|
||||||
|
~IdlePanelGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -345,30 +431,43 @@ class IdlePanelGen : public wxPanel
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class ImagerPanelGen : public wxPanel
|
class ImagerPanelGen : public wxPanel
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxAuiToolBar* imagerToolbar;
|
||||||
|
wxAuiToolBarItem* imagerBackTool;
|
||||||
|
VisualisationControl* visualiser;
|
||||||
|
wxButton* imagerSaveImageButton;
|
||||||
|
wxButton* imagerSaveFluxButton;
|
||||||
|
HistogramViewer* histogram;
|
||||||
|
wxButton* imagerGoAgainButton;
|
||||||
|
|
||||||
protected:
|
// Virtual event handlers, override them in your derived class
|
||||||
wxAuiToolBar* imagerToolbar;
|
virtual void OnBackButton(wxCommandEvent& event)
|
||||||
wxAuiToolBarItem* imagerBackTool;
|
{
|
||||||
VisualisationControl* visualiser;
|
event.Skip();
|
||||||
wxButton* imagerSaveImageButton;
|
}
|
||||||
wxButton* imagerSaveFluxButton;
|
virtual void OnSaveImageButton(wxCommandEvent& event)
|
||||||
HistogramViewer* histogram;
|
{
|
||||||
wxButton* imagerGoAgainButton;
|
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
|
public:
|
||||||
virtual void OnBackButton( wxCommandEvent& event ) { event.Skip(); }
|
ImagerPanelGen(wxWindow* parent,
|
||||||
virtual void OnSaveImageButton( wxCommandEvent& event ) { event.Skip(); }
|
wxWindowID id = wxID_ANY,
|
||||||
virtual void OnSaveFluxButton( wxCommandEvent& event ) { event.Skip(); }
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
virtual void OnImagerGoAgainButton( wxCommandEvent& event ) { event.Skip(); }
|
const wxSize& size = wxSize(500, 300),
|
||||||
|
long style = wxTAB_TRAVERSAL,
|
||||||
|
const wxString& name = wxEmptyString);
|
||||||
public:
|
|
||||||
|
|
||||||
ImagerPanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
|
||||||
|
|
||||||
~ImagerPanelGen();
|
|
||||||
|
|
||||||
|
~ImagerPanelGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -376,69 +475,121 @@ class ImagerPanelGen : public wxPanel
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class BrowserPanelGen : 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:
|
// Virtual event handlers, override them in your derived class
|
||||||
wxAuiToolBar* browserToolbar;
|
virtual void OnBackButton(wxCommandEvent& event)
|
||||||
wxAuiToolBarItem* browserBackTool;
|
{
|
||||||
wxAuiToolBarItem* browserInfoTool;
|
event.Skip();
|
||||||
wxAuiToolBarItem* browserViewTool;
|
}
|
||||||
wxAuiToolBarItem* browserSaveTool;
|
virtual void OnBrowserInfoButton(wxCommandEvent& event)
|
||||||
wxAuiToolBarItem* browserMoreMenuButton;
|
{
|
||||||
wxMenu* browserMoreMenu;
|
event.Skip();
|
||||||
wxMenuItem* browserAddMenuItem;
|
}
|
||||||
wxMenuItem* browserNewDirectoryMenuItem;
|
virtual void OnBrowserViewButton(wxCommandEvent& event)
|
||||||
wxMenuItem* browserRenameMenuItem;
|
{
|
||||||
wxMenuItem* browserDeleteMenuItem;
|
event.Skip();
|
||||||
wxAuiToolBarItem* browserFormatTool;
|
}
|
||||||
wxDataViewCtrl* browserTree;
|
virtual void OnBrowserSaveButton(wxCommandEvent& event)
|
||||||
wxDataViewColumn* m_dataViewColumn1;
|
{
|
||||||
wxDataViewColumn* m_dataViewColumn2;
|
event.Skip();
|
||||||
wxDataViewColumn* m_dataViewColumn3;
|
}
|
||||||
wxGauge* diskSpaceGauge;
|
virtual void OnBrowserAddMenuItem(wxCommandEvent& event)
|
||||||
wxButton* browserDiscardButton;
|
{
|
||||||
wxButton* browserCommitButton;
|
event.Skip();
|
||||||
wxStaticText* m_staticText12;
|
}
|
||||||
|
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
|
public:
|
||||||
virtual void OnBackButton( wxCommandEvent& event ) { event.Skip(); }
|
BrowserPanelGen(wxWindow* parent,
|
||||||
virtual void OnBrowserInfoButton( wxCommandEvent& event ) { event.Skip(); }
|
wxWindowID id = wxID_ANY,
|
||||||
virtual void OnBrowserViewButton( wxCommandEvent& event ) { event.Skip(); }
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
virtual void OnBrowserSaveButton( wxCommandEvent& event ) { event.Skip(); }
|
const wxSize& size = wxSize(500, 300),
|
||||||
virtual void OnBrowserAddMenuItem( wxCommandEvent& event ) { event.Skip(); }
|
long style = wxTAB_TRAVERSAL,
|
||||||
virtual void OnBrowserNewDirectoryMenuItem( wxCommandEvent& event ) { event.Skip(); }
|
const wxString& name = wxEmptyString);
|
||||||
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(); }
|
|
||||||
|
|
||||||
|
~BrowserPanelGen();
|
||||||
|
|
||||||
public:
|
void browserMoreMenuButtonOnDropDownMenu(wxAuiToolBarEvent& event)
|
||||||
|
{
|
||||||
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 );
|
if (event.IsDropDownClicked())
|
||||||
|
{
|
||||||
~BrowserPanelGen();
|
browserToolbar->SetToolSticky(event.GetId(), true);
|
||||||
|
wxRect rect = browserToolbar->GetToolRect(event.GetId());
|
||||||
void browserMoreMenuButtonOnDropDownMenu( wxAuiToolBarEvent &event )
|
wxPoint pt = browserToolbar->ClientToScreen(rect.GetBottomLeft());
|
||||||
{
|
pt = ScreenToClient(pt);
|
||||||
if ( event.IsDropDownClicked() )
|
browserToolbar->PopupMenu(browserMoreMenu, pt);
|
||||||
{
|
browserToolbar->SetToolSticky(event.GetId(), false);
|
||||||
browserToolbar->SetToolSticky( event.GetId(), true );
|
}
|
||||||
wxRect rect = browserToolbar->GetToolRect( event.GetId() );
|
}
|
||||||
wxPoint pt = browserToolbar->ClientToScreen( rect.GetBottomLeft() );
|
|
||||||
pt = ScreenToClient( pt );
|
|
||||||
browserToolbar->PopupMenu( browserMoreMenu, pt );
|
|
||||||
browserToolbar->SetToolSticky( event.GetId(), false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -446,45 +597,64 @@ class BrowserPanelGen : public wxPanel
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class ExplorerPanelGen : 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:
|
// Virtual event handlers, override them in your derived class
|
||||||
wxAuiToolBar* explorerToolbar;
|
virtual void OnBackButton(wxCommandEvent& event)
|
||||||
wxAuiToolBarItem* explorerBackTool;
|
{
|
||||||
wxAuiToolBarItem* explorerRefreshTool;
|
event.Skip();
|
||||||
wxStaticText* m_staticText22;
|
}
|
||||||
wxSpinCtrl* explorerTrackSpinCtrl;
|
virtual void OnExplorerRefreshButton(wxCommandEvent& event)
|
||||||
wxStaticText* m_staticText26;
|
{
|
||||||
wxSpinCtrl* explorerSideSpinCtrl;
|
event.Skip();
|
||||||
wxStaticText* m_staticText231;
|
}
|
||||||
wxSpinCtrlDouble* explorerStartTimeSpinCtrl;
|
virtual void OnExplorerSettingChange(wxSpinEvent& event)
|
||||||
wxStaticText* m_staticText24;
|
{
|
||||||
wxButton* guessButton;
|
event.Skip();
|
||||||
wxSpinCtrlDouble* explorerClockSpinCtrl;
|
}
|
||||||
wxStaticText* m_staticText25;
|
virtual void OnExplorerSettingChange(wxSpinDoubleEvent& event)
|
||||||
wxSpinCtrl* explorerBitOffsetSpinCtrl;
|
{
|
||||||
wxStaticText* m_staticText27;
|
event.Skip();
|
||||||
wxChoice* explorerDecodeChoice;
|
}
|
||||||
wxStaticText* m_staticText241;
|
virtual void OnGuessClockButton(wxCommandEvent& event)
|
||||||
wxCheckBox* explorerReverseCheckBox;
|
{
|
||||||
HistogramViewer* histogram;
|
event.Skip();
|
||||||
wxTextCtrl* explorerText;
|
}
|
||||||
|
virtual void OnExplorerSettingChange(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
// Virtual event handlers, override them in your derived class
|
public:
|
||||||
virtual void OnBackButton( wxCommandEvent& event ) { event.Skip(); }
|
ExplorerPanelGen(wxWindow* parent,
|
||||||
virtual void OnExplorerRefreshButton( wxCommandEvent& event ) { event.Skip(); }
|
wxWindowID id = wxID_ANY,
|
||||||
virtual void OnExplorerSettingChange( wxSpinEvent& event ) { event.Skip(); }
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
virtual void OnExplorerSettingChange( wxSpinDoubleEvent& event ) { event.Skip(); }
|
const wxSize& size = wxSize(620, 426),
|
||||||
virtual void OnGuessClockButton( wxCommandEvent& event ) { event.Skip(); }
|
long style = wxTAB_TRAVERSAL,
|
||||||
virtual void OnExplorerSettingChange( wxCommandEvent& event ) { event.Skip(); }
|
const wxString& name = wxEmptyString);
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
ExplorerPanelGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 620,426 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
|
||||||
|
|
||||||
~ExplorerPanelGen();
|
|
||||||
|
|
||||||
|
~ExplorerPanelGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -492,21 +662,24 @@ class ExplorerPanelGen : public wxPanel
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class HardwareSourcePanelGen : public wxPanel
|
class HardwareSourcePanelGen : public wxPanel
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticText30;
|
||||||
|
wxStaticText* m_staticText29;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
wxStaticText* m_staticText30;
|
wxStaticText* label;
|
||||||
wxStaticText* m_staticText29;
|
wxCheckBox* highDensityToggle;
|
||||||
|
wxChoice* driveTypeChoice;
|
||||||
|
|
||||||
public:
|
HardwareSourcePanelGen(wxWindow* parent,
|
||||||
wxStaticText* label;
|
wxWindowID id = wxID_ANY,
|
||||||
wxCheckBox* highDensityToggle;
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
wxChoice* driveTypeChoice;
|
const wxSize& size = wxSize(-1, -1),
|
||||||
|
long style = wxTAB_TRAVERSAL,
|
||||||
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 );
|
const wxString& name = wxEmptyString);
|
||||||
|
|
||||||
~HardwareSourcePanelGen();
|
|
||||||
|
|
||||||
|
~HardwareSourcePanelGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -514,19 +687,22 @@ class HardwareSourcePanelGen : public wxPanel
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class FluxfileSourcePanelGen : public wxPanel
|
class FluxfileSourcePanelGen : public wxPanel
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticText28;
|
||||||
|
wxStaticText* m_staticText27;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
wxStaticText* m_staticText28;
|
wxFilePickerCtrl* fluxImagePicker;
|
||||||
wxStaticText* m_staticText27;
|
|
||||||
|
|
||||||
public:
|
FluxfileSourcePanelGen(wxWindow* parent,
|
||||||
wxFilePickerCtrl* fluxImagePicker;
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
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 );
|
const wxSize& size = wxSize(-1, -1),
|
||||||
|
long style = wxTAB_TRAVERSAL,
|
||||||
~FluxfileSourcePanelGen();
|
const wxString& name = wxEmptyString);
|
||||||
|
|
||||||
|
~FluxfileSourcePanelGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -534,18 +710,20 @@ class FluxfileSourcePanelGen : public wxPanel
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class ImagefileSourcePanelGen : public wxPanel
|
class ImagefileSourcePanelGen : public wxPanel
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_staticText29;
|
||||||
|
wxStaticText* m_staticText28;
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
wxStaticText* m_staticText29;
|
wxFilePickerCtrl* diskImagePicker;
|
||||||
wxStaticText* m_staticText28;
|
|
||||||
|
|
||||||
public:
|
ImagefileSourcePanelGen(wxWindow* parent,
|
||||||
wxFilePickerCtrl* diskImagePicker;
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
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 );
|
const wxSize& size = wxSize(-1, -1),
|
||||||
|
long style = wxTAB_TRAVERSAL,
|
||||||
~ImagefileSourcePanelGen();
|
const wxString& name = wxEmptyString);
|
||||||
|
|
||||||
|
~ImagefileSourcePanelGen();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,3 @@ extern RangeFlag requiredSectors;
|
|||||||
extern int mainReadIBM(int argc, const char* argv[]);
|
extern int mainReadIBM(int argc, const char* argv[]);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2,37 +2,39 @@
|
|||||||
#define TESTS_H
|
#define TESTS_H
|
||||||
|
|
||||||
class AssertionError
|
class AssertionError
|
||||||
{};
|
{
|
||||||
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class Subject
|
class Subject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Subject(const std::string& filename, int lineno, T value):
|
Subject(const std::string& filename, int lineno, T value):
|
||||||
_filename(filename),
|
_filename(filename),
|
||||||
_lineno(lineno),
|
_lineno(lineno),
|
||||||
_value(value) {}
|
_value(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void isEqualTo(T wanted)
|
void isEqualTo(T wanted)
|
||||||
{
|
{
|
||||||
if (_value != wanted)
|
if (_value != wanted)
|
||||||
fail(fmt::format("wanted {}, got {}", wanted, _value));
|
fail(fmt::format("wanted {}, got {}", wanted, _value));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fail(const std::string& message)
|
void fail(const std::string& message)
|
||||||
{
|
{
|
||||||
error("assertion failed: {}: {}: {}", _filename, _lineno, message);
|
error("assertion failed: {}: {}: {}", _filename, _lineno, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string _filename;
|
const std::string _filename;
|
||||||
int _lineno;
|
int _lineno;
|
||||||
T _value;
|
T _value;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define assertThat(value) Subject(__FILE__, __LINE__, value)
|
#define assertThat(value) Subject(__FILE__, __LINE__, value)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user