aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner
diff options
context:
space:
mode:
authorPeter Kohaut2019-11-26 22:12:33 +0100
committerPeter Kohaut2019-11-26 22:15:27 +0100
commit3619b613bcf92386c62b4c23fed62502bbdd712d (patch)
tree206ad93f197ec4112cecac38636ebb7c146d13b6 /engines/bladerunner
parentf48343e77cf6de03dfcb3787bf1006b83654abb5 (diff)
downloadscummvm-rg350-3619b613bcf92386c62b4c23fed62502bbdd712d.tar.gz
scummvm-rg350-3619b613bcf92386c62b4c23fed62502bbdd712d.tar.bz2
scummvm-rg350-3619b613bcf92386c62b4c23fed62502bbdd712d.zip
BLADERUNNER: Fixed crossplatform thumbnails in saves
Thumbnail was broken when savefile was transfered between big endiang and little endian platforms. closes #11258
Diffstat (limited to 'engines/bladerunner')
-rw-r--r--engines/bladerunner/bladerunner.cpp10
-rw-r--r--engines/bladerunner/savefile.cpp6
2 files changed, 12 insertions, 4 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 21ebebcd0b..3493c8adbb 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -2043,7 +2043,12 @@ bool BladeRunnerEngine::saveGame(Common::WriteStream &stream, Graphics::Surface
SaveFileWriteStream s(memoryStream);
thumbnail.convertToInPlace(gameDataPixelFormat());
- s.write(thumbnail.getPixels(), SaveFileManager::kThumbnailSize);
+
+ uint16* thumbnailData = (uint16*)thumbnail.getPixels();
+ for (uint i = 0; i < SaveFileManager::kThumbnailSize / 2; ++i) {
+ s.writeUint16LE(thumbnailData[i]);
+ }
+
s.writeFloat(1.0f);
_settings->save(s);
_scene->save(s);
@@ -2126,8 +2131,9 @@ bool BladeRunnerEngine::loadGame(Common::SeekableReadStream &stream) {
_gameIsLoading = true;
_settings->setLoadingGame();
+
s.skip(SaveFileManager::kThumbnailSize); // skip the thumbnail
- s.skip(4);// always float 1.0, but never used
+ s.skip(4);// always float 1.0, but never used, assuming it's the game version
_settings->load(s);
_scene->load(s);
_scene->_exits->load(s);
diff --git a/engines/bladerunner/savefile.cpp b/engines/bladerunner/savefile.cpp
index 1ea1a8807d..7a0739bd98 100644
--- a/engines/bladerunner/savefile.cpp
+++ b/engines/bladerunner/savefile.cpp
@@ -146,8 +146,10 @@ bool SaveFileManager::readHeader(Common::SeekableReadStream &in, SaveFileHeader
s.skip(4); //skip size;
- void *thumbnailData = malloc(kThumbnailSize); // freed by ScummVM's smartptr
- s.read(thumbnailData, kThumbnailSize);
+ uint16 *thumbnailData = (uint16*)malloc(kThumbnailSize); // freed by ScummVM's smartptr
+ for (uint i = 0; i < kThumbnailSize / 2; ++i) {
+ thumbnailData[i] = s.readUint16LE();
+ }
header._thumbnail->init(80, 60, 160, thumbnailData, gameDataPixelFormat());