SCUMM: setOffHeap uses resource status in HE90+ games.

This commit is contained in:
Travis Howell 2011-08-28 11:39:05 +10:00
parent b3457144ed
commit fb41b96e96
2 changed files with 30 additions and 28 deletions

View File

@ -939,18 +939,6 @@ void ResourceManager::unlock(ResType type, ResId idx) {
_types[type][idx].unlock(); _types[type][idx].unlock();
} }
void ResourceManager::setOffHeap(ResType type, ResId idx) {
if (!validateResource("setOffHeap", type, idx))
return;
_types[type][idx].setOffHeap();
}
void ResourceManager::setOnHeap(ResType type, ResId idx) {
if (!validateResource("setOnHeap", type, idx))
return;
_types[type][idx].setOnHeap();
}
bool ResourceManager::isLocked(ResType type, ResId idx) const { bool ResourceManager::isLocked(ResType type, ResId idx) const {
if (!validateResource("isLocked", type, idx)) if (!validateResource("isLocked", type, idx))
return false; return false;
@ -969,18 +957,6 @@ bool ResourceManager::Resource::isLocked() const {
return (_flags & RF_LOCK) != 0; return (_flags & RF_LOCK) != 0;
} }
void ResourceManager::Resource::setOffHeap() {
_flags |= RF_OFFHEAP;
}
void ResourceManager::Resource::setOnHeap() {
_flags &= ~RF_OFFHEAP;
}
bool ResourceManager::Resource::isOffHeap() const {
return (_flags & RF_OFFHEAP) != 0;
}
bool ScummEngine::isResourceInUse(ResType type, ResId idx) const { bool ScummEngine::isResourceInUse(ResType type, ResId idx) const {
if (!_res->validateResource("isResourceInUse", type, idx)) if (!_res->validateResource("isResourceInUse", type, idx))
return false; return false;
@ -1018,18 +994,42 @@ void ResourceManager::setModified(ResType type, ResId idx) {
_types[type][idx].setModified(); _types[type][idx].setModified();
} }
void ResourceManager::setOffHeap(ResType type, ResId idx) {
if (!validateResource("setOffHeap", type, idx))
return;
_types[type][idx].setOffHeap();
}
void ResourceManager::setOnHeap(ResType type, ResId idx) {
if (!validateResource("setOnHeap", type, idx))
return;
_types[type][idx].setOnHeap();
}
bool ResourceManager::isModified(ResType type, ResId idx) const { bool ResourceManager::isModified(ResType type, ResId idx) const {
if (!validateResource("isModified", type, idx)) if (!validateResource("isModified", type, idx))
return false; return false;
return _types[type][idx].isModified(); return _types[type][idx].isModified();
} }
bool ResourceManager::Resource::isModified() const {
return (_status & RS_MODIFIED) != 0;
}
bool ResourceManager::Resource::isOffHeap() const {
return (_status & RF_OFFHEAP) != 0;
}
void ResourceManager::Resource::setModified() { void ResourceManager::Resource::setModified() {
_status |= RS_MODIFIED; _status |= RS_MODIFIED;
} }
bool ResourceManager::Resource::isModified() const { void ResourceManager::Resource::setOffHeap() {
return (_status & RS_MODIFIED) != 0; _status |= RF_OFFHEAP;
}
void ResourceManager::Resource::setOnHeap() {
_status &= ~RF_OFFHEAP;
} }
void ResourceManager::expireResources(uint32 size) { void ResourceManager::expireResources(uint32 size) {

View File

@ -134,10 +134,11 @@ public:
inline void setResourceCounter(byte counter); inline void setResourceCounter(byte counter);
inline byte getResourceCounter() const; inline byte getResourceCounter() const;
// HE specific
void lock(); void lock();
void unlock(); void unlock();
bool isLocked() const; bool isLocked() const;
// HE specific
void setModified(); void setModified();
bool isModified() const; bool isModified() const;
void setOffHeap(); void setOffHeap();
@ -191,10 +192,11 @@ public:
bool isResourceLoaded(ResType type, ResId idx) const; bool isResourceLoaded(ResType type, ResId idx) const;
// HE Specific
void lock(ResType type, ResId idx); void lock(ResType type, ResId idx);
void unlock(ResType type, ResId idx); void unlock(ResType type, ResId idx);
bool isLocked(ResType type, ResId idx) const; bool isLocked(ResType type, ResId idx) const;
// HE Specific
void setModified(ResType type, ResId idx); void setModified(ResType type, ResId idx);
bool isModified(ResType type, ResId idx) const; bool isModified(ResType type, ResId idx) const;
void setOffHeap(ResType type, ResId idx); void setOffHeap(ResType type, ResId idx);