[Scummvm-git-logs] scummvm master -> 3c5569d2724809048876821d120293e5016b53e2

sev- sev at scummvm.org
Tue Aug 25 16:37:35 UTC 2020


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:
3c5569d272 PRINCE: Fix infinite loop on bad 'look' data. Fixes #11429


Commit: 3c5569d2724809048876821d120293e5016b53e2
    https://github.com/scummvm/scummvm/commit/3c5569d2724809048876821d120293e5016b53e2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-25T18:36:52+02:00

Commit Message:
PRINCE: Fix infinite loop on bad 'look' data. Fixes #11429

Changed paths:
    engines/prince/prince.cpp
    engines/prince/prince.h
    engines/prince/script.cpp
    engines/prince/sound.cpp


diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index ef91f0bec4..47ec701b3b 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -87,7 +87,7 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc)
 	_shanLen(0), _directionTable(nullptr), _currentMidi(0), _lightX(0), _lightY(0), _curveData(nullptr), _curvPos(0),
 	_creditsData(nullptr), _creditsDataSize(0), _currentTime(0), _zoomBitmap(nullptr), _shadowBitmap(nullptr), _transTable(nullptr),
 	_flcFrameSurface(nullptr), _shadScaleValue(0), _shadLineLen(0), _scaleValue(0), _dialogImage(nullptr), _mobTranslationData(nullptr),
-	_mobTranslationSize(0) {
+	_mobTranslationSize(0), _missingVoice(false) {
 
 	// Debug/console setup
 	DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel");
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index 19a3cac5ef..173efdc0fe 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -316,6 +316,8 @@ public:
 	uint32 _mobTranslationSize;
 	byte *_mobTranslationData;
 
+	bool _missingVoice;
+
 	bool loadLocation(uint16 locationNr);
 	bool loadAnim(uint16 animNr, bool loop);
 	bool loadVoice(uint32 textSlot, uint32 sampleSlot, const Common::String &name);
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index 15b1a796bf..299ce8a958 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -1405,6 +1405,11 @@ void Interpreter::O_GETCHAR() {
 	debugInterpreter("O_GETCHAR %04X (%s) %02x", flagId, _flagMap.getFlagName(flagId), _flags->getFlagValue(flagId));
 	_flags->setFlagValue(flagId, *_string);
 	_string++;
+
+	if (_vm->_missingVoice) {	// Sometimes data is missing the END tag, insert it here
+		_flags->setFlagValue(flagId, 255);
+		_vm->_missingVoice = false;
+	}
 }
 
 void Interpreter::O_SETDFLAG() {
diff --git a/engines/prince/sound.cpp b/engines/prince/sound.cpp
index 49983860be..60fa521238 100644
--- a/engines/prince/sound.cpp
+++ b/engines/prince/sound.cpp
@@ -94,6 +94,8 @@ bool PrinceEngine::loadVoice(uint32 slot, uint32 sampleSlot, const Common::Strin
 	if (getFeatures() & GF_NOVOICES)
 		return false;
 
+	_missingVoice = false;
+
 	debugEngine("Loading wav %s slot %d", streamName.c_str(), slot);
 
 	if (slot >= kMaxTexts) {
@@ -105,6 +107,9 @@ bool PrinceEngine::loadVoice(uint32 slot, uint32 sampleSlot, const Common::Strin
 	Common::SeekableReadStream *sampleStream = SearchMan.createReadStreamForMember(streamName);
 	if (sampleStream == nullptr) {
 		warning("loadVoice: Can't open %s", streamName.c_str());
+		_missingVoice = true;	// Insert END tag if needed
+		_textSlots[slot]._time = 1; // Set phrase time to none
+		_mainHero->_talkTime = 1;
 		return false;
 	}
 




More information about the Scummvm-git-logs mailing list