diff options
author | Paul Gilbert | 2019-06-16 18:03:17 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-06-16 18:03:17 -0700 |
commit | 1afd60cd3e98725c59daf9cdc7a40655c454fb81 (patch) | |
tree | e86d8f69ad06e35dd774549db07cf56c3affc691 /engines | |
parent | 2e69903cbb16ed9d939caad82b17c8c1e9a20a3c (diff) | |
download | scummvm-rg350-1afd60cd3e98725c59daf9cdc7a40655c454fb81.tar.gz scummvm-rg350-1afd60cd3e98725c59daf9cdc7a40655c454fb81.tar.bz2 scummvm-rg350-1afd60cd3e98725c59daf9cdc7a40655c454fb81.zip |
GLK: Change language Id in savegames to more portable language code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/glk.cpp | 6 | ||||
-rw-r--r-- | engines/glk/quetzal.cpp | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp index 1208cba527..ffb5015633 100644 --- a/engines/glk/glk.cpp +++ b/engines/glk/glk.cpp @@ -25,6 +25,7 @@ #include "common/debug-channels.h" #include "common/events.h" #include "common/file.h" +#include "common/language.h" #include "engines/util.h" #include "graphics/scaler.h" #include "graphics/thumbnail.h" @@ -195,11 +196,12 @@ Common::Error GlkEngine::loadGameState(int slot) { rs->skip(14); uint32 interpType = rs->readUint32BE(); - byte language = rs->readByte(); + Common::String langCode = QuetzalReader::readString(rs); Common::String md5 = QuetzalReader::readString(rs); delete rs; - if (interpType != INTERPRETER_IDS[getInterpreterType()] || language != getLanguage() || md5 != getGameMD5()) + if (interpType != INTERPRETER_IDS[getInterpreterType()] || + parseLanguage(langCode) !=getLanguage() || md5 != getGameMD5()) errCode = Common::kReadingFailed; } } diff --git a/engines/glk/quetzal.cpp b/engines/glk/quetzal.cpp index a745d7586e..68c11d0996 100644 --- a/engines/glk/quetzal.cpp +++ b/engines/glk/quetzal.cpp @@ -23,8 +23,9 @@ #include "glk/quetzal.h" #include "glk/glk_api.h" #include "glk/events.h" -#include "common/memstream.h" #include "common/system.h" +#include "common/language.h" +#include "common/memstream.h" #include "common/translation.h" namespace Glk { @@ -202,7 +203,7 @@ void QuetzalWriter::addCommonChunks(const Common::String &saveName) { ws.write(saveName.c_str(), saveName.size()); ws.writeByte(0); } - + Common::Language l; // Write 'SCVM' chunk with game version & gameplay statistics { Common::WriteStream &ws = add(ID_SCVM); @@ -219,7 +220,8 @@ void QuetzalWriter::addCommonChunks(const Common::String &saveName) { // Write out intrepreter type, language, and game Id ws.writeUint32BE(INTERPRETER_IDS[g_vm->getInterpreterType()]); - ws.writeByte(g_vm->getLanguage()); + const char *langCode = getLanguageCode(g_vm->getLanguage()); + ws.write(langCode, strlen(langCode) + 1); Common::String md5 = g_vm->getGameMD5(); ws.write(md5.c_str(), md5.size()); ws.writeByte('\0'); |