[Scummvm-cvs-logs] SF.net SVN: scummvm:[43698] scummvm/trunk/engines/sci/detection.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Mon Aug 24 15:47:38 CEST 2009
Revision: 43698
http://scummvm.svn.sourceforge.net/scummvm/?rev=43698&view=rev
Author: thebluegr
Date: 2009-08-24 13:47:38 +0000 (Mon, 24 Aug 2009)
Log Message:
-----------
More work on the fallback detector: added detection of CD games and prevented a crash when detecting a SCI32 game if SCI32 isn't compiled in
Modified Paths:
--------------
scummvm/trunk/engines/sci/detection.cpp
Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp 2009-08-24 13:08:21 UTC (rev 43697)
+++ scummvm/trunk/engines/sci/detection.cpp 2009-08-24 13:47:38 UTC (rev 43698)
@@ -261,6 +261,13 @@
bool foundRes000 = false;
Common::Platform exePlatform = Common::kPlatformUnknown;
+ // Set some defaults
+ s_fallbackDesc.desc.extra = "";
+ s_fallbackDesc.desc.language = Common::UNK_LANG;
+ s_fallbackDesc.desc.flags = ADGF_NO_FLAGS;
+ s_fallbackDesc.desc.platform = Common::kPlatformUnknown;
+ s_fallbackDesc.desc.gameid = "sci";
+
// First grab all filenames
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
if (file->isDirectory())
@@ -286,6 +293,28 @@
foundResMap = true;
}
+ // Determine if we got a CD version and set the CD flag accordingly, by checking for
+ // resource.aud. We assume that the file should be over 10MB, as it contains all the
+ // game speech and is usually around 450MB+. The size check is for some floppy game
+ // versions like KQ6 floppy, which also have a small resource.aud file
+ if (filename.contains("resource.aud")) {
+ Common::SeekableReadStream *tmpStream = file->createReadStream();
+ if (tmpStream->size() > 10 * 1024 * 1024) {
+ // We got a CD version, so set the CD flag accordingly
+ s_fallbackDesc.desc.flags |= ADGF_CD;
+ s_fallbackDesc.desc.extra = "CD";
+ }
+ delete tmpStream;
+ }
+
+ // Check if we got a map file for older SCI1 CD versions (like KQ5CD)
+ // It's named like "audioXXX.map"
+ if (filename.contains("audio") && filename.contains(".map")) {
+ // We got a CD version, so set the CD flag accordingly
+ s_fallbackDesc.desc.flags |= ADGF_CD;
+ s_fallbackDesc.desc.extra = "CD";
+ }
+
if (filename.contains("resource.000") || filename.contains("resource.001")
|| filename.contains("ressci.000") || filename.contains("ressci.001"))
foundRes000 = true;
@@ -313,14 +342,27 @@
ResourceManager *resMgr = new ResourceManager(fslist);
SciVersion version = resMgr->sciVersion();
+ ViewType gameViews = resMgr->getViewType();
+
+ // Have we identified the game views? If not, stop here
+ if (gameViews == kViewUnknown) {
+ SearchMan.remove("SCI_detection");
+ return (const ADGameDescription *)&s_fallbackDesc;
+ }
+
+#ifndef ENABLE_SCI32
+ // Is SCI32 compiled in? If not, and this is a SCI32 game,
+ // stop here
+ if (resMgr->sciVersion() == SCI_VERSION_32) {
+ SearchMan.remove("SCI_detection");
+ return (const ADGameDescription *)&s_fallbackDesc;
+ }
+#endif
+
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
@@ -337,7 +379,6 @@
}
s_fallbackDesc.desc.platform = exePlatform;
- s_fallbackDesc.desc.flags = ADGF_NO_FLAGS;
// Determine the game id
if (!script_instantiate(resMgr, segManager, version, 0)) {
@@ -355,10 +396,6 @@
delete segManager;
delete resMgr;
- 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");
-
SearchMan.remove("SCI_detection");
return (const ADGameDescription *)&s_fallbackDesc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list