aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kohaut2019-04-02 18:48:28 +0200
committerPeter Kohaut2019-04-02 18:55:53 +0200
commitc47237e5b9d5b6d28ecc39757c13b54fb2f8aa23 (patch)
tree627dc361353a009910948fe4e25af0589e78e72d
parentc0aeb99d7862cb3f1e4681139edc11ea65023ce9 (diff)
downloadscummvm-rg350-c47237e5b9d5b6d28ecc39757c13b54fb2f8aa23.tar.gz
scummvm-rg350-c47237e5b9d5b6d28ecc39757c13b54fb2f8aa23.tar.bz2
scummvm-rg350-c47237e5b9d5b6d28ecc39757c13b54fb2f8aa23.zip
BLADERUNNER: Fixed images & z-buffer on big-endian architectures
-rw-r--r--engines/bladerunner/image.cpp7
-rw-r--r--engines/bladerunner/ui/esper.cpp7
-rw-r--r--engines/bladerunner/zbuffer.cpp7
3 files changed, 21 insertions, 0 deletions
diff --git a/engines/bladerunner/image.cpp b/engines/bladerunner/image.cpp
index e6b55280a7..19f9f0087d 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 af6150f983..929601677f 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 21fa6c5da1..ccc6a0075c 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();