[Scummvm-git-logs] scummvm master -> 5a9f14cc4e1f15a591594636dc101647accb189c

sluicebox noreply at scummvm.org
Tue Jul 18 18:49:36 UTC 2023


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:
f16f8c792f SCI32: Fix SQ6 demo inventory crash
c3f6ccfdca SCI32: Add fixes for early SQ6 demos
5a9f14cc4e SCI32: Fix kSetShowStyle version checks


Commit: f16f8c792fd0827ff55c947752e9120fd4c7d52b
    https://github.com/scummvm/scummvm/commit/f16f8c792fd0827ff55c947752e9120fd4c7d52b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-07-18T11:46:38-07:00

Commit Message:
SCI32: Fix SQ6 demo inventory crash

Fixes bug #14547

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 848dbb5fc43..ab816789389 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -24516,12 +24516,42 @@ static const uint16 sq6NarratorLockupPatch[] = {
 	PATCH_END
 };
 
+// The SQ6 demo can crash the inventory screen because ego:put doesn't clear the
+//  highlighted icon when dropping an item. This was fixed in the real game.
+//
+// We fix this by clearing SQInventory:highlightedIcon when showing inventory.
+//
+// Applies to: Demo (all versions)
+// Responsible method: SQInventory:show
+// Fixes bug: #14547
+static const uint16 sq6DemoInventorySignature[] = {
+	SIG_MAGICDWORD,
+	0x36,                               // push
+	0x35, 0x01,                         // ldi 01
+	0x02,                               // add
+	SIG_ADDTOOFFSET(+8),
+	0x72, SIG_ADDTOOFFSET(+2),          // lofsa invPlane
+	0x36,                               // push
+	SIG_END
+};
+
+static const uint16 sq6DemoInventoryPatch[] = {
+	0x76,                               // push0
+	0x69, 0x22,                         // sTop highlightedIcon [ highlightedIcon = 0 ]
+	0x78,                               // push1
+	0x02,                               // add
+	PATCH_GETORIGINALBYTES(+4, 8),
+	0x74, PATCH_GETORIGINALUINT16(+13), // lofss invPlane
+	PATCH_END
+};
+
 //          script, description,                                      signature                        patch
 static const SciScriptPatcherEntry sq6Signatures[] = {
 	{  true,     0, "fix slow transitions",                        1, sq6SlowTransitionSignature2,     sq6SlowTransitionPatch2 },
 	{  true,    15, "fix english pc missing points",               3, sq6MissingPointsSignature,       sq6MissingPointsPatch },
 	{  true,    15, "fix staple/celery missing point",             2, sq6StapleCeleryPointSignature,   sq6StapleCeleryPointPatch },
 	{  true,    15, "fix hookah hose missing point",               1, sq6HookahHosePointSignature,     sq6HookahHosePointPatch },
+	{  false,   15, "demo: fix inventory crash",                   1, sq6DemoInventorySignature,       sq6DemoInventoryPatch },
 	{  true,    15, "fix invalid array construction",              1, sci21IntArraySignature,          sci21IntArrayPatch },
 	{  true,    22, "fix invalid array construction",              1, sci21IntArraySignature,          sci21IntArrayPatch },
 	{  true,    31, "fix ExitFeature breaking icons",              2, sq6ExitFeatureIconSignature,     sq6ExitFeatureIconPatch },
@@ -25597,6 +25627,11 @@ void ScriptPatcher::processScript(uint16 scriptNr, SciSpan<byte> scriptData) {
 					enablePatch(signatureTable, "CD: disable timepod code for removed room");
 				}
 				break;
+			case GID_SQ6:
+				if (g_sci->isDemo()) {
+					enablePatch(signatureTable, "demo: fix inventory crash");
+				}
+				break;
 			default:
 				break;
 			}


Commit: c3f6ccfdca96f14cf439d5520a644e5b1a9f6542
    https://github.com/scummvm/scummvm/commit/c3f6ccfdca96f14cf439d5520a644e5b1a9f6542
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-07-18T11:48:26-07:00

Commit Message:
SCI32: Add fixes for early SQ6 demos

Changed paths:
    engines/sci/detection.h
    engines/sci/detection_tables.h
    engines/sci/engine/features.cpp
    engines/sci/engine/workarounds.cpp
    engines/sci/resource/resource.cpp


diff --git a/engines/sci/detection.h b/engines/sci/detection.h
index 8530576c1b3..63875e39d13 100644
--- a/engines/sci/detection.h
+++ b/engines/sci/detection.h
@@ -141,7 +141,7 @@ enum SciVersion {
 	SCI_VERSION_1_LATE, // Dr. Brain 1, EcoQuest 1, Longbow, PQ3, SQ1, LSL5, KQ5 CD
 	SCI_VERSION_1_1, // Dr. Brain 2, EcoQuest 1 CD, EcoQuest 2, KQ6, QFG3, SQ4CD, XMAS 1992 and many more
 	SCI_VERSION_2, // GK1, PQ4 floppy, QFG4 floppy
-	SCI_VERSION_2_1_EARLY, // GK2 demo, KQ7 1.4/1.51, LSL6 hires, PQ4CD, QFG4CD
+	SCI_VERSION_2_1_EARLY, // GK2 demo, KQ7 1.4/1.51, LSL6 hires, PQ4CD, QFG4CD, SQ6 early demos
 	SCI_VERSION_2_1_MIDDLE, // GK2, Hoyle 5, KQ7 2.00b, MUMG Deluxe, Phantasmagoria 1, PQ:SWAT, Shivers 1, SQ6, Torin
 	SCI_VERSION_2_1_LATE, // Demos and Mac versions of LSL7, Lighthouse, RAMA
 	SCI_VERSION_3 // LSL7, Lighthouse, RAMA, Phantasmagoria 2, interactive Lighthouse demos
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 1c786889523..171f04490a1 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -6017,15 +6017,16 @@ static const struct ADGameDescription SciGameDescriptions[] = {
 		AD_LISTEND},
 		Common::DE_DEU, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO_SQ6 },
 
-	// Space Quest 6 - English Win3.11 Demo (from Sneak Peeks 2)
+	// Space Quest 6 - English Win3.11 Interactive Demo (from Sneak Peeks 2)
+	// This demo has no speech, unlike the later DOS/Win version.
 	// Executable scanning reports "2.100.002", VERSION file reports "1.000.000"
 	{"sq6", "Demo", {
 		{"resource.map", 0, "5cf3f0db76080a4ac327190bd027e355", 2164},
 		{"resource.000", 0, "ab12724e078dea34b624e0d2a38dcd7c", 2159708},
 		AD_LISTEND},
-		Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO_SQ6_DEMO },
+		Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO3(GUIO_NOSPEECH, GUIO_NOLAUNCHLOAD, GUIO_NOASPECT) },
 
-	// Space Quest 6 - English Win3.1 Demo (from trembyle)
+	// Space Quest 6 - English Win3.11 Non-Interactive Demo (from trembyle)
 	// Found on Interactive Entertainment Episode 10 - Feb 1995
 	// Executable scanning reports "2.100.002"
 	{"sq6", "Demo", {
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 75189fddbe4..eef3e909402 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -624,7 +624,6 @@ MessageTypeSyncStrategy GameFeatures::getMessageTypeSyncStrategy() const {
 	case GID_LSL7:
 	case GID_MOTHERGOOSEHIRES:
 	case GID_PHANTASMAGORIA:
-	case GID_SQ6:
 	case GID_TORIN:
 		return kMessageTypeSyncStrategyDefault;
 
@@ -634,6 +633,13 @@ MessageTypeSyncStrategy GameFeatures::getMessageTypeSyncStrategy() const {
 	case GID_SHIVERS:
 		return kMessageTypeSyncStrategyShivers;
 
+	case GID_SQ6:
+		// don't sync the early demos; they are speechless and
+		// require the message type global to remain unchanged.
+		return (g_sci->isDemo() && getSciVersion() < SCI_VERSION_2_1_MIDDLE) ?
+			kMessageTypeSyncStrategyNone :
+			kMessageTypeSyncStrategyDefault;
+
 	case GID_GK2:
 	case GID_PQSWAT:
 	default:
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index d4260f4f1d1..cf479ec8750 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -578,6 +578,7 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
 	{ GID_SQ4,            -1,   708, -1,                  ".", "doVerb",                       nullptr,     0,     0, { WORKAROUND_FAKE,   0 } }, // Floppy: happens, when looking at the "next" button... in Russian version - bug #5573
 	{ GID_SQ5,           201,   201,  0,        "buttonPanel", "doVerb",                       nullptr,     0,     0, { WORKAROUND_FAKE,   1 } }, // when looking at the orange or red button - bug #5112
 	{ GID_SQ6,            -1,     0,  0,                "SQ6", "init",                         nullptr,     2,     2, { WORKAROUND_FAKE,   0 } }, // Demo and full version: called when the game starts (demo: room 0, full: room 100)
+	{ GID_SQ6,           390,   666, -1,                   "", "export 0",                     nullptr,     1,     1, { WORKAROUND_FAKE,   0 } }, // Demo: death dialog in room 390 (early version)
 	{ GID_SQ6,            -1, 64950, -1,            "Feature", "handleEvent",                  nullptr,     0,     0, { WORKAROUND_FAKE,   0 } }, // called when pressing "Start game" in the main menu, when entering the Orion's Belt bar (room 300), and perhaps other places
 	{ GID_SQ6,            -1, 64964,  0,              "DPath", "init",                         nullptr,     1,     1, { WORKAROUND_FAKE,   0 } }, // during the game
 	{ GID_SQ6,           210,   210,  0,       "buttonSecret", "doVerb",                       nullptr,     0,     0, { WORKAROUND_FAKE,   0 } }, // after winning the first round of stooge fighter 3
diff --git a/engines/sci/resource/resource.cpp b/engines/sci/resource/resource.cpp
index 521adb097c5..60395124dfc 100644
--- a/engines/sci/resource/resource.cpp
+++ b/engines/sci/resource/resource.cpp
@@ -1547,9 +1547,11 @@ bool ResourceManager::isBlacklistedPatch(const ResourceId &resId) const {
 
 	switch (g_sci->getGameId()) {
 	case GID_SHIVERS:
+	case GID_SQ6:
 		// The SFX resource map patch in the Shivers interactive demo has
 		// broken offsets for some sounds; ignore it so that the correct map
 		// from RESSCI.000 will be used instead.
+		// This also occurs in an early SQ6 demo; the original ignored the patch.
 		return g_sci->isDemo() &&
 			resId.getType() == kResourceTypeMap &&
 			resId.getNumber() == 65535;


Commit: 5a9f14cc4e1f15a591594636dc101647accb189c
    https://github.com/scummvm/scummvm/commit/5a9f14cc4e1f15a591594636dc101647accb189c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-07-18T11:48:26-07:00

Commit Message:
SCI32: Fix kSetShowStyle version checks

Fix version checks and divisions table. Now the early SQ6 demos start.

Fix version typo introduced in e23f5fe85517083bdd396e91f1963480dfd85fb4

Changed paths:
    engines/sci/engine/kgraphics32.cpp
    engines/sci/graphics/transitions32.cpp


diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index 43293518a5e..c157aba0060 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -399,7 +399,7 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
 	// KQ7 2.0b uses a mismatched version of the Styler script (SCI2.1early script
 	// for SCI2.1mid engine), so the calls it makes to kSetShowStyle are wrong and
 	// put `divisions` where `pFadeArray` is supposed to be.
-	if (getSciVersion() <= SCI_VERSION_1_EARLY || g_sci->getGameId() == GID_KQ7) {
+	if (getSciVersion() <= SCI_VERSION_2_1_EARLY || g_sci->getGameId() == GID_KQ7) {
 		blackScreen = 0;
 		pFadeArray = NULL_REG;
 		divisions = argc > 7 ? argv[7].toSint16() : -1;
@@ -419,7 +419,16 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
 		divisions = argc > 9 ? argv[9].toSint16() : -1;
 	}
 
-	if ((getSciVersion() < SCI_VERSION_2_1_MIDDLE && g_sci->getGameId() != GID_KQ7 && type == 15) || type > 15) {
+	// kShowStyleMorph (15) was introduced during SCI2.1early.
+	// It appears after LSL6 and PQ4, but so far the only known
+	// SCI2.1early games to use it are KQ7 and SQ6 demos.
+	int maxType = 15;
+	if (getSciVersion() < SCI_VERSION_2_1_EARLY ||
+		g_sci->getGameId() == GID_LSL6 ||
+		g_sci->getGameId() == GID_PQ4) {
+		maxType = 14;
+	}
+	if (type > maxType) {
 		error("Illegal show style %d for plane %04x:%04x", type, PRINT_REG(planeObj));
 	}
 
diff --git a/engines/sci/graphics/transitions32.cpp b/engines/sci/graphics/transitions32.cpp
index 1a49326b995..9911db989a9 100644
--- a/engines/sci/graphics/transitions32.cpp
+++ b/engines/sci/graphics/transitions32.cpp
@@ -35,7 +35,8 @@ static int dissolveSequences[2][20] = {
 	/* SCI2.1mid+ */ { 0, 0, 3, 6, 12, 20, 48, 96, 184, 272, 576, 1280, 3232, 6912, 13568, 24576, 46080, 73728, 132096, 466944 }
 };
 static int16 divisionsDefaults[2][16] = {
-	/* SCI2.1early- */ { 1, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 40, 40, 101, 101 },
+	// the last element in SCI2.1early was added after LSL6 and PQ4
+	/* SCI2.1early- */ { 1, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 40, 40, 101, 101, 2 },
 	/* SCI2.1mid+ */   { 1, 20, 20, 20, 20, 10, 10, 10, 10, 20, 20,  6, 10, 101, 101, 2 }
 };
 




More information about the Scummvm-git-logs mailing list