commit 51d0c204301c193782fdc82803e1d047ba08b838
parent 27866bb7d75d00d6634bac250a826987b7cf2574
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Wed, 1 May 2024 13:37:39 +0200
remove ability to embed a rom
Diffstat:
5 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/source/mqLib/mqhardware.cpp b/source/mqLib/mqhardware.cpp
@@ -6,21 +6,11 @@
#include <cstring> // memcpy
-#if EMBED_ROM
-#include "romData.h"
-#else
-constexpr uint8_t* ROM_DATA = nullptr;
-#endif
-
namespace mqLib
{
-#if EMBED_ROM
- static_assert(ROM_DATA_SIZE == ROM::g_romSize);
-#endif
-
Hardware::Hardware(const std::string& _romFilename)
: wLib::Hardware(44100)
- , m_rom(_romFilename, ROM_DATA)
+ , m_rom(_romFilename)
, m_uc(m_rom)
#if MQ_VOICE_EXPANSION
, m_dsps{MqDsp(*this, m_uc.getHdi08A().getHdi08(), 0), MqDsp(*this, m_uc.getHdi08B().getHdi08(), 1) , MqDsp(*this, m_uc.getHdi08C().getHdi08(), 2)}
diff --git a/source/mqLib/rom.h b/source/mqLib/rom.h
@@ -9,7 +9,7 @@ namespace mqLib
public:
static constexpr uint32_t g_romSize = 524288;
- explicit ROM(const std::string& _filename, const uint8_t* _data = nullptr) : wLib::ROM(_filename, g_romSize, _data)
+ explicit ROM(const std::string& _filename) : wLib::ROM(_filename, g_romSize)
{
}
diff --git a/source/wLib/wRom.h b/source/wLib/wRom.h
@@ -9,10 +9,12 @@ namespace wLib
class ROM
{
public:
- explicit ROM(const std::string& _filename, const uint32_t _expectedSize, const uint8_t* _data = nullptr) : m_data(_data)
+ explicit ROM(const std::string& _filename, const uint32_t _expectedSize, std::vector<uint8_t> _data = {}) : m_buffer(std::move(_data))
{
- if (!_filename.empty())
+ if (m_buffer.size() != _expectedSize)
loadFromFile(_filename, _expectedSize);
+ else
+ m_data = m_buffer.data();
}
virtual ~ROM() = default;
diff --git a/source/xtLib/xtHardware.cpp b/source/xtLib/xtHardware.cpp
@@ -9,7 +9,7 @@ namespace xt
{
Hardware::Hardware(const std::string& _romFilename)
: wLib::Hardware(40000)
- , m_rom(_romFilename, nullptr)
+ , m_rom(_romFilename)
, m_uc(m_rom)
, m_dsps{DSP(*this, m_uc.getHdi08A().getHdi08(), 0)}
, m_midi(m_uc.getQSM())
diff --git a/source/xtLib/xtRom.h b/source/xtLib/xtRom.h
@@ -11,7 +11,7 @@ namespace xt
public:
static constexpr uint32_t Size = g_romSize;
- Rom(const std::string& _filename, const uint8_t* _data) : ROM(_filename, Size, _data)
+ Rom(const std::string& _filename) : ROM(_filename, Size)
{
}