[Scummvm-cvs-logs] CVS: scummvm/base engine.cpp,1.25,1.26 engine.h,1.15,1.16 main.cpp,1.57,1.58

Eugene Sandulenko sev at users.sourceforge.net
Tue Nov 23 16:16:01 CET 2004


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

Modified Files:
	engine.cpp engine.h main.cpp 
Log Message:
Fix a`ll engines. They work, though current fix is just temporary.
There are plans to add some brains to GameDetector class, which will let us
avoid passing detector to init() method.


Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/engine.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- engine.cpp	20 Nov 2004 23:49:09 -0000	1.25
+++ engine.cpp	24 Nov 2004 00:13:58 -0000	1.26
@@ -23,10 +23,10 @@
 #include <malloc.h>
 #endif
 #include "base/engine.h"
-#include "base/gameDetector.h"
 #include "common/config-manager.h"
 #include "common/file.h"
 #include "common/timer.h"
+#include "common/scaler.h"	// For GFX_NORMAL
 #include "sound/mixer.h"
 
 /* FIXME - BIG HACK for MidiEmu */
@@ -58,6 +58,29 @@
 	g_engine = NULL;
 }
 
+void Engine::initCommonGFX(GameDetector &detector) {
+	const bool useDefaultGraphicsMode =
+		!ConfMan.hasKey("gfx_mode", detector._targetName) ||
+		!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());
+		}
+	}
+	
+	// (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"));
+}
+
 const char *Engine::getSavePath() const {
 
 #if defined(__PALM_OS__)

Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/engine.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- engine.h	23 Nov 2004 00:03:19 -0000	1.15
+++ engine.h	24 Nov 2004 00:13:58 -0000	1.16
@@ -24,6 +24,7 @@
 #include "common/scummsys.h"
 #include "common/str.h"
 #include "common/system.h"
+#include "base/gameDetector.h"
 
 class SoundMixer;
 class Timer;
@@ -46,7 +47,7 @@
 	 * Init the engine.
 	 * @return 0 for success, else an error code.
 	 */
-	virtual int init() = 0;
+	virtual int init(GameDetector &detector) = 0;
 
 	/**
 	 * Start the main engine loop.
@@ -64,6 +65,8 @@
 
 	/** Specific for each engine: prepare error string. */
 	virtual void errorString(const char *buf_input, char *buf_output) = 0;
+
+	void initCommonGFX(GameDetector &detector);
 };
 
 extern Engine *g_engine;

Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/base/main.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- main.cpp	23 Nov 2004 00:03:19 -0000	1.57
+++ main.cpp	24 Nov 2004 00:13:58 -0000	1.58
@@ -35,7 +35,6 @@
 #include "base/version.h"
 #include "common/config-manager.h"
 #include "common/file.h"
-#include "common/scaler.h"	// For GFX_NORMAL
 #include "common/timer.h"
 #include "gui/newgui.h"
 #include "gui/launcher.h"
@@ -247,11 +246,6 @@
 		system->setWindowCaption(caption.c_str());
 	}
 	
-	const bool useDefaultGraphicsMode =
-		!ConfMan.hasKey("gfx_mode", detector._targetName) ||
-		!scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "normal") ||
-		!scumm_stricmp(ConfMan.get("gfx_mode", detector._targetName).c_str(), "default");
-
 	// Create the game engine
 	Engine *engine = detector.createEngine(system);
 	assert(engine);
@@ -265,29 +259,8 @@
 
 	int result;
 
-	// Start GFX transaction
-	system->beginGFXTransaction();
-
-		// 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 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"));
-		
-		// Init the engine (this might change the screen parameters
-		result = engine->init();
-
-	system->endGFXTransaction();
+	// Init the engine (this might change the screen parameters
+	result = engine->init(detector);
 
 	// Run the game engine if the initialization was successful.
 	if (result == 0) {





More information about the Scummvm-git-logs mailing list