diff options
-rw-r--r-- | engines/saga/detection.cpp | 19 | ||||
-rw-r--r-- | engines/saga/detection_tables.h | 95 | ||||
-rw-r--r-- | engines/saga/rscfile.cpp | 87 | ||||
-rw-r--r-- | engines/saga/sndres.cpp | 10 |
4 files changed, 133 insertions, 78 deletions
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index 7f154afbda..d5e12a66f3 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -150,11 +150,20 @@ bool SagaEngine::initGame() { } // If a compressed sound file is found in the game's directory, set the compressed flag to true - if (Common::File::exists("sounds.cmp") || Common::File::exists("soundsd.cmp") || - Common::File::exists("voices.cmp") || Common::File::exists("voicesd.cmp") || - Common::File::exists("inherit the earth voices.cmp")) { - _gf_compressed_sounds = true; - } + if (_gameDescription->gameType == GType_ITE) { + if (Common::File::exists("sounds.cmp") || Common::File::exists("soundsd.cmp") || + Common::File::exists("voices.cmp") || Common::File::exists("voicesd.cmp") || + Common::File::exists("inherit the earth voices.cmp")) { + _gf_compressed_sounds = true; + } + } else { + if (Common::File::exists("voicess.cmp") || Common::File::exists("voices1.cmp") || + Common::File::exists("voices2.cmp") || Common::File::exists("voices3.cmp") || + Common::File::exists("voices4.cmp") || Common::File::exists("voices5.cmp") || + Common::File::exists("voices6.cmp") || Common::File::exists("voicesd.cmp")) { + _gf_compressed_sounds = true; + } + } return _resource->createContexts(); } diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h index c4bd4fd7b3..4bcbb004a0 100644 --- a/engines/saga/detection_tables.h +++ b/engines/saga/detection_tables.h @@ -65,15 +65,6 @@ static const GameFontDescription ITEDEMO_GameFonts[] = { {1} }; -static const GameSoundInfo ITEDEMO_GameSound = { - kSoundVOC, - -1, - -1, - false, - false, - true -}; - // Inherit the Earth - Wyrmkeep Win32 Demo version static const GameFontDescription ITEWINDEMO_GameFonts[] = { @@ -136,16 +127,6 @@ static const GameSoundInfo ITEMACDEMO_GameMusic = { true }; -// Inherit the Earth - Wyrmkeep Linux Demo version -static const GameSoundInfo ITELINDEMO_GameMusic = { - kSoundPCM, - 11025, - 16, - true, - false, - true -}; - static const GameSoundInfo ITEMACCD_G_GameSound = { kSoundMacPCM, 22050, @@ -336,7 +317,7 @@ static const SAGAGameDescription gameDescriptions[] = { {"ite.rsc", GAME_RESOURCEFILE, "986c79c4d2939dbe555576529fd37932", -1}, //{"ite.dmo", GAME_DEMOFILE}, "0b9a70eb4e120b6f00579b46c8cae29e" {"scripts.rsc", GAME_SCRIPTFILE, "d5697dd3240a3ceaddaa986c47e1a2d7", -1}, - {"voices.rsc", GAME_SOUNDFILE | GAME_VOICEFILE, "c58e67c506af4ffa03fd0aac2079deb0", -1}, + //{"voices.rsc", GAME_SOUNDFILE | GAME_VOICEFILE, "c58e67c506af4ffa03fd0aac2079deb0", -1}, { NULL, 0, NULL, 0} }, Common::EN_ANY, @@ -350,8 +331,8 @@ static const SAGAGameDescription gameDescriptions[] = { &ITEDemo_Resources, ARRAYSIZE(ITEDEMO_GameFonts), ITEDEMO_GameFonts, - &ITEDEMO_GameSound, - &ITEDEMO_GameSound, + &ITEDISK_GameSound, + &ITEDISK_GameSound, &ITEMACCD_GameMusic, // note: this version did not originally have digital music 0, NULL, @@ -452,7 +433,7 @@ static const SAGAGameDescription gameDescriptions[] = { ITEWINDEMO_GameFonts, &ITEWINDEMO2_GameVoice, &ITEWINDEMO2_GameSound, - &ITELINDEMO_GameMusic, + &ITEMACCD_GameMusic, ARRAYSIZE(ITEPatch_Files), ITEPatch_Files, }, @@ -769,7 +750,7 @@ static const SAGAGameDescription gameDescriptions[] = { {"scream.res", GAME_RESOURCEFILE, "46bbdc65d164ba7e89836a0935eec8e6", -1}, {"scripts.res", GAME_SCRIPTFILE, "9626bda8978094ff9b29198bc1ed5f9a", -1}, {"sfx.res", GAME_SOUNDFILE, "1c610d543f32ec8b525e3f652536f269", -1}, - {"voicesd.res", GAME_VOICEFILE, "3bbc16a8f741dbb511da506c660a0b54", -1}, + //{"voicesd.res", GAME_VOICEFILE, "3bbc16a8f741dbb511da506c660a0b54", -1}, { NULL, 0, NULL, 0} }, Common::EN_ANY, @@ -802,13 +783,13 @@ static const SAGAGameDescription gameDescriptions[] = { {"patch.re_", GAME_PATCHFILE | GAME_RESOURCEFILE, "58b79e61594779513c7f2d35509fa89e", -1}, {"scripts.res", GAME_SCRIPTFILE, "be38bbc5a26be809dbf39f13befebd01", -1}, {"sfx.res", GAME_SOUNDFILE, "1c610d543f32ec8b525e3f652536f269", -1}, - {"voicess.res", GAME_VOICEFILE, "54b1f2013a075338ceb0e258d97808bd", -1}, //order of voice bank file is important - {"voices1.res", GAME_VOICEFILE, "fc6440b38025f4b2cc3ff55c3da5c3eb", -1}, - {"voices2.res", GAME_VOICEFILE, "b37f10fd1696ade7d58704ccaaebceeb", -1}, - {"voices3.res", GAME_VOICEFILE, "3bbc16a8f741dbb511da506c660a0b54", -1}, - {"voices4.res", GAME_VOICEFILE, "ebfa160122d2247a676ca39920e5d481", -1}, - {"voices5.res", GAME_VOICEFILE, "1f501ce4b72392bdd1d9ec38f6eec6da", -1}, - {"voices6.res", GAME_VOICEFILE, "f580ed7568c7d6ef34e934ba20adf834", -1}, + //{"voicess.res", GAME_VOICEFILE, "54b1f2013a075338ceb0e258d97808bd", -1}, //order of voice bank file is important + //{"voices1.res", GAME_VOICEFILE, "fc6440b38025f4b2cc3ff55c3da5c3eb", -1}, + //{"voices2.res", GAME_VOICEFILE, "b37f10fd1696ade7d58704ccaaebceeb", -1}, + //{"voices3.res", GAME_VOICEFILE, "3bbc16a8f741dbb511da506c660a0b54", -1}, + //{"voices4.res", GAME_VOICEFILE, "ebfa160122d2247a676ca39920e5d481", -1}, + //{"voices5.res", GAME_VOICEFILE, "1f501ce4b72392bdd1d9ec38f6eec6da", -1}, + //{"voices6.res", GAME_VOICEFILE, "f580ed7568c7d6ef34e934ba20adf834", -1}, { NULL, 0, NULL, 0} }, Common::EN_ANY, @@ -843,12 +824,12 @@ static const SAGAGameDescription gameDescriptions[] = { {"scripts.res", GAME_SCRIPTFILE, "32aa01a89937520fe0ea513950117292", -1}, {"patch.re_", GAME_PATCHFILE | GAME_RESOURCEFILE, "58b79e61594779513c7f2d35509fa89e", -1}, {"sfx.res", GAME_SOUNDFILE, "1c610d543f32ec8b525e3f652536f269", -1}, - {"voicess.res", GAME_VOICEFILE, "8b09a196a52627cacb4eab13bfe0b2c3", -1}, //order of voice bank file is important - {"voices1.res", GAME_VOICEFILE, "424971e1e2373187c3f5734fe36071a2", -1}, - {"voices2.res", GAME_VOICEFILE, "c270e0980782af43641a86e4a14e2a32", -1}, - {"voices3.res", GAME_VOICEFILE, "49e42befea883fd101ec3d0f5d0647b9", -1}, - {"voices5.res", GAME_VOICEFILE, "c477443c52a0aa56e686ebd8d051e4ab", -1}, - {"voices6.res", GAME_VOICEFILE, "2b9aea838f74b4eecfb29a8f205a2bd4", -1}, + //{"voicess.res", GAME_VOICEFILE, "8b09a196a52627cacb4eab13bfe0b2c3", -1}, //order of voice bank file is important + //{"voices1.res", GAME_VOICEFILE, "424971e1e2373187c3f5734fe36071a2", -1}, + //{"voices2.res", GAME_VOICEFILE, "c270e0980782af43641a86e4a14e2a32", -1}, + //{"voices3.res", GAME_VOICEFILE, "49e42befea883fd101ec3d0f5d0647b9", -1}, + //{"voices5.res", GAME_VOICEFILE, "c477443c52a0aa56e686ebd8d051e4ab", -1}, + //{"voices6.res", GAME_VOICEFILE, "2b9aea838f74b4eecfb29a8f205a2bd4", -1}, { NULL, 0, NULL, 0} }, Common::DE_DEU, @@ -881,13 +862,13 @@ static const SAGAGameDescription gameDescriptions[] = { {"patch.re_", GAME_PATCHFILE | GAME_RESOURCEFILE, "58b79e61594779513c7f2d35509fa89e", -1}, {"scripts.res", GAME_SCRIPTFILE, "be38bbc5a26be809dbf39f13befebd01", -1}, {"sfx.res", GAME_SOUNDFILE, "1c610d543f32ec8b525e3f652536f269", -1}, - {"voicess.res", GAME_VOICEFILE, "d869de9883c8faea7f687217a9ec7057", -1}, //order of voice bank file is important - {"voices1.res", GAME_VOICEFILE, "dc6a34e3d1668730ea46815a92c7847f", -1}, - {"voices2.res", GAME_VOICEFILE, "dc6a5fa7a4cdc2ca5a6fd924e969986c", -1}, - {"voices3.res", GAME_VOICEFILE, "dc6a5fa7a4cdc2ca5a6fd924e969986c", -1}, - {"voices4.res", GAME_VOICEFILE, "0f87400b804232a58dd22e404420cc45", -1}, - {"voices5.res", GAME_VOICEFILE, "172668cfc5d8c305cb5b1a9b4d995fc0", -1}, - {"voices6.res", GAME_VOICEFILE, "96c9bda9a5f41d6bc232ed7bf6d371d9", -1}, + //{"voicess.res", GAME_VOICEFILE, "d869de9883c8faea7f687217a9ec7057", -1}, //order of voice bank file is important + //{"voices1.res", GAME_VOICEFILE, "dc6a34e3d1668730ea46815a92c7847f", -1}, + //{"voices2.res", GAME_VOICEFILE, "dc6a5fa7a4cdc2ca5a6fd924e969986c", -1}, + //{"voices3.res", GAME_VOICEFILE, "dc6a5fa7a4cdc2ca5a6fd924e969986c", -1}, + //{"voices4.res", GAME_VOICEFILE, "0f87400b804232a58dd22e404420cc45", -1}, + //{"voices5.res", GAME_VOICEFILE, "172668cfc5d8c305cb5b1a9b4d995fc0", -1}, + //{"voices6.res", GAME_VOICEFILE, "96c9bda9a5f41d6bc232ed7bf6d371d9", -1}, { NULL, 0, NULL, 0} }, Common::ES_ESP, @@ -920,13 +901,13 @@ static const SAGAGameDescription gameDescriptions[] = { {"patch.re_", GAME_PATCHFILE | GAME_RESOURCEFILE, "58b79e61594779513c7f2d35509fa89e", -1}, {"scripts.res", GAME_SCRIPTFILE, "be38bbc5a26be809dbf39f13befebd01", -1}, {"sfx.res", GAME_SOUNDFILE, "1c610d543f32ec8b525e3f652536f269", -1}, - {"voicess.res", GAME_VOICEFILE, "9df7cd3b18ddaa16b5291b3432567036", -1}, //order of voice bank file is important - {"voices1.res", GAME_VOICEFILE, "d6100d2dc3b2b9f2e1ad247f613dce9b", -1}, - {"voices2.res", GAME_VOICEFILE, "84f6f48ecc2832841ea6417a9a379430", -1}, - {"voices3.res", GAME_VOICEFILE, "ebb9501283047f27a0f54e27b3c8ba1e", -1}, - {"voices4.res", GAME_VOICEFILE, "4c145da5fa6d1306162a7ca8ce5a4f2e", -1}, - {"voices5.res", GAME_VOICEFILE, "871a559644281917677eca4af1b05620", -1}, - {"voices6.res", GAME_VOICEFILE, "211be5c24f066d69a2f6cfa953acfba6", -1}, + //{"voicess.res", GAME_VOICEFILE, "9df7cd3b18ddaa16b5291b3432567036", -1}, //order of voice bank file is important + //{"voices1.res", GAME_VOICEFILE, "d6100d2dc3b2b9f2e1ad247f613dce9b", -1}, + //{"voices2.res", GAME_VOICEFILE, "84f6f48ecc2832841ea6417a9a379430", -1}, + //{"voices3.res", GAME_VOICEFILE, "ebb9501283047f27a0f54e27b3c8ba1e", -1}, + //{"voices4.res", GAME_VOICEFILE, "4c145da5fa6d1306162a7ca8ce5a4f2e", -1}, + //{"voices5.res", GAME_VOICEFILE, "871a559644281917677eca4af1b05620", -1}, + //{"voices6.res", GAME_VOICEFILE, "211be5c24f066d69a2f6cfa953acfba6", -1}, { NULL, 0, NULL, 0} }, Common::RU_RUS, @@ -959,12 +940,12 @@ static const SAGAGameDescription gameDescriptions[] = { {"scripts.res", GAME_SCRIPTFILE, "32aa01a89937520fe0ea513950117292", -1}, {"patch.re_", GAME_PATCHFILE | GAME_RESOURCEFILE, "58b79e61594779513c7f2d35509fa89e", -1}, {"sfx.res", GAME_SOUNDFILE, "1c610d543f32ec8b525e3f652536f269", -1}, - {"voicess.res", GAME_VOICEFILE, "b8642e943bbebf89cef2f48b31cb4305", -1}, //order of voice bank file is important - {"voices1.res", GAME_VOICEFILE, "424971e1e2373187c3f5734fe36071a2", -1}, - {"voices2.res", GAME_VOICEFILE, "c2d93a35d2c2def9c3d6d242576c794b", -1}, - {"voices3.res", GAME_VOICEFILE, "49e42befea883fd101ec3d0f5d0647b9", -1}, - {"voices5.res", GAME_VOICEFILE, "f4c415de7c03de86b73f9a12b8bd632f", -1}, - {"voices6.res", GAME_VOICEFILE, "3fc5358a5d8eee43bdfab2740276572e", -1}, + //{"voicess.res", GAME_VOICEFILE, "b8642e943bbebf89cef2f48b31cb4305", -1}, //order of voice bank file is important + //{"voices1.res", GAME_VOICEFILE, "424971e1e2373187c3f5734fe36071a2", -1}, + //{"voices2.res", GAME_VOICEFILE, "c2d93a35d2c2def9c3d6d242576c794b", -1}, + //{"voices3.res", GAME_VOICEFILE, "49e42befea883fd101ec3d0f5d0647b9", -1}, + //{"voices5.res", GAME_VOICEFILE, "f4c415de7c03de86b73f9a12b8bd632f", -1}, + //{"voices6.res", GAME_VOICEFILE, "3fc5358a5d8eee43bdfab2740276572e", -1}, { NULL, 0, NULL, 0} }, Common::FR_FRA, diff --git a/engines/saga/rscfile.cpp b/engines/saga/rscfile.cpp index 0aa7e2eafe..4d3ff1e47c 100644 --- a/engines/saga/rscfile.cpp +++ b/engines/saga/rscfile.cpp @@ -353,6 +353,8 @@ bool Resource::createContexts() { bool digitalMusic = false; bool soundFileInArray = false; bool voicesFileInArray = false; + bool multipleVoices = false; + bool censoredVersion = false; uint16 voiceFileType = GAME_VOICEFILE; _contextsCount = 0; @@ -364,8 +366,8 @@ bool Resource::createContexts() { voicesFileInArray = true; } - if (_vm->getGameType() == GType_ITE) { - if (!soundFileInArray) { + if (!soundFileInArray) { + if (_vm->getGameType() == GType_ITE) { // If the sound file is not specified in the detector table, add it here if (Common::File::exists("sounds.rsc") || Common::File::exists("sounds.cmp")) { _contextsCount++; @@ -387,9 +389,24 @@ bool Resource::createContexts() { // ITE floppy versions have both voices and sounds in voices.rsc voiceFileType = GAME_SOUNDFILE | GAME_VOICEFILE; } + } else { + // If the sound file is not specified in the detector table, add it here + if (Common::File::exists("sfx.res") || Common::File::exists("sfx.cmp")) { + _contextsCount++; + soundFileIndex = _contextsCount - 1; + if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS) + sprintf(soundFileName, "sfx.cmp"); + else + sprintf(soundFileName, "sfx.res"); + } else { + // No sound file found, don't add any file to the array + soundFileInArray = true; + } } + } - if (!voicesFileInArray) { + if (!voicesFileInArray) { + if (_vm->getGameType() == GType_ITE) { // If the voices file is not specified in the detector table, add it here if (Common::File::exists("voices.rsc") || Common::File::exists("voices.cmp")) { _contextsCount++; @@ -413,18 +430,50 @@ bool Resource::createContexts() { sprintf(voicesFileName, "inherit the earth voices.cmp"); else sprintf(voicesFileName, "inherit the earth voices"); - - // The resources in the Wyrmkeep combined Windows/Mac/Linux CD version are little endian, but - // the voice file is big endian. If we got such a version with mixed files, mark this voice file - // as big endian - if (!_vm->isBigEndian()) - voiceFileType = GAME_VOICEFILE | GAME_SWAPENDIAN; // This file is big endian + // The resources in the Wyrmkeep combined Windows/Mac/Linux CD version are little endian, but + // the voice file is big endian. If we got such a version with mixed files, mark this voice file + // as big endian + if (!_vm->isBigEndian()) + voiceFileType = GAME_VOICEFILE | GAME_SWAPENDIAN; // This file is big endian + } else { + // No voice file found, don't add any file to the array + voicesFileInArray = true; + } + } else { + // If the voices file is not specified in the detector table, add it here + if (Common::File::exists("voicess.res") || Common::File::exists("voicess.cmp")) { + _contextsCount++; + voicesFileIndex = _contextsCount - 1; + // IHNM has multiple voice files + multipleVoices = true; + // Note: it is assumed that the voices are always last in the list + if (Common::File::exists("voices4.res") || Common::File::exists("voices4.cmp")) { + _contextsCount += 6; // voices1-voices6 + } else { + // The German and French versions of IHNM don't have Nimdok's chapter, therefore the voices file + // for that chapter is missing + _contextsCount += 5; // voices1-voices3, voices4-voices5 + censoredVersion = true; + } + if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS) + sprintf(voicesFileName, "voicess.cmp"); + else + sprintf(voicesFileName, "voicess.res"); + } else if (Common::File::exists("voicesd.res") || Common::File::exists("voicesd.cmp")) { + _contextsCount++; + voicesFileIndex = _contextsCount - 1; + if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS) + sprintf(voicesFileName, "voicesd.cmp"); + else + sprintf(voicesFileName, "voicesd.res"); } else { // No voice file found, don't add any file to the array voicesFileInArray = true; } } + } + if (_vm->getGameType() == GType_ITE) { // Check for digital music in ITE if (Common::File::exists("music.rsc") || Common::File::exists("music.cmp")) { _contextsCount++; @@ -455,16 +504,28 @@ bool Resource::createContexts() { if (_vm->getGameType() == GType_ITE && digitalMusic && i == _contextsCount - 1) { context->fileName = musicFileName; context->fileType = GAME_MUSICFILE; - } else if (_vm->getGameType() == GType_ITE && !soundFileInArray && i == soundFileIndex) { + } else if (!soundFileInArray && i == soundFileIndex) { context->fileName = soundFileName; context->fileType = GAME_SOUNDFILE; - } else if (_vm->getGameType() == GType_ITE && !voicesFileInArray && i == voicesFileIndex) { + } else if (!voicesFileInArray && i == voicesFileIndex) { context->fileName = voicesFileName; // can be GAME_VOICEFILE or GAME_SOUNDFILE | GAME_VOICEFILE or GAME_VOICEFILE | GAME_SWAPENDIAN context->fileType = voiceFileType; } else { - context->fileName = _vm->getFilesDescriptions()[i].fileName; - context->fileType = _vm->getFilesDescriptions()[i].fileType; + if (!(!voicesFileInArray && multipleVoices && (i > voicesFileIndex))) { + context->fileName = _vm->getFilesDescriptions()[i].fileName; + context->fileType = _vm->getFilesDescriptions()[i].fileType; + } else { + int token = (censoredVersion && (i - voicesFileIndex >= 4)) ? 1 : 0; // censored versions don't have voice4 + + if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS) + sprintf(voicesFileName, "voices%i.cmp", i - voicesFileIndex + token); + else + sprintf(voicesFileName, "voices%i.res", i - voicesFileIndex + token); + + context->fileName = voicesFileName; + context->fileType = GAME_VOICEFILE; + } } context->serial = 0; diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 3f1957b9c5..edbdebabab 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -182,13 +182,17 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff resourceType = kSoundWAV; } - bool patchedSound = false; + bool uncompressedSound = false; // If a patch file exists for sound resource 4 (used in ITE intro), don't treat this sound as compressed if (_vm->getGameType() == GType_ITE && resourceId == 4 && (Common::File::exists("sound/p2_a.iaf") || Common::File::exists("sound/p2_a.voc"))) - patchedSound = true; + uncompressedSound = true; - if ((_vm->getFeatures() & GF_COMPRESSED_SOUNDS) && !patchedSound) { + // FIXME: Currently, the SFX.RES file in IHNM cannot be compressed + if (_vm->getGameType() == GType_IHNM && (context->fileType & GAME_SOUNDFILE)) + uncompressedSound = true; + + if ((_vm->getFeatures() & GF_COMPRESSED_SOUNDS) && !uncompressedSound) { if (soundResource[0] == char(0)) { resourceType = kSoundMP3; } else if (soundResource[0] == char(1)) { |