diff options
author | Colin Snover | 2017-05-07 14:09:58 -0500 |
---|---|---|
committer | Colin Snover | 2017-05-08 11:26:46 -0500 |
commit | 554a73e01209643161f8adecba825a5bc39f87f8 (patch) | |
tree | 79b9823307b1b472c761f0e6143ec90f634fa9eb /engines/sci/resource.h | |
parent | 23abcffbc5bc2f3e74d4725af1d292db0421054b (diff) | |
download | scummvm-rg350-554a73e01209643161f8adecba825a5bc39f87f8.tar.gz scummvm-rg350-554a73e01209643161f8adecba825a5bc39f87f8.tar.bz2 scummvm-rg350-554a73e01209643161f8adecba825a5bc39f87f8.zip |
SCI: Improve detection and reporting of resource errors
Simple assertions in the resource manager are not sufficient to
track down resource corruption issues, and some error conditions
that were being checked already were either ignored or only raised
as warnings that casual users would be unlikely to see.
Ideally, error handling in ResourceManager would be improved to
the point where errors would correctly propagate out of it (so the
warning dialogue could be displayed from outside), but right now
error codes are dropped all over the place, and it would take more
effort to fix that without much benefit for the current situation.
If/until someone has the energy to fix that, the warning dialogue
is simply shown from ResourceManager::scanNewSources.
Refs Trac#9764.
Diffstat (limited to 'engines/sci/resource.h')
-rw-r--r-- | engines/sci/resource.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/sci/resource.h b/engines/sci/resource.h index 85bd915e5d..b869c7a627 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -519,8 +519,10 @@ protected: Common::SeekableReadStream *getVolumeFile(ResourceSource *source); void loadResource(Resource *res); void freeOldResources(); - void addResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size = 0); - Resource *updateResource(ResourceId resId, ResourceSource *src, uint32 size); + bool validateResource(const ResourceId &resourceId, const Common::String &sourceMapLocation, const Common::String &sourceName, const uint32 offset, const uint32 size, const uint32 sourceSize) const; + void addResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size = 0, const Common::String &sourceMapLocation = Common::String("(no map location)")); + Resource *updateResource(ResourceId resId, ResourceSource *src, uint32 size, const Common::String &sourceMapLocation = Common::String("(no map location)")); + Resource *updateResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size, const Common::String &sourceMapLocation = Common::String("(no map location)")); void removeAudioResource(ResourceId resId); /**--- Resource map decoding functions ---*/ @@ -592,6 +594,9 @@ protected: bool checkResourceDataForSignature(Resource *resource, const byte *signature); bool checkResourceForSignatures(ResourceType resourceType, uint16 resourceNr, const byte *signature1, const byte *signature2); void detectSciVersion(); + +private: + bool _hasBadResources; }; class SoundResource { |