[Scummvm-git-logs] scummvm master -> b5b94a03da0692492b879876cedbaf524612373e

sluicebox noreply at scummvm.org
Wed Nov 9 00:38:02 UTC 2022


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:
2d98fda2df SCI: Fix KQ6 Mac About dialog lockups
ddf7b7da14 SCI: Add KQ6 Mac workaround for long About message
b5b94a03da SCI: Convert LB2 German fix to message workaround


Commit: 2d98fda2dfe9dc52fc722310b683f8370bda3d15
    https://github.com/scummvm/scummvm/commit/2d98fda2dfe9dc52fc722310b683f8370bda3d15
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-11-08T16:37:17-08:00

Commit Message:
SCI: Fix KQ6 Mac About dialog lockups

Fixes script bugs in the original that caused buttons such as
"Tips for playing King's Quest VI" to always lock up the game

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 2454b564bdc..471b12b13e3 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -6656,6 +6656,44 @@ static const uint16 kq6MacPatchMacOpeningMovieDelay[] = {
 	PATCH_END
 };
 
+// In KQ6 Mac, the About dialogs break the game. There are four buttons that
+//  display a series of messages, but three of them permanently disable input.
+//  This is an incompatibility between the existing PC scripts and the kPlatform
+//  calls that were added to system scripts to enable/disable the Mac icon bar.
+//
+// We fix this by changing the three broken button scripts to act like the one
+//  that survives the bug. The "About King's Quest VI" button happens to work
+//  because sixScript sets a 1 cycle delay before calling Kq6Messager:say. The
+//  others call say immediately, deep within nested event loops. Patching in a
+//  new first state that sets a 1 cycle delay fixes the other button scripts.
+//
+// Applies to: English Mac only
+// Responsible methods: oneThroughFive:changeState, tips:changeState,
+//                      walkThrough:changeState
+static const uint16 kq6MacSignatureAboutDialogs[] = {
+	SIG_MAGICDWORD,
+	0x87, 0x01,                         // lap 01
+	0x65, 0x14,                         // aTop state
+	0x36,                               // push
+	0x3c,                               // dup
+	0x35, 0x00,                         // ldi 00
+	0x1a,                               // eq?
+	0x31, SIG_ADDTOOFFSET(+1),          // bnt [ state 1 ]
+	0x38, SIG_SELECTOR16(say),          // pushi say
+	SIG_END
+};
+
+static const uint16 kq6MacPatchAboutDialogs[] = {
+	0x78,                               // push1
+	0x69, 0x1a,                         // sTop cycles [ cycles = 1 ]
+	0x6f, 0x14,                         // ipTos state [ increment state ]
+	0x35, 0x01,                         // ldi 01
+	0x04,                               // sub  [ state - 1 ]
+	0x36,                               // push [ use previous state value in switch ]
+	0x2f,                               // bt   [ state 1 ]
+	PATCH_END
+};
+
 //          script, description,                                      signature                                 patch
 static const SciScriptPatcherEntry kq6Signatures[] = {
 	{  true,    52, "CD: Girl In The Tower playback",                 1, kq6CDSignatureGirlInTheTowerPlayback,     kq6CDPatchGirlInTheTowerPlayback },
@@ -6677,6 +6715,7 @@ static const SciScriptPatcherEntry kq6Signatures[] = {
 	{  true,   481, "fix duplicate baby tears point",                 1, kq6SignatureDuplicateBabyTearsPoint,      kq6PatchDuplicateBabyTearsPoint },
 	{  true,   640, "fix 'Tickets Only' audio timing",                1, kq6CDSignatureTicketsOnlyAudioTiming,     kq6CDPatchTicketsOnlyAudioTiming },
 	{  true,   745, "fix wedding genie lamp message",                 1, kq6SignatureWeddingGenieLampMessage,      kq6PatchWeddingGenieLampMessage },
+	{ false,   905, "Mac: fix about dialogs",                         3, kq6MacSignatureAboutDialogs,              kq6MacPatchAboutDialogs },
 	{  true,   907, "fix inventory stack leak",                       1, kq6SignatureInventoryStackFix,            kq6PatchInventoryStackFix },
 	{  true,   907, "fix hair detection for ribbon's look msg",       1, kq6SignatureLookRibbonFix,                kq6PatchLookRibbonFix },
 	{  true,   907, "talking inventory workaround",                   4, kq6SignatureTalkingInventory,             kq6PatchTalkingInventory },
@@ -24386,6 +24425,8 @@ void ScriptPatcher::processScript(uint16 scriptNr, SciSpan<byte> scriptData) {
 				if (_isMacSci11) {
 					// Enables Mac-only patch to work around missing pic
 					enablePatch(signatureTable, "Mac: Drink Me pic");
+					// Enables Mac-only patch for dialog box incompatibilities
+					enablePatch(signatureTable, "Mac: fix about dialogs");
 				}
 				break;
 			case GID_LAURABOW2:


Commit: ddf7b7da147031f4df8027a171c7d37183fe6f9b
    https://github.com/scummvm/scummvm/commit/ddf7b7da147031f4df8027a171c7d37183fe6f9b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-11-08T16:37:18-08:00

Commit Message:
SCI: Add KQ6 Mac workaround for long About message

Changed paths:
    engines/sci/engine/workarounds.cpp
    engines/sci/engine/workarounds.h


diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 1655cbf3837..a7bf25ef65d 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -1309,6 +1309,12 @@ static const SciMessageWorkaroundEntry messageWorkarounds[] = {
 	// Clicking the drink-me potion on ego in the castle basement hallways while guards are around
 	{ GID_KQ6,           SCI_MEDIA_ALL,    K_LANG_NONE,     -1,  840,   3,  14,   1,  1, { MSG_WORKAROUND_REMAP,    899,   0,   0, 198,  1, 99,   0,   0, nullptr } },
 	{ GID_KQ6,           SCI_MEDIA_ALL,    K_LANG_NONE,     -1,  899,   1,  14,   1,  1, { MSG_WORKAROUND_REMAP,    899,   0,   0, 198,  1, 99,   0,   0, nullptr } },
+	// "Tips for playing King's Quest VI" displays a message that's too long to display on the screen
+	// with Macintosh fonts and causes the graphics code to crash. In the original this "worked" because
+	// of a script bug that truncated all CD and Mac messages to 400 characters, even though KQ6 has
+	// several important messages that are much longer. We fix the truncation bug with a script patch,
+	// but this one message needs to remain shorter.
+	{ GID_KQ6,           SCI_MEDIA_MAC,    K_LANG_NONE,     -1,  908,   0,   0,  16, 27, { MSG_WORKAROUND_EXTRACT,  908,   0,   0,  16, 27, 99,   0, 466, nullptr } },
 	// Asking Yvette about Tut in act 2 party in floppy version - bug #10723
 	//  The last two sequences in this five part message reveal a murder that hasn't occurred yet.
 	//  We skip these as to not spoil the plot, but only in the act 2 rooms, as the message is used
@@ -1418,7 +1424,8 @@ static SciMessageWorkaroundSolution findMessageWorkaround(int module, byte noun,
 		if (workaround->gameId == g_sci->getGameId() &&
 			(workaround->media == SCI_MEDIA_ALL ||
 			(workaround->media == SCI_MEDIA_FLOPPY && !g_sci->isCD()) ||
-			(workaround->media == SCI_MEDIA_CD && g_sci->isCD())) &&
+			(workaround->media == SCI_MEDIA_CD && g_sci->isCD()) ||
+			(workaround->media == SCI_MEDIA_MAC && g_sci->getPlatform() == Common::kPlatformMacintosh && !g_sci->isCD())) &&
 			(workaround->language == K_LANG_NONE ||
 			workaround->language == g_sci->getSciLanguage()) &&
 			(workaround->roomNumber == -1 ||
diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h
index 9a9608e30f4..2fff741fe46 100644
--- a/engines/sci/engine/workarounds.h
+++ b/engines/sci/engine/workarounds.h
@@ -124,7 +124,8 @@ enum SciMessageWorkaroundType {
 enum SciMedia {
 	SCI_MEDIA_ALL,
 	SCI_MEDIA_FLOPPY,
-	SCI_MEDIA_CD
+	SCI_MEDIA_CD,
+	SCI_MEDIA_MAC, // mac floppy
 };
 
 struct SciMessageWorkaroundSolution {


Commit: b5b94a03da0692492b879876cedbaf524612373e
    https://github.com/scummvm/scummvm/commit/b5b94a03da0692492b879876cedbaf524612373e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-11-08T16:37:18-08:00

Commit Message:
SCI: Convert LB2 German fix to message workaround

Changed paths:
    engines/sci/engine/kgraphics.cpp
    engines/sci/engine/workarounds.cpp


diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 239a402df3a..b62eec7d061 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -366,21 +366,6 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
 	const bool useMacFonts = g_sci->hasMacFonts() && (argc < 6);
 	if (!useMacFonts) {
 		g_sci->_gfxText16->kernelTextSize(splitText.c_str(), languageSplitter, font, maxWidth, &textWidth, &textHeight);
-
-		// One of the game texts in LB2 German contains loads of spaces in
-		// its end. We trim the text here, otherwise the graphics code will
-		// attempt to draw a very large window (larger than the screen) to
-		// show the text, and crash.
-		// Fixes bug #5710.
-		if (textWidth >= g_sci->_gfxScreen->getDisplayWidth() ||
-			textHeight >= g_sci->_gfxScreen->getDisplayHeight()) {
-			warning("kTextSize: string would be too big to fit on screen. Trimming it");
-			text.trim();
-			// Copy over the trimmed string...
-			s->_segMan->strcpy_(argv[1], text.c_str());
-			// ...and recalculate bounding box dimensions
-			g_sci->_gfxText16->kernelTextSize(splitText.c_str(), languageSplitter, font, maxWidth, &textWidth, &textHeight);
-		}
 	} else {
 		// Mac games with native fonts always use them for sizing unless a sixth
 		// parameter is passed to indicate that SCI font sizing should be used.
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index a7bf25ef65d..e3a06806846 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -1327,6 +1327,12 @@ static const SciMessageWorkaroundEntry messageWorkarounds[] = {
 	{ GID_LAURABOW2,     SCI_MEDIA_FLOPPY, K_LANG_NONE,     -1,  550,   5,  39,   6,  1, { MSG_WORKAROUND_REMAP,    550,  45,  39,   6,  1,  0,   0,   0, nullptr } },
 	// Looking at coal in room 720, message is prepended with carriage return and newline
 	{ GID_LAURABOW2,     SCI_MEDIA_CD,     K_LANG_ENGLISH,  -1,  720,  12,   1,   0,  1, { MSG_WORKAROUND_EXTRACT,  720,  12,   1,   0,  1, 99,   2, 255, nullptr } },
+	// Asking Olympia about Pippin Carter during Act 2 in German version - bug #5170
+	//  This message contains over seventy trailing newlines, causing the graphics code to
+	//  draw a window larger than the screen and crash. We trim the trailing newlines.
+	{ GID_LAURABOW2,     SCI_MEDIA_FLOPPY, K_LANG_GERMAN,   -1, 1892,   1,   6,   3,  1, { MSG_WORKAROUND_EXTRACT, 1892,   1,   6,   3,  1, 25,   0, 249, nullptr } },
+	// Asking Ramses about snake oil in German version. Same as above: excessive trailing newlines.
+	{ GID_LAURABOW2,     SCI_MEDIA_FLOPPY, K_LANG_GERMAN,   -1, 1891,   1,   6,  41,  1, { MSG_WORKAROUND_EXTRACT, 1891,   1,   6,  41,  1, 27,   0, 146, nullptr } },
 	// Using the hand icon on Keith in the Blue Room (missing message) - bug #6253
 	{ GID_PQ1,           SCI_MEDIA_ALL,    K_LANG_NONE,     -1,   38,  10,   4,   8,  1, { MSG_WORKAROUND_REMAP,     38,  10,   4,   9,  1,  0,   0,   0, nullptr } },
 	// Using the eye icon on Keith in the Blue Room (no message and wrong talker) - bug #6253




More information about the Scummvm-git-logs mailing list