[Scummvm-cvs-logs] SF.net SVN: scummvm: [22938] scummvm/trunk/backends/PalmOS/Src

chrilith at users.sourceforge.net chrilith at users.sourceforge.net
Mon Jun 5 21:17:48 CEST 2006


Revision: 22938
Author:   chrilith
Date:     2006-06-05 12:17:30 -0700 (Mon, 05 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22938&view=rev

Log Message:
-----------
- Added arrow keys emulation
- Ajust mouse simulation so that there is no more hang while moving it

Modified Paths:
--------------
    scummvm/trunk/backends/PalmOS/Rsc/Resource.Frk/Starter.rsrc
    scummvm/trunk/backends/PalmOS/Rsc/StarterRsc.h
    scummvm/trunk/backends/PalmOS/Src/base_event.cpp
    scummvm/trunk/backends/PalmOS/Src/base_mouse.cpp
    scummvm/trunk/backends/PalmOS/Src/be_base.cpp
    scummvm/trunk/backends/PalmOS/Src/be_base.h
    scummvm/trunk/backends/PalmOS/Src/globals.h
    scummvm/trunk/backends/PalmOS/Src/launcher/launch.cpp
    scummvm/trunk/backends/PalmOS/Src/launcher/start.h
    scummvm/trunk/backends/PalmOS/Src/zodiac_event.cpp
Modified: scummvm/trunk/backends/PalmOS/Rsc/Resource.Frk/Starter.rsrc
===================================================================
(Binary files differ)

Modified: scummvm/trunk/backends/PalmOS/Rsc/StarterRsc.h
===================================================================
--- scummvm/trunk/backends/PalmOS/Rsc/StarterRsc.h	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Rsc/StarterRsc.h	2006-06-05 19:17:30 UTC (rev 22938)
@@ -3,7 +3,7 @@
 
 //	Header generated by Constructor for Palm OS (R) 1.9.1
 //
-//	Generated at 21:13:49  on jeudi 9 mars 2006
+//	Generated at 20:53:03  on lundi 5 juin 2006
 //
 //	Generated for file: Starter.rsrc
 //
@@ -114,9 +114,10 @@
 #define TabMiscPalmOSForm                         2800	//(Left Origin = 0, Top Origin = 0, Width = 160, Height = 120, Usable = 0, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
 #define TabMiscPalmOSVibratorCheckbox             2802	//(Left Origin = 4, Top Origin = 12, Width = 128, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
 #define TabMiscPalmOSNoAutoOffCheckbox            2803	//(Left Origin = 4, Top Origin = 24, Width = 152, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
-#define TabMiscPalmOSStdPaletteCheckbox           2804	//(Left Origin = 4, Top Origin = 72, Width = 146, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
+#define TabMiscPalmOSStdPaletteCheckbox           2804	//(Left Origin = 4, Top Origin = 84, Width = 146, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
 #define TabMiscPalmOSLargerStackCheckbox          2805	//(Left Origin = 4, Top Origin = 36, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
-#define TabMiscPalmOSAdvancedCheckbox             2806	//(Left Origin = 4, Top Origin = 84, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
+#define TabMiscPalmOSAdvancedCheckbox             2806	//(Left Origin = 4, Top Origin = 96, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
+#define TabMiscPalmOSArrowCheckbox                2807	//(Left Origin = 4, Top Origin = 72, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
 #define TabMiscPalmOSExitLauncherCheckbox         2810	//(Left Origin = 4, Top Origin = 48, Width = 150, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
 #define TabMiscPalmOSStylusClickCheckbox          2811	//(Left Origin = 4, Top Origin = 60, Width = 120, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
 #define TabMiscPalmOSTabTitlePalmLabel            2801	//(Left Origin = 4, Top Origin = 0, Usable = 1, Font = Bold)

Modified: scummvm/trunk/backends/PalmOS/Src/base_event.cpp
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/base_event.cpp	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Src/base_event.cpp	2006-06-05 19:17:30 UTC (rev 22938)
@@ -96,30 +96,68 @@
 		keyCurrentState = KeyCurrentState();
 		// check_hard_keys();
 
-		if ((keyCurrentState & _keyMouseMask)) {
-			Int8 sx = 0;
-			Int8 sy = 0;
+		if (!(keyCurrentState & _keyMouseMask)) {
+			_lastKeyRepeat = 0;
+		} else {
+			if (getMillis() >= (_keyMouseRepeat + _keyMouseDelay)) {
+				_keyMouseRepeat = getMillis();
 
-			if (keyCurrentState & _keyMouse.bitUp)
-				sy = -1;
-			else if (keyCurrentState & _keyMouse.bitDown)
-				sy = +1;
-				
-			if (keyCurrentState & _keyMouse.bitLeft)
-				sx = -1;
-			else if (keyCurrentState & _keyMouse.bitRight)
-				sx = +1;					
+				if (gVars->arrowKeys) {				
+					if (keyCurrentState & _keyMouse.bitUp)
+						event.kbd.keycode = 273;
+					else if (keyCurrentState & _keyMouse.bitDown)
+						event.kbd.keycode = 274;
+					else if (keyCurrentState & _keyMouse.bitLeft)
+						event.kbd.keycode = 276;
+					else if (keyCurrentState & _keyMouse.bitRight)
+						event.kbd.keycode = 275;
+					else if (keyCurrentState & _keyMouse.bitButLeft)
+						event.kbd.keycode = chrLineFeed;
 
-			simulate_mouse(event, sx, sy, &x, &y);
-			warpMouse(x, y);
-			updateScreen();
-	//		updateCD();
-			event.type = EVENT_MOUSEMOVE;
-			event.mouse.x = x;
-			event.mouse.y = y;
+					event.type = EVENT_KEYDOWN;
+					event.kbd.ascii = event.kbd.keycode;
+					event.kbd.flags = 0;
 
-			_lastKey = kKeyMouseMove;
-			return true;
+				} else {
+					Int8 sx = 0;
+					Int8 sy = 0;
+
+					if (keyCurrentState & _keyMouse.bitUp)
+						sy = -1;
+					else if (keyCurrentState & _keyMouse.bitDown)
+						sy = +1;
+						
+					if (keyCurrentState & _keyMouse.bitLeft)
+						sx = -1;
+					else if (keyCurrentState & _keyMouse.bitRight)
+						sx = +1;
+
+					if (sx || sy) {
+						simulate_mouse(event, sx, sy, &x, &y);
+						event.type = EVENT_MOUSEMOVE;
+						_lastKey = kKeyMouseMove;
+
+					} else {			
+						x = _mouseCurState.x;
+						y = _mouseCurState.y;
+
+						if (keyCurrentState & _keyMouse.bitButLeft) {
+							event.type = EVENT_LBUTTONDOWN;
+							_lastKey = kKeyMouseLButton;
+
+						} else if (_lastKey == kKeyMouseLButton) {
+							event.type = EVENT_LBUTTONUP;
+							_lastKey = kKeyNone;
+						}
+					}
+
+					event.mouse.x = x;
+					event.mouse.y = y;
+					warpMouse(x, y);
+		//			updateCD();
+				}
+				return true;
+			}
 		}
 
 		if (ev.eType == keyDownEvent) {

Modified: scummvm/trunk/backends/PalmOS/Src/base_mouse.cpp
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/base_mouse.cpp	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Src/base_mouse.cpp	2006-06-05 19:17:30 UTC (rev 22938)
@@ -52,14 +52,10 @@
 	Int16 y = _mouseCurState.y;
 	Int16 slow;
 
-	if (_lastKey != kKeyNone) {
-		_lastKeyRepeat++;
+	_lastKeyRepeat++;
 
-		if (_lastKeyRepeat > 16)
-			_lastKeyRepeat = 16;
-	}
-	else
-		_lastKeyRepeat = 0;
+	if (_lastKeyRepeat > 32)
+		_lastKeyRepeat = 32;
 
 	slow = (iHoriz && iVert) ? 2 : 1;
 

Modified: scummvm/trunk/backends/PalmOS/Src/be_base.cpp
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/be_base.cpp	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Src/be_base.cpp	2006-06-05 19:17:30 UTC (rev 22938)
@@ -66,6 +66,9 @@
 	MemSet(&_mouseOldState, sizeof(_mouseOldState), 0);
 	MemSet(&_timer, sizeof(TimerType), 0);
 	MemSet(&_sound, sizeof(SoundType), 0);
+	
+	_keyMouseRepeat = 0;
+	_keyMouseDelay = (gVars->arrowKeys) ? computeMsecs(125) : computeMsecs(25);
 }
 
 void OSystem_PalmBase::initBackend() {
@@ -88,7 +91,7 @@
 }
 
 void OSystem_PalmBase::delayMillis(uint msecs) {
-	Int32 delay = (SysTicksPerSecond() * msecs) / 1000;
+	Int32 delay = computeMsecs(msecs);
 
 	if (delay > 0)
 		SysTaskDelay(delay);

Modified: scummvm/trunk/backends/PalmOS/Src/be_base.h
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/be_base.h	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Src/be_base.h	2006-06-05 19:17:30 UTC (rev 22938)
@@ -49,6 +49,8 @@
 #define kDrawBatLow		3020
 #define kDrawFight		3030
 
+#define computeMsecs(x) ((SysTicksPerSecond() * x) / 1000)
+
 typedef struct {
 	UInt32 duration, nextExpiry;
 	Boolean active;
@@ -131,7 +133,7 @@
 	Boolean _overlayVisible;
 	Boolean _redawOSD, _setPalette;
 
-	UInt32 _keyMouseMask;
+	UInt32 _keyMouseMask, _keyMouseRepeat, _keyMouseDelay;
 	struct {
 		UInt32 bitUp;
 		UInt32 bitDown;
@@ -140,7 +142,7 @@
 		UInt32 bitButLeft;
 		Boolean hasMore;
 	} _keyMouse;
-
+	
 	bool _mouseVisible;
 	bool _mouseDrawn;
 	MousePos _mouseCurState;

Modified: scummvm/trunk/backends/PalmOS/Src/globals.h
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/globals.h	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Src/globals.h	2006-06-05 19:17:30 UTC (rev 22938)
@@ -92,6 +92,7 @@
 	Boolean stdPalette;
 	Boolean filter;
 	Boolean stylusClick;
+	Boolean arrowKeys;
 	UInt8 init;
 	UInt8 palmVolume;
 	UInt8 fmQuality;

Modified: scummvm/trunk/backends/PalmOS/Src/launcher/launch.cpp
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/launcher/launch.cpp	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Src/launcher/launch.cpp	2006-06-05 19:17:30 UTC (rev 22938)
@@ -437,6 +437,7 @@
 	gVars->stylusClick		= gPrefs->stylusClick;
 	gVars->autoSave			= (gPrefs->autoSave ? gPrefs->autoSavePeriod : -1);
 	gVars->advancedMode		= gPrefs->advancedMode;
+	gVars->arrowKeys		= gPrefs->arrowKeys;
 
 	// user params
 	HWR_RSTALL();

Modified: scummvm/trunk/backends/PalmOS/Src/launcher/start.h
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/launcher/start.h	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Src/launcher/start.h	2006-06-05 19:17:30 UTC (rev 22938)
@@ -43,6 +43,7 @@
 	Boolean exitLauncher;
 	Boolean goLCD;
 	Boolean stylusClick;
+	Boolean arrowKeys;
 
 	UInt16 listPosition;
 	UInt16 autoSavePeriod;

Modified: scummvm/trunk/backends/PalmOS/Src/zodiac_event.cpp
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/zodiac_event.cpp	2006-06-05 17:56:27 UTC (rev 22937)
+++ scummvm/trunk/backends/PalmOS/Src/zodiac_event.cpp	2006-06-05 19:17:30 UTC (rev 22938)
@@ -71,7 +71,6 @@
 			setFeatureState(kFeatureAspectRatioCorrection, 0);
 			return false; // not a key
 
-		case vchrRockerCenter:
 		case vchrActionLeft:
 			_lastKey = kKeyMouseLButton;
 			event.type = EVENT_LBUTTONDOWN;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list