diff options
author | Alexander Tkachev | 2016-08-04 15:15:45 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-04 15:15:45 +0600 |
commit | ef631c9e75f09e3a2a54701c1d6bf0e2dce5b71e (patch) | |
tree | 00cbdb551157799ca01f7a55078d5f0e702a8bd9 /engines/wage | |
parent | f58abd95409998d5e0859aaa1ef0df14c0639519 (diff) | |
download | scummvm-rg350-ef631c9e75f09e3a2a54701c1d6bf0e2dce5b71e.tar.gz scummvm-rg350-ef631c9e75f09e3a2a54701c1d6bf0e2dce5b71e.tar.bz2 scummvm-rg350-ef631c9e75f09e3a2a54701c1d6bf0e2dce5b71e.zip |
WAGE: Update saves format
Offset is added in the end of the file, so ScummVM would know where to
look for description, version, thumbnail information.
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/detection.cpp | 15 | ||||
-rw-r--r-- | engines/wage/saveload.cpp | 6 |
2 files changed, 18 insertions, 3 deletions
diff --git a/engines/wage/detection.cpp b/engines/wage/detection.cpp index e14a952588..a27bfd7fde 100644 --- a/engines/wage/detection.cpp +++ b/engines/wage/detection.cpp @@ -99,7 +99,7 @@ SaveStateList WageMetaEngine::listSaves(const char *target) const { const uint32 WAGEflag = MKTAG('W','A','G','E'); Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::StringArray filenames; - char saveDesc[31]; + char saveDesc[128] = {0}; Common::String pattern = target; pattern += ".###"; @@ -113,9 +113,18 @@ SaveStateList WageMetaEngine::listSaves(const char *target) const { if (slotNum >= 0 && slotNum <= 999) { Common::InSaveFile *in = saveFileMan->openForLoading(*file); if (in) { + saveDesc[0] = 0; + in->seek(in->size() - 8); + uint32 offset = in->readUint32BE(); uint32 type = in->readUint32BE(); - if (type == WAGEflag) - in->read(saveDesc, 31); + if (type == WAGEflag) { + in->seek(offset); + + type = in->readUint32BE(); + if (type == WAGEflag) { + in->read(saveDesc, 127); + } + } saveList.push_back(SaveStateDescriptor(slotNum, saveDesc)); delete in; } diff --git a/engines/wage/saveload.cpp b/engines/wage/saveload.cpp index 78e8d389d3..c3b20bdf2f 100644 --- a/engines/wage/saveload.cpp +++ b/engines/wage/saveload.cpp @@ -335,6 +335,10 @@ int WageEngine::saveGame(const Common::String &fileName, const Common::String &d } // the following is appended by ScummVM + int32 appendixOffset = out->pos(); + if (appendixOffset < 0) { + warning("OutSaveFile::pos() failed"); + } out->writeUint32BE(WAGEflag); // Write description of saved game, limited to WAGE_SAVEDGAME_DESCRIPTION_LEN characters + terminating NUL @@ -352,6 +356,8 @@ int WageEngine::saveGame(const Common::String &fileName, const Common::String &d // Thumbnail Graphics::saveThumbnail(*out); + out->writeUint32BE(appendixOffset); + // this one to make checking easier: // it couldn't be added to the beginning // and we won't be able to find it in the middle, |