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
This commit is contained in:
Max Horn 2006-04-02 14:31:23 +00:00
parent 9217472f0e
commit e9bc5ba280
11 changed files with 40 additions and 19 deletions

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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()

View file

@ -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) {

View file

@ -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;
}

View file

@ -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

View file

@ -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;
}
// ********************************************************************************************

View file

@ -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) {

View file

@ -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;
}