[Scummvm-cvs-logs] SF.net SVN: scummvm:[38529] scummvm/trunk/engines/sci
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Thu Feb 19 03:04:31 CET 2009
Revision: 38529
http://scummvm.svn.sourceforge.net/scummvm/?rev=38529&view=rev
Author: mthreepwood
Date: 2009-02-19 02:04:31 +0000 (Thu, 19 Feb 2009)
Log Message:
-----------
- Fix finding versions from exe's
- Fix fallback detection
- Make getVersion() return an int instead of a uint16 which makes the version lose precision and the "major" version can get lost.
Modified Paths:
--------------
scummvm/trunk/engines/sci/detection.cpp
scummvm/trunk/engines/sci/sci.h
scummvm/trunk/engines/sci/scicore/exe_lzexe.cpp
scummvm/trunk/engines/sci/scicore/exe_raw.cpp
Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp 2009-02-19 00:59:34 UTC (rev 38528)
+++ scummvm/trunk/engines/sci/detection.cpp 2009-02-19 02:04:31 UTC (rev 38529)
@@ -105,7 +105,7 @@
return _gameDescription->desc.flags;
}
-uint16 SciEngine::getVersion() const {
+int SciEngine::getVersion() const {
return _gameDescription->version;
}
@@ -1320,6 +1320,24 @@
{AD_TABLE_END_MARKER, {}, SCI_VERSION(0, 000, 000)}
};
+/**
+ * The fallback game descriptor used by the SCI engine's fallbackDetector.
+ * Contents of this struct are to be overwritten by the fallbackDetector.
+ */
+static SciGameDescription g_fallbackDesc = {
+ {
+ "",
+ "",
+ AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor
+ Common::UNK_LANG,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS
+ },
+ {},
+ SCI_VERSION(0, 000, 000)
+};
+
+
static const ADParams detectionParams = {
// Pointer to ADGameDescription or its superset structure
(const byte *)SciGameDescriptions,
@@ -1358,19 +1376,41 @@
const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fslist) const {
int exeVersion = 0;
+ bool foundResMap = false;
+ bool foundRes000 = false;
// First grab all filenames
for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
if (file->isDirectory()) continue;
Common::String filename = file->getName();
filename.toLowercase();
+
+ if (filename.contains("resource.map") || filename.contains("resmap.000"))
+ foundResMap = true;
+
+ if (filename.contains("resource.000") || filename.contains("resource.001")
+ || filename.contains("ressci.000") || filename.contains("ressci.001"))
+ foundRes000 = true;
// FIXME: This is all quite hackish
- if (filename.contains("scidhuv")) {
+ if (filename.contains("scidhuv") || filename.contains("sciv") ||
+ filename.contains("sierra") || filename.contains("sciw")) {
exeVersion = version_detect_from_executable((char *)file->getPath().c_str());
break;
}
}
+
+ // If these files aren't found, it can't be SCI
+ if (!foundResMap && !foundRes000)
+ return 0;
+
+ // Set some defaults
+ g_fallbackDesc.desc.gameid = "sci";
+ g_fallbackDesc.desc.extra = "";
+ g_fallbackDesc.desc.language = Common::UNK_LANG;
+ g_fallbackDesc.desc.platform = Common::kPlatformPC;
+ g_fallbackDesc.desc.flags = ADGF_NO_FLAGS;
+ g_fallbackDesc.version = exeVersion;
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");
@@ -1381,7 +1421,7 @@
SCI_VERSION_MINOR(exeVersion),
SCI_VERSION_PATCHLEVEL(exeVersion));
- return 0;
+ return (const ADGameDescription *)&g_fallbackDesc;
}
bool SciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h 2009-02-19 00:59:34 UTC (rev 38528)
+++ scummvm/trunk/engines/sci/sci.h 2009-02-19 02:04:31 UTC (rev 38529)
@@ -64,7 +64,7 @@
const SciGameDescription *_gameDescription;
const char* getGameID() const;
- uint16 getVersion() const;
+ int getVersion() const;
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
uint32 getFlags() const;
Modified: scummvm/trunk/engines/sci/scicore/exe_lzexe.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/exe_lzexe.cpp 2009-02-19 00:59:34 UTC (rev 38528)
+++ scummvm/trunk/engines/sci/scicore/exe_lzexe.cpp 2009-02-19 02:04:31 UTC (rev 38529)
@@ -217,7 +217,7 @@
guint8 size[2];
off_t fpos;
- FILE *f = sci_fopen(filename, "rb");
+ FILE *f = fopen(filename, "rb");
if (!f)
return NULL;
Modified: scummvm/trunk/engines/sci/scicore/exe_raw.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/exe_raw.cpp 2009-02-19 00:59:34 UTC (rev 38528)
+++ scummvm/trunk/engines/sci/scicore/exe_raw.cpp 2009-02-19 02:04:31 UTC (rev 38529)
@@ -33,7 +33,7 @@
static exe_handle_t *
raw_open(const char *filename) {
- FILE *f = sci_fopen(filename, "rb");
+ FILE *f = fopen(filename, "rb");
exe_handle_t *handle;
if (!f)
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