[Scummvm-git-logs] scummvm master -> 1cf6af6a744b85c5f7a6b93b0dda5c84ea6bfb36
sev-
noreply at scummvm.org
Fri Feb 24 15:14:41 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1cf6af6a74 DIRECTOR: Made loading from external files more robust
Commit: 1cf6af6a744b85c5f7a6b93b0dda5c84ea6bfb36
https://github.com/scummvm/scummvm/commit/1cf6af6a744b85c5f7a6b93b0dda5c84ea6bfb36
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-02-24T16:14:24+01:00
Commit Message:
DIRECTOR: Made loading from external files more robust
Changed paths:
engines/director/cast.cpp
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index f74d6e6ace2..3f449a27a6d 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -671,7 +671,7 @@ void Cast::loadBitmapData(int key, BitmapCastMember *bitmapCast) {
pic = sharedCast->getArchive()->getResource(tag, imgId);
}
- if (pic == nullptr || pic->size() == 0) {
+ if ((pic == nullptr || pic->size() == 0) && !_castsInfo[key]->fileName.empty()) {
// image file is linked, load from the filesystem
Common::File file;
@@ -679,19 +679,29 @@ void Cast::loadBitmapData(int key, BitmapCastMember *bitmapCast) {
Common::String directory = _castsInfo[key]->directory;
Common::String imageFilename = directory + g_director->_dirSeparator + filename;
+
Common::Path path = Common::Path(pathMakeRelative(imageFilename), g_director->_dirSeparator);
- file.open(path);
- Image::PICTDecoder *pict = new Image::PICTDecoder();
- pict->loadStream(file);
- file.close();
- bitmapCast->_img = pict;
+ if (file.open(path)) {
+ Image::PICTDecoder *pict = new Image::PICTDecoder();
+
+ bool res = pict->loadStream(file);
+ file.close();
+
+ if (res) {
+ bitmapCast->_img = pict;
- const Graphics::Surface *surf = pict->getSurface();
- bitmapCast->_size = surf->pitch * surf->h + pict->getPaletteColorCount() * 3;
+ const Graphics::Surface *surf = pict->getSurface();
+ bitmapCast->_size = surf->pitch * surf->h + pict->getPaletteColorCount() * 3;
- delete pic;
- return;
+ delete pic;
+ return;
+ } else {
+ warning("BUILDBOT: Cast::loadBitmapData(): wrong format for external picture '%s'", path.toString().c_str());
+ }
+ } else {
+ warning("Cast::loadBitmapData(): cannot open external picture '%s'", path.toString().c_str());
+ }
}
} else {
if (_loadedCast->contains(imgId)) {
More information about the Scummvm-git-logs
mailing list