[Scummvm-cvs-logs] CVS: scummvm/queen queen.cpp,1.119,1.120

Joost Peters joostp at users.sourceforge.net
Sun Mar 6 10:09:16 CET 2005


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3439/queen

Modified Files:
	queen.cpp 
Log Message:
Add demo detection; satisfies feature request #1154562.


Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- queen.cpp	23 Feb 2005 17:21:32 -0000	1.119
+++ queen.cpp	6 Mar 2005 18:08:46 -0000	1.120
@@ -52,15 +52,36 @@
 
 
 /* Flight of the Amazon Queen */
-static const GameSettings queen_setting =
-	{ "queen", "Flight of the Amazon Queen", 0 };
+static const GameSettings queen_setting[] = {
+	{ "queen", "Flight of the Amazon Queen", 0 },
+	{ "queen", "Flight of the Amazon Queen (Demo)", 0 },
+	{ "queen", "Flight of the Amazon Queen (Interview)", 0 },
+	{ 0, 0, 0 }
+};
 
 GameList Engine_QUEEN_gameList() {
 	GameList games;
-	games.push_back(queen_setting);
+	const GameSettings *g = queen_setting;
+
+	while (g->name) {
+		games.push_back(*g);
+		g++;
+	}
 	return games;
 }
 
+bool isDemo(uint32 size) {
+	switch(size) {
+		case 1915913:	//interview
+		case 3724538:
+		case 3732177:
+			return true;
+		default:
+			return false;
+	}
+	return false;
+}
+
 DetectedGameList Engine_QUEEN_detectGames(const FSList &fslist) {
 	DetectedGameList detectedGames;
 
@@ -71,7 +92,35 @@
 
 			if (0 == scumm_stricmp("queen.1", gameName) || 0 == scumm_stricmp("queen.1c", gameName)) {
 				// Match found, add to list of candidates, then abort loop.
-				detectedGames.push_back(queen_setting);
+			
+				File dataFile;
+				dataFile.open(file->path().c_str());
+				assert(dataFile.isOpen());
+				
+				if (0 == scumm_stricmp("queen.1", gameName)) {	//an unmodified file
+					if (isDemo(dataFile.size())) { //is it a demo?
+						uint8 whichDemo = dataFile.size() == 1915913 ? 2 : 1;
+						detectedGames.push_back(queen_setting[whichDemo]);
+					} else { //must be a full game then
+						detectedGames.push_back(queen_setting[0]);
+					}
+				} else if (0 == scumm_stricmp("queen.1c", gameName)) { //oh joy, it's a rebuilt file
+					char header[9];
+					dataFile.read(header, 9);
+					if (0 == scumm_strnicmp("QTBL", header, 4)) { //check validity
+						uint8 version = 0;	//default to full/normal version
+
+						if (0 == scumm_strnicmp("PE100", header + 4, 5)) //One of the 2 regular demos
+							version = 1;
+						if (0 == scumm_strnicmp("PEint", header + 4, 5)) //Interview demo
+							version = 2;
+
+						detectedGames.push_back(queen_setting[version]);
+					}
+				}
+
+				dataFile.close();
+				
 				break;
 			}
 		}





More information about the Scummvm-git-logs mailing list