[Scummvm-git-logs] scummvm master -> 4952a6fb043c86d78d18890f6ba44f8c606f0f8d

sluicebox 22204938+sluicebox at users.noreply.github.com
Tue Apr 21 05:23:24 UTC 2020


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

Summary:
3c9b28e35d SCI32: Fix parsing digits from save filenames
4952a6fb04 SCI32: Fix KQ7 2.00 allowing too many saves


Commit: 3c9b28e35d3a51c4ea0a81f5967eb6ddc93d9bff
    https://github.com/scummvm/scummvm/commit/3c9b28e35d3a51c4ea0a81f5967eb6ddc93d9bff
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-04-20T22:21:38-07:00

Commit Message:
SCI32: Fix parsing digits from save filenames

Fixes KQ7 deleting the wrong save game and other bugs.
Most of these digit strings start with zero and so they've
been parsed as octal instead of decimal.

Changed paths:
    engines/sci/engine/kfile.cpp


diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 633793100d..7d36cdcd7c 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -400,7 +400,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
 			// of the filename
 			const int skip = name.firstChar() < '0' || name.firstChar() > '9';
 
-			if (sscanf(name.c_str() + skip, "%i.DTA", &saveNo) != 1) {
+			if (sscanf(name.c_str() + skip, "%d.DTA", &saveNo) != 1) {
 				warning("Could not parse game filename %s", name.c_str());
 			}
 
@@ -453,7 +453,7 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) {
 		int saveNo = -1;
 		if (name == "911.sg" || name == "autorama.sg") {
 			saveNo = kAutoSaveId;
-		} else if (sscanf(name.c_str(), "ramasg.%i", &saveNo) == 1) {
+		} else if (sscanf(name.c_str(), "ramasg.%d", &saveNo) == 1) {
 			saveNo += kSaveIdShift;
 		}
 
@@ -679,8 +679,8 @@ reg_t kFileIOUnlink(EngineState *s, int argc, reg_t *argv) {
 		// Special cases for KQ7 & RAMA, basically identical to the SQ4 case
 		// above, where the game hardcodes its save game names
 		int saveNo;
-		if (sscanf(name.c_str(), "kq7cdsg.%i", &saveNo) == 1 ||
-			sscanf(name.c_str(), "ramasg.%i", &saveNo) == 1) {
+		if (sscanf(name.c_str(), "kq7cdsg.%d", &saveNo) == 1 ||
+			sscanf(name.c_str(), "ramasg.%d", &saveNo) == 1) {
 
 			name = g_sci->getSavegameName(saveNo + kSaveIdShift);
 		} else if (g_sci->getGameId() == GID_RAMA && (name == "911.sg" || name == "autorama.sg")) {
@@ -835,7 +835,7 @@ reg_t kFileIOExists(EngineState *s, int argc, reg_t *argv) {
 		// the native save/load dialogue
 		if (name == "autorama.sg") {
 			findSaveNo = kAutoSaveId;
-		} else if (sscanf(name.c_str(), "ramasg.%i", &findSaveNo) == 1) {
+		} else if (sscanf(name.c_str(), "ramasg.%d", &findSaveNo) == 1) {
 			findSaveNo += kSaveIdShift;
 		}
 	}


Commit: 4952a6fb043c86d78d18890f6ba44f8c606f0f8d
    https://github.com/scummvm/scummvm/commit/4952a6fb043c86d78d18890f6ba44f8c606f0f8d
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2020-04-20T22:21:38-07:00

Commit Message:
SCI32: Fix KQ7 2.00 allowing too many saves

Changed paths:
    engines/sci/engine/script_patches.cpp


diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 52750dd549..900ed125dc 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -5251,10 +5251,35 @@ static const uint16 kq7SnakeOilSalesmanPatch[] = {
 	PATCH_END
 };
 
+// KQ7 allows a maximum of 10 save games but English version 2.00 introduced a
+//  script bug which removed the check that enforces this. We add the missing
+//  check so that the game doesn't break. Sierra later released English version
+//  2.00b whose only change was to fix this.
+//
+// Applies to: English PC 2.00
+// Responsible method: startBut:doVerb
+static const uint16 kq7TooManySavesSignature[] = {
+	0x47, 0x15, 0x00, SIG_UINT16(0x0000),   // calle proc21_0 [ get save count ]
+	0xa5, 0x00,                             // sat 00 [ unused ]
+	SIG_MAGICDWORD,
+	0x35, 0x00,                             // ldi 00
+	0x31, 0x16,                             // bnt 16 [ allow save ]
+	SIG_END
+};
+
+static const uint16 kq7TooManySavesPatch[] = {
+	PATCH_ADDTOOFFSET(+5),
+	0x36,                                   // push
+	0x35, 0x0a,                             // ldi 0a
+	0x20,                                   // ge? [ save count >= 10 ]
+	PATCH_END
+};
+
 //          script, description,                                      signature                                 patch
 static const SciScriptPatcherEntry kq7Signatures[] = {
 	{  true,     0, "disable video benchmarking",                  1, kq7BenchmarkSignature,                    kq7BenchmarkPatch },
 	{  true,     0, "remove hardcoded spin loop",                  1, kq7PragmaFailSpinSignature,               kq7PragmaFailSpinPatch },
+	{  true,    30, "fix allowing too many saves",                 1, kq7TooManySavesSignature,                 kq7TooManySavesPatch },
 	{  true,  5300, "fix snake oil salesman disposal",             1, kq7SnakeOilSalesmanSignature,             kq7SnakeOilSalesmanPatch },
 	{  true,  6100, "fix extra ambrosia",                          1, kq7ExtraAmbrosiaSignature,                kq7ExtraAmbrosiaPatch },
 	{  true,    31, "enable subtitles (1/3)",                      1, kq7SubtitleFixSignature1,                 kq7SubtitleFixPatch1 },




More information about the Scummvm-git-logs mailing list