diff options
author | Travis Howell | 2006-08-26 11:56:49 +0000 |
---|---|---|
committer | Travis Howell | 2006-08-26 11:56:49 +0000 |
commit | be794a6b845b4e6c9c893df58778af9c741510d9 (patch) | |
tree | fd893a381512ba69e4cff9b6b8c938ca5219add1 /engines/agi | |
parent | ca387f158537dad55d11725247c8224678108e2f (diff) | |
download | scummvm-rg350-be794a6b845b4e6c9c893df58778af9c741510d9.tar.gz scummvm-rg350-be794a6b845b4e6c9c893df58778af9c741510d9.tar.bz2 scummvm-rg350-be794a6b845b4e6c9c893df58778af9c741510d9.zip |
Fix bug #1544810 - AGI: Launching undefined target 'agi' shows a blank screen
svn-id: r23754
Diffstat (limited to 'engines/agi')
-rw-r--r-- | engines/agi/agi.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 0ba9f7c122..4bc85bc5b4 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -635,9 +635,29 @@ DetectedGameList Engine_AGI_detectGames(const FSList &fslist) { } PluginError Engine_AGI_create(OSystem *syst, Engine **engine) { + assert(syst); assert(engine); - *engine = new Agi::AgiEngine(syst); - return kNoError; + + FSList fslist; + FilesystemNode dir(ConfMan.get("path")); + if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + warning("AgiEngine: invalid game path '%s'", dir.path().c_str()); + return kInvalidPathError; + } + + // Invoke the detector + Common::String gameid = ConfMan.get("gameid"); + DetectedGameList detectedGames = Engine_AGI_detectGames(fslist); + + for (uint i = 0; i < detectedGames.size(); i++) { + if (detectedGames[i].gameid == gameid) { + *engine = new Agi::AgiEngine(syst); + return kNoError; + } + } + + warning("AgiEngine: Unable to locate game data at path '%s'", dir.path().c_str()); + return kNoGameDataFoundError; } REGISTER_PLUGIN(AGI, "AGI Engine", "TODO (C) TODO"); |