[Scummvm-cvs-logs] CVS: scummvm/base engine.h,1.5,1.6 gameDetector.cpp,1.22,1.23 gameDetector.h,1.8,1.9 main.cpp,1.14,1.15 plugins.cpp,1.11,1.12 plugins.h,1.7,1.8
Max Horn
fingolfin at users.sourceforge.net
Sun Oct 12 11:41:06 CEST 2003
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1:/tmp/cvs-serv28202/base
Modified Files:
engine.h gameDetector.cpp gameDetector.h main.cpp plugins.cpp
plugins.h
Log Message:
some renaming for more consistent terminology (although we might want to reevaluate this): 'target' is what is in your config file; 'game' is what a frontend provide. E.g. the scumm frontend provides the game 'monkeyvga', and my config file has target 'monkeyvga-ger' configured to use that game
Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/engine.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- engine.h 10 Oct 2003 13:55:05 -0000 1.5
+++ engine.h 12 Oct 2003 18:40:08 -0000 1.6
@@ -59,7 +59,7 @@
class SoundMixer;
class GameDetector;
class Timer;
-struct TargetSettings;
+struct GameSettings;
class Engine {
public:
Index: gameDetector.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- gameDetector.cpp 12 Oct 2003 18:24:28 -0000 1.22
+++ gameDetector.cpp 12 Oct 2003 18:40:08 -0000 1.23
@@ -242,7 +242,7 @@
// 2) List all available (configured) targets, including those with custom
// names, e.g. "monkey-mac", "skycd-demo", ...
const PluginList &plugins = PluginManager::instance().getPlugins();
- const TargetSettings *v;
+ const GameSettings *v;
printf("Game Full Title \n"
"---------------- ------------------------------------------------------\n");
@@ -250,26 +250,26 @@
PluginList::ConstIterator iter = plugins.begin();
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
v = (*iter)->getTargets();
- while (v->targetName && v->description) {
+ while (v->gameName && v->description) {
#if 1
- printf("%-17s%-56s\n", v->targetName, v->description);
+ printf("%-17s%-56s\n", v->gameName, v->description);
#else
- const char *config = (g_config->has_domain(v->targetName)) ? "Yes" : "";
- printf("%-17s%-56s%s\n", v->targetName, v->description, config);
+ const char *config = (g_config->has_domain(v->gameName)) ? "Yes" : "";
+ printf("%-17s%-56s%s\n", v->gameName, v->description, config);
#endif
v++;
}
}
}
-const TargetSettings *GameDetector::findTarget(const String &targetName, const Plugin **plugin) const {
- // Find the TargetSettings for this target
- const TargetSettings *target;
+const GameSettings *GameDetector::findGame(const String &gameName, const Plugin **plugin) const {
+ // Find the GameSettings for this target
+ const GameSettings *target;
const PluginList &plugins = PluginManager::instance().getPlugins();
PluginList::ConstIterator iter = plugins.begin();
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
- target = (*iter)->findTarget(targetName.c_str());
+ target = (*iter)->findGame(gameName.c_str());
if (target) {
if (plugin)
*plugin = *iter;
@@ -457,8 +457,8 @@
// To verify this, check if there is either a game domain (i.e
// a configured target) matching this argument, or if we can
// find any target with that name.
- if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findTarget(s))) {
- setGame(s);
+ if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findGame(s))) {
+ setTarget(s);
} else {
if (current_option == NULL)
current_option = s;
@@ -475,8 +475,8 @@
exit(1);
}
-void GameDetector::setGame(const String &name) {
- _gameFileName = name;
+void GameDetector::setTarget(const String &name) {
+ _targetName = name;
ConfMan.setActiveDomain(name);
}
@@ -546,23 +546,23 @@
}
bool GameDetector::detectGame() {
- const TargetSettings *target;
+ const GameSettings *target;
String realGame;
if (ConfMan.hasKey("gameid"))
realGame = ConfMan.get("gameid");
else
- realGame = _gameFileName;
+ realGame = _targetName;
printf("Looking for %s\n", realGame.c_str());
- target = findTarget(realGame, &_plugin);
+ target = findGame(realGame, &_plugin);
if (target) {
_game = *target;
if (ConfMan.hasKey("basename")) {
// FIXME: What is this good for?
// FIXME: This leaks now!
- _game.targetName = strdup(ConfMan.get("basename").c_str());
+ _game.gameName = strdup(ConfMan.get("basename").c_str());
}
printf("Trying to start game '%s'\n", _game.description);
return true;
@@ -573,13 +573,13 @@
}
bool GameDetector::detectMain() {
- if (_gameFileName.isEmpty()) {
+ if (_targetName.isEmpty()) {
warning("No game was specified...");
return false;
}
if (!detectGame()) {
- warning("%s is an invalid target. Use the -z parameter to list targets", _gameFileName.c_str());
+ warning("%s is an invalid target. Use the -z parameter to list targets", _targetName.c_str());
return false;
}
Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/gameDetector.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gameDetector.h 8 Oct 2003 21:59:21 -0000 1.8
+++ gameDetector.h 12 Oct 2003 18:40:08 -0000 1.9
@@ -84,8 +84,8 @@
MDT_PREFER_NATIVE = 16
};
-struct TargetSettings {
- const char *targetName;
+struct GameSettings {
+ const char *gameName;
const char *description;
byte id, version;
int midi; // MidiDriverType values
@@ -102,8 +102,8 @@
void parseCommandLine(int argc, char **argv);
bool detectMain();
- String _gameFileName;
- TargetSettings _game;
+ String _targetName;
+ GameSettings _game;
const Plugin *_plugin;
bool _debugMode;
@@ -120,14 +120,14 @@
MidiDriver *createMidi();
int getMidiDriverType(); // FIXME: Try to get rid of this, only Sky frontend uses it
- void setGame(const String &name);
+ void setTarget(const String &name);
static int parseGraphicsMode(const String &s); // Used in main()
static int parseMusicDriver(const String &s);
static Language parseLanguage(const String &s);
static Platform parsePlatform(const String &s);
- const TargetSettings *findTarget(const String &targetName, const Plugin **plugin = NULL) const;
+ const GameSettings *findGame(const String &gameName, const Plugin **plugin = NULL) const;
protected:
bool detectGame(void);
Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- main.cpp 8 Oct 2003 22:10:59 -0000 1.14
+++ main.cpp 12 Oct 2003 18:40:08 -0000 1.15
@@ -259,16 +259,18 @@
g_gui = new NewGui(system);
// Unless a game was specified, show the launcher dialog
- if (detector._gameFileName.isEmpty())
+ if (detector._targetName.isEmpty())
launcherDialog(detector, system);
// Verify the given game name is a valid supported game
if (detector.detectMain()) {
// Set the window caption to the game name
- prop.caption = ConfMan.get("description", detector._gameFileName).c_str();
+ prop.caption = ConfMan.get("description", detector._targetName).c_str();
if (prop.caption == NULL)
- prop.caption = detector._gameFileName.c_str();
+ prop.caption = detector._game.description;
+ if (prop.caption == NULL)
+ prop.caption = detector._targetName.c_str();
if (prop.caption != NULL)
system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
@@ -277,7 +279,7 @@
// should combine both checks into one.
// See if the game should default to 1x scaler
- if (!ConfMan.hasKey("gfx_mode", detector._gameFileName) &&
+ if (!ConfMan.hasKey("gfx_mode", detector._targetName) &&
(detector._game.features & GF_DEFAULT_TO_1X_SCALER)) {
prop.gfx_mode = GFX_NORMAL;
system->property(OSystem::PROP_SET_GFX_MODE, &prop);
Index: plugins.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/plugins.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- plugins.cpp 8 Oct 2003 22:10:58 -0000 1.11
+++ plugins.cpp 12 Oct 2003 18:40:08 -0000 1.12
@@ -44,27 +44,27 @@
// 1) Clean seperation from the game modules (scumm, simon) and the generic code
// 2) Faster (compiler doesn't have to parse lengthy header files)
#ifndef DISABLE_SCUMM
-extern const TargetSettings *Engine_SCUMM_targetList();
+extern const GameSettings *Engine_SCUMM_targetList();
extern Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst);
#endif
#ifndef DISABLE_SIMON
extern Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst);
-extern const TargetSettings *Engine_SIMON_targetList();
+extern const GameSettings *Engine_SIMON_targetList();
#endif
#ifndef DISABLE_SKY
-extern const TargetSettings *Engine_SKY_targetList();
+extern const GameSettings *Engine_SKY_targetList();
extern Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst);
#endif
#ifndef DISABLE_SWORD2
-extern const TargetSettings *Engine_SWORD2_targetList();
+extern const GameSettings *Engine_SWORD2_targetList();
extern Engine *Engine_SWORD2_create(GameDetector *detector, OSystem *syst);
#endif
#ifndef DISABLE_QUEEN
-extern const TargetSettings *Engine_QUEEN_targetList();
+extern const GameSettings *Engine_QUEEN_targetList();
extern Engine *Engine_QUEEN_create(GameDetector *detector, OSystem *syst);
#endif
@@ -75,19 +75,19 @@
int Plugin::countTargets() const {
- const TargetSettings *target = getTargets();
+ const GameSettings *target = getTargets();
int count;
- for (count = 0; target->targetName; target++, count++)
+ for (count = 0; target->gameName; target++, count++)
;
return count;
}
-const TargetSettings *Plugin::findTarget(const char *targetName) const {
- // Find the TargetSettings for this target
- const TargetSettings *target = getTargets();
- assert(targetName);
- while (target->targetName) {
- if (!scumm_stricmp(target->targetName, targetName)) {
+const GameSettings *Plugin::findGame(const char *gameName) const {
+ // Find the GameSettings for this target
+ const GameSettings *target = getTargets();
+ assert(gameName);
+ while (target->gameName) {
+ if (!scumm_stricmp(target->gameName, gameName)) {
return target;
}
target++;
@@ -101,11 +101,11 @@
class StaticPlugin : public Plugin {
const char *_name;
- const TargetSettings *_targets;
+ const GameSettings *_targets;
int _targetCount;
EngineFactory _ef;
public:
- StaticPlugin(const char *name, const TargetSettings *targets, EngineFactory ef)
+ StaticPlugin(const char *name, const GameSettings *targets, EngineFactory ef)
: _name(name), _targets(targets), _ef(ef) {
_targetCount = Plugin::countTargets();
}
@@ -113,7 +113,7 @@
const char *getName() const { return _name; }
int countTargets() const { return _targetCount; }
- const TargetSettings *getTargets() const { return _targets; }
+ const GameSettings *getTargets() const { return _targets; }
Engine *createInstance(GameDetector *detector, OSystem *syst) const {
return (*_ef)(detector, syst);
@@ -131,7 +131,7 @@
Common::String _filename;
Common::String _name;
- const TargetSettings *_targets;
+ const GameSettings *_targets;
int _targetCount;
EngineFactory _ef;
@@ -144,7 +144,7 @@
const char *getName() const { return _name.c_str(); }
int countTargets() const { return _targetCount; }
- const TargetSettings *getTargets() const { return _targets; }
+ const GameSettings *getTargets() const { return _targets; }
Engine *createInstance(GameDetector *detector, OSystem *syst) const {
assert(_ef);
@@ -174,7 +174,7 @@
}
typedef const char *(*NameFunc)();
-typedef const TargetSettings *(*TargetListFunc)();
+typedef const GameSettings *(*TargetListFunc)();
bool DynamicPlugin::loadPlugin() {
assert(!_dlHandle);
Index: plugins.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/plugins.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- plugins.h 11 Oct 2003 14:13:22 -0000 1.7
+++ plugins.h 12 Oct 2003 18:40:08 -0000 1.8
@@ -29,7 +29,7 @@
class Engine;
class GameDetector;
class OSystem;
-struct TargetSettings;
+struct GameSettings;
/**
* Abstract base class for the plugin system.
@@ -47,8 +47,8 @@
virtual int getVersion() const { return 0; } // TODO!
virtual int countTargets() const;
- virtual const TargetSettings *getTargets() const = 0;
- virtual const TargetSettings *findTarget(const char *targetName) const;
+ virtual const GameSettings *getTargets() const = 0;
+ virtual const GameSettings *findGame(const char *gameName) const;
virtual Engine *createInstance(GameDetector *detector, OSystem *syst) const = 0;
};
@@ -69,7 +69,7 @@
#define REGISTER_PLUGIN(name,targetListFactory,engineFactory) \
extern "C" { \
const char *PLUGIN_name() { return name; } \
- const TargetSettings *PLUGIN_getTargetList() { return targetListFactory(); } \
+ const GameSettings *PLUGIN_getTargetList() { return targetListFactory(); } \
Engine *PLUGIN_createEngine(GameDetector *detector, OSystem *syst) { return engineFactory(detector, syst); } \
}
#endif
More information about the Scummvm-git-logs
mailing list