[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src app.cpp,1.2,1.3 globals.h,1.8,1.9

Chris Apers chrilith at users.sourceforge.net
Tue Dec 2 03:15:04 CET 2003


Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src
In directory sc8-pr-cvs1:/tmp/cvs-serv23392

Modified Files:
	app.cpp globals.h 
Log Message:
Added memory auto-configuration

Index: app.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/app.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- app.cpp	28 Nov 2003 09:18:32 -0000	1.2
+++ app.cpp	2 Dec 2003 11:14:17 -0000	1.3
@@ -289,6 +289,39 @@
 		SilkLibClose(gVars->slkRefNum);
 }
 
+#define max(id,value)	gVars->memory[id] = (gVars->memory[id] < value ? value : gVars->memory[id])
+#define min(id,value)	gVars->memory[id] = (gVars->memory[id] > value ? value : gVars->memory[id])
+#define threshold 		500
+
+static void AppStartSetMemory() {
+	UInt32 mem, def;
+	GetMemory(0,0,0,&mem);
+	def = (mem > threshold) ? (mem - threshold) * 1024 : 0;
+
+	// default values
+	gVars->memory[kMemScummOldCostGames] = (mem >= 550 + threshold) ? 550000 : def;
+	gVars->memory[kMemScummNewCostGames] = (mem >= 2500 + threshold) ? 2500000 : def;
+	gVars->memory[kMemSimon1Games] = (mem >= 1000 + threshold) ? 1000000 : def;
+	gVars->memory[kMemSimon2Games] = (mem >= 2000 + threshold) ? 2000000 : def;
+
+	// set min required values
+	max(kMemScummOldCostGames, 450000);
+	max(kMemScummNewCostGames, 450000);
+	max(kMemSimon1Games, 500000);
+	max(kMemSimon2Games, 500000);
+
+	// set max required values
+	min(kMemScummOldCostGames, 550000);
+	min(kMemScummNewCostGames, 2500000);
+	min(kMemSimon1Games, 1000000);
+	min(kMemSimon2Games, 2000000);
+	
+}
+
+#undef threshold
+#undef min
+#undef max
+
 Err AppStart(void) {
 	UInt16 dataSize, checkSize = 0;
 	UInt32 ulProcessorType;
@@ -308,6 +341,7 @@
 	gVars->skinSet = false;
 	gVars->options = optNone;
 
+
 	// OS5 ?
 	if (!FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion))
 		gVars->options |= ((romVersion >= kOS5Version) ? optIsOS5Device : 0);
@@ -373,6 +407,8 @@
 
 	AppStartCheckNotify(); // not fatal error if not avalaible
 	AppStartCheckScreenSize();
+	AppStartSetMemory();	// set memory required by the differents engines
+
 
 	return error;
 }

Index: globals.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/globals.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- globals.h	28 Nov 2003 09:24:35 -0000	1.8
+++ globals.h	2 Dec 2003 11:14:17 -0000	1.9
@@ -39,8 +39,18 @@
 	optHas16BitMode			=	1 <<	8,
 };
 
+enum {
+	kMemScummOldCostGames = 0,
+	kMemScummNewCostGames,
+	kMemSimon1Games,	
+	kMemSimon2Games,
+
+	kMemGamesCount
+};
+
 typedef struct {
 	DmOpenRef globals[GBVARS_COUNT];
+	UInt32 memory[kMemGamesCount];
 
 	UInt32 options;
 





More information about the Scummvm-git-logs mailing list