diff options
Diffstat (limited to 'engines/agos/drivers')
-rw-r--r-- | engines/agos/drivers/simon1/adlib.cpp | 22 | ||||
-rw-r--r-- | engines/agos/drivers/simon1/adlib.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/engines/agos/drivers/simon1/adlib.cpp b/engines/agos/drivers/simon1/adlib.cpp index d331b868fc..7f1370e8bd 100644 --- a/engines/agos/drivers/simon1/adlib.cpp +++ b/engines/agos/drivers/simon1/adlib.cpp @@ -24,6 +24,7 @@ #include "common/textconsole.h" #include "common/util.h" +#include "common/file.h" namespace AGOS { @@ -491,4 +492,25 @@ const MidiDriver_Simon1_AdLib::RhythmMap MidiDriver_Simon1_AdLib::_rhythmMap[39] { 13, 125, 100 } }; +MidiDriver *createMidiDriverSimon1AdLib(const char *instrumentFilename) { + // Load instrument data. + Common::File ibk; + + if (!ibk.open(instrumentFilename)) { + return nullptr; + } + + if (ibk.readUint32BE() != 0x49424b1a) { + return nullptr; + } + + byte *instrumentData = new byte[128 * 16]; + if (ibk.read(instrumentData, 128 * 16) != 128 * 16) { + delete[] instrumentData; + return nullptr; + } + + return new MidiDriver_Simon1_AdLib(instrumentData); +} + } // End of namespace AGOS diff --git a/engines/agos/drivers/simon1/adlib.h b/engines/agos/drivers/simon1/adlib.h index b92c1dde24..6057bf1b16 100644 --- a/engines/agos/drivers/simon1/adlib.h +++ b/engines/agos/drivers/simon1/adlib.h @@ -111,6 +111,8 @@ private: static const RhythmMap _rhythmMap[39]; }; +MidiDriver *createMidiDriverSimon1AdLib(const char *instrumentFilename); + } // End of namespace AGOS #endif |