diff options
author | Paul Gilbert | 2019-06-16 17:55:16 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-06-16 17:55:16 -0700 |
commit | 2e69903cbb16ed9d939caad82b17c8c1e9a20a3c (patch) | |
tree | 461226cd825f458d40ad200de0748765916025a2 /engines | |
parent | fee722181079655203efb1420667f5449459aa7a (diff) | |
download | scummvm-rg350-2e69903cbb16ed9d939caad82b17c8c1e9a20a3c.tar.gz scummvm-rg350-2e69903cbb16ed9d939caad82b17c8c1e9a20a3c.tar.bz2 scummvm-rg350-2e69903cbb16ed9d939caad82b17c8c1e9a20a3c.zip |
GLK: Change savegame interpreter Ids from index to 4 byte code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/glk.cpp | 4 | ||||
-rw-r--r-- | engines/glk/glk_types.h | 33 | ||||
-rw-r--r-- | engines/glk/quetzal.cpp | 20 | ||||
-rw-r--r-- | engines/glk/quetzal.h | 3 |
4 files changed, 40 insertions, 20 deletions
diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index d154de2d39..1208cba527 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -194,12 +194,12 @@ Common::Error GlkEngine::loadGameState(int slot) { Common::SeekableReadStream *rs = it.getStream(); rs->skip(14); - byte interpType = rs->readByte(); + uint32 interpType = rs->readUint32BE(); byte language = rs->readByte(); Common::String md5 = QuetzalReader::readString(rs); delete rs; - if (interpType != getInterpreterType() || language != getLanguage() || md5 != getGameMD5()) + if (interpType != INTERPRETER_IDS[getInterpreterType()] || language != getLanguage() || md5 != getGameMD5()) errCode = Common::kReadingFailed; } } diff --git a/engines/glk/glk_types.h b/engines/glk/glk_types.h index 3c233ff51c..2cf66d0ce8 100644 --- a/engines/glk/glk_types.h +++ b/engines/glk/glk_types.h @@ -34,23 +34,22 @@ class Window; * List of the different sub-engines the engine will likely eventually support */ enum InterpreterType { - INTERPRETER_ADVSYS = 0, - INTERPRETER_AGILITY = 1, - INTERPRETER_ALAN2 = 2, - INTERPRETER_ALAN3 = 3, - INTERPRETER_BOCFEL = 4, - INTERPRETER_FROTZ = 5, - INTERPRETER_GEAS = 6, - INTERPRETER_GLULXE = 7, - INTERPRETER_HUGO = 8, - INTERPRETER_JACL = 9, - INTERPRETER_LEVEL9 = 10, - INTERPRETER_MAGNETIC = 11, - INTERPRETER_NITFOL = 12, - INTERPRETER_SCARE = 13, - INTERPRETER_SCOTT = 14, - INTERPRETER_TADS2 = 15, - INTERPRETER_TADS3 = 16 + INTERPRETER_ADVSYS, + INTERPRETER_AGILITY, + INTERPRETER_ALAN2, + INTERPRETER_ALAN3, + INTERPRETER_BOCFEL, + INTERPRETER_FROTZ, + INTERPRETER_GEAS, + INTERPRETER_GLULXE, + INTERPRETER_HUGO, + INTERPRETER_JACL, + INTERPRETER_LEVEL9, + INTERPRETER_MAGNETIC, + INTERPRETER_SCARE, + INTERPRETER_SCOTT, + INTERPRETER_TADS2, + INTERPRETER_TADS3 }; /** diff --git a/engines/glk/quetzal.cpp b/engines/glk/quetzal.cpp index 69b0475b5d..a745d7586e 100644 --- a/engines/glk/quetzal.cpp +++ b/engines/glk/quetzal.cpp @@ -29,6 +29,24 @@ namespace Glk { +const uint32 INTERPRETER_IDS[INTERPRETER_TADS3 + 1] = { + MKTAG('A', 'S', 'Y', 'S'), + MKTAG('A', 'G', 'I', 'L'), + MKTAG('A', 'L', 'N', '2'), + MKTAG('A', 'L', 'N', '3'), + MKTAG('Z', 'C', 'O', 'D'), + MKTAG('G', 'E', 'A', 'S'), + MKTAG('G', 'L', 'U', 'L'), + MKTAG('H', 'U', 'G', 'O'), + MKTAG('J', 'A', 'C', 'L'), + MKTAG('L', 'V', 'L', '9'), + MKTAG('M', 'A', 'G', 'N'), + MKTAG('S', 'C', 'A', 'R'), + MKTAG('S', 'C', 'O', 'T'), + MKTAG('T', 'A', 'D', '2'), + MKTAG('T', 'A', 'D', '3') +}; + void QuetzalReader::clear() { _chunks.clear(); _stream = nullptr; @@ -200,7 +218,7 @@ void QuetzalWriter::addCommonChunks(const Common::String &saveName) { ws.writeUint32BE(g_vm->_events->getTotalPlayTicks()); // Write out intrepreter type, language, and game Id - ws.writeByte(g_vm->getInterpreterType()); + ws.writeUint32BE(INTERPRETER_IDS[g_vm->getInterpreterType()]); ws.writeByte(g_vm->getLanguage()); Common::String md5 = g_vm->getGameMD5(); ws.write(md5.c_str(), md5.size()); diff --git a/engines/glk/quetzal.h b/engines/glk/quetzal.h index 7f2dd30a71..c9452b6429 100644 --- a/engines/glk/quetzal.h +++ b/engines/glk/quetzal.h @@ -29,6 +29,7 @@ #include "common/stream.h" #include "engines/savestate.h" #include "glk/blorb.h" +#include "glk/glk_types.h" namespace Glk { @@ -42,6 +43,8 @@ enum QueztalTag { ID_SCVM = MKTAG('S', 'C', 'V', 'M') }; +extern const uint32 INTERPRETER_IDS[INTERPRETER_TADS3 + 1]; + /** * Quetzal save file reader */ |