[Scummvm-cvs-logs] SF.net SVN: scummvm: [24084] scummvm/trunk/engines/sky/sky.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Oct 3 00:27:03 CEST 2006


Revision: 24084
          http://svn.sourceforge.net/scummvm/?rev=24084&view=rev
Author:   fingolfin
Date:     2006-10-02 15:26:57 -0700 (Mon, 02 Oct 2006)

Log Message:
-----------
Improved the BASS detector a bit

Modified Paths:
--------------
    scummvm/trunk/engines/sky/sky.cpp

Modified: scummvm/trunk/engines/sky/sky.cpp
===================================================================
--- scummvm/trunk/engines/sky/sky.cpp	2006-10-02 22:21:57 UTC (rev 24083)
+++ scummvm/trunk/engines/sky/sky.cpp	2006-10-02 22:26:57 UTC (rev 24084)
@@ -89,22 +89,76 @@
 	return GameDescriptor();
 }
 
+struct SkyVersion {
+	int dinnerTableEntries;
+	int dataDiskSize;
+	const char *extraDesc;
+	int version;
+};
+
+// TODO: Would be nice if Disk::determineGameVersion() used this table, too.
+static const SkyVersion skyVersions[] = {
+	{  243, -1, "pc gamer demo", 109 },
+	{  247, -1, "floppy demo", 267 },
+	{ 1404, -1, "floppy", 288 },
+	{ 1413, -1, "floppy", 303 },
+	{ 1445, 8830435, "floppy", 348 },
+	{ 1445, -1, "floppy", 331 },
+	{ 1711, -1, "cd demo", 365 },
+	{ 5099, -1, "cd", 368 },
+	{ 5097, -1, "cd", 372 },
+	{ 0, 0, 0, 0 }
+};
+
 DetectedGameList Engine_SKY_detectGames(const FSList &fslist) {
 	DetectedGameList detectedGames;
+	bool hasSkyDsk = false;
+	bool hasSkyDnr = false;
+	int dinnerTableEntries = -1;
+	int dataDiskSize = -1;
+
 	// Iterate over all files in the given directory
 	for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
 		if (!file->isDirectory()) {
 			const char *fileName = file->name().c_str();
 
 			if (0 == scumm_stricmp("sky.dsk", fileName)) {
-				// Match found, add to list of candidates, then abort inner loop.
-				// The game detector uses US English by default. We want British
-				// English to match the recorded voices better.
-				detectedGames.push_back(DetectedGame(skySetting, Common::EN_GRB, Common::kPlatformUnknown));
+				Common::File dataDisk;
+				if (dataDisk.open(file->path())) {
+					hasSkyDsk = true;
+					dataDiskSize = dataDisk.size();
+				}
+			}
+
+			if (0 == scumm_stricmp("sky.dnr", fileName)) {
+				Common::File dinner;
+				if (dinner.open(file->path())) {
+					hasSkyDnr = true;
+					dinnerTableEntries = dinner.readUint32LE();
+				}
+			}
+		}
+	}
+
+	if (hasSkyDsk && hasSkyDnr) {
+		// Match found, add to list of candidates, then abort inner loop.
+		// The game detector uses US English by default. We want British
+		// English to match the recorded voices better.
+		DetectedGame dg(skySetting, Common::UNK_LANG, Common::kPlatformUnknown);
+		const SkyVersion *sv = skyVersions;
+		while (sv->dinnerTableEntries) {
+			if (dinnerTableEntries == sv->dinnerTableEntries &&
+				(sv->dataDiskSize == dataDiskSize || sv->dataDiskSize == -1)) {
+				char buf[32];
+				snprintf(buf, sizeof(buf), "v0.0%d %s", sv->version, sv->extraDesc);
+				dg.updateDesc(buf);
 				break;
 			}
+			++sv;
 		}
+		detectedGames.push_back(dg);
 	}
+
 	return detectedGames;
 }
 


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