aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/sound
diff options
context:
space:
mode:
authorSven Hesse2009-06-23 08:51:55 +0000
committerSven Hesse2009-06-23 08:51:55 +0000
commit65891626a209f894b5a3d0ebdafaec8dfc3fd011 (patch)
tree14db2c3ee20fe512d8a74552a1e1f742447a8250 /engines/gob/sound
parentb6e1787d72abf55bfb44635482b4e80c3c2ea6d4 (diff)
downloadscummvm-rg350-65891626a209f894b5a3d0ebdafaec8dfc3fd011.tar.gz
scummvm-rg350-65891626a209f894b5a3d0ebdafaec8dfc3fd011.tar.bz2
scummvm-rg350-65891626a209f894b5a3d0ebdafaec8dfc3fd011.zip
Changing the TBR FIXME into a warning in setVoice()
svn-id: r41803
Diffstat (limited to 'engines/gob/sound')
-rw-r--r--engines/gob/sound/adlib.cpp14
1 files changed, 7 insertions, 7 deletions
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<uint32>(_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;