Using a constexpr for the magic header string of a SPC rom

This commit is contained in:
Melefo
2021-06-23 21:56:38 +02:00
parent cb1d35c288
commit ca94b0fbaa
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ namespace ComSquare::Cartridge
{
std::string str = std::string(reinterpret_cast<char *>(this->_data), 0x21);
if (str != "SNES-SPC700 Sound File Data v0.30")
if (str != Cartridge::_magicSPC)
return false;
if (this->_data[0x21] != 0x1A || this->_data[0x22] != 0x1A)
return false;
+2
View File
@@ -91,6 +91,8 @@ namespace ComSquare::Cartridge
Header _mapHeader(uint32_t headerAddress);
//! @brief Current type of the cartridge
CartridgeType _type;
//! @brief Magic Header string of a SPC Rom
static constexpr std::string_view _magicSPC = "SNES-SPC700 Sound File Data v0.30";
public:
//! @brief Load a rom from it's path.
explicit Cartridge(const std::string &romPath);