mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 07:53:12 +00:00
Rewrote and greatly simplified the SAGA detector, removing many duplicate and unneeded entries
- Digital music will now always be enabled for all versions if the digital music file is present. The duplicate game entries with and without this file have been removed - Changed the way compressed sound files are detected. All the duplicate compressed sound entries have been removed - The Wyrmkeep Windows CD version is now properly distinguished from the DOS CD version - Unified all the different patch file entries (apart from the Mac patch file entries, which are of a different type). If a patch file is not found, it's ignored svn-id: r28058
This commit is contained in:
parent
52f4d0b7d9
commit
eedec897f8
@ -41,7 +41,7 @@ namespace Saga {
|
||||
class HitZone;
|
||||
|
||||
|
||||
// #define ACTOR_DEBUG 1 //only for actor pathfinding debug!
|
||||
#define ACTOR_DEBUG 1 //only for actor pathfinding debug!
|
||||
|
||||
#define ACTOR_BARRIERS_MAX 16
|
||||
|
||||
|
@ -69,7 +69,19 @@ int SagaEngine::getFontsCount() const { return _gameDescription->fontsCount; }
|
||||
|
||||
int SagaEngine::getGameId() const { return _gameDescription->gameId; }
|
||||
int SagaEngine::getGameType() const { return _gameDescription->gameType; }
|
||||
uint32 SagaEngine::getFeatures() const { return _gameDescription->features; }
|
||||
|
||||
uint32 SagaEngine::getFeatures() const {
|
||||
uint32 result = _gameDescription->features;
|
||||
|
||||
if (_gf_wyrmkeep)
|
||||
result |= GF_WYRMKEEP;
|
||||
|
||||
if (_gf_compressed_sounds)
|
||||
result |= GF_COMPRESSED_SOUNDS;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Common::Language SagaEngine::getLanguage() const { return _gameDescription->desc.language; }
|
||||
Common::Platform SagaEngine::getPlatform() const { return _gameDescription->desc.platform; }
|
||||
int SagaEngine::getGameNumber() const { return _gameNumber; }
|
||||
@ -133,6 +145,18 @@ 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 (Common::File::exists("music.cmp") || Common::File::exists("musicd.cmp") ||
|
||||
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;
|
||||
}
|
||||
|
||||
return _resource->createContexts();
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -343,18 +343,136 @@ bool Resource::loadContext(ResourceContext *context) {
|
||||
bool Resource::createContexts() {
|
||||
int i;
|
||||
ResourceContext *context;
|
||||
char musicFileName[256];
|
||||
char soundFileName[256];
|
||||
char voicesFileName[256];
|
||||
int soundFileIndex = 0;
|
||||
int voicesFileIndex = 0;
|
||||
bool digitalMusic = false;
|
||||
bool soundFileInArray = false;
|
||||
bool voicesFileInArray = false;
|
||||
uint16 voiceFileType = GAME_VOICEFILE;
|
||||
|
||||
_contextsCount = 0;
|
||||
for (i = 0; _vm->getFilesDescriptions()[i].fileName; i++)
|
||||
for (i = 0; _vm->getFilesDescriptions()[i].fileName; i++) {
|
||||
_contextsCount++;
|
||||
if (_vm->getFilesDescriptions()[i].fileType == GAME_SOUNDFILE)
|
||||
soundFileInArray = true;
|
||||
if (_vm->getFilesDescriptions()[i].fileType == GAME_VOICEFILE)
|
||||
voicesFileInArray = true;
|
||||
}
|
||||
|
||||
if (_vm->getGameType() == GType_ITE) {
|
||||
if (!soundFileInArray) {
|
||||
// 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++;
|
||||
soundFileIndex = _contextsCount - 1;
|
||||
if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
|
||||
sprintf(soundFileName, "sounds.cmp");
|
||||
else
|
||||
sprintf(soundFileName, "sounds.rsc");
|
||||
} 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
|
||||
sprintf(soundFileName, "soundsd.rsc");
|
||||
} else {
|
||||
// No sound file found, don't add any file to the array
|
||||
soundFileInArray = true;
|
||||
// ITE floppy versions have both voices and sounds in voices.rsc
|
||||
voiceFileType = GAME_SOUNDFILE | GAME_VOICEFILE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!voicesFileInArray) {
|
||||
// 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++;
|
||||
voicesFileIndex = _contextsCount - 1;
|
||||
if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
|
||||
sprintf(voicesFileName, "voices.cmp");
|
||||
else
|
||||
sprintf(voicesFileName, "voices.rsc");
|
||||
} 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
|
||||
sprintf(voicesFileName, "voicesd.rsc");
|
||||
} 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
|
||||
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 {
|
||||
// No voice file found, don't add any file to the array
|
||||
voicesFileInArray = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for digital music in ITE
|
||||
if (Common::File::exists("music.rsc") || Common::File::exists("music.cmp")) {
|
||||
_contextsCount++;
|
||||
digitalMusic = true;
|
||||
if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
|
||||
sprintf(musicFileName, "music.cmp");
|
||||
else
|
||||
sprintf(musicFileName, "music.rsc");
|
||||
} else if (Common::File::exists("musicd.rsc") || Common::File::exists("musicd.cmp")) {
|
||||
_contextsCount++;
|
||||
digitalMusic = true;
|
||||
if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
|
||||
sprintf(musicFileName, "musicd.cmp");
|
||||
else
|
||||
sprintf(musicFileName, "musicd.rsc");
|
||||
} else {
|
||||
digitalMusic = false;
|
||||
}
|
||||
}
|
||||
|
||||
_contexts = (ResourceContext*)calloc(_contextsCount, sizeof(*_contexts));
|
||||
|
||||
for (i = 0; i < _contextsCount; i++) {
|
||||
context = &_contexts[i];
|
||||
context->file = new Common::File();
|
||||
context->fileName = _vm->getFilesDescriptions()[i].fileName;
|
||||
context->fileType = _vm->getFilesDescriptions()[i].fileType;
|
||||
|
||||
// For ITE, add the digital music file and sfx file information here
|
||||
if (_vm->getGameType() == GType_ITE && digitalMusic && i == _contextsCount - 1) {
|
||||
if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
|
||||
context->fileName = musicFileName;
|
||||
else
|
||||
context->fileName = musicFileName;
|
||||
context->fileType = GAME_MUSICFILE;
|
||||
} else if (_vm->getGameType() == GType_ITE && !soundFileInArray && i == soundFileIndex) {
|
||||
if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
|
||||
context->fileName = soundFileName;
|
||||
else
|
||||
context->fileName = soundFileName;
|
||||
context->fileType = GAME_SOUNDFILE;
|
||||
} else if (_vm->getGameType() == GType_ITE && !voicesFileInArray && i == voicesFileIndex) {
|
||||
if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS)
|
||||
context->fileName = voicesFileName;
|
||||
else
|
||||
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;
|
||||
}
|
||||
context->serial = 0;
|
||||
|
||||
// IHNM has serveral different voice files, so we need to allow
|
||||
|
@ -107,7 +107,6 @@ SagaEngine::SagaEngine(OSystem *syst)
|
||||
// Mac CD Wyrmkeep
|
||||
Common::File::addDefaultDirectory(_gameDataPath + "patch/");
|
||||
|
||||
|
||||
// Setup mixer
|
||||
if (!_mixer->isReady()) {
|
||||
warning("Sound initialization failed.");
|
||||
@ -150,6 +149,8 @@ int SagaEngine::init() {
|
||||
_subtitlesEnabled = ConfMan.getBool("subtitles");
|
||||
_readingSpeed = getTalkspeed();
|
||||
_copyProtection = ConfMan.getBool("copy_protection");
|
||||
_gf_wyrmkeep = false;
|
||||
_gf_compressed_sounds = false;
|
||||
|
||||
if (_readingSpeed > 3)
|
||||
_readingSpeed = 0;
|
||||
|
@ -527,6 +527,8 @@ public:
|
||||
int _readingSpeed;
|
||||
|
||||
bool _copyProtection;
|
||||
bool _gf_wyrmkeep;
|
||||
bool _gf_compressed_sounds;
|
||||
|
||||
SndRes *_sndRes;
|
||||
Sound *_sound;
|
||||
|
Loading…
x
Reference in New Issue
Block a user