[Scummvm-cvs-logs] SF.net SVN: scummvm:[43503] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Aug 18 11:12:41 CEST 2009
Revision: 43503
http://scummvm.svn.sourceforge.net/scummvm/?rev=43503&view=rev
Author: thebluegr
Date: 2009-08-18 09:12:41 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
Removed the maxMemory parameter of the resource manager and replaced it with a define
Modified Paths:
--------------
scummvm/trunk/engines/sci/detection.cpp
scummvm/trunk/engines/sci/resource.cpp
scummvm/trunk/engines/sci/resource.h
scummvm/trunk/engines/sci/sci.cpp
Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp 2009-08-18 08:00:24 UTC (rev 43502)
+++ scummvm/trunk/engines/sci/detection.cpp 2009-08-18 09:12:41 UTC (rev 43503)
@@ -3090,7 +3090,7 @@
#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);
Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp 2009-08-18 08:00:24 UTC (rev 43502)
+++ scummvm/trunk/engines/sci/resource.cpp 2009-08-18 09:12:41 UTC (rev 43503)
@@ -396,8 +396,7 @@
_sources.clear();
}
-ResourceManager::ResourceManager(int maxMemory) {
- _maxMemory = maxMemory;
+ResourceManager::ResourceManager() {
_memoryLocked = 0;
_memoryLRU = 0;
_LRU.clear();
@@ -506,7 +505,7 @@
}
void ResourceManager::freeOldResources() {
- while (_maxMemory < _memoryLRU) {
+ while (MAX_MEMORY < _memoryLRU) {
assert(!_LRU.empty());
Resource *goner = *_LRU.reverse_begin();
removeFromLRU(goner);
@@ -614,6 +613,7 @@
break;
}
}
+
if (file.isOpen() == false) {
error("Failed to open resource map file");
return kResVersionUnknown;
Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h 2009-08-18 08:00:24 UTC (rev 43502)
+++ scummvm/trunk/engines/sci/resource.h 2009-08-18 09:12:41 UTC (rev 43503)
@@ -245,15 +245,8 @@
/**
* 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 @@
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
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2009-08-18 08:00:24 UTC (rev 43502)
+++ scummvm/trunk/engines/sci/sci.cpp 2009-08-18 09:12:41 UTC (rev 43503)
@@ -135,7 +135,7 @@
const uint32 flags = getFlags();
- _resmgr = new ResourceManager(256 * 1024);
+ _resmgr = new ResourceManager();
_version = _resmgr->sciVersion();
if (!_resmgr) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list