From b1074543b575bdca64b228272f2dfddda2e98cff Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 7 Sep 2012 17:49:17 +0200 Subject: CINE: Skip resource header in loadSpl. This implements a long standing TODO in PaulaSound::playSound. --- engines/cine/anim.cpp | 2 +- engines/cine/script_fw.cpp | 3 +++ engines/cine/sound.cpp | 4 +--- engines/cine/sound.h | 3 +-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'engines/cine') diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index 9b2103687d..075a59cfb6 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -535,7 +535,7 @@ int loadSpl(const char *resourceName, int16 idx) { entry = idx < 0 ? emptyAnimSpace() : idx; assert(entry >= 0); - g_cine->_animDataTable[entry].load(dataPtr, ANIM_RAW, g_cine->_partBuffer[foundFileIdx].unpackedSize, 1, foundFileIdx, 0, currentPartName); + g_cine->_animDataTable[entry].load(dataPtr + 0x16, ANIM_RAW, g_cine->_partBuffer[foundFileIdx].unpackedSize - 0x16, 1, foundFileIdx, 0, currentPartName); free(dataPtr); return entry + 1; diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp index 885a43f2f5..a4e7314a67 100644 --- a/engines/cine/script_fw.cpp +++ b/engines/cine/script_fw.cpp @@ -1818,6 +1818,9 @@ int FWScript::o1_playSample() { if (g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) { if (size == 0xFFFF) { size = g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height; + } else if (size > g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height) { + warning("o1_playSample: Got invalid sample size %d for sample %d", size, anim); + size = g_cine->_animDataTable[anim]._width * g_cine->_animDataTable[anim]._height; } if (channel < 10) { // || _currentOpcode == 0x78 int channel1, channel2; diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp index b92c5374bd..6cf3d9b5b9 100644 --- a/engines/cine/sound.cpp +++ b/engines/cine/sound.cpp @@ -1052,12 +1052,10 @@ void PaulaSound::playSound(int channel, int frequency, const uint8 *data, int si // TODO: handle volume slides and repeat debugC(5, kCineDebugSound, "PaulaSound::playSound() channel %d size %d", channel, size); stopSound(channel); - size = MIN(size - SPL_HDR_SIZE, READ_BE_UINT16(data + 4)); - // TODO: consider skipping the header in loadSpl directly if (size > 0) { byte *sound = (byte *)malloc(size); if (sound) { - memcpy(sound, data + SPL_HDR_SIZE, size); + memcpy(sound, data, size); playSoundChannel(channel, frequency, sound, size, volume); } } diff --git a/engines/cine/sound.h b/engines/cine/sound.h index afc0994a26..7caa41b655 100644 --- a/engines/cine/sound.h +++ b/engines/cine/sound.h @@ -95,8 +95,7 @@ public: enum { PAULA_FREQ = 7093789, - NUM_CHANNELS = 4, - SPL_HDR_SIZE = 22 + NUM_CHANNELS = 4 }; protected: -- cgit v1.2.3