diff options
-rw-r--r-- | backends/dc/dcmain.cpp | 2 | ||||
-rw-r--r-- | backends/gp32/gp32_main.cpp | 5 | ||||
-rw-r--r-- | backends/maemo/main.cpp | 6 | ||||
-rw-r--r-- | backends/morphos/morphos_start.cpp | 5 | ||||
-rw-r--r-- | backends/null/null.cpp | 7 | ||||
-rw-r--r-- | backends/ps2/systemps2.cpp | 4 | ||||
-rw-r--r-- | backends/psp/psp_main.cpp | 6 | ||||
-rw-r--r-- | backends/sdl/sdl.cpp | 6 | ||||
-rw-r--r-- | backends/wince/wince-sdl.cpp | 9 | ||||
-rw-r--r-- | backends/x11/x11.cpp | 4 | ||||
-rw-r--r-- | base/main.cpp | 5 |
11 files changed, 40 insertions, 19 deletions
diff --git a/backends/dc/dcmain.cpp b/backends/dc/dcmain.cpp index 5e59f80813..43962487ed 100644 --- a/backends/dc/dcmain.cpp +++ b/backends/dc/dcmain.cpp @@ -206,7 +206,7 @@ int main() g_system = new OSystem_Dreamcast(); assert(g_system); - scummvm_main(argc, argv); + int res = scummvm_main(argc, argv); exit(0); } diff --git a/backends/gp32/gp32_main.cpp b/backends/gp32/gp32_main.cpp index 3fb32aa9b2..ebada917fd 100644 --- a/backends/gp32/gp32_main.cpp +++ b/backends/gp32/gp32_main.cpp @@ -74,5 +74,8 @@ void GpMain(void *arg) { g_system = new OSystem_GP32_create(); assert(g_system); - scummvm_main(1, NULL); + // Invoke the actual ScummVM main entry point: + int res = scummvm_main(1, NULL); + g_system->quit(); // TODO: Consider removing / replacing this! + return res; } diff --git a/backends/maemo/main.cpp b/backends/maemo/main.cpp index 3d155cc625..968641c0cc 100644 --- a/backends/maemo/main.cpp +++ b/backends/maemo/main.cpp @@ -68,12 +68,14 @@ int main(int argc, char *argv[]) { g_system = new OSystem_SDL(); assert(g_system); - scummvm_main(argc, argv); + // Invoke the actual ScummVM main entry point: + int res = scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! /* Deinitialize OSSO */ //osso_deinitialize(osso_context); set_doubling(0); - return 0; + return res; } diff --git a/backends/morphos/morphos_start.cpp b/backends/morphos/morphos_start.cpp index 6a8299d2cd..82c57be7bc 100644 --- a/backends/morphos/morphos_start.cpp +++ b/backends/morphos/morphos_start.cpp @@ -437,6 +437,9 @@ int main() g_system = OSystem_MorphOS_create(); assert(g_system); - return scummvm_main(argc, argv); + // Invoke the actual ScummVM main entry point: + int res = scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! + return res; } diff --git a/backends/null/null.cpp b/backends/null/null.cpp index 03939896b1..e4d7a7a2b1 100644 --- a/backends/null/null.cpp +++ b/backends/null/null.cpp @@ -107,10 +107,13 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { }; int main(int argc, char *argv[]) { - // Invoke the actual ScummVM main entry point: g_system = OSystem_NULL_create(); assert(g_system); - return scummvm_main(argc, argv); + + // Invoke the actual ScummVM main entry point: + int res = scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! + return res; } OSystem_NULL::OSystem_NULL() diff --git a/backends/ps2/systemps2.cpp b/backends/ps2/systemps2.cpp index f277648c27..2279a4bed6 100644 --- a/backends/ps2/systemps2.cpp +++ b/backends/ps2/systemps2.cpp @@ -133,7 +133,9 @@ extern "C" int main(int argc, char *argv[]) { assert(g_system); sioprintf("init done. starting ScummVM."); - return scummvm_main(argc, argv); + int res = scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! + return res; } s32 timerInterruptHandler(s32 cause) { diff --git a/backends/psp/psp_main.cpp b/backends/psp/psp_main.cpp index cbdaad68e0..f06ac5f1d5 100644 --- a/backends/psp/psp_main.cpp +++ b/backends/psp/psp_main.cpp @@ -147,10 +147,12 @@ int main(void) g_system = OSystem_PSP_create(); assert(g_system); - scummvm_main(argc, argv); + int res = scummvm_main(argc, argv); + + g_system->quit(); // TODO: Consider removing / replacing this! sceKernelSleepThread(); - return 0; + return res; } diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp index 2d567ea769..ed3371d4fb 100644 --- a/backends/sdl/sdl.cpp +++ b/backends/sdl/sdl.cpp @@ -91,12 +91,14 @@ int main(int argc, char *argv[]) { #endif // defined(__SYMBIAN32__) - + // Create our OSystem instance g_system = new OSystem_SDL(); assert(g_system); // Invoke the actual ScummVM main entry point: - return scummvm_main(argc, argv); + int res = scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! + return res; } #endif diff --git a/backends/wince/wince-sdl.cpp b/backends/wince/wince-sdl.cpp index e08cc965ff..23821a5ae4 100644 --- a/backends/wince/wince-sdl.cpp +++ b/backends/wince/wince-sdl.cpp @@ -146,15 +146,20 @@ int SDL_main(int argc, char **argv) { stderr_file = fopen("\\scummvm_stderr.txt", "w"); GUI::Actions::init(_gameDetector); + int rest = 0; + __try { g_system = OSystem_WINCE3_create(); assert(g_system); - return scummvm_main(_gameDetector, argc, argv); + + // Invoke the actual ScummVM main entry point: + res = scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! } __except (handleException(GetExceptionInformation())) { } - return 0; + return res; } // ******************************************************************************************** diff --git a/backends/x11/x11.cpp b/backends/x11/x11.cpp index 778028b031..1ceb20703b 100644 --- a/backends/x11/x11.cpp +++ b/backends/x11/x11.cpp @@ -63,7 +63,9 @@ int main(int argc, char *argv[]) { assert(g_system); // Invoke the actual ScummVM main entry point: - return scummvm_main(argc, argv); + int res = scummvm_main(argc, argv); + g_system->quit(); // TODO: Consider removing / replacing this! + return res; } OSystem *OSystem_X11::create(int gfx_mode, bool full_screen) { diff --git a/base/main.cpp b/base/main.cpp index 4baa6a6ca4..f53f0895cf 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -398,11 +398,8 @@ extern "C" int scummvm_main(int argc, char *argv[]) { running = launcherDialog(detector, system); } - // ...and quit (the return 0 should never be reached) + // Deinit the timer delete Common::g_timer; - system.quit(); - - error("If you are seeing this, your OSystem backend is not working properly"); return 0; } |