ScummVM API documentation
Scumm::ResourceManager Class Reference

#include <resource.h>

Classes

class  Resource
 
class  ResTypeData
 

Public Member Functions

 ResourceManager (ScummEngine *vm)
 
void setHeapThreshold (int min, int max)
 
uint32 getHeapSize ()
 
void allocResTypeData (ResType type, uint32 tag, int num, ResTypeMode mode)
 
void freeResources ()
 
byte * createResource (ResType type, ResId idx, uint32 size)
 
void nukeResource (ResType type, ResId idx)
 
bool isResourceLoaded (ResType type, ResId idx) const
 
void lock (ResType type, ResId idx)
 
void unlock (ResType type, ResId idx)
 
bool isLocked (ResType type, ResId idx) const
 
void setModified (ResType type, ResId idx)
 
bool isModified (ResType type, ResId idx) const
 
void setOffHeap (ResType type, ResId idx)
 
bool isOffHeap (ResType type, ResId idx) const
 
void setOnHeap (ResType type, ResId idx)
 
void increaseExpireCounter ()
 
void setResourceCounter (ResType type, ResId idx, byte counter)
 
void increaseResourceCounters ()
 
void resourceStats ()
 
bool validateResource (const char *str, ResType type, ResId idx) const
 

Public Attributes

ResTypeData _types [rtLast+1]
 

Protected Member Functions

void expireResources (uint32 size)
 

Protected Attributes

ScummEngine_vm
 
uint32 _allocatedSize
 
uint32 _maxHeapThreshold
 
uint32 _minHeapThreshold
 
byte _expireCounter
 

Detailed Description

The 'resource manager' class. Currently doesn't really deserve to be called a 'class', at least until somebody gets around to OOfying this more.

Member Function Documentation

◆ increaseExpireCounter()

void Scumm::ResourceManager::increaseExpireCounter ( )

This method increments the _expireCounter, and if it overflows (which happens after at most 256 calls), it calls increaseResourceCounter. It is invoked in the engine's main loop ScummEngine::scummLoop().

◆ setResourceCounter()

void Scumm::ResourceManager::setResourceCounter ( ResType  type,
ResId  idx,
byte  counter 
)

Update the specified resource's counter.

◆ increaseResourceCounters()

void Scumm::ResourceManager::increaseResourceCounters ( )

Increment the counter of all unlocked loaded resources. The maximal count is 255. This is called by increaseExpireCounter and expireResources, but also by ScummEngine::startScene.


The documentation for this class was generated from the following file: