gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

xtRomLoader.h (966B)


      1 #pragma once
      2 
      3 #include "synthLib/romLoader.h"
      4 
      5 #include <cstdint>
      6 
      7 #include "xtRom.h"
      8 
      9 namespace xt
     10 {
     11 	class RomLoader : public synthLib::RomLoader
     12 	{
     13 	public:
     14 		enum class FileType
     15 		{
     16 			Unknown,
     17 			FullRom,
     18 			HalfRomA,
     19 			HalfRomB,
     20 			MidiUpdate,
     21 		};
     22 
     23 		struct File
     24 		{
     25 			FileType type = FileType::Unknown;
     26 			std::vector<uint8_t> data;
     27 			std::string name;
     28 			uint32_t version = 0;
     29 
     30 			bool operator < (const File& _f) const
     31 			{
     32 				if(version < _f.version)
     33 					return true;
     34 				if(version > _f.version)
     35 					return false;
     36 				return name < _f.name;
     37 			}
     38 			bool operator == (const File& _f) const
     39 			{
     40 				return version == _f.version && name == _f.name;
     41 			}
     42 		};
     43 
     44 		static Rom findROM();
     45 
     46 	private:
     47 		static std::vector<File> findFiles(const std::string& _extension, size_t _sizeMin, size_t _sizeMax);
     48 		static bool detectFileType(File& _file);
     49 		static bool removeBootloader(std::vector<uint8_t>& _data);
     50 		static bool detectVersion(File& _file);
     51 	};
     52 }