From 65891626a209f894b5a3d0ebdafaec8dfc3fd011 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Tue, 23 Jun 2009 08:51:55 +0000 Subject: Changing the TBR FIXME into a warning in setVoice() svn-id: r41803 --- engines/gob/sound/adlib.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/gob/sound') diff --git a/engines/gob/sound/adlib.cpp b/engines/gob/sound/adlib.cpp index b4543dec6f..12544f78ea 100644 --- a/engines/gob/sound/adlib.cpp +++ b/engines/gob/sound/adlib.cpp @@ -549,12 +549,7 @@ bool MDYPlayer::loadTBR(Common::SeekableReadStream &stream) { _timbresSize = stream.size(); - // FIXME: _timbresSize is smaller than setVoice() expects! - uint32 rSize = MAX(_timbresSize, 810); - - _timbres = new byte[rSize]; - memset(_timbres, 0, rSize); - + _timbres = new byte[_timbresSize]; stream.read(_timbres, _timbresSize); reset(); @@ -754,7 +749,12 @@ void MDYPlayer::setVoice(byte voice, byte instr, bool set) { for (int i = 0; i < 2; i++) { timbrePtr = _timbres + _tbrStart + instr * 0x38 + i * 0x1A; for (int j = 0; j < 27; j++) { - strct[j] = READ_LE_UINT16(timbrePtr); + if (timbrePtr >= (_timbres + _timbresSize)) { + warning("Instrument %d out of range (%d, %d)", instr, + (uint32) (timbrePtr - _timbres), _timbresSize); + strct[j] = 0; + } else + strct[j] = READ_LE_UINT16(timbrePtr); timbrePtr += 2; } channel = _operators[voice] + i * 3; -- cgit v1.2.3