[Scummvm-cvs-logs] CVS: scummvm/backends/wince CEActions.cpp,1.3.2.6,1.3.2.7 CEDevice.cpp,1.2.2.3,1.2.2.4 CEKeysDialog.cpp,1.1,1.1.2.1 wince-sdl.cpp,1.4.2.12,1.4.2.13

Nicolas Bacca arisme at users.sourceforge.net
Sun Jul 18 13:04:01 CEST 2004


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

Modified Files:
      Tag: branch-0-6-0
	CEActions.cpp CEDevice.cpp CEKeysDialog.cpp wince-sdl.cpp 
Log Message:
New hardware key handling (with SDL 30/05/04) - do not delete stdout/stderr files if debugging was required - backport flickering 640x480 fixes

Index: CEActions.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEActions.cpp,v
retrieving revision 1.3.2.6
retrieving revision 1.3.2.7
diff -u -d -r1.3.2.6 -r1.3.2.7
--- CEActions.cpp	18 Jul 2004 17:08:25 -0000	1.3.2.6
+++ CEActions.cpp	18 Jul 2004 20:03:43 -0000	1.3.2.7
@@ -186,7 +186,7 @@
 		case ACTION_QUIT:
 			GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
 			if (alert.runModal() == 1)
-				_mainSystem->quit();
+				_mainSystem->quit(); 
 			return true;
 	}
 	return false;
@@ -298,4 +298,4 @@
 		return (_action_mapping[ACTION_ZOOM_UP] == 0 || _action_mapping[ACTION_ZOOM_DOWN] == 0);
 }
 
-CEActions *CEActions::_instance = NULL;    
\ No newline at end of file
+CEActions *CEActions::_instance = NULL;    

Index: CEDevice.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEDevice.cpp,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -d -r1.2.2.3 -r1.2.2.4
--- CEDevice.cpp	15 Mar 2004 10:03:00 -0000	1.2.2.3
+++ CEDevice.cpp	18 Jul 2004 20:03:44 -0000	1.2.2.4
@@ -22,6 +22,10 @@
 #include "stdafx.h"
 #include "CEDevice.h"
 
+#include <SDL.h>
+
+#include "wince-sdl.h"
+
 bool CEDevice::_hasGAPIMapping = false;
 struct GXKeyList CEDevice::_portrait_keys = {0};
 
@@ -90,22 +94,7 @@
 
 	if (!keyCode)
 		return "No key";
-	if (keyCode == (unsigned int)_portrait_keys.vkA)
-		return "Button A";
-    if (keyCode == (unsigned int)_portrait_keys.vkB)
-		return "Button B";
-    if (keyCode == (unsigned int)_portrait_keys.vkC)
-		return "Button C";
-    if (keyCode == (unsigned int)_portrait_keys.vkStart)
-		return "Button Start";
-    if (keyCode == (unsigned int)_portrait_keys.vkUp)
-		return "Pad Up";
-    if (keyCode == (unsigned int)_portrait_keys.vkDown)
-		return "Pad Down";
-    if (keyCode == (unsigned int)_portrait_keys.vkLeft)
-		return "Pad Left";
-    if (keyCode == (unsigned int)_portrait_keys.vkRight)
-		return "Pad Right";
+
 	if (keyCode == KEY_CALENDAR)
 		return "Button Calendar";
 	if (keyCode == KEY_CONTACTS)
@@ -114,6 +103,14 @@
 		return "Button Inbox";
 	if (keyCode == KEY_TASK)
 		return "Button Tasks";
+	if (keyCode == SDLK_F1) 
+		return "F1 (hard 1)";
+	if (keyCode == SDLK_F2) 
+		return "F2 (hard 2)";
+	if (keyCode == SDLK_F3) 
+		return "F3 (hard 3)";
+	if (keyCode == SDLK_F4) 
+		return "F4 (hard 4)";
 
 	sprintf(key_name, "Key %.4x", keyCode);
 	return key_name;	

Index: CEKeysDialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/CEKeysDialog.cpp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -d -r1.1 -r1.1.2.1
--- CEKeysDialog.cpp	26 Jan 2004 08:20:26 -0000	1.1
+++ CEKeysDialog.cpp	18 Jul 2004 20:03:44 -0000	1.1.2.1
@@ -110,7 +110,7 @@
 		// GAPI key was selected
 		char selection[100];
 
-		CEActions::Instance()->setMapping((ActionType)_actionSelected, (ascii & 0xff));
+		CEActions::Instance()->setMapping((ActionType)_actionSelected, ascii);
 		
 		sprintf(selection, "Associated key : %s", CEDevice::getKeyName(CEActions::Instance()->getMapping((ActionType)_actionSelected)).c_str());
 		_actionTitle->setLabel("Choose an action to map");

Index: wince-sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/wince/wince-sdl.cpp,v
retrieving revision 1.4.2.12
retrieving revision 1.4.2.13
diff -u -d -r1.4.2.12 -r1.4.2.13
--- wince-sdl.cpp	18 Jul 2004 17:11:18 -0000	1.4.2.12
+++ wince-sdl.cpp	18 Jul 2004 20:03:44 -0000	1.4.2.13
@@ -1028,6 +1028,11 @@
 
 static int mapKeyCE(SDLKey key, SDLMod mod, Uint16 unicode)
 {
+
+	if (CEActions::Instance()->mappingActive()) {
+		return key;
+	}
+
 	if (key >= SDLK_F1 && key <= SDLK_F9) {
 		return key - SDLK_F1 + 315;
 	} else if (key >= SDLK_KP0 && key <= SDLK_KP9) {
@@ -1083,6 +1088,51 @@
 }
 
 void OSystem_WINCE3::add_dirty_rect(int x, int y, int w, int h) {
+	// Align on boundaries
+	if (_scaleFactorXd > 1) {
+		while (x % _scaleFactorXd) {
+			x--;
+			w++;
+		}
+		while (w % _scaleFactorXd) w++;
+	}
+
+	if (_scaleFactorYd > 1) {
+		while (y % _scaleFactorYd) {
+			y--;
+			h++;
+		}
+		while (h % _scaleFactorYd) h++;
+	}
+
+	if (_scaler_proc == PocketPCHalfZoom) {
+		// 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);
+}
+
+/*
+void OSystem_WINCE3::add_dirty_rect(int x, int y, int w, int h) {
 	if (_scaler_proc == PocketPCPortrait) {
 		// Align on a 4 bytes boundary for the Portrait mode
 		if (x != 0) {
@@ -1132,6 +1182,7 @@
 
 	OSystem_SDL_Common::add_dirty_rect(x, y, w, h);
 }
+*/
 
 // FIXME
 // Remove useless mappings
@@ -1141,6 +1192,9 @@
 	byte b = 0;
 	Event temp_event;
 
+	memset(&temp_event, 0, sizeof(Event));
+	memset(event, 0, sizeof(Event));
+
 	// Check if the keys queue is empty
 	Key *key = _keysBuffer->Instance()->get();
 	if (key) {
@@ -1184,6 +1238,9 @@
 		switch(ev.type) {
 		case SDL_KEYDOWN:
 
+			if (CEActions::Instance()->performMapped(ev.key.keysym.sym, true))
+				return true;
+
 			if (ev.key.keysym.mod & KMOD_SHIFT)
 				b |= KBD_SHIFT;
 			if (ev.key.keysym.mod & KMOD_CTRL)
@@ -1295,27 +1352,16 @@
 				}
 			}
 
-			// Check mapping
+			event->event_code = EVENT_KEYDOWN;
+			event->kbd.keycode = ev.key.keysym.sym;
+			event->kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+			
 			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
-			if (CEActions::Instance()->performMapped((ev.key.keysym.sym ? ev.key.keysym.sym : ev.key.keysym.unicode), true))
-				return true;
 
-			event->event_code = EVENT_KEYDOWN;
-			event->kbd.keycode = ev.key.keysym.sym;
-			event->kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
-			
+
 			switch(ev.key.keysym.sym) {
 			case SDLK_LEFT:
 				km.x_vel = -1;
@@ -1340,20 +1386,19 @@
 			return true;
 	
 		case SDL_KEYUP:
+	
+			if (CEActions::Instance()->performMapped(ev.key.keysym.sym, false))
+				return true;
+				
+			event->event_code = EVENT_KEYUP;
+			event->kbd.keycode = ev.key.keysym.sym;
+			event->kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
+
 			// Check mapping
 			if (CEActions::Instance()->mappingActive()) {
-				event->event_code = EVENT_KEYUP;
-				event->kbd.ascii = (ev.key.keysym.sym ? ev.key.keysym.sym : ev.key.keysym.unicode);
 				event->kbd.flags = 0xff;
 				return true;
 			}
-			else
-			if (CEActions::Instance()->performMapped((ev.key.keysym.sym ? ev.key.keysym.sym : ev.key.keysym.unicode), false))
-				return true;
-			
-			event->event_code = EVENT_KEYUP;
-			event->kbd.keycode = ev.key.keysym.sym;
-			event->kbd.ascii = mapKeyCE(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode);
 
 			switch(ev.key.keysym.sym) {
 			case SDLK_LEFT:
@@ -1455,8 +1500,10 @@
 void OSystem_WINCE3::quit() {
 	fclose(stdout_file);
 	fclose(stderr_file);
-	DeleteFile(TEXT("\\scummvm_stdout.txt"));
-	DeleteFile(TEXT("\\scummvm_stderr.txt"));
+	if (ConfMan.get("debuglevel").isEmpty()) {
+		DeleteFile(TEXT("\\scummvm_stdout.txt"));
+		DeleteFile(TEXT("\\scummvm_stderr.txt"));
+	}
 	CEDevice::disableHardwareKeyMapping();
 	OSystem_SDL_Common::quit();
 }
\ No newline at end of file





More information about the Scummvm-git-logs mailing list