diff options
Diffstat (limited to 'base/main.cpp')
| -rw-r--r-- | base/main.cpp | 43 | 
1 files changed, 20 insertions, 23 deletions
diff --git a/base/main.cpp b/base/main.cpp index 65aa0ab43f..906f4c9242 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -18,9 +18,6 @@   * along with this program; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.   * - * $URL$ - * $Id$ - *   */  /*! \mainpage %ScummVM Source Reference @@ -31,6 +28,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 +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; +	if (Base::processSettings(command, settings, res)) { +		if (res.getCode() != Common::kNoError) +			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  | 
