diff options
author | Johannes Schickel | 2008-08-20 14:24:16 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-08-20 14:24:16 +0000 |
commit | 9138128f5cee660184ce57b645644d341241918a (patch) | |
tree | 227f5b9fc2bab3ac30d85d545b615efbf0f9137e /engines | |
parent | f4fc8c3e4c1621e8c40392881a6c647f9915fa38 (diff) | |
download | scummvm-rg350-9138128f5cee660184ce57b645644d341241918a.tar.gz scummvm-rg350-9138128f5cee660184ce57b645644d341241918a.tar.bz2 scummvm-rg350-9138128f5cee660184ce57b645644d341241918a.zip |
- Committed Max' compressed save backseeking support from patch #2050337 "KYRA/SCUMM: Thumbnail support/improvement"
- Extended SCUMM engine to support savegames without thumbnail header. (Increased savegame version to prevent saves to be loaded from older ScummVM versions)
- Fixed KYRA to properly support savegames without thumbnail header.
svn-id: r34054
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/saveload.cpp | 5 | ||||
-rw-r--r-- | engines/scumm/saveload.cpp | 14 | ||||
-rw-r--r-- | engines/scumm/saveload.h | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 4 | ||||
-rw-r--r-- | engines/scumm/thumbnail.cpp | 27 |
5 files changed, 16 insertions, 36 deletions
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index c08967c85c..debf0623ac 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -113,7 +113,10 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab if (loadThumbnail) { header.thumbnail = new Graphics::Surface(); assert(header.thumbnail); - Graphics::loadThumbnail(*in, *header.thumbnail); + if (!Graphics::loadThumbnail(*in, *header.thumbnail)) { + delete header.thumbnail; + header.thumbnail = 0; + } } else { Graphics::skipThumbnailHeader(*in); } diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 54dfca9eea..c7193a55f3 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -184,18 +184,8 @@ bool ScummEngine::loadState(int slot, bool compat) { } // Since version 52 a thumbnail is saved directly after the header. - if (hdr.ver >= VER(52)) { - uint32 type = in->readUint32BE(); - // Check for the THMB header. Also, work around a bug which caused - // the chunk type (incorrectly) to be written in LE on LE machines. - if (! (type == MKID_BE('THMB') || (hdr.ver < VER(55) && type == MKID_BE('BMHT')))){ - warning("Can not load thumbnail"); - delete in; - return false; - } - uint32 size = in->readUint32BE(); - in->skip(size - 8); - } + if (hdr.ver >= VER(52)) + skipThumbnailHeader(in); // Since version 56 we save additional information about the creation of // the save game and the save time. diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h index 2d7ee64680..4f9899f961 100644 --- a/engines/scumm/saveload.h +++ b/engines/scumm/saveload.h @@ -50,7 +50,7 @@ namespace Scumm { * only saves/loads those which are valid for the version of the savegame * which is being loaded/saved currently. */ -#define CURRENT_VER 74 +#define CURRENT_VER 75 /** * An auxillary macro, used to specify savegame versions. We use this instead diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 2763331420..9ac78e3b93 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -636,9 +636,11 @@ public: protected: Graphics::Surface *loadThumbnail(Common::SeekableReadStream *file); - bool loadInfos(Common::SeekableReadStream *file, InfoStuff *stuff); void saveThumbnail(Common::WriteStream *file); + void skipThumbnailHeader(Common::SeekableReadStream *file); + void saveInfos(Common::WriteStream* file); + bool loadInfos(Common::SeekableReadStream *file, InfoStuff *stuff); int32 _engineStartTime; int32 _pauseStartTime; diff --git a/engines/scumm/thumbnail.cpp b/engines/scumm/thumbnail.cpp index da5cad945e..1f494b25a5 100644 --- a/engines/scumm/thumbnail.cpp +++ b/engines/scumm/thumbnail.cpp @@ -33,11 +33,8 @@ namespace Scumm { Graphics::Surface *ScummEngine::loadThumbnail(Common::SeekableReadStream *file) { - // TODO: Until backwards seeking in compressed save files is not supported - // We can not use this. - - //if (!Graphics::checkThumbnailHeader(*file)) - // return 0; + if (!Graphics::checkThumbnailHeader(*file)) + return 0; Graphics::Surface *thumb = new Graphics::Surface(); assert(thumb); @@ -50,25 +47,13 @@ Graphics::Surface *ScummEngine::loadThumbnail(Common::SeekableReadStream *file) } void ScummEngine::saveThumbnail(Common::OutSaveFile *file) { - // Until we support no thumbnails in the SCUMM save formats for NDS - // we save a dummy thumbnail. - // - // TODO: Actually all what has to be done about it, is to update - // the code in engines/scumm/saveload.o which skips the saveheader. - // Currently impossible because of lacking backward seek support for - // compressed save files. - // When we change that code to use the new API from graphics/thumbnail.h - // it should be all fine to save no header at all for NDS. - - Graphics::Surface thumb; - #if !defined(__DS__) - if (!createThumbnailFromScreen(&thumb)) + Graphics::saveThumbnail(*file); #endif - thumb.create(kThumbnailWidth, kThumbnailHeight2, sizeof(uint16)); +} - Graphics::saveThumbnail(*file, thumb); - thumb.free(); +void ScummEngine::skipThumbnailHeader(Common::SeekableReadStream *file) { + Graphics::skipThumbnailHeader(*file); } } // end of namespace Scumm |