[Scummvm-cvs-logs] CVS: scummvm/backends/wince CEActions.cpp,1.3.2.3,1.3.2.4 CEActions.h,1.2,1.2.2.1 CEDevice.cpp,1.2.2.2,1.2.2.3 CEDevice.h,1.1.2.1,1.1.2.2 CEScaler.cpp,1.5,1.5.2.1 CEScaler.h,1.2,1.2.2.1 wince-sdl.cpp,1.4.2.9,1.4.2.10 wince-sdl.h,1.3,1.3.2.1

James Brown ender at users.sourceforge.net
Mon Mar 15 02:13:01 CET 2004


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

Modified Files:
      Tag: branch-0-6-0
	CEActions.cpp CEActions.h CEDevice.cpp CEDevice.h CEScaler.cpp 
	CEScaler.h wince-sdl.cpp wince-sdl.h 
Log Message:
Update WinCE backend and retag 0.6.0


Index: CEActions.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActions.cpp,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -d -r1.3.2.3 -r1.3.2.4
--- CEActions.cpp	2 Mar 2004 23:24:21 -0000	1.3.2.3
+++ CEActions.cpp	15 Mar 2004 10:02:59 -0000	1.3.2.4
@@ -41,7 +41,9 @@
 	"Sound",
 	"Right click",
 	"Cursor",
-	"Free look"
+	"Free look",
+	"Zoom up",
+	"Zoom down",
 };
 
 CEActions* CEActions::Instance() {		
@@ -53,30 +55,38 @@
 }
 
 int CEActions::size() {
-	return ACTION_LAST - 1;
+	return ACTION_LAST;
 }
 
-CEActions::CEActions(OSystem_WINCE3 *mainSystem, GameDetector &detector) :
-	_mainSystem(mainSystem), _mapping_active(false), _right_click_needed(false),
-	_hide_toolbar_needed(false) 
+CEActions::CEActions(GameDetector &detector) :
+	_detector(&detector), _mapping_active(false), _right_click_needed(false), 
+	_hide_toolbar_needed(false), _zoom_needed(false)
 {
 	int i;
-	bool is_simon = (strncmp(detector._targetName.c_str(), "simon", 5) == 0);
-	bool is_sword1 = (detector._targetName == "sword1");
-	bool is_sword2 = (strcmp(detector._targetName.c_str(), "sword2") == 0);
-	bool is_queen = (detector._targetName == "queen");
-	bool is_sky = (detector._targetName == "sky");
 
-	for (i=0; i<ACTION_LAST; i++)
+	for (i=0; i<ACTION_LAST; i++) {
 		_action_mapping[i] = 0;
+		_action_enabled[i] = false;
+	}
+}
 
+void CEActions::initInstance(OSystem_WINCE3 *mainSystem) {
+	bool is_simon = (strncmp(_detector->_targetName.c_str(), "simon", 5) == 0);
+	bool is_sword1 = (_detector->_targetName == "sword1");
+	bool is_sword2 = (strcmp(_detector->_targetName.c_str(), "sword2") == 0);
+	bool is_queen = (_detector->_targetName == "queen");
+	bool is_sky = (_detector->_targetName == "sky");
+	bool is_comi = (strncmp(_detector->_targetName.c_str(), "comi", 4) == 0);
+
+	_mainSystem = mainSystem;
+	
 	// See if a right click mapping could be needed
-	if (is_sword1 || is_sword2 || is_sky || is_queen || strncmp(detector._targetName.c_str(), "comi", 4) == 0 ||
-		detector._targetName == "samnmax")
+	if (is_sword1 || is_sword2 || is_sky || is_queen || is_comi ||
+		_detector->_targetName == "samnmax")
 		_right_click_needed = true;
 
 	// See if a "hide toolbar" mapping could be needed
-	if (is_sword1 || is_sword2 || strncmp(detector._targetName.c_str(), "comi", 4) == 0)
+	if (is_sword1 || is_sword2 || is_comi)
 		_hide_toolbar_needed = true;
 
 	// Initialize keys for different actions
@@ -120,17 +130,30 @@
 	_action_enabled[ACTION_CURSOR] = true;
 	// Freelook
 	_action_enabled[ACTION_FREELOOK] = true;
+	// Zoom
+	if (is_sword1 || is_sword2 || is_comi) {
+		_zoom_needed = true;
+		_action_enabled[ACTION_ZOOM_UP] = true;
+		_action_enabled[ACTION_ZOOM_DOWN] = true;
+	}
+	else {
+		_action_enabled[ACTION_ZOOM_UP] = false;
+		_action_enabled[ACTION_ZOOM_DOWN] = false;
+	}
 }
 
 
 CEActions::~CEActions() {
 }
 
-void CEActions::init(OSystem_WINCE3 *mainSystem, GameDetector &detector) {
-	_instance = new CEActions(mainSystem, detector);
+void CEActions::init(GameDetector &detector) {
+	_instance = new CEActions(detector);
 }
 
 bool CEActions::perform(ActionType action) {
+	if (!_action_enabled[action])
+		return false;
+
 	switch (action) {
 		case ACTION_PAUSE:
 		case ACTION_SAVE:
@@ -152,6 +175,12 @@
 		case ACTION_CURSOR:
 			_mainSystem->swap_mouse_visibility();
 			return true;
+		case ACTION_ZOOM_UP:
+			_mainSystem->swap_zoom_up();
+			return true;
+		case ACTION_ZOOM_DOWN:
+			_mainSystem->swap_zoom_down();
+			return true;
 		case ACTION_QUIT:
 			GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
 			if (alert.runModal() == 1)
@@ -260,4 +289,11 @@
 		return (_action_mapping[ACTION_HIDE] == 0);
 }
 
+bool CEActions::needsZoomMapping() {
+	if (!_zoom_needed)
+		return false;
+	else
+		return (_action_mapping[ACTION_ZOOM_UP] == 0 || _action_mapping[ACTION_ZOOM_DOWN] == 0);
+}
+
 CEActions *CEActions::_instance = NULL;    
\ No newline at end of file

Index: CEActions.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActions.h,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- CEActions.h	28 Jan 2004 01:06:29 -0000	1.2
+++ CEActions.h	15 Mar 2004 10:02:59 -0000	1.2.2.1
@@ -43,18 +43,21 @@
         ACTION_RIGHTCLICK,
         ACTION_CURSOR,
         ACTION_FREELOOK,
+		ACTION_ZOOM_UP,
+		ACTION_ZOOM_DOWN,
 
 		ACTION_LAST
 };
 
-#define ACTIONS_VERSION 1
+#define ACTIONS_VERSION 2
 
 class OSystem_WINCE3;
 
 class CEActions {
 	public:
 		static CEActions* Instance();
-		static void init(OSystem_WINCE3 *mainSystem, GameDetector &detector);
+		static void init(GameDetector &detector);
+		void initInstance(OSystem_WINCE3 *mainSystem);
 
 		// Actions
 		bool perform(ActionType action);
@@ -75,12 +78,14 @@
 		// Utility
 		bool needsRightClickMapping();
 		bool needsHideToolbarMapping();
+		bool needsZoomMapping();
 
 		~CEActions();
 	private:
-		CEActions(OSystem_WINCE3 *mainSystem, GameDetector &detector);
+		CEActions(GameDetector &detector);
 		static CEActions* _instance;
 		OSystem_WINCE3 *_mainSystem;
+		GameDetector *_detector;
 		Key _key_action[ACTION_LAST];
 		bool _action_active[ACTION_LAST];
 		bool _action_enabled[ACTION_LAST];
@@ -88,6 +93,7 @@
 		bool _mapping_active;
 		bool _right_click_needed;
 		bool _hide_toolbar_needed;
+		bool _zoom_needed;
 	};	
 
 #endif
\ No newline at end of file

Index: CEDevice.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEDevice.cpp,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -d -r1.2.2.2 -r1.2.2.3
--- CEDevice.cpp	5 Mar 2004 08:50:31 -0000	1.2.2.2
+++ CEDevice.cpp	15 Mar 2004 10:03:00 -0000	1.2.2.3
@@ -35,6 +35,10 @@
 			(GetSystemMetrics(SM_CXSCREEN) >= 320 && GetSystemMetrics(SM_CYSCREEN) < 480));
 }
 
+bool CEDevice::hasDesktopResolution() {
+	return (GetSystemMetrics(SM_CXSCREEN) >= 320 && GetSystemMetrics(SM_CYSCREEN) >= 240);
+}
+
 bool CEDevice::hasWideResolution() {
 	return ((GetSystemMetrics(SM_CXSCREEN) >= 640 && GetSystemMetrics(SM_CYSCREEN) >= 480)
 		   ||(GetSystemMetrics(SM_CYSCREEN) >= 640 && GetSystemMetrics(SM_CXSCREEN) >= 480));

Index: CEDevice.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEDevice.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- CEDevice.h	5 Mar 2004 08:50:31 -0000	1.1.2.1
+++ CEDevice.h	15 Mar 2004 10:03:00 -0000	1.1.2.2
@@ -32,6 +32,7 @@
 class CEDevice {
 	public:
 		static bool hasPocketPCResolution();
+		static bool hasDesktopResolution();
 		static bool hasWideResolution();
 		static bool hasSmartphoneResolution();
 		static bool enableHardwareKeyMapping();

Index: CEScaler.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEScaler.cpp,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- CEScaler.cpp	13 Feb 2004 14:18:24 -0000	1.5
+++ CEScaler.cpp	15 Mar 2004 10:03:00 -0000	1.5.2.1
@@ -95,3 +95,27 @@
 	}
 }
 
+
+void PocketPCHalfZoom(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
+	uint8 *work;
+	int i;
+	uint16 srcPitch16 = (uint16)(srcPitch / sizeof(uint16));
+
+	if (!height)
+		return;
+
+	while (height--) {
+		i = 0;
+		work = dstPtr;
+
+		for (int i=0; i<width; i+=2) {
+			uint16 color1 = *(((const uint16 *)srcPtr) + i);
+			uint16 color2 = *(((const uint16 *)srcPtr) + (i + 1));
+			*(((uint16 *)work) + 0) = CEinterpolate16_2(color1, 1, color2, 1);
+			
+			work += sizeof(uint16);
+		}
+		srcPtr += srcPitch; 
+		dstPtr += dstPitch;
+	}
+}
\ No newline at end of file

Index: CEScaler.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEScaler.h,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- CEScaler.h	13 Feb 2004 14:18:24 -0000	1.2
+++ CEScaler.h	15 Mar 2004 10:03:00 -0000	1.2.2.1
@@ -30,6 +30,7 @@
 
 DECLARE_SCALER(PocketPCPortrait);
 DECLARE_SCALER(PocketPCHalf);
+DECLARE_SCALER(PocketPCHalfZoom);
 
 void initCEScaler(void);
 

Index: wince-sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.cpp,v
retrieving revision 1.4.2.9
retrieving revision 1.4.2.10
diff -u -d -r1.4.2.9 -r1.4.2.10
--- wince-sdl.cpp	5 Mar 2004 08:49:53 -0000	1.4.2.9
+++ wince-sdl.cpp	15 Mar 2004 10:03:00 -0000	1.4.2.10
@@ -81,6 +81,7 @@
 	/* Avoid print problems - this file will be put in RAM anyway */
 	stdout_file = fopen("\\scummvm_stdout.txt", "w");
 	stderr_file = fopen("\\scummvm_stderr.txt", "w");
+	CEActions::init(_gameDetector);
 	return scummvm_main(_gameDetector, argc, argv);
 }    
    
@@ -129,7 +130,8 @@
 	 : _hwscreen(0), _scaler_proc(0), _orientationLandscape(false), _newOrientation(false),
 	   _panelInitialized(false), _forcePanelInvisible(false), _panelVisible(true),
 	   _panelStateForced(false), _addRightClickDown(false), _addRightClickUp(false),
-	   _forceHideMouse(false), _freeLook(false), _toolbarHighDrawn(false)
+	   _forceHideMouse(false), _freeLook(false), _toolbarHighDrawn(false), _zoomUp(false),
+	   _zoomDown(false), _saveToolbarZoom(false)
 {
 	CEDevice::enableHardwareKeyMapping();
 	create_toolbar();
@@ -178,6 +180,68 @@
 	_freeLook = !_freeLook;
 }
 
+void OSystem_WINCE3::swap_zoom_up() {	
+	if (_zoomUp) {
+		// restore visibility
+		_toolbarHandler.setVisible(_saveToolbarZoom);
+		// restore scaler
+		_scaleFactorYd = 2;
+		_scaler_proc = PocketPCHalf;
+		_zoomUp = false;
+	}
+	else
+	{
+		// only active if running on a PocketPC
+		if (_scaler_proc != PocketPCHalf && _scaler_proc != PocketPCHalfZoom)
+			return;
+		if (_scaler_proc == PocketPCHalf) {
+			_saveToolbarZoom = _toolbarHandler.visible();
+			_toolbarHandler.setVisible(false);
+			// set zoom scaler
+			_scaleFactorYd = 1;
+			_scaler_proc = PocketPCHalfZoom;
+		}
+		else
+			_zoomDown = false;
+
+		_zoomUp = true;
+	}
+	// redraw whole screen
+	add_dirty_rect(0, 0, 640, 480);
+	update_screen();
+}
+
+void OSystem_WINCE3::swap_zoom_down() {	
+	if (_zoomDown) {
+		// restore visibility
+		_toolbarHandler.setVisible(_saveToolbarZoom);
+		// restore scaler
+		_scaleFactorYd = 2;
+		_scaler_proc = PocketPCHalf;
+		_zoomDown = false;
+	}
+	else
+	{
+		// only active if running on a PocketPC
+		if (_scaler_proc != PocketPCHalf && _scaler_proc != PocketPCHalfZoom)
+			return;
+		if (_scaler_proc == PocketPCHalf) {
+			_saveToolbarZoom = _toolbarHandler.visible();
+			_toolbarHandler.setVisible(false);
+			// set zoom scaler
+			_scaleFactorYd = 1;
+			_scaler_proc = PocketPCHalfZoom;
+		}
+		else
+			_zoomUp = false;
+
+		_zoomDown = true;
+	}
+	// redraw whole screen
+	add_dirty_rect(0, 0, 640, 480);
+	update_screen();
+}
+
 void OSystem_WINCE3::create_toolbar() {
 	PanelKeyboard *keyboard;
 
@@ -206,12 +270,14 @@
                 if (!ov_open(testFile, test_ov_file, NULL, 0)) {
                         bool highSampleRate = (ov_info(test_ov_file, -1)->rate == 22050);
                         ov_clear(test_ov_file);
+						delete test_ov_file;
                         return highSampleRate;
                 }
-        }
+        }		
 
         // Do not test for OGG samples - too big and too slow anyway :)
 
+		delete test_ov_file;
         return false;
 }
 #endif
@@ -277,32 +343,45 @@
 		if (!_gameDetector._targetName.size())
 			return;
 		
-		CEActions::init(this, _gameDetector);
+		//CEActions::init(this, _gameDetector);
+		CEActions::Instance()->initInstance(this);
 		// Load key mapping
 		CEActions::Instance()->loadMapping();
 
 		// Some games need to map the right click button, signal it here if it wasn't done
 		if (CEActions::Instance()->needsRightClickMapping()) {
+			CEKeysDialog *keysDialog = new CEKeysDialog("Map right click action");	
 			while (!CEActions::Instance()->getMapping(ACTION_RIGHTCLICK)) {
-				CEKeysDialog *keysDialog = new CEKeysDialog("Map right click action");	
 				keysDialog->runModal();
 				if (!CEActions::Instance()->getMapping(ACTION_RIGHTCLICK)) {
 					GUI::MessageDialog alert("You must map a key to the 'Right Click' action to play this game");
 					alert.runModal();
 				}					
 			}
+			delete keysDialog;
 		}
 
 		// Map the "hide toolbar" action if needed
 		if (CEActions::Instance()->needsHideToolbarMapping()) {
+			CEKeysDialog *keysDialog = new CEKeysDialog("Map hide toolbar action");
 			while (!CEActions::Instance()->getMapping(ACTION_HIDE)) {
-				CEKeysDialog *keysDialog = new CEKeysDialog("Map hide toolbar action");
 				keysDialog->runModal();
 				if (!CEActions::Instance()->getMapping(ACTION_HIDE)) {
 					GUI::MessageDialog alert("You must map a key to the 'Hide toolbar' action to play this game");
 					alert.runModal();
 				}
 			}
+			delete keysDialog;
+		}
+
+		// Map the "zoom" actions if needed
+		if (CEActions::Instance()->needsZoomMapping()) {
+			CEKeysDialog *keysDialog = new CEKeysDialog("Map Zoom Up action (optional)");
+			keysDialog->runModal();
+			delete keysDialog;
+			keysDialog = new CEKeysDialog("Map Zoom Down action (optional)");
+			keysDialog->runModal();
+			delete keysDialog;
 		}
 
 		// Extra warning for Zak Mc Kracken
@@ -328,7 +407,7 @@
 		// sound
 		panel->add(NAME_ITEM_SOUND, new ItemSwitch(ITEM_SOUND_OFF, ITEM_SOUND_ON, &_soundMaster)); 
 		// portrait/landscape - screen dependant
-		if (_screenWidth <= 320) {
+		if (_screenWidth <= 320 && !CEDevice::hasDesktopResolution()) {
 			_newOrientation = _orientationLandscape = ConfMan.getBool("CE_landscape");
 			panel->add(NAME_ITEM_ORIENTATION, new ItemSwitch(ITEM_VIEW_LANDSCAPE, ITEM_VIEW_PORTRAIT, &_newOrientation));
 		}
@@ -380,6 +459,9 @@
 	_scaleFactorYd = -1;  
 	_scaleFactor = 0;	
 
+	if (CEDevice::hasDesktopResolution())
+		_orientationLandscape = true;
+
 	if (CEDevice::hasPocketPCResolution()) {
 		if (!_orientationLandscape && _screenWidth == 320) {
 			_scaleFactorXm = 3;
@@ -399,7 +481,7 @@
 		}
 	}
 
-	if (CEDevice::hasPocketPCResolution() && _orientationLandscape)
+	if (CEDevice::hasPocketPCResolution() && _orientationLandscape) 
 		_mode = GFX_NORMAL;
 
 	if (_scaleFactorXm < 0) {
@@ -496,7 +578,7 @@
 	}
 
 	_hwscreen = SDL_SetVideoMode(displayWidth, displayHeight, 16, SDL_FULLSCREEN | SDL_SWSURFACE);
-	if (_hwscreen == NULL) {
+	if (_hwscreen == NULL) { 
 		// DON'T use error(), as this tries to bring up the debug
 		// console, which WON'T WORK now that _hwscreen is hosed.
 
@@ -624,9 +706,9 @@
 	SDL_BlitSurface(old_tmpscreen, NULL, _tmpscreen, NULL);
 	
 	// Free the old surfaces
-	SDL_FreeSurface(old_screen);
+	SDL_FreeSurface(old_screen); 
 	free(old_tmpscreen->pixels);
-	SDL_FreeSurface(old_tmpscreen);
+	SDL_FreeSurface(old_tmpscreen); 
 
 	// Blit everything to the screen
 	update_screen();
@@ -674,10 +756,10 @@
 	// screen surface accordingly. 
 	if (_paletteDirtyEnd != 0) {
 		SDL_SetColors(_screen, _currentPalette + _paletteDirtyStart, 
-			_paletteDirtyStart,
-			_paletteDirtyEnd - _paletteDirtyStart);
+			_paletteDirtyStart, 
+			_paletteDirtyEnd - _paletteDirtyStart); 
 		
-		_paletteDirtyEnd = 0;
+		_paletteDirtyEnd = 0;   
 
 		_forceFull = true;
 	}
@@ -687,9 +769,15 @@
 		_num_dirty_rects = 1;
 
 		_dirty_rect_list[0].x = 0;
-		_dirty_rect_list[0].y = 0;
+		if (!_zoomDown)
+			_dirty_rect_list[0].y = 0;
+		else
+			_dirty_rect_list[0].y = _screenHeight / 2;
 		_dirty_rect_list[0].w = _screenWidth;
-		_dirty_rect_list[0].h = _screenHeight;
+		if (!_zoomUp && !_zoomDown)
+			_dirty_rect_list[0].h = _screenHeight;
+		else
+			_dirty_rect_list[0].h = _screenHeight / 2;
 
 		_toolbarHandler.forceRedraw();
 	}
@@ -734,7 +822,7 @@
 				}
 			}
 
-			SDL_LockSurface(_tmpscreen);
+			SDL_LockSurface(_tmpscreen); 
 			SDL_LockSurface(_hwscreen);
 
 			srcPitch = _tmpscreen->pitch;
@@ -762,13 +850,21 @@
 						orig_dst_y = dst_y;
 						dst_y = real2Aspect(dst_y);
 					}
-				
-					_scaler_proc((byte *)_tmpscreen->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
-						(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + dst_y * dstPitch, dstPitch, r->w, dst_h);
+
+					if (!_zoomDown)
+						_scaler_proc((byte *)_tmpscreen->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+							(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + dst_y * dstPitch, dstPitch, r->w, dst_h);
+					else {
+						_scaler_proc((byte *)_tmpscreen->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+							(byte *)_hwscreen->pixels + (r->x * 2 * _scaleFactorXm / _scaleFactorXd) + (dst_y - 240) * dstPitch, dstPitch, r->w, dst_h);
+					}
 				}
 
 				r->x = r->x * _scaleFactorXm / _scaleFactorXd;
-				r->y = dst_y;
+				if (!_zoomDown)
+					r->y = dst_y;
+				else
+					r->y = dst_y - 240;
 				r->w = r->w * _scaleFactorXm / _scaleFactorXd;
 				r->h = dst_h * _scaleFactorYm / _scaleFactorYd;
 
@@ -784,7 +880,7 @@
 		// This is necessary if shaking is active.
 		if (_forceFull) {
 			_dirty_rect_list[0].y = 0;
-			_dirty_rect_list[0].h = (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactorYm / _scaleFactorYd;
+			_dirty_rect_list[0].h = (_adjustAspectRatio ? 240 : (_zoomUp || _zoomDown ? _screenHeight / 2 : _screenHeight)) * _scaleFactorYm / _scaleFactorYd;
 		}
 	}
 	// Add the toolbar if needed
@@ -964,6 +1060,9 @@
 	km.y = event.mouse.y;
 
 	// Adjust for the screen scaling
+	if (_zoomDown) 
+		event.mouse.y += 240;
+
 	event.mouse.x = event.mouse.x * _scaleFactorXd / _scaleFactorXm;
 	event.mouse.y = event.mouse.y * _scaleFactorYd / _scaleFactorYm;
 }
@@ -995,7 +1094,7 @@
 		while (w % 4) w++;
 	}
 	else
-	if (_scaler_proc == PocketPCHalf) {
+	if (_scaler_proc == PocketPCHalf || _scaler_proc == PocketPCHalfZoom) {
 		// Align on a 2x2 square
 		if (x != 0) {
 			while (x % 2) {
@@ -1009,6 +1108,29 @@
 			while (w % 2) w++;
 			while (h % 2) h++;
 		}
+
+
+		// Restrict rect if we're zooming
+
+		if (_zoomUp) {
+			if (y + h >= 240) {
+				if (y >= 240)
+					return;
+				else
+					h = 240 - y;
+			}
+		}
+		else
+		if (_zoomDown) {
+			if (y + h >= 240) {
+				if (y < 240) {
+					h = 240 - y;
+					y = 240;
+				}
+			}
+			else
+				return;
+		}
 	}
 
 	OSystem_SDL_Common::add_dirty_rect(x, y, w, h);
@@ -1178,9 +1300,15 @@
 
 			// Check mapping
 			if (CEActions::Instance()->mappingActive()) {
+				Key mappingKey;
+				mappingKey.setAscii(ev.key.keysym.sym ? ev.key.keysym.sym : ev.key.keysym.unicode);
+				mappingKey.setFlags(0xff);
+				_keysBuffer->Instance()->simulate(&mappingKey);
+				/*
 				event->event_code = EVENT_KEYDOWN;
 				event->kbd.ascii = (ev.key.keysym.sym ? ev.key.keysym.sym : ev.key.keysym.unicode);
 				event->kbd.flags = 0xff;
+				*/
 				return true;
 			}
 			else

Index: wince-sdl.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- wince-sdl.h	28 Jan 2004 01:12:48 -0000	1.3
+++ wince-sdl.h	15 Mar 2004 10:03:00 -0000	1.3.2.1
@@ -70,6 +70,8 @@
 	void add_right_click();
 	void swap_mouse_visibility();
 	void swap_freeLook();
+	void swap_zoom_up();
+	void swap_zoom_down();
 
 protected:
 	SDL_Surface *_hwscreen;    // hardware screen
@@ -128,6 +130,10 @@
 	bool _saveToolbarState;		// save visibility when forced
 	String _saveActiveToolbar;	// save active toolbar when forced
 
+	bool _saveToolbarZoom;		// save visibility when zooming 
+	bool _zoomUp;				// zooming up mode
+	bool _zoomDown;				// zooming down mode
+
 	int _scaleFactorXm;
 	int _scaleFactorXd;
 	int _scaleFactorYm;





More information about the Scummvm-git-logs mailing list