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
This commit is contained in:
parent
c3f4bbf34f
commit
36fd7ec445
13 changed files with 87 additions and 85 deletions
2
TODO
2
TODO
|
@ -11,7 +11,7 @@ General
|
||||||
* allow for return-to-launcher instead of a normal "quit" ?
|
* allow for return-to-launcher instead of a normal "quit" ?
|
||||||
* improve the argv (command line args) parser
|
* improve the argv (command line args) parser
|
||||||
* extend the Plugin API to provide for "game detection": instead of the
|
* extend the Plugin API to provide for "game detection": instead of the
|
||||||
TargetSettings::detectname "hack" to detect files, provide a callback
|
GameSettings::detectname "hack" to detect files, provide a callback
|
||||||
in each Plugin which given a FSList returns a list of candidate targets.
|
in each Plugin which given a FSList returns a list of candidate targets.
|
||||||
This way, a plugin can implement tests more elaborate than filename
|
This way, a plugin can implement tests more elaborate than filename
|
||||||
checking, e.g. it could actually peek into the files.
|
checking, e.g. it could actually peek into the files.
|
||||||
|
|
|
@ -59,7 +59,7 @@ enum GameId {
|
||||||
class SoundMixer;
|
class SoundMixer;
|
||||||
class GameDetector;
|
class GameDetector;
|
||||||
class Timer;
|
class Timer;
|
||||||
struct TargetSettings;
|
struct GameSettings;
|
||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -242,7 +242,7 @@ void GameDetector::list_games() {
|
||||||
// 2) List all available (configured) targets, including those with custom
|
// 2) List all available (configured) targets, including those with custom
|
||||||
// names, e.g. "monkey-mac", "skycd-demo", ...
|
// names, e.g. "monkey-mac", "skycd-demo", ...
|
||||||
const PluginList &plugins = PluginManager::instance().getPlugins();
|
const PluginList &plugins = PluginManager::instance().getPlugins();
|
||||||
const TargetSettings *v;
|
const GameSettings *v;
|
||||||
|
|
||||||
printf("Game Full Title \n"
|
printf("Game Full Title \n"
|
||||||
"---------------- ------------------------------------------------------\n");
|
"---------------- ------------------------------------------------------\n");
|
||||||
|
@ -250,26 +250,26 @@ void GameDetector::list_games() {
|
||||||
PluginList::ConstIterator iter = plugins.begin();
|
PluginList::ConstIterator iter = plugins.begin();
|
||||||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||||
v = (*iter)->getTargets();
|
v = (*iter)->getTargets();
|
||||||
while (v->targetName && v->description) {
|
while (v->gameName && v->description) {
|
||||||
#if 1
|
#if 1
|
||||||
printf("%-17s%-56s\n", v->targetName, v->description);
|
printf("%-17s%-56s\n", v->gameName, v->description);
|
||||||
#else
|
#else
|
||||||
const char *config = (g_config->has_domain(v->targetName)) ? "Yes" : "";
|
const char *config = (g_config->has_domain(v->gameName)) ? "Yes" : "";
|
||||||
printf("%-17s%-56s%s\n", v->targetName, v->description, config);
|
printf("%-17s%-56s%s\n", v->gameName, v->description, config);
|
||||||
#endif
|
#endif
|
||||||
v++;
|
v++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TargetSettings *GameDetector::findTarget(const String &targetName, const Plugin **plugin) const {
|
const GameSettings *GameDetector::findGame(const String &gameName, const Plugin **plugin) const {
|
||||||
// Find the TargetSettings for this target
|
// Find the GameSettings for this target
|
||||||
const TargetSettings *target;
|
const GameSettings *target;
|
||||||
const PluginList &plugins = PluginManager::instance().getPlugins();
|
const PluginList &plugins = PluginManager::instance().getPlugins();
|
||||||
|
|
||||||
PluginList::ConstIterator iter = plugins.begin();
|
PluginList::ConstIterator iter = plugins.begin();
|
||||||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||||
target = (*iter)->findTarget(targetName.c_str());
|
target = (*iter)->findGame(gameName.c_str());
|
||||||
if (target) {
|
if (target) {
|
||||||
if (plugin)
|
if (plugin)
|
||||||
*plugin = *iter;
|
*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
|
// To verify this, check if there is either a game domain (i.e
|
||||||
// a configured target) matching this argument, or if we can
|
// a configured target) matching this argument, or if we can
|
||||||
// find any target with that name.
|
// find any target with that name.
|
||||||
if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findTarget(s))) {
|
if (i == (argc - 1) && (ConfMan.hasGameDomain(s) || findGame(s))) {
|
||||||
setGame(s);
|
setTarget(s);
|
||||||
} else {
|
} else {
|
||||||
if (current_option == NULL)
|
if (current_option == NULL)
|
||||||
current_option = s;
|
current_option = s;
|
||||||
|
@ -475,8 +475,8 @@ ShowHelpAndExit:
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameDetector::setGame(const String &name) {
|
void GameDetector::setTarget(const String &name) {
|
||||||
_gameFileName = name;
|
_targetName = name;
|
||||||
ConfMan.setActiveDomain(name);
|
ConfMan.setActiveDomain(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,23 +546,23 @@ int GameDetector::parseMusicDriver(const String &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameDetector::detectGame() {
|
bool GameDetector::detectGame() {
|
||||||
const TargetSettings *target;
|
const GameSettings *target;
|
||||||
String realGame;
|
String realGame;
|
||||||
|
|
||||||
if (ConfMan.hasKey("gameid"))
|
if (ConfMan.hasKey("gameid"))
|
||||||
realGame = ConfMan.get("gameid");
|
realGame = ConfMan.get("gameid");
|
||||||
else
|
else
|
||||||
realGame = _gameFileName;
|
realGame = _targetName;
|
||||||
printf("Looking for %s\n", realGame.c_str());
|
printf("Looking for %s\n", realGame.c_str());
|
||||||
|
|
||||||
target = findTarget(realGame, &_plugin);
|
target = findGame(realGame, &_plugin);
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
_game = *target;
|
_game = *target;
|
||||||
if (ConfMan.hasKey("basename")) {
|
if (ConfMan.hasKey("basename")) {
|
||||||
// FIXME: What is this good for?
|
// FIXME: What is this good for?
|
||||||
// FIXME: This leaks now!
|
// 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);
|
printf("Trying to start game '%s'\n", _game.description);
|
||||||
return true;
|
return true;
|
||||||
|
@ -573,13 +573,13 @@ bool GameDetector::detectGame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameDetector::detectMain() {
|
bool GameDetector::detectMain() {
|
||||||
if (_gameFileName.isEmpty()) {
|
if (_targetName.isEmpty()) {
|
||||||
warning("No game was specified...");
|
warning("No game was specified...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!detectGame()) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@ enum MidiDriverType {
|
||||||
MDT_PREFER_NATIVE = 16
|
MDT_PREFER_NATIVE = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TargetSettings {
|
struct GameSettings {
|
||||||
const char *targetName;
|
const char *gameName;
|
||||||
const char *description;
|
const char *description;
|
||||||
byte id, version;
|
byte id, version;
|
||||||
int midi; // MidiDriverType values
|
int midi; // MidiDriverType values
|
||||||
|
@ -102,8 +102,8 @@ public:
|
||||||
void parseCommandLine(int argc, char **argv);
|
void parseCommandLine(int argc, char **argv);
|
||||||
bool detectMain();
|
bool detectMain();
|
||||||
|
|
||||||
String _gameFileName;
|
String _targetName;
|
||||||
TargetSettings _game;
|
GameSettings _game;
|
||||||
const Plugin *_plugin;
|
const Plugin *_plugin;
|
||||||
|
|
||||||
bool _debugMode;
|
bool _debugMode;
|
||||||
|
@ -120,14 +120,14 @@ public:
|
||||||
MidiDriver *createMidi();
|
MidiDriver *createMidi();
|
||||||
int getMidiDriverType(); // FIXME: Try to get rid of this, only Sky frontend uses it
|
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 parseGraphicsMode(const String &s); // Used in main()
|
||||||
static int parseMusicDriver(const String &s);
|
static int parseMusicDriver(const String &s);
|
||||||
static Language parseLanguage(const String &s);
|
static Language parseLanguage(const String &s);
|
||||||
static Platform parsePlatform(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:
|
protected:
|
||||||
bool detectGame(void);
|
bool detectGame(void);
|
||||||
|
|
|
@ -259,16 +259,18 @@ int main(int argc, char *argv[]) {
|
||||||
g_gui = new NewGui(system);
|
g_gui = new NewGui(system);
|
||||||
|
|
||||||
// Unless a game was specified, show the launcher dialog
|
// Unless a game was specified, show the launcher dialog
|
||||||
if (detector._gameFileName.isEmpty())
|
if (detector._targetName.isEmpty())
|
||||||
launcherDialog(detector, system);
|
launcherDialog(detector, system);
|
||||||
|
|
||||||
// Verify the given game name is a valid supported game
|
// Verify the given game name is a valid supported game
|
||||||
if (detector.detectMain()) {
|
if (detector.detectMain()) {
|
||||||
|
|
||||||
// Set the window caption to the game name
|
// 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)
|
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)
|
if (prop.caption != NULL)
|
||||||
system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
|
system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
|
||||||
|
|
||||||
|
@ -277,7 +279,7 @@ int main(int argc, char *argv[]) {
|
||||||
// should combine both checks into one.
|
// should combine both checks into one.
|
||||||
|
|
||||||
// See if the game should default to 1x scaler
|
// 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)) {
|
(detector._game.features & GF_DEFAULT_TO_1X_SCALER)) {
|
||||||
prop.gfx_mode = GFX_NORMAL;
|
prop.gfx_mode = GFX_NORMAL;
|
||||||
system->property(OSystem::PROP_SET_GFX_MODE, &prop);
|
system->property(OSystem::PROP_SET_GFX_MODE, &prop);
|
||||||
|
|
|
@ -44,27 +44,27 @@ typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst);
|
||||||
// 1) Clean seperation from the game modules (scumm, simon) and the generic code
|
// 1) Clean seperation from the game modules (scumm, simon) and the generic code
|
||||||
// 2) Faster (compiler doesn't have to parse lengthy header files)
|
// 2) Faster (compiler doesn't have to parse lengthy header files)
|
||||||
#ifndef DISABLE_SCUMM
|
#ifndef DISABLE_SCUMM
|
||||||
extern const TargetSettings *Engine_SCUMM_targetList();
|
extern const GameSettings *Engine_SCUMM_targetList();
|
||||||
extern Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst);
|
extern Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_SIMON
|
#ifndef DISABLE_SIMON
|
||||||
extern Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst);
|
extern Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst);
|
||||||
extern const TargetSettings *Engine_SIMON_targetList();
|
extern const GameSettings *Engine_SIMON_targetList();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_SKY
|
#ifndef DISABLE_SKY
|
||||||
extern const TargetSettings *Engine_SKY_targetList();
|
extern const GameSettings *Engine_SKY_targetList();
|
||||||
extern Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst);
|
extern Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_SWORD2
|
#ifndef DISABLE_SWORD2
|
||||||
extern const TargetSettings *Engine_SWORD2_targetList();
|
extern const GameSettings *Engine_SWORD2_targetList();
|
||||||
extern Engine *Engine_SWORD2_create(GameDetector *detector, OSystem *syst);
|
extern Engine *Engine_SWORD2_create(GameDetector *detector, OSystem *syst);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_QUEEN
|
#ifndef DISABLE_QUEEN
|
||||||
extern const TargetSettings *Engine_QUEEN_targetList();
|
extern const GameSettings *Engine_QUEEN_targetList();
|
||||||
extern Engine *Engine_QUEEN_create(GameDetector *detector, OSystem *syst);
|
extern Engine *Engine_QUEEN_create(GameDetector *detector, OSystem *syst);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -75,19 +75,19 @@ extern Engine *Engine_QUEEN_create(GameDetector *detector, OSystem *syst);
|
||||||
|
|
||||||
|
|
||||||
int Plugin::countTargets() const {
|
int Plugin::countTargets() const {
|
||||||
const TargetSettings *target = getTargets();
|
const GameSettings *target = getTargets();
|
||||||
int count;
|
int count;
|
||||||
for (count = 0; target->targetName; target++, count++)
|
for (count = 0; target->gameName; target++, count++)
|
||||||
;
|
;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TargetSettings *Plugin::findTarget(const char *targetName) const {
|
const GameSettings *Plugin::findGame(const char *gameName) const {
|
||||||
// Find the TargetSettings for this target
|
// Find the GameSettings for this target
|
||||||
const TargetSettings *target = getTargets();
|
const GameSettings *target = getTargets();
|
||||||
assert(targetName);
|
assert(gameName);
|
||||||
while (target->targetName) {
|
while (target->gameName) {
|
||||||
if (!scumm_stricmp(target->targetName, targetName)) {
|
if (!scumm_stricmp(target->gameName, gameName)) {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
target++;
|
target++;
|
||||||
|
@ -101,11 +101,11 @@ const TargetSettings *Plugin::findTarget(const char *targetName) const {
|
||||||
|
|
||||||
class StaticPlugin : public Plugin {
|
class StaticPlugin : public Plugin {
|
||||||
const char *_name;
|
const char *_name;
|
||||||
const TargetSettings *_targets;
|
const GameSettings *_targets;
|
||||||
int _targetCount;
|
int _targetCount;
|
||||||
EngineFactory _ef;
|
EngineFactory _ef;
|
||||||
public:
|
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) {
|
: _name(name), _targets(targets), _ef(ef) {
|
||||||
_targetCount = Plugin::countTargets();
|
_targetCount = Plugin::countTargets();
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public:
|
||||||
const char *getName() const { return _name; }
|
const char *getName() const { return _name; }
|
||||||
|
|
||||||
int countTargets() const { return _targetCount; }
|
int countTargets() const { return _targetCount; }
|
||||||
const TargetSettings *getTargets() const { return _targets; }
|
const GameSettings *getTargets() const { return _targets; }
|
||||||
|
|
||||||
Engine *createInstance(GameDetector *detector, OSystem *syst) const {
|
Engine *createInstance(GameDetector *detector, OSystem *syst) const {
|
||||||
return (*_ef)(detector, syst);
|
return (*_ef)(detector, syst);
|
||||||
|
@ -131,7 +131,7 @@ class DynamicPlugin : public Plugin {
|
||||||
Common::String _filename;
|
Common::String _filename;
|
||||||
|
|
||||||
Common::String _name;
|
Common::String _name;
|
||||||
const TargetSettings *_targets;
|
const GameSettings *_targets;
|
||||||
int _targetCount;
|
int _targetCount;
|
||||||
EngineFactory _ef;
|
EngineFactory _ef;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public:
|
||||||
const char *getName() const { return _name.c_str(); }
|
const char *getName() const { return _name.c_str(); }
|
||||||
|
|
||||||
int countTargets() const { return _targetCount; }
|
int countTargets() const { return _targetCount; }
|
||||||
const TargetSettings *getTargets() const { return _targets; }
|
const GameSettings *getTargets() const { return _targets; }
|
||||||
|
|
||||||
Engine *createInstance(GameDetector *detector, OSystem *syst) const {
|
Engine *createInstance(GameDetector *detector, OSystem *syst) const {
|
||||||
assert(_ef);
|
assert(_ef);
|
||||||
|
@ -174,7 +174,7 @@ void *DynamicPlugin::findSymbol(const char *symbol) {
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef const char *(*NameFunc)();
|
typedef const char *(*NameFunc)();
|
||||||
typedef const TargetSettings *(*TargetListFunc)();
|
typedef const GameSettings *(*TargetListFunc)();
|
||||||
|
|
||||||
bool DynamicPlugin::loadPlugin() {
|
bool DynamicPlugin::loadPlugin() {
|
||||||
assert(!_dlHandle);
|
assert(!_dlHandle);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
class Engine;
|
class Engine;
|
||||||
class GameDetector;
|
class GameDetector;
|
||||||
class OSystem;
|
class OSystem;
|
||||||
struct TargetSettings;
|
struct GameSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract base class for the plugin system.
|
* Abstract base class for the plugin system.
|
||||||
|
@ -47,8 +47,8 @@ public:
|
||||||
virtual int getVersion() const { return 0; } // TODO!
|
virtual int getVersion() const { return 0; } // TODO!
|
||||||
|
|
||||||
virtual int countTargets() const;
|
virtual int countTargets() const;
|
||||||
virtual const TargetSettings *getTargets() const = 0;
|
virtual const GameSettings *getTargets() const = 0;
|
||||||
virtual const TargetSettings *findTarget(const char *targetName) const;
|
virtual const GameSettings *findGame(const char *gameName) const;
|
||||||
|
|
||||||
virtual Engine *createInstance(GameDetector *detector, OSystem *syst) const = 0;
|
virtual Engine *createInstance(GameDetector *detector, OSystem *syst) const = 0;
|
||||||
};
|
};
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
#define REGISTER_PLUGIN(name,targetListFactory,engineFactory) \
|
#define REGISTER_PLUGIN(name,targetListFactory,engineFactory) \
|
||||||
extern "C" { \
|
extern "C" { \
|
||||||
const char *PLUGIN_name() { return name; } \
|
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); } \
|
Engine *PLUGIN_createEngine(GameDetector *detector, OSystem *syst) { return engineFactory(detector, syst); } \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,7 +50,7 @@ enum {
|
||||||
kQuitCmd = 'QUIT'
|
kQuitCmd = 'QUIT'
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Common::List<const TargetSettings *> GameList;
|
typedef Common::List<const GameSettings *> GameList;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A dialog that allows the user to edit a config game entry.
|
* A dialog that allows the user to edit a config game entry.
|
||||||
|
@ -80,7 +80,7 @@ class EditGameDialog : public Dialog {
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
typedef Common::StringList StringList;
|
typedef Common::StringList StringList;
|
||||||
public:
|
public:
|
||||||
EditGameDialog(NewGui *gui, const String &domain, const TargetSettings *target);
|
EditGameDialog(NewGui *gui, const String &domain, const GameSettings *target);
|
||||||
|
|
||||||
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ protected:
|
||||||
CheckboxWidget *_amigaCheckbox;
|
CheckboxWidget *_amigaCheckbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
EditGameDialog::EditGameDialog(NewGui *gui, const String &domain, const TargetSettings *target)
|
EditGameDialog::EditGameDialog(NewGui *gui, const String &domain, const GameSettings *target)
|
||||||
: Dialog(gui, 8, 50, 320 - 2 * 8, 200 - 2 * 40),
|
: Dialog(gui, 8, 50, 320 - 2 * 8, 200 - 2 * 40),
|
||||||
_domain(domain) {
|
_domain(domain) {
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ void LauncherDialog::updateListing() {
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
name = iter->_key;
|
name = iter->_key;
|
||||||
if (description.isEmpty()) {
|
if (description.isEmpty()) {
|
||||||
const TargetSettings *v = _detector.findTarget(name);
|
const GameSettings *v = _detector.findGame(name);
|
||||||
if (v && v->description)
|
if (v && v->description)
|
||||||
description = v->description;
|
description = v->description;
|
||||||
}
|
}
|
||||||
|
@ -284,8 +284,8 @@ GameList findGame(FilesystemNode *dir) {
|
||||||
const PluginList &plugins = PluginManager::instance().getPlugins();
|
const PluginList &plugins = PluginManager::instance().getPlugins();
|
||||||
int p;
|
int p;
|
||||||
for (p = 0; p < plugins.size(); p++) {
|
for (p = 0; p < plugins.size(); p++) {
|
||||||
const TargetSettings *v = plugins[p]->getTargets();
|
const GameSettings *v = plugins[p]->getTargets();
|
||||||
while (v->targetName && v->description) {
|
while (v->gameName && v->description) {
|
||||||
|
|
||||||
// Determine the 'detectname' for this game, that is, the name of a
|
// Determine the 'detectname' for this game, that is, the name of a
|
||||||
// file that *must* be presented if the directory contains the data
|
// file that *must* be presented if the directory contains the data
|
||||||
|
@ -296,9 +296,9 @@ GameList findGame(FilesystemNode *dir) {
|
||||||
strcat(detectName2, ".");
|
strcat(detectName2, ".");
|
||||||
detectName3[0] = '\0';
|
detectName3[0] = '\0';
|
||||||
} else {
|
} else {
|
||||||
strcpy(detectName, v->targetName);
|
strcpy(detectName, v->gameName);
|
||||||
strcpy(detectName2, v->targetName);
|
strcpy(detectName2, v->gameName);
|
||||||
strcpy(detectName3, v->targetName);
|
strcpy(detectName3, v->gameName);
|
||||||
strcat(detectName, ".000");
|
strcat(detectName, ".000");
|
||||||
if (v->version >= 7) {
|
if (v->version >= 7) {
|
||||||
strcat(detectName2, ".la0");
|
strcat(detectName2, ".la0");
|
||||||
|
@ -309,11 +309,11 @@ GameList findGame(FilesystemNode *dir) {
|
||||||
|
|
||||||
// Iterate over all files in the given directory
|
// Iterate over all files in the given directory
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
const char *targetName = (*files)[i].displayName().c_str();
|
const char *gameName = (*files)[i].displayName().c_str();
|
||||||
|
|
||||||
if ((0 == scumm_stricmp(detectName, targetName)) ||
|
if ((0 == scumm_stricmp(detectName, gameName)) ||
|
||||||
(0 == scumm_stricmp(detectName2, targetName)) ||
|
(0 == scumm_stricmp(detectName2, gameName)) ||
|
||||||
(0 == scumm_stricmp(detectName3, targetName))) {
|
(0 == scumm_stricmp(detectName3, gameName))) {
|
||||||
// Match found, add to list of candidates, then abort inner loop.
|
// Match found, add to list of candidates, then abort inner loop.
|
||||||
list.push_back(v);
|
list.push_back(v);
|
||||||
break;
|
break;
|
||||||
|
@ -350,7 +350,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
// ...so let's determine a list of candidates, games that
|
// ...so let's determine a list of candidates, games that
|
||||||
// could be contained in the specified directory.
|
// could be contained in the specified directory.
|
||||||
GameList candidates = findGame(dir);
|
GameList candidates = findGame(dir);
|
||||||
const TargetSettings *v = 0;
|
const GameSettings *v = 0;
|
||||||
|
|
||||||
if (candidates.isEmpty()) {
|
if (candidates.isEmpty()) {
|
||||||
// No game was found in the specified directory
|
// No game was found in the specified directory
|
||||||
|
@ -376,7 +376,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
// The auto detector or the user made a choice.
|
// The auto detector or the user made a choice.
|
||||||
// Pick a domain name which does not yet exist (after all, we
|
// Pick a domain name which does not yet exist (after all, we
|
||||||
// are *adding* a game to the config, not replacing).
|
// are *adding* a game to the config, not replacing).
|
||||||
String domain(v->targetName);
|
String domain(v->gameName);
|
||||||
if (ConfMan.hasGameDomain(domain)) {
|
if (ConfMan.hasGameDomain(domain)) {
|
||||||
char suffix = 'a';
|
char suffix = 'a';
|
||||||
domain += suffix;
|
domain += suffix;
|
||||||
|
@ -385,7 +385,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
suffix++;
|
suffix++;
|
||||||
domain += suffix;
|
domain += suffix;
|
||||||
}
|
}
|
||||||
ConfMan.set("gameid", v->targetName, domain);
|
ConfMan.set("gameid", v->gameName, domain);
|
||||||
ConfMan.set("description", v->description, domain);
|
ConfMan.set("description", v->description, domain);
|
||||||
}
|
}
|
||||||
ConfMan.set("path", dir->path(), domain);
|
ConfMan.set("path", dir->path(), domain);
|
||||||
|
@ -431,7 +431,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
String gameId(ConfMan.get("gameid", _domains[item]));
|
String gameId(ConfMan.get("gameid", _domains[item]));
|
||||||
if (gameId.isEmpty())
|
if (gameId.isEmpty())
|
||||||
gameId = _domains[item];
|
gameId = _domains[item];
|
||||||
EditGameDialog editDialog(_gui, _domains[item], _detector.findTarget(gameId));
|
EditGameDialog editDialog(_gui, _domains[item], _detector.findGame(gameId));
|
||||||
if (editDialog.runModal()) {
|
if (editDialog.runModal()) {
|
||||||
// User pressed OK, so make changes permanent
|
// User pressed OK, so make changes permanent
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|
||||||
case kListItemDoubleClickedCmd:
|
case kListItemDoubleClickedCmd:
|
||||||
// Print out what was selected
|
// Print out what was selected
|
||||||
assert(item >= 0);
|
assert(item >= 0);
|
||||||
_detector.setGame(_domains[item]);
|
_detector.setTarget(_domains[item]);
|
||||||
close();
|
close();
|
||||||
break;
|
break;
|
||||||
case kListSelectionChangedCmd:
|
case kListSelectionChangedCmd:
|
||||||
|
|
|
@ -36,13 +36,13 @@ extern bool draw_keyboard;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const TargetSettings queen_settings[] = {
|
static const GameSettings queen_settings[] = {
|
||||||
/* Flight of the Amazon Queen */
|
/* Flight of the Amazon Queen */
|
||||||
{ "queen", "Flight of the Amazon Queen", GID_QUEEN_FIRST, 99, MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1" },
|
{ "queen", "Flight of the Amazon Queen", GID_QUEEN_FIRST, 99, MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1" },
|
||||||
{ NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
{ NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
const TargetSettings *Engine_QUEEN_targetList() {
|
const GameSettings *Engine_QUEEN_targetList() {
|
||||||
return queen_settings;
|
return queen_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ enum MouseButtonStatus {
|
||||||
// Use g_scumm from error() ONLY
|
// Use g_scumm from error() ONLY
|
||||||
ScummEngine *g_scumm = 0;
|
ScummEngine *g_scumm = 0;
|
||||||
|
|
||||||
static const TargetSettings scumm_settings[] = {
|
static const GameSettings scumm_settings[] = {
|
||||||
/* Scumm Version 1 */
|
/* Scumm Version 1 */
|
||||||
/* Scumm Version 2 */
|
/* Scumm Version 2 */
|
||||||
|
|
||||||
|
@ -595,8 +595,8 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst)
|
||||||
_debugLevel = ConfMan.getInt("debuglevel");
|
_debugLevel = ConfMan.getInt("debuglevel");
|
||||||
_dumpScripts = detector->_dumpScripts;
|
_dumpScripts = detector->_dumpScripts;
|
||||||
_bootParam = ConfMan.getInt("boot_param");
|
_bootParam = ConfMan.getInt("boot_param");
|
||||||
_exe_name = strdup(detector->_game.targetName);
|
_exe_name = strdup(detector->_game.gameName);
|
||||||
_game_name = strdup(detector->_gameFileName.c_str());
|
_game_name = strdup(detector->_targetName.c_str());
|
||||||
_gameId = detector->_game.id;
|
_gameId = detector->_game.id;
|
||||||
_version = detector->_game.version;
|
_version = detector->_game.version;
|
||||||
setFeatures(detector->_game.features);
|
setFeatures(detector->_game.features);
|
||||||
|
@ -2634,7 +2634,7 @@ int normalizeAngle(int angle) {
|
||||||
|
|
||||||
using namespace Scumm;
|
using namespace Scumm;
|
||||||
|
|
||||||
const TargetSettings *Engine_SCUMM_targetList() {
|
const GameSettings *Engine_SCUMM_targetList() {
|
||||||
return scumm_settings;
|
return scumm_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ extern bool draw_keyboard;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const TargetSettings simon_settings[] = {
|
static const GameSettings simon_settings[] = {
|
||||||
// Simon the Sorcerer 1 & 2 (not SCUMM games)
|
// Simon the Sorcerer 1 & 2 (not SCUMM games)
|
||||||
{"simon1acorn", "Simon the Sorcerer 1 (Acorn)", GID_SIMON_FIRST, 99, MDT_ADLIB | MDT_NATIVE, GAME_SIMON1ACORN, "DATA"},
|
{"simon1acorn", "Simon the Sorcerer 1 (Acorn)", GID_SIMON_FIRST, 99, MDT_ADLIB | MDT_NATIVE, GAME_SIMON1ACORN, "DATA"},
|
||||||
{"simon1dos", "Simon the Sorcerer 1 (DOS)", GID_SIMON_FIRST, 99, MDT_ADLIB | MDT_NATIVE, GAME_SIMON1DOS, "GAMEPC"},
|
{"simon1dos", "Simon the Sorcerer 1 (DOS)", GID_SIMON_FIRST, 99, MDT_ADLIB | MDT_NATIVE, GAME_SIMON1DOS, "GAMEPC"},
|
||||||
|
@ -62,7 +62,7 @@ static const TargetSettings simon_settings[] = {
|
||||||
{NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
{NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
const TargetSettings *Engine_SIMON_targetList() {
|
const GameSettings *Engine_SIMON_targetList() {
|
||||||
return simon_settings;
|
return simon_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,13 +76,13 @@ extern bool draw_keyboard;
|
||||||
|
|
||||||
#undef WITH_DEBUG_CHEATS
|
#undef WITH_DEBUG_CHEATS
|
||||||
|
|
||||||
static const TargetSettings sky_settings[] = {
|
static const GameSettings sky_settings[] = {
|
||||||
/* Beneath a Steel Sky */
|
/* Beneath a Steel Sky */
|
||||||
{"sky", "Beneath a Steel Sky", GID_SKY_FIRST, 99, MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "sky.dsk" },
|
{"sky", "Beneath a Steel Sky", GID_SKY_FIRST, 99, MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "sky.dsk" },
|
||||||
{NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
{NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
const TargetSettings *Engine_SKY_targetList() {
|
const GameSettings *Engine_SKY_targetList() {
|
||||||
return sky_settings;
|
return sky_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
extern uint16 _debugLevel;
|
extern uint16 _debugLevel;
|
||||||
|
|
||||||
static const TargetSettings sword2_settings[] = {
|
static const GameSettings sword2_settings[] = {
|
||||||
/* Broken Sword 2 */
|
/* Broken Sword 2 */
|
||||||
{"sword2", "Broken Sword II", GID_SWORD2, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "players.clu" },
|
{"sword2", "Broken Sword II", GID_SWORD2, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "players.clu" },
|
||||||
{"sword2alt", "Broken Sword II (alt)", GID_SWORD2, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "r2ctlns.ocx" },
|
{"sword2alt", "Broken Sword II (alt)", GID_SWORD2, 99, MDT_ADLIB | MDT_NATIVE, GF_DEFAULT_TO_1X_SCALER, "r2ctlns.ocx" },
|
||||||
|
@ -56,7 +56,7 @@ static const TargetSettings sword2_settings[] = {
|
||||||
{NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
{NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
const TargetSettings *Engine_SWORD2_targetList() {
|
const GameSettings *Engine_SWORD2_targetList() {
|
||||||
return sword2_settings;
|
return sword2_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst)
|
||||||
g_sword2 = this;
|
g_sword2 = this;
|
||||||
_features = detector->_game.features;
|
_features = detector->_game.features;
|
||||||
_gameId = detector->_game.id;
|
_gameId = detector->_game.id;
|
||||||
_gameName = strdup(detector->_gameFileName.c_str());
|
_gameName = strdup(detector->_targetName.c_str());
|
||||||
_bootParam = ConfMan.getInt("boot_param");
|
_bootParam = ConfMan.getInt("boot_param");
|
||||||
_saveSlot = ConfMan.getInt("save_slot");
|
_saveSlot = ConfMan.getInt("save_slot");
|
||||||
_debugLevel = ConfMan.getInt("debuglevel");
|
_debugLevel = ConfMan.getInt("debuglevel");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue