[Scummvm-cvs-logs] SF.net SVN: scummvm: [21154] scummvm/trunk/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Mar 8 19:10:03 CET 2006


Revision: 21154
Author:   fingolfin
Date:     2006-03-08 19:09:21 -0800 (Wed, 08 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21154&view=rev

Log Message:
-----------
- Removed the code from the launcher that adds language/platform to the
  game descriptions. Doing this now is the responsibility of the engines.
- Adapted the SCUMM engine to add lang/platform to the desc string if 
  necessary. Other engines still have to be adapted (but many do not seem to
  need this at all, since they either are lang/platform agnostic, or already
  include this information in their MD5 tables).

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/plugin.cpp
    scummvm/trunk/gui/launcher.cpp
Modified: scummvm/trunk/engines/scumm/plugin.cpp
===================================================================
--- scummvm/trunk/engines/scumm/plugin.cpp	2006-03-09 03:04:57 UTC (rev 21153)
+++ scummvm/trunk/engines/scumm/plugin.cpp	2006-03-09 03:09:21 UTC (rev 21154)
@@ -1133,29 +1133,30 @@
 							}
 
 							// Match found, add to list of candidates, then abort inner loop.
-							const char *desc = findDescriptionFromGameID(g->gameid);
+							DetectedGame dg(g->gameid, findDescriptionFromGameID(g->gameid));
 							if (substLastIndex > 0 && // HE Mac versions.
 								(subst.genMethod == kGenMac ||
 								 subst.genMethod == kGenMacNoParens)) {
-								detectedGames.push_back(DetectedGame(g->gameid, desc,
-																	 Common::UNK_LANG,
-																	 Common::kPlatformMacintosh));
+								dg.platform = Common::kPlatformMacintosh;
 								fileSet[file->path()] = true;
 							} else if (substLastIndex == 0 && g->id == GID_MANIAC &&
 									   (buf[0] == 0xbc || buf[0] == 0xa0)) {
-								detectedGames.push_back(DetectedGame(g->gameid, desc,
-																	 Common::UNK_LANG,
-																	 Common::kPlatformNES));
+								dg.platform = Common::kPlatformNES;
 							} else if ((g->id == GID_MANIAC || g->id == GID_ZAK) &&
 									   ((buf[0] == 0x31 && buf[1] == 0x0a) ||
 										(buf[0] == 0xcd && buf[1] == 0xfe))) {
-								detectedGames.push_back(DetectedGame(g->gameid, desc,
-																	 Common::UNK_LANG,
-																	 Common::kPlatformC64));
+								dg.platform = Common::kPlatformC64;
 							} else {
-								detectedGames.push_back(DetectedGame(g->gameid, desc));
 								fileSet[file->path()] = false;
 							}
+							
+							// If known, add the platform to the description string
+							if (dg.platform != Common::kPlatformUnknown) {
+								dg.description += "(";
+								dg.description += Common::getPlatformDescription(dg.platform);
+								dg.description += ")";
+							}
+							detectedGames.push_back(dg);
 							break;
 						}
 					}
@@ -1194,12 +1195,31 @@
 							break;
 				}
 				assert(g->gameid);
-				// Insert the 'enhanced' game data into the candidate list
-				const char *desc = findDescriptionFromGameID(g->gameid);
+				DetectedGame dg(g->gameid, findDescriptionFromGameID(g->gameid), elem->language);
 				if (iter->_value == true) // This was HE Mac game
-					detectedGames.push_back(DetectedGame(g->gameid, desc, elem->language, Common::kPlatformMacintosh));
+					dg.platform = Common::kPlatformMacintosh;
 				else
-					detectedGames.push_back(DetectedGame(g->gameid, desc, elem->language, elem->platform));
+					dg.platform = elem->platform;
+
+				const bool customLanguage = (dg.language != Common::UNK_LANG);
+				const bool customPlatform = (dg.platform != Common::kPlatformUnknown);
+
+				// Adapt the description string if custom platform/language is set.
+				// TODO: Also use the 'extra' information, like "Demo" etc.
+				if (customLanguage || customPlatform) {
+					dg.description += " (";
+					if (customLanguage)
+						dg.description += Common::getLanguageDescription(dg.language);
+					if (customLanguage && customPlatform)
+						dg.description += "/";
+					if (customPlatform)
+						dg.description += Common::getPlatformDescription(dg.platform);
+					dg.description += ")";
+				}
+				
+				// Insert the 'enhanced' game data into the candidate list
+				detectedGames.push_back(dg);
+
 				exactMatch = true;
 			}
 		}

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2006-03-09 03:04:57 UTC (rev 21153)
+++ scummvm/trunk/gui/launcher.cpp	2006-03-09 03:09:21 UTC (rev 21154)
@@ -654,31 +654,14 @@
 			ConfMan.set("gameid", result.gameid, domain);
 			ConfMan.set("path", dir.path(), domain);
 
-			const bool customLanguage = (result.language != Common::UNK_LANG);
-			const bool customPlatform = (result.platform != Common::kPlatformUnknown);
-
 			// Set language if specified
-			if (customLanguage)
+			if (result.language != Common::UNK_LANG)
 				ConfMan.set("language", Common::getLanguageCode(result.language), domain);
 
 			// Set platform if specified
-			if (customPlatform)
+			if (result.platform != Common::kPlatformUnknown)
 				ConfMan.set("platform", Common::getPlatformCode(result.platform), domain);
 
-			// Adapt the description string if custom platform/language is set
-			if (customLanguage || customPlatform) {
-				result.description += " (";
-				if (customLanguage)
-					result.description += Common::getLanguageDescription(result.language);
-				if (customLanguage && customPlatform)
-					result.description += "/";
-				if (customPlatform)
-					result.description += Common::getPlatformDescription(result.platform);
-				result.description += ")";
-
-				ConfMan.set("description", result.description, domain);
-			}
-
 			// Display edit dialog for the new entry
 			EditGameDialog editDialog(domain, result.description);
 			if (editDialog.runModal() > 0) {


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