romloader.h (1072B)
1 #pragma once 2 3 #include "romfile.h" 4 5 #include "synthLib/romLoader.h" 6 7 namespace virusLib 8 { 9 class ROMLoader : public synthLib::RomLoader 10 { 11 public: 12 enum FileType 13 { 14 Invalid, 15 BinaryRom, 16 MidiRom, 17 MidiPresets 18 }; 19 20 struct FileData 21 { 22 std::string filename; 23 FileType type; 24 std::vector<uint8_t> data; 25 26 bool isValid() const { return type != Invalid && !data.empty(); } 27 }; 28 29 static std::vector<ROMFile> findROMs(DeviceModel _model = DeviceModel::ABC); 30 static std::vector<ROMFile> findROMs(DeviceModel _modelA, DeviceModel _modelB); 31 static std::vector<ROMFile> findROMs(const std::string& _path, DeviceModel _model = DeviceModel::ABC); 32 static ROMFile findROM(DeviceModel _model = DeviceModel::ABC); 33 static ROMFile findROM(const std::string& _filename, DeviceModel _model = DeviceModel::ABC); 34 35 private: 36 static FileData loadFile(const std::string& _name); 37 38 static DeviceModel detectModel(const std::vector<uint8_t>& _data); 39 40 static std::vector<ROMFile> initializeRoms(const std::vector<std::string>& _files, DeviceModel _model); 41 }; 42 }