[Scummvm-git-logs] scummvm master -> 1ea57c994c613141805e72a9830753425ad62374
bluegr
noreply at scummvm.org
Sat May 7 17:51:46 UTC 2022
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:
1ea57c994c GRAPHICS: Add support for loading oversized Mac CURS resources
Commit: 1ea57c994c613141805e72a9830753425ad62374
https://github.com/scummvm/scummvm/commit/1ea57c994c613141805e72a9830753425ad62374
Author: elasota (ejlasota at gmail.com)
Date: 2022-05-07T20:51:44+03:00
Commit Message:
GRAPHICS: Add support for loading oversized Mac CURS resources
Changed paths:
graphics/maccursor.cpp
graphics/maccursor.h
diff --git a/graphics/maccursor.cpp b/graphics/maccursor.cpp
index e9f1ed1b9e1..81a04a464dd 100644
--- a/graphics/maccursor.cpp
+++ b/graphics/maccursor.cpp
@@ -42,12 +42,14 @@ void MacCursor::clear() {
memset(_palette, 0, 256 * 3);
}
-bool MacCursor::readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome, byte monochromeInvertedPixelColor) {
+bool MacCursor::readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome, byte monochromeInvertedPixelColor, bool forceCURSFormat) {
clear();
- // Older Mac CURS monochrome cursors had a set size
+ const int minCursSize = 32 * 2 + 4;
+
+ // Older Mac CURS monochrome cursors had a set size, but sometimes contain extra unused bytes
// All crsr cursors are larger than this
- if (stream.size() == 32 * 2 + 4)
+ if (stream.size() == minCursSize || (forceCURSFormat && stream.size() >= minCursSize))
return readFromCURS(stream, monochromeInvertedPixelColor);
return readFromCRSR(stream, forceMonochrome, monochromeInvertedPixelColor);
diff --git a/graphics/maccursor.h b/graphics/maccursor.h
index 3faec2e880b..f77446b9db5 100644
--- a/graphics/maccursor.h
+++ b/graphics/maccursor.h
@@ -68,7 +68,7 @@ public:
uint16 getPaletteCount() const { return 256; }
/** Read the cursor's data out of a stream. */
- bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false, byte monochromeInvertedPixelColor = 0xff);
+ bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false, byte monochromeInvertedPixelColor = 0xff, bool forceCURSFormat = false);
protected:
bool readFromCURS(Common::SeekableReadStream &stream, byte monochromeInvertedPixelColor);
More information about the Scummvm-git-logs
mailing list