diff options
author | Eugene Sandulenko | 2016-09-20 11:02:49 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-20 19:34:48 +0200 |
commit | ca1eb70fd8760411c0be2eb48449765c15768cb6 (patch) | |
tree | 265612d2cfed23461d48cb93e5708021c34bf425 /engines/fullpipe | |
parent | dde4076f725e30a1264b3f0935df7c6fdf7cf774 (diff) | |
download | scummvm-rg350-ca1eb70fd8760411c0be2eb48449765c15768cb6.tar.gz scummvm-rg350-ca1eb70fd8760411c0be2eb48449765c15768cb6.tar.bz2 scummvm-rg350-ca1eb70fd8760411c0be2eb48449765c15768cb6.zip |
FULLPIPE: Read playtime and save date from save headers
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/gameloader.cpp | 18 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.h | 6 | ||||
-rw-r--r-- | engines/fullpipe/modal.cpp | 4 |
3 files changed, 24 insertions, 4 deletions
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 64c744ff24..d7e40f9806 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -696,6 +696,17 @@ const char *getSavegameFile(int saveGameIdx) { return buffer; } +void parseSavegameHeader(Fullpipe::FullpipeSavegameHeader &header, SaveStateDescriptor &desc) { + int day = (header.date >> 24) & 0xFF; + int month = (header.date >> 16) & 0xFF; + int year = header.date & 0xFFFF; + desc.setSaveDate(year, month, day); + int hour = (header.time >> 8) & 0xFF; + int minutes = header.time & 0xFF; + desc.setSaveTime(hour, minutes); + desc.setPlayTime(header.playtime * 1000); +} + bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header) { char saveIdentBuffer[6]; header.thumbnail = NULL; @@ -709,8 +720,13 @@ bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header) // Validate the header Id in->read(saveIdentBuffer, 6); - if (strcmp(saveIdentBuffer, "SVMCR")) + if (strcmp(saveIdentBuffer, "SVMCR")) { + // This is wrong header, perhaps it is original savegame. Thus fill out dummy values + header.date = (16 >> 24) | (9 >> 20) | 2016; + header.time = (9 >> 8) | 56; + header.playtime = 1000; return false; + } header.version = in->readByte(); if (header.version != FULLPIPE_SAVEGAME_VERSION) diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index d984020ff1..5687e6bba3 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -23,6 +23,8 @@ #ifndef FULLPIPE_GAMELOADER_H #define FULLPIPE_GAMELOADER_H +#include "engines/savestate.h" + #include "fullpipe/objects.h" #include "fullpipe/inventory.h" #include "fullpipe/messages.h" @@ -77,6 +79,9 @@ class PreloadItems : public Common::Array<PreloadItem *>, public CObject { struct FullpipeSavegameHeader { uint8 version; Common::String saveName; + uint32 date; + uint16 time; + uint32 playtime; Graphics::Surface *thumbnail; }; @@ -134,6 +139,7 @@ class GameLoader : public CObject { const char *getSavegameFile(int saveGameIdx); bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header); +void parseSavegameHeader(Fullpipe::FullpipeSavegameHeader &header, SaveStateDescriptor &desc); Inventory2 *getGameLoaderInventory(); InteractionController *getGameLoaderInteractionController(); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index cceec4a852..468d4219fc 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1640,9 +1640,7 @@ bool ModalSaveGame::getFileInfo(int slot, FileInfo *fileinfo) { SaveStateDescriptor desc(slot, header.saveName); char res[17]; - // FIXME. HACK. TODO: Set proper dates - desc.setSaveDate(2016, 9, 18); - desc.setSaveTime(9, 56); + Fullpipe::parseSavegameHeader(header, desc); snprintf(res, 17, "%s %s", desc.getSaveDate().c_str(), desc.getSaveTime().c_str()); |