commit 016202706a6e2dd530bb7c19581db28e62518f56
parent c115834af1437320599cba86d8d7a9a32e1bf5df
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sun, 4 Sep 2022 12:20:18 +0200
fix demo playback not being able to load a demo from a ROM
Diffstat:
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/source/virusLib/demoplayback.cpp b/source/virusLib/demoplayback.cpp
@@ -7,6 +7,7 @@
#include "../synthLib/midiToSysex.h"
#include "../synthLib/midiTypes.h"
+#include "../synthLib/os.h"
#include "dsp56kEmu/logging.h"
@@ -21,6 +22,23 @@ namespace virusLib
bool DemoPlayback::loadMidi(const std::string& _filename)
{
+ if(synthLib::hasExtension(_filename, ".bin"))
+ {
+ std::vector<uint8_t> data;
+ auto hFile = fopen(_filename.c_str(), "rb");
+ if(!hFile)
+ {
+ LOG("Failed to open demo file " << _filename);
+ return false;
+ }
+ fseek(hFile, 0, SEEK_END);
+ data.resize(ftell(hFile));
+ fseek(hFile, 0, SEEK_SET);
+ fread(&data[0], 1, data.size(), hFile);
+ fclose(hFile);
+ return loadBinData(data);
+ }
+
std::vector<uint8_t> sysex;
synthLib::MidiToSysex::readFile(sysex, _filename.c_str());