diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/resource.cpp | 11 | ||||
-rw-r--r-- | engines/sci/resource.h | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 92d35ba1fc..86c5f52455 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -865,6 +865,7 @@ ResourceManager::ResourceManager() { } void ResourceManager::init() { + _maxMemoryLRU = 256 * 1024; // 256KiB _memoryLocked = 0; _memoryLRU = 0; _LRU.clear(); @@ -918,6 +919,14 @@ void ResourceManager::init() { debugC(1, kDebugLevelResMan, "resMan: Detected %s", getSciVersionDesc(getSciVersion())); + // Resources in SCI32 games are significantly larger than SCI16 + // games and can cause immediate exhaustion of the LRU resource + // cache, leading to constant decompression of picture resources + // and making the renderer very slow. + if (getSciVersion() >= SCI_VERSION_2) { + _maxMemoryLRU = 2048 * 1024; // 2MiB + } + switch (_viewType) { case kViewEga: debugC(1, kDebugLevelResMan, "resMan: Detected EGA graphic resources"); @@ -1023,7 +1032,7 @@ void ResourceManager::printLRU() { } void ResourceManager::freeOldResources() { - while (MAX_MEMORY < _memoryLRU) { + while (_maxMemoryLRU < _memoryLRU) { assert(!_LRU.empty()); Resource *goner = *_LRU.reverse_begin(); removeFromLRU(goner); diff --git a/engines/sci/resource.h b/engines/sci/resource.h index eb5b508254..46ac2bb944 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -426,9 +426,7 @@ protected: // Note: maxMemory will not be interpreted as a hard limit, only as a restriction // for resources which are not explicitly locked. However, a warning will be // issued whenever this limit is exceeded. - enum { - MAX_MEMORY = 256 * 1024 // 256KB - }; + int _maxMemoryLRU; ViewType _viewType; // Used to determine if the game has EGA or VGA graphics Common::List<ResourceSource *> _sources; |