diff options
author | Johannes Schickel | 2015-07-23 22:33:56 +0200 |
---|---|---|
committer | Johannes Schickel | 2015-07-23 22:33:56 +0200 |
commit | cf42dc0a358da489ff93d32c18a5103de4dc4385 (patch) | |
tree | d9d4d0f6b4cddc7b06002824a6731dd6590705ae /engines/agos/drivers | |
parent | 33c57c632cc630d1d64266d9ee2bf340d0052049 (diff) | |
download | scummvm-rg350-cf42dc0a358da489ff93d32c18a5103de4dc4385.tar.gz scummvm-rg350-cf42dc0a358da489ff93d32c18a5103de4dc4385.tar.bz2 scummvm-rg350-cf42dc0a358da489ff93d32c18a5103de4dc4385.zip |
AGOS: Slight cleanup in Simon1 AdLib output initialization code.
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 |