mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
CINE: Skip resource header in loadSpl.
This implements a long standing TODO in PaulaSound::playSound.
This commit is contained in:
parent
17d6d732ea
commit
b1074543b5
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<int>(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);
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +95,7 @@ public:
|
||||
|
||||
enum {
|
||||
PAULA_FREQ = 7093789,
|
||||
NUM_CHANNELS = 4,
|
||||
SPL_HDR_SIZE = 22
|
||||
NUM_CHANNELS = 4
|
||||
};
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user