aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMarcus Comstedt2007-02-18 16:55:40 +0000
committerMarcus Comstedt2007-02-18 16:55:40 +0000
commit138b7bea41f0e24d3cde41253f59d0f32ab2dbda (patch)
treec14fb8d34395520c34532d2b52962e22eee8fbe7 /backends
parentda442dd2fb81cbff5ca51f73c01e01d1d94d113f (diff)
downloadscummvm-rg350-138b7bea41f0e24d3cde41253f59d0f32ab2dbda.tar.gz
scummvm-rg350-138b7bea41f0e24d3cde41253f59d0f32ab2dbda.tar.bz2
scummvm-rg350-138b7bea41f0e24d3cde41253f59d0f32ab2dbda.zip
Accept zlib format files as well when reading.
svn-id: r25690
Diffstat (limited to 'backends')
-rw-r--r--backends/saves/compressed/compressed-saves.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/backends/saves/compressed/compressed-saves.cpp b/backends/saves/compressed/compressed-saves.cpp
index 183e8dd355..48b7cfff79 100644
--- a/backends/saves/compressed/compressed-saves.cpp
+++ b/backends/saves/compressed/compressed-saves.cpp
@@ -59,11 +59,18 @@ public:
// Verify file header is correct once more
w->seek(0, SEEK_SET);
- assert(w->readUint16BE() == 0x1F8B);
+ uint16 header = w->readUint16BE();
+ assert(header == 0x1F8B ||
+ ((header & 0x0F00) == 0x0800 && header % 31 == 0));
- // Retrieve the original file size
- w->seek(-4, SEEK_END);
- _origSize = w->readUint32LE();
+ if(header == 0x1F8B) {
+ // Retrieve the original file size
+ w->seek(-4, SEEK_END);
+ _origSize = w->readUint32LE();
+ } else {
+ // Original size not available in zlib format
+ _origSize = 0;
+ }
_pos = 0;
w->seek(0, SEEK_SET);
@@ -261,7 +268,10 @@ public:
Common::InSaveFile *wrapInSaveFile(Common::InSaveFile *toBeWrapped) {
#if defined(USE_ZLIB)
if (toBeWrapped) {
- bool isCompressed = (toBeWrapped->readUint16BE() == 0x1F8B);
+ uint16 header = toBeWrapped->readUint16BE();
+ bool isCompressed = (header == 0x1F8B ||
+ ((header & 0x0F00) == 0x0800 &&
+ header % 31 == 0));
toBeWrapped->seek(-2, SEEK_CUR);
if (isCompressed)
return new CompressedInSaveFile(toBeWrapped);