diff options
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | base/main.cpp | 15 |
2 files changed, 16 insertions, 4 deletions
@@ -229,6 +229,11 @@ Plugins be put into ScummVM.app/Contents/PlugIns/; this also means that the loader needs to search in the plugin dir of the active bundle. So use the CF bundle API, inside a #ifdef MACOSX block. +* When creating an engine instance, there is currently no way for the plugin + to indicate an error, except for returning a NULL value. It would be nice + if the engine could specify why creating the engine instance failed (e.g. + due to lack of memory, because a file couldn't be found, because the game + was not recognized, etc.). OSystem ======= diff --git a/base/main.cpp b/base/main.cpp index 70ce2726bc..bddbbed2c2 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -250,6 +250,17 @@ static bool launcherDialog(GameDetector &detector, OSystem &system) { } static int runGame(GameDetector &detector, OSystem &system) { + // Create the game engine + Engine *engine = detector.createEngine(&system); + if (!engine) { + // TODO: Show an error dialog or so? + //GUI::MessageDialog alert("ScummVM could not find any game in the specified directory!"); + //alert.runModal(); + warning("Failed to instantiate engine for target %s", detector._targetName.c_str()); + return 0; + } + + // Set the window caption to the game name Common::String caption(ConfMan.get("description", detector._targetName)); @@ -261,10 +272,6 @@ static int runGame(GameDetector &detector, OSystem &system) { system.setWindowCaption(caption.c_str()); } - // Create the game engine - Engine *engine = detector.createEngine(&system); - assert(engine); - // Add extrapath (if any) to the directory search list if (ConfMan.hasKey("extrapath")) File::addDefaultDirectory(ConfMan.get("extrapath")); |