diff options
author | Max Horn | 2006-02-18 12:50:48 +0000 |
---|---|---|
committer | Max Horn | 2006-02-18 12:50:48 +0000 |
commit | 01fc7034b535e2dcc0526d5ac4d1ae4eae60459f (patch) | |
tree | 4e10d3d934d77825bd9f76fc4eca0177067e596a | |
parent | 8ac17430ac7aa3bba5630d74a1eeda54bce7801b (diff) | |
download | scummvm-rg350-01fc7034b535e2dcc0526d5ac4d1ae4eae60459f.tar.gz scummvm-rg350-01fc7034b535e2dcc0526d5ac4d1ae4eae60459f.tar.bz2 scummvm-rg350-01fc7034b535e2dcc0526d5ac4d1ae4eae60459f.zip |
- Merged GameDetector::detectGame() into GameDetector::detectMain()
- Replaced GameSettings GameDetector::_game by a simple gameid string
svn-id: r20753
-rw-r--r-- | base/gameDetector.cpp | 34 | ||||
-rw-r--r-- | base/gameDetector.h | 9 | ||||
-rw-r--r-- | base/main.cpp | 5 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 6 | ||||
-rw-r--r-- | engines/simon/simon.cpp | 4 | ||||
-rw-r--r-- | engines/sword1/sword1.cpp | 2 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 2 |
7 files changed, 26 insertions, 36 deletions
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index b2aa2d64f7..d787f257e1 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -225,7 +225,6 @@ GameDetector::GameDetector() { _force1xOverlay = false; #endif - memset(&_game, 0, sizeof(_game)); _plugin = 0; } @@ -630,37 +629,28 @@ void GameDetector::setTarget(const String &target) { ConfMan.setActiveDomain(target); } -bool GameDetector::detectGame() { - String realGame; - - if (ConfMan.hasKey("gameid")) - realGame = ConfMan.get("gameid"); - else - realGame = _targetName; - - printf("Looking for %s\n", realGame.c_str()); - _game = findGame(realGame, &_plugin); - - if (_game.gameid) { - printf("Trying to start game '%s'\n", _game.description); - return true; - } else { - printf("Failed game detection\n"); - return false; - } -} - bool GameDetector::detectMain() { if (_targetName.isEmpty()) { warning("No game was specified..."); return false; } - if (!detectGame()) { + if (ConfMan.hasKey("gameid")) + _gameid = ConfMan.get("gameid"); + else + _gameid = _targetName; + + printf("Looking for %s\n", _gameid.c_str()); + GameSettings game = findGame(_gameid, &_plugin); + + if (!game.gameid) { + printf("Failed game detection\n"); warning("%s is an invalid target. Use the --list-targets option to list targets", _targetName.c_str()); return false; } + printf("Trying to start game '%s'\n", game.description); + String gameDataPath(ConfMan.get("path")); if (gameDataPath.isEmpty()) { warning("No path was provided. Assuming the data files are in the current directory"); diff --git a/base/gameDetector.h b/base/gameDetector.h index bdbb68bf90..0cada3e597 100644 --- a/base/gameDetector.h +++ b/base/gameDetector.h @@ -65,14 +65,13 @@ public: bool detectMain(); String _targetName; - GameSettings _game; // TODO: Eventually get rid of this?! - const Plugin *_plugin; + String _gameid; bool _dumpScripts; bool _force1xOverlay; - void setTarget(const String &name); + const Plugin *_plugin; // TODO: This should be protected public: Engine *createEngine(OSystem *system); @@ -81,8 +80,8 @@ public: static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL); -protected: - bool detectGame(void); +//protected: + void setTarget(const String &name); // TODO: This should be protected }; #endif diff --git a/base/main.cpp b/base/main.cpp index 4d74a77858..4328b4a81a 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -291,8 +291,9 @@ static int runGame(GameDetector &detector, OSystem &system, const Common::String // Set the window caption to the game name Common::String caption(ConfMan.get("description", detector._targetName)); - if (caption.isEmpty() && detector._game.description) - caption = detector._game.description; + const char *desc = GameDetector::findGame(detector._gameid).description; + if (caption.isEmpty() && desc) + caption = desc; if (caption.isEmpty()) caption = detector._targetName; if (!caption.isEmpty()) { diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 695a1c9bc8..7d8a5239cc 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -3361,9 +3361,9 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { // the correct new game ID (and platform, if specified). const ObsoleteGameID *o = obsoleteGameIDsTable; while (o->from) { - if (!scumm_stricmp(detector->_game.gameid, o->from)) { + if (!scumm_stricmp(detector->_gameid.c_str(), o->from)) { // Match found, perform upgrade - detector->_game.gameid = o->to; + detector->_gameid = o->to; ConfMan.set("gameid", o->to); if (o->platform != Common::kPlatformUnknown) @@ -3380,7 +3380,7 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { // the game ID is unknown, and we have to abort. const ScummGameSettings *g = scumm_settings; while (g->gameid) { - if (!scumm_stricmp(detector->_game.gameid, g->gameid)) + if (!scumm_stricmp(detector->_gameid.c_str(), g->gameid)) break; g++; } diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index cd9c36d564..2e17a725c1 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -127,8 +127,8 @@ DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) { Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst) { const ObsoleteGameID *o = obsoleteGameIDsTable; while (o->from) { - if (!scumm_stricmp(detector->_game.gameid, o->from)) { - detector->_game.gameid = o->to; + if (!scumm_stricmp(detector->_gameid.c_str(), o->from)) { + detector->_gameid = o->to; ConfMan.set("gameid", o->to); diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp index 47b4a9e780..fb2c352523 100644 --- a/engines/sword1/sword1.cpp +++ b/engines/sword1/sword1.cpp @@ -135,7 +135,7 @@ void SwordEngine::errorString(const char *buf1, char *buf2) { SwordEngine::SwordEngine(GameDetector *detector, OSystem *syst) : Engine(syst) { - if (0 == strcmp(detector->_game.gameid, "sword1demo")) + if (0 == scumm_stricmp(detector->_gameid.c_str(), "sword1demo")) _features = GF_DEMO; else _features = 0; diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 56ae60b7ff..4abd8b1a70 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -125,7 +125,7 @@ Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst) : Engine(syst) Common::File::addDefaultDirectory(_gameDataPath + "sword2/"); Common::File::addDefaultDirectory(_gameDataPath + "video/"); - if (0 == strcmp(detector->_game.gameid, "sword2demo")) + if (0 == scumm_stricmp(detector->_gameid.c_str(), "sword2demo")) _features = GF_DEMO; else _features = 0; |