[Scummvm-cvs-logs] SF.net SVN: scummvm: [20753] scummvm/trunk/base
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Feb 18 04:52:01 CET 2006
Revision: 20753
Author: fingolfin
Date: 2006-02-18 04:50:48 -0800 (Sat, 18 Feb 2006)
ViewCVS: http://svn.sourceforge.net/scummvm?rev=20753&view=rev
Log Message:
-----------
- Merged GameDetector::detectGame() into GameDetector::detectMain()
- Replaced GameSettings GameDetector::_game by a simple gameid string
Modified Paths:
--------------
scummvm/trunk/base/gameDetector.cpp
scummvm/trunk/base/gameDetector.h
scummvm/trunk/base/main.cpp
scummvm/trunk/engines/scumm/scumm.cpp
scummvm/trunk/engines/simon/simon.cpp
scummvm/trunk/engines/sword1/sword1.cpp
scummvm/trunk/engines/sword2/sword2.cpp
Modified: scummvm/trunk/base/gameDetector.cpp
===================================================================
--- scummvm/trunk/base/gameDetector.cpp 2006-02-18 11:15:37 UTC (rev 20752)
+++ scummvm/trunk/base/gameDetector.cpp 2006-02-18 12:50:48 UTC (rev 20753)
@@ -225,7 +225,6 @@
_force1xOverlay = false;
#endif
- memset(&_game, 0, sizeof(_game));
_plugin = 0;
}
@@ -630,37 +629,28 @@
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");
Modified: scummvm/trunk/base/gameDetector.h
===================================================================
--- scummvm/trunk/base/gameDetector.h 2006-02-18 11:15:37 UTC (rev 20752)
+++ scummvm/trunk/base/gameDetector.h 2006-02-18 12:50:48 UTC (rev 20753)
@@ -65,14 +65,13 @@
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 @@
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
Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp 2006-02-18 11:15:37 UTC (rev 20752)
+++ scummvm/trunk/base/main.cpp 2006-02-18 12:50:48 UTC (rev 20753)
@@ -291,8 +291,9 @@
// 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()) {
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp 2006-02-18 11:15:37 UTC (rev 20752)
+++ scummvm/trunk/engines/scumm/scumm.cpp 2006-02-18 12:50:48 UTC (rev 20753)
@@ -3361,9 +3361,9 @@
// 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 @@
// 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++;
}
Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp 2006-02-18 11:15:37 UTC (rev 20752)
+++ scummvm/trunk/engines/simon/simon.cpp 2006-02-18 12:50:48 UTC (rev 20753)
@@ -127,8 +127,8 @@
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);
Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp 2006-02-18 11:15:37 UTC (rev 20752)
+++ scummvm/trunk/engines/sword1/sword1.cpp 2006-02-18 12:50:48 UTC (rev 20753)
@@ -135,7 +135,7 @@
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;
Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp 2006-02-18 11:15:37 UTC (rev 20752)
+++ scummvm/trunk/engines/sword2/sword2.cpp 2006-02-18 12:50:48 UTC (rev 20753)
@@ -125,7 +125,7 @@
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;
More information about the Scummvm-git-logs
mailing list