diff options
author | sluicebox | 2019-09-12 12:02:56 -0700 |
---|---|---|
committer | sluicebox | 2019-09-12 12:02:56 -0700 |
commit | debe25907419990337ae1f631fa04c8615fb68a4 (patch) | |
tree | d0d9d17a89c6429ac58ad2e53cb241ca58c50090 /engines/sci | |
parent | 698ca464d7d9c020374c1c80c98df70150083072 (diff) | |
download | scummvm-rg350-debe25907419990337ae1f631fa04c8615fb68a4.tar.gz scummvm-rg350-debe25907419990337ae1f631fa04c8615fb68a4.tar.bz2 scummvm-rg350-debe25907419990337ae1f631fa04c8615fb68a4.zip |
SCI32: Fix loading system font for Mac games
Fixes GK1 Mac crash on load due to reading hard-coded
little endian font data as big endian
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/font.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp index 8dd6cbde5d..97627ec00b 100644 --- a/engines/sci/graphics/font.cpp +++ b/engines/sci/graphics/font.cpp @@ -185,7 +185,7 @@ static const byte sci32SystemFont[] = { }; #endif - GfxFontFromResource::GfxFontFromResource(ResourceManager *resMan, GfxScreen *screen, GuiResourceId resourceId) +GfxFontFromResource::GfxFontFromResource(ResourceManager *resMan, GfxScreen *screen, GuiResourceId resourceId) : _resourceId(resourceId), _screen(screen), _resMan(resMan) { if (getSciVersion() < SCI_VERSION_2) { assert(resourceId != -1); @@ -211,12 +211,22 @@ static const byte sci32SystemFont[] = { } #endif - _numChars = _resourceData.getUint16SE32At(2); - _fontHeight = _resourceData.getUint16SE32At(4); + if (_resource) { + _numChars = _resourceData.getUint16SE32At(2); + _fontHeight = _resourceData.getUint16SE32At(4); + } else { + _numChars = _resourceData.getUint16LEAt(2); + _fontHeight = _resourceData.getUint16LEAt(4); + } _chars = new Charinfo[_numChars]; // filling info for every char for (int16 i = 0; i < _numChars; i++) { - _chars[i].offset = _resourceData.getUint16SE32At(6 + i * 2); + uint32 charOffsetIndex = 6 + i * 2; + if (_resource) { + _chars[i].offset = _resourceData.getUint16SE32At(charOffsetIndex); + } else { + _chars[i].offset = _resourceData.getUint16LEAt(charOffsetIndex); + } _chars[i].width = _resourceData.getUint8At(_chars[i].offset); _chars[i].height = _resourceData.getUint8At(_chars[i].offset + 1); } |