- Renamed ConfigManager::getActiveDomain to getActiveDomainName, and added a new getActiveDomain method that returns a pointer to the actual active *domain*

- Added Engine::_targetName whose value is computed from the name of the active domain
- Removed GameDetector::_targetName, instead code now uses either Engine::_targetName or the name of the active domain
- This in turn allowed for removing usage of GameDetector in many places

svn-id: r21916
This commit is contained in:
Max Horn 2006-04-15 20:36:41 +00:00
parent ad45318328
commit 68cb7f52c8
42 changed files with 171 additions and 207 deletions

View file

@ -30,7 +30,7 @@
AeroCDPlayer::AeroCDPlayer(OSystem *sys) { AeroCDPlayer::AeroCDPlayer(OSystem *sys) {
_sys = sys; _sys = sys;
StrCopy(gameP, ConfMan.getActiveDomain().c_str()); StrCopy(gameP, ConfMan.getActiveDomainName().c_str());
} }
bool AeroCDPlayer::init() { bool AeroCDPlayer::init() {

View file

@ -28,7 +28,7 @@
PckTunesCDPlayer::PckTunesCDPlayer(OSystem *sys) { PckTunesCDPlayer::PckTunesCDPlayer(OSystem *sys) {
_sys = sys; _sys = sys;
StrCopy(gameP, ConfMan.getActiveDomain().c_str()); StrCopy(gameP, ConfMan.getActiveDomainName().c_str());
} }
bool PckTunesCDPlayer::init() { bool PckTunesCDPlayer::init() {

View file

@ -24,7 +24,6 @@
#include <malloc.h> #include <malloc.h>
#endif #endif
#include "base/engine.h" #include "base/engine.h"
#include "base/gameDetector.h"
#include "common/config-manager.h" #include "common/config-manager.h"
#include "common/file.h" #include "common/file.h"
#include "common/timer.h" #include "common/timer.h"
@ -37,7 +36,9 @@
Engine *g_engine = 0; Engine *g_engine = 0;
Engine::Engine(OSystem *syst) Engine::Engine(OSystem *syst)
: _system(syst), _gameDataPath(ConfMan.get("path")) { : _system(syst),
_gameDataPath(ConfMan.get("path")),
_targetName(ConfMan.getActiveDomainName()){
g_engine = this; g_engine = this;
_mixer = new Audio::Mixer(); _mixer = new Audio::Mixer();
@ -55,9 +56,9 @@ Engine::~Engine() {
g_engine = NULL; g_engine = NULL;
} }
void Engine::initCommonGFX(GameDetector &detector, bool defaultTo1XScaler) { void Engine::initCommonGFX(bool defaultTo1XScaler) {
const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain); const Common::ConfigManager::Domain *transientDomain = ConfMan.getDomain(Common::ConfigManager::kTransientDomain);
const Common::ConfigManager::Domain *gameDomain = ConfMan.getDomain(detector._targetName); const Common::ConfigManager::Domain *gameDomain = ConfMan.getActiveDomain();
assert(transientDomain); assert(transientDomain);

View file

@ -25,7 +25,6 @@
#include "common/scummsys.h" #include "common/scummsys.h"
#include "common/str.h" #include "common/str.h"
class GameDetector;
class OSystem; class OSystem;
namespace Audio { namespace Audio {
class Mixer; class Mixer;
@ -42,6 +41,7 @@ public:
Common::Timer * _timer; Common::Timer * _timer;
protected: protected:
const Common::String _targetName; // target name for saves
const Common::String _gameDataPath; const Common::String _gameDataPath;
Common::SaveFileManager *_saveFileMan; Common::SaveFileManager *_saveFileMan;
@ -56,7 +56,7 @@ public:
* Init the engine. * Init the engine.
* @return 0 for success, else an error code. * @return 0 for success, else an error code.
*/ */
virtual int init(GameDetector &detector) = 0; virtual int init() = 0;
/** /**
* Start the main engine loop. * Start the main engine loop.
@ -69,7 +69,7 @@ public:
/** Specific for each engine: prepare error string. */ /** Specific for each engine: prepare error string. */
virtual void errorString(const char *buf_input, char *buf_output); virtual void errorString(const char *buf_input, char *buf_output);
void initCommonGFX(GameDetector &detector, bool defaultTo1XScaler); void initCommonGFX(bool defaultTo1XScaler);
/** On some systems, check if the game appears to be run from CD. */ /** On some systems, check if the game appears to be run from CD. */
void checkCD(); void checkCD();

View file

@ -578,11 +578,10 @@ void GameDetector::processSettings(Common::String &target, Common::StringMap &se
void GameDetector::setTarget(const String &target) { void GameDetector::setTarget(const String &target) {
_targetName = target;
ConfMan.setActiveDomain(target); ConfMan.setActiveDomain(target);
// Make sure the gameid is set in the config manager, and that it is lowercase. // Make sure the gameid is set in the config manager, and that it is lowercase.
String gameid(_targetName); String gameid(target);
if (ConfMan.hasKey("gameid")) if (ConfMan.hasKey("gameid"))
gameid = ConfMan.get("gameid"); gameid = ConfMan.get("gameid");
gameid.toLowercase(); gameid.toLowercase();
@ -592,7 +591,7 @@ void GameDetector::setTarget(const String &target) {
const Plugin *GameDetector::detectMain() { const Plugin *GameDetector::detectMain() {
const Plugin *plugin = 0; const Plugin *plugin = 0;
if (_targetName.empty()) { if (ConfMan.getActiveDomainName().empty()) {
warning("No game was specified..."); warning("No game was specified...");
return 0; return 0;
} }
@ -602,7 +601,7 @@ const Plugin *GameDetector::detectMain() {
if (plugin == 0) { if (plugin == 0) {
printf("Failed game detection\n"); printf("Failed game detection\n");
warning("%s is an invalid target. Use the --list-targets option to list targets", _targetName.c_str()); warning("%s is an invalid target. Use the --list-targets option to list targets", ConfMan.getActiveDomainName().c_str());
return 0; return 0;
} }

View file

@ -27,7 +27,6 @@
#include "common/str.h" #include "common/str.h"
#include "common/config-manager.h" #include "common/config-manager.h"
class GameDetector;
class OSystem; class OSystem;
class Plugin; class Plugin;
@ -69,8 +68,6 @@ public:
void processSettings(Common::String &target, Common::StringMap &settings); void processSettings(Common::String &target, Common::StringMap &settings);
const Plugin *detectMain(); const Plugin *detectMain();
String _targetName;
public: public:
static GameDescriptor findGame(const String &gameName, const Plugin **plugin = NULL); static GameDescriptor findGame(const String &gameName, const Plugin **plugin = NULL);

View file

@ -157,7 +157,7 @@ static bool launcherDialog(GameDetector &detector, OSystem &system) {
return (dlg.runModal() != -1); return (dlg.runModal() != -1);
} }
static int runGame(const Plugin *plugin, GameDetector &detector, OSystem &system, const Common::String &edebuglevels) { static int runGame(const Plugin *plugin, OSystem &system, const Common::String &edebuglevels) {
// We add it here, so MD5-based detection will be able to // We add it here, so MD5-based detection will be able to
// read mixed case files // read mixed case files
if (ConfMan.hasKey("path")) if (ConfMan.hasKey("path"))
@ -166,12 +166,12 @@ static int runGame(const Plugin *plugin, GameDetector &detector, OSystem &system
Common::File::addDefaultDirectory("."); Common::File::addDefaultDirectory(".");
// Create the game engine // Create the game engine
Engine *engine = plugin->createInstance(&detector, &system); Engine *engine = plugin->createInstance(&system);
if (!engine) { if (!engine) {
// TODO: Show an error dialog or so? // TODO: Show an error dialog or so?
//GUI::MessageDialog alert("ScummVM could not find any game in the specified directory!"); //GUI::MessageDialog alert("ScummVM could not find any game in the specified directory!");
//alert.runModal(); //alert.runModal();
warning("Failed to instantiate engine for target %s", detector._targetName.c_str()); warning("Failed to instantiate engine for target %s", ConfMan.getActiveDomainName().c_str());
return 0; return 0;
} }
@ -179,13 +179,13 @@ static int runGame(const Plugin *plugin, GameDetector &detector, OSystem &system
Common::enableSpecialDebugLevelList(edebuglevels); Common::enableSpecialDebugLevelList(edebuglevels);
// Set the window caption to the game name // Set the window caption to the game name
Common::String caption(ConfMan.get("description", detector._targetName)); Common::String caption(ConfMan.get("description"));
Common::String desc = GameDetector::findGame(ConfMan.get("gameid")).description; Common::String desc = GameDetector::findGame(ConfMan.get("gameid")).description;
if (caption.empty() && !desc.empty()) if (caption.empty() && !desc.empty())
caption = desc; caption = desc;
if (caption.empty()) if (caption.empty())
caption = detector._targetName; caption = ConfMan.getActiveDomainName(); // Use the domain (=target) name
if (!caption.empty()) { if (!caption.empty()) {
system.setWindowCaption(caption.c_str()); system.setWindowCaption(caption.c_str());
} }
@ -208,7 +208,7 @@ static int runGame(const Plugin *plugin, GameDetector &detector, OSystem &system
int result; int result;
// Init the engine (this might change the screen parameters // Init the engine (this might change the screen parameters
result = engine->init(detector); result = engine->init();
// Run the game engine if the initialization was successful. // Run the game engine if the initialization was successful.
if (result == 0) { if (result == 0) {
@ -314,7 +314,7 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
setupDummyPalette(system); setupDummyPalette(system);
// Unless a game was specified, show the launcher dialog // Unless a game was specified, show the launcher dialog
if (detector._targetName.empty()) { if (ConfMan.getActiveDomainName().empty()) {
running = launcherDialog(detector, system); running = launcherDialog(detector, system);
// Discard any command line options. Those that affect the graphics // Discard any command line options. Those that affect the graphics
@ -335,7 +335,7 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
// to save memory // to save memory
PluginManager::instance().unloadPluginsExcept(plugin); PluginManager::instance().unloadPluginsExcept(plugin);
int result = runGame(plugin, detector, system, specialDebug); int result = runGame(plugin, system, specialDebug);
if (result == 0) if (result == 0)
break; break;

View file

@ -23,13 +23,12 @@
#include "common/stdafx.h" #include "common/stdafx.h"
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "base/engine.h" #include "base/engine.h"
#include "common/util.h" #include "common/util.h"
/** Type of factory functions which make new Engine objects. */ /** Type of factory functions which make new Engine objects. */
typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst); typedef Engine *(*EngineFactory)(OSystem *syst);
typedef const char *(*NameFunc)(); typedef const char *(*NameFunc)();
typedef GameDescriptor (*GameIDQueryFunc)(const char *gameid); typedef GameDescriptor (*GameIDQueryFunc)(const char *gameid);
@ -117,9 +116,9 @@ public:
const char *getName() const { return _plugin->_name; } const char *getName() const { return _plugin->_name; }
Engine *createInstance(GameDetector *detector, OSystem *syst) const { Engine *createInstance(OSystem *syst) const {
assert(_plugin->_ef); assert(_plugin->_ef);
return (*_plugin->_ef)(detector, syst); return (*_plugin->_ef)(syst);
} }
GameList getSupportedGames() const { return _plugin->_games; } GameList getSupportedGames() const { return _plugin->_games; }
@ -158,9 +157,9 @@ public:
const char *getName() const { return _name.c_str(); } const char *getName() const { return _name.c_str(); }
Engine *createInstance(GameDetector *detector, OSystem *syst) const { Engine *createInstance(OSystem *syst) const {
assert(_ef); assert(_ef);
return (*_ef)(detector, syst); return (*_ef)(syst);
} }
GameList getSupportedGames() const { return _games; } GameList getSupportedGames() const { return _games; }

View file

@ -31,7 +31,6 @@
class Engine; class Engine;
class FSList; class FSList;
class GameDetector;
class OSystem; class OSystem;
/** List of games. */ /** List of games. */
@ -85,7 +84,7 @@ public:
virtual GameDescriptor findGame(const char *gameid) const = 0; virtual GameDescriptor findGame(const char *gameid) const = 0;
virtual DetectedGameList detectGames(const FSList &fslist) const = 0; virtual DetectedGameList detectGames(const FSList &fslist) const = 0;
virtual Engine *createInstance(GameDetector *detector, OSystem *syst) const = 0; virtual Engine *createInstance(OSystem *syst) const = 0;
}; };
@ -107,7 +106,7 @@ public:
* - DetectedGameList Engine_##ID##_detectGames(const FSList &fslist) * - DetectedGameList Engine_##ID##_detectGames(const FSList &fslist)
* -> scans through the given file list (usually the contents of a directory), * -> scans through the given file list (usually the contents of a directory),
* and attempts to detects games present in that location. * and attempts to detects games present in that location.
* - Engine *Engine_##ID##_create(GameDetector *detector, OSystem *syst) * - Engine *Engine_##ID##_create(OSystem *syst)
* -> factory function, create an instance of the Engine class. * -> factory function, create an instance of the Engine class.
* *
* @todo add some means to query the plugin API version etc. * @todo add some means to query the plugin API version etc.
@ -131,7 +130,7 @@ public:
PLUGIN_EXPORT const char *PLUGIN_name() { return name; } \ PLUGIN_EXPORT const char *PLUGIN_name() { return name; } \
PLUGIN_EXPORT GameList PLUGIN_gameIDList() { return Engine_##ID##_gameIDList(); } \ PLUGIN_EXPORT GameList PLUGIN_gameIDList() { return Engine_##ID##_gameIDList(); } \
PLUGIN_EXPORT GameDescriptor PLUGIN_findGameID(const char *gameid) { return Engine_##ID##_findGameID(gameid); } \ PLUGIN_EXPORT GameDescriptor PLUGIN_findGameID(const char *gameid) { return Engine_##ID##_findGameID(gameid); } \
PLUGIN_EXPORT Engine *PLUGIN_createEngine(GameDetector *detector, OSystem *syst) { return Engine_##ID##_create(detector, syst); } \ PLUGIN_EXPORT Engine *PLUGIN_createEngine(OSystem *syst) { return Engine_##ID##_create(syst); } \
PLUGIN_EXPORT DetectedGameList PLUGIN_detectGames(const FSList &fslist) { return Engine_##ID##_detectGames(fslist); } \ PLUGIN_EXPORT DetectedGameList PLUGIN_detectGames(const FSList &fslist) { return Engine_##ID##_detectGames(fslist); } \
} \ } \
void dummyFuncToAllowTrailingSemicolon() void dummyFuncToAllowTrailingSemicolon()
@ -146,7 +145,7 @@ class PluginRegistrator {
friend class StaticPlugin; friend class StaticPlugin;
public: public:
typedef GameDescriptor (*GameIDQueryFunc)(const char *gameid); typedef GameDescriptor (*GameIDQueryFunc)(const char *gameid);
typedef Engine *(*EngineFactory)(GameDetector *detector, OSystem *syst); typedef Engine *(*EngineFactory)(OSystem *syst);
typedef DetectedGameList (*DetectFunc)(const FSList &fslist); typedef DetectedGameList (*DetectFunc)(const FSList &fslist);
protected: protected:

View file

@ -142,7 +142,9 @@ public:
void flushToDisk(); void flushToDisk();
void setActiveDomain(const String &domName); void setActiveDomain(const String &domName);
const String & getActiveDomain() const { return _activeDomainName; } Domain * getActiveDomain() { return _activeDomain; }
const Domain * getActiveDomain() const { return _activeDomain; }
const String & getActiveDomainName() const { return _activeDomainName; }
// void addDomain(const String &domName); // void addDomain(const String &domName);
void removeGameDomain(const String &domName); void removeGameDomain(const String &domName);

View file

@ -48,7 +48,7 @@ const char *SaveFileManager::getSavePath() const {
// Work around a bug (#999122) in the original 0.6.1 release of // Work around a bug (#999122) in the original 0.6.1 release of
// ScummVM, which would insert a bad savepath value into config files. // ScummVM, which would insert a bad savepath value into config files.
if (0 == strcmp(dir, "None")) { if (0 == strcmp(dir, "None")) {
ConfMan.removeKey("savepath", ConfMan.getActiveDomain()); ConfMan.removeKey("savepath", ConfMan.getActiveDomainName());
ConfMan.flushToDisk(); ConfMan.flushToDisk();
dir = ConfMan.get("savepath").c_str(); dir = ConfMan.get("savepath").c_str();
} }

View file

@ -28,7 +28,6 @@
#include "common/config-manager.h" #include "common/config-manager.h"
#include "common/system.h" #include "common/system.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
@ -111,15 +110,15 @@ DetectedGameList Engine_CINE_detectGames(const FSList &fslist) {
return detectedGames; return detectedGames;
} }
Engine *Engine_CINE_create(GameDetector *detector, OSystem *syst) { Engine *Engine_CINE_create(OSystem *syst) {
return new Cine::CineEngine(detector, syst); return new Cine::CineEngine(syst);
} }
REGISTER_PLUGIN(CINE, "CINE Engine"); REGISTER_PLUGIN(CINE, "CINE Engine");
namespace Cine { namespace Cine {
CineEngine::CineEngine(GameDetector *detector, OSystem *syst) : Engine(syst) { CineEngine::CineEngine(OSystem *syst) : Engine(syst) {
Common::addSpecialDebugLevel(kCineDebugScript, "Script", "Script debug level"); Common::addSpecialDebugLevel(kCineDebugScript, "Script", "Script debug level");
// Setup mixer // Setup mixer
@ -132,9 +131,12 @@ CineEngine::CineEngine(GameDetector *detector, OSystem *syst) : Engine(syst) {
const Cine::GameSettings *g; const Cine::GameSettings *g;
const char *gameid = ConfMan.get("gameid").c_str();
for (g = Cine::cine_settings; g->gameid; ++g) for (g = Cine::cine_settings; g->gameid; ++g)
if (!scumm_stricmp(g->gameid, detector->_targetName.c_str())) if (!scumm_stricmp(g->gameid, gameid)) {
_gameId = g->id; _gameId = g->id;
break;
}
gameType = _gameId; gameType = _gameId;
} }
@ -146,10 +148,10 @@ void CineEngine::errorString(const char *buf1, char *buf2) {
strcpy(buf2, buf1); strcpy(buf2, buf1);
} }
int CineEngine::init(GameDetector &detector) { int CineEngine::init() {
// Initialize backend // Initialize backend
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, false); initCommonGFX(false);
_system->initSize(320, 200); _system->initSize(320, 200);
_system->endGFXTransaction(); _system->endGFXTransaction();

View file

@ -58,12 +58,12 @@ class CineEngine : public Engine {
void errorString(const char *buf_input, char *buf_output); void errorString(const char *buf_input, char *buf_output);
protected: protected:
int init(GameDetector & detector); int init();
int go(); int go();
void shutdown(); void shutdown();
public: public:
CineEngine(GameDetector *detector, OSystem *syst); CineEngine(OSystem *syst);
virtual ~CineEngine(); virtual ~CineEngine();
int getGameId() { int getGameId() {
return _gameId; return _gameId;

View file

@ -21,7 +21,6 @@
*/ */
#include "common/stdafx.h" #include "common/stdafx.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -127,7 +126,7 @@ static const PlainGameDescriptor gob_list[] = {
#define MAX_TIME_DELTA 100 #define MAX_TIME_DELTA 100
GobEngine::GobEngine(GameDetector *detector, OSystem * syst, uint32 features) GobEngine::GobEngine(OSystem * syst, uint32 features)
: Engine(syst) { : Engine(syst) {
// Setup mixer // Setup mixer
if (!_mixer->isReady()) { if (!_mixer->isReady()) {
@ -189,7 +188,7 @@ void GobEngine::shutdown() {
_system->quit(); _system->quit();
} }
int GobEngine::init(GameDetector &detector) { int GobEngine::init() {
_game = new Game(this); _game = new Game(this);
_snd = new Snd(this); _snd = new Snd(this);
_video = new Video(this); _video = new Video(this);
@ -223,7 +222,7 @@ int GobEngine::init(GameDetector &detector) {
_music = new Music(this); _music = new Music(this);
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, false); initCommonGFX(false);
_system->initSize(320, 200); _system->initSize(320, 200);
_system->endGFXTransaction(); _system->endGFXTransaction();
@ -339,7 +338,7 @@ DetectedGameList Engine_GOB_detectGames(const FSList &fslist) {
return detectedGames; return detectedGames;
} }
Engine *Engine_GOB_create(GameDetector * detector, OSystem *syst) { Engine *Engine_GOB_create(OSystem *syst) {
// Detect game features based on MD5 // Detect game features based on MD5
uint8 md5sum[16]; uint8 md5sum[16];
char md5str[32 + 1]; char md5str[32 + 1];
@ -358,12 +357,8 @@ Engine *Engine_GOB_create(GameDetector * detector, OSystem *syst) {
// TODO // TODO
// Fallback. Maybe we will be able to determine game type from game // Fallback. Maybe we will be able to determine game type from game
// data contents // data contents
Common::String realGame; Common::String realGame(ConfMan.get("gameid"));
uint32 features; uint32 features;
if (ConfMan.hasKey("gameid"))
realGame = ConfMan.get("gameid");
else
realGame = detector->_targetName;
if (!scumm_stricmp(realGame.c_str(), "gob2")) if (!scumm_stricmp(realGame.c_str(), "gob2"))
features = GF_GOB2; features = GF_GOB2;
else else
@ -385,7 +380,7 @@ Engine *Engine_GOB_create(GameDetector * detector, OSystem *syst) {
printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
} }
return new GobEngine(detector, syst, features); return new GobEngine(syst, features);
} }
REGISTER_PLUGIN(GOB, "Gob Engine"); REGISTER_PLUGIN(GOB, "Gob Engine");

View file

@ -85,10 +85,10 @@ class GobEngine : public Engine {
protected: protected:
int go(); int go();
int init(GameDetector &detector); int init();
public: public:
GobEngine(GameDetector * detector, OSystem * syst, uint32 features); GobEngine(OSystem *syst, uint32 features);
virtual ~GobEngine(); virtual ~GobEngine();
void shutdown(); void shutdown();

View file

@ -24,7 +24,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -205,15 +204,15 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
return detectedGames; return detectedGames;
} }
Engine *Engine_KYRA_create(GameDetector *detector, OSystem *system) { Engine *Engine_KYRA_create(OSystem *system) {
return new KyraEngine(detector, system); return new KyraEngine(system);
} }
REGISTER_PLUGIN(KYRA, "Legend of Kyrandia Engine"); REGISTER_PLUGIN(KYRA, "Legend of Kyrandia Engine");
namespace Kyra { namespace Kyra {
KyraEngine::KyraEngine(GameDetector *detector, OSystem *system) KyraEngine::KyraEngine(OSystem *system)
: Engine(system) { : Engine(system) {
_seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm = _seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm =
_seq_MalcolmTree = _seq_WestwoodLogo = _seq_Demo1 = _seq_Demo2 = _seq_Demo3 = _seq_MalcolmTree = _seq_WestwoodLogo = _seq_Demo1 = _seq_Demo2 = _seq_Demo3 =
@ -326,9 +325,9 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *system)
} }
} }
int KyraEngine::init(GameDetector &detector) { int KyraEngine::init() {
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, false); initCommonGFX(false);
//for debug reasons (see Screen::updateScreen) //for debug reasons (see Screen::updateScreen)
//_system->initSize(640, 200); //_system->initSize(640, 200);
_system->initSize(320, 200); _system->initSize(320, 200);
@ -506,7 +505,6 @@ int KyraEngine::init(GameDetector &detector) {
_mousePressFlag = false; _mousePressFlag = false;
_targetName = detector._targetName;
_menuDirectlyToLoad = false; _menuDirectlyToLoad = false;
_lastMusicCommand = 0; _lastMusicCommand = 0;

View file

@ -246,7 +246,7 @@ public:
MUSIC_INTRO = 0 MUSIC_INTRO = 0
}; };
KyraEngine(GameDetector *detector, OSystem *system); KyraEngine(OSystem *system);
~KyraEngine(); ~KyraEngine();
void errorString(const char *buf_input, char *buf_output); void errorString(const char *buf_input, char *buf_output);
@ -476,7 +476,7 @@ public:
protected: protected:
int go(); int go();
int init(GameDetector &detector); int init();
void startup(); void startup();
void mainLoop(); void mainLoop();
@ -781,8 +781,6 @@ protected:
bool _configSounds; bool _configSounds;
uint8 _configVoice; uint8 _configVoice;
Common::String _targetName;
int _curMusicTheme; int _curMusicTheme;
int _newMusicTheme; int _newMusicTheme;
int16 _lastMusicCommand; int16 _lastMusicCommand;

View file

@ -24,7 +24,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -155,7 +154,7 @@ DetectedGameList Engine_LURE_detectGames(const FSList &fslist) {
return detectedGames; return detectedGames;
} }
Engine *Engine_LURE_create(GameDetector *detector, OSystem *system) { Engine *Engine_LURE_create(OSystem *system) {
return new LureEngine(system); return new LureEngine(system);
} }
@ -252,9 +251,9 @@ void LureEngine::detectGame() {
} }
} }
int LureEngine::init(GameDetector &detector) { int LureEngine::init() {
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, false); initCommonGFX(false);
_system->initSize(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); _system->initSize(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
_system->endGFXTransaction(); _system->endGFXTransaction();

View file

@ -58,7 +58,7 @@ public:
LureEngine(OSystem *system); LureEngine(OSystem *system);
~LureEngine(); ~LureEngine();
virtual int init(GameDetector &detector); virtual int init();
virtual int go(); virtual int go();
virtual void errorString(const char *buf_input, char *buf_output); virtual void errorString(const char *buf_input, char *buf_output);
void quitGame(); void quitGame();

View file

@ -24,7 +24,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -129,7 +128,7 @@ DetectedGameList Engine_QUEEN_detectGames(const FSList &fslist) {
return detectedGames; return detectedGames;
} }
Engine *Engine_QUEEN_create(GameDetector *detector, OSystem *syst) { Engine *Engine_QUEEN_create(OSystem *syst) {
return new Queen::QueenEngine(syst); return new Queen::QueenEngine(syst);
} }
@ -404,9 +403,9 @@ int QueenEngine::go() {
return 0; return 0;
} }
int QueenEngine::init(GameDetector &detector) { int QueenEngine::init() {
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, false); initCommonGFX(false);
_system->initSize(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT); _system->initSize(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
_system->endGFXTransaction(); _system->endGFXTransaction();

View file

@ -25,7 +25,6 @@
#include "base/engine.h" #include "base/engine.h"
class GameDetector;
namespace Common { namespace Common {
class InSaveFile; class InSaveFile;
} }
@ -136,7 +135,7 @@ protected:
void errorString(const char *buf_input, char *buf_output); void errorString(const char *buf_input, char *buf_output);
int go(); int go();
int init(GameDetector &detector); int init();
int _talkSpeed; int _talkSpeed;

View file

@ -31,7 +31,6 @@
#include "common/hashmap.h" #include "common/hashmap.h"
#include "common/config-manager.h" #include "common/config-manager.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "base/gameDetector.h"
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "saga/rscfile.h" #include "saga/rscfile.h"
@ -84,8 +83,8 @@ DetectedGameList Engine_SAGA_detectGames(const FSList &fslist) {
return Saga::GAME_detectGames(fslist); return Saga::GAME_detectGames(fslist);
} }
Engine *Engine_SAGA_create(GameDetector *detector, OSystem *syst) { Engine *Engine_SAGA_create(OSystem *syst) {
return new Saga::SagaEngine(detector, syst); return new Saga::SagaEngine(syst);
} }
REGISTER_PLUGIN(SAGA, "SAGA Engine"); REGISTER_PLUGIN(SAGA, "SAGA Engine");

View file

@ -36,9 +36,9 @@
namespace Saga { namespace Saga {
Gfx::Gfx(SagaEngine *vm, OSystem *system, int width, int height, GameDetector &detector) : _vm(vm), _system(system) { Gfx::Gfx(SagaEngine *vm, OSystem *system, int width, int height) : _vm(vm), _system(system) {
_system->beginGFXTransaction(); _system->beginGFXTransaction();
_vm->initCommonGFX(detector, (width > 320)); _vm->initCommonGFX(width > 320);
_system->initSize(width, height); _system->initSize(width, height);
_system->endGFXTransaction(); _system->endGFXTransaction();

View file

@ -134,7 +134,7 @@ class SagaEngine;
class Gfx { class Gfx {
public: public:
Gfx(SagaEngine *vm, OSystem *system, int width, int height, GameDetector &detector); Gfx(SagaEngine *vm, OSystem *system, int width, int height);
~Gfx(); ~Gfx();
Surface *getBackBuffer() { Surface *getBackBuffer() {
return &_backBuffer; return &_backBuffer;

View file

@ -23,7 +23,6 @@
*/ */
#include "common/stdafx.h" #include "common/stdafx.h"
#include "base/gameDetector.h"
#include "common/file.h" #include "common/file.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -58,9 +57,8 @@ namespace Saga {
#define MAX_TIME_DELTA 100 #define MAX_TIME_DELTA 100
SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst) SagaEngine::SagaEngine(OSystem *syst)
: Engine(syst), : Engine(syst) {
_targetName(detector->_targetName) {
_leftMouseButtonPressed = _rightMouseButtonPressed = false; _leftMouseButtonPressed = _rightMouseButtonPressed = false;
@ -148,7 +146,7 @@ void SagaEngine::errorString(const char *buf1, char *buf2) {
strcpy(buf2, buf1); strcpy(buf2, buf1);
} }
int SagaEngine::init(GameDetector &detector) { int SagaEngine::init() {
_soundVolume = ConfMan.getInt("sfx_volume") / 25; _soundVolume = ConfMan.getInt("sfx_volume") / 25;
_musicVolume = ConfMan.getInt("music_volume") / 25; _musicVolume = ConfMan.getInt("music_volume") / 25;
_subtitlesEnabled = ConfMan.getBool("subtitles"); _subtitlesEnabled = ConfMan.getBool("subtitles");
@ -186,7 +184,7 @@ int SagaEngine::init(GameDetector &detector) {
_previousTicks = _system->getMillis(); _previousTicks = _system->getMillis();
// Initialize graphics // Initialize graphics
_gfx = new Gfx(this, _system, getDisplayWidth(), getDisplayHeight(), detector); _gfx = new Gfx(this, _system, getDisplayWidth(), getDisplayHeight());
// Graphics driver should be initialized before console // Graphics driver should be initialized before console
_console = new Console(this); _console = new Console(this);

View file

@ -573,9 +573,9 @@ class SagaEngine : public Engine {
protected: protected:
int go(); int go();
int init(GameDetector &detector); int init();
public: public:
SagaEngine(GameDetector * detector, OSystem * syst); SagaEngine(OSystem *syst);
virtual ~SagaEngine(); virtual ~SagaEngine();
void shutDown() { _quit = true; } void shutDown() { _quit = true; }
@ -666,8 +666,6 @@ public:
} }
private: private:
Common::String _targetName;
uint _saveFilesMaxCount; uint _saveFilesMaxCount;
uint _saveFilesCount; uint _saveFilesCount;
SaveFileData _saveFiles[MAX_SAVES]; SaveFileData _saveFiles[MAX_SAVES];

View file

@ -93,8 +93,8 @@ static const byte default_v6_cursor[] = {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x0F,0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x0F,0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
}; };
ScummEngine_v5::ScummEngine_v5(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v5::ScummEngine_v5(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine(detector, syst, gs, md5sum, subst) { : ScummEngine(syst, gs, md5sum, subst) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
memcpy(_cursorImages[i], default_cursor_images[i], 32); memcpy(_cursorImages[i], default_cursor_images[i], 32);

View file

@ -82,7 +82,7 @@ ScummDebugger::ScummDebugger(ScummEngine *s)
DVar_Register("scumm_roomresource", &_vm->_roomResource, DVAR_INT, 0); DVar_Register("scumm_roomresource", &_vm->_roomResource, DVAR_INT, 0);
DVar_Register("scumm_vars", &_vm->_scummVars, DVAR_INTARRAY, _vm->_numVariables); DVar_Register("scumm_vars", &_vm->_scummVars, DVAR_INTARRAY, _vm->_numVariables);
DVar_Register("scumm_gamename", &_vm->_targetName, DVAR_STRING, 0); // DVar_Register("scumm_gamename", &_vm->_targetName, DVAR_STRING, 0);
DVar_Register("scumm_exename", &_vm->_baseName, DVAR_STRING, 0); DVar_Register("scumm_exename", &_vm->_baseName, DVAR_STRING, 0);
DVar_Register("scumm_gameid", &_vm->_game.id, DVAR_BYTE, 0); DVar_Register("scumm_gameid", &_vm->_game.id, DVAR_BYTE, 0);

View file

@ -51,7 +51,7 @@ protected:
Common::File _hFileTable[17]; Common::File _hFileTable[17];
public: public:
ScummEngine_v60he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) : ScummEngine_v6(detector, syst, gs, md5sum, subst) {} ScummEngine_v60he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) : ScummEngine_v6(syst, gs, md5sum, subst) {}
virtual void scummInit(); virtual void scummInit();
@ -116,7 +116,7 @@ protected:
bool _skipProcessActors; bool _skipProcessActors;
public: public:
ScummEngine_v70he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v70he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
~ScummEngine_v70he(); ~ScummEngine_v70he();
Wiz *_wiz; Wiz *_wiz;
@ -182,7 +182,7 @@ protected:
class ScummEngine_v71he : public ScummEngine_v70he { class ScummEngine_v71he : public ScummEngine_v70he {
public: public:
ScummEngine_v71he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v71he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
protected: protected:
virtual void saveOrLoad(Serializer *s); virtual void saveOrLoad(Serializer *s);
@ -237,7 +237,7 @@ protected:
WizParameters _wizParams; WizParameters _wizParams;
public: public:
ScummEngine_v72he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v72he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
virtual void scummInit(); virtual void scummInit();
@ -348,7 +348,7 @@ protected:
int32 _heSndResId, _curSndId, _sndPtrOffs, _sndTmrOffs; int32 _heSndResId, _curSndId, _sndPtrOffs, _sndTmrOffs;
public: public:
ScummEngine_v80he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v80he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
protected: protected:
virtual void setupOpcodes(); virtual void setupOpcodes();
@ -421,7 +421,7 @@ protected:
int32 _curSpriteGroupId; int32 _curSpriteGroupId;
public: public:
ScummEngine_v90he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v90he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
~ScummEngine_v90he(); ~ScummEngine_v90he();
virtual void scummInit(); virtual void scummInit();
@ -518,7 +518,7 @@ protected:
class ScummEngine_v99he : public ScummEngine_v90he { class ScummEngine_v99he : public ScummEngine_v90he {
public: public:
ScummEngine_v99he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) : ScummEngine_v90he(detector, syst, gs, md5sum, subst) {} ScummEngine_v99he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) : ScummEngine_v90he(syst, gs, md5sum, subst) {}
virtual void scummInit(); virtual void scummInit();
@ -549,7 +549,7 @@ protected:
const OpcodeEntryV100he *_opcodesV100he; const OpcodeEntryV100he *_opcodesV100he;
public: public:
ScummEngine_v100he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) : ScummEngine_v99he(detector, syst, gs, md5sum, subst) {} ScummEngine_v100he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) : ScummEngine_v99he(syst, gs, md5sum, subst) {}
protected: protected:
virtual void setupOpcodes(); virtual void setupOpcodes();

View file

@ -50,7 +50,7 @@ protected:
byte _cursorHotspots[2 * 4]; byte _cursorHotspots[2 * 4];
public: public:
ScummEngine_v5(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v5(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
protected: protected:
virtual void setupOpcodes(); virtual void setupOpcodes();
@ -193,7 +193,7 @@ protected:
*/ */
class ScummEngine_v4 : public ScummEngine_v5 { class ScummEngine_v4 : public ScummEngine_v5 {
public: public:
ScummEngine_v4(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v4(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
virtual void scummInit(); virtual void scummInit();
@ -212,7 +212,7 @@ protected:
*/ */
class ScummEngine_v3 : public ScummEngine_v4 { class ScummEngine_v3 : public ScummEngine_v4 {
public: public:
ScummEngine_v3(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v3(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
protected: protected:
virtual void readRoomsOffsets(); virtual void readRoomsOffsets();
@ -224,7 +224,7 @@ protected:
*/ */
class ScummEngine_v3old : public ScummEngine_v3 { class ScummEngine_v3old : public ScummEngine_v3 {
public: public:
ScummEngine_v3old(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v3old(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
protected: protected:
virtual void readResTypeList(int id, const char *name); virtual void readResTypeList(int id, const char *name);
@ -257,7 +257,7 @@ protected:
int8 _mouseOverBoxV2; int8 _mouseOverBoxV2;
public: public:
ScummEngine_v2(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v2(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
virtual void scummInit(); virtual void scummInit();
@ -403,7 +403,7 @@ protected:
int _currentMode; int _currentMode;
public: public:
ScummEngine_c64(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_c64(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
virtual void scummInit(); virtual void scummInit();
@ -555,7 +555,7 @@ protected:
public: public:
ScummEngine_v6(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v6(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
virtual void scummInit(); virtual void scummInit();
@ -784,7 +784,7 @@ protected:
#ifndef DISABLE_SCUMM_7_8 #ifndef DISABLE_SCUMM_7_8
class ScummEngine_v7 : public ScummEngine_v6 { class ScummEngine_v7 : public ScummEngine_v6 {
public: public:
ScummEngine_v7(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v7(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
~ScummEngine_v7(); ~ScummEngine_v7();
struct LangIndexNode { struct LangIndexNode {
@ -865,7 +865,7 @@ protected:
ObjectNameId *_objectIDMap; ObjectNameId *_objectIDMap;
public: public:
ScummEngine_v8(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine_v8(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
~ScummEngine_v8(); ~ScummEngine_v8();
protected: protected:

View file

@ -25,7 +25,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -1618,7 +1617,7 @@ DetectedGameList Engine_SCUMM_detectGames(const FSList &fslist) {
* *
* This is heavily based on our MD5 detection scheme. * This is heavily based on our MD5 detection scheme.
*/ */
Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) { Engine *Engine_SCUMM_create(OSystem *syst) {
Engine *engine; Engine *engine;
const char *gameid = ConfMan.get("gameid").c_str(); const char *gameid = ConfMan.get("gameid").c_str();
@ -1811,65 +1810,65 @@ Engine *Engine_SCUMM_create(GameDetector *detector, OSystem *syst) {
case 1: case 1:
case 2: case 2:
if (game.id == GID_MANIAC && game.platform == Common::kPlatformC64) if (game.id == GID_MANIAC && game.platform == Common::kPlatformC64)
engine = new ScummEngine_c64(detector, syst, game, md5sum, subst); engine = new ScummEngine_c64(syst, game, md5sum, subst);
else else
engine = new ScummEngine_v2(detector, syst, game, md5sum, subst); engine = new ScummEngine_v2(syst, game, md5sum, subst);
break; break;
case 3: case 3:
if (game.features & GF_OLD_BUNDLE) if (game.features & GF_OLD_BUNDLE)
engine = new ScummEngine_v3old(detector, syst, game, md5sum, subst); engine = new ScummEngine_v3old(syst, game, md5sum, subst);
else else
engine = new ScummEngine_v3(detector, syst, game, md5sum, subst); engine = new ScummEngine_v3(syst, game, md5sum, subst);
break; break;
case 4: case 4:
engine = new ScummEngine_v4(detector, syst, game, md5sum, subst); engine = new ScummEngine_v4(syst, game, md5sum, subst);
break; break;
case 5: case 5:
engine = new ScummEngine_v5(detector, syst, game, md5sum, subst); engine = new ScummEngine_v5(syst, game, md5sum, subst);
break; break;
case 6: case 6:
switch (game.heversion) { switch (game.heversion) {
#ifndef DISABLE_HE #ifndef DISABLE_HE
case 100: case 100:
engine = new ScummEngine_v100he(detector, syst, game, md5sum, subst); engine = new ScummEngine_v100he(syst, game, md5sum, subst);
break; break;
case 99: case 99:
engine = new ScummEngine_v99he(detector, syst, game, md5sum, subst); engine = new ScummEngine_v99he(syst, game, md5sum, subst);
break; break;
case 98: case 98:
case 95: case 95:
case 90: case 90:
engine = new ScummEngine_v90he(detector, syst, game, md5sum, subst); engine = new ScummEngine_v90he(syst, game, md5sum, subst);
break; break;
case 80: case 80:
engine = new ScummEngine_v80he(detector, syst, game, md5sum, subst); engine = new ScummEngine_v80he(syst, game, md5sum, subst);
break; break;
case 73: case 73:
case 72: case 72:
engine = new ScummEngine_v72he(detector, syst, game, md5sum, subst); engine = new ScummEngine_v72he(syst, game, md5sum, subst);
break; break;
case 71: case 71:
engine = new ScummEngine_v71he(detector, syst, game, md5sum, subst); engine = new ScummEngine_v71he(syst, game, md5sum, subst);
break; break;
case 70: case 70:
engine = new ScummEngine_v70he(detector, syst, game, md5sum, subst); engine = new ScummEngine_v70he(syst, game, md5sum, subst);
break; break;
#endif #endif
#ifndef PALMOS_68K #ifndef PALMOS_68K
case 61: case 61:
engine = new ScummEngine_v60he(detector, syst, game, md5sum, subst); engine = new ScummEngine_v60he(syst, game, md5sum, subst);
break; break;
#endif #endif
default: default:
engine = new ScummEngine_v6(detector, syst, game, md5sum, subst); engine = new ScummEngine_v6(syst, game, md5sum, subst);
} }
break; break;
#ifndef DISABLE_SCUMM_7_8 #ifndef DISABLE_SCUMM_7_8
case 7: case 7:
engine = new ScummEngine_v7(detector, syst, game, md5sum, subst); engine = new ScummEngine_v7(syst, game, md5sum, subst);
break; break;
case 8: case 8:
engine = new ScummEngine_v8(detector, syst, game, md5sum, subst); engine = new ScummEngine_v8(syst, game, md5sum, subst);
break; break;
#endif #endif
default: default:

View file

@ -25,7 +25,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -81,7 +80,7 @@ namespace Scumm {
ScummEngine *g_scumm = 0; ScummEngine *g_scumm = 0;
ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine::ScummEngine(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: Engine(syst), : Engine(syst),
_game(gs), _game(gs),
_substResFileName(subst), _substResFileName(subst),
@ -89,8 +88,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const GameSettin
_currentScript(0xFF), // Let debug() work on init stage _currentScript(0xFF), // Let debug() work on init stage
gdi(this), gdi(this),
res(this), res(this),
_pauseDialog(0), _mainMenuDialog(0), _versionDialog(0), _pauseDialog(0), _mainMenuDialog(0), _versionDialog(0) {
_targetName(detector->_targetName) {
// Copy MD5 checksum // Copy MD5 checksum
memcpy(_gameMD5, md5sum, 16); memcpy(_gameMD5, md5sum, 16);
@ -677,22 +675,22 @@ ScummEngine::~ScummEngine() {
delete _debugger; delete _debugger;
} }
ScummEngine_v4::ScummEngine_v4(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v4::ScummEngine_v4(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v5(detector, syst, gs, md5sum, subst) { : ScummEngine_v5(syst, gs, md5sum, subst) {
_resourceHeaderSize = 6; _resourceHeaderSize = 6;
} }
ScummEngine_v3::ScummEngine_v3(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v3::ScummEngine_v3(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v4(detector, syst, gs, md5sum, subst) { : ScummEngine_v4(syst, gs, md5sum, subst) {
} }
ScummEngine_v3old::ScummEngine_v3old(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v3old::ScummEngine_v3old(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v3(detector, syst, gs, md5sum, subst) { : ScummEngine_v3(syst, gs, md5sum, subst) {
_resourceHeaderSize = 4; _resourceHeaderSize = 4;
} }
ScummEngine_v2::ScummEngine_v2(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v2::ScummEngine_v2(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v3old(detector, syst, gs, md5sum, subst) { : ScummEngine_v3old(syst, gs, md5sum, subst) {
VAR_SENTENCE_VERB = 0xFF; VAR_SENTENCE_VERB = 0xFF;
VAR_SENTENCE_OBJECT1 = 0xFF; VAR_SENTENCE_OBJECT1 = 0xFF;
@ -705,14 +703,14 @@ ScummEngine_v2::ScummEngine_v2(GameDetector *detector, OSystem *syst, const Game
VAR_CLICK_OBJECT = 0xFF; VAR_CLICK_OBJECT = 0xFF;
} }
ScummEngine_c64::ScummEngine_c64(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_c64::ScummEngine_c64(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v2(detector, syst, gs, md5sum, subst) { : ScummEngine_v2(syst, gs, md5sum, subst) {
_currentMode = 0; _currentMode = 0;
} }
ScummEngine_v6::ScummEngine_v6(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v6::ScummEngine_v6(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine(detector, syst, gs, md5sum, subst) { : ScummEngine(syst, gs, md5sum, subst) {
_blastObjectQueuePos = 0; _blastObjectQueuePos = 0;
memset(_blastObjectQueue, 0, sizeof(_blastObjectQueue)); memset(_blastObjectQueue, 0, sizeof(_blastObjectQueue));
_blastTextQueuePos = 0; _blastTextQueuePos = 0;
@ -733,8 +731,8 @@ ScummEngine_v6::ScummEngine_v6(GameDetector *detector, OSystem *syst, const Game
} }
#ifndef DISABLE_HE #ifndef DISABLE_HE
ScummEngine_v70he::ScummEngine_v70he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v70he::ScummEngine_v70he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v60he(detector, syst, gs, md5sum, subst) { : ScummEngine_v60he(syst, gs, md5sum, subst) {
if (_game.platform == Common::kPlatformMacintosh && (_game.heversion >= 72 && _game.heversion <= 73)) if (_game.platform == Common::kPlatformMacintosh && (_game.heversion >= 72 && _game.heversion <= 73))
_resExtractor = new MacResExtractor(this); _resExtractor = new MacResExtractor(this);
else else
@ -765,16 +763,16 @@ ScummEngine_v70he::~ScummEngine_v70he() {
free(_storedFlObjects); free(_storedFlObjects);
} }
ScummEngine_v71he::ScummEngine_v71he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v71he::ScummEngine_v71he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v70he(detector, syst, gs, md5sum, subst) { : ScummEngine_v70he(syst, gs, md5sum, subst) {
_auxBlocksNum = 0; _auxBlocksNum = 0;
memset(_auxBlocks, 0, sizeof(_auxBlocks)); memset(_auxBlocks, 0, sizeof(_auxBlocks));
_auxEntriesNum = 0; _auxEntriesNum = 0;
memset(_auxEntries, 0, sizeof(_auxEntries)); memset(_auxEntries, 0, sizeof(_auxEntries));
} }
ScummEngine_v72he::ScummEngine_v72he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v72he::ScummEngine_v72he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v71he(detector, syst, gs, md5sum, subst) { : ScummEngine_v71he(syst, gs, md5sum, subst) {
VAR_NUM_ROOMS = 0xFF; VAR_NUM_ROOMS = 0xFF;
VAR_NUM_SCRIPTS = 0xFF; VAR_NUM_SCRIPTS = 0xFF;
VAR_NUM_SOUNDS = 0xFF; VAR_NUM_SOUNDS = 0xFF;
@ -784,8 +782,8 @@ ScummEngine_v72he::ScummEngine_v72he(GameDetector *detector, OSystem *syst, cons
VAR_POLYGONS_ONLY = 0xFF; VAR_POLYGONS_ONLY = 0xFF;
} }
ScummEngine_v80he::ScummEngine_v80he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v80he::ScummEngine_v80he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v72he(detector, syst, gs, md5sum, subst) { : ScummEngine_v72he(syst, gs, md5sum, subst) {
_heSndResId = 0; _heSndResId = 0;
_curSndId = 0; _curSndId = 0;
_sndPtrOffs = 0; _sndPtrOffs = 0;
@ -797,8 +795,8 @@ ScummEngine_v80he::ScummEngine_v80he(GameDetector *detector, OSystem *syst, cons
VAR_COLOR_DEPTH = 0xFF; VAR_COLOR_DEPTH = 0xFF;
} }
ScummEngine_v90he::ScummEngine_v90he(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v90he::ScummEngine_v90he(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v80he(detector, syst, gs, md5sum, subst) { : ScummEngine_v80he(syst, gs, md5sum, subst) {
_sprite = new Sprite(this); _sprite = new Sprite(this);
VAR_NUM_SPRITE_GROUPS = 0xFF; VAR_NUM_SPRITE_GROUPS = 0xFF;
@ -822,8 +820,8 @@ ScummEngine_v90he::~ScummEngine_v90he() {
#endif #endif
#ifndef DISABLE_SCUMM_7_8 #ifndef DISABLE_SCUMM_7_8
ScummEngine_v7::ScummEngine_v7(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v7::ScummEngine_v7(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v6(detector, syst, gs, md5sum, subst) { : ScummEngine_v6(syst, gs, md5sum, subst) {
_verbCharset = 0; _verbCharset = 0;
_existLanguageFile = false; _existLanguageFile = false;
_languageBuffer = NULL; _languageBuffer = NULL;
@ -836,8 +834,8 @@ ScummEngine_v7::~ScummEngine_v7() {
free(_languageIndex); free(_languageIndex);
} }
ScummEngine_v8::ScummEngine_v8(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst) ScummEngine_v8::ScummEngine_v8(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
: ScummEngine_v7(detector, syst, gs, md5sum, subst) { : ScummEngine_v7(syst, gs, md5sum, subst) {
_objectIDMap = 0; _objectIDMap = 0;
} }
@ -850,7 +848,7 @@ ScummEngine_v8::~ScummEngine_v8() {
#pragma mark --- Initialization --- #pragma mark --- Initialization ---
#pragma mark - #pragma mark -
int ScummEngine::init(GameDetector &detector) { int ScummEngine::init() {
// Initialize backend // Initialize backend
_system->beginGFXTransaction(); _system->beginGFXTransaction();
@ -867,7 +865,7 @@ int ScummEngine::init(GameDetector &detector) {
_system->initSize(_screenWidth, _screenHeight, (ConfMan.getBool("force_1x_overlay") ? 1 : 2)); _system->initSize(_screenWidth, _screenHeight, (ConfMan.getBool("force_1x_overlay") ? 1 : 2));
defaultTo1XScaler = (_screenWidth > 320); defaultTo1XScaler = (_screenWidth > 320);
} }
initCommonGFX(detector, defaultTo1XScaler); initCommonGFX(defaultTo1XScaler);
_system->endGFXTransaction(); _system->endGFXTransaction();
// On some systems it's not safe to run CD audio games from the CD. // On some systems it's not safe to run CD audio games from the CD.

View file

@ -41,7 +41,6 @@ namespace GUI {
class Dialog; class Dialog;
} }
using GUI::Dialog; using GUI::Dialog;
class GameDetector;
namespace Common { namespace Common {
class InSaveFile; class InSaveFile;
class OutSaveFile; class OutSaveFile;
@ -445,14 +444,14 @@ protected:
public: public:
// Constructor / Destructor // Constructor / Destructor
ScummEngine(GameDetector *detector, OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst); ScummEngine(OSystem *syst, const GameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);
virtual ~ScummEngine(); virtual ~ScummEngine();
/** Startup function, main loop. */ /** Startup function, main loop. */
int go(); int go();
// Init functions // Init functions
int init(GameDetector &detector); int init();
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void initScummVars();
@ -739,7 +738,6 @@ public:
protected: protected:
int _resourceHeaderSize; int _resourceHeaderSize;
Common::String _baseName; // This is the name we use for opening resource files Common::String _baseName; // This is the name we use for opening resource files
Common::String _targetName; // This is the game the user calls it, so use for saving
byte _resourceMapper[128]; byte _resourceMapper[128];
byte *_heV7DiskOffsets; byte *_heV7DiskOffsets;
uint32 *_heV7RoomIntOffsets; uint32 *_heV7RoomIntOffsets;

View file

@ -24,7 +24,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -112,7 +111,7 @@ DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) {
return Simon::GAME_detectGames(fslist); return Simon::GAME_detectGames(fslist);
} }
Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst) { Engine *Engine_SIMON_create(OSystem *syst) {
const char *gameid = ConfMan.get("gameid").c_str(); const char *gameid = ConfMan.get("gameid").c_str();
for (const ObsoleteGameID *o = obsoleteGameIDsTable; o->from; ++o) { for (const ObsoleteGameID *o = obsoleteGameIDsTable; o->from; ++o) {

View file

@ -24,7 +24,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "common/config-manager.h" #include "common/config-manager.h"
#include "common/file.h" #include "common/file.h"
@ -484,7 +483,7 @@ SimonEngine::SimonEngine(OSystem *syst)
File::addDefaultDirectory(_gameDataPath + "SPEECH/"); File::addDefaultDirectory(_gameDataPath + "SPEECH/");
} }
int SimonEngine::init(GameDetector &detector) { int SimonEngine::init() {
// Detect game // Detect game
if (!initGame()) { if (!initGame()) {
@ -509,7 +508,7 @@ int SimonEngine::init(GameDetector &detector) {
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, getGameType() == GType_FF); initCommonGFX(getGameType() == GType_FF);
_system->initSize(_screenWidth, _screenHeight); _system->initSize(_screenWidth, _screenHeight);
_system->endGFXTransaction(); _system->endGFXTransaction();

View file

@ -35,8 +35,6 @@
#include "simon/sound.h" #include "simon/sound.h"
#include "simon/vga.h" #include "simon/vga.h"
class GameDetector;
namespace Simon { namespace Simon {
/* Various other settings */ /* Various other settings */
@ -1044,7 +1042,7 @@ protected:
void resfile_read(void *dst, uint32 offs, uint32 size); void resfile_read(void *dst, uint32 offs, uint32 size);
int init(GameDetector &detector); int init();
int go(); int go();
void openGameFile(); void openGameFile();

View file

@ -24,7 +24,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -111,7 +110,7 @@ DetectedGameList Engine_SKY_detectGames(const FSList &fslist) {
return detectedGames; return detectedGames;
} }
Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst) { Engine *Engine_SKY_create(OSystem *syst) {
return new Sky::SkyEngine(syst); return new Sky::SkyEngine(syst);
} }
@ -306,9 +305,9 @@ int SkyEngine::go() {
return 0; return 0;
} }
int SkyEngine::init(GameDetector &detector) { int SkyEngine::init() {
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, false); initCommonGFX(false);
_system->initSize(320, 200); _system->initSize(320, 200);
_system->endGFXTransaction(); _system->endGFXTransaction();

View file

@ -26,8 +26,6 @@
#include "common/stdafx.h" #include "common/stdafx.h"
#include "base/engine.h" #include "base/engine.h"
class GameDetector;
namespace Sky { namespace Sky {
struct SystemVars { struct SystemVars {
@ -98,7 +96,7 @@ protected:
uint32 _lastSaveTime; uint32 _lastSaveTime;
int init(GameDetector &detector); int init();
void initItemList(); void initItemList();
void initVirgin(); void initVirgin();

View file

@ -117,8 +117,8 @@ DetectedGameList Engine_SWORD1_detectGames(const FSList &fslist) {
return detectedGames; return detectedGames;
} }
Engine *Engine_SWORD1_create(GameDetector *detector, OSystem *syst) { Engine *Engine_SWORD1_create(OSystem *syst) {
return new SwordEngine(detector, syst); return new SwordEngine(syst);
} }
REGISTER_PLUGIN(SWORD1, "Broken Sword"); REGISTER_PLUGIN(SWORD1, "Broken Sword");
@ -131,7 +131,7 @@ void SwordEngine::errorString(const char *buf1, char *buf2) {
strcpy(buf2, buf1); strcpy(buf2, buf1);
} }
SwordEngine::SwordEngine(GameDetector *detector, OSystem *syst) SwordEngine::SwordEngine(OSystem *syst)
: Engine(syst) { : Engine(syst) {
if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo")) if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo"))
@ -166,10 +166,10 @@ SwordEngine::~SwordEngine() {
delete _resMan; delete _resMan;
} }
int SwordEngine::init(GameDetector &detector) { int SwordEngine::init() {
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, true); initCommonGFX(true);
_system->initSize(640, 480); _system->initSize(640, 480);
_system->endGFXTransaction(); _system->endGFXTransaction();

View file

@ -25,7 +25,6 @@
#include "base/engine.h" #include "base/engine.h"
#include "common/util.h" #include "common/util.h"
#include "base/gameDetector.h"
#include "sword1/sworddefs.h" #include "sword1/sworddefs.h"
namespace Sword1 { namespace Sword1 {
@ -71,7 +70,7 @@ struct SystemVars {
class SwordEngine : public Engine { class SwordEngine : public Engine {
void errorString(const char *buf_input, char *buf_output); void errorString(const char *buf_input, char *buf_output);
public: public:
SwordEngine(GameDetector *detector, OSystem *syst); SwordEngine(OSystem *syst);
virtual ~SwordEngine(); virtual ~SwordEngine();
static SystemVars _systemVars; static SystemVars _systemVars;
void reinitialize(void); void reinitialize(void);
@ -79,7 +78,7 @@ public:
uint32 _features; uint32 _features;
protected: protected:
int go(); int go();
int init(GameDetector &detector); int init();
private: private:
void delay(int32 amount); void delay(int32 amount);

View file

@ -23,7 +23,6 @@
#include "backends/fs/fs.h" #include "backends/fs/fs.h"
#include "base/gameDetector.h"
#include "base/plugins.h" #include "base/plugins.h"
#include "common/config-manager.h" #include "common/config-manager.h"
@ -112,15 +111,15 @@ DetectedGameList Engine_SWORD2_detectGames(const FSList &fslist) {
return detectedGames; return detectedGames;
} }
Engine *Engine_SWORD2_create(GameDetector *detector, OSystem *syst) { Engine *Engine_SWORD2_create(OSystem *syst) {
return new Sword2::Sword2Engine(detector, syst); return new Sword2::Sword2Engine(syst);
} }
REGISTER_PLUGIN(SWORD2, "Broken Sword 2"); REGISTER_PLUGIN(SWORD2, "Broken Sword 2");
namespace Sword2 { namespace Sword2 {
Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst) : Engine(syst) { Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) {
// Add default file directories // Add default file directories
Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/"); Common::File::addDefaultDirectory(_gameDataPath + "CLUSTERS/");
Common::File::addDefaultDirectory(_gameDataPath + "SWORD2/"); Common::File::addDefaultDirectory(_gameDataPath + "SWORD2/");
@ -134,8 +133,6 @@ Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst) : Engine(syst)
else else
_features = 0; _features = 0;
_targetName = detector->_targetName;
_bootParam = ConfMan.getInt("boot_param"); _bootParam = ConfMan.getInt("boot_param");
_saveSlot = ConfMan.getInt("save_slot"); _saveSlot = ConfMan.getInt("save_slot");
@ -243,12 +240,12 @@ void Sword2Engine::setupPersistentResources() {
_resman->openResource(CUR_PLAYER_ID); _resman->openResource(CUR_PLAYER_ID);
} }
int Sword2Engine::init(GameDetector &detector) { int Sword2Engine::init() {
// Get some falling RAM and put it in your pocket, never let it slip // Get some falling RAM and put it in your pocket, never let it slip
// away // away
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector, true); initCommonGFX(true);
_screen = new Screen(this, 640, 480); _screen = new Screen(this, 640, 480);
_system->endGFXTransaction(); _system->endGFXTransaction();

View file

@ -36,7 +36,6 @@
#define MAX_starts 100 #define MAX_starts 100
#define MAX_description 100 #define MAX_description 100
class GameDetector;
class OSystem; class OSystem;
namespace Sword2 { namespace Sword2 {
@ -121,10 +120,10 @@ private:
StartUp _startList[MAX_starts]; StartUp _startList[MAX_starts];
public: public:
Sword2Engine(GameDetector *detector, OSystem *syst); Sword2Engine(OSystem *syst);
~Sword2Engine(); ~Sword2Engine();
int go(); int go();
int init(GameDetector &detector); int init();
void registerDefaultSettings(); void registerDefaultSettings();
void readSettings(); void readSettings();
@ -138,7 +137,6 @@ public:
bool _quit; bool _quit;
uint32 _features; uint32 _features;
Common::String _targetName; // target name for saves
MemoryManager *_memory; MemoryManager *_memory;
ResourceManager *_resman; ResourceManager *_resman;