diff options
author | Travis Howell | 2006-10-05 01:17:59 +0000 |
---|---|---|
committer | Travis Howell | 2006-10-05 01:17:59 +0000 |
commit | 5fe35cbe9aa7f09bbf05c9d852b51537cdb39733 (patch) | |
tree | 9fe2dfa600ada222f9e136fc217bb2a075e66107 /engines | |
parent | b18fdb4c0a146dada1f4e33ca8e7d285e794156d (diff) | |
download | scummvm-rg350-5fe35cbe9aa7f09bbf05c9d852b51537cdb39733.tar.gz scummvm-rg350-5fe35cbe9aa7f09bbf05c9d852b51537cdb39733.tar.bz2 scummvm-rg350-5fe35cbe9aa7f09bbf05c9d852b51537cdb39733.zip |
Reduce memory required by each game, and add safety checks
svn-id: r24118
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agos/agos.cpp | 25 | ||||
-rw-r--r-- | engines/agos/agos.h | 12 |
2 files changed, 27 insertions, 10 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index a62dc86cee..ed33787f6c 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -548,6 +548,7 @@ void AGOSEngine::setupGame() { #else _vgaMemSize = gVars->memory[kMemSimon2Games]; #endif + _itemMemSize = 20000; _tableMemSize = 200000; _frameRate = 1; _vgaBaseDelay = 5; @@ -561,6 +562,7 @@ void AGOSEngine::setupGame() { #else _vgaMemSize = gVars->memory[kMemSimon2Games]; #endif + _itemMemSize = 20000; _tableMemSize = 200000; _frameRate = 1; _vgaBaseDelay = 5; @@ -576,6 +578,7 @@ void AGOSEngine::setupGame() { #else _vgaMemSize = gVars->memory[kMemSimon2Games]; #endif + _itemMemSize = 20000; _tableMemSize = 100000; // Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2 if ((getGameType() == GType_SIMON2) && _native_mt32) @@ -597,7 +600,8 @@ void AGOSEngine::setupGame() { #else _vgaMemSize = gVars->memory[kMemSimon1Games]; #endif - _tableMemSize = 150000; + _itemMemSize = 20000; + _tableMemSize = 50000; _musicIndexBase = 1316 / 4; _soundIndexBase = 0; _frameRate = 1; @@ -612,7 +616,8 @@ void AGOSEngine::setupGame() { #else _vgaMemSize = gVars->memory[kMemSimon1Games]; #endif - _tableMemSize = 150000; + _itemMemSize = 64000; + _tableMemSize = 50000; _frameRate = 4; _vgaBaseDelay = 1; _numVars = 255; @@ -625,6 +630,7 @@ void AGOSEngine::setupGame() { #else _vgaMemSize = gVars->memory[kMemSimon1Games]; #endif + _itemMemSize = 64000; _tableMemSize = 50000; _frameRate = 4; _vgaBaseDelay = 1; @@ -638,7 +644,8 @@ void AGOSEngine::setupGame() { #else _vgaMemSize = gVars->memory[kMemSimon1Games]; #endif - _tableMemSize = 150000; + _itemMemSize = 64000; + _tableMemSize = 50000; _frameRate = 4; _vgaBaseDelay = 1; _numVars = 512; @@ -649,8 +656,10 @@ void AGOSEngine::setupGame() { initMouse(); _variableArray = (int16 *)calloc(_numVars, sizeof(int16)); - _variableArray2 = (int16 *)calloc(_numVars, sizeof(int16)); _variableArrayPtr = _variableArray; + if (getGameType() == GType_FF || getGameType() == GType_PP) { + _variableArray2 = (int16 *)calloc(_numVars, sizeof(int16)); + } setupOpcodes(); setupVgaOpcodes(); @@ -802,15 +811,19 @@ Child *AGOSEngine::allocateChildBlock(Item *i, uint type, uint size) { } void AGOSEngine::allocItemHeap() { - _itemHeapSize = 64000; + _itemHeapSize = _itemMemSize; _itemHeapCurPos = 0; - _itemHeapPtr = (byte *)calloc(64000, 1); + _itemHeapPtr = (byte *)calloc(_itemMemSize, 1); + if (!_itemHeapPtr) + error("Out Of Memory - Items"); } void AGOSEngine::allocTablesHeap() { _tablesHeapSize = _tableMemSize; _tablesHeapCurPos = 0; _tablesHeapPtr = (byte *)calloc(_tableMemSize, 1); + if (!_tablesHeapPtr) + error("Out Of Memory - Tables"); } void AGOSEngine::setItemState(Item *item, int value) { diff --git a/engines/agos/agos.h b/engines/agos/agos.h index c9a83114c8..ba2aa9ca0d 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -194,14 +194,18 @@ protected: uint32 *_gameOffsetsPtr; + uint _numVars; uint _vgaBaseDelay; + + uint _musicIndexBase; + uint _soundIndexBase; uint _tableIndexBase; uint _textIndexBase; - uint _vgaMemSize; + + uint _itemMemSize; uint _tableMemSize; - uint _musicIndexBase; - uint _soundIndexBase; - uint _numVars; + uint _vgaMemSize; + const GameSpecificSettings *gss; byte _keyPressed; |