From a6efbf8880d56680e5503bcf1f68fdf2c9ef9156 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 1 Jun 2010 22:06:52 +0000 Subject: Fixed the detection of SCI2.1 games in the fallback detector svn-id: r49382 --- engines/sci/detection.cpp | 18 ++++++++++++-- engines/sci/resource.cpp | 60 ++++++++++++++++++++++++++++------------------- engines/sci/resource.h | 6 ++--- 3 files changed, 55 insertions(+), 29 deletions(-) diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 06a83a98dc..dbd65c7aaa 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -140,9 +140,11 @@ static const OldNewIdTableEntry s_oldNewTable[] = { { "eco", "ecoquest", SCI_VERSION_NONE }, { "eco2", "ecoquest2", SCI_VERSION_NONE }, // EcoQuest 2 demo { "rain", "ecoquest2", SCI_VERSION_NONE }, // EcoQuest 2 full + { "tales", "fairytales", SCI_VERSION_NONE }, { "fp", "freddypharkas", SCI_VERSION_NONE }, { "emc", "funseeker", SCI_VERSION_NONE }, { "gk", "gk1", SCI_VERSION_NONE }, + // gk2 is the same { "hoyledemo", "hoyle1", SCI_VERSION_NONE }, { "cardgames", "hoyle1", SCI_VERSION_NONE }, { "solitare", "hoyle2", SCI_VERSION_NONE }, @@ -152,6 +154,9 @@ static const OldNewIdTableEntry s_oldNewTable[] = { { "demo000", "kq1sci", SCI_VERSION_NONE }, { "kq1", "kq1sci", SCI_VERSION_NONE }, { "kq4", "kq4sci", SCI_VERSION_NONE }, + // kq5 is the same + // kq6 is the same + // kq7 is the same { "mm1", "laurabow", SCI_VERSION_NONE }, { "cb1", "laurabow", SCI_VERSION_NONE }, { "lb2", "laurabow2", SCI_VERSION_NONE }, @@ -165,24 +170,30 @@ static const OldNewIdTableEntry s_oldNewTable[] = { // lsl6 is the same { "mg", "mothergoose", SCI_VERSION_NONE }, { "twisty", "pepper", SCI_VERSION_NONE }, + { "scary", "phantasmagoria", SCI_VERSION_NONE }, + // TODO: distinguish the full version of Phantasmagoria from the demo { "pq1", "pq1sci", SCI_VERSION_NONE }, { "pq", "pq2", SCI_VERSION_NONE }, // pq3 is the same // pq4 is the same - { "tales", "fairytales", SCI_VERSION_NONE }, { "hq", "qfg1", SCI_VERSION_NONE }, // QFG1 SCI0/EGA { "glory", "qfg1", SCI_VERSION_0_LATE }, // QFG1 SCI0/EGA { "trial", "qfg2", SCI_VERSION_NONE }, { "hq2demo", "qfg2", SCI_VERSION_NONE }, + // rama is the same + // TODO: distinguish the full version of rama from the demo { "thegame", "slater", SCI_VERSION_NONE }, { "sq1demo", "sq1sci", SCI_VERSION_NONE }, { "sq1", "sq1sci", SCI_VERSION_NONE }, // sq3 is the same // sq4 is the same // sq5 is the same + // sq6 is the same + // TODO: distinguish the full version of SQ6 from the demo // torin is the same - // TODO: SCI2.1, SCI3 IDs + + // TODO: SCI3 IDs { "", "", SCI_VERSION_NONE } }; @@ -222,6 +233,9 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R return "msastrochicken"; } + if (sierraId == "torin" && resources->size() == 226) // Torin's Passage demo + *gameFlags |= ADGF_DEMO; + for (const OldNewIdTableEntry *cur = s_oldNewTable; cur->oldId[0]; ++cur) { if (sierraId == cur->oldId) { // Distinguish same IDs from the SCI version diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 96bef504f7..b07b76f9c9 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -183,7 +183,7 @@ ResourceSource *ResourceManager::addExternalMap(const char *file_name, int volum return newsrc; } -ResourceSource *ResourceManager::addExternalMap(const Common::FSNode *mapFile) { +ResourceSource *ResourceManager::addExternalMap(const Common::FSNode *mapFile, int volume_nr) { ResourceSource *newsrc = new ResourceSource(); newsrc->source_type = kSourceExtMap; @@ -191,7 +191,7 @@ ResourceSource *ResourceManager::addExternalMap(const Common::FSNode *mapFile) { newsrc->resourceFile = mapFile; newsrc->scanned = false; newsrc->associated_map = NULL; - newsrc->volume_number = 0; + newsrc->volume_number = volume_nr; _sources.push_back(newsrc); return newsrc; @@ -447,11 +447,11 @@ int sci0_get_compression_method(Common::ReadStream &stream) { int ResourceManager::addAppropriateSources() { Common::ArchiveMemberList files; - if (Common::File::exists("RESOURCE.MAP")) { + if (Common::File::exists("resource.map")) { // SCI0-SCI2 file naming scheme - ResourceSource *map = addExternalMap("RESOURCE.MAP"); + ResourceSource *map = addExternalMap("resource.map"); - SearchMan.listMatchingMembers(files, "RESOURCE.0??"); + SearchMan.listMatchingMembers(files, "resource.0??"); for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) { const Common::String name = (*x)->getName(); @@ -462,8 +462,8 @@ int ResourceManager::addAppropriateSources() { } #ifdef ENABLE_SCI32 // GK1CD hires content - if (Common::File::exists("ALT.MAP") && Common::File::exists("RESOURCE.ALT")) - addSource(addExternalMap("ALT.MAP", 10), kSourceVolume, "RESOURCE.ALT", 10); + if (Common::File::exists("alt.map") && Common::File::exists("resource.alt")) + addSource(addExternalMap("alt.map", 10), kSourceVolume, "resource.alt", 10); #endif } else if (Common::File::exists("Data1")) { // Mac SCI1.1+ file naming scheme @@ -486,8 +486,8 @@ int ResourceManager::addAppropriateSources() { } else { // SCI2.1-SCI3 file naming scheme Common::ArchiveMemberList mapFiles; - SearchMan.listMatchingMembers(mapFiles, "RESMAP.0??"); - SearchMan.listMatchingMembers(files, "RESSCI.0??"); + SearchMan.listMatchingMembers(mapFiles, "resmap.0??"); + SearchMan.listMatchingMembers(files, "ressci.0??"); // We need to have the same number of maps as resource archives if (mapFiles.empty() || files.empty() || mapFiles.size() != files.size()) @@ -509,9 +509,9 @@ int ResourceManager::addAppropriateSources() { } // SCI2.1 resource patches - if (Common::File::exists("RESMAP.PAT") && Common::File::exists("RESSCI.PAT")) { + if (Common::File::exists("resmap.pat") && Common::File::exists("ressci.pat")) { // We add this resource with a map which surely won't exist - addSource(addExternalMap("RESMAP.PAT", 100), kSourceVolume, "RESSCI.PAT", 100); + addSource(addExternalMap("resmap.pat", 100), kSourceVolume, "ressci.pat", 100); } } #else @@ -520,14 +520,16 @@ int ResourceManager::addAppropriateSources() { #endif addPatchDir("."); - if (Common::File::exists("MESSAGE.MAP")) - addSource(addExternalMap("MESSAGE.MAP"), kSourceVolume, "RESOURCE.MSG", 0); + if (Common::File::exists("message.map")) + addSource(addExternalMap("message.map"), kSourceVolume, "resource.msg", 0); return 1; } int ResourceManager::addAppropriateSources(const Common::FSList &fslist) { ResourceSource *map = 0; + ResourceSource *sci21PatchMap = 0; + const Common::FSNode *sci21PatchRes = 0; // First, find resource.map for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { @@ -537,15 +539,33 @@ int ResourceManager::addAppropriateSources(const Common::FSList &fslist) { Common::String filename = file->getName(); filename.toLowercase(); - if (filename.contains("resource.map") || filename.contains("resmap.000")) { + if (filename.contains("resource.map")) map = addExternalMap(file); - break; + + if (filename.contains("resmap.0")) { + const char *dot = strrchr(file->getName().c_str(), '.'); + int number = atoi(dot + 1); + map = addExternalMap(file, number); } + +#ifdef ENABLE_SCI32 + // SCI2.1 resource patches + if (filename.contains("resmap.pat")) + sci21PatchMap = addExternalMap(file, 100); + + if (filename.contains("ressci.pat")) + sci21PatchRes = file; +#endif } if (!map) return 0; +#ifdef ENABLE_SCI32 + if (sci21PatchMap && sci21PatchRes) + addSource(sci21PatchMap, kSourceVolume, sci21PatchRes, 100); +#endif + // Now find all the resource.0?? files for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { if (file->isDirectory()) @@ -562,14 +582,6 @@ int ResourceManager::addAppropriateSources(const Common::FSList &fslist) { } } -#ifdef ENABLE_SCI32 - // SCI2.1 resource patches - if (Common::File::exists("RESMAP.PAT") && Common::File::exists("RESSCI.PAT")) { - // We add this resource with a map which surely won't exist - addSource(addExternalMap("RESMAP.PAT", 100), kSourceVolume, "RESSCI.PAT", 100); - } -#endif - // This function is only called by the advanced detector, and we don't really need // to add a patch directory or message.map here @@ -1282,7 +1294,7 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) { res->_id = resId; // NOTE: We add the map's volume number here to the specified volume number - // for SCI2.1 and SCI3 maps that are not RESMAP.000. The RESMAP.* files' numbers + // for SCI2.1 and SCI3 maps that are not resmap.000. The resmap.* files' numbers // need to be used in concurrence with the volume specified in the map to get // the actual resource file. res->_source = getVolume(map, volume_nr + map->volume_number); diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 8147763f4f..65717e4124 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -321,8 +321,8 @@ protected: ResourceMap _resMap; Common::List _volumeFiles; ///< list of opened volume files ResourceSource *_audioMapSCI1; ///< Currently loaded audio map for SCI1 - ResVersion _volVersion; ///< RESOURCE.0xx version - ResVersion _mapVersion; ///< RESOURCE.MAP version + ResVersion _volVersion; ///< resource.0xx version + ResVersion _mapVersion; ///< resource.map version /** * Initializes the resource manager @@ -358,7 +358,7 @@ protected: */ ResourceSource *addExternalMap(const char *file_name, int volume_nr = 0); - ResourceSource *addExternalMap(const Common::FSNode *mapFile); + ResourceSource *addExternalMap(const Common::FSNode *mapFile, int volume_nr = 0); /** * Add an internal (i.e., resource) map to the resource manager's list of sources. -- cgit v1.2.3