diff options
author | Max Horn | 2008-07-29 16:09:10 +0000 |
---|---|---|
committer | Max Horn | 2008-07-29 16:09:10 +0000 |
commit | 0be985ce833d03e4458bb4512d5bed377c13d9c7 (patch) | |
tree | 0306c88a96f5eba14268fb33cc3cb45a5c8ba51e /sound/softsynth | |
parent | c9051fcfbd9b1f227bf5bddd81aac478d139e358 (diff) | |
download | scummvm-rg350-0be985ce833d03e4458bb4512d5bed377c13d9c7.tar.gz scummvm-rg350-0be985ce833d03e4458bb4512d5bed377c13d9c7.tar.bz2 scummvm-rg350-0be985ce833d03e4458bb4512d5bed377c13d9c7.zip |
Changed class File (and derived classes) to only support read-only access; added a new class DumpFile for writing
svn-id: r33412
Diffstat (limited to 'sound/softsynth')
-rw-r--r-- | sound/softsynth/mt32.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp index 053df544b1..360ef4539d 100644 --- a/sound/softsynth/mt32.cpp +++ b/sound/softsynth/mt32.cpp @@ -80,37 +80,41 @@ public: }; class MT32File : public MT32Emu::File { - Common::File file; + Common::File _in; + Common::DumpFile _out; public: bool open(const char *filename, OpenMode mode) { - Common::File::AccessMode accessMode = mode == OpenMode_read ? Common::File::kFileReadMode : Common::File::kFileWriteMode; - return file.open(filename, accessMode); + if (mode == OpenMode_read) + return _in.open(filename); + else + return _out.open(filename); } void close() { - return file.close(); + _in.close(); + _out.close(); } size_t read(void *in, size_t size) { - return file.read(in, size); + return _in.read(in, size); } bool readLine(char *in, size_t size) { - return file.readLine(in, size) != NULL; + return _in.readLine(in, size) != NULL; } bool readBit8u(MT32Emu::Bit8u *in) { - byte b = file.readByte(); - if (file.eof()) + byte b = _in.readByte(); + if (_in.eof()) return false; *in = b; return true; } size_t write(const void *in, size_t size) { - return file.write(in, size); + return _out.write(in, size); } bool writeBit8u(MT32Emu::Bit8u out) { - file.writeByte(out); - return !file.ioFailed(); + _out.writeByte(out); + return !_out.ioFailed(); } bool isEOF() { - return file.eof(); + return _in.isOpen() ? _in.eof() : _out.eof(); } }; |