aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2006-01-21 13:01:20 +0000
committerMax Horn2006-01-21 13:01:20 +0000
commit0b39c0ea9fbc43569a17f65db6fe6a89f29ccee1 (patch)
treec1b6170cbc006981a22b36c4b02f10bda699c542 /scumm
parente34d963027194654259c4ce3499780671f36e133 (diff)
downloadscummvm-rg350-0b39c0ea9fbc43569a17f65db6fe6a89f29ccee1.tar.gz
scummvm-rg350-0b39c0ea9fbc43569a17f65db6fe6a89f29ccee1.tar.bz2
scummvm-rg350-0b39c0ea9fbc43569a17f65db6fe6a89f29ccee1.zip
Fix various incorrect usages of the word 'target' instead of 'gameid'; change the ambigiuous 'GameSettings::name' to 'GameSettings::gameid'
svn-id: r20115
Diffstat (limited to 'scumm')
-rw-r--r--scumm/debugger.cpp2
-rw-r--r--scumm/resource.cpp18
-rw-r--r--scumm/resource_v7he.cpp4
-rw-r--r--scumm/scumm-md5.h4
-rw-r--r--scumm/scumm.cpp82
-rw-r--r--scumm/scumm.h4
-rw-r--r--scumm/smush/smush_player.cpp2
-rw-r--r--scumm/sound.cpp8
-rw-r--r--scumm/sound_he.cpp4
9 files changed, 69 insertions, 59 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index e86ab9065d..c4a8da0920 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -82,7 +82,7 @@ ScummDebugger::ScummDebugger(ScummEngine *s)
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
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 4c02945aca..b5c505ec5a 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -118,28 +118,28 @@ void ScummEngine::openRoom(const int room) {
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;
diff --git a/scumm/resource_v7he.cpp b/scumm/resource_v7he.cpp
index e2e2d396a2..3977140693 100644
--- a/scumm/resource_v7he.cpp
+++ b/scumm/resource_v7he.cpp
@@ -158,7 +158,7 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
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 @@ int MacResExtractor::extractResource(int id, byte **buf) {
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
diff --git a/scumm/scumm-md5.h b/scumm/scumm-md5.h
index 50e8f76d49..9948a2ab27 100644
--- a/scumm/scumm-md5.h
+++ b/scumm/scumm-md5.h
@@ -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;
};
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index 0aa920ec5f..d9b9eef61e 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -89,7 +89,7 @@ namespace Scumm {
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 @@ struct ScummGameSettings {
Common::Platform platform;
GameSettings toGameSettings() const {
- GameSettings dummy = { name, description, features };
+ GameSettings dummy = { gameid, description, features };
return dummy;
}
};
@@ -109,13 +109,13 @@ enum {
};
-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 @@ struct ObsoleteTargets {
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 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
// 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 @@ void ScummEngine_v99he::scummInit() {
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 @@ using namespace Scumm;
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 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
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 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
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 @@ static int generateSubstResFileName_(const char *filename, char *buf, int bufsiz
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 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
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 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
// 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;
diff --git a/scumm/scumm.h b/scumm/scumm.h
index c86fd15bfb..7e0b7f0ee9 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -434,7 +434,7 @@ public:
// 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 @@ public:
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;
diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp
index 34f5a01e5c..06e1af0cd8 100644
--- a/scumm/smush/smush_player.cpp
+++ b/scumm/smush/smush_player.cpp
@@ -1170,7 +1170,7 @@ void SmushPlayer::updateScreen() {
#ifdef DUMP_SMUSH_FRAMES
char fileName[100];
// change path below for dump png files
- sprintf(fileName, "/path/to/somethere/%s%04d.png", _vm->getGameName(), _frame);
+ sprintf(fileName, "/path/to/somethere/%s%04d.png", _vm->getBaseName(), _frame);
FILE *file = fopen(fileName, "wb");
if (file == NULL)
error("can't open file for writing png");
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 681ff0ebd8..067cb0dc93 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -1008,12 +1008,12 @@ ScummFile *Sound::openSfxFile() {
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 @@ ScummFile *Sound::openSfxFile() {
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) {
diff --git a/scumm/sound_he.cpp b/scumm/sound_he.cpp
index 6defced989..9d29d42b5e 100644
--- a/scumm/sound_he.cpp
+++ b/scumm/sound_he.cpp
@@ -138,7 +138,7 @@ void Sound::setupHEMusicFile() {
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 @@ void Sound::playHESound(int soundID, int heOffset, int heChannel, int heFlags) {
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));