diff options
| author | Matthew Hoops | 2011-05-03 17:17:27 -0400 |
|---|---|---|
| committer | Matthew Hoops | 2011-05-03 17:25:41 -0400 |
| commit | 9cb600099f4c29298707787cafad2741a1cd6686 (patch) | |
| tree | fb1930fa56b611317831d66442cba19b18d2e57a /base/main.cpp | |
| parent | 3b2283daf850605ca897002afbafe44489c35473 (diff) | |
| parent | 95a6098f672191dc0792bd4f9bfa18706bbe8e3a (diff) | |
| download | scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.tar.gz scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.tar.bz2 scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.zip | |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'base/main.cpp')
| -rw-r--r-- | base/main.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/base/main.cpp b/base/main.cpp index 65aa0ab43f..fc4523b895 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -31,6 +31,9 @@ * of almost all the classes, methods and variables, and how they interact. */ +// FIXME: Avoid using printf +#define FORBIDDEN_SYMBOL_EXCEPTION_printf + #include "engines/engine.h" #include "engines/metaengine.h" #include "base/commandLine.h" @@ -43,14 +46,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 +113,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 +132,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 +352,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 +430,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 |
