aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2009-02-19 02:04:31 +0000
committerMatthew Hoops2009-02-19 02:04:31 +0000
commitee16e35bb6c86323d69937992e34ac214e2005c2 (patch)
tree8e5790092d3c87a1d30098d57885ff12d5a82e01
parent5778350053e96859844f5998a06056e890da40c1 (diff)
downloadscummvm-rg350-ee16e35bb6c86323d69937992e34ac214e2005c2.tar.gz
scummvm-rg350-ee16e35bb6c86323d69937992e34ac214e2005c2.tar.bz2
scummvm-rg350-ee16e35bb6c86323d69937992e34ac214e2005c2.zip
- 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. svn-id: r38529
-rw-r--r--engines/sci/detection.cpp46
-rw-r--r--engines/sci/sci.h2
-rw-r--r--engines/sci/scicore/exe_lzexe.cpp2
-rw-r--r--engines/sci/scicore/exe_raw.cpp2
4 files changed, 46 insertions, 6 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 861826ffc0..8856ebe9b6 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -105,7 +105,7 @@ uint32 SciEngine::getFlags() const {
return _gameDescription->desc.flags;
}
-uint16 SciEngine::getVersion() const {
+int SciEngine::getVersion() const {
return _gameDescription->version;
}
@@ -1320,6 +1320,24 @@ static const struct SciGameDescription SciGameDescriptions[] = {
{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 @@ public:
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 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
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 {
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 57d140f01a..575fa5eadd 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -64,7 +64,7 @@ public:
const SciGameDescription *_gameDescription;
const char* getGameID() const;
- uint16 getVersion() const;
+ int getVersion() const;
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
uint32 getFlags() const;
diff --git a/engines/sci/scicore/exe_lzexe.cpp b/engines/sci/scicore/exe_lzexe.cpp
index a8876b3bc5..a7a1c31a08 100644
--- a/engines/sci/scicore/exe_lzexe.cpp
+++ b/engines/sci/scicore/exe_lzexe.cpp
@@ -217,7 +217,7 @@ lzexe_open(const char *filename) {
guint8 size[2];
off_t fpos;
- FILE *f = sci_fopen(filename, "rb");
+ FILE *f = fopen(filename, "rb");
if (!f)
return NULL;
diff --git a/engines/sci/scicore/exe_raw.cpp b/engines/sci/scicore/exe_raw.cpp
index 17d46f524f..69daaca45f 100644
--- a/engines/sci/scicore/exe_raw.cpp
+++ b/engines/sci/scicore/exe_raw.cpp
@@ -33,7 +33,7 @@ struct _exe_handle {
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)