From be794a6b845b4e6c9c893df58778af9c741510d9 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 26 Aug 2006 11:56:49 +0000 Subject: Fix bug #1544810 - AGI: Launching undefined target 'agi' shows a blank screen svn-id: r23754 --- engines/agi/agi.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'engines') 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"); -- cgit v1.2.3