[Scummvm-cvs-logs] CVS: scummvm/base main.cpp,1.55,1.56

Max Horn fingolfin at users.sourceforge.net
Mon Nov 22 15:26:05 CET 2004


Update of /cvsroot/scummvm/scummvm/base
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24444/base

Modified Files:
	main.cpp 
Log Message:
Added OSystem::beginGFXTransaction / endGFXTransaction (not yet implemented, though :-)

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- main.cpp	20 Nov 2004 01:55:53 -0000	1.55
+++ main.cpp	22 Nov 2004 23:25:08 -0000	1.56
@@ -185,15 +185,19 @@
 #endif
 
 static int launcherDialog(GameDetector &detector, OSystem *system) {
-	// Set the user specified graphics mode (if any).
-	system->setGraphicsMode(ConfMan.get("gfx_mode").c_str());
 
-	// FIXME - we need to call initSize() 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 
-	// implementations reentrant (it is so now for the SDL backend). Thus we need
-	// to fix all backends to support it, if they don't already.
-	system->initSize(320, 200);
+	system->beginGFXTransaction();
+		// Set the user specified graphics mode (if any).
+		system->setGraphicsMode(ConfMan.get("gfx_mode").c_str());
+	
+		// FIXME - we need to call initSize() 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 
+		// implementations reentrant (it is so now for the SDL backend). Thus we need
+		// to fix all backends to support it, if they don't already.
+		system->initSize(320, 200);
+	system->endGFXTransaction();
+
 	
 	// Clear the main screen
 	system->clearScreen();
@@ -252,21 +256,37 @@
 		!scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "normal") ||
 		!scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "default");
 
-	// See if the game should default to 1x scaler
-	if (useDefaultGraphicsMode && (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) {
-		system->setGraphicsMode(GFX_NORMAL);
-	} else {
-		// Override global scaler with any game-specific define
-		if (ConfMan.hasKey("gfx_mode")) {
-			system->setGraphicsMode(ConfMan.get("gfx_mode").c_str());
-		}
-	}
+	system->beginGFXTransaction();
 
-	// (De)activate aspect-ratio correction as determined by the config settings
-	system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio"));
+		// See if the game should default to 1x scaler
+		if (useDefaultGraphicsMode && (detector._game.features & GF_DEFAULT_TO_1X_SCALER)) {
+			system->setGraphicsMode(GFX_NORMAL);
+		} else {
+			// Override global scaler with any game-specific define
+			if (ConfMan.hasKey("gfx_mode")) {
+				system->setGraphicsMode(ConfMan.get("gfx_mode").c_str());
+			}
+		}
 	
-	// (De)activate fullscreen mode as determined by the config settings 
-	system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
+		// (De)activate aspect-ratio correction as determined by the config settings
+		system->setFeatureState(OSystem::kFeatureAspectRatioCorrection, ConfMan.getBool("aspect_ratio"));
+		
+		// (De)activate fullscreen mode as determined by the config settings 
+		system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
+		
+		// TODO / FIXME: this transaction sould also contain the initial call to initSize
+		// which all engines perform. However, as long as that is contained within 
+		// the "engine->go()", this is not possible.
+		// Multiple solutions come to mind, including these:
+		// * Don't let the engine invoke initSize(); rather, add a method to them which we can
+		//   use to query their desired res, then we set it for them
+		// * Move the setGraphicsMode/setFeatureState calls here to the Engine class, which the
+		//   engines invoke (in other words: move this transaction into the engines
+		// * Add an explicit Engine::init() method, which all engines have to implement,
+		//   and into which they should put their call to initSize. Then, make sure this transaction
+		//   surrounds the call to engine->init();
+
+	system->endGFXTransaction();
 
 	// Create the game engine
 	Engine *engine = detector.createEngine(system);





More information about the Scummvm-git-logs mailing list