diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/detection.cpp | 2 | ||||
-rw-r--r-- | engines/sci/resource.cpp | 6 | ||||
-rw-r--r-- | engines/sci/resource.h | 16 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 2 |
4 files changed, 12 insertions, 14 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 88bd0d63c3..d46dd2cbd8 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -3090,7 +3090,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl #if 0 // Determine the game id // TODO - ResourceManager *resMgr = new ResourceManager(256 * 1024); + ResourceManager *resMgr = new ResourceManager(); SciVersion version = resMgr->sciVersion(); SegManager *segManager = new SegManager(resMgr, version); reg_t game_obj = script_lookup_export(segManager, 0, 0); diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 7b201d0506..2ca198954a 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -396,8 +396,7 @@ void ResourceManager::freeResourceSources() { _sources.clear(); } -ResourceManager::ResourceManager(int maxMemory) { - _maxMemory = maxMemory; +ResourceManager::ResourceManager() { _memoryLocked = 0; _memoryLRU = 0; _LRU.clear(); @@ -506,7 +505,7 @@ void ResourceManager::printLRU() { } void ResourceManager::freeOldResources() { - while (_maxMemory < _memoryLRU) { + while (MAX_MEMORY < _memoryLRU) { assert(!_LRU.empty()); Resource *goner = *_LRU.reverse_begin(); removeFromLRU(goner); @@ -614,6 +613,7 @@ ResourceManager::ResVersion ResourceManager::detectMapVersion() { break; } } + if (file.isOpen() == false) { error("Failed to open resource map file"); return kResVersionUnknown; diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 0a5336fd3f..8ab740f463 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -245,15 +245,8 @@ public: /** * Creates a new SCI resource manager. - * @param version The SCI version to look for; use SCI_VERSION_AUTODETECT - * in the default case. - * @param maxMemory Maximum number of bytes to allow allocated for resources - * - * @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. */ - ResourceManager(int maxMemory); + ResourceManager(); ~ResourceManager(); /** @@ -294,8 +287,13 @@ public: void setAudioLanguage(int language); protected: + // Maximum number of bytes to allow being allocated for resources + // 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. + #define MAX_MEMORY 256 * 1024 // 256KB + ViewType _viewType; // Used to determine if the game has EGA or VGA graphics - int _maxMemory; //!< Config option: Maximum total byte number allocated Common::List<ResourceSource *> _sources; int _memoryLocked; //!< Amount of resource bytes in locked memory int _memoryLRU; //!< Amount of resource bytes under LRU control diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 64e89a638e..53e3e7ab9c 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -135,7 +135,7 @@ Common::Error SciEngine::run() { const uint32 flags = getFlags(); - _resmgr = new ResourceManager(256 * 1024); + _resmgr = new ResourceManager(); _version = _resmgr->sciVersion(); if (!_resmgr) { |