diff options
Diffstat (limited to 'base/main.cpp')
-rw-r--r-- | base/main.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/base/main.cpp b/base/main.cpp index 65aa0ab43f..7a77d6af7a 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -43,14 +43,13 @@ #include "common/debug-channels.h" /* for debug manager */ #include "common/events.h" #include "common/EventRecorder.h" -#include "common/file.h" #include "common/fs.h" #include "common/system.h" +#include "common/textconsole.h" #include "common/tokenizer.h" #include "common/translation.h" #include "gui/gui-manager.h" -#include "gui/message.h" #include "gui/error.h" #include "audio/mididrv.h" @@ -111,13 +110,12 @@ static const EnginePlugin *detectPlugin() { if (plugin == 0) { printf("failed\n"); warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str()); - return 0; } else { printf("%s\n", plugin->getName()); - } - // FIXME: Do we really need this one? - printf(" Starting '%s'\n", game.description().c_str()); + // FIXME: Do we really need this one? + printf(" Starting '%s'\n", game.description().c_str()); + } return plugin; } @@ -131,24 +129,20 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const // Verify that the game path refers to an actual directory if (!(dir.exists() && dir.isDirectory())) - err = Common::kInvalidPathError; + err = Common::kPathNotDirectory; // Create the game engine - if (err == Common::kNoError) + if (err.getCode() == Common::kNoError) err = (*plugin)->createInstance(&system, &engine); // Check for errors - if (!engine || err != Common::kNoError) { - - // TODO: An errorDialog for this and engine related errors is displayed already in the scummvm_main function - // Is a separate dialog here still required? - - //GUI::displayErrorDialog("ScummVM could not find any game in the specified directory!"); - const char *errMsg = _(Common::errorToString(err)); + if (!engine || err.getCode() != Common::kNoError) { + // Print a warning; note that scummvm_main will also + // display an error dialog, so we don't have to do this here. warning("%s failed to instantiate engine: %s (target '%s', path '%s')", plugin->getName(), - errMsg, + err.getDesc().c_str(), ConfMan.getActiveDomainName().c_str(), dir.getPath().c_str() ); @@ -355,8 +349,11 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { Common::Error res; // TODO: deal with settings that require plugins to be loaded - if ((res = Base::processSettings(command, settings)) != Common::kArgumentNotProcessed) - return res; + res = Base::processSettings(command, settings); + if (res.getCode() != Common::kArgumentNotProcessed) { + warning("%s", res.getDesc().c_str()); + return res.getCode(); + } // Init the backend. Must take place after all config data (including // the command line params) was read. @@ -430,14 +427,14 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { #endif // Did an error occur ? - if (result != Common::kNoError) { + if (result.getCode() != Common::kNoError) { // Shows an informative error dialog if starting the selected game failed. GUI::displayErrorDialog(result, _("Error running game:")); } // Quit unless an error occurred, or Return to launcher was requested #ifndef FORCE_RTL - if (result == 0 && !g_system->getEventManager()->shouldRTL()) + if (result.getCode() == Common::kNoError && !g_system->getEventManager()->shouldRTL()) break; #endif // Reset RTL flag in case we want to load another engine |