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

chrilith at users.sourceforge.net chrilith at users.sourceforge.net
Sun Feb 12 11:48:04 CET 2006


Revision: 20653
Author:   chrilith
Date:     2006-02-12 11:47:30 -0800 (Sun, 12 Feb 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=20653&view=rev

Log Message:
-----------
- Fixed bug #1329844, autooff not reset on exit
- Splitted AppStartCheckScreenSize from app.cpp rev19461, here is the palm standard one : PalmScreenSize
- Move PalmGetMemory here from file forminfo.cpp rev18604

ViewCVS Links:
-------------
    http://svn.sourceforge.net/scummvm?rev=19461&view=rev
    http://svn.sourceforge.net/scummvm?rev=18604&view=rev

Modified Paths:
--------------
    scummvm/trunk/backends/PalmOS/Src/init_palmos.cpp
    scummvm/trunk/backends/PalmOS/Src/init_palmos.h
Modified: scummvm/trunk/backends/PalmOS/Src/init_palmos.cpp
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/init_palmos.cpp	2006-02-12 19:38:26 UTC (rev 20652)
+++ scummvm/trunk/backends/PalmOS/Src/init_palmos.cpp	2006-02-12 19:47:30 UTC (rev 20653)
@@ -1,3 +1,27 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001  Ludvig Strigeus
+ * Copyright (C) 2001-2006 The ScummVM project
+ * Copyright (C) 2002-2006 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
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
 #include <PalmOS.h>
 
 #include "globals.h"
@@ -18,8 +42,10 @@
 }
 
 void PalmRelease(UInt8 init) {
-	SysSetAutoOffTime(autoOffDelay);
-	EvtResetAutoOffTimer();
+	if (init & INIT_AUTOOFF) {
+		SysSetAutoOffTime(autoOffDelay);
+		EvtResetAutoOffTimer();
+	}
 }
 
 Err PalmHRInit(UInt32 depth) {
@@ -42,3 +68,104 @@
 void PalmHRRelease() {
 	// should i do something here ?
 }
+
+UInt8 PalmScreenSize(Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh) {
+	UInt32 ftr;
+	UInt8 mode = 0;
+
+	Coord sw = 160;
+	Coord sh = 160;	
+
+	// Hi-Density present ?
+	if (!FtrGet(sysFtrCreator, sysFtrNumWinVersion, &ftr)) {
+		if (ftr >= 4) {
+			sw = 320;
+			sh = 320;
+		}
+	}
+
+	Coord fw = sw;
+	Coord fh = sh;
+
+	// if feature set, not set on Garmin iQue3600 ???
+	if (!(FtrGet(sysFtrCreator, sysFtrNumInputAreaFlags, &ftr))) {
+		if (ftr & grfFtrInputAreaFlagCollapsible) {
+			UInt16 curOrientation = SysGetOrientation();
+
+			if (curOrientation == sysOrientationLandscape ||
+				curOrientation == sysOrientationReverseLandscape
+					)
+				mode = PALM_LANDSCAPE;
+			else
+				mode = PALM_PORTRAIT;
+
+			PINSetInputTriggerState(pinInputTriggerEnabled);
+			PINSetInputAreaState(pinInputAreaClosed);
+			StatHide();
+
+			WinGetDisplayExtent(&fw, &fh);
+			fw *= 2;
+			fh *= 2;
+
+			StatShow();
+			PINSetInputAreaState(pinInputAreaOpen);
+			PINSetInputTriggerState(pinInputTriggerDisabled);
+		}
+	}
+
+	if (stdw) *stdw = sw;
+	if (stdh) *stdh = sh;
+	if (fullw) *fullw = fw;
+	if (fullh) *fullh = fh;
+
+	return mode;
+}
+
+void PalmGetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFreeP, UInt32 *dynamicFreeP) {
+	UInt32		free, max;
+
+	Int16		i;
+	Int16		nCards;
+	UInt16		cardNo;
+	UInt16		heapID;
+
+	UInt32		storageMemory = 0;
+	UInt32		dynamicMemory = 0;
+	UInt32		storageFree = 0;
+	UInt32		dynamicFree = 0;
+
+	// Iterate through each card to support devices with multiple cards.
+	nCards = MemNumCards();		
+
+	for (cardNo = 0; cardNo < nCards; cardNo++) {
+		// Iterate through the RAM heaps on a card (excludes ROM).
+		for (i=0; i< MemNumRAMHeaps(cardNo); i++) {
+			// Obtain the ID of the heap.
+			heapID = MemHeapID(cardNo, i);
+			// Calculate the total memory and free memory of the heap.
+			MemHeapFreeBytes(heapID, &free, &max);
+
+			// If the heap is dynamic, increment the dynamic memory total.
+			if (MemHeapDynamic(heapID)) {
+				dynamicMemory += MemHeapSize(heapID);
+				dynamicFree += free;
+
+			// The heap is nondynamic (storage ?).
+			} else {
+				storageMemory += MemHeapSize(heapID);
+				storageFree += free;
+			}
+		}
+	}
+	// Reduce the stats to KB.  Round the results.
+	dynamicMemory = dynamicMemory / 1024L;
+	storageMemory = storageMemory / 1024L;
+
+	dynamicFree = dynamicFree / 1024L;
+	storageFree = storageFree / 1024L;
+
+	if (dynamicMemoryP) *dynamicMemoryP = dynamicMemory;
+	if (storageMemoryP) *storageMemoryP = storageMemory;
+	if (dynamicFreeP) *dynamicFreeP = dynamicFree;
+	if (storageFreeP) *storageFreeP = storageFree;
+}

Modified: scummvm/trunk/backends/PalmOS/Src/init_palmos.h
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/init_palmos.h	2006-02-12 19:38:26 UTC (rev 20652)
+++ scummvm/trunk/backends/PalmOS/Src/init_palmos.h	2006-02-12 19:47:30 UTC (rev 20653)
@@ -1,10 +1,41 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001  Ludvig Strigeus
+ * Copyright (C) 2001-2006 The ScummVM project
+ * Copyright (C) 2002-2006 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
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
 #ifndef INIT_PALMOS_H
 #define INIT_PALMOS_H
 
+#define PALM_PORTRAIT 	1
+#define PALM_LANDSCAPE	2
+
 void PalmInit(UInt8 init);
 void PalmRelease(UInt8 init);
 
 Err PalmHRInit(UInt32 depth);
 void PalmHRRelease();
 
-#endif
+
+UInt8 PalmScreenSize(Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh);
+void PalmGetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *storageFreeP, UInt32 *dynamicFreeP);
+
+#endif
\ No newline at end of file







More information about the Scummvm-git-logs mailing list