From a4ac594d21dd0f892be4b855f46b5d7a73a65f7a Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 26 Aug 2006 11:25:08 +0000 Subject: Fix bug #1544799 - SIMON: Engine creates launcher entry when failing to launch. svn-id: r23749 --- engines/simon/game.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'engines') 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"); -- cgit v1.2.3