diff options
| author | Filippos Karapetis | 2009-08-24 08:10:29 +0000 |
|---|---|---|
| committer | Filippos Karapetis | 2009-08-24 08:10:29 +0000 |
| commit | 4c62b6ac86d28d5701dd2563eb030bf5cfa0d036 (patch) | |
| tree | e4106d1b9d788c58a08677791ff4802dbdf0e5c5 /engines/sci/detection.cpp | |
| parent | 030665f90b5f172b7bafe730abcbc6f2a818ad6d (diff) | |
| download | scummvm-rg350-4c62b6ac86d28d5701dd2563eb030bf5cfa0d036.tar.gz scummvm-rg350-4c62b6ac86d28d5701dd2563eb030bf5cfa0d036.tar.bz2 scummvm-rg350-4c62b6ac86d28d5701dd2563eb030bf5cfa0d036.zip | |
- Removed the code which reads the SCI version string from the game executable in the fallback detector. We no longer use the actual SCI version string, and we can auto-detect a lot of features from the game resources now. The EXE version string was only used to display the detected SCI version in the console, which isn't very useful to us anymore.
- Added detection for PC and Amiga versions based on the game's detected view types. Still need to do detection for Mac and Atari ST versions
svn-id: r43683
Diffstat (limited to 'engines/sci/detection.cpp')
| -rw-r--r-- | engines/sci/detection.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 177fc2fbd1..55ea8ee00a 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -260,7 +260,6 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl bool foundResMap = false; bool foundRes000 = false; Common::Platform exePlatform = Common::kPlatformUnknown; - Common::String exeVersionString; // First grab all filenames for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { @@ -293,22 +292,15 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl // Check if it's a known executable name // Note: "sier" matches "sier.exe", "sierra.exe", "sierw.exe" and "sierw5.exe" + // TODO: Try to remove this code, and base platform detection on game resources + // instead of the executable itself if (filename.contains("scidhuv") || filename.contains("sciduv") || filename.contains("sciv") || filename.contains("sciw") || filename.contains("prog") || filename.contains("sier")) { - // We already found a valid exe, no need to check this one. - if (!exeVersionString.empty()) - continue; - // Is it really an executable file? Common::SeekableReadStream *fileStream = file->createReadStream(); exePlatform = getGameExePlatform(fileStream); - - // It's a valid exe, read the interpreter version string - if (exePlatform != Common::kPlatformUnknown) - exeVersionString = readSciVersionFromExe(fileStream, exePlatform); - delete fileStream; } } @@ -319,19 +311,40 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl return 0; } + ResourceManager *resMgr = new ResourceManager(fslist); + SciVersion version = resMgr->sciVersion(); + SegManager *segManager = new SegManager(resMgr, version); + // Set some defaults s_fallbackDesc.desc.extra = ""; s_fallbackDesc.desc.language = Common::UNK_LANG; + if (exePlatform == Common::kPlatformUnknown) { + // Try to determine the platform from game resources + ViewType gameViews = resMgr->getViewType(); + if (gameViews == kViewEga || gameViews == kViewVga || + gameViews == kViewVga11) { + // Must be PC or Mac, set to PC for now + // TODO: Is there a reliable way to determine the game + // platform from the resources? So far, I've noticed + // that Mac versions have a different signature for + // kGetEvent and kNewWindow. I'm unsure about Atari ST + // versions. Could we base detection on this? + exePlatform = Common::kPlatformPC; + } else if (gameViews == kViewAmiga) { + exePlatform = Common::kPlatformAmiga; + } + // TODO: detection for Mac and Atari ST + } + s_fallbackDesc.desc.platform = exePlatform; s_fallbackDesc.desc.flags = ADGF_NO_FLAGS; // Determine the game id - ResourceManager *resMgr = new ResourceManager(fslist); - SciVersion version = resMgr->sciVersion(); - SegManager *segManager = new SegManager(resMgr, version); if (!script_instantiate(resMgr, segManager, version, 0)) { warning("fallbackDetect(): Could not instantiate script 0"); SearchMan.remove("SCI_detection"); + delete segManager; + delete resMgr; return 0; } reg_t game_obj = script_lookup_export(segManager, 0, 0); @@ -345,7 +358,6 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl printf("If this is *NOT* a fan-modified version (in particular, not a fan-made\n"); printf("translation), please, report the data above, including the following\n"); printf("version number, from the game's executable:\n"); - printf("Version: %s\n\n", exeVersionString.empty() ? "not found" : exeVersionString.c_str()); SearchMan.remove("SCI_detection"); |
