aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-09-20 10:45:28 +0200
committerEugene Sandulenko2016-09-20 19:34:48 +0200
commitdde4076f725e30a1264b3f0935df7c6fdf7cf774 (patch)
tree8b3a0d37a5bf2d95c49bc367dc91530928501437
parent0aef5c55d4fbb27b7cb7ed3dda001c9ede205cf5 (diff)
downloadscummvm-rg350-dde4076f725e30a1264b3f0935df7c6fdf7cf774.tar.gz
scummvm-rg350-dde4076f725e30a1264b3f0935df7c6fdf7cf774.tar.bz2
scummvm-rg350-dde4076f725e30a1264b3f0935df7c6fdf7cf774.zip
FULLPIPE: Read ScummVM savegame header from end of the file
This will let us maintain backward compatibility with original saves
-rw-r--r--engines/fullpipe/gameloader.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index d1f27814c0..64c744ff24 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -700,6 +700,13 @@ bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header)
char saveIdentBuffer[6];
header.thumbnail = NULL;
+ uint oldPos = in->pos();
+
+ in->seek(4, SEEK_END);
+ uint headerOffset = in->readUint32LE();
+
+ in->seek(headerOffset, SEEK_SET);
+
// Validate the header Id
in->read(saveIdentBuffer, 6);
if (strcmp(saveIdentBuffer, "SVMCR"))
@@ -717,6 +724,9 @@ bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header)
// Get the thumbnail
header.thumbnail = Graphics::loadThumbnail(*in);
+
+ in->seek(oldPos, SEEK_SET); // Rewind the file
+
if (!header.thumbnail)
return false;