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

rom.cpp (530B)


      1 #include "rom.h"
      2 
      3 #include <cstring>
      4 
      5 namespace mqLib
      6 {
      7 	ROM::ROM(const std::string& _filename) : wLib::ROM(_filename, g_romSize)
      8 	{
      9 		verifyRom();
     10 	}
     11 
     12 	ROM::ROM(const std::vector<uint8_t>& _data, const std::string& _name) : wLib::ROM(_name, g_romSize, _data)
     13 	{
     14 		verifyRom();
     15 	}
     16 
     17 	void ROM::verifyRom()
     18 	{
     19 		if(getData().size() < 5)
     20 			return;
     21 
     22 		auto* d = reinterpret_cast<const char*>(getData().data());
     23 
     24 		// OS version is right at the start of the ROM, as zero-terminated ASCII
     25 		if(strstr(d, "2.23") != d)
     26 			clear();
     27 	}
     28 }