[Scummvm-cvs-logs] scummvm master -> ab612df33854c74eae7dab6f2cda78588313ddbc

Strangerke Strangerke at scummvm.org
Tue Sep 8 07:47:28 CEST 2015


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:
ab612df338 MORTEVIELLE: Fix a couple of crashes occurring in the alternate DOS version


Commit: ab612df33854c74eae7dab6f2cda78588313ddbc
    https://github.com/scummvm/scummvm/commit/ab612df33854c74eae7dab6f2cda78588313ddbc
Author: Strangerke (strangerke at scummvm.org)
Date: 2015-09-08T07:43:30+02:00

Commit Message:
MORTEVIELLE: Fix a couple of crashes occurring in the alternate DOS version

Changed paths:
    engines/mortevielle/sound.cpp
    engines/mortevielle/utils.cpp



diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp
index 23ca9d8..70fb6f8 100644
--- a/engines/mortevielle/sound.cpp
+++ b/engines/mortevielle/sound.cpp
@@ -139,22 +139,46 @@ void SoundManager::loadAmbiantSounds() {
  * @remarks	Originally called 'charge_bruit' and 'charge_bruit5'
  */
 void SoundManager::loadNoise() {
-	Common::File f1, f2;
+	Common::File f1, f5;
 
-	if (!f1.open("bruits"))               //Translation: "noise"
-		error("Missing file - bruits");
-	if (!f2.open("bruit5"))
+	if (!f5.open("bruit5"))
 		error("Missing file - bruit5");
 
-	_noiseBuf = (byte *)malloc(sizeof(byte) * (f1.size() + f2.size()));
-	assert(f1.size() > 32000);
+	if (f1.open("bruits")) { //Translation: "noise"
+		error("Missing file - bruits");
+
+		assert(f1.size() > 32000);
+		_noiseBuf = (byte *)malloc(sizeof(byte) * (f1.size() + f5.size()));
 
-	f1.read(_noiseBuf, 32000); // 250 * 128
-	f2.read(&_noiseBuf[32000], f2.size());
-	f1.read(&_noiseBuf[32000 + f2.size()], f1.size() - 32000); // 19072
+		f1.read(_noiseBuf, 32000); // 250 * 128
+		f5.read(&_noiseBuf[32000], f5.size());
+		f1.read(&_noiseBuf[32000 + f5.size()], f1.size() - 32000); // 19072
 
-	f1.close();
-	f2.close();
+		f1.close();
+	} else {
+		Common::File f2, f3, f4;
+		if (!f1.open("bruit1") || !f2.open("bruit2") || !f3.open("bruit3") || !f4.open("bruit4"))
+			error("Missing file - bruits");
+
+		assert(f4.size() == 32000);
+		_noiseBuf = (byte *)malloc(sizeof(byte) * (f1.size() + f2.size() + f3.size() + f4.size() + f5.size()));
+
+		f4.read(_noiseBuf, f4.size());
+		int pos = f4.size();
+		f5.read(&_noiseBuf[pos], f5.size());
+		pos += f5.size();
+		f1.read(&_noiseBuf[pos], f1.size());
+		pos += f1.size();
+		f2.read(&_noiseBuf[pos], f2.size());
+		pos += f2.size();
+		f3.read(&_noiseBuf[pos], f3.size());
+
+		f1.close();
+		f2.close();
+		f3.close();
+		f4.close();
+	}
+	f5.close();
 }
 
 void SoundManager::regenbruit() {
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index 5137e18..cbc22e4 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -2115,8 +2115,12 @@ void MortevielleEngine::music() {
 	_reloadCFIEC = true;
 
 	Common::File f;
-	if (!f.open("mort.img"))
-		error("Missing file - mort.img");
+	if (!f.open("mort.img")) {
+		// Some DOS versions use MORTP2 instead of MORT.IMG
+		// Some have both and they are identical
+		if (!f.open("mortp2"))
+			error("Missing file - mort.img");
+	}
 
 	int size = f.size();
 	byte *compMusicBuf = (byte *)malloc(sizeof(byte) * size);






More information about the Scummvm-git-logs mailing list