[Scummvm-git-logs] scummvm master -> c47237e5b9d5b6d28ecc39757c13b54fb2f8aa23
peterkohaut
peterkohaut at users.noreply.github.com
Tue Apr 2 18:56:29 CEST 2019
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:
c47237e5b9 BLADERUNNER: Fixed images & z-buffer on big-endian architectures
Commit: c47237e5b9d5b6d28ecc39757c13b54fb2f8aa23
https://github.com/scummvm/scummvm/commit/c47237e5b9d5b6d28ecc39757c13b54fb2f8aa23
Author: Peter Kohaut (peter.kohaut at gmail.com)
Date: 2019-04-02T18:55:53+02:00
Commit Message:
BLADERUNNER: Fixed images & z-buffer on big-endian architectures
Changed paths:
engines/bladerunner/image.cpp
engines/bladerunner/ui/esper.cpp
engines/bladerunner/zbuffer.cpp
diff --git a/engines/bladerunner/image.cpp b/engines/bladerunner/image.cpp
index e6b5528..19f9f00 100644
--- a/engines/bladerunner/image.cpp
+++ b/engines/bladerunner/image.cpp
@@ -64,6 +64,13 @@ bool Image::open(const Common::String &name) {
warning("LZO image decompression is not implemented");
} else if (strcmp(tag, "LCW") == 0) {
decompress_lcw(buf, bufSize, (uint8 *)data, dataSize);
+#ifdef SCUMM_BIG_ENDIAN
+ // As the compression is working with 8-bit data, on big-endian architectures we have to switch order of bytes in uncompressed data
+ uint8 *rawData = (uint8 *)data;
+ for (size_t i = 0; i < dataSize - 1; i += 2) {
+ SWAP(rawData[i], rawData[i + 1]);
+ }
+#endif
}
const Graphics::PixelFormat pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp
index af6150f..9296016 100644
--- a/engines/bladerunner/ui/esper.cpp
+++ b/engines/bladerunner/ui/esper.cpp
@@ -1433,6 +1433,13 @@ void ESPER::selectPhoto(int photoId) {
s->read(photoCompressed, photoCompressedSize);
decompress_lcw(photoCompressed, photoCompressedSize, (uint8 *)_surfacePhoto.getPixels(), photoSize);
+#ifdef SCUMM_BIG_ENDIAN
+ // As the compression is working with 8-bit data, on big-endian architectures we have to switch order of bytes in uncompressed data
+ uint8 *rawData = (uint8 *)_surfacePhoto.getPixels();
+ for (size_t i = 0; i < photoSize - 1; i += 2) {
+ SWAP(rawData[i], rawData[i + 1]);
+ }
+#endif
// apply palette
for (uint j = 0; j < width * height; ++j) {
diff --git a/engines/bladerunner/zbuffer.cpp b/engines/bladerunner/zbuffer.cpp
index 21fa6c5..ccc6a00 100644
--- a/engines/bladerunner/zbuffer.cpp
+++ b/engines/bladerunner/zbuffer.cpp
@@ -154,6 +154,13 @@ bool ZBuffer::decodeData(const uint8 *data, int size) {
resetUpdates();
size_t zbufOutSize;
decompress_lzo1x(data, size, (uint8 *)_zbuf1, &zbufOutSize);
+#ifdef SCUMM_BIG_ENDIAN
+ // As the compression is working with 8-bit data, on big-endian architectures we have to switch order of bytes in uncompressed data
+ uint8 *rawZbuf = (uint8 *)_zbuf1;
+ for (size_t i = 0; i < zbufOutSize - 1; i += 2) {
+ SWAP(rawZbuf[i], rawZbuf[i + 1]);
+ }
+#endif
memcpy(_zbuf2, _zbuf1, 2 * _width * _height);
} else {
clean();
More information about the Scummvm-git-logs
mailing list