mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-25 13:42:37 +00:00
Removed the maxMemory parameter of the resource manager and replaced it with a define
svn-id: r43503
This commit is contained in:
parent
c9402c5559
commit
65ac355efa
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user