diff options
-rw-r--r-- | backends/sdl/sdl-common.cpp | 2 | ||||
-rw-r--r-- | backends/wince/pocketpc.cpp | 4 | ||||
-rw-r--r-- | backends/x11/x11.cpp | 2 | ||||
-rw-r--r-- | common/main.cpp | 30 |
4 files changed, 27 insertions, 11 deletions
diff --git a/backends/sdl/sdl-common.cpp b/backends/sdl/sdl-common.cpp index 3c1fd3a151..b27b5ee5c1 100644 --- a/backends/sdl/sdl-common.cpp +++ b/backends/sdl/sdl-common.cpp @@ -681,7 +681,7 @@ void OSystem_SDL_Common::quit() { SDL_CDClose(cdrom); } unload_gfx_mode(); - exit(1); + exit(0); } void OSystem_SDL_Common::draw_mouse() { diff --git a/backends/wince/pocketpc.cpp b/backends/wince/pocketpc.cpp index 6adb61b0b3..4d4406a3a6 100644 --- a/backends/wince/pocketpc.cpp +++ b/backends/wince/pocketpc.cpp @@ -1499,8 +1499,8 @@ uint32 OSystem_WINCE3::property(int param, Property *value) { } void OSystem_WINCE3::quit() { - unload_gfx_mode(); - exit(1); + unload_gfx_mode(); + exit(0); } /* CDRom Audio */ diff --git a/backends/x11/x11.cpp b/backends/x11/x11.cpp index 3a2e362a1d..bf7b01e278 100644 --- a/backends/x11/x11.cpp +++ b/backends/x11/x11.cpp @@ -649,7 +649,7 @@ bool OSystem_X11::show_mouse(bool visible) void OSystem_X11::quit() { - exit(1); + exit(0); } void OSystem_X11::draw_mouse() 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; } |