mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	Add the boilerplate for the Agat encoder.
This commit is contained in:
		| @@ -3,7 +3,13 @@ | ||||
|  | ||||
| #define AGAT_SECTOR_SIZE 256 | ||||
|  | ||||
| class Encoder; | ||||
| class EncoderProto; | ||||
| class Decoder; | ||||
| class DecoderProto; | ||||
|  | ||||
| extern std::unique_ptr<Decoder> createAgatDecoder(const DecoderProto& config); | ||||
| extern std::unique_ptr<Encoder> createAgatEncoder(const EncoderProto& config); | ||||
|  | ||||
| extern uint8_t agatChecksum(const Bytes& bytes); | ||||
|  | ||||
|   | ||||
| @@ -2,4 +2,5 @@ syntax = "proto2"; | ||||
|  | ||||
| message AgatDecoderProto {} | ||||
|  | ||||
| message AgatEncoderProto {} | ||||
|  | ||||
|   | ||||
							
								
								
									
										37
									
								
								arch/agat/encoder.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								arch/agat/encoder.cc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| #include "globals.h" | ||||
| #include "decoders/decoders.h" | ||||
| #include "encoders/encoders.h" | ||||
| #include "agat.h" | ||||
| #include "crc.h" | ||||
| #include "readerwriter.h" | ||||
| #include "image.h" | ||||
| #include "arch/agat/agat.pb.h" | ||||
| #include "lib/encoders/encoders.pb.h" | ||||
|  | ||||
| class AgatEncoder : public Encoder | ||||
| { | ||||
| public: | ||||
|     AgatEncoder(const EncoderProto& config): | ||||
|         Encoder(config), | ||||
|         _config(config.agat()) | ||||
|     { | ||||
|     } | ||||
|  | ||||
| public: | ||||
|     std::unique_ptr<Fluxmap> encode(std::shared_ptr<const TrackInfo>& trackInfo, | ||||
|         const std::vector<std::shared_ptr<const Sector>>& sectors, | ||||
|         const Image& image) override | ||||
|     { | ||||
|         Error() << "unimplemented"; | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     const AgatEncoderProto& _config; | ||||
| }; | ||||
|  | ||||
|  | ||||
| std::unique_ptr<Encoder> createAgatEncoder(const EncoderProto& config) | ||||
| { | ||||
|     return std::unique_ptr<Encoder>(new AgatEncoder(config)); | ||||
| } | ||||
|  | ||||
| @@ -2,6 +2,7 @@ LIBARCH_SRCS = \ | ||||
| 	arch/aeslanier/decoder.cc \ | ||||
| 	arch/agat/agat.cc \ | ||||
| 	arch/agat/decoder.cc \ | ||||
| 	arch/agat/encoder.cc \ | ||||
| 	arch/amiga/amiga.cc \ | ||||
| 	arch/amiga/decoder.cc \ | ||||
| 	arch/amiga/encoder.cc \ | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
| #include "fluxmap.h" | ||||
| #include "decoders/decoders.h" | ||||
| #include "encoders/encoders.h" | ||||
| #include "arch/agat/agat.h" | ||||
| #include "arch/amiga/amiga.h" | ||||
| #include "arch/apple2/apple2.h" | ||||
| #include "arch/brother/brother.h" | ||||
| @@ -25,6 +26,7 @@ std::unique_ptr<Encoder> Encoder::create( | ||||
|         std::function<std::unique_ptr<Encoder>(const EncoderProto&)>> | ||||
|         encoders = { | ||||
|             {EncoderProto::kAmiga,      createAmigaEncoder      }, | ||||
|             {EncoderProto::kAgat,       createAgatEncoder      }, | ||||
|             {EncoderProto::kApple2,     createApple2Encoder     }, | ||||
|             {EncoderProto::kBrother,    createBrotherEncoder    }, | ||||
|             {EncoderProto::kC64,        createCommodore64Encoder}, | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| syntax = "proto2"; | ||||
|  | ||||
| import "arch/agat/agat.proto"; | ||||
| import "arch/amiga/amiga.proto"; | ||||
| import "arch/apple2/apple2.proto"; | ||||
| import "arch/brother/brother.proto"; | ||||
| @@ -25,5 +26,6 @@ message EncoderProto | ||||
|         MicropolisEncoderProto micropolis = 10; | ||||
|         Victor9kEncoderProto victor9k = 11; | ||||
|         Apple2EncoderProto apple2 = 12; | ||||
|         AgatEncoderProto agat = 13; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -20,3 +20,8 @@ layout { | ||||
| decoder { | ||||
| 	agat {} | ||||
| } | ||||
|  | ||||
| encoder { | ||||
| 	agat {} | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user