diff options
author | Strangerke | 2015-09-08 07:43:30 +0200 |
---|---|---|
committer | Strangerke | 2015-09-08 07:43:30 +0200 |
commit | ab612df33854c74eae7dab6f2cda78588313ddbc (patch) | |
tree | 2039ce9881422ea815f58565f14f250e5760857b /engines | |
parent | 35b27e6986725d20d83da4d9ff773196a9115ee8 (diff) | |
download | scummvm-rg350-ab612df33854c74eae7dab6f2cda78588313ddbc.tar.gz scummvm-rg350-ab612df33854c74eae7dab6f2cda78588313ddbc.tar.bz2 scummvm-rg350-ab612df33854c74eae7dab6f2cda78588313ddbc.zip |
MORTEVIELLE: Fix a couple of crashes occurring in the alternate DOS version
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mortevielle/sound.cpp | 46 | ||||
-rw-r--r-- | engines/mortevielle/utils.cpp | 8 |
2 files changed, 41 insertions, 13 deletions
diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index 23ca9d89b4..70fb6f8759 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 5137e1892b..cbc22e4886 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); |