From e9bc5ba280d4b893feb8b704423a9a757f0141bf Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 2 Apr 2006 14:31:23 +0000 Subject: Backends now are also responsile for deiniting properly. In particular, moved the call to quit() from scummvm_main to the various backend main routines (porters may want to replace it by something different) svn-id: r21559 --- backends/dc/dcmain.cpp | 2 +- backends/gp32/gp32_main.cpp | 5 ++++- backends/maemo/main.cpp | 6 ++++-- backends/morphos/morphos_start.cpp | 5 ++++- backends/null/null.cpp | 7 +++++-- backends/ps2/systemps2.cpp | 4 +++- backends/psp/psp_main.cpp | 6 ++++-- backends/sdl/sdl.cpp | 6 ++++-- backends/wince/wince-sdl.cpp | 9 +++++++-- backends/x11/x11.cpp | 4 +++- 10 files changed, 39 insertions(+), 15 deletions(-) (limited to 'backends') 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) { -- cgit v1.2.3