mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-30 23:43:10 +00:00
SWORD25: Remove thumbnails from the cache when saving a new game
This commit is contained in:
parent
2af3759a78
commit
0ef807146e
@ -336,6 +336,9 @@ bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotF
|
||||
// Savegameinformationen für diesen Slot aktualisieren.
|
||||
_impl->readSlotSavegameInformation(slotID);
|
||||
|
||||
// Empty the cache, to remove old thumbnails
|
||||
Kernel::getInstance()->getResourceManager()->emptyThumbnailCache();
|
||||
|
||||
// Erfolg signalisieren.
|
||||
return true;
|
||||
}
|
||||
|
@ -147,6 +147,21 @@ void ResourceManager::emptyCache() {
|
||||
}
|
||||
}
|
||||
|
||||
void ResourceManager::emptyThumbnailCache() {
|
||||
// Scan through the resource list
|
||||
Common::List<Resource *>::iterator iter = _resources.begin();
|
||||
while (iter != _resources.end()) {
|
||||
if ((*iter)->getFileName().hasPrefix("/saves")) {
|
||||
// Unlock the thumbnail
|
||||
while ((*iter)->getLockCount() > 0)
|
||||
(*iter)->release();
|
||||
// Delete the thumbnail
|
||||
iter = deleteResource(*iter);
|
||||
} else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a requested resource. If any error occurs, returns NULL
|
||||
* @param FileName Filename of resource
|
||||
|
@ -81,6 +81,11 @@ public:
|
||||
**/
|
||||
void emptyCache();
|
||||
|
||||
/**
|
||||
* Removes all the savegame thumbnails from the cache
|
||||
**/
|
||||
void emptyThumbnailCache();
|
||||
|
||||
/**
|
||||
* Writes the names of all currently locked resources to the log file
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user