aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorMax Horn2003-10-12 18:40:12 +0000
committerMax Horn2003-10-12 18:40:12 +0000
commit36fd7ec44574a4b1712fff1eb0ec43a76aab8f1c (patch)
treec7d0ddca69492d7db124a6c9ea4728e59faba071 /base
parentc3f4bbf34fe5192fe5bccd87c4319a42e1109422 (diff)
downloadscummvm-rg350-36fd7ec44574a4b1712fff1eb0ec43a76aab8f1c.tar.gz
scummvm-rg350-36fd7ec44574a4b1712fff1eb0ec43a76aab8f1c.tar.bz2
scummvm-rg350-36fd7ec44574a4b1712fff1eb0ec43a76aab8f1c.zip
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
svn-id: r10766
Diffstat (limited to 'base')
-rw-r--r--base/engine.h2
-rw-r--r--base/gameDetector.cpp38
-rw-r--r--base/gameDetector.h12
-rw-r--r--base/main.cpp10
-rw-r--r--base/plugins.cpp38
-rw-r--r--base/plugins.h8
6 files changed, 55 insertions, 53 deletions
diff --git a/base/engine.h b/base/engine.h
index e1bb4c71cc..25ad6e343e 100644
--- a/base/engine.h
+++ b/base/engine.h
@@ -59,7 +59,7 @@ enum GameId {
class SoundMixer;
class GameDetector;
class Timer;
-struct TargetSettings;
+struct GameSettings;
class Engine {
public:
diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp
index 9f4d5d4499..06430a5f58 100644
--- a/base/gameDetector.cpp
+++ b/base/gameDetector.cpp
@@ -242,7 +242,7 @@ void GameDetector::list_games() {
// 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 @@ void GameDetector::list_games() {
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 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
// 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 @@ ShowHelpAndExit:
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 @@ int GameDetector::parseMusicDriver(const String &str) {
}
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::detectGame() {
}
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;
}
diff --git a/base/gameDetector.h b/base/gameDetector.h
index 7f96ecf4e4..a236d0b479 100644
--- a/base/gameDetector.h
+++ b/base/gameDetector.h
@@ -84,8 +84,8 @@ enum MidiDriverType {
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 @@ public:
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 @@ public:
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);
diff --git a/base/main.cpp b/base/main.cpp
index 2ca7a9966d..6b90e531f7 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -259,16 +259,18 @@ int main(int argc, char *argv[]) {
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 @@ int main(int argc, char *argv[]) {
// 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);
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 45ffec8d7f..9d78f2ffa2 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -44,27 +44,27 @@ typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
// 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 @@ extern Engine *Engine_QUEEN_create(GameDetector *detector, OSystem *syst);
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 @@ const TargetSettings *Plugin::findTarget(const char *targetName) const {
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 @@ public:
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 @@ class DynamicPlugin : public Plugin {
Common::String _filename;
Common::String _name;
- const TargetSettings *_targets;
+ const GameSettings *_targets;
int _targetCount;
EngineFactory _ef;
@@ -144,7 +144,7 @@ public:
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 @@ void *DynamicPlugin::findSymbol(const char *symbol) {
}
typedef const char *(*NameFunc)();
-typedef const TargetSettings *(*TargetListFunc)();
+typedef const GameSettings *(*TargetListFunc)();
bool DynamicPlugin::loadPlugin() {
assert(!_dlHandle);
diff --git a/base/plugins.h b/base/plugins.h
index 990ad68703..817ec79f85 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -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 @@ public:
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 @@ public:
#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