Ticket #8917: mt32-archive.patch
File mt32-archive.patch, 1.6 KB (added by , 16 years ago) |
---|
-
sound/softsynth/mt32.cpp
32 32 #include "sound/musicplugin.h" 33 33 #include "sound/mpu401.h" 34 34 35 #include "common/archive.h" 35 36 #include "common/config-manager.h" 36 37 #include "common/events.h" 37 38 #include "common/file.h" … … 80 81 }; 81 82 82 83 class MT32File : public MT32Emu::File { 83 Common:: File_in;84 Common::SeekableReadStream *_in; 84 85 Common::DumpFile _out; 85 86 public: 87 MT32File() : _in(0) { } 88 ~MT32File() { close(); } 86 89 bool open(const char *filename, OpenMode mode) { 87 90 if (mode == OpenMode_read) 88 return _in.open(filename);91 return (_in = SearchMan.openFile(filename)); 89 92 else 90 93 return _out.open(filename); 91 94 } 92 95 void close() { 93 _in.close();96 delete _in; _in = 0; 94 97 _out.close(); 95 98 } 96 99 size_t read(void *in, size_t size) { 97 return _in .read(in, size);100 return _in->read(in, size); 98 101 } 99 102 bool readBit8u(MT32Emu::Bit8u *in) { 100 byte b = _in .readByte();101 if (_in .eof())103 byte b = _in->readByte(); 104 if (_in->eos()) 102 105 return false; 103 106 *in = b; 104 107 return true; … … 111 114 return !_out.ioFailed(); 112 115 } 113 116 bool isEOF() { 114 return _in .isOpen() ? _in.eof() : _out.eof();117 return _in ? _in->eos() : _out.eos(); 115 118 } 116 119 }; 117 120 … … 511 514 } 512 515 513 516 MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer) { 514 // HACK: It will stay here until engine plugin loader overhaul515 if (ConfMan.hasKey("extrapath"))516 Common::File::addDefaultDirectory(ConfMan.get("extrapath"));517 518 517 MidiDriver *mididriver; 519 518 520 519 MT32EmuMusicPlugin p;