diff options
author | Chris Apers | 2003-12-02 11:14:17 +0000 |
---|---|---|
committer | Chris Apers | 2003-12-02 11:14:17 +0000 |
commit | 182285508d04ac581bd5255c8df17db6a30b6ef0 (patch) | |
tree | 0da52794841b273013679ee22810b2d69563e7be /backends/PalmOS/Src/app.cpp | |
parent | 3c3ca2b2bdde8491ffd4992b7675f071f50926c6 (diff) | |
download | scummvm-rg350-182285508d04ac581bd5255c8df17db6a30b6ef0.tar.gz scummvm-rg350-182285508d04ac581bd5255c8df17db6a30b6ef0.tar.bz2 scummvm-rg350-182285508d04ac581bd5255c8df17db6a30b6ef0.zip |
Added memory auto-configuration
svn-id: r11471
Diffstat (limited to 'backends/PalmOS/Src/app.cpp')
-rw-r--r-- | backends/PalmOS/Src/app.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/backends/PalmOS/Src/app.cpp b/backends/PalmOS/Src/app.cpp index 7932507e13..46cc06570d 100644 --- a/backends/PalmOS/Src/app.cpp +++ b/backends/PalmOS/Src/app.cpp @@ -289,6 +289,39 @@ static void AppStopSilk() { 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 @@ Err AppStart(void) { gVars->skinSet = false; gVars->options = optNone; + // OS5 ? if (!FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion)) gVars->options |= ((romVersion >= kOS5Version) ? optIsOS5Device : 0); @@ -373,6 +407,8 @@ Err AppStart(void) { AppStartCheckNotify(); // not fatal error if not avalaible AppStartCheckScreenSize(); + AppStartSetMemory(); // set memory required by the differents engines + return error; } |