diff options
author | Torbjörn Andersson | 2004-09-08 07:10:54 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-09-08 07:10:54 +0000 |
commit | 412f7105f06343c6a592a58df4b575fd64b74024 (patch) | |
tree | 70a5b6f55392470120ea4329c84f8f4ffa355251 /sword2/resman.cpp | |
parent | d662863db152e85c85f82220e37eed20d89d7fdd (diff) | |
download | scummvm-rg350-412f7105f06343c6a592a58df4b575fd64b74024.tar.gz scummvm-rg350-412f7105f06343c6a592a58df4b575fd64b74024.tar.bz2 scummvm-rg350-412f7105f06343c6a592a58df4b575fd64b74024.zip |
Fixed evil regression #2. Restarting the game, or using the "start" debug
command, would close the global script variables and player object
resources, without reopening them again. This made them fair game for the
resource expiration mechanism. The player object is probably referenced
often enough to stay alive, but the variables died on me pretty quickly,
causing ScummVM to crash.
I've also added a "reslist" debug command to make this sort of things
easier to spot. By default it only lists resources with refCount > 0. Use
"reslist 0" to see all the cached resources as well.
svn-id: r14958
Diffstat (limited to 'sword2/resman.cpp')
-rw-r--r-- | sword2/resman.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sword2/resman.cpp b/sword2/resman.cpp index bd4eddd450..1882fa045e 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -633,7 +633,7 @@ uint32 ResourceManager::fetchLen(uint32 res) { return file.readUint32LE(); } -void ResourceManager::expelOldResources() { +void ResourceManager::expireOldResources() { int nuked = 0; for (uint i = 0; i < _totalResFiles; i++) { @@ -673,6 +673,15 @@ void ResourceManager::printConsoleClusters(void) { Debug_Printf("Argh! No resources!\n"); } +void ResourceManager::listResources(uint minCount) { + for (uint i = 0; i < _totalResFiles; i++) { + if (_resList[i].ptr && _resList[i].refCount >= minCount) { + StandardHeader *head = (StandardHeader *) _resList[i].ptr; + Debug_Printf("%-4d: %-35s refCount: %-3d age: %-2d\n", i, head->name, _resList[i].refCount, _resTime - _resList[i].refTime); + } + } +} + void ResourceManager::examine(int res) { if (res < 0 || res >= (int) _totalResFiles) Debug_Printf("Illegal resource %d (there are %d resources 0-%d)\n", res, _totalResFiles, _totalResFiles - 1); |