[Scummvm-git-logs] scummvm master -> 5cb8202d9bced76237c3bfb8ecb23ce038ede818

AndywinXp noreply at scummvm.org
Sat Feb 26 23:46:23 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5cb8202d9b SCUMM: DiMUSE: Remove a hack in Dispatch which caused rare crashes


Commit: 5cb8202d9bced76237c3bfb8ecb23ce038ede818
    https://github.com/scummvm/scummvm/commit/5cb8202d9bced76237c3bfb8ecb23ce038ede818
Author: Andrea Boscarino (andywinxp at gmail.com)
Date: 2022-02-27T00:46:19+01:00

Commit Message:
SCUMM: DiMUSE: Remove a hack in Dispatch which caused rare crashes

The code now matches the Full Throttle interpreter

Changed paths:
    engines/scumm/imuse_digi/dimuse_dispatch.cpp


diff --git a/engines/scumm/imuse_digi/dimuse_dispatch.cpp b/engines/scumm/imuse_digi/dimuse_dispatch.cpp
index 6fdee931f18..0b6f79b02d4 100644
--- a/engines/scumm/imuse_digi/dimuse_dispatch.cpp
+++ b/engines/scumm/imuse_digi/dimuse_dispatch.cpp
@@ -1631,27 +1631,14 @@ int IMuseDigital::dispatchSeekToNextChunk(IMuseDigiDispatch *dispatchPtr) {
 		if (dispatchPtr->streamPtr) {
 			headerBuf = streamerGetStreamBufferAtOffset(dispatchPtr->streamPtr, 0, 0x30);
 			if (headerBuf || (headerBuf = streamerGetStreamBufferAtOffset(dispatchPtr->streamPtr, 0, 1)) != 0) {
-				// Little hack: avoid copying stuff from the resource to the
-				// header buffer beyond the resource size limit
-				resSize = _filesHandler->getSoundAddrDataSize(dispatchPtr->trackPtr->soundId, dispatchPtr->streamPtr != nullptr);
-				if ((resSize - dispatchPtr->currentOffset) < 0x30) {
-					memcpy(_currentVOCHeader, headerBuf, resSize - dispatchPtr->currentOffset);
-				} else {
-					memcpy(_currentVOCHeader, headerBuf, 0x30);
-				}
+				memcpy(_currentVOCHeader, headerBuf, 0x30);
 			} else {
 				return -3;
 			}
 		} else {
 			soundAddrData = _filesHandler->getSoundAddrData(dispatchPtr->trackPtr->soundId);
 			if (soundAddrData) {
-				// Little hack: see above
-				resSize = _filesHandler->getSoundAddrDataSize(dispatchPtr->trackPtr->soundId, dispatchPtr->streamPtr != nullptr);
-				if ((resSize - dispatchPtr->currentOffset) < 0x30) {
-					memcpy(_currentVOCHeader, &soundAddrData[dispatchPtr->currentOffset], resSize - dispatchPtr->currentOffset);
-				} else {
-					memcpy(_currentVOCHeader, &soundAddrData[dispatchPtr->currentOffset], 0x30);
-				}
+				memcpy(_currentVOCHeader, &soundAddrData[dispatchPtr->currentOffset], 0x30);
 			} else {
 				return -1;
 			}
@@ -1682,7 +1669,7 @@ int IMuseDigital::dispatchSeekToNextChunk(IMuseDigiDispatch *dispatchPtr) {
 				dispatchPtr->audioRemaining = (READ_LE_UINT32(headerTag) >> 8) - 2;
 				dispatchPtr->currentOffset += 6;
 
-				// Another little hack to avoid click and pops artifacts:
+				// A little hack to avoid click and pops artifacts:
 				// read one audio sample less if this is the last audio chunk of the file
 				resSize = _filesHandler->getSoundAddrDataSize(dispatchPtr->trackPtr->soundId, dispatchPtr->streamPtr != nullptr);
 				if ((resSize - (dispatchPtr->currentOffset + dispatchPtr->audioRemaining)) < 0x30) {




More information about the Scummvm-git-logs mailing list