[Scummvm-cvs-logs] CVS: scummvm/backends/wince wince-sdl.h,1.8,1.9 wince-sdl.cpp,1.13,1.14 CELauncherDialog.cpp,1.5,1.6 CEDevice.cpp,1.4,1.5

Nicolas Bacca arisme at users.sourceforge.net
Sun May 30 06:26:01 CEST 2004


Update of /cvsroot/scummvm/scummvm/backends/wince
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28269

Modified Files:
	wince-sdl.h wince-sdl.cpp CELauncherDialog.cpp CEDevice.cpp 
Log Message:
Ozone tweaks (add virtual screen and infos) / Fix initial keyboard bug (Monkey 1 and 2)

Index: wince-sdl.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- wince-sdl.h	9 May 2004 15:02:10 -0000	1.8
+++ wince-sdl.h	30 May 2004 13:24:51 -0000	1.9
@@ -80,6 +80,10 @@
 	void switch_zone();
 #endif
 
+	static int getScreenWidth();
+	static int getScreenHeight();
+	static void initScreenInfos();
+	static bool isOzone();
 
 protected:
 	void load_gfx_mode();
@@ -88,7 +92,7 @@
 	bool save_screenshot(const char *filename);
 
 	
-	//const GraphicsMode *getSupportedGraphicsModes() const;	
+	const GraphicsMode *getSupportedGraphicsModes() const;	
 	bool setGraphicsMode(int mode);
 	//int getGraphicsMode() const;	
 	int getDefaultGraphicsMode() const;
@@ -154,6 +158,11 @@
 	int _scaleFactorXd;
 	int _scaleFactorYm;
 	int _scaleFactorYd;
+	bool _scalersChanged;
+
+	static int _platformScreenWidth;
+	static int _platformScreenHeight;
+	static bool _isOzone;
 };
 
 #endif
\ No newline at end of file

Index: wince-sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- wince-sdl.cpp	9 May 2004 15:22:04 -0000	1.13
+++ wince-sdl.cpp	30 May 2004 13:24:51 -0000	1.14
@@ -44,6 +44,9 @@
 
 #include "sound/fmopl.h"
 
+#include "ozone.h"
+#include "CEException.h"
+
 #ifdef USE_VORBIS
 #include <vorbis/vorbisfile.h>
 #endif
@@ -72,13 +75,49 @@
 bool OSystem_WINCE3::_soundMaster = true;
 OSystem::SoundProc OSystem_WINCE3::_originalSoundProc = NULL;
 
+// Graphics mode consts
+
+// Low end devices 240x320
+
+static const OSystem::GraphicsMode s_supportedGraphicsModesLow[] = {
+	{"1x", "Normal (no scaling)", GFX_NORMAL},
+	{0, 0, 0}
+};
+
+// High end device 480x640
+
+static const OSystem::GraphicsMode s_supportedGraphicsModesHigh[] = {
+	{"1x", "Normal (no scaling)", GFX_NORMAL},
+	{"2x", "2x", GFX_DOUBLESIZE},
+#ifndef _MSC_VER // EVC breaks template functions, and I'm tired of fixing them :)
+	{"2xsai", "2xSAI", GFX_2XSAI},
+	{"super2xsai", "Super2xSAI", GFX_SUPER2XSAI},
+	{"supereagle", "SuperEagle", GFX_SUPEREAGLE},
+#endif
+	{"advmame2x", "AdvMAME2x", GFX_ADVMAME2X},
+#ifndef _MSC_VER
+	{"hq2x", "HQ2x", GFX_HQ2X},
+	{"tv2x", "TV2x", GFX_TV2X},
+#endif
+	{"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
+	{0, 0, 0}
+};
+
+
 // ********************************************************************************************
 
 // MAIN
 
 extern "C" int scummvm_main(GameDetector &gameDetector, int argc, char **argv);
 
+void handleException(EXCEPTION_POINTERS *exceptionPointers) {
+	CEException::writeException(TEXT("\\scummvmCrash"), exceptionPointers);
+	drawError("Unrecoverable exception occurred - see crash dump in latest \\scummvmCrash file");
+	exit(1);
+}
+
 int SDL_main(int argc, char **argv) {
+	OSystem_WINCE3::initScreenInfos();
 	/* Sanity check */
 #ifndef WIN32_PLATFORM_WFSP
 	if (CEDevice::hasSmartphoneResolution()) {
@@ -90,7 +129,11 @@
 	stdout_file = fopen("\\scummvm_stdout.txt", "w");
 	stderr_file = fopen("\\scummvm_stderr.txt", "w");
 	CEActions::init(_gameDetector);
-	return scummvm_main(_gameDetector, argc, argv);
+	__try {
+		return scummvm_main(_gameDetector, argc, argv);
+	}
+	__except (handleException(GetExceptionInformation())) {
+	}
 }    
    
 // ********************************************************************************************
@@ -120,6 +163,34 @@
 
 // ********************************************************************************************
 
+int OSystem_WINCE3::getScreenWidth() {
+	return _platformScreenWidth;
+}
+
+int OSystem_WINCE3::getScreenHeight() {
+	return _platformScreenHeight;
+}
+
+void OSystem_WINCE3::initScreenInfos() {
+	// Check if we're running Ozone
+	int result;
+	RawFrameBufferInfo frameBufferInfo;
+	HDC hdc = GetDC(NULL);
+	result = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *)&frameBufferInfo);
+	ReleaseDC(NULL, hdc);
+	_isOzone = (result > 0);
+	// And obtain the real screen size
+	_platformScreenWidth = (result > 0 ? frameBufferInfo.cxPixels : GetSystemMetrics(SM_CXSCREEN));
+	_platformScreenHeight = (result > 0 ? frameBufferInfo.cyPixels : GetSystemMetrics(SM_CYSCREEN));
+}
+
+bool OSystem_WINCE3::isOzone() {
+	return _isOzone;
+}
+
+// ********************************************************************************************
+
+
 OSystem *OSystem_WINCE3_create() {
 	return new OSystem_WINCE3();
 }
@@ -127,7 +198,8 @@
 OSystem_WINCE3::OSystem_WINCE3() : OSystem_SDL(), 
 	_orientationLandscape(false), _newOrientation(false), _panelInitialized(false),
 	_panelVisible(false), _panelStateForced(false), _forceHideMouse(false),
-	_freeLook(false), _toolbarHighDrawn(false), _zoomUp(false), _zoomDown(false)
+	_freeLook(false), _toolbarHighDrawn(false), _zoomUp(false), _zoomDown(false),
+	_scalersChanged(false)
 {
 	create_toolbar();
 }
@@ -339,6 +411,12 @@
 	return false;
 }
 
+const OSystem::GraphicsMode *OSystem_WINCE3::getSupportedGraphicsModes() const {
+	if (CEDevice::hasWideResolution())
+		return s_supportedGraphicsModesHigh;
+	else
+		return s_supportedGraphicsModesLow;
+}
 
 bool OSystem_WINCE3::hasFeature(Feature f) {
 return
@@ -488,7 +566,7 @@
 		// sound
 		panel->add(NAME_ITEM_SOUND, new ItemSwitch(ITEM_SOUND_OFF, ITEM_SOUND_ON, &_soundMaster)); 
 		// portrait/landscape - screen dependant
-		if (_screenWidth <= 320 && !CEDevice::hasDesktopResolution()) {
+		if (_screenWidth <= 320 && (isOzone() || !CEDevice::hasDesktopResolution())) {
 			_newOrientation = _orientationLandscape = (ConfMan.hasKey("landscape") ? ConfMan.getBool("landscape") : false);
 			panel->add(NAME_ITEM_ORIENTATION, new ItemSwitch(ITEM_VIEW_LANDSCAPE, ITEM_VIEW_PORTRAIT, &_newOrientation));
 		}
@@ -501,12 +579,12 @@
 			_toolbarHandler.setActive(NAME_PANEL_KEYBOARD);
 		}
 
-		if (ConfMan.hasKey("landscape") && ConfMan.getBool("landscape")) {
+		if (_mode == GFX_NORMAL && ConfMan.hasKey("landscape") && ConfMan.getBool("landscape")) {
 			setGraphicsMode(GFX_NORMAL);
 			hotswap_gfx_mode();
 		}
 	}
-
+ 
 	get_sample_rate();
 }
 
@@ -519,13 +597,22 @@
 	else
 		_toolbarHandler.setOffset(400);	
 
-	OSystem_SDL::initSize(w, h);	
+	if (w != _screenWidth || h != _screenHeight)
+		_scalersChanged = false;
 
-	update_game_settings();
+	OSystem_SDL::initSize(w, h);
+	
+	if (_scalersChanged) {
+		unload_gfx_mode();
+		load_gfx_mode();
+		_scalersChanged = false;
+	}
+
+	update_game_settings(); 
 }
 
 int OSystem_WINCE3::getDefaultGraphicsMode() const {
-    return GFX_NORMAL;
+    return GFX_NORMAL; 
 }
 
 bool OSystem_WINCE3::update_scalers() {
@@ -539,7 +626,7 @@
 			_scaler_proc = PocketPCPortrait;
 			_mode_flags = 0;
 		}
-		if (_screenWidth == 640) {
+		if (_screenWidth == 640 && !(isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
 			_scaleFactorXm = 1;
 			_scaleFactorXd = 2;
 			_scaleFactorYm = 1;
@@ -547,6 +634,14 @@
 			_scaler_proc = PocketPCHalf;
 			_mode_flags = 0;
 		}
+		if (_screenWidth == 640 && (isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
+			_scaleFactorXm = 1;
+			_scaleFactorXd = 1;
+			_scaleFactorYm = 1;
+			_scaleFactorYd = 1;
+			_scaler_proc = Normal1x;
+			_mode_flags = 0;
+		}
 
 		return true;
 	}
@@ -570,6 +665,10 @@
 
 bool OSystem_WINCE3::setGraphicsMode(int mode) {
 	Common::StackLock lock(_graphicsMutex);
+	int oldScaleFactorXm = _scaleFactorXm;
+	int oldScaleFactorXd = _scaleFactorXd;
+	int oldScaleFactorYm = _scaleFactorYm;
+	int oldScaleFactorYd = _scaleFactorYd;
 
 	_scaleFactorXm = -1;
 	_scaleFactorXd = -1;
@@ -580,17 +679,19 @@
 	
 	update_scalers();
 	
-	if (CEDevice::hasPocketPCResolution() && _orientationLandscape)
+	if (CEDevice::hasPocketPCResolution() && !CEDevice::hasWideResolution() && _orientationLandscape)
 		_mode = GFX_NORMAL;
+	else
+		_mode = mode;
 
-	if (_scaleFactorXm < 0) {
+	if (_scaleFactorXm < 0) { 
 		/* Standard scalers, from the SDL backend */
 		switch(_mode) {    
 		case GFX_NORMAL:     
-			_scaleFactor = 1;
+			_scaleFactor = 1; 
 			_scaler_proc = Normal1x;
 			break;
-		case GFX_DOUBLESIZE: 
+		case GFX_DOUBLESIZE:  
 			_scaleFactor = 2;
 			_scaler_proc = Normal2x;
 			break;
@@ -641,10 +742,10 @@
 	}
 
 	// Check if the scaler can be accepted, if not get back to normal scaler
-	if (_scaleFactor && ((_scaleFactor * _screenWidth > GetSystemMetrics(SM_CXSCREEN) &&
-						  _scaleFactor * _screenWidth > GetSystemMetrics(SM_CYSCREEN))
-					 || (_scaleFactor * _screenHeight > GetSystemMetrics(SM_CXSCREEN) &&
-						_scaleFactor * _screenHeight > GetSystemMetrics(SM_CYSCREEN)))) {
+	if (_scaleFactor && ((_scaleFactor * _screenWidth > getScreenWidth() &&
+						  _scaleFactor * _screenWidth > getScreenHeight())
+					 || (_scaleFactor * _screenHeight > getScreenWidth() &&
+						_scaleFactor * _screenHeight > getScreenHeight()))) {
 				_scaleFactor = 1;
 				_scaler_proc = Normal1x;
 	}
@@ -659,6 +760,15 @@
 
 	_forceFull = true;
 
+	if (oldScaleFactorXm != _scaleFactorXm ||
+		oldScaleFactorXd != _scaleFactorXd ||
+		oldScaleFactorYm != _scaleFactorYm ||
+		oldScaleFactorYd != _scaleFactorYd) {
+		_scalersChanged = true;
+	}
+	else
+		_scalersChanged = false;
+
 	return true;
 
 }
@@ -690,11 +800,12 @@
 	displayWidth = _screenWidth * _scaleFactorXm / _scaleFactorXd;
 	displayHeight = _screenHeight * _scaleFactorYm / _scaleFactorYd;
 
+	// FIXME
 	if (!(displayWidth > GetSystemMetrics(SM_CXSCREEN))) { // no rotation
 		displayWidth = GetSystemMetrics(SM_CXSCREEN);
-		displayHeight = GetSystemMetrics(SM_CYSCREEN);
+		displayHeight = GetSystemMetrics(SM_CYSCREEN); 
 	}
-
+	
 	_hwscreen = SDL_SetVideoMode(displayWidth, displayHeight, 16, SDL_FULLSCREEN | SDL_SWSURFACE);
 	if (_hwscreen == NULL) {
 		// DON'T use error(), as this tries to bring up the debug
@@ -837,7 +948,7 @@
 void OSystem_WINCE3::update_keyboard() {
 
 	// Update the forced keyboard for Monkey Island copy protection
-	if (_monkeyKeyboard && Scumm::g_scumm && Scumm::g_scumm->VAR(Scumm::g_scumm->VAR_ROOM) != 108 &&
+	if (_monkeyKeyboard && Scumm::g_scumm->VAR_ROOM != 0xff && Scumm::g_scumm && Scumm::g_scumm->VAR(Scumm::g_scumm->VAR_ROOM) != 108 &&
 		Scumm::g_scumm->VAR(Scumm::g_scumm->VAR_ROOM) != 90) {
 			// Switch back to the normal panel now that the keyboard is not used anymore
 			_monkeyKeyboard = false;
@@ -1013,7 +1124,7 @@
 				Normal2x((byte*)_toolbarLow->pixels, _toolbarLow->pitch, (byte*)_toolbarHigh->pixels, _toolbarHigh->pitch, toolbar_rect[0].w, toolbar_rect[0].h);
 				SDL_UnlockSurface(_toolbarHigh);
 				SDL_UnlockSurface(_toolbarLow);
-				_toolbarHighDrawn = true;
+				_toolbarHighDrawn = true; 
 			}
 			else
 				_toolbarHighDrawn = false;
@@ -1300,3 +1411,7 @@
 	}
 	OSystem_SDL::quit();
 }
+
+int OSystem_WINCE3::_platformScreenWidth;
+int OSystem_WINCE3::_platformScreenHeight;
+bool OSystem_WINCE3::_isOzone;

Index: CELauncherDialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CELauncherDialog.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- CELauncherDialog.cpp	9 May 2004 14:48:59 -0000	1.5
+++ CELauncherDialog.cpp	30 May 2004 13:24:51 -0000	1.6
@@ -50,7 +50,7 @@
 		videoDriver += tempo;
 		new StaticTextWidget(this, 0, 10, _w, kLineHeight, videoDriver, kTextAlignCenter);
 		Common::String displayInfos("Display ");
-		sprintf(tempo, "%dx%d", GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
+		sprintf(tempo, "%dx%d (real %dx%d)", GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), OSystem_WINCE3::getScreenWidth(), OSystem_WINCE3::getScreenHeight());
 		displayInfos += tempo;
 		new StaticTextWidget(this, 0, 20, _w, kLineHeight, displayInfos, kTextAlignCenter);
 	}

Index: CEDevice.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEDevice.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CEDevice.cpp	9 May 2004 14:53:05 -0000	1.4
+++ CEDevice.cpp	30 May 2004 13:24:51 -0000	1.5
@@ -24,6 +24,8 @@
 
 #include <SDL.h>
 
+#include "wince-sdl.h"
+
 #define KEY_CALENDAR 0xc1
 #define KEY_CONTACTS 0xc2
 #define KEY_INBOX 0xc3
@@ -46,19 +48,23 @@
 
 
 bool CEDevice::hasPocketPCResolution() {
-	return (GetSystemMetrics(SM_CXSCREEN) < 320 && GetSystemMetrics(SM_CXSCREEN) >= 240);
+	if (OSystem_WINCE3::isOzone() && hasWideResolution())
+		return true;
+	return (OSystem_WINCE3::getScreenWidth() < 320 && OSystem_WINCE3::getScreenWidth() >= 240);
 }
 
 bool CEDevice::hasDesktopResolution() {
-	return (GetSystemMetrics(SM_CXSCREEN) >= 320);
+	if (OSystem_WINCE3::isOzone() && hasWideResolution())
+		return true;
+	return (OSystem_WINCE3::getScreenWidth() >= 320);
 }
 
 bool CEDevice::hasWideResolution() {
-	return (GetSystemMetrics(SM_CXSCREEN) >= 640 || GetSystemMetrics(SM_CYSCREEN) >= 640);
+	return (OSystem_WINCE3::getScreenWidth() >= 640 || OSystem_WINCE3::getScreenHeight() >= 640);
 }
 
 bool CEDevice::hasSmartphoneResolution() {
-	return (GetSystemMetrics(SM_CXSCREEN) < 240);
+	return (OSystem_WINCE3::getScreenWidth() < 240);
 }
 
 Common::String CEDevice::getKeyName(unsigned int keyCode) {





More information about the Scummvm-git-logs mailing list