[Scummvm-cvs-logs] scummvm master -> 6eeebfb19125b79e4a77e8c35a0d04cf1a5d97bd

fingolfin max at quendi.de
Mon Apr 4 11:14:23 CEST 2011


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

Summary:
a4eea36b84 SCI: Initialize newPlane fully before adding it to _planes
c4ae3b90db COMMON: Fix (harmless) int <-> uint mismatch
b188e60f44 AGI: Avoid global constructors (due to global refs)
6eeebfb191 SCUMM: Check for cutSceneStackPointer underflows


Commit: a4eea36b84b60db158fa14e15a620a6f3e72cc37
    https://github.com/scummvm/scummvm/commit/a4eea36b84b60db158fa14e15a620a6f3e72cc37
Author: Max Horn (max at quendi.de)
Date: 2011-04-04T00:53:26-07:00

Commit Message:
SCI: Initialize newPlane fully before adding it to _planes

Changed paths:
    engines/sci/graphics/frameout.cpp



diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 7189def..dd55b3b 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -83,10 +83,12 @@ void GfxFrameout::kernelAddPlane(reg_t object) {
 	}
 
 	newPlane.object = object;
-	newPlane.pictureId = 0xFFFF;
 	newPlane.priority = readSelectorValue(_segMan, object, SELECTOR(priority));
 	newPlane.lastPriority = 0xFFFF; // hidden
 	newPlane.planeOffsetX = 0;
+	newPlane.pictureId = 0xFFFF;
+	newPlane.planePictureMirrored = false;
+	newPlane.planeBack = 0;
 	_planes.push_back(newPlane);
 
 	kernelUpdatePlane(object);


Commit: c4ae3b90db9fe28130c00e9736fdc388088e7a35
    https://github.com/scummvm/scummvm/commit/c4ae3b90db9fe28130c00e9736fdc388088e7a35
Author: Max Horn (max at quendi.de)
Date: 2011-04-04T00:53:26-07:00

Commit Message:
COMMON: Fix (harmless) int <-> uint mismatch

Changed paths:
    common/hashmap.h
    common/list.h



diff --git a/common/hashmap.h b/common/hashmap.h
index b645a37..233d7f5 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -142,8 +142,8 @@ private:
 	}
 
 	void assign(const HM_t &map);
-	int lookup(const Key &key) const;
-	int lookupAndCreateIfMissing(const Key &key);
+	uint lookup(const Key &key) const;
+	uint lookupAndCreateIfMissing(const Key &key);
 	void expandStorage(uint newCapacity);
 
 #if !defined(__sgi) || defined(__GNUC__)
@@ -456,7 +456,7 @@ void HashMap<Key, Val, HashFunc, EqualFunc>::expandStorage(uint newCapacity) {
 }
 
 template<class Key, class Val, class HashFunc, class EqualFunc>
-int HashMap<Key, Val, HashFunc, EqualFunc>::lookup(const Key &key) const {
+uint HashMap<Key, Val, HashFunc, EqualFunc>::lookup(const Key &key) const {
 	const uint hash = _hash(key);
 	uint ctr = hash & _mask;
 	for (uint perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) {
@@ -487,7 +487,7 @@ int HashMap<Key, Val, HashFunc, EqualFunc>::lookup(const Key &key) const {
 }
 
 template<class Key, class Val, class HashFunc, class EqualFunc>
-int HashMap<Key, Val, HashFunc, EqualFunc>::lookupAndCreateIfMissing(const Key &key) {
+uint HashMap<Key, Val, HashFunc, EqualFunc>::lookupAndCreateIfMissing(const Key &key) {
 	const uint hash = _hash(key);
 	uint ctr = hash & _mask;
 	const uint NONE_FOUND = _mask + 1;
diff --git a/common/list.h b/common/list.h
index f3bc1df..ad6193c 100644
--- a/common/list.h
+++ b/common/list.h
@@ -185,7 +185,7 @@ public:
 	}
 
 	uint size() const {
-		int n = 0;
+		uint n = 0;
 		for (const NodeBase *cur = _anchor._next; cur != &_anchor; cur = cur->_next)
 			++n;
 		return n;


Commit: b188e60f4415e7a2d7dc08ce5471edc818e94076
    https://github.com/scummvm/scummvm/commit/b188e60f4415e7a2d7dc08ce5471edc818e94076
Author: Max Horn (max at quendi.de)
Date: 2011-04-04T00:53:26-07:00

Commit Message:
AGI: Avoid global constructors (due to global refs)

Changed paths:
    engines/agi/sound_2gs.cpp
    engines/agi/sound_2gs.h



diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index 4ed4fb7..11bf5a9 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -766,7 +766,7 @@ bool SoundGen2GS::loadInstruments() {
 	// load the instrument headers and their sample data.
 	// None of the tested SIERRASTANDARD-files have zeroes in them so
 	// there's no need to check for prematurely ending samples here.
-	setProgramChangeMapping(&exeInfo->instSet.progToInst);
+	setProgramChangeMapping(exeInfo->instSet->progToInst);
 	return loadWaveFile(*waveFsnode, *exeInfo) && loadInstrumentHeaders(*exeFsnode, *exeInfo);
 }
 
@@ -792,29 +792,29 @@ static const MidiProgramChangeMapping progToInstMappingV2 = {
 
 /** Older Apple IIGS AGI instrument set. Used only by Space Quest I (AGI v1.002). */
 static const InstrumentSetInfo instSetV1 = {
-	1192, 26, "7ee16bbc135171ffd6b9120cc7ff1af2", "edd3bf8905d9c238e02832b732fb2e18", progToInstMappingV1
+	1192, 26, "7ee16bbc135171ffd6b9120cc7ff1af2", "edd3bf8905d9c238e02832b732fb2e18", &progToInstMappingV1
 };
 
 /** Newer Apple IIGS AGI instrument set (AGI v1.003+). Used by all others than Space Quest I. */
 static const InstrumentSetInfo instSetV2 = {
-	1292, 28, "b7d428955bb90721996de1cbca25e768", "c05fb0b0e11deefab58bc68fbd2a3d07", progToInstMappingV2
+	1292, 28, "b7d428955bb90721996de1cbca25e768", "c05fb0b0e11deefab58bc68fbd2a3d07", &progToInstMappingV2
 };
 
 /** Information about different Apple IIGS AGI executables. */
 static const IIgsExeInfo IIgsExeInfos[] = {
-	{GID_SQ1,      "SQ",   0x1002, 138496, 0x80AD, instSetV1},
-	{GID_LSL1,     "LL",   0x1003, 141003, 0x844E, instSetV2},
-	{GID_AGIDEMO,  "DEMO", 0x1005, 141884, 0x8469, instSetV2},
-	{GID_KQ1,      "KQ",   0x1006, 141894, 0x8469, instSetV2},
-	{GID_PQ1,      "PQ",   0x1007, 141882, 0x8469, instSetV2},
-	{GID_MIXEDUP,  "MG",   0x1013, 142552, 0x84B7, instSetV2},
-	{GID_KQ2,      "KQ2",  0x1013, 143775, 0x84B7, instSetV2},
-	{GID_KQ3,      "KQ3",  0x1014, 144312, 0x84B7, instSetV2},
-	{GID_SQ2,      "SQ2",  0x1014, 107882, 0x6563, instSetV2},
-	{GID_MH1,      "MH",   0x2004, 147678, 0x8979, instSetV2},
-	{GID_KQ4,      "KQ4",  0x2006, 147652, 0x8979, instSetV2},
-	{GID_BC,       "BC",   0x3001, 148192, 0x8979, instSetV2},
-	{GID_GOLDRUSH, "GR",   0x3003, 148268, 0x8979, instSetV2}
+	{GID_SQ1,      "SQ",   0x1002, 138496, 0x80AD, &instSetV1},
+	{GID_LSL1,     "LL",   0x1003, 141003, 0x844E, &instSetV2},
+	{GID_AGIDEMO,  "DEMO", 0x1005, 141884, 0x8469, &instSetV2},
+	{GID_KQ1,      "KQ",   0x1006, 141894, 0x8469, &instSetV2},
+	{GID_PQ1,      "PQ",   0x1007, 141882, 0x8469, &instSetV2},
+	{GID_MIXEDUP,  "MG",   0x1013, 142552, 0x84B7, &instSetV2},
+	{GID_KQ2,      "KQ2",  0x1013, 143775, 0x84B7, &instSetV2},
+	{GID_KQ3,      "KQ3",  0x1014, 144312, 0x84B7, &instSetV2},
+	{GID_SQ2,      "SQ2",  0x1014, 107882, 0x6563, &instSetV2},
+	{GID_MH1,      "MH",   0x2004, 147678, 0x8979, &instSetV2},
+	{GID_KQ4,      "KQ4",  0x2006, 147652, 0x8979, &instSetV2},
+	{GID_BC,       "BC",   0x3001, 148192, 0x8979, &instSetV2},
+	{GID_GOLDRUSH, "GR",   0x3003, 148268, 0x8979, &instSetV2}
 };
 
 /**
@@ -844,20 +844,20 @@ bool SoundGen2GS::loadInstrumentHeaders(const Common::FSNode &exePath, const IIg
 	file.close();
 
 	// Check that we got enough data to be able to parse the instruments
-	if (data && data->size() >= (int32)(exeInfo.instSetStart + exeInfo.instSet.byteCount)) {
+	if (data && data->size() >= (int32)(exeInfo.instSetStart + exeInfo.instSet->byteCount)) {
 		// Check instrument set's length (The info's saved in the executable)
 		data->seek(exeInfo.instSetStart - 4);
 		uint16 instSetByteCount = data->readUint16LE();
-		if (instSetByteCount != exeInfo.instSet.byteCount) {
+		if (instSetByteCount != exeInfo.instSet->byteCount) {
 			debugC(3, kDebugLevelSound, "Wrong instrument set size (Is %d, should be %d) in Apple IIGS executable (%s)",
-				instSetByteCount, exeInfo.instSet.byteCount, exePath.getPath().c_str());
+				instSetByteCount, exeInfo.instSet->byteCount, exePath.getPath().c_str());
 		}
 
 		// Check instrument set's md5sum
 		data->seek(exeInfo.instSetStart);
 
-		Common::String md5str = Common::computeStreamMD5AsString(*data, exeInfo.instSet.byteCount);
-		if (md5str != exeInfo.instSet.md5) {
+		Common::String md5str = Common::computeStreamMD5AsString(*data, exeInfo.instSet->byteCount);
+		if (md5str != exeInfo.instSet->md5) {
 			warning("Unknown Apple IIGS instrument set (md5: %s) in %s, trying to use it nonetheless",
 				md5str.c_str(), exePath.getPath().c_str());
 		}
@@ -867,20 +867,20 @@ bool SoundGen2GS::loadInstrumentHeaders(const Common::FSNode &exePath, const IIg
 
 		// Load the instruments
 		_instruments.clear();
-		_instruments.reserve(exeInfo.instSet.instCount);
+		_instruments.reserve(exeInfo.instSet->instCount);
 
 		IIgsInstrumentHeader instrument;
-		for (uint i = 0; i < exeInfo.instSet.instCount; i++) {
+		for (uint i = 0; i < exeInfo.instSet->instCount; i++) {
 			if (!instrument.read(*data)) {
 				warning("Error loading Apple IIGS instrument (%d. of %d) from %s, not loading more instruments",
-					i + 1, exeInfo.instSet.instCount, exePath.getPath().c_str());
+					i + 1, exeInfo.instSet->instCount, exePath.getPath().c_str());
 				break;
 			}
 			_instruments.push_back(instrument); // Add the successfully loaded instrument to the instruments array
 		}
 
 		// Loading was successful only if all instruments were loaded successfully
-		loadedOk = (_instruments.size() == exeInfo.instSet.instCount);
+		loadedOk = (_instruments.size() == exeInfo.instSet->instCount);
 	} else // Couldn't read enough data from the executable file
 		warning("Error loading instruments from Apple IIGS executable (%s)", exePath.getPath().c_str());
 
@@ -899,7 +899,7 @@ bool SoundGen2GS::loadWaveFile(const Common::FSNode &wavePath, const IIgsExeInfo
 	if (uint8Wave && uint8Wave->size() == SIERRASTANDARD_SIZE) {
 		// Check wave file's md5sum
 		Common::String md5str = Common::computeStreamMD5AsString(*uint8Wave, SIERRASTANDARD_SIZE);
-		if (md5str != exeInfo.instSet.waveFileMd5) {
+		if (md5str != exeInfo.instSet->waveFileMd5) {
 			warning("Unknown Apple IIGS wave file (md5: %s, game: %s).\n" \
 				"Please report the information on the previous line to the ScummVM team.\n" \
 				"Using the wave file as it is - music may sound weird", md5str.c_str(), exeInfo.exePrefix);
diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h
index 391646d..76f0642 100644
--- a/engines/agi/sound_2gs.h
+++ b/engines/agi/sound_2gs.h
@@ -238,7 +238,7 @@ struct InstrumentSetInfo {
 	uint instCount;          ///< Amount of instrument in the set
 	const char *md5;         ///< MD5 hex digest of the whole instrument set
 	const char *waveFileMd5; ///< MD5 hex digest of the wave file (i.e. the sample data used by the instruments)
-	const MidiProgramChangeMapping &progToInst; ///< Program change to instrument number mapping
+	const MidiProgramChangeMapping *progToInst; ///< Program change to instrument number mapping
 };
 
 /** Apple IIGS AGI executable file information. */
@@ -248,7 +248,7 @@ struct IIgsExeInfo {
 	uint agiVer;                      ///< Apple IIGS AGI version number, not strictly needed
 	uint exeSize;                     ///< Size of the Apple IIGS AGI executable file in bytes
 	uint instSetStart;                ///< Starting offset of the instrument set inside the executable file
-	const InstrumentSetInfo &instSet; ///< Information about the used instrument set
+	const InstrumentSetInfo *instSet; ///< Information about the used instrument set
 };
 
 class IIgsMidiChannel {


Commit: 6eeebfb19125b79e4a77e8c35a0d04cf1a5d97bd
    https://github.com/scummvm/scummvm/commit/6eeebfb19125b79e4a77e8c35a0d04cf1a5d97bd
Author: Max Horn (max at quendi.de)
Date: 2011-04-04T00:56:50-07:00

Commit Message:
SCUMM: Check for cutSceneStackPointer underflows

Changed paths:
    engines/scumm/script.cpp



diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index eac2061..a76461f 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -1283,7 +1283,8 @@ void ScummEngine::beginCutscene(int *args) {
 	int scr = _currentScript;
 	vm.slot[scr].cutsceneOverride++;
 
-	if (++vm.cutSceneStackPointer > ARRAYSIZE(vm.cutSceneData))
+	++vm.cutSceneStackPointer;
+	if (vm.cutSceneStackPointer > ARRAYSIZE(vm.cutSceneData))
 		error("Cutscene stack overflow");
 
 	vm.cutSceneData[vm.cutSceneStackPointer] = args[0];
@@ -1313,6 +1314,9 @@ void ScummEngine::endCutscene() {
 
 	vm.cutSceneScript[vm.cutSceneStackPointer] = 0;
 	vm.cutScenePtr[vm.cutSceneStackPointer] = 0;
+
+	if (0 == vm.cutSceneStackPointer)
+		error("Cutscene stack underflow");
 	vm.cutSceneStackPointer--;
 
 	if (VAR(VAR_CUTSCENE_END_SCRIPT))






More information about the Scummvm-git-logs mailing list