[Scummvm-cvs-logs] CVS: scummvm/base main.cpp,1.29,1.30
James Brown
ender at users.sourceforge.net
Thu Jan 15 06:03:03 CET 2004
Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1:/tmp/cvs-serv18621/base
Modified Files:
main.cpp
Log Message:
Fiddling.
Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- main.cpp 6 Jan 2004 12:45:27 -0000 1.29
+++ main.cpp 15 Jan 2004 14:01:57 -0000 1.30
@@ -148,7 +148,7 @@
#ifndef _WIN32_WCE
-static void launcherDialog(GameDetector &detector, OSystem *system) {
+static int launcherDialog(GameDetector &detector, OSystem *system) {
// FIXME - we need to call init_size() here so that we can display for example
// the launcher dialog. But the Engine object will also call it again (possibly
// with a different widht/height!9 However, this method is not for all OSystem
@@ -184,9 +184,55 @@
system->set_palette(dummy_palette, 0, 16);
GUI::LauncherDialog dlg(detector);
- dlg.runModal();
+ return dlg.runModal();
}
+static void runGame(GameDetector &detector, OSystem *system) {
+ OSystem::Property prop;
+
+ // Set the window caption to the game name
+ Common::String caption(ConfMan.get("description", detector._targetName));
+
+ if (caption.isEmpty() && detector._game.description)
+ caption = detector._game.description;
+ if (caption.isEmpty())
+ caption = detector._targetName;
+ if (!caption.isEmpty()) {
+ prop.caption = caption.c_str();
+ system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
+ }
+
+ // See if the game should default to 1x scaler
+ if (!ConfMan.hasKey("gfx_mode", detector._targetName) &&
+ (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) {
+ prop.gfx_mode = GFX_NORMAL;
+ system->property(OSystem::PROP_SET_GFX_MODE, &prop);
+ } else {
+ // Override global scaler with any game-specific define
+ if (ConfMan.hasKey("gfx_mode")) {
+ prop.gfx_mode = detector.parseGraphicsMode(ConfMan.get("gfx_mode"));
+ system->property(OSystem::PROP_SET_GFX_MODE, &prop);
+ }
+ }
+
+ // (De)activate fullscreen mode as determined by the config settings
+ if (ConfMan.getBool("fullscreen") != (system->property(OSystem::PROP_GET_FULLSCREEN, 0) != 0))
+ system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0);
+
+ // Create the game engine
+ Engine *engine = detector.createEngine(system);
+ assert(engine);
+
+ // Run the game engine
+ engine->go();
+
+ // Stop all sound processing now (this prevents some race conditions later on)
+ system->clear_sound_proc();
+
+ // Free up memory
+ delete engine;
+};
+
int main(int argc, char *argv[]) {
OSystem::Property prop;
@@ -254,49 +300,17 @@
if (detector._targetName.isEmpty())
launcherDialog(detector, system);
- // Verify the given game name is a valid supported game
- if (detector.detectMain()) {
-
- // Set the window caption to the game name
- Common::String caption(ConfMan.get("description", detector._targetName));
- if (caption.isEmpty() && detector._game.description)
- caption = detector._game.description;
- if (caption.isEmpty())
- caption = detector._targetName;
- if (!caption.isEmpty()) {
- prop.caption = caption.c_str();
- system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
- }
+ // Uncomment the while loop, and the launcherDialog call, to allow
+ // returning to the Launcher after an engine quit. Disabled currently
+ // as it probably leaks memory like a sieve.
+ //while(1) {
+ // Verify the given game name is a valid supported game
+ if (detector.detectMain()) {
+ runGame(detector, system);
- // See if the game should default to 1x scaler
- if (!ConfMan.hasKey("gfx_mode", detector._targetName) &&
- (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) {
- prop.gfx_mode = GFX_NORMAL;
- system->property(OSystem::PROP_SET_GFX_MODE, &prop);
- } else
- // Override global scaler with any game-specific define
- if (ConfMan.hasKey("gfx_mode")) {
- prop.gfx_mode = detector.parseGraphicsMode(ConfMan.get("gfx_mode"));
- system->property(OSystem::PROP_SET_GFX_MODE, &prop);
+ // launcherDialog(detector, system);
}
-
- // (De)activate fullscreen mode as determined by the config settings
- if (ConfMan.getBool("fullscreen") != (system->property(OSystem::PROP_GET_FULLSCREEN, 0) != 0))
- system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0);
-
- // Create the game engine
- Engine *engine = detector.createEngine(system);
- assert(engine);
-
- // Run the game engine
- engine->go();
-
- // Stop all sound processing now (this prevents some race conditions later on)
- system->clear_sound_proc();
-
- // Free up memory
- delete engine;
- }
+ //}
// ...and quit (the return 0 should never be reached)
system->quit();
More information about the Scummvm-git-logs
mailing list