diff options
author | Travis Howell | 2006-08-26 11:25:08 +0000 |
---|---|---|
committer | Travis Howell | 2006-08-26 11:25:08 +0000 |
commit | a4ac594d21dd0f892be4b855f46b5d7a73a65f7a (patch) | |
tree | 34a355351c7851a6a7d413d090346c9915ca47dc /engines | |
parent | c7627bbb5cdb48cc0cec1d125f624343c9743f1c (diff) | |
download | scummvm-rg350-a4ac594d21dd0f892be4b855f46b5d7a73a65f7a.tar.gz scummvm-rg350-a4ac594d21dd0f892be4b855f46b5d7a73a65f7a.tar.bz2 scummvm-rg350-a4ac594d21dd0f892be4b855f46b5d7a73a65f7a.zip |
Fix bug #1544799 - SIMON: Engine creates launcher entry when failing to launch.
svn-id: r23749
Diffstat (limited to 'engines')
-rw-r--r-- | engines/simon/game.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/engines/simon/game.cpp b/engines/simon/game.cpp index 6c9c70c7f1..2d749a43cb 100644 --- a/engines/simon/game.cpp +++ b/engines/simon/game.cpp @@ -113,6 +113,8 @@ DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) { } PluginError Engine_SIMON_create(OSystem *syst, Engine **engine) { + assert(syst); + assert(engine); const char *gameid = ConfMan.get("gameid").c_str(); for (const ObsoleteGameID *o = obsoleteGameIDsTable; o->from; ++o) { @@ -130,9 +132,25 @@ PluginError Engine_SIMON_create(OSystem *syst, Engine **engine) { } } - assert(engine); - *engine = new Simon::SimonEngine(syst); - return kNoError; + FSList fslist; + FilesystemNode dir(ConfMan.get("path")); + if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + warning("SimonEngine: invalid game path '%s'", dir.path().c_str()); + return kInvalidPathError; + } + + // Invoke the detector + DetectedGameList detectedGames = Engine_SIMON_detectGames(fslist); + + for (uint i = 0; i < detectedGames.size(); i++) { + if (detectedGames[i].gameid == gameid) { + *engine = new Simon::SimonEngine(syst); + return kNoError; + } + } + + warning("SimonEngine: Unable to locate game data at path '%s'", dir.path().c_str()); + return kNoGameDataFoundError; } REGISTER_PLUGIN(SIMON, "Simon the Sorcerer", "Simon the Sorcerer (C) Adventure Soft"); |