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

chrilith at users.sourceforge.net chrilith at users.sourceforge.net
Tue May 1 12:12:56 CEST 2007


Revision: 26699
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26699&view=rev
Author:   chrilith
Date:     2007-05-01 03:12:55 -0700 (Tue, 01 May 2007)

Log Message:
-----------
- Prevent lose of events
- Added hard arrow keys support
- Revamped mouse code to prevent duplication and get rid of fixed size mouse buffer
- Reviewed event code (more work needed for OS5 and keyup emulation)
- Cleanup

Modified Paths:
--------------
    scummvm/trunk/backends/platform/PalmOS/Src/base_event.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
    scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h
    scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h
    scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_gfx.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_overlay.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/os5_sound.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/zodiac_gfx.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp
    scummvm/trunk/backends/platform/PalmOS/Src/zodiac_overlay.cpp

Modified: scummvm/trunk/backends/platform/PalmOS/Src/base_event.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/base_event.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/base_event.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -81,7 +81,7 @@
 	}
 }
 
-bool OSystem_PalmBase::pollEvent(Event &event) {
+bool OSystem_PalmBase::pollEvent(Common::Event &event) {
 	::EventType ev;
 	Boolean handled;
 	UInt32 keyCurrentState;
@@ -92,52 +92,60 @@
 	sound_handler();
 
 	for(;;) {
-#if defined(COMPILE_OS5) && defined(PALMOS_ARM)
-		SysEventGet(&ev, evtNoWait);
-#else
-		EvtGetEvent(&ev, evtNoWait);
-#endif
-		// check for hardkey repeat for mouse emulation
-		keyCurrentState = KeyCurrentState();
-		// check_hard_keys();
+		// if it was a key pressed, let the keyup event raise
+		if (_wasKey) {
+			// check for hardkey repeat for mouse emulation
+			keyCurrentState = KeyCurrentState();
 
-		if (!(keyCurrentState & _keyMouseMask)) {
-			_lastKeyRepeat = 0;
-		} else {
-			if (getMillis() >= (_keyMouseRepeat + _keyMouseDelay)) {
-				_keyMouseRepeat = getMillis();
+			if (!(keyCurrentState & _keyExtraMask)) {
+				_lastKeyRepeat = 0;
 
+			} else if (getMillis() >= (_keyExtraRepeat + _keyExtraDelay)) {
+				_keyExtraRepeat = getMillis();
+
 				if (gVars->arrowKeys) {
-					event.kbd.keycode = 0;
+/*					if		HARD_KEY(Up,	chrUpArrow)
+					else if	HARD_KEY(Down,	chrDownArrow)
+					else if	HARD_KEY(Left,	chrLeftArrow)
+					else if	HARD_KEY(Right,	chrRightArrow)
+*/
+				} else {
+					// button released ?
+					if (_keyExtraPressed) {
+						if (_keyExtraPressed & _keyExtra.bitActionA) {
+							if (!(keyCurrentState & _keyExtra.bitActionA)) {
+								_keyExtraPressed &= ~_keyExtra.bitActionA;
 
-					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;
+								event.type = Common::EVENT_LBUTTONUP;
+								event.mouse.x = _mouseCurState.x;
+								event.mouse.y = _mouseCurState.y;
+								return true;
+							}
+						}
 
-					if (event.kbd.keycode) {
-						event.type = Common::EVENT_KEYDOWN;
-						event.kbd.ascii = event.kbd.keycode;
-						event.kbd.flags = 0;
-						return true;
+						if (_keyExtraPressed & _keyExtra.bitActionB) {
+							if (!(keyCurrentState & _keyExtra.bitActionB)) {
+								_keyExtraPressed &= ~_keyExtra.bitActionB;
+
+								event.type = Common::EVENT_RBUTTONUP;
+								event.mouse.x = _mouseCurState.x;
+								event.mouse.y = _mouseCurState.y;
+								return true;
+							}
+						}
 					}
 
-				} else {
 					Int8 sx = 0;
 					Int8 sy = 0;
 
-					if (keyCurrentState & _keyMouse.bitUp)
+					if (keyCurrentState & _keyExtra.bitUp)
 						sy = -1;
-					else if (keyCurrentState & _keyMouse.bitDown)
+					else if (keyCurrentState & _keyExtra.bitDown)
 						sy = +1;
 						
-					if (keyCurrentState & _keyMouse.bitLeft)
+					if (keyCurrentState & _keyExtra.bitLeft)
 						sx = -1;
-					else if (keyCurrentState & _keyMouse.bitRight)
+					else if (keyCurrentState & _keyExtra.bitRight)
 						sx = +1;
 
 					if (sx || sy) {
@@ -148,12 +156,42 @@
 						warpMouse(x, y);
 
 						return true;
-					}
+					}			
 				}
 			}
 		}
 
-		if (ev.eType == keyDownEvent) {
+#if defined(COMPILE_OS5) && defined(PALMOS_ARM)
+		SysEventGet(&ev, evtNoWait);
+#else
+		EvtGetEvent(&ev, evtNoWait);
+#endif
+
+		if (ev.eType == keyUpEvent) {
+			int k = 0;
+			switch (ev.data.keyUp.chr) {
+
+			// arrow keys
+			case chrUpArrow:
+				k = 273; break;
+			case chrDownArrow:
+				k = 274; break;
+			case chrLeftArrow:
+				k = 275; break;
+			case chrRightArrow:
+				k = 276; break;
+			}
+
+			if (k) {
+				event.type = Common::EVENT_KEYUP;
+				event.kbd.keycode = k;
+				event.kbd.ascii = k;
+				event.kbd.flags = 0;
+				return true;
+			}
+
+		} else if (ev.eType == keyDownEvent) {
+			int k = 0;
 			switch (ev.data.keyDown.chr) {
 			// ESC key
 			case vchrLaunch:
@@ -180,7 +218,25 @@
 			case vchrContrast:
 				// do nothing
 				return true;
+
+			// arrow keys
+			case chrUpArrow:
+				k = 273; break;
+			case chrDownArrow:
+				k = 274; break;
+			case chrLeftArrow:
+				k = 275; break;
+			case chrRightArrow:
+				k = 276; break;
 			}
+
+			if (k) {
+				event.type = Common::EVENT_KEYDOWN;
+				event.kbd.keycode = k;
+				event.kbd.ascii = k;
+				event.kbd.flags = 0;
+				return true;
+			}
 		}
 
 		if (check_event(event, &ev))
@@ -192,11 +248,13 @@
 						((ev.data.keyDown.chr == vchrAttnStateChanged) || 
 						(ev.data.keyDown.chr == vchrAttnUnsnooze))); 
 
+
 		// graffiti strokes, auto-off, etc...
 		if (!handled)
 			if (SysHandleEvent(&ev))
 				continue;
 
+
 		switch(ev.eType) {
 		case penMoveEvent:
 			get_coordinates(&ev, x, y);
@@ -222,7 +280,7 @@
 				num += 9 -
 						(3 - (3 * x / _screenWidth )) -
 						(3 * (3 * y / _screenHeight));
-			
+
 				event.type = Common::EVENT_KEYDOWN;
 				event.kbd.keycode = num;
 				event.kbd.ascii = num;
@@ -252,7 +310,7 @@
 			event.mouse.y = y;
 			warpMouse(x, y);
 			return true;
-		
+
 		case keyDownEvent:
 			if (ev.data.keyDown.chr == vchrCommand &&
 				(ev.data.keyDown.modifiers & commandKeyMask)) {
@@ -302,7 +360,7 @@
 			} else if  ((key == 'z' && mask == Common::KBD_CTRL) || (mask == Common::KBD_ALT && key == 'x')) {
 				event.type = Common::EVENT_QUIT;
 				return true;
-			
+
 			// num pad (indy fight mode)
 			} else if (key == 'n' && mask == (Common::KBD_CTRL|Common::KBD_ALT) && !_overlayVisible) {
 				_useNumPad = !_useNumPad;
@@ -310,7 +368,7 @@
 				displayMessageOnOSD(_useNumPad ? "Fight mode on." : "Fight mode off.");
 				return false;
 			}
-			
+
 			// other keys
 			_wasKey = true;
 			event.type = Common::EVENT_KEYDOWN;
@@ -320,7 +378,7 @@
 			return true;
 
 		default:
-			if (_wasKey) {
+			if (_wasKey && ev.eType != keyHoldEvent) {
 				event.type = Common::EVENT_KEYUP;
 				_wasKey = false;
 				return true;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/base_mouse.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -26,22 +26,53 @@
 
 void OSystem_PalmBase::warpMouse(int x, int y) {
 	if (x != _mouseCurState.x || y != _mouseCurState.y) {
+		x = x >= _screenWidth  ? _screenWidth  - 1 : x;
+		y = y >= _screenHeight ? _screenHeight - 1 : y;
+
 		_mouseCurState.x = x;
 		_mouseCurState.y = y;
-		undraw_mouse();
 	}
 }
 
 bool OSystem_PalmBase::showMouse(bool visible) {
-	if (_mouseVisible == visible)
-		return visible;
-	
 	bool last = _mouseVisible;
 	_mouseVisible = visible;
 
 	return last;
 }
 
+void OSystem_PalmBase::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) {
+	if (w == 0 || h == 0)
+		return;
+
+	_mouseHotspotX = hotspotX;
+	_mouseHotspotY = hotspotY;
+
+	_mouseKeyColor = keycolor;
+
+	if (_mouseCurState.w != w || _mouseCurState.h != h) {
+		_mouseCurState.w = w;
+		_mouseCurState.h = h;
+		
+		if (_mouseDataP)
+			free(_mouseDataP);
+		
+		if (_mouseBackupP)
+			free(_mouseBackupP);
+
+		_mouseDataP = (byte *)malloc(w * h);
+		_mouseBackupP = (byte *)malloc(w * h * 2); // if 16bit = *2
+	}
+
+	if (!_mouseBackupP) {
+		free(_mouseDataP);
+		_mouseDataP = NULL;
+	}
+
+	if (_mouseDataP)
+		memcpy(_mouseDataP, buf, w * h);
+}
+
 void OSystem_PalmBase::simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iVert, Coord *xr, Coord *yr) {
 	Int16 x = _mouseCurState.x;
 	Int16 y = _mouseCurState.y;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -1,7 +1,7 @@
 /* ScummVM - Scumm Interpreter
  * Copyright (C) 2001  Ludvig Strigeus
- * Copyright (C) 2001-2006 The ScummVM project
- * Copyright (C) 2002-2006 Chris Apers - PalmOS Backend
+ * Copyright (C) 2001-2007 The ScummVM project
+ * Copyright (C) 2002-2007 Chris Apers - PalmOS Backend
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -64,16 +64,18 @@
 	_mixerMgr = 0;
 	
 	_mouseDataP = NULL;
+	_mouseBackupP = NULL;
 	_mouseVisible = false;
 	_mouseDrawn = false;
-	MemSet(&_keyMouse, sizeof(_keyMouse), 0);
+	MemSet(&_keyExtra, sizeof(_keyExtra), 0);
 	MemSet(&_mouseCurState, sizeof(_mouseCurState), 0);
 	MemSet(&_mouseOldState, sizeof(_mouseOldState), 0);
 	MemSet(&_timer, sizeof(TimerType), 0);
 	MemSet(&_sound, sizeof(SoundType), 0);
 	
-	_keyMouseRepeat = 0;
-	_keyMouseDelay = (gVars->arrowKeys) ? computeMsecs(125) : computeMsecs(25);
+	_keyExtraRepeat = 0;
+	_keyExtraPressed = 0;
+	_keyExtraDelay = (gVars->arrowKeys) ? computeMsecs(125) : computeMsecs(25);
 }
 
 static int timer_handler(int t) {
@@ -86,13 +88,13 @@
 	if (gVars->autoSave != -1)
 		ConfMan.setInt("autosave_period", gVars->autoSave);
 
-	_keyMouse.bitUp		= keyBitPageUp;
-	_keyMouse.bitDown	= keyBitPageDown;
-	_keyMouse.bitLeft	= keyBitHard2;
-	_keyMouse.bitRight	= keyBitHard3;
+	_keyExtra.bitUp		= keyBitPageUp;
+	_keyExtra.bitDown	= keyBitPageDown;
+	_keyExtra.bitLeft	= keyBitHard2;
+	_keyExtra.bitRight	= keyBitHard3;
 
 	int_initBackend();
-	_keyMouseMask = (_keyMouse.bitUp | _keyMouse.bitDown | _keyMouse.bitLeft | _keyMouse.bitRight);
+	_keyExtraMask = (_keyExtra.bitUp | _keyExtra.bitDown | _keyExtra.bitLeft | _keyExtra.bitRight | _keyExtra.bitActionA | _keyExtra.bitActionB);
 
 	// Create the savefile manager, if none exists yet (we check for this to
 	// allow subclasses to provide their own).
@@ -143,7 +145,12 @@
 	int_quit();
 	clearSoundCallback();
 	unload_gfx_mode();
-	
+
+	if (_mouseDataP) {
+		MemPtrFree(_mouseBackupP);
+		MemPtrFree(_mouseDataP);
+	}
+
 	delete _saveMgr;
 	delete _timerMgr;
 	delete _mixerMgr;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_base.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_base.h	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_base.h	2007-05-01 10:12:55 UTC (rev 26699)
@@ -25,9 +25,13 @@
 #ifndef BE_BASE_H
 #define BE_BASE_H
 
+#include "PalmVersion.h"
+#include "globals.h"
+
 #include "common/stdafx.h"
 #include "common/scummsys.h"
 #include "common/system.h"
+#include "common/events.h"
 
 namespace Audio {
 	class Mixer;
@@ -52,6 +56,12 @@
 	kModifierCount
 };
 
+// Mouse button event
+enum {
+	vchrMouseLeft = vchrHardKeyMax - 2,
+	vchrMouseRight = vchrHardKeyMax - 1
+};
+
 // OSD resource id
 #define kDrawKeyState	3000
 #define kDrawNumPad		3010
@@ -94,7 +104,6 @@
 	virtual void draw_mouse() = 0;
 	virtual void undraw_mouse() = 0;
 	
-//	virtual bool check_hard_keys() = 0;
 	virtual bool check_event(Common::Event &event, EventPtr ev) = 0;
 	
 	virtual void timer_handler();
@@ -107,12 +116,10 @@
 	virtual void clearSoundCallback() = 0;
 
 protected:
+	OSystem_PalmBase();
+
 	virtual void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0);
 
-	enum {
-		MAX_MOUSE_W = 80,
-		MAX_MOUSE_H = 80
-	};
 	struct MousePos {
 		int16 x,y,w,h;
 	};
@@ -145,13 +152,15 @@
 	Boolean _overlayVisible;
 	Boolean _redawOSD, _setPalette;
 
-	UInt32 _keyMouseMask, _keyMouseRepeat, _keyMouseDelay;
+	UInt32 _keyExtraMask, _keyExtraPressed, _keyExtraRepeat, _keyExtraDelay;
 	struct {
 		UInt32 bitUp;
 		UInt32 bitDown;
 		UInt32 bitLeft;
 		UInt32 bitRight;
-	} _keyMouse;
+		UInt32 bitActionA;	// left mouse button
+		UInt32 bitActionB;	// right mouse button
+	} _keyExtra;
 	
 	bool _mouseVisible;
 	bool _mouseDrawn;
@@ -163,7 +172,7 @@
 	byte *_mouseDataP, *_mouseBackupP;
 	
 
-	eventsEnum _wasKey;
+	bool _wasKey;
 	UInt8 _lastKeyModifier;
 	UInt32 _lastKeyRepeat;
 	Boolean _useNumPad, _showBatLow;
@@ -172,11 +181,10 @@
 	int _samplesPerSec;
 
 public:
-	OSystem_PalmBase();
 	void initBackend();
 
 /*
-	virtual void setFeatureState(Feature f, bool enable) {}
+	virtual void setFeatureState(Feature f, bool enable) {};
 
 
 	bool hasFeature(Feature f);
@@ -216,7 +224,7 @@
 
 	bool showMouse(bool visible);
 	void warpMouse(int x, int y);
-	virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) = 0;
+	void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale);
 
 	virtual void showOverlay() = 0;
 	virtual void hideOverlay() = 0;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_os5.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -23,11 +23,7 @@
  */
 
 #include "be_os5.h"
-
-#ifndef __TWKEYS_H__
-#include <PalmNavigator.h>
 #include <HsKeyCommon.h>
-#endif
 
 OSystem_PalmOS5::OSystem_PalmOS5() : OSystem_PalmBase() {
 	_sound.active = false;
@@ -78,18 +74,12 @@
 }
 
 void OSystem_PalmOS5::int_initBackend() {
-	if (OPTIONS_TST(kOpt5WayNavigatorV1)) {
-		_keyMouse.bitUp		= keyBitPageUp;
-		_keyMouse.bitDown	= keyBitPageDown;
-		_keyMouse.bitLeft	= keyBitNavLeft;
-		_keyMouse.bitRight	= keyBitNavRight;
-
-	} else if (OPTIONS_TST(kOpt5WayNavigatorV2)) {
-		_keyMouse.bitUp		= keyBitRockerUp|keyBitPageUp;
-		_keyMouse.bitDown	= keyBitRockerDown|keyBitPageDown;
-		_keyMouse.bitLeft	= keyBitRockerLeft;
-		_keyMouse.bitRight	= keyBitRockerRight;
-	}
+	_keyExtra.bitUp		= keyBitRockerUp|keyBitPageUp;
+	_keyExtra.bitDown	= keyBitRockerDown|keyBitPageDown;
+	_keyExtra.bitLeft	= keyBitRockerLeft;
+	_keyExtra.bitRight	= keyBitRockerRight;
+	_keyExtra.bitActionA	= keyBitHard3;
+	_keyExtra.bitActionB	= keyBitHard4;
 }
 
 bool OSystem_PalmOS5::hasFeature(Feature f) {

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_os5.h	2007-05-01 10:12:55 UTC (rev 26699)
@@ -99,6 +99,9 @@
 extern SoundExType _soundEx;
 
 class OSystem_PalmOS5 : public OSystem_PalmBase {
+protected:
+	int16 _nativePal[256], _mousePal[256];
+
 private:
 	uint16 _scaleTableX[512];
 	uint32 _scaleTableY[512];
@@ -108,7 +111,6 @@
 
 	OverlayColor *_overlayP;
 	WinHandle _overlayH, _workScreenH;
-	int16 _nativePal[256], _mousePal[256];
 	int16 *_workScreenP;
 	
 	Boolean _isSwitchable, _wasRotated;
@@ -124,7 +126,7 @@
 	void draw_mouse();
 	void undraw_mouse();
 	virtual bool check_event(Common::Event &event, EventPtr ev);
-	virtual void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b);
+	void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b);
 	void calc_scale();
 
 	void render_landscapeAny(RectangleType &r, PointType &p);
@@ -168,8 +170,7 @@
 	void clearScreen();
 	bool grabRawScreen(Graphics::Surface *surf);
 
-	void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale);
-	virtual void setCursorPalette(const byte *colors, uint start, uint num);
+	void setCursorPalette(const byte *colors, uint start, uint num);
 	void disableCursorPalette(bool disable);
 
 	void showOverlay();
@@ -179,7 +180,7 @@
 	virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
 	virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
 	virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
-
+	
 	void setWindowCaption(const char *caption);
 
 };

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -33,10 +33,13 @@
 }
 
 void OSystem_PalmZodiac::int_initBackend() {
-	_keyMouse.bitUp			= keyBitRockerUp;
-	_keyMouse.bitDown		= keyBitRockerDown;
-	_keyMouse.bitLeft		= keyBitRockerLeft;
-	_keyMouse.bitRight		= keyBitRockerRight;
+	_keyExtra.bitUp			= keyBitRockerUp;
+	_keyExtra.bitDown		= keyBitRockerDown;
+	_keyExtra.bitLeft		= keyBitRockerLeft;
+	_keyExtra.bitRight		= keyBitRockerRight;
+	
+//	_keyExtra.bitActionA	= keyBitActionD;
+//	_keyExtra.bitActionB	= keyBitActionB;
 }
 
 void OSystem_PalmZodiac::calc_rect(Boolean fullscreen) {

Modified: scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/be_zodiac.h	2007-05-01 10:12:55 UTC (rev 26699)
@@ -36,7 +36,6 @@
 	TwGfxType *_gfxH;
 	TwGfxSurfaceType *_palmScreenP, *_tmpScreenP;
 	TwGfxSurfaceType *_overlayP;
-	UInt16 _nativePal[256], _mousePal[256];
 	Boolean _fullscreen;
 	
 	TwGfxPointType _srcPos;
@@ -53,7 +52,6 @@
 	void load_gfx_mode();
 	void hotswap_gfx_mode(int mode);
 
-	void extras_palette(uint8 index, uint8 r, uint8 g, uint8 b);
 	void calc_rect(Boolean fullscreen);
 	bool check_event(Common::Event &event, EventPtr ev);
 	void draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color = 0);
@@ -69,8 +67,6 @@
 
 	void updateScreen();
 
-	void setCursorPalette(const byte *colors, uint start, uint num);
-
 	void clearOverlay();
 	void grabOverlay(OverlayColor *buf, int pitch);
 	void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_event.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -37,19 +37,12 @@
 	}
 }
 
-bool OSystem_PalmOS5::check_event(Event &event, EventPtr ev) {
+bool OSystem_PalmOS5::check_event(Common::Event &event, EventPtr ev) {
 	if (ev->eType == keyUpEvent) {
-		switch (ev->data.keyDown.chr) {
+		switch (ev->data.keyUp.chr) {
 		case vchrHard3:
-			event.type = Common::EVENT_LBUTTONUP;
-			event.mouse.x = _mouseCurState.x;
-			event.mouse.y = _mouseCurState.y;
-			return true;
-
 		case vchrHard4:
-			event.type = Common::EVENT_RBUTTONUP;
-			event.mouse.x = _mouseCurState.x;
-			event.mouse.y = _mouseCurState.y;
+			// will be handled by hard keys
 			return true;
 		}
 
@@ -59,23 +52,24 @@
 		// hot swap gfx
 //	case 0x1B04:
 		case vchrHard1:
-			printf("swap\n");
 			if (OPTIONS_TST(kOptCollapsible))
 				hotswap_gfx_mode(_mode == GFX_WIDE ? GFX_NORMAL: GFX_WIDE);
 			return false; // not a key
 
 //	case 0x1B05:
 		case vchrHard2:
-		setFeatureState(kFeatureAspectRatioCorrection, 0);
-		return false; // not a key
+			setFeatureState(kFeatureAspectRatioCorrection, 0);
+			return false; // not a key
 
 		case vchrHard3:
-			event.type = Common::EVENT_RBUTTONDOWN;
+			_keyExtraPressed |= _keyExtra.bitActionA;
+			event.type = Common::EVENT_LBUTTONDOWN;
 			event.mouse.x = _mouseCurState.x;
 			event.mouse.y = _mouseCurState.y;
 			return true;
 
 		case vchrHard4:
+			_keyExtraPressed |= _keyExtra.bitActionB;
 			event.type = Common::EVENT_RBUTTONDOWN;
 			event.mouse.x = _mouseCurState.x;
 			event.mouse.y = _mouseCurState.y;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_gfx.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_gfx.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -28,11 +28,6 @@
 #include <PenInputMgr.h>
 #include <palmOneResources.h>
 
-#ifdef PALMOS_ARM
-#include <System/WIP.h>
-#include <Libraries/AIA/palmOneStatusBarMgrARM.h>
-#endif
-
 #include "oscalls.h"
 
 void OSystem_PalmOS5::int_initSize(uint w, uint h) {
@@ -63,8 +58,6 @@
 	_ratio.width = (gVars->screenFullHeight * _screenWidth / _screenHeight);
 	_ratio.height = (gVars->screenFullWidth * _screenHeight / _screenWidth);
 
-	_mouseBackupP = (byte *)MemPtrNew(MAX_MOUSE_W * MAX_MOUSE_H * 2); // *2 if 16bit
-	_mouseDataP = (byte *)MemPtrNew(MAX_MOUSE_W * MAX_MOUSE_H);
 	_offScreenP	= (byte *)malloc(_screenWidth * _screenHeight);
 
 	MemSet(_offScreenP, _screenWidth * _screenHeight, 0);
@@ -75,6 +68,11 @@
 	WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
 	clearScreen();
 
+	if (OPTIONS_TST(kOptModeRotatable)) {
+		_sysOldOrientation = __68K(SysGetOrientation());
+		__68K(SysSetOrientation(sysOrientationLandscape));
+	}
+
 	gVars->indicator.on = RGBToColor(0,255,0);
 	gVars->indicator.off = RGBToColor(0,0,0);
 
@@ -97,13 +95,6 @@
 	if (_mode != GFX_NORMAL && !_isSwitchable)
 		return;
 
-#ifdef PALMOS_ARM
-	UInt32 device;
-	Boolean isT3 = false;
-	if (!FtrGet(sysFileCSystem, sysFtrNumOEMDeviceID, &device))
-		isT3 = (device == kPalmOneDeviceIDTungstenT3);
-#endif
-
 	if (_workScreenH)
 		WinDeleteWindow(_workScreenH, false);
 	_workScreenH = NULL;
@@ -117,17 +108,9 @@
 		_stretched = (_screenWidth > gVars->screenWidth);
 
 		if (OPTIONS_TST(kOptCollapsible)) {
-#ifdef PALMOS_ARM
-			if (isT3) {
-				//AiaSetInputAreaState(aiaInputAreaShow);
-				StatShow_68k();
-				PINSetInputAreaState_68k(pinInputAreaOpen);
-			} else
-#endif
-			{
-				StatShow();
-				PINSetInputAreaState(pinInputAreaOpen);
-			}
+			//AiaSetInputAreaState(aiaInputAreaShow); // For T3 ??
+			__68K(StatShow());
+			__68K(PINSetInputAreaState(pinInputAreaOpen));
 		}
 
 		if (_stretched) {
@@ -143,18 +126,10 @@
 		_stretched = true;
 
 		if (OPTIONS_TST(kOptCollapsible)) {
-#ifdef PALMOS_ARM
 			// T3 DIA library is 68k base, there is no possible native call
-			if (isT3) {
-				//AiaSetInputAreaState(aiaInputAreaFullScreen);
-				PINSetInputAreaState_68k(pinInputAreaClosed);
-				StatHide_68k();
-			} else
-#endif
-			{
-				PINSetInputAreaState(pinInputAreaClosed);
-				StatHide();
-			}
+			//AiaSetInputAreaState(aiaInputAreaFullScreen);
+			__68K(PINSetInputAreaState(pinInputAreaClosed));
+			__68K(StatHide());
 		}
 
 		calc_rect(true);
@@ -182,8 +157,7 @@
 		return;	
 	_gfxLoaded = false;
 	
-	MemPtrFree(_mouseBackupP);
-	MemPtrFree(_mouseDataP);
+	// mouse data freed in quit()
 	free(_offScreenP);
 
 	if (_workScreenH)
@@ -198,6 +172,9 @@
 	WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
 	clearScreen();
 
+	if (OPTIONS_TST(kOptModeRotatable))
+		__68K(SysSetOrientation(_sysOldOrientation));
+
 	WinSetCoordinateSystem(_sysOldCoord);
 }
 

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_mouse.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -37,130 +37,86 @@
 	_cursorPaletteDisabled = disable;
 }
 
-void OSystem_PalmOS5::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) {
-	if (w == 0 || h == 0)
-		return;
-
-FIXME: The restriction on MAX_MOUSE_H / MAX_MOUSE_W is obsolete;
-in particular, BS2 might use bigger cursors these days.
-See also bug #1609058. 1607180
-Hence this code now might overwrite memory unchecked; at the
-very least an assert should be inserted to cause a controlled
-crash, but of course it would be better to remove the restriction
-on "small" cursors.
-
-
-	_mouseCurState.w = w;
-	_mouseCurState.h = h;
-
-	_mouseHotspotX = hotspotX;
-	_mouseHotspotY = hotspotY;
-
-	_mouseKeyColor = keycolor;
-
-	// copy new cursor
-	byte *dst = _mouseDataP;
-	memset(dst, MAX_MOUSE_W * MAX_MOUSE_H, keycolor);
-	while (h--) {
-		memcpy(dst, buf, w);
-		dst += MAX_MOUSE_W;
-		buf += w;
-	}
-}
-
+// TODO: this code is almost the same as Zodiac version.
 void OSystem_PalmOS5::draw_mouse() {
-	if (_mouseDrawn || !_mouseVisible)
+	if (!_mouseDataP || _mouseDrawn || !_mouseVisible)
 		return;
+	
+	byte *src = _mouseDataP;
 
-	byte *src = _mouseDataP;		// Image representing the mouse
-	byte color;
-	int width;
-
-	_mouseCurState.y = _mouseCurState.y >= _screenHeight ? _screenHeight - 1 : _mouseCurState.y;
-
 	int x = _mouseCurState.x - _mouseHotspotX;
 	int y = _mouseCurState.y - _mouseHotspotY;
 	int w = _mouseCurState.w;
 	int h = _mouseCurState.h;
 
-	int draw_x = x;
-	int draw_y = y;
-
 	// clip the mouse rect
-	if (x < 0) {
-		w += x;
-		src -= x;
-		x = 0;
-	}
 	if (y < 0) {
+		src -= y * w;
 		h += y;
-		src -= y * MAX_MOUSE_W;
 		y = 0;
 	}
-	if (w > _screenWidth - x)
-		w = _screenWidth - x;
+	if (x < 0) {
+		src -= x;
+		w += x;
+		x = 0;
+	}
+
 	if (h > _screenHeight - y)
 		h = _screenHeight - y;
+	if (w > _screenWidth - x)
+		w = _screenWidth - x;
 
-	// Quick check to see if anything has to be drawn at all
 	if (w <= 0 || h <= 0)
 		return;
 
-	// Store the bounding box so that undraw mouse can restore the area the
-	// mouse currently covers to its original content.
+	// store the bounding box so that undraw mouse can restore the area the
+	// mouse currently covers to its original content
 	_mouseOldState.x = x;
 	_mouseOldState.y = y;
 	_mouseOldState.w = w;
 	_mouseOldState.h = h;
 
-	// Quick check to see if anything has to be drawn at all
-	if (w <= 0 || h <= 0)
-		return;
+	byte color;
+	int ww;
 
-	// Store the bounding box so that undraw mouse can restore the area the
-	// mouse currently covers to its original content.
-	_mouseOldState.x = x;
-	_mouseOldState.y = y;
-	_mouseOldState.w = w;
-	_mouseOldState.h = h;
-
-	// Backup the covered area draw the mouse cursor
 	if (_overlayVisible) {
-		int16 *bak = (int16 *)_mouseBackupP;			// Surface used to backup the area obscured by the mouse
-		int16 *dst = _overlayP + y * _screenWidth + x;
+		int16 *bak = (int16 *)_mouseBackupP;
 		int16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal;
+		int16 *dst = _overlayP + y * _screenWidth + x;
 
 		do {
-			width = w;
+			ww = w;
 			do {
 				*bak++ = *dst;
 				color = *src++;
-				if (color != _mouseKeyColor)	// transparent, don't draw
+
+				// transparent, don't draw
+				if (color != _mouseKeyColor)
 					*dst = pal[color];
 				dst++;
-			} while (--width);
+			} while (--ww);
 
-			src += MAX_MOUSE_W - w;
-			bak += MAX_MOUSE_W - w;
+			src += _mouseCurState.w - w;
 			dst += _screenWidth - w;
 		} while (--h);
 
 	} else {
-		byte *bak = _mouseBackupP;						// Surface used to backup the area obscured by the mouse
-		byte *dst =_offScreenP + y * _screenWidth + x;	// Surface we are drawing into
+		byte *bak = _mouseBackupP;
+		byte *dst =_offScreenP + y * _screenWidth + x;
 
 		do {
-			width = w;
+			ww = w;
 			do {
 				*bak++ = *dst;
 				color = *src++;
-				if (color != _mouseKeyColor)	// transparent, don't draw
+
+				// transparent, don't draw
+				if (color != _mouseKeyColor)
 					*dst = color;
 				dst++;
-			} while (--width);
+			} while (--ww);
 
-			src += MAX_MOUSE_W - w;
-			bak += MAX_MOUSE_W - w;
+			src += _mouseCurState.w - w;
 			dst += _screenWidth - w;
 		} while (--h);
 	}
@@ -173,27 +129,28 @@
 		return;
 
 	int h = _mouseOldState.h;
-	// No need to do clipping here, since draw_mouse() did that already
+
+	// no need to do clipping here, since draw_mouse() did that already
 	if (_overlayVisible) {
-		int16 *bak = (int16 *)_mouseBackupP;
 		int16 *dst = _overlayP + _mouseOldState.y * _screenWidth + _mouseOldState.x;
+		int16 *bak = (int16 *)_mouseBackupP;
 
 		do {
-			memcpy(dst, bak, _mouseOldState.w * 2);
-			bak += MAX_MOUSE_W;
+			MemMove(dst, bak, _mouseOldState.w * 2);
 			dst += _screenWidth;
+			bak += _mouseOldState.w;
 		} while (--h);
 
 	} else {
-		byte *dst, *bak = _mouseBackupP;
-		dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x;
+		byte *dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x;
+		byte *bak = _mouseBackupP;
 		
 		do {
-			memcpy(dst, bak, _mouseOldState.w);
-			bak += MAX_MOUSE_W;
+			MemMove(dst, bak, _mouseOldState.w);
 			dst += _screenWidth;
+			bak +=  _mouseOldState.w;
 		} while (--h);
 	}
 
 	_mouseDrawn = false;
-}
+}
\ No newline at end of file

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_overlay.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_overlay.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_overlay.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -31,7 +31,7 @@
 
 	undraw_mouse();
 	_overlayVisible = true;
-	clearOverlay();	
+	clearOverlay();
 }
 
 void OSystem_PalmOS5::hideOverlay() {

Modified: scummvm/trunk/backends/platform/PalmOS/Src/os5_sound.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/os5_sound.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/os5_sound.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -134,7 +134,7 @@
 		}
 
 		if (_soundEx.dataP)
-			free(_soundEx.dataP);
+			MemPtrFree(_soundEx.dataP);
 	}
 
 	_sound.active = false;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/zodiac_gfx.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/zodiac_gfx.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/zodiac_gfx.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -56,11 +56,9 @@
 	_ratio.adjustAspect = ConfMan.getBool("aspect_ratio") ? kRatioHeight : kRatioNone;
 
 	// precalc ratio (WIDE mode)
-	_ratio.width = ((float)_screenWidth / _screenHeight * gVars->screenFullHeight);
-	_ratio.height = ((float)_screenHeight / _screenWidth * gVars->screenFullWidth);
+	_ratio.width = (gVars->screenFullHeight * _screenWidth / _screenHeight);
+	_ratio.height = (gVars->screenFullWidth * _screenHeight / _screenWidth);
 
-	_mouseBackupP = (byte *)MemPtrNew(MAX_MOUSE_W * MAX_MOUSE_H * 2); // *2 if 16bit
-	_mouseDataP = (byte *)MemPtrNew(MAX_MOUSE_W * MAX_MOUSE_H);
 	_offScreenP = (byte *)MemPtrNew(_screenWidth * _screenHeight);
 
 	MemSet(_offScreenP, _screenWidth * _screenHeight, 0);
@@ -98,7 +96,7 @@
 	_srcBmp.rowBytes = _screenWidth;
 	_srcBmp.pixelFormat = twGfxPixelFormat8bpp;
 	_srcBmp.data = _offScreenP;
-	_srcBmp.palette = _nativePal;
+	_srcBmp.palette = (UInt16 *)_nativePal;
 
 	_srcRect.x = 0;
 	_srcRect.y = 0;
@@ -192,8 +190,6 @@
 	WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
 	clearScreen();
 
-	MemPtrFree(_mouseBackupP);
-	MemPtrFree(_mouseDataP);
 	MemPtrFree(_offScreenP);
 
 	SysSetOrientation(_sysOldOrientation);
@@ -217,7 +213,8 @@
 	Err e;
 
 	// draw the mouse pointer
-	draw_mouse();		
+	draw_mouse();
+
 	// update the screen
 	if (_overlayVisible) {
 		if (_stretched) {
@@ -247,6 +244,7 @@
 				dst.y += _new_shake_pos;
 			}
 			e = TwGfxDrawBitmap(_tmpScreenP, &pos, &_srcBmp);
+			e = TwGfxWaitForVBlank(_gfxH);
 			e = TwGfxStretchBlt2(_palmScreenP, &dst, _tmpScreenP, &_srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0)); 
 			
 		} else {
@@ -264,13 +262,11 @@
 			e = TwGfxDrawBitmap(_palmScreenP, &pos, &_srcBmp);
 		}
 	}
+	
+	// undraw the mouse
 	undraw_mouse();
 }
 
-void OSystem_PalmZodiac::extras_palette(uint8 index, uint8 r, uint8 g, uint8 b) {
-	_nativePal[index] = TwGfxMakeDisplayRGB(r, g, b);
-}
-
 void OSystem_PalmZodiac::draw_osd(UInt16 id, Int32 x, Int32 y, Boolean show, UInt8 color) {
 	if (_mode != GFX_NORMAL)
 		return;

Modified: scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/zodiac_mouse.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -24,100 +24,90 @@
 
 #include "be_zodiac.h"
 
-void OSystem_PalmZodiac::setCursorPalette(const byte *colors, uint start, uint num) {
-	for(uint i = 0; i < num; i++) {
-		_mousePal[i + start] = TwGfxMakeDisplayRGB(colors[0], colors[1], colors[2]);
-		colors += 4;
-	}
-	_cursorPaletteDisabled = false;
-}
-
 void OSystem_PalmZodiac::draw_mouse() {
-	if (_mouseDrawn || !_mouseVisible)
+	if (!_mouseDataP || _mouseDrawn || !_mouseVisible)
 		return;
+	
+	byte *src = _mouseDataP;
 
-	byte *src = _mouseDataP;		// Image representing the mouse
-	byte color;
-	int width;
-
-	_mouseCurState.y = _mouseCurState.y >= _screenHeight ? _screenHeight - 1 : _mouseCurState.y;
-
 	int x = _mouseCurState.x - _mouseHotspotX;
 	int y = _mouseCurState.y - _mouseHotspotY;
 	int w = _mouseCurState.w;
 	int h = _mouseCurState.h;
 
-	int draw_x = x;
-	int draw_y = y;
-
 	// clip the mouse rect
-	if (x < 0) {
-		w += x;
-		src -= x;
-		x = 0;
-	}
 	if (y < 0) {
+		src -= y * w;
 		h += y;
-		src -= y * MAX_MOUSE_W;
 		y = 0;
 	}
-	if (w > _screenWidth - x)
-		w = _screenWidth - x;
+	if (x < 0) {
+		src -= x;
+		w += x;
+		x = 0;
+	}
+
 	if (h > _screenHeight - y)
 		h = _screenHeight - y;
+	if (w > _screenWidth - x)
+		w = _screenWidth - x;
 
-	// Quick check to see if anything has to be drawn at all
 	if (w <= 0 || h <= 0)
 		return;
 
-	// Store the bounding box so that undraw mouse can restore the area the
-	// mouse currently covers to its original content.
+	// store the bounding box so that undraw mouse can restore the area the
+	// mouse currently covers to its original content
 	_mouseOldState.x = x;
 	_mouseOldState.y = y;
 	_mouseOldState.w = w;
 	_mouseOldState.h = h;
 
-	// Backup the covered area draw the mouse cursor
+	byte color;
+	int ww;
+
 	if (_overlayVisible) {
-		uint16 *bak = (uint16 *)_mouseBackupP;			// Surface used to backup the area obscured by the mouse
-		uint16 *dst, *pal = _cursorPaletteDisabled ? _nativePal : _mousePal;
+		int16 *bak = (int16 *)_mouseBackupP;
+		int16 *pal = _cursorPaletteDisabled ? _nativePal : _mousePal;
+		int16 *dst;
 
 		TwGfxLockSurface(_overlayP, (void **)&dst);
 		dst += y * _screenWidth + x;
 
 		do {
-			width = w;
+			ww = w;
 			do {
 				*bak++ = *dst;
 				color = *src++;
-				if (color != _mouseKeyColor)	// transparent, don't draw
+
+				// transparent, don't draw
+				if (color != _mouseKeyColor)
 					*dst = pal[color];
 				dst++;
-			} while (--width);
+			} while (--ww);
 
-			src += MAX_MOUSE_W - w;
-			bak += MAX_MOUSE_W - w;
+			src += _mouseCurState.w - w;
 			dst += _screenWidth - w;
 		} while (--h);
 
 		TwGfxUnlockSurface(_overlayP, true);
 
 	} else {
-		byte *bak = _mouseBackupP;						// Surface used to backup the area obscured by the mouse
-		byte *dst =_offScreenP + y * _screenWidth + x;	// Surface we are drawing into
+		byte *bak = _mouseBackupP;
+		byte *dst =_offScreenP + y * _screenWidth + x;
 
 		do {
-			width = w;
+			ww = w;
 			do {
 				*bak++ = *dst;
 				color = *src++;
-				if (color != _mouseKeyColor)	// transparent, don't draw
+
+				// transparent, don't draw
+				if (color != _mouseKeyColor)
 					*dst = color;
 				dst++;
-			} while (--width);
+			} while (--ww);
 
-			src += MAX_MOUSE_W - w;
-			bak += MAX_MOUSE_W - w;
+			src += _mouseCurState.w - w;
 			dst += _screenWidth - w;
 		} while (--h);
 	}
@@ -130,30 +120,31 @@
 		return;
 
 	int h = _mouseOldState.h;
-	// No need to do clipping here, since draw_mouse() did that already
+
+	// no need to do clipping here, since draw_mouse() did that already
 	if (_overlayVisible) {
-		uint16 *bak = (uint16 *)_mouseBackupP;
 		uint16 *dst;
+		uint16 *bak = (uint16 *)_mouseBackupP;
 
 		TwGfxLockSurface(_overlayP, (void **)&dst);
 		dst += _mouseOldState.y * _screenWidth + _mouseOldState.x;
 
 		do {
-			memcpy(dst, bak, _mouseOldState.w * 2);
-			bak += MAX_MOUSE_W;
+			MemMove(dst, bak, _mouseOldState.w * 2);
 			dst += _screenWidth;
+			bak += _mouseOldState.w;
 		} while (--h);
 
 		TwGfxUnlockSurface(_overlayP, true);
 
 	} else {
-		byte *dst, *bak = _mouseBackupP;
-		dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x;
-		
+		byte *dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x;
+		byte *bak = _mouseBackupP;
+
 		do {
-			memcpy(dst, bak, _mouseOldState.w);
-			bak += MAX_MOUSE_W;
+			MemMove(dst, bak, _mouseOldState.w);
 			dst += _screenWidth;
+			bak +=  _mouseOldState.w;
 		} while (--h);
 	}
 

Modified: scummvm/trunk/backends/platform/PalmOS/Src/zodiac_overlay.cpp
===================================================================
--- scummvm/trunk/backends/platform/PalmOS/Src/zodiac_overlay.cpp	2007-05-01 09:58:44 UTC (rev 26698)
+++ scummvm/trunk/backends/platform/PalmOS/Src/zodiac_overlay.cpp	2007-05-01 10:12:55 UTC (rev 26699)
@@ -34,7 +34,7 @@
 	TwGfxBitmapType bmp = {
 		sizeof(TwGfxBitmapType),
 		_screenWidth, _screenHeight, _screenWidth, twGfxPixelFormat8bpp,
-		(void *)_offScreenP, _nativePal
+		(void *)_offScreenP, (UInt16 *)_nativePal
 	};
 	e = TwGfxDrawBitmap(_overlayP, &pos, &bmp);
 }


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