[Scummvm-git-logs] scummvm branch-2-8 -> 46307ca0b9c4e17ddc3661bed83eb033a1055b0c

sluicebox noreply at scummvm.org
Tue Jan 2 08:37:04 UTC 2024


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

Summary:
f4b8e05432 SCI: Fix PQ3 wrong ending
52d2fb69b1 CREATE_PROJECT: Fix crash when all engines disabled
368d44e3c8 AGI: Fix print.at parameter count in SQ1 1.0X
6c5ecf767e AGI: Fix uninit memory use, crash on `error`
46307ca0b9 SCI: Fix LSL5 TPrint script patch


Commit: f4b8e05432db242c208faf2bfaf5366e638868a8
    https://github.com/scummvm/scummvm/commit/f4b8e05432db242c208faf2bfaf5366e638868a8
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-02T00:34:31-08:00

Commit Message:
SCI: Fix PQ3 wrong ending

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 f4fa67c90f1..50ec36cfbc4 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -13488,6 +13488,40 @@ static const uint16 pq3PatchGiveLocketPoints[] = {
 	PATCH_END
 };
 
+// PQ3 plays the wrong ending if the player woke Marie from her coma but still
+//  has an extra rose in their inventory. Room 300 checks to see if Marie is
+//  awake by testing flags and item locations, but one of these tests is wrong
+//  and out of sync with similar tests in other scripts.
+//
+// Giving Marie the rose places it in her room, but purchasing a second rose
+//  changes rose:owner from her room back to ego, and the location check fails.
+//
+// We fix this by testing rose:state instead of rose:owner, as all the other
+//  scripts do. Sierra fixed this in later versions.
+//
+// Applies to: English PC VGA Floppy
+// Responsible method: rm300:init
+static const uint16 pq3SignatureWrongEnding[] = {
+	0x38, SIG_SELECTOR16(owner),         // pushi owner
+	0x76,                                // push0
+	0x39, SIG_MAGICDWORD,                // pushi at
+	      SIG_SELECTOR8(at),
+	0x78,                                // push1
+	0x39, 0x24,                          // pushi 24 [ rose ]
+	SIG_ADDTOOFFSET(+7),
+	0x35, 0x24,                          // ldi 24 [ hospital room ]
+	0x1a,                                // eq [ (rose owner:) == 36 ]
+	SIG_END
+};
+
+static const uint16 pq3PatchWrongEnding[] = {
+	0x38, PATCH_SELECTOR16(state),       // pushi state
+	PATCH_ADDTOOFFSET(+13),
+	0x35, 0x00,                          // ldi 00
+	0x1e,                                // gt? [ (rose state:) > 0 ]
+	PATCH_END
+};
+
 // The doctor's mouth moves too fast in room 36. doctorMouth:cyleSpeed is set to
 //  one, the maximum speed, unlike any other inset in the game. Most insets use
 //  the default speed of six and almost all the rest use an even slower speed.
@@ -13667,6 +13701,7 @@ static const SciScriptPatcherEntry pq3Signatures[] = {
 	{  true,    36, "doctor mouth speed",                     1, pq3SignatureDoctorMouthSpeed,      pq3PatchDoctorMouthSpeed },
 	{  true,    44, "fix judge evidence lockup",              1, pq3SignatureJudgeEvidenceLockup,   pq3PatchJudgeEvidenceLockup },
 	{  true,    99, "disable speed test",                     1, sci01SpeedTestLocalSignature,      sci01SpeedTestLocalPatch },
+	{  true,   300, "fix wrong ending",                       1, pq3SignatureWrongEnding,           pq3PatchWrongEnding },
 	{  true,   994, "NRS: remove speed throttle",             1, pq3SignatureNrsSpeedThrottle,      pq3PatchNrsSpeedThrottle },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: 52d2fb69b101f66e37b5f61a67f53e71ade633c7
    https://github.com/scummvm/scummvm/commit/52d2fb69b101f66e37b5f61a67f53e71ade633c7
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-02T00:34:56-08:00

Commit Message:
CREATE_PROJECT: Fix crash when all engines disabled

Changed paths:
    devtools/create_project/create_project.cpp


diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp
index 0a2f6769002..193f3e3d78e 100644
--- a/devtools/create_project/create_project.cpp
+++ b/devtools/create_project/create_project.cpp
@@ -1887,6 +1887,9 @@ void ProjectProvider::addFilesToProject(const std::string &dir, std::ostream &pr
 										const std::string &pchIncludeRoot, const StringList &pchDirs, const StringList &pchExclude,
 										const std::string &filePrefix) {
 	FileNode *files = scanFiles(dir, includeList, excludeList);
+	if (files == nullptr) {
+		return;
+	}
 
 	writeFileListToProject(*files, projectFile, 0, std::string(), filePrefix + '/', pchIncludeRoot, pchDirs, pchExclude);
 


Commit: 368d44e3c8100036605c82b7ce241f023f98b7e1
    https://github.com/scummvm/scummvm/commit/368d44e3c8100036605c82b7ce241f023f98b7e1
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-02T00:35:19-08:00

Commit Message:
AGI: Fix print.at parameter count in SQ1 1.0X

Fixes the skimmer sequence locking up when displaying a message box.

fixes bug #10872

Changed paths:
    engines/agi/opcodes.cpp


diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index 8b7a7ca2875..acb36d02510 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -320,7 +320,7 @@ AgiOpCodeDefinitionEntry opCodesV2[] = {
 	{ "reposition.to.v",    "nvv",      &cmdRepositionToF },    // 94
 	{ "trace.on",           "",         &cmdTraceOn },          // 95
 	{ "trace.info",         "nnn",      &cmdTraceInfo },        // 96
-	{ "print.at",           "snnn",     &cmdPrintAt }, // 3 args for AGI versions before 2.440
+	{ "print.at",           "snnn",     &cmdPrintAt }, // 3 args for AGI versions before 2.089
 	{ "print.at.v",         "vnnn",     &cmdPrintAtV },         // 98
 	{ "discard.view.v",     "v",        &cmdDiscardView},       // 99
 	{ "clear.text.rect",    "nnnnn",    &cmdClearTextRect },    // 9A
@@ -404,10 +404,10 @@ void AgiEngine::setupOpCodes(uint16 version) {
 		if (version == 0x2089)
 			_opCodes[0x86].parameters = "";
 
-		// 'print.at' and 'print.at.v' take 3 args before 2.272
-		// This is documented in the specs as only < 2.440, but it seems
-		// that KQ3 (2.272) needs a 'print.at' taking 4 args.
-		if (version < 0x2272) {
+		// 'print.at' and 'print.at.v' take 3 args before 2.089.
+		// This is documented in the specs as only < 2.440, but
+		// SQ1 1.0X (2.089) and KQ3 (2.272) take 4 args. Bug #10872
+		if (version < 0x2089) {
 			_opCodes[0x97].parameters = "vvv";
 			_opCodes[0x98].parameters = "vvv";
 		}


Commit: 6c5ecf767e0148653f753a09e8039fda57db3b77
    https://github.com/scummvm/scummvm/commit/6c5ecf767e0148653f753a09e8039fda57db3b77
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-02T00:35:28-08:00

Commit Message:
AGI: Fix uninit memory use, crash on `error`

Fixes random crashes when an illegal opcode is encountered.

See bug #14699

Changed paths:
    engines/agi/op_cmd.cpp
    engines/agi/opcodes.cpp


diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 9c383f70546..555871b5284 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -2439,16 +2439,16 @@ int AgiEngine::runLogic(int16 logicNr) {
 			_game.execStack.pop_back();
 			return 1;
 		default:
+			if (!_opCodes[op].functionPtr) {
+				error("Illegal opcode %x in logic %d, ip %d", op, state->curLogicNr, state->_curLogic->cIP);
+			}
+
 			curParameterSize = _opCodes[op].parameterSize;
 			memmove(p, state->_curLogic->data + state->_curLogic->cIP, curParameterSize);
 			memset(p + curParameterSize, 0, CMD_BSIZE - curParameterSize);
 
 			debugC(2, kDebugLevelScripts, "%s%s(%d %d %d)", st, _opCodes[op].name, p[0], p[1], p[2]);
 
-			if (!_opCodes[op].functionPtr) {
-				error("Illegal opcode %x in logic %d, ip %d", op, state->curLogicNr, state->_curLogic->cIP);
-			}
-
 			_opCodes[op].functionPtr(&_game, this, p);
 			state->_curLogic->cIP += curParameterSize;
 		}
diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index acb36d02510..f391dcb2e5b 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -366,8 +366,6 @@ void AgiEngine::setupOpCodes(uint16 version) {
 	const AgiOpCodeDefinitionEntry *opCodesCondTable = nullptr;
 	uint16 opCodesTableSize = 0;
 	uint16 opCodesCondTableSize = 0;
-	uint16 opCodesTableMaxSize = sizeof(_opCodes) / sizeof(AgiOpCodeEntry);
-	uint16 opCodesCondTableMaxSize = sizeof(_opCodesCond) / sizeof(AgiOpCodeEntry);
 
 	debug(0, "Setting up for version 0x%04X", version);
 
@@ -443,16 +441,18 @@ void AgiEngine::setupOpCodes(uint16 version) {
 		_opCodes[182].parameters = "vv";
 
 	// add invalid entries for every opcode, that is not defined at all
-	for (int opCodeNr = opCodesTableSize; opCodeNr < opCodesTableMaxSize; opCodeNr++) {
+	for (int opCodeNr = opCodesTableSize; opCodeNr < ARRAYSIZE(_opCodes); opCodeNr++) {
 		_opCodes[opCodeNr].name = "illegal";
 		_opCodes[opCodeNr].parameters = "";
 		_opCodes[opCodeNr].functionPtr = nullptr;
+		_opCodes[opCodeNr].parameterSize = 0;
 	}
 
-	for (int opCodeNr = opCodesCondTableSize; opCodeNr < opCodesCondTableMaxSize; opCodeNr++) {
+	for (int opCodeNr = opCodesCondTableSize; opCodeNr < ARRAYSIZE(_opCodesCond); opCodeNr++) {
 		_opCodesCond[opCodeNr].name = "illegal";
 		_opCodesCond[opCodeNr].parameters = "";
 		_opCodesCond[opCodeNr].functionPtr = nullptr;
+		_opCodesCond[opCodeNr].parameterSize = 0;
 	}
 
 	// calculate parameter size


Commit: 46307ca0b9c4e17ddc3661bed83eb033a1055b0c
    https://github.com/scummvm/scummvm/commit/46307ca0b9c4e17ddc3661bed83eb033a1055b0c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-01-02T00:35:45-08:00

Commit Message:
SCI: Fix LSL5 TPrint script patch

The patch altered the frame size of a call instruction, but I failed
to update the matching argument count on the stack.

This caused Print to receive an incorrect argc and crash the
gymnastics scene in room 920.

See: 4a40ac92ea3d7d6efe76583b91b2769463c8f8db

Fixes bug #14791

Thanks to @EricTSten for reporting 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 50ec36cfbc4..48fc70b1098 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -9030,6 +9030,8 @@ static const uint16 larry5PatchHollywoodSign[] = {
 // Applies to: All versions
 // Responsible method: Export 14 in script 0 (TPrint)
 static const uint16 larry5SignatureHTPrintUninitParameter[] = {
+	0x39, 0x04,                         // pushi 04 [ argc ]
+	SIG_ADDTOOFFSET(+5),
 	SIG_MAGICDWORD,
 	0x8f, 0x02,                         // lsp 02 [ often non-existent ]
 	0x59, 0x03,                         // &rest 03
@@ -9038,6 +9040,8 @@ static const uint16 larry5SignatureHTPrintUninitParameter[] = {
 };
 
 static const uint16 larry5PatchTPrintUninitParameter[] = {
+	0x39, 0x03,                         // pushi 03 [ argc ]
+	PATCH_ADDTOOFFSET(+5),
 	0x33, 0x00,                         // jmp 00
 	0x59, 0x02,                         // &rest 02
 	0x47, 0xff, 0x00, 0x06,             // calle proc225_0 [ Print ... &rest ]




More information about the Scummvm-git-logs mailing list