aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorFilippos Karapetis2007-10-28 04:12:01 +0000
committerFilippos Karapetis2007-10-28 04:12:01 +0000
commit59f2a90a6fac7b30441770e498dc2dbd818021d0 (patch)
tree4a5b1d038fc502f1c41479f74071047d1b4e5134 /engines/saga
parent641ff5e9b744922f2631689df19a62d9fad5af08 (diff)
downloadscummvm-rg350-59f2a90a6fac7b30441770e498dc2dbd818021d0.tar.gz
scummvm-rg350-59f2a90a6fac7b30441770e498dc2dbd818021d0.tar.bz2
scummvm-rg350-59f2a90a6fac7b30441770e498dc2dbd818021d0.zip
Cleanup of the engine detection code. Possibly fixes bug #1804403 - "IHNM/ITE: Error loading Game resources (fs-node regression)"
svn-id: r29273
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/detection.cpp20
-rw-r--r--engines/saga/rscfile.cpp99
2 files changed, 70 insertions, 49 deletions
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index 29ca0e8bbe..2ca1ae4482 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -155,26 +155,6 @@ bool SagaEngine::initGame() {
_displayClip.right = getDisplayInfo().logicalWidth;
_displayClip.bottom = getDisplayInfo().logicalHeight;
- if (Common::File::exists("graphics/credit3n.dlt")) {
- _gf_wyrmkeep = true;
- }
-
- // If a compressed sound file is found in the game's directory, set the compressed flag to 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/rscfile.cpp b/engines/saga/rscfile.cpp
index e47b8e86c1..87b4c53f18 100644
--- a/engines/saga/rscfile.cpp
+++ b/engines/saga/rscfile.cpp
@@ -360,6 +360,11 @@ bool Resource::createContexts() {
bool censoredVersion = false;
uint16 voiceFileType = GAME_VOICEFILE;
+ // If the Wyrmkeep credits file is found, set the Wyrmkeep version flag to true
+ if (Common::File::exists("graphics/credit3n.dlt")) {
+ _vm->_gf_wyrmkeep = true;
+ }
+
_contextsCount = 0;
for (i = 0; _vm->getFilesDescriptions()[i].fileName; i++) {
_contextsCount++;
@@ -375,17 +380,21 @@ bool Resource::createContexts() {
if (Common::File::exists("sounds.rsc") || Common::File::exists("sounds.cmp")) {
_contextsCount++;
soundFileIndex = _contextsCount - 1;
- if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
- sprintf(soundFileName, "sounds.cmp");
- else
+ if (Common::File::exists("sounds.rsc")) {
sprintf(soundFileName, "sounds.rsc");
+ } else {
+ sprintf(soundFileName, "sounds.cmp");
+ _vm->_gf_compressed_sounds = true;
+ }
} else if (Common::File::exists("soundsd.rsc") || Common::File::exists("soundsd.cmp")) {
_contextsCount++;
soundFileIndex = _contextsCount - 1;
- if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
- sprintf(soundFileName, "soundsd.cmp");
- else
+ if (Common::File::exists("soundsd.rsc")) {
sprintf(soundFileName, "soundsd.rsc");
+ } else {
+ sprintf(soundFileName, "soundsd.cmp");
+ _vm->_gf_compressed_sounds = true;
+ }
} else {
// No sound file found, don't add any file to the array
soundFileInArray = true;
@@ -397,10 +406,12 @@ bool Resource::createContexts() {
if (Common::File::exists("sfx.res") || Common::File::exists("sfx.cmp")) {
_contextsCount++;
soundFileIndex = _contextsCount - 1;
- if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
+ if (Common::File::exists("sfx.rsc")) {
+ sprintf(soundFileName, "sfx.rsc");
+ } else {
sprintf(soundFileName, "sfx.cmp");
- else
- sprintf(soundFileName, "sfx.res");
+ _vm->_gf_compressed_sounds = true;
+ }
} else {
// No sound file found, don't add any file to the array
soundFileInArray = true;
@@ -414,30 +425,56 @@ bool Resource::createContexts() {
if (Common::File::exists("voices.rsc") || Common::File::exists("voices.cmp")) {
_contextsCount++;
voicesFileIndex = _contextsCount - 1;
- if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
- sprintf(voicesFileName, "voices.cmp");
- else
+ if (Common::File::exists("voices.rsc")) {
sprintf(voicesFileName, "voices.rsc");
+ } else {
+ sprintf(voicesFileName, "voices.cmp");
+ _vm->_gf_compressed_sounds = true;
+ }
} else if (Common::File::exists("voicesd.rsc") || Common::File::exists("voicesd.cmp")) {
_contextsCount++;
voicesFileIndex = _contextsCount - 1;
- if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
- sprintf(voicesFileName, "voicesd.cmp");
- else
+ if (Common::File::exists("voicesd.rsc")) {
sprintf(voicesFileName, "voicesd.rsc");
+ } else {
+ sprintf(voicesFileName, "voicesd.cmp");
+ _vm->_gf_compressed_sounds = true;
+ }
+#ifndef __amigaos4__
} else if (Common::File::exists("inherit the earth voices") ||
Common::File::exists("inherit the earth voices.cmp")) {
+
_contextsCount++;
voicesFileIndex = _contextsCount - 1;
- if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
- sprintf(voicesFileName, "inherit the earth voices.cmp");
- else
+ if (Common::File::exists("inherit the earth voices")) {
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
+ } else {
+ sprintf(voicesFileName, "inherit the earth voices.cmp");
+ _vm->_gf_compressed_sounds = true;
+ }
+ // 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
+ } else if (Common::File::exists("\"inherit the earth voices\"") ||
+ Common::File::exists("\"inherit the earth voices.cmp\"")) {
+
+ _contextsCount++;
+ voicesFileIndex = _contextsCount - 1;
+ if (Common::File::exists("\"inherit the earth voices\"")) {
+ sprintf(voicesFileName, "\"inherit the earth voices\"");
+ } else {
+ sprintf(voicesFileName, "\"inherit the earth voices.cmp\"");
+ _vm->_gf_compressed_sounds = true;
+ }
+ // 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
+#endif
} else {
// No voice file found, don't add any file to the array
voicesFileInArray = true;
@@ -458,17 +495,21 @@ bool Resource::createContexts() {
_contextsCount += 5; // voices1-voices3, voices4-voices5
censoredVersion = true;
}
- if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
- sprintf(voicesFileName, "voicess.cmp");
- else
+ if (Common::File::exists("voicess.res")) {
sprintf(voicesFileName, "voicess.res");
+ } else {
+ sprintf(voicesFileName, "voicess.cmp");
+ _vm->_gf_compressed_sounds = true;
+ }
} 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
+ if (Common::File::exists("voicesd.res")) {
sprintf(voicesFileName, "voicesd.res");
+ } else {
+ sprintf(voicesFileName, "voicesd.cmp");
+ _vm->_gf_compressed_sounds = true;
+ }
} else {
// No voice file found, don't add any file to the array
voicesFileInArray = true;