diff options
Diffstat (limited to 'engines/scumm/saveload.cpp')
| -rw-r--r-- | engines/scumm/saveload.cpp | 40 | 
1 files changed, 30 insertions, 10 deletions
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 426c7ee48b..eb7cf1ba56 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -46,6 +46,8 @@  #include "sound/audiocd.h"  #include "sound/mixer.h" +#include "graphics/thumbnail.h" +  namespace Scumm {  struct SaveGameHeader { @@ -71,6 +73,22 @@ struct SaveInfoSection {  #define INFOSECTION_VERSION 2 +Graphics::Surface *ScummEngine::loadThumbnail(Common::SeekableReadStream *file) { +	if (!Graphics::checkThumbnailHeader(*file)) +		return 0; + +	Graphics::Surface *thumb = new Graphics::Surface(); +	assert(thumb); +	if (!Graphics::loadThumbnail(*file, *thumb)) { +		delete thumb; +		return 0; +	} + +	return thumb; +} + +#pragma mark - +  void ScummEngine::requestSave(int slot, const char *name, bool temporary) {  	_saveLoadSlot = slot;  	_saveTemporaryState = temporary; @@ -114,7 +132,9 @@ bool ScummEngine::saveState(int slot, bool compat) {  	memcpy(hdr.name, _saveLoadName, sizeof(hdr.name));  	saveSaveGameHeader(out, hdr); -	saveThumbnail(out); +#if !defined(__DS__) +	Graphics::saveThumbnail(*out); +#endif  	saveInfos(out);  	Serializer ser(0, out, CURRENT_VER); @@ -185,16 +205,16 @@ 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; +		// Prior to version 75 we always required an thumbnail to be present +		if (hdr.ver <= VER(74)) { +			if (!Graphics::checkThumbnailHeader(*in)) { +				warning("Can not load thumbnail"); +				delete in; +				return false; +			}  		} -		uint32 size = in->readUint32BE(); -		in->skip(size - 8); + +		Graphics::skipThumbnailHeader(*in);  	}  	// Since version 56 we save additional information about the creation of  | 
