diff options
author | Max Horn | 2003-10-12 19:10:17 +0000 |
---|---|---|
committer | Max Horn | 2003-10-12 19:10:17 +0000 |
commit | 31ba12c800f55d3611c36838a18e4276dec239ff (patch) | |
tree | 6e125ace0a0bb383f27ed53bb45f6f5ad923dc7f /scumm | |
parent | 5325ed83cf8166203ade9565805550a768786264 (diff) | |
download | scummvm-rg350-31ba12c800f55d3611c36838a18e4276dec239ff.tar.gz scummvm-rg350-31ba12c800f55d3611c36838a18e4276dec239ff.tar.bz2 scummvm-rg350-31ba12c800f55d3611c36838a18e4276dec239ff.zip |
some more target<->game cleanup
svn-id: r10769
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/debugger.cpp | 7 | ||||
-rw-r--r-- | scumm/resource.cpp | 12 | ||||
-rw-r--r-- | scumm/saveload.cpp | 2 | ||||
-rw-r--r-- | scumm/scumm.h | 6 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 13 | ||||
-rw-r--r-- | scumm/smush/smush_player.cpp | 2 | ||||
-rw-r--r-- | scumm/sound.cpp | 10 |
7 files changed, 27 insertions, 25 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index e095fcf4bd..bd7b1a9ba9 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -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 @@ ScummDebugger::ScummDebugger(ScummEngine *s) { 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 @@ bool ScummDebugger::RunCommand(const char *inputOrig) { 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]); diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 9cf1919537..d42041f991 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -83,18 +83,18 @@ void ScummEngine::openRoom(int room) { 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; diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index 142e9417b4..13dc1d2609 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -228,7 +228,7 @@ bool ScummEngine::loadState(int slot, bool compat, SaveFileManager *mgr) { } 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) { diff --git a/scumm/scumm.h b/scumm/scumm.h index 9f04ddc9f1..52b4f72044 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -311,7 +311,7 @@ public: 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 @@ protected: 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; diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 65d2ce355a..1e72191943 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -364,8 +364,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst) _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 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst) _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 @@ ScummEngine::~ScummEngine() { free(_bitVars); free(_newNames); free(_classData); - free(_exe_name); - free(_game_name); free(_roomStrips); free(_languageIndex); diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 161c6ff3cd..c00c493ce5 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -887,7 +887,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", _scumm->getExeName, _frame); + sprintf(fileName, "/path/to/somethere/%s%04d.png", _scumm->getGameName(), _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 fd55633bd1..b8df43cb63 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -895,13 +895,13 @@ File *Sound::openSfxFile() { 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 @@ File *Sound::openSfxFile() { #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 @@ File *Sound::openSfxFile() { 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; |