aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-09-24 11:10:03 -0500
committerColin Snover2017-09-24 11:12:45 -0500
commitd73ada9088b53451eaa0b7e57064b6e6769f63fc (patch)
tree131ba959e57a2d23c8b8d27ddf75aaaddef49fa9
parent5424f70002c8483448225aeb5982b709c2774e46 (diff)
downloadscummvm-rg350-d73ada9088b53451eaa0b7e57064b6e6769f63fc.tar.gz
scummvm-rg350-d73ada9088b53451eaa0b7e57064b6e6769f63fc.tar.bz2
scummvm-rg350-d73ada9088b53451eaa0b7e57064b6e6769f63fc.zip
SCI: Fix generation of save games
-rw-r--r--engines/sci/engine/savegame.cpp10
-rw-r--r--engines/sci/engine/savegame.h1
2 files changed, 8 insertions, 3 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 60ad497b84..b0fa31a1bb 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -1184,8 +1184,8 @@ void SegManager::reconstructClones() {
bool gamestate_save(EngineState *s, Common::WriteStream *fh, const Common::String &savename, const Common::String &version) {
- set_savegame_metadata(fh, savename, version);
Common::Serializer ser(nullptr, fh);
+ set_savegame_metadata(ser, fh, savename, version);
s->saveLoadWithSerializer(ser); // FIXME: Error handling?
if (g_sci->_gfxPorts)
g_sci->_gfxPorts->saveLoadWithSerializer(ser);
@@ -1373,7 +1373,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
s->gameIsRestarting = GAMEISRESTARTING_RESTORE;
}
-void set_savegame_metadata(Common::WriteStream *fh, const Common::String &savename, const Common::String &version) {
+void set_savegame_metadata(Common::Serializer &ser, Common::WriteStream *fh, const Common::String &savename, const Common::String &version) {
TimeDate curTime;
g_system->getTimeAndDate(curTime);
@@ -1389,11 +1389,15 @@ void set_savegame_metadata(Common::WriteStream *fh, const Common::String &savena
meta.script0Size = script0->size();
meta.gameObjectOffset = g_sci->getGameObject().getOffset();
- Common::Serializer ser(nullptr, fh);
sync_SavegameMetadata(ser, meta);
Graphics::saveThumbnail(*fh);
}
+void set_savegame_metadata(Common::WriteStream *fh, const Common::String &savename, const Common::String &version) {
+ Common::Serializer ser(nullptr, fh);
+ set_savegame_metadata(ser, fh, savename, version);
+}
+
bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata &meta) {
assert(stream);
diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h
index 1ac25b26a9..ac79a76aff 100644
--- a/engines/sci/engine/savegame.h
+++ b/engines/sci/engine/savegame.h
@@ -123,6 +123,7 @@ bool get_savegame_metadata(Common::SeekableReadStream *stream, SavegameMetadata
/**
* Write the header to a savegame.
*/
+void set_savegame_metadata(Common::Serializer &ser, Common::WriteStream *fh, const Common::String &savename, const Common::String &version);
void set_savegame_metadata(Common::WriteStream *fh, const Common::String &savename, const Common::String &version);
} // End of namespace Sci