diff options
author | Paul Gilbert | 2012-02-11 21:45:16 +1100 |
---|---|---|
committer | Paul Gilbert | 2012-02-11 21:45:16 +1100 |
commit | 5ce622c1b65917b194e6118c9fa247c2a8d4b54e (patch) | |
tree | b13962717d27d5fc1288b6e8708c498d9ef64065 /engines/tinsel | |
parent | 342fd8cc28b3ce26c2c593f5641c90642f54571c (diff) | |
download | scummvm-rg350-5ce622c1b65917b194e6118c9fa247c2a8d4b54e.tar.gz scummvm-rg350-5ce622c1b65917b194e6118c9fa247c2a8d4b54e.tar.bz2 scummvm-rg350-5ce622c1b65917b194e6118c9fa247c2a8d4b54e.zip |
TINSEL: Added extra fields to the savegame header for SCN/GRA usage and language
New savegames that are created will no longer appear in the savegame list for different data versions or languages.
Diffstat (limited to 'engines/tinsel')
-rw-r--r-- | engines/tinsel/saveload.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 8664cd5f15..f8598c05f8 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -22,6 +22,7 @@ */ #include "tinsel/actors.h" +#include "tinsel/config.h" #include "tinsel/dialogs.h" #include "tinsel/drives.h" #include "tinsel/dw.h" @@ -94,12 +95,14 @@ struct SaveGameHeader { uint32 ver; char desc[SG_DESC_LEN]; TimeDate dateTime; + bool scnFlag; + byte language; }; enum { DW1_SAVEGAME_ID = 0x44575399, // = 'DWSc' = "DiscWorld 1 ScummVM" DW2_SAVEGAME_ID = 0x44573253, // = 'DW2S' = "DiscWorld 2 ScummVM" - SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7 + SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7 + 1 + 1 }; #define SAVEGAME_ID (TinselV2 ? (uint32)DW2_SAVEGAME_ID : (uint32)DW1_SAVEGAME_ID) @@ -166,6 +169,21 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) { // Perform sanity check if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024) return false; + + if (tmp > 0) { + // If there's header space left, handling syncing the Scn flag and game language + s.syncAsByte(hdr.scnFlag); + s.syncAsByte(hdr.language); + tmp -= 2; + + if (_vm && s.isLoading()) { + // If the engine is loaded, ensure the Scn/Gra usage is correct, and it's the correct language + if ((hdr.scnFlag != ((_vm->getFeatures() & GF_SCNFILES) != 0)) || + (hdr.language != _vm->_config->_language)) + return false; + } + } + // Skip over any extra bytes s.skip(tmp); return true; @@ -547,6 +565,9 @@ static void DoSave() { memcpy(hdr.desc, SaveSceneDesc, SG_DESC_LEN); hdr.desc[SG_DESC_LEN - 1] = 0; g_system->getTimeAndDate(hdr.dateTime); + hdr.scnFlag = _vm->getFeatures() & GF_SCNFILES; + hdr.language = _vm->_config->_language; + if (!syncSaveGameHeader(s, hdr) || f->err()) { SaveFailure(f); return; |