Implemented some advanced savegame functionality - loading and deleting savegames from the GMM is now possible, and new saved games will also have thumbnails. Saving from the GMM creates corrupted saved games, so it has been disabled for now

svn-id: r44930
This commit is contained in:
Filippos Karapetis 2009-10-11 15:51:43 +00:00
parent ba9a9422b4
commit 1d3118cf42
5 changed files with 191 additions and 6 deletions

View file

@ -27,6 +27,7 @@
#include "common/system.h"
#include "common/func.h"
#include "common/serializer.h"
#include "graphics/thumbnail.h"
#include "sci/sci.h"
#include "sci/gfx/operations.h"
@ -529,6 +530,7 @@ int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename
*/
Common::Serializer ser(0, fh);
sync_SavegameMetadata(ser, meta);
Graphics::saveThumbnail(*fh);
s->saveLoadWithSerializer(ser); // FIXME: Error handling?
return 0;
@ -724,6 +726,15 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
return NULL;
}
if (meta.savegame_version >= 12) {
// We don't need the thumbnail here, so just read it and discard it
Graphics::Surface *thumbnail = new Graphics::Surface();
assert(thumbnail);
Graphics::loadThumbnail(*fh, *thumbnail);
delete thumbnail;
thumbnail = 0;
}
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_gui, s->_cursor);