[Scummvm-cvs-logs] CVS: scummvm/scumm debugger.cpp,1.93,1.94 resource.cpp,1.166,1.167 saveload.cpp,1.114,1.115 scumm.h,1.313,1.314 scummvm.cpp,2.437,2.438 sound.cpp,1.265,1.266

Max Horn fingolfin at users.sourceforge.net
Sun Oct 12 12:11:03 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv1263/scumm

Modified Files:
	debugger.cpp resource.cpp saveload.cpp scumm.h scummvm.cpp 
	sound.cpp 
Log Message:
some more target<->game cleanup

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- debugger.cpp	12 Oct 2003 17:49:52 -0000	1.93
+++ debugger.cpp	12 Oct 2003 19:10:16 -0000	1.94
@@ -21,6 +21,7 @@
 #include "stdafx.h"
 
 #include "common/file.h"
+#include "common/str.h"
 #include "common/util.h"
 
 #include "scumm/actor.h"
@@ -64,8 +65,8 @@
 	DVar_Register("scumm_roomresource", &_vm->_roomResource, DVAR_INT, 0);
 	DVar_Register("scumm_vars", &_vm->_scummVars, DVAR_INTARRAY, _vm->_numVariables);
 
-	DVar_Register("scumm_gamename", &_vm->_game_name, DVAR_STRING, 0);
-	DVar_Register("scumm_exename", &_vm->_exe_name, DVAR_STRING, 0);
+	DVar_Register("scumm_gamename", &_vm->_targetName, DVAR_STRING, 0);
+	DVar_Register("scumm_exename", &_vm->_gameName, DVAR_STRING, 0);
 	DVar_Register("scumm_gameid", &_vm->_gameId, DVAR_INT, 0);
 
 	// Register commands
@@ -325,7 +326,7 @@
 				break;
 				// String
 				case DVAR_STRING:
-					Debug_Printf("(string)%s = %s\n", param[0], *(char **)_dvars[i].variable);
+					Debug_Printf("(string)%s = %s\n", param[0], ((Common::String *)_dvars[i].variable)->c_str());
 					break;
 				default:
 					Debug_Printf("%s = (unknown type)\n", param[0]);

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- resource.cpp	11 Oct 2003 15:18:49 -0000	1.166
+++ resource.cpp	12 Oct 2003 19:10:16 -0000	1.167
@@ -83,18 +83,18 @@
 		if (!(_features & GF_SMALL_HEADER)) {
 
 			if (_features & GF_AFTER_HEV7) {
-				sprintf(buf, "%s.he%.1d", _exe_name, room == 0 ? 0 : 1);
+				sprintf(buf, "%s.he%.1d", _gameName.c_str(), room == 0 ? 0 : 1);
 			} else if (_version >= 7) {
 				if (room > 0 && (_version == 8))
 					VAR(VAR_CURRENTDISK) = res.roomno[rtRoom][room];
-				sprintf(buf, "%s.la%d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
-				sprintf(buf2, "%s.%.3d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
+				sprintf(buf, "%s.la%d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
+				sprintf(buf2, "%s.%.3d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
 			} else if (_features & GF_HUMONGOUS)
-				sprintf(buf, "%s.he%.1d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
+				sprintf(buf, "%s.he%.1d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
 			else {
-				sprintf(buf, "%s.%.3d",  _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
+				sprintf(buf, "%s.%.3d",  _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
 				if (_gameId == GID_SAMNMAX)
-					sprintf(buf2, "%s.sm%.1d",  _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
+					sprintf(buf2, "%s.sm%.1d",  _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
 			}
 
 			encByte = (_features & GF_USE_KEY) ? 0x69 : 0;

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- saveload.cpp	12 Oct 2003 17:33:28 -0000	1.114
+++ saveload.cpp	12 Oct 2003 19:10:16 -0000	1.115
@@ -228,7 +228,7 @@
 }
 
 void ScummEngine::makeSavegameName(char *out, int slot, bool compatible) {
-	sprintf(out, "%s.%c%.2d", _game_name, compatible ? 'c' : 's', slot);
+	sprintf(out, "%s.%c%.2d", _targetName.c_str(), compatible ? 'c' : 's', slot);
 }
 
 void ScummEngine::listSavegames(bool *marks, int num, SaveFileManager *mgr) {

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.313
retrieving revision 1.314
diff -u -d -r1.313 -r1.314
--- scumm.h	12 Oct 2003 17:33:29 -0000	1.313
+++ scumm.h	12 Oct 2003 19:10:16 -0000	1.314
@@ -311,7 +311,7 @@
 	void clearClickedStatus();
 
 	// Misc utility functions
-	const char *getExeName() const { return _exe_name; }
+	const char *getGameName() const { return _gameName.c_str(); }
 	const char *getGameDataPath() const;
 
 	// Cursor/palette
@@ -556,8 +556,8 @@
 	File _fileHandle;
 	uint32 _fileOffset;
 	int _resourceHeaderSize;
-	char *_exe_name;	// This is the name we use for opening resource files
-	char *_game_name;	// This is the game the user calls it, so use for saving
+	Common::String _gameName;	// 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
 	bool _dynamicRoomOffsets;
 	byte _resourceMapper[128];
 	uint32 _allocatedSize;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.437
retrieving revision 2.438
diff -u -d -r2.437 -r2.438
--- scummvm.cpp	12 Oct 2003 18:40:09 -0000	2.437
+++ scummvm.cpp	12 Oct 2003 19:10:16 -0000	2.438
@@ -364,8 +364,6 @@
 	_keyScriptKey = 0;
 	_keyScriptNo = 0;
 	_fileOffset = 0;
-	_exe_name = NULL;
-	_game_name = NULL;
 	_dynamicRoomOffsets = false;
 	memset(_resourceMapper, 0, sizeof(_resourceMapper));
 	_allocatedSize = 0;
@@ -595,8 +593,13 @@
 	_debugLevel = ConfMan.getInt("debuglevel");
 	_dumpScripts = detector->_dumpScripts;
 	_bootParam = ConfMan.getInt("boot_param");
-	_exe_name = strdup(detector->_game.gameName);
-	_game_name = strdup(detector->_targetName.c_str());
+
+	// 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") : detector->_game.gameName;
+
+	_targetName = detector->_targetName;
 	_gameId = detector->_game.id;
 	_version = detector->_game.version;
 	setFeatures(detector->_game.features);
@@ -786,8 +789,6 @@
 	free(_bitVars);
 	free(_newNames);
 	free(_classData);
-	free(_exe_name);
-	free(_game_name);
 
 	free(_roomStrips);
 	free(_languageIndex);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -d -r1.265 -r1.266
--- sound.cpp	8 Oct 2003 21:59:22 -0000	1.265
+++ sound.cpp	12 Oct 2003 19:10:16 -0000	1.266
@@ -895,13 +895,13 @@
 	char buf[256];
 	File *file = new File();
 
-	/* Try opening the file <_exe_name>.sou first, eg tentacle.sou.
+	/* Try opening the file <_gameName>.sou first, eg tentacle.sou.
 	 * That way, you can keep .sou files for multiple games in the
 	 * same directory */
 	offset_table = NULL;
 
 #ifdef USE_MAD
-	sprintf(buf, "%s.so3", _scumm->getExeName());
+	sprintf(buf, "%s.so3", _scumm->getGameName());
 	if (!file->open(buf, _scumm->getGameDataPath())) {
 		file->open("monster.so3", _scumm->getGameDataPath());
 	}
@@ -911,7 +911,7 @@
 
 #ifdef USE_VORBIS
 	if (!file->isOpen()) {
-		sprintf(buf, "%s.sog", _scumm->getExeName());
+		sprintf(buf, "%s.sog", _scumm->getGameName());
 		if (!file->open(buf, _scumm->getGameDataPath()))
 			file->open("monster.sog", _scumm->getGameDataPath());
 		if (file->isOpen())
@@ -953,13 +953,13 @@
 		return file;
 	}
 
-	sprintf(buf, "%s.sou", _scumm->getExeName());
+	sprintf(buf, "%s.sou", _scumm->getGameName());
 	if (!file->open(buf, _scumm->getGameDataPath())) {
 		file->open("monster.sou", _scumm->getGameDataPath());
 	}
 
 	if (!file->isOpen()) {
-		sprintf(buf, "%s.tlk", _scumm->getExeName());
+		sprintf(buf, "%s.tlk", _scumm->getGameName());
 		file->open(buf, _scumm->getGameDataPath(), 1, 0x69);
 	}
 	return file;





More information about the Scummvm-git-logs mailing list