[Scummvm-git-logs] scummvm master -> 4035e20b1196053dfe77605be574cbda82bb9251
sluicebox
noreply at scummvm.org
Sat Apr 9 02:58:18 UTC 2022
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3e1ecd2ea4 SCI: Remove "Dummy" from kernel functions debug command
6abb9c6061 SCI: kScummVMSleep is now available in SCI16
437c80e382 SCI: Add delay between LSL2 lottery ticket messages
4035e20b11 SCI: Fix SQ3 navigation message not displaying
Commit: 3e1ecd2ea42c2df4d098d8f1df74904e421cf522
https://github.com/scummvm/scummvm/commit/3e1ecd2ea42c2df4d098d8f1df74904e421cf522
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-04-08T22:42:04-04:00
Commit Message:
SCI: Remove "Dummy" from kernel functions debug command
There a lot of these entries due to our custom functions
Changed paths:
engines/sci/console.cpp
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index b8181566ca4..7041328da84 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -602,9 +602,13 @@ bool Console::cmdSelectors(int argc, const char **argv) {
bool Console::cmdKernelFunctions(int argc, const char **argv) {
debugPrintf("Kernel function names in numeric order:\n");
+ uint column = 0;
for (uint seeker = 0; seeker < _engine->getKernel()->getKernelNamesSize(); seeker++) {
- debugPrintf("%03x: %20s | ", seeker, _engine->getKernel()->getKernelName(seeker).c_str());
- if ((seeker % 3) == 2)
+ const Common::String &kernelName = _engine->getKernel()->getKernelName(seeker);
+ if (kernelName == "Dummy")
+ continue;
+ debugPrintf("%03x: %20s | ", seeker, kernelName.c_str());
+ if ((column++ % 3) == 2)
debugPrintf("\n");
}
Commit: 6abb9c6061b12aabcaf88c3514a1c946fe860ea9
https://github.com/scummvm/scummvm/commit/6abb9c6061b12aabcaf88c3514a1c946fe860ea9
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-04-08T22:42:04-04:00
Commit Message:
SCI: kScummVMSleep is now available in SCI16
Changed paths:
engines/sci/engine/kernel.cpp
engines/sci/engine/kernel.h
engines/sci/engine/kernel_tables.h
engines/sci/engine/kgraphics.cpp
engines/sci/engine/kmisc.cpp
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 13225299c7a..d49b51dde0b 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -846,7 +846,6 @@ void Kernel::loadKernelNames(GameFeatures *features) {
break;
}
-#ifdef ENABLE_SCI32
// Reserve a high range of kernel call IDs (0xe0 to 0xef) that can be used
// by ScummVM to improve integration and fix bugs in games that require
// more help than can be provided by a simple script patch (e.g. spinloops
@@ -856,17 +855,24 @@ void Kernel::loadKernelNames(GameFeatures *features) {
// that might try to add their own kernel calls in the same manner. It also
// helps to separate ScummVM interpreter's kernel calls from SSCI's standard
// kernel calls.
+ uint maxKernelId = kScummVMSleepId;
+#ifdef ENABLE_SCI32
if (getSciVersion() >= SCI_VERSION_2) {
- const uint kernelListSize = _kernelNames.size();
- _kernelNames.resize(0xe2);
- for (uint id = kernelListSize; id < 0xe0; ++id) {
- _kernelNames[id] = "Dummy";
- }
+ maxKernelId = kScummVMSaveLoadId;
+ }
+#endif
+ const uint kernelListSize = _kernelNames.size();
+ _kernelNames.resize(maxKernelId + 1);
+ for (uint id = kernelListSize; id < kScummVMSleepId; ++id) {
+ _kernelNames[id] = "Dummy";
+ }
- // Used by SCI32 script patches to remove CPU spinning on kGetTime
- _kernelNames[kScummVMSleepId] = "ScummVMSleep";
+ // Used by script patches to remove CPU spinning on kGetTime and add delays
+ _kernelNames[kScummVMSleepId] = "ScummVMSleep";
- // Used by GuestAdditions to support integrated save/load dialogue
+#ifdef ENABLE_SCI32
+ if (getSciVersion() >= SCI_VERSION_2) {
+ // Used by GuestAdditions to support integrated save/load dialog
_kernelNames[kScummVMSaveLoadId] = "ScummVMSaveLoad";
}
#endif
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 4929b72d1a6..522abd5c636 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -104,13 +104,13 @@ struct SciWorkaroundEntry; // from workarounds.h
// ---- Kernel signatures -----------------------------------------------------
-#ifdef ENABLE_SCI32
// Kernel functions that have been added for ScummVM script patches to call
enum {
kScummVMSleepId = 0xe0, // sleeps for a delay while remaining responsive
+#ifdef ENABLE_SCI32
kScummVMSaveLoadId = 0xe1 // launches ScummVM's save/load dialog
-};
#endif
+};
// internal kernel signature data
enum {
@@ -669,10 +669,6 @@ reg_t kPlayDuckClose(EngineState *s, int argc, reg_t *argv);
reg_t kPlayDuckSetVolume(EngineState *s, int argc, reg_t *argv);
reg_t kWebConnect(EngineState *s, int argc, reg_t *argv);
reg_t kWinExec(EngineState *s, int argc, reg_t *argv);
-
-// SCI32 custom ScummVM kernel functions
-reg_t kScummVMSleep(EngineState *s, int argc, reg_t *argv);
-reg_t kScummVMSaveLoad(EngineState *s, int argc, reg_t *argv);
#endif
reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
@@ -748,6 +744,12 @@ reg_t kFileIOGetCWD(EngineState *s, int argc, reg_t *argv);
reg_t kFileIOIsValidDirectory(EngineState *s, int argc, reg_t *argv);
#endif
+// Custom ScummVM kernel functions
+reg_t kScummVMSleep(EngineState *s, int argc, reg_t *argv);
+#ifdef ENABLE_SCI32
+reg_t kScummVMSaveLoad(EngineState *s, int argc, reg_t *argv);
+#endif
+
/** @} */
} // End of namespace Sci
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index c2a55a95217..95071bdf32e 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -832,9 +832,7 @@ static SciKernelMapEntry s_kernelMap[] = {
#endif
{ MAP_CALL(Show), SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(SinDiv), SIG_EVERYWHERE, "ii", NULL, NULL },
-#ifdef ENABLE_SCI32
- { MAP_CALL(ScummVMSleep), SIG_SCI32, SIGFOR_ALL, "i", NULL, NULL },
-#endif
+ { MAP_CALL(ScummVMSleep), SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(Sort), SIG_EVERYWHERE, "ooo", NULL, NULL },
{ MAP_CALL(Sqrt), SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(StrAt), SIG_EVERYWHERE, "ri(i)", NULL, kStrAt_workarounds },
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index cc22bacae6c..c0034153c3d 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -411,9 +411,8 @@ reg_t kWait(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, delta);
}
-#ifdef ENABLE_SCI32
// kScummVMSleep is our own custom kernel function that sleeps for
-// the number of ticks requested. We use this in SCI32 script patches
+// the number of ticks requested. We use this in script patches
// to replace spin loops so that the application remains responsive
// and doesn't just block the thread without updating the screen or
// processing input events.
@@ -422,7 +421,6 @@ reg_t kScummVMSleep(EngineState *s, int argc, reg_t *argv) {
s->sleep(ticks);
return s->r_acc;
}
-#endif
reg_t kCoordPri(EngineState *s, int argc, reg_t *argv) {
int16 y = argv[0].toSint16();
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 2b87d30fe6a..3e228267931 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -100,25 +100,6 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
neededSleep = 60;
}
break;
- case GID_KQ6: {
- // KQ6 has talking inventory items that animate in the inventory window.
- // This is done with unthrottled inner loops which we replace with
- // calls to kGameIsRestarting so that the screen updates and responds
- // to input. Since this can happen in any room, we detect if the caller
- // is inventory script 907. See kq6PatchTalkingInventory.
- if (s->_executionStack.size() >= 2) {
- Common::List<ExecStack>::const_iterator iter = s->_executionStack.reverse_begin();
- --iter; // skip this kernel call
- if (iter->type == EXEC_STACK_TYPE_CALL) {
- int callerScriptNumber = s->_segMan->getScript(iter->addr.pc.getSegment())->getScriptNumber();
- if (callerScriptNumber == 907) {
- s->_throttleTrigger = true;
- neededSleep = 90; // talk animation interval
- }
- }
- }
- break;
- }
case GID_SQ4:
// In SQ4 (floppy and CD) the sequel police appear way too quickly in
// the Skate-o-rama rooms, resulting in all sorts of timer issues, like
@@ -937,8 +918,8 @@ reg_t kKawaDbugStr(EngineState *s, int argc, reg_t *argv)
reg_t kEmpty(EngineState *s, int argc, reg_t *argv) {
// Placeholder for empty kernel functions which are still called from the
// engine scripts (like the empty kSetSynonyms function in SCI1.1). This
- // differs from dummy functions because it does nothing and never throws a
- // warning when it is called.
+ // differs from dummy functions because it doesn't throw an error when it
+ // is called.
return s->r_acc;
}
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index bb1d1a0bfe3..e10a93cd69d 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -5768,8 +5768,8 @@ static const uint16 kq6PatchTruncatedMessagesFix[] = {
// their mouths are animated by inner loops that call kDrawCel with unthrottled
// inner inner loops that spin to create a delay between frames. This prevents
// updating the screen and responding to input. We replace the spin loops with
-// calls to kGameIsRestarting, which detects and throttles these calls so that
-// the speed is reasonable, the screen updates, and the game is responsive.
+// calls to kScummVMSleep for 5 ticks so that the speed is reasonable, the
+// screen updates, and the game is responsive.
//
// Applies to: All versions
// Responsible method: participle:doVerb, tomato:doVerb
@@ -5786,9 +5786,9 @@ static const uint16 kq6SignatureTalkingInventory[] = {
static const uint16 kq6PatchTalkingInventory[] = {
PATCH_ADDTOOFFSET(+2),
0x78, // push1
- 0x76, // push0
- 0x43, 0x2c, 0x02, // callk GameIsRestarting 02 [ custom throttling ]
- 0x34, PATCH_UINT16(0x0000), // ldi 0000 [ exit loop ]
+ 0x39, 0x05, // pushi 05
+ 0x43, kScummVMSleepId, 0x02, // callk kScummVMSleep 02 [ 5 ticks ]
+ 0x35, 0x00, // ldi 00 [ exit loop ]
PATCH_END
};
Commit: 437c80e38269b9b012ba3666952585c491db7be9
https://github.com/scummvm/scummvm/commit/437c80e38269b9b012ba3666952585c491db7be9
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-04-08T22:56:39-04:00
Commit Message:
SCI: Add delay between LSL2 lottery ticket messages
Thanks to @eriktorbjorn for noticing this
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 e10a93cd69d..407c9841fa1 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -7908,9 +7908,62 @@ static const uint16 larry2PatchWearParachutePoints[] = {
PATCH_END
};
-// script, description, signature patch
+// When buying a lottery ticket, the message box "Processing..." is displayed
+// three times with no delay between the messages. In the original, each was
+// visibly erased before the next because the interpreter drew directly to the
+// screen. This created the necessary flicker effect indicating that the three
+// identical messages were separte. In ScummVM there is no flicker because the
+// window is updated with the screen buffer when processing events or between
+// game cycles. The result is a single message box that appears to not respond
+// to Enter or clicks until the third one dismisses it.
+//
+// We fix this by adding a brief delay in the "Procesing..." loop with a call to
+// kScummVMSleep so that the screen is redrawn between message boxes and the
+// intended effect occurs as in the original. This patch is broken up into two
+// parts because different versions have different instructions in the loop.
+//
+// Applies to: All versions
+// Responsible method: rm114Script:changeState(15)
+static const uint16 larry2SignatureLotteryTicketMessages1[] = {
+ 0x35, 0x00, // ldi 00
+ 0xa5, 0x00, // sat 00 [ temp0 = 0 ]
+ 0x8d, 0x00, // lst 00 [ start loop ]
+ SIG_MAGICDWORD,
+ 0x35, 0x03, // ldi 03
+ 0x22, // lt? [ temp0 < 3 ]
+ 0x30, SIG_ADDTOOFFSET(+1), 0x00, // bnt [ exit loop ]
+ SIG_END
+};
+
+static const uint16 larry2PatchLotteryTicketMessages1[] = {
+ 0xa5, 0x00, // sat 00 [ temp0 = 0 (acc already 0) ]
+ 0x7a, // push2 [ start loop ]
+ 0x20, // ge? [ 2 >= temp0 ]
+ 0x31, PATCH_GETORIGINALBYTEADJUST(+10, +6), // bnt [ exit loop ]
+ 0x78, // push1
+ 0x39, 0x02, // pushi 02
+ 0x43, kScummVMSleepId, 0x02, // callk kScummVMSleep 02 [ 2 ticks ]
+ PATCH_END
+};
+
+static const uint16 larry2SignatureLotteryTicketMessages2[] = {
+ 0x47, 0xff, SIG_MAGICDWORD, 0x00, 0x0c, // calle proc255_0 0c [ Print "Processing..." ]
+ 0xc5, 0x00, // +at 00 [ temp0++, acc = temp0 ]
+ 0x32, SIG_ADDTOOFFSET(+1), 0xff, // jmp [ continue loop ]
+ SIG_END
+};
+
+static const uint16 larry2PatchLotteryTicketMessages2[] = {
+ PATCH_ADDTOOFFSET(+6),
+ 0x32, PATCH_GETORIGINALBYTEADJUST(+7, -2), 0xff, // jmp [ continue loop ]
+ PATCH_END
+};
+
+// script, description, signature patch
static const SciScriptPatcherEntry larry2Signatures[] = {
- { true, 63, "plane: no points for wearing parachute", 1, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints },
+ { true, 63, "plane: no points for wearing parachute", 1, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints },
+ { true, 114, "lottery ticket messages (1/2)", 1, larry2SignatureLotteryTicketMessages1, larry2PatchLotteryTicketMessages1 },
+ { true, 114, "lottery ticket messages (2/2)", 1, larry2SignatureLotteryTicketMessages2, larry2PatchLotteryTicketMessages2 },
SCI_SIGNATUREENTRY_TERMINATOR
};
Commit: 4035e20b1196053dfe77605be574cbda82bb9251
https://github.com/scummvm/scummvm/commit/4035e20b1196053dfe77605be574cbda82bb9251
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-04-08T22:57:29-04:00
Commit Message:
SCI: Fix SQ3 navigation message not displaying
Fixes bug #13114
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 407c9841fa1..2b4df9076b5 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -18612,6 +18612,44 @@ static const uint16 sq3AnnouncementsPatch[] = {
PATCH_END
};
+// In the navigation computer, selecting your current location is supposed to
+// display COURSE ALREADY ACHIEVED but the message doesn't appear in ScummVM.
+// This occurs in later versions of SQ3.
+//
+// The navigation computer was changed in version 1.018 to return to the main
+// screen when selecting the current location. It appears that there was some
+// confusion though; the new script incorrectly attempts to disable the scan
+// button and sets a three second pause after requesting a room change. The
+// result is that the pause doesn't occur and the text is drawn and then erased
+// on the same game cycle. By the time ScummVM updates the window from the
+// screen buffer it's too late. In Sierra's interpreter the text only flickers
+// on the screen, even on slow machines.
+//
+// We fix this by calling kScummVMSleep with the script's three second delay so
+// that the screen updates and the message is displayed. The button states
+// don't matter because no input is processed when sleeping and the script sets
+// a new room immediately afterwards.
+//
+// Applies to: English PC 1.018, German PC, German Amiga, Macintosh
+// Responsible method: courseScript:changeState(1)
+// Fixes bug: #13114
+static const uint16 sq3CourseAchievedSignature[] = {
+ 0x39, SIG_MAGICDWORD, // pushi state
+ SIG_SELECTOR8(state),
+ 0x78, // push1
+ 0x76, // push0
+ 0x72, SIG_ADDTOOFFSET(+2), // lofsa scanBut
+ 0x4a, 0x06, // send 06 [ scanBut state: 0 (has no effect) ]
+ SIG_END
+};
+
+static const uint16 sq3CourseAchievedPatch[] = {
+ 0x38, PATCH_UINT16(0x0001), // pushi 0001
+ 0x38, PATCH_UINT16(0x00b4), // pushi 00b4
+ 0x43, kScummVMSleepId, 0x02, // callk kScummVMSleep 02 [ 180 ticks ]
+ PATCH_END
+};
+
// Space Quest 3 has some strings hard coded in the scripts file
// We need to patch them for the Hebrew translation
@@ -18642,6 +18680,7 @@ static const uint16 sq3HebrewStatusBarNamePatch[] = {
// script, description, signature patch
static const SciScriptPatcherEntry sq3Signatures[] = {
{ false, 0, "Hebrew: Replace name in status bar", 1, sq3HebrewStatusBarNameSignature, sq3HebrewStatusBarNamePatch },
+ { true, 19, "Fix course achieved message", 1, sq3CourseAchievedSignature, sq3CourseAchievedPatch },
{ true, 117, "Fix end credits", 1, sq3EndCreditsSignature, sq3EndCreditsPatch },
{ true, 702, "Fix scumsoft announcements", 1, sq3AnnouncementsSignature, sq3AnnouncementsPatch },
{ false, 996, "Hebrew: Replace 'Enter input' prompt", 1, sq3HebrewEnterInputSignature, sq3HebrewEnterInputPatch },
More information about the Scummvm-git-logs
mailing list