[Scummvm-cvs-logs] CVS: scummvm/scumm debugger.cpp,1.157,1.158 resource.cpp,1.356,1.357 resource_v7he.cpp,1.57,1.58 scumm-md5.h,2.164,2.165 scumm.cpp,1.699,1.700 scumm.h,1.670,1.671 sound.cpp,1.502,1.503 sound_he.cpp,2.19,2.20

Max Horn fingolfin at users.sourceforge.net
Sat Jan 21 05:02:04 CET 2006


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

Modified Files:
	debugger.cpp resource.cpp resource_v7he.cpp scumm-md5.h 
	scumm.cpp scumm.h sound.cpp sound_he.cpp 
Log Message:
Fix various incorrect usages of the word 'target' instead of 'gameid'; change the ambigiuous 'GameSettings::name' to 'GameSettings::gameid'

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- debugger.cpp	18 Jan 2006 17:39:40 -0000	1.157
+++ debugger.cpp	21 Jan 2006 13:01:19 -0000	1.158
@@ -82,7 +82,7 @@
 	DVar_Register("scumm_vars", &_vm->_scummVars, DVAR_INTARRAY, _vm->_numVariables);
 
 	DVar_Register("scumm_gamename", &_vm->_targetName, DVAR_STRING, 0);
-	DVar_Register("scumm_exename", &_vm->_gameName, DVAR_STRING, 0);
+	DVar_Register("scumm_exename", &_vm->_baseName, DVAR_STRING, 0);
 	DVar_Register("scumm_gameid", &_vm->_gameId, DVAR_BYTE, 0);
 
 	// Register commands

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.356
retrieving revision 1.357
diff -u -d -r1.356 -r1.357
--- resource.cpp	18 Jan 2006 17:39:45 -0000	1.356
+++ resource.cpp	21 Jan 2006 13:01:19 -0000	1.357
@@ -118,28 +118,28 @@
 
 					switch(disk) {
 					case 2:
-						sprintf(buf, "%s.%s", _gameName.c_str(), "(b)");
+						sprintf(buf, "%s.%s", _baseName.c_str(), "(b)");
 						break;
 					case 1:
-						sprintf(buf, "%s.%s", _gameName.c_str(), "(a)");
+						sprintf(buf, "%s.%s", _baseName.c_str(), "(a)");
 						break;
 					default:
-						sprintf(buf, "%s.%s", _gameName.c_str(), "he0");
+						sprintf(buf, "%s.%s", _baseName.c_str(), "he0");
 					}
 				} else
-					sprintf(buf, "%s.he%.1d", _gameName.c_str(), room == 0 ? 0 : 1);
+					sprintf(buf, "%s.he%.1d", _baseName.c_str(), room == 0 ? 0 : 1);
 			} else if (_version >= 7) {
 				if (room > 0 && (_version == 8))
 					VAR(VAR_CURRENTDISK) = diskNumber;
-				sprintf(buf, "%s.la%d", _gameName.c_str(), diskNumber);
+				sprintf(buf, "%s.la%d", _baseName.c_str(), diskNumber);
 
-				sprintf(buf2, "%s.%.3d", _gameName.c_str(), diskNumber);
+				sprintf(buf2, "%s.%.3d", _baseName.c_str(), diskNumber);
 			} else if (_heversion >= 60) {
-				sprintf(buf, "%s.he%.1d", _gameName.c_str(), diskNumber);
+				sprintf(buf, "%s.he%.1d", _baseName.c_str(), diskNumber);
 			} else {
-				sprintf(buf, "%s.%.3d",  _gameName.c_str(), diskNumber);
+				sprintf(buf, "%s.%.3d", _baseName.c_str(), diskNumber);
 				if (_gameId == GID_SAMNMAX)
-					sprintf(buf2, "%s.sm%.1d",  _gameName.c_str(), diskNumber);
+					sprintf(buf2, "%s.sm%.1d", _baseName.c_str(), diskNumber);
 			}
 
 			encByte = (_features & GF_USE_KEY) ? 0x69 : 0;

Index: resource_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v7he.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- resource_v7he.cpp	18 Jan 2006 17:39:45 -0000	1.57
+++ resource_v7he.cpp	21 Jan 2006 13:01:19 -0000	1.58
@@ -158,7 +158,7 @@
 	fi.file = new Common::File;
 
 	if (!_fileName[0]) { // We are running for the first time
-		snprintf(_fileName, 256, "%s.he3", _vm->getGameName());
+		snprintf(_fileName, 256, "%s.he3", _vm->getBaseName());
 
 		if (_vm->_substResFileNameIndex > 0) {
 			char buf1[128];
@@ -1292,7 +1292,7 @@
 		if (_vm->_substResFileNameIndex > 0) {
 			char buf1[128];
 
-			snprintf(buf1, 128, "%s.he3", _vm->getGameName());
+			snprintf(buf1, 128, "%s.he3", _vm->getBaseName());
 			_vm->generateSubstResFileName(buf1, _fileName, sizeof(buf1));
 
 			// Some programs write it as .bin. Try that too

Index: scumm-md5.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm-md5.h,v
retrieving revision 2.164
retrieving revision 2.165
diff -u -d -r2.164 -r2.165
--- scumm-md5.h	19 Jan 2006 22:57:13 -0000	2.164
+++ scumm-md5.h	21 Jan 2006 13:01:19 -0000	2.165
@@ -1,11 +1,11 @@
 /*
-  This file was generated by the md5table tool on Thu Jan 19 22:55:50 2006
+  This file was generated by the md5table tool on Sat Jan 21 12:36:17 2006
   DO NOT EDIT MANUALLY!
  */
 
 struct MD5Table {
 	const char *md5;
-	const char *target;
+	const char *gameid;
 	Common::Language language;
 	Common::Platform platform;
 };

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.699
retrieving revision 1.700
diff -u -d -r1.699 -r1.700
--- scumm.cpp	21 Jan 2006 12:01:39 -0000	1.699
+++ scumm.cpp	21 Jan 2006 13:01:19 -0000	1.700
@@ -89,7 +89,7 @@
 ScummEngine *g_scumm = 0;
 
 struct ScummGameSettings {
-	const char *name;
+	const char *gameid;
 	const char *description;
 	byte id, version, heversion;
 	int midi; // MidiDriverFlags values
@@ -97,7 +97,7 @@
 	Common::Platform platform;
 
 	GameSettings toGameSettings() const {
-		GameSettings dummy = { name, description, features };
+		GameSettings dummy = { gameid, description, features };
 		return dummy;
 	}
 };
@@ -109,13 +109,13 @@
 };
 
 
-struct ObsoleteTargets {
+struct ObsoleteGameIDs {
 	const char *from;
 	const char *to;
 	Common::Platform platform;
 
 	GameSettings toGameSettings() const {
-		GameSettings dummy = { from, "Obsolete Target", 0 };
+		GameSettings dummy = { from, "Obsolete game ID", 0 };
 		return dummy;
 	}
 };
@@ -123,12 +123,12 @@
 static const Common::Platform UNK = Common::kPlatformUnknown;
 
 /**
- * Conversion table mapping old obsolete target names to the
- * corresponding new target and platform combination.
+ * Conversion table mapping old obsolete game IDs to the
+ * corresponding new game ID and platform combination.
  *
  * We use an ugly macro 'UNK' here to make the following table more readable.
  */
-static ObsoleteTargets obsoleteTargetsTable[] = {
+static ObsoleteGameIDs obsoleteGameIDsTable[] = {
 	{"comidemo", "comi", UNK},
 	{"digdemo", "dig", UNK},
 	{"digdemoMac", "dig", Common::kPlatformMacintosh},
@@ -1389,7 +1389,7 @@
 	// Allow the user to override the game name with a custom string.
 	// This allows some game versions to work which use filenames
 	// differing from the regular version(s) of that game.
-	_gameName = ConfMan.hasKey("basename") ? ConfMan.get("basename") : gs.name;
+	_baseName = ConfMan.hasKey("basename") ? ConfMan.get("basename") : gs.gameid;
 
 	_copyProtection = ConfMan.getBool("copy_protection");
 	_demoMode = ConfMan.getBool("demo_mode");
@@ -2132,9 +2132,9 @@
 	memset(_hePalettes, 0, (_numPalettes + 1) * 1024);
 
 	// Array 129 is set to base name
-	int len = resStrLen((const byte *)_gameName.c_str()) + 1;
+	int len = resStrLen((const byte *)_baseName.c_str()) + 1;
 	ArrayHeader *ah = defineArray(129, kStringArray, 0, 0, 0, len);
-	memcpy(ah->data, _gameName.c_str(), len);
+	memcpy(ah->data, _baseName.c_str(), len);
 
 }
 #endif
@@ -2838,9 +2838,9 @@
 
 GameList Engine_SCUMM_gameList() {
 	const ScummGameSettings *g = scumm_settings;
-	const ObsoleteTargets *o = obsoleteTargetsTable;
+	const ObsoleteGameIDs *o = obsoleteGameIDsTable;
 	GameList games;
-	while (g->name) {
+	while (g->gameid) {
 		games.push_back(g->toGameSettings());
 		g++;
 	}
@@ -2862,11 +2862,11 @@
 	typedef Common::Map<Common::String, bool> StringSet;
 	StringSet fileSet;
 
-	for (g = scumm_settings; g->name; ++g) {
+	for (g = scumm_settings; g->gameid; ++g) {
 		// Determine the 'detectname' for this game, that is, the name of a
 		// file that *must* be presented if the directory contains the data
 		// for this game. For example, FOA requires atlantis.000
-		const char *base = g->name;
+		const char *base = g->gameid;
 		detectName[0] = '\0';
 
 		// TODO: we need to add cache here
@@ -3099,14 +3099,14 @@
 				if (!exactMatch)
 					detectedGames.clear();	// Clear all the non-exact candidates
 
-				const char *target = elem->target;
+				const char *gameid = elem->gameid;
 
-				// Find the GameSettings for that target
-				for (g = scumm_settings; g->name; ++g) {
-					if (0 == scumm_stricmp(g->name, target))
+				// Find the GameSettings for that gameid
+				for (g = scumm_settings; g->gameid; ++g) {
+					if (0 == scumm_stricmp(g->gameid, gameid))
 							break;
 				}
-				assert(g->name);
+				assert(g->gameid);
 				// Insert the 'enhanced' game data into the candidate list
 				if (iter->_value == true) // This was HE Mac game
 					detectedGames.push_back(DetectedGame(g->toGameSettings(), elem->language, Common::kPlatformMacintosh));
@@ -3173,39 +3173,49 @@
 	return -1;
 }
 
+/**
+ * Create a ScummEngine instance, based on the given detector data.
+ *
+ * This is heavily based on our MD5 detection scheme.
+ */
 Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
 	Engine *engine;
 
-	const ObsoleteTargets *o = obsoleteTargetsTable;
+	// We start by checking whether the specified game ID is obsolete.
+	// If that is the case, we automaticlaly upgrade the target to use
+	// the correct new game ID (and platform, if specified).
+	const ObsoleteGameIDs *o = obsoleteGameIDsTable;
 	while (o->from) {
-		if (!scumm_stricmp(detector->_game.name, o->from)) {
-			detector->_game.name = o->to;
-
+		if (!scumm_stricmp(detector->_game.gameid, o->from)) {
+			// Match found, perform upgrade
+			detector->_game.gameid = o->to;
 			ConfMan.set("gameid", o->to);
 
 			if (o->platform != Common::kPlatformUnknown)
 				ConfMan.set("platform", Common::getPlatformCode(o->platform));
 
-			warning("Target upgraded from %s to %s", o->from, o->to);
+			warning("Target upgraded from game ID %s to %s", o->from, o->to);
 			ConfMan.flushToDisk();
 			break;
 		}
 		o++;
 	}
 
+	// Lookup the game ID in our database. If this lookup fails, then
+	// the game ID is unknown, and we have to abort.
 	const ScummGameSettings *g = scumm_settings;
-	while (g->name) {
-		if (!scumm_stricmp(detector->_game.name, g->name))
+	while (g->gameid) {
+		if (!scumm_stricmp(detector->_game.gameid, g->gameid))
 			break;
 		g++;
 	}
-	if (!g->name) {
-		error("Invalid game '%s'\n", detector->_game.name);
+	if (!g->gameid) {
+		error("Invalid game ID '%s'\n", detector->_game.gameid);
 		return 0;
 	}
 
 	// Calculate MD5 of the games detection file, for savegames etc.
-	const char *name = g->name;
+	const char *gameid = g->gameid;
 	char detectName[256], tempName[256], gameMD5[32+1];
 	uint8 md5sum[16];
 	int substLastIndex = 0;
@@ -3222,19 +3232,19 @@
 			strcpy(detectName, "000.LFL");
 			break;
 		case 2:
-			strcpy(detectName, name);
+			strcpy(detectName, gameid);
 			strcat(detectName, ".la0");
 			break;
 		case 3:
-			strcpy(detectName, name);
+			strcpy(detectName, gameid);
 			strcat(detectName, ".he0");
 			break;
 		case 4:
-			strcpy(detectName, name);
+			strcpy(detectName, gameid);
 			strcat(detectName, ".000");
 			break;
 		case 5:
-			strcpy(detectName, name);
+			strcpy(detectName, gameid);
 			strcat(detectName, ".sm0");
 			break;
 		case 6:
@@ -3288,11 +3298,11 @@
 	// Now search our 'database' for the MD5; if a match is found, we use 
 	// the information in the 'database' to correct the GameSettings.
 	g = multiple_versions_md5_settings;
-	while (g->name) {
-		if (!scumm_stricmp(md5, g->name)) {
+	while (g->gameid) {
+		if (!scumm_stricmp(md5, g->gameid)) {
 			// Match found
 			game = *g;
-			game.name = name;
+			game.gameid = gameid;	// FIXME: Fingolfin wonders what this line is good for?
 			if (game.description)
 				g_system->setWindowCaption(game.description);
 			break;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.670
retrieving revision 1.671
diff -u -d -r1.670 -r1.671
--- scumm.h	18 Jan 2006 17:39:47 -0000	1.670
+++ scumm.h	21 Jan 2006 13:01:19 -0000	1.671
@@ -434,7 +434,7 @@
 
 	// Misc utility functions
 	uint32 _debugFlags;
-	const char *getGameName() const { return _gameName.c_str(); }
+	const char *getBaseName() const { return _baseName.c_str(); }
 
 	// Cursor/palette
 	void updateCursor();
@@ -696,7 +696,7 @@
 
 protected:
 	int _resourceHeaderSize;
-	Common::String _gameName;	// This is the name we use for opening resource files
+	Common::String _baseName;	// This is the name we use for opening resource files
 	Common::String _targetName;	// This is the game the user calls it, so use for saving
 	byte _resourceMapper[128];
 	byte *_heV7DiskOffsets;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.502
retrieving revision 1.503
diff -u -d -r1.502 -r1.503
--- sound.cpp	18 Jan 2006 17:39:47 -0000	1.502
+++ sound.cpp	21 Jan 2006 13:01:19 -0000	1.503
@@ -1008,12 +1008,12 @@
 	ScummFile *file = new ScummFile();
 	_offsetTable = NULL;
 
-	/* Try opening the file <_gameName>.sou first, e.g. tentacle.sou.
+	/* Try opening the file <baseName>.sou first, e.g. tentacle.sou.
 	 * That way, you can keep .sou files for multiple games in the
 	 * same directory */
 
 	const char *basename[4] = { 0, 0, 0, 0 };
-	basename[0] = _vm->getGameName();
+	basename[0] = _vm->getBaseName();
 	basename[1] = "monster";
 	
 	if (_vm->_substResFileNameIndex > 0) {
@@ -1036,9 +1036,9 @@
 
 	if (!file->isOpen()) {
 		if ((_vm->_heversion <= 61 && _vm->_platform == Common::kPlatformMacintosh) || (_vm->_heversion >= 70)) {
-			sprintf(buf, "%s.he2", _vm->getGameName());
+			sprintf(buf, "%s.he2", _vm->getBaseName());
 		} else {
-			sprintf(buf, "%s.tlk", _vm->getGameName());
+			sprintf(buf, "%s.tlk", _vm->getBaseName());
 		}
 
 		if (_vm->_substResFileNameIndex > 0) {

Index: sound_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound_he.cpp,v
retrieving revision 2.19
retrieving revision 2.20
diff -u -d -r2.19 -r2.20
--- sound_he.cpp	21 Jan 2006 03:45:53 -0000	2.19
+++ sound_he.cpp	21 Jan 2006 13:01:19 -0000	2.20
@@ -138,7 +138,7 @@
 	char buf[32], buf1[128];
 	Common::File musicFile;
 
-	sprintf(buf, "%s.he4", _vm->getGameName());
+	sprintf(buf, "%s.he4", _vm->getBaseName());
 
 	if (_vm->_substResFileNameIndex > 0) {
 		_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));
@@ -334,7 +334,7 @@
 		char buf[32], buf1[128];
 		Common::File musicFile;
 
-		sprintf(buf, "%s.he4", _vm->getGameName());
+		sprintf(buf, "%s.he4", _vm->getBaseName());
 
 		if (_vm->_substResFileNameIndex > 0) {
 			_vm->generateSubstResFileName(buf, buf1, sizeof(buf1));





More information about the Scummvm-git-logs mailing list