commit 7df7efb0efecc54381bdcb78c16af34e08e0379c
parent 3f6e5cf2561a45a604f06169f53589d1b9a89108
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Mon, 4 Nov 2024 12:56:23 +0100
use a fixed ordering of TI/TI2/Snow rom banks to fix issues when switching model that cause duplicated rom banks or lost favs
Diffstat:
2 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/source/virusJucePlugin/VirusController.cpp b/source/virusJucePlugin/VirusController.cpp
@@ -754,31 +754,12 @@ namespace virus
{
_index -= 2;
- const auto countSnow = virusLib::ROMFile::getRomBankCount(virusLib::DeviceModel::Snow);
const auto countTI = virusLib::ROMFile::getRomBankCount(virusLib::DeviceModel::TI);
const auto countTI2 = virusLib::ROMFile::getRomBankCount(virusLib::DeviceModel::TI2);
- switch(m_processor.getModel())
- {
- case virusLib::DeviceModel::Snow:
- if(_index < countSnow) sprintf(temp, "Snow Rom %c", 'A' + _index);
- else if(_index < countTI + countSnow) sprintf(temp, "TI Rom %c", 'A' + (_index - countSnow));
- else sprintf(temp, "TI2 Rom %c", 'A' + (_index - countTI - countSnow));
- break;
- case virusLib::DeviceModel::TI:
- if(_index < countTI) sprintf(temp, "TI Rom %c", 'A' + _index);
- else if(_index < countTI + countTI2) sprintf(temp, "TI2 Rom %c", 'A' + (_index - countTI));
- else sprintf(temp, "Snow Rom %c", 'A' + (_index - countTI - countTI2));
- break;
- case virusLib::DeviceModel::TI2:
- if(_index < countTI2) sprintf(temp, "TI2 Rom %c", 'A' + _index);
- else if(_index < countTI2 + countTI) sprintf(temp, "TI Rom %c", 'A' + (_index - countTI2));
- else sprintf(temp, "Snow Rom %c", 'A' + (_index - countTI2 - countTI));
- break;
- default:
- assert(false);
- break;
- }
+ if(_index < countTI) sprintf(temp, "TI Rom %c", 'A' + _index);
+ else if(_index < countTI + countTI2) sprintf(temp, "TI2 Rom %c", 'A' + (_index - countTI));
+ else sprintf(temp, "Snow Rom %c", 'A' + (_index - countTI - countTI2));
}
return temp;
}
diff --git a/source/virusLib/romfile.cpp b/source/virusLib/romfile.cpp
@@ -84,12 +84,6 @@ bool ROMFile::initialize()
{
if (!fw.Presets.empty())
{
- for (auto& presetFile: fw.Presets)
- {
- imemstream stream(presetFile);
- loadPresetFile(stream, m_model);
- }
-
for (const auto & preset : fw.Presets)
{
m_demoData.insert(m_demoData.begin(), preset.begin(), preset.end());
@@ -143,11 +137,9 @@ bool ROMFile::initialize()
}
}
- // try to load the presets from the other roms, too
+ //load presets in a fixed order, TI first, Snow last
auto loadFirmwarePresets = [this](const DeviceModel _model)
{
- if(m_model == _model)
- return;
const std::unique_ptr<imemstream> file(new imemstream(reinterpret_cast<std::vector<char>&>(m_romFileData)));
const auto firmware = ROMUnpacker::getFirmware(*file, _model);
if(!firmware.Presets.empty())