diff options
author | Max Horn | 2011-03-21 15:42:17 +0100 |
---|---|---|
committer | Max Horn | 2011-03-22 23:51:47 +0100 |
commit | 8982fff1b79aa3cc53a5c328b283e0f102cb647f (patch) | |
tree | 01e3835be4fcdf9acbbea5e7878e0c6cfdb5b5fe /engines/groovie | |
parent | 92716d71edfe1b23482306e74a1d249c4f43bb0b (diff) | |
download | scummvm-rg350-8982fff1b79aa3cc53a5c328b283e0f102cb647f.tar.gz scummvm-rg350-8982fff1b79aa3cc53a5c328b283e0f102cb647f.tar.bz2 scummvm-rg350-8982fff1b79aa3cc53a5c328b283e0f102cb647f.zip |
AUDIO: Add pure virtual MidiDriver::isOpen() method
This in turn enables modifying MidiDriver_MPU401::close() to allow
it to be called on a midi driver that has not yet been opened.
The specific issue that triggered me to make these changes was a
crash-upon-quit in HUGO, caused by it instantiating a midi driver,
then encountering an error (missing hugo.dat) *before* having
opened the new midi driver; the general cleanup code then tries
to close the (not yet opened) midi driver -> kaboom
Also fixed some engines which were leaking MidiDriver instances.
Diffstat (limited to 'engines/groovie')
-rw-r--r-- | engines/groovie/music.cpp | 4 | ||||
-rw-r--r-- | engines/groovie/music.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index 011409155c..7651576828 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -264,6 +264,10 @@ int MusicPlayerMidi::open() { return 0; } +bool MusicPlayerMidi::isOpen() const { + return _driver && _driver->isOpen(); +} + void MusicPlayerMidi::close() {} void MusicPlayerMidi::send(uint32 b) { diff --git a/engines/groovie/music.h b/engines/groovie/music.h index 5974559c53..e45e130a70 100644 --- a/engines/groovie/music.h +++ b/engines/groovie/music.h @@ -95,6 +95,7 @@ public: // MidiDriver interface virtual int open(); + virtual bool isOpen() const; virtual void close(); virtual void send(uint32 b); virtual void metaEvent(byte type, byte *data, uint16 length); |