diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/engine.cpp | 6 | ||||
-rw-r--r-- | common/gameDetector.cpp | 48 | ||||
-rw-r--r-- | common/gameDetector.h | 10 | ||||
-rw-r--r-- | common/main.cpp | 2 |
4 files changed, 25 insertions, 41 deletions
diff --git a/common/engine.cpp b/common/engine.cpp index dd6e208a88..d68b9e46da 100644 --- a/common/engine.cpp +++ b/common/engine.cpp @@ -82,21 +82,21 @@ Engine *Engine::createFromDetector(GameDetector *detector, OSystem *syst) { Engine *engine = NULL; #ifndef DISABLE_SCUMM - if (detector->_gameId >= GID_SCUMM_FIRST && detector->_gameId <= GID_SCUMM_LAST) { + if (detector->_game.id >= GID_SCUMM_FIRST && detector->_game.id <= GID_SCUMM_LAST) { // Some kind of Scumm game engine = Engine_SCUMM_create(detector, syst); } #endif #ifndef DISABLE_SIMON - if (detector->_gameId >= GID_SIMON_FIRST && detector->_gameId <= GID_SIMON_LAST) { + if (detector->_game.id >= GID_SIMON_FIRST && detector->_game.id <= GID_SIMON_LAST) { // Simon the Sorcerer engine = Engine_SIMON_create(detector, syst); } #endif #ifndef DISABLE_SKY - if (detector->_gameId >= GID_SKY_FIRST && detector->_gameId <= GID_SKY_LAST) { + if (detector->_game.id >= GID_SKY_FIRST && detector->_game.id <= GID_SKY_LAST) { // Beneath a Steel Sky engine = Engine_SKY_create(detector, syst); } diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp index 6ecd7cdff0..aa5225b0ff 100644 --- a/common/gameDetector.cpp +++ b/common/gameDetector.cpp @@ -148,7 +148,6 @@ static int countVersions(const VersionSettings *v) { GameDetector::GameDetector() { _fullScreen = false; - _gameId = 0; _use_adlib = false; @@ -168,7 +167,8 @@ GameDetector::GameDetector() { _gameDataPath = 0; _gameTempo = 0; _midi_driver = MD_AUTO; - _features = 0; + _game.id = 0; + _game.features = 0; _multi_midi = false; _native_mt32 = false; @@ -289,26 +289,14 @@ void GameDetector::updateconfig() { void GameDetector::list_games() { const VersionSettings *v = version_settings; - char config[4] = ""; + const char *config; printf("Game SCUMM ver Full Title Config\n" "------------- --------- ---------------------------------------------- -------\n"); while (v->filename && v->gamename) { - if (g_config->has_domain(v->filename)) { - strcpy(config, "Yes"); - } - else { - strcpy(config, ""); - } - - if (v->major != 99) - printf("%-14s%d.%d.%d\t%-47s%s\n", v->filename, - v->major, v->middle, v->minor, v->gamename, config); - else - printf("%-14s%-7s\t%-47s%s\n", v->filename, "n/a", - v->gamename, config); - + config = (g_config->has_domain(v->filename)) ? "Yes" : ""; + printf("%-14s%-7s\t%-47s%s\n", v->filename, "n/a", v->gamename, config); v++; } @@ -578,27 +566,23 @@ bool GameDetector::parseMusicDriver(const char *s) { bool GameDetector::detectGame() { const VersionSettings *gnl = version_settings; const char *realGame, *basename; - _gameId = 0; + _game.id = 0; _gameText.clear(); - if (!(realGame = g_config->get("gameid"))) + realGame = g_config->get("gameid"); + if (!realGame) realGame = _gameFileName.c_str(); printf("Looking for %s\n", realGame); do { if (!scumm_stricmp(realGame, gnl->filename)) { - _gameId = gnl->id; - if ((basename = g_config->get("basename"))) - _gameRealName = basename; - else - _gameRealName = gnl->filename; - _features = gnl->features; + _game = *gnl; + if ((basename = g_config->get("basename"))) { + // FIXME: What is this good for? + _game.filename = basename; + } _gameText = gnl->gamename; - if (gnl->major != 99) - debug(1, "Trying to start game '%s', version %d.%d.%d", - gnl->gamename, gnl->major, gnl->middle, gnl->minor); - else - debug(1, "Trying to start game '%s'",gnl->gamename); + debug(1, "Trying to start game '%s'",gnl->gamename); return true; } } while ((++gnl)->filename); @@ -633,7 +617,7 @@ int GameDetector::detectMain() { * default, OR if the game is an older game that doesn't * support anything else anyway. */ #ifndef __PALM_OS__ // currently adlib is not supported, is this really needed ? - if ((_midi_driver == MD_AUTO && _features & GF_ADLIB_DEFAULT) || _features & GF_SMALL_HEADER) { + if ((_midi_driver == MD_AUTO && _game.features & GF_ADLIB_DEFAULT) || _game.features & GF_SMALL_HEADER) { _midi_driver = MD_ADLIB; _use_adlib = true; } @@ -668,7 +652,7 @@ OSystem *GameDetector::createSystem() { #elif defined(X11_BACKEND) return OSystem_X11_create(); #elif defined(__MORPHOS__) - return OSystem_MorphOS_create(_gameId, _gfx_mode, _fullScreen); + return OSystem_MorphOS_create(_game.id, _gfx_mode, _fullScreen); #elif defined(_WIN32_WCE) return OSystem_WINCE3_create(); #elif defined(MACOS_CARBON) diff --git a/common/gameDetector.h b/common/gameDetector.h index 15d28230e4..9330641ad7 100644 --- a/common/gameDetector.h +++ b/common/gameDetector.h @@ -100,7 +100,7 @@ enum GameFeatures { struct VersionSettings { const char *filename; const char *gamename; - byte id, major, middle, minor; + byte id, version; uint32 features; char *detectname; }; @@ -142,7 +142,6 @@ public: const String& getGameName(void); bool _fullScreen; - byte _gameId; bool _use_adlib; @@ -162,10 +161,9 @@ public: char *_gameDataPath; int _gameTempo; int _midi_driver; + String _gameFileName; - String _gameText; - String _gameRealName; - uint32 _features; + VersionSettings _game; int _gfx_mode; bool _default_gfx_mode; @@ -187,6 +185,8 @@ public: void updateconfig(); protected: + String _gameText; + bool detectGame(void); bool parseMusicDriver(const char *s); int parseLanguage(const char *s); diff --git a/common/main.cpp b/common/main.cpp index c220a0a137..658895c27d 100644 --- a/common/main.cpp +++ b/common/main.cpp @@ -213,7 +213,7 @@ int main(int argc, char *argv[]) { // See if the game should default to 1x scaler if ((detector._default_gfx_mode) && - (detector._features & GF_DEFAULT_TO_1X_SCALER)) { + (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) { prop.gfx_mode = GFX_NORMAL; system->property(OSystem::PROP_SET_GFX_MODE, &prop); } |