[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src palm.cpp,1.36,1.37

Chris Apers chrilith at users.sourceforge.net
Sun Sep 12 06:16:04 CEST 2004


Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5432

Modified Files:
	palm.cpp 
Log Message:
- Pocket Tunes support
- new mouse emu code
- setWindowCaption fix
- get rid of _quitCount and selfQuit
- clean up

Index: palm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/palm.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- palm.cpp	25 May 2004 14:42:13 -0000	1.36
+++ palm.cpp	12 Sep 2004 13:15:17 -0000	1.37
@@ -27,6 +27,12 @@
 
 #include "cd_msa.h"
 #include "cd_default.h"
+#include "cd_pockettunes.h"
+
+#include <PalmNavigator.h>
+#ifndef DISABLE_TAPWAVE
+#include <TwChars.h>
+#endif
 
 OSystem *OSystem_PALMOS_create() {
 	return OSystem_PALMOS::create();
@@ -49,6 +55,7 @@
 
 	do {
 		timer_handler(current);
+		sound_handler();
 		current = get_msecs();
 	} while (current < last);
 }
@@ -106,13 +113,12 @@
 	Coord h = FntLineHeight() + 2;
 	Coord w, y;
 
-	// quick erase the screen
-	WinScreenLock(winLockErase);
-	WinScreenUnlock();
-	
+	WinSetBackColor(0);
 	WinSetTextColor(255);
-	WinSetForeColor(255);
 
+	// erase the screen
+	WinEraseWindow();
+	
 	if (_useHRmode) {
 		y = 160 - (h >> 1) - 10;
 		HRFntSetFont(gVars->HRrefNum,hrTinyBoldFont);
@@ -126,14 +132,22 @@
 		HRWinDrawChars(gVars->HRrefNum, caption, StrLen(caption), w, y);
 	} else {
 		Err e;
+		UInt16 size = 1;
+
+		if (OPTIONS_TST(kOptModeHiDensity))
+			if (WinGetCoordinateSystem() == kCoordinatesNative) {
+				size = 2;
+				h = (h - 2) / 2 + 2;
+			}
+		
 		BitmapTypeV3 *bmp2P;
 		BitmapType *bmp1P = BmpCreate(320, (h << 1), 8, NULL, &e);
 		WinHandle tmpH = WinCreateBitmapWindow(bmp1P, &e);
 
 		WinSetDrawWindow(tmpH);
+		WinEraseWindow();
 
 		FntSetFont(boldFont);
-		y = 80 - (h >> 2) - 5;
 		w = FntCharsWidth(loading, StrLen(loading));
 		w = (320 - w) >> 1;
 		WinDrawChars(loading, StrLen(loading), w, 0 + h);
@@ -145,6 +159,7 @@
 
 		WinSetDrawWindow(WinGetDisplayWindow());
 		bmp2P = BmpCreateBitmapV3(bmp1P, kDensityDouble, BmpGetBits(bmp1P), NULL);
+		y = (80 - (h >> 2) - 5) * size;
 		WinDrawBitmap((BitmapPtr)bmp2P, 0, y);
 
 		BmpDelete((BitmapPtr)bmp2P);
@@ -187,39 +202,22 @@
 }
 
 void OSystem_PALMOS::quit() {
-	// There is no exit(.) function under PalmOS, to exit an app
-	// we need to send an 'exit' event to the event handler
-	// and then the system return to the launcher. But this event
-	// is not handled by the main loop and so we need to force exit.
-	// In other systems like Windows ScummVM exit immediatly and so this doesn't appear.
-
-	if (_quitCount)
-		return;
-
-#ifndef DISABLE_SCUMM
-	if (_selfQuit && Scumm::g_scumm)
-		Scumm::g_scumm->_quit = true;
-#endif
-
 	free(_currentPalette);
 	free(_mouseBackupP);
 	free(_mouseDataP);
 	
-	_PnoFree(&_arm[PNO_COPY].pnoDesc, _arm[PNO_COPY].pnoPtr);
-
 	if (_cdPlayer) {
 		_cdPlayer->release();
 		_cdPlayer = NULL;
 	}
 
 	unload_gfx_mode();
-	_quitCount++;
-	exit(1);
+	clearSoundCallback();
+
+	exit(0);
 }
 
 OSystem_PALMOS::OSystem_PALMOS() {
-	_quitCount = 0;
-	_selfQuit = false; // prevent illegal access to g_scumm
 	_current_shake_pos = 0;
 	_new_shake_pos = 0;
 
@@ -257,9 +255,22 @@
 	// HiRes
 	_useHRmode	= (gVars->HRrefNum != sysInvalidRefNum);
 	
-	// ARM
-	memset(_arm, 0, sizeof(_arm));
-	_arm[PNO_COPY].pnoPtr = _PnoInit(ARM_OCOPYRECT, &_arm[PNO_COPY].pnoDesc);
+	// mouse emu
+	// TODO : add UX50 arrow keys
+	if (OPTIONS_TST(kOpt5WayNavigator)) {
+		_keyMouse.bitUp		= keyBitPageUp;
+		_keyMouse.bitDown	= keyBitPageDown;
+		_keyMouse.bitLeft	= keyBitNavLeft;
+		_keyMouse.bitRight	= keyBitNavRight;
+		_keyMouse.bitButLeft= keyBitNavSelect;
+	} else {
+		_keyMouse.bitUp		= keyBitPageUp;
+		_keyMouse.bitDown	= keyBitPageDown;
+		_keyMouse.bitLeft	= keyBitHard1;
+		_keyMouse.bitRight	= keyBitHard2;
+		_keyMouse.bitButLeft= keyBitHard3|0x00100000; // keyBitRockerCenter on TwKeys.h but conflict with palmnavigator.h
+	}
+	_keyMask = (_keyMouse.bitUp | _keyMouse.bitDown | _keyMouse.bitLeft | _keyMouse.bitRight | _keyMouse.bitButLeft);
 	
 	// enable cdrom ?
 	_cdPlayer = NULL;
@@ -271,6 +282,9 @@
 			case 1:	// MSA Library
 				_cdPlayer = new MsaCDPlayer(this);
 				break;
+			case 2:	// Pocket Tunes API
+				_cdPlayer = new PckTunesCDPlayer(this);
+				break;
 		}
 		
 		if (_cdPlayer) {
@@ -283,9 +297,6 @@
 	
 	// sound
 	memset(&_sound,0,sizeof(SoundDataType));
-
-	// init
-	_vibrate = gVars->vibrator;
 }
 
 void ClearScreen() {





More information about the Scummvm-git-logs mailing list