diff options
author | Eugene Sandulenko | 2016-09-18 00:02:11 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-18 00:16:29 +0200 |
commit | 83a82a98420423f2aa27b7e7eedce13b03ec34b2 (patch) | |
tree | 8788af30097d288e3ca79b7acf43a059093229e0 /engines/fullpipe/gameloader.cpp | |
parent | 973df9d2fda30e92e51de98482592333f4e229bd (diff) | |
download | scummvm-rg350-83a82a98420423f2aa27b7e7eedce13b03ec34b2.tar.gz scummvm-rg350-83a82a98420423f2aa27b7e7eedce13b03ec34b2.tar.bz2 scummvm-rg350-83a82a98420423f2aa27b7e7eedce13b03ec34b2.zip |
FULLPIPE: Further work on saving
Diffstat (limited to 'engines/fullpipe/gameloader.cpp')
-rw-r--r-- | engines/fullpipe/gameloader.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 83da25dbf3..5d204bf0cd 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -21,6 +21,7 @@ */ #include "fullpipe/fullpipe.h" +#include "common/memstream.h" #include "graphics/thumbnail.h" #include "fullpipe/gameloader.h" @@ -634,8 +635,9 @@ void GameLoader::writeSavegame(Scene *sc, const char *fname) { header.updateCounter = _updateCounter; header.unkField = 1; - // open save for reading - Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(fname); + Common::MemoryWriteStreamDynamic stream; + + MfcArchive *archive = new MfcArchive(&stream); v = _gameVar->getSubVarByName("OBJSTATES"); @@ -649,9 +651,10 @@ void GameLoader::writeSavegame(Scene *sc, const char *fname) { v->_parentVarObj = 0; v->_nextVarObj = 0; v->_prevVarObj = 0; + warning("NULLIFIED"); } - writeObject(saveFile, v); + archive->writeObject(v); if (v) { v->_parentVarObj = par; @@ -659,15 +662,15 @@ void GameLoader::writeSavegame(Scene *sc, const char *fname) { v->_prevVarObj = prv; } - getGameLoaderInventory()->savePartial(saveFile); + getGameLoaderInventory()->savePartial(*archive); - saveFile->writeUint32LE(_sc2array.size()); + archive->writeUint32LE(_sc2array.size()); for (uint i = 0; i < _sc2array.size(); i++) { - saveFile->writeUint32LE(_sc2array[i]._picAniInfosCount); + archive->writeUint32LE(_sc2array[i]._picAniInfosCount); for (uint j = 0; j < _sc2array[i]._picAniInfosCount; j++) { - _sc2array[i]._picAniInfos[j]->save(saveFile); + _sc2array[i]._picAniInfos[j]->save(*archive); } } @@ -677,6 +680,11 @@ void GameLoader::writeSavegame(Scene *sc, const char *fname) { //if (_savegameCallback) // _savegameCallback(saveFile, 1); + // Now dump it into save file + Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(fname); + + saveFile->write(stream.getData(), stream.size()); + saveFile->finalize(); delete saveFile; |