aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2002-09-20 00:12:58 +0000
committerMax Horn2002-09-20 00:12:58 +0000
commite0f11edf45361eb79ee281254602edc1748007e0 (patch)
treedf4e9a1cac5237e44ab9101baa9dcbe53e6009e7 /common
parentfcfc72296ccf751d4900d05129cbefcc0823550b (diff)
downloadscummvm-rg350-e0f11edf45361eb79ee281254602edc1748007e0.tar.gz
scummvm-rg350-e0f11edf45361eb79ee281254602edc1748007e0.tar.bz2
scummvm-rg350-e0f11edf45361eb79ee281254602edc1748007e0.zip
quit should not exit(1) but rather exit(0) (mabye we should add a paramter 'bool success' to it that flags whether this is a normal exit or one with an error?)
svn-id: r4979
Diffstat (limited to 'common')
-rw-r--r--common/main.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/common/main.cpp b/common/main.cpp
index 8295b99805..f4c319accc 100644
--- a/common/main.cpp
+++ b/common/main.cpp
@@ -96,6 +96,7 @@ static void do_memory_test(void) {
int main(int argc, char *argv[])
{
+ int result;
#ifdef __DC__
extern void dc_init_hardware();
dc_init_hardware();
@@ -120,28 +121,43 @@ int main(int argc, char *argv[])
#endif
#endif
+ // Read the config file
scummcfg = new Config(scummhome, "scummvm");
scummcfg->set("versioninfo", SCUMMVM_VERSION);
- if (detector.detectMain(argc, argv))
- return (-1);
+
+ // Parse the command line information
+ result = detector.detectMain(argc, argv);
+ // Create the system object
OSystem *system = detector.createSystem();
- {
- OSystem::Property prop;
-
- prop.caption = (char *)detector.getGameName();
- system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
+ // TODO - if detectMain() returns an error, fire up the launcher dialog
+ // TODO - implement the launcher dialog; also implement some sort of generic
+ // error dialog, to be used by the launcher if e.g. the game data can't
+ // be found.
+ if (result) {
+ system->quit();
+ return (-1);
}
+ // Set the window caption (for OSystems that support it)
+ OSystem::Property prop;
+ prop.caption = (char *)detector.getGameName();
+ system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
+
// Create the game engine
Engine *engine = Engine::createFromDetector(&detector, system);
// Run the game engine
engine->go();
+ // Free up memory
+ delete engine;
delete scummcfg;
+ // ...and quit (the return 0 should never be reached)
+ system->quit();
+
return 0;
}