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

sluicebox 22204938+sluicebox at users.noreply.github.com
Mon Feb 1 04:09:51 UTC 2021


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:
b23daadf00 SCI32: Fix restoring PHANT2 games from overlay
20d052fee4 SCI32: PHANT2 script patch comments
a8a6bf4f30 SCI32: Remove PHANT2 spin loop in easter egg


Commit: b23daadf0056c92c0329b1966c9fa60f3b8dbdc6
    https://github.com/scummvm/scummvm/commit/b23daadf0056c92c0329b1966c9fa60f3b8dbdc6
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-01-31T19:37:58-08:00

Commit Message:
SCI32: Fix restoring PHANT2 games from overlay

Fixes restoring from overlay while game is in handsOff mode.
For example: room 3310.

Changed paths:
    engines/sci/engine/guest_additions.cpp
    engines/sci/engine/selector.cpp
    engines/sci/engine/selector.h
    engines/sci/engine/vm.h


diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index 0b9bbf2a86..dfca1c433d 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -780,7 +780,14 @@ bool GuestAdditions::restoreFromLauncher() const {
 		if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
 			// Phantasmagoria 2 moves the function that actually restores
 			// a game, and uses a property of the main game object when picking
-			// the save game to restore
+			// the save game to restore. Before calling this function, we
+			// must ensure that input is enabled, as the "Click to continue"
+			// prompt expects this. Otherwise, restoring from our overlay during
+			// a handsOff sequence breaks the prompt and crashes the next room.
+			// We enable input by calling p2User:canInput(1).
+			reg_t canInputParams[] = { TRUE_REG };
+			invokeSelector(_state->variables[VAR_GLOBAL][kGlobalVarPhant2User], SELECTOR(canInput), 1, canInputParams);
+
 			writeSelectorValue(_segMan, g_sci->getGameObject(), SELECTOR(num), _state->_delayedRestoreGameId - kSaveIdShift);
 			invokeSelector(g_sci->getGameObject(), SELECTOR(reallyRestore));
 		} else if (g_sci->getGameId() == GID_SHIVERS) {
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index 7ea4dc5df6..25e225f2b7 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -232,6 +232,7 @@ void Kernel::mapSelectors() {
 	FIND_SELECTOR(scratch);
 	FIND_SELECTOR(num);
 	FIND_SELECTOR(reallyRestore);
+	FIND_SELECTOR(canInput);
 	FIND_SELECTOR(bookMark);
 	FIND_SELECTOR(fileNumber);
 	FIND_SELECTOR(description);
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index b324be0004..61bb4f50b5 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -190,6 +190,7 @@ struct SelectorCache {
 	Selector scratch; // for Phant2 save/load patching
 	Selector num; // for Phant2 restore from launcher
 	Selector reallyRestore; // for Phant2 restore from launcher
+	Selector canInput; // for Phant2 restore from launcher
 	Selector bookMark; // for Phant2 auto-save
 	Selector fileNumber; // for RAMA save/load
 	Selector description; // for RAMA save/load
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 50c90baaa6..9136f77b9c 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -152,6 +152,7 @@ enum GlobalVar {
 	kGlobalVarVersion        = 27,
 	kGlobalVarGK2MusicVolume = 76, // 0 to 127
 	kGlobalVarPhant2SecondaryVolume = 76, // 0 to 127
+	kGlobalVarPhant2User           = 80,
 	kGlobalVarFastCast             = 84, // SCI16
 	kGlobalVarMessageType          = 90,
 	kGlobalVarTextSpeed            = 94, // SCI32; 0 is fastest, 8 is slowest


Commit: 20d052fee4dd3f96af6b3d039a97e69089fa226e
    https://github.com/scummvm/scummvm/commit/20d052fee4dd3f96af6b3d039a97e69089fa226e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-01-31T19:39:21-08:00

Commit Message:
SCI32: PHANT2 script patch comments

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 f9bd15db24..b71f9ba2c6 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -9928,6 +9928,7 @@ static const uint16 phant2WaitParam1Patch[] = {
 // is set to 1, which means that these fades are quite slow. We replace the use
 // of global[227] with an immediate value for a reasonable fade speed.
 // Applies to at least: US English
+// Responsible method: topInterfacePlane:handleEvent
 static const uint16 phant2SlowIFadeSignature[] = {
 	0x43, 0x21, SIG_UINT16(0x0000),     // callk FrameOut, 0
 	SIG_MAGICDWORD,
@@ -9969,6 +9970,7 @@ static const uint16 phant2Wait4FadePatch[] = {
 // and size arguments, so the version file data never actually makes it into the
 // game.
 // Applies to at least: Phant2 US English CD
+// Responsible method: p2:init
 static const uint16 phant2GetVersionSignature[] = {
 	0x36,                         // push
 	0x35, 0xff,                   // ldi $ff
@@ -10014,6 +10016,7 @@ static const uint16 phant2GetVersionPatch[] = {
 // puzzle, which causes the mouse to appear unresponsive. Replace the spin loop
 // with a call to ScummVM kWait.
 // Applies to at least: US English
+// Responsible method: thePuzzle:doit
 static const uint16 phant2RatboySignature[] = {
 	0x8d, 0x01,                   // lst temp[1]
 	0x35, 0x1e,                   // ldi $1e
@@ -10040,6 +10043,7 @@ static const uint16 phant2RatboyPatch[] = {
 // order for dialogue in movies to be consistently audible, so patch the
 // in-game volume slider to limit it to our maximum.
 // Applies to at least: US English
+// Responsible method: optionsD:init
 // Fixes bug: #10165
 static const uint16 phant2AudioVolumeSignature[] = {
 	SIG_MAGICDWORD,
@@ -10130,6 +10134,7 @@ static const uint16 phant2NumSavesPatch2[] = {
 // ScrollbarArrow::action would only send cues once every N ticks whilst being
 // held down, but unfortunately the game was not programmed to do this.
 // Applies to at least: US English
+// Responsible method: WynDocTextView:cue
 static const uint16 phant2SlowScrollSignature[] = {
 	SIG_MAGICDWORD,
 	0x35, 0x0a,                         // ldi 10
@@ -10157,6 +10162,7 @@ static const uint16 phant2SlowScrollPatch[] = {
 // computer is displaying scary messages, since every time the scary message is
 // rendered the text fields re-render at the top-left corner of the screen.
 // Applies to at least: US English
+// Responsible method: WynNetDoco:open
 // Fixes bug: #10036
 static const uint16 phant2BadPositionSignature[] = {
 	SIG_MAGICDWORD,
@@ -10193,6 +10199,7 @@ static const uint16 phant2BadPositionPatch[] = {
 // messages, since every time the scary message is rendered the icons re-render
 // as closed.
 // Applies to at least: US English
+// Responsible method: WynNetDoco:refresh
 static const uint16 phant2BadIconSignature[] = {
 	SIG_MAGICDWORD,
 	0x38, SIG_SELECTOR16(setCel), // pushi setCel
@@ -10219,9 +10226,10 @@ static const uint16 phant2BadIconPatch[] = {
 // inventory item is wide, which causes the inventory to creep to the left by
 // one pixel per scrolled item.
 // Applies to at least: US English
+// Responsible method: Heap in script 63001
 // Fixes bug: #10037
 static const uint16 phant2InvLeftDeltaSignature[] = {
-	SIG_MAGICDWORD,
+	SIG_MAGICDWORD,                     // lftButn
 	SIG_UINT16(0x0042),                 // delta
 	SIG_UINT16(0x0019),                 // moveDelay
 	SIG_END
@@ -10233,7 +10241,7 @@ static const uint16 phant2InvLeftDeltaPatch[] = {
 };
 
 static const uint16 phant2InvRightDeltaSignature[] = {
-	SIG_MAGICDWORD,
+	SIG_MAGICDWORD,                     // rtButn
 	SIG_UINT16(0xffbe),                 // delta
 	SIG_UINT16(0x0019),                 // moveDelay
 	SIG_END
@@ -10247,6 +10255,7 @@ static const uint16 phant2InvRightDeltaPatch[] = {
 // The first inventory item is put too far to the right, which causes wide items
 // to get cut off on the right side of the inventory.
 // Applies to at least: US English
+// Responsible method: InvPlane:addItem
 static const uint16 phant2InvOffsetSignature[] = {
 	SIG_MAGICDWORD,
 	0x35, 0x26,                         // ldi 38


Commit: a8a6bf4f30beead046494646ee32530f9dfe7349
    https://github.com/scummvm/scummvm/commit/a8a6bf4f30beead046494646ee32530f9dfe7349
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-01-31T19:42:02-08:00

Commit Message:
SCI32: Remove PHANT2 spin loop in easter egg

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 b71f9ba2c6..70e1465e9d 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -10037,6 +10037,30 @@ static const uint16 phant2RatboyPatch[] = {
 	PATCH_END
 };
 
+// The game uses a spin loop during the floating head easter egg, which causes
+//  the mouse to appear unresponsive. Replace the inner loop with kWait.
+//
+// Applies to at least: US English
+// Responsible method: bigScript:changeState
+static const uint16 phant2FloatingHeadSignature[] = {
+	SIG_MAGICDWORD,
+	0x8d, 0x00,                   // lst 00
+	0x78,                         // push1
+	0x78,                         // push1
+	0x43, 0x79, SIG_UINT16(0x02), // callk GetTime, 2
+	0x1a,                         // eq?
+	0x31, 0x02,                   // bnt 02
+	SIG_END
+};
+
+static const uint16 phant2FloatingHeadPatch[] = {
+	0x78,                                     // push1
+	0x39, 0x3c,                               // pushi 3c [ 1 second ]
+	0x43, kScummVMWaitId, PATCH_UINT16(0x02), // callk Wait, 2
+	0x33, 0x04,                               // jmp 04
+	PATCH_END
+};
+
 // Phant2 has separate in-game volume controls for handling movie volume and
 // in-game volume (misleadingly labelled "music volume"), but really needs the
 // in-game volume to always be significantly lower than the movie volume in
@@ -10403,27 +10427,28 @@ static const uint16 phant2ScrollbarArrowPatch[] = {
 
 //          script, description,                                      signature                                  patch
 static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
-	{  true,     0, "speed up interface fades",                    3, phant2SlowIFadeSignature,                  phant2SlowIFadePatch },
-	{  true,     0, "fix bad arguments to get game version",       1, phant2GetVersionSignature,                 phant2GetVersionPatch },
-	{  true,  3000, "replace spin loop in alien password window",  1, phant2WaitParam1Signature,                 phant2WaitParam1Patch },
-	{  true,  4081, "replace spin loop after ratboy puzzle",       1, phant2RatboySignature,                     phant2RatboyPatch },
-	{  true, 63001, "fix inventory left scroll delta",             1, phant2InvLeftDeltaSignature,               phant2InvLeftDeltaPatch },
-	{  true, 63001, "fix inventory right scroll delta",            1, phant2InvRightDeltaSignature,              phant2InvRightDeltaPatch },
-	{  true, 63001, "fix inventory wrong initial offset",          1, phant2InvOffsetSignature,                  phant2InvOffsetPatch },
-	{  true, 63004, "limit in-game audio volume",                  1, phant2AudioVolumeSignature,                phant2AudioVolumePatch },
-	{  true, 63016, "replace spin loop during music fades",        1, phant2Wait4FadeSignature,                  phant2Wait4FadePatch },
-	{  true, 63019, "replace spin loop during computer load",      1, phant2WaitParam1Signature,                 phant2WaitParam1Patch },
-	{  true, 63019, "replace spin loop during computer scrolling", 1, phant2SlowScrollSignature,                 phant2SlowScrollPatch },
-	{  true, 63019, "fix bad doc/email name & memo positioning",   2, phant2BadPositionSignature,                phant2BadPositionPatch },
-	{  true, 63019, "fix bad folder/doc icon refresh",             2, phant2BadIconSignature,                    phant2BadIconPatch },
-	{  true, 63019, "fix file and note content placement",         1, phant2DocuStoreFileNotePlacementSignature, phant2DocuStoreFileNotePlacementPatch },
-	{  true, 63019, "fix email content placement",                 1, phant2DocuStoreEmailPlacementSignature,    phant2DocuStoreEmailPlacementPatch },
-	{  true, 64926, "fix computer scrollbar crash",                1, phant2ComputerScrollbarCrashSignature,     phant2ComputerScrollbarCrashPatch },
-	{  true, 64926, "fix volume scrollbar arrows",                 1, phant2ScrollbarArrowSignature,             phant2ScrollbarArrowPatch },
-	{  true, 64990, "remove save game name mangling (1/2)",        1, phant2SaveNameSignature1,                  phant2SaveNamePatch1 },
-	{  true, 64990, "increase number of save games (1/2)",         1, phant2NumSavesSignature1,                  phant2NumSavesPatch1 },
-	{  true, 64990, "increase number of save games (2/2)",         2, phant2NumSavesSignature2,                  phant2NumSavesPatch2 },
-	{  true, 64994, "remove save game name mangling (2/2)",        1, phant2SaveNameSignature2,                  phant2SaveNamePatch2 },
+	{  true,     0, "speed up interface fades",                      3, phant2SlowIFadeSignature,                  phant2SlowIFadePatch },
+	{  true,     0, "fix bad arguments to get game version",         1, phant2GetVersionSignature,                 phant2GetVersionPatch },
+	{  true,  3000, "replace spin loop in alien password window",    1, phant2WaitParam1Signature,                 phant2WaitParam1Patch },
+	{  true,  3310, "replace spin loop in floating head easter egg", 2, phant2FloatingHeadSignature,               phant2FloatingHeadPatch },
+	{  true,  4081, "replace spin loop after ratboy puzzle",         1, phant2RatboySignature,                     phant2RatboyPatch },
+	{  true, 63001, "fix inventory left scroll delta",               1, phant2InvLeftDeltaSignature,               phant2InvLeftDeltaPatch },
+	{  true, 63001, "fix inventory right scroll delta",              1, phant2InvRightDeltaSignature,              phant2InvRightDeltaPatch },
+	{  true, 63001, "fix inventory wrong initial offset",            1, phant2InvOffsetSignature,                  phant2InvOffsetPatch },
+	{  true, 63004, "limit in-game audio volume",                    1, phant2AudioVolumeSignature,                phant2AudioVolumePatch },
+	{  true, 63016, "replace spin loop during music fades",          1, phant2Wait4FadeSignature,                  phant2Wait4FadePatch },
+	{  true, 63019, "replace spin loop during computer load",        1, phant2WaitParam1Signature,                 phant2WaitParam1Patch },
+	{  true, 63019, "replace spin loop during computer scrolling",   1, phant2SlowScrollSignature,                 phant2SlowScrollPatch },
+	{  true, 63019, "fix bad doc/email name & memo positioning",     2, phant2BadPositionSignature,                phant2BadPositionPatch },
+	{  true, 63019, "fix bad folder/doc icon refresh",               2, phant2BadIconSignature,                    phant2BadIconPatch },
+	{  true, 63019, "fix file and note content placement",           1, phant2DocuStoreFileNotePlacementSignature, phant2DocuStoreFileNotePlacementPatch },
+	{  true, 63019, "fix email content placement",                   1, phant2DocuStoreEmailPlacementSignature,    phant2DocuStoreEmailPlacementPatch },
+	{  true, 64926, "fix computer scrollbar crash",                  1, phant2ComputerScrollbarCrashSignature,     phant2ComputerScrollbarCrashPatch },
+	{  true, 64926, "fix volume scrollbar arrows",                   1, phant2ScrollbarArrowSignature,             phant2ScrollbarArrowPatch },
+	{  true, 64990, "remove save game name mangling (1/2)",          1, phant2SaveNameSignature1,                  phant2SaveNamePatch1 },
+	{  true, 64990, "increase number of save games (1/2)",           1, phant2NumSavesSignature1,                  phant2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games (2/2)",           2, phant2NumSavesSignature2,                  phant2NumSavesPatch2 },
+	{  true, 64994, "remove save game name mangling (2/2)",          1, phant2SaveNameSignature2,                  phant2SaveNamePatch2 },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 




More information about the Scummvm-git-logs mailing list