[Scummvm-git-logs] scummvm master -> 1afd60cd3e98725c59daf9cdc7a40655c454fb81

dreammaster paulfgilbert at gmail.com
Mon Jun 17 03:17:38 CEST 2019


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
fee7221810 GLK: ADVSYS: Fix inputs with indirect objects
2e69903cbb GLK: Change savegame interpreter Ids from index to 4 byte code
1afd60cd3e GLK: Change language Id in savegames to more portable language code


Commit: fee722181079655203efb1420667f5449459aa7a
    https://github.com/scummvm/scummvm/commit/fee722181079655203efb1420667f5449459aa7a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-06-16T17:43:07-07:00

Commit Message:
GLK: ADVSYS: Fix inputs with indirect objects

Changed paths:
    engines/glk/advsys/vm.cpp


diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp
index 70b0359..13929ae 100644
--- a/engines/glk/advsys/vm.cpp
+++ b/engines/glk/advsys/vm.cpp
@@ -488,7 +488,7 @@ bool VM::parseInput() {
 				preposition = *_wordPtr++;
 
 			// Get the indirect object
-			noun2 = _adjectiveList.size();
+			noun2 = _adjectiveList.size() + 1;
 			for (;;) {
 				// Get the indirect object
 				if (!getNoun())
@@ -615,10 +615,15 @@ uint VM::getNoun() {
 	_adjectiveList.push_back(AdjectiveEntry());
 	assert(_adjectiveList.size() <= 20);
 
+	if (_wordPtr == _words.end() || getWordType(*_wordPtr) != WT_NOUN) {
+		parseError();
+		return NIL;
+	}
+
 	// Add a noun entry to the list
 	Noun n;
 	n._adjective = &_adjectiveList[alStart];
-	n._noun = (_wordPtr == _words.end()) ? 0 : *_wordPtr++;
+	n._noun = *_wordPtr++;
 	n._num = _wordPtr - _words.begin() - 1;
 	_nouns.push_back(n);
 


Commit: 2e69903cbb16ed9d939caad82b17c8c1e9a20a3c
    https://github.com/scummvm/scummvm/commit/2e69903cbb16ed9d939caad82b17c8c1e9a20a3c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-06-16T17:55:16-07:00

Commit Message:
GLK: Change savegame interpreter Ids from index to 4 byte code

Changed paths:
    engines/glk/glk.cpp
    engines/glk/glk_types.h
    engines/glk/quetzal.cpp
    engines/glk/quetzal.h


diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index d154de2..1208cba 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 3c233ff..2cf66d0 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 69b0475..a745d75 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 7f2dd30..c9452b6 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
  */


Commit: 1afd60cd3e98725c59daf9cdc7a40655c454fb81
    https://github.com/scummvm/scummvm/commit/1afd60cd3e98725c59daf9cdc7a40655c454fb81
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-06-16T18:03:17-07:00

Commit Message:
GLK: Change language Id in savegames to more portable language code

Changed paths:
    engines/glk/glk.cpp
    engines/glk/quetzal.cpp


diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index 1208cba..ffb5015 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 a745d75..68c11d0 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');





More information about the Scummvm-git-logs mailing list