[Scummvm-git-logs] scummvm master -> 9d42bea857e23b66fd2e12a94fb4947acd7de029

csnover csnover at users.noreply.github.com
Mon Sep 4 22:20:55 CEST 2017


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:
67fcb0bdaf SCI: Allow deep inspection of objects in debugger
109d870990 SCI: Remove already-finished TODO
bdbcc90148 SCI32: Disable save game mangling in Phant2
9d42bea857 SCI32: Fix creating over 20 saves in Phant2 native save game


Commit: 67fcb0bdafac4384dbb6be3dca565a6e99b75e0a
    https://github.com/scummvm/scummvm/commit/67fcb0bdafac4384dbb6be3dca565a6e99b75e0a
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-04T15:19:59-05:00

Commit Message:
SCI: Allow deep inspection of objects in debugger

Changed paths:
    engines/sci/console.cpp
    engines/sci/console.h


diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 82661f0..a81cdd2 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2832,94 +2832,7 @@ bool Console::cmdViewReference(int argc, const char **argv) {
 		}
 	}
 
-	int type_mask = g_sci->getKernel()->findRegType(reg);
-	int filter;
-	int found = 0;
-
-	debugPrintf("%04x:%04x is of type 0x%x: ", PRINT_REG(reg), type_mask);
-
-	if (reg.getSegment() == 0 && reg.getOffset() == 0) {
-		debugPrintf("Null.\n");
-		return true;
-	}
-
-	if (reg_end.getSegment() != reg.getSegment() && reg_end != NULL_REG) {
-		debugPrintf("Ending segment different from starting segment. Assuming no bound on dump.\n");
-		reg_end = NULL_REG;
-	}
-
-	for (filter = 1; filter < 0xf000; filter <<= 1) {
-		int type = type_mask & filter;
-
-		if (found && type) {
-			debugPrintf("--- Alternatively, it could be a ");
-		}
-
-
-		switch (type) {
-		case 0:
-			break;
-		case SIG_TYPE_LIST:
-			printList(reg);
-			break;
-		case SIG_TYPE_NODE:
-			debugPrintf("list node\n");
-			printNode(reg);
-			break;
-		case SIG_TYPE_OBJECT:
-			debugPrintf("object\n");
-			printObject(reg);
-			break;
-		case SIG_TYPE_REFERENCE: {
-			switch (_engine->_gamestate->_segMan->getSegmentType(reg.getSegment())) {
-#ifdef ENABLE_SCI32
-				case SEG_TYPE_ARRAY: {
-					printArray(reg);
-					break;
-				}
-				case SEG_TYPE_BITMAP: {
-					printBitmap(reg);
-					break;
-				}
-#endif
-				default: {
-					const SegmentRef block = _engine->_gamestate->_segMan->dereference(reg);
-					uint16 size = block.maxSize;
-
-					debugPrintf("raw data\n");
-
-					if (reg_end.getSegment() != 0 && (size < reg_end.getOffset() - reg.getOffset())) {
-						debugPrintf("Block end out of bounds (size %d). Resetting.\n", size);
-						reg_end = NULL_REG;
-					}
-
-					if (reg_end.getSegment() != 0 && (size >= reg_end.getOffset() - reg.getOffset()))
-						size = reg_end.getOffset() - reg.getOffset();
-
-					if (reg_end.getSegment() != 0)
-						debugPrintf("Block size less than or equal to %d\n", size);
-
-					if (block.isRaw)
-						Common::hexdump(block.raw, size, 16, 0);
-					else
-						hexDumpReg(block.reg, size / 2, 4, 0);
-				}
-			}
-			break;
-		}
-		case SIG_TYPE_INTEGER:
-			debugPrintf("arithmetic value\n  %d (%04x)\n", (int16) reg.getOffset(), reg.getOffset());
-			break;
-		default:
-			debugPrintf("unknown type %d.\n", type);
-		}
-
-		if (type) {
-			debugPrintf("\n");
-			found = 1;
-		}
-	}
-
+	printReference(reg, reg_end);
 	return true;
 }
 
@@ -3043,9 +2956,9 @@ bool Console::cmdDumpReference(int argc, const char **argv) {
 }
 
 bool Console::cmdViewObject(int argc, const char **argv) {
-	if (argc != 2) {
+	if (argc < 2) {
 		debugPrintf("Examines the object at the given address.\n");
-		debugPrintf("Usage: %s <address>\n", argv[0]);
+		debugPrintf("Usage: %s <address> [<selector name> ...]\n", argv[0]);
 		debugPrintf("Check the \"addresses\" command on how to use addresses\n");
 		return true;
 	}
@@ -3058,8 +2971,45 @@ bool Console::cmdViewObject(int argc, const char **argv) {
 		return true;
 	}
 
-	debugPrintf("Information on the object at the given address:\n");
-	printObject(addr);
+	if (argc >= 3) {
+		for (int i = 2; i < argc; ++i) {
+			const Object *obj = _engine->_gamestate->_segMan->getObject(addr);
+			if (!obj) {
+				debugPrintf("%04x:%04x is not an object.\n", PRINT_REG(addr));
+				break;
+			}
+
+			const Selector selector = _engine->getKernel()->findSelector(argv[i]);
+			if (selector == -1) {
+				debugPrintf("Invalid selector '%s'.\n", argv[i]);
+				break;
+			}
+
+			const int index = obj->locateVarSelector(_engine->_gamestate->_segMan, selector);
+			if (index == -1) {
+				debugPrintf("Selector '%s' is not valid for object %04x:%04x.\n", argv[i], PRINT_REG(addr));
+				break;
+			}
+
+			const reg_t value = obj->getVariable(index);
+			if (i == argc - 1) {
+				if (value.isPointer()) {
+					printReference(value);
+				} else {
+					debugPrintf("%04x:%04x (%u)\n", PRINT_REG(value), value.toUint16());
+				}
+			} else if (!value.isPointer()) {
+				debugPrintf("Selector '%s' on object %04x:%04x is not a pointer to an object.\n", argv[i], PRINT_REG(addr));
+				debugPrintf("Value is %04x:%04x (%u).\n", PRINT_REG(value), value.toUint16());
+				break;
+			} else {
+				addr = value;
+			}
+		}
+	} else {
+		debugPrintf("Information on the object at the given address:\n");
+		printObject(addr);
+	}
 
 	return true;
 }
@@ -4791,6 +4741,96 @@ int Console::printNode(reg_t addr) {
 	return 0;
 }
 
+void Console::printReference(reg_t reg, reg_t reg_end) {
+	int type_mask = g_sci->getKernel()->findRegType(reg);
+	int filter;
+	int found = 0;
+
+	debugPrintf("%04x:%04x is of type 0x%x: ", PRINT_REG(reg), type_mask);
+
+	if (reg.getSegment() == 0 && reg.getOffset() == 0) {
+		debugPrintf("Null.\n");
+		return;
+	}
+
+	if (reg_end.getSegment() != reg.getSegment() && reg_end != NULL_REG) {
+		debugPrintf("Ending segment different from starting segment. Assuming no bound on dump.\n");
+		reg_end = NULL_REG;
+	}
+
+	for (filter = 1; filter < 0xf000; filter <<= 1) {
+		int type = type_mask & filter;
+
+		if (found && type) {
+			debugPrintf("--- Alternatively, it could be a ");
+		}
+
+
+		switch (type) {
+		case 0:
+			break;
+		case SIG_TYPE_LIST:
+			printList(reg);
+			break;
+		case SIG_TYPE_NODE:
+			debugPrintf("list node\n");
+			printNode(reg);
+			break;
+		case SIG_TYPE_OBJECT:
+			debugPrintf("object\n");
+			printObject(reg);
+			break;
+		case SIG_TYPE_REFERENCE: {
+			switch (_engine->_gamestate->_segMan->getSegmentType(reg.getSegment())) {
+#ifdef ENABLE_SCI32
+				case SEG_TYPE_ARRAY: {
+					printArray(reg);
+					break;
+				}
+				case SEG_TYPE_BITMAP: {
+					printBitmap(reg);
+					break;
+				}
+#endif
+				default: {
+					const SegmentRef block = _engine->_gamestate->_segMan->dereference(reg);
+					uint16 size = block.maxSize;
+
+					debugPrintf("raw data\n");
+
+					if (reg_end.getSegment() != 0 && (size < reg_end.getOffset() - reg.getOffset())) {
+						debugPrintf("Block end out of bounds (size %d). Resetting.\n", size);
+						reg_end = NULL_REG;
+					}
+
+					if (reg_end.getSegment() != 0 && (size >= reg_end.getOffset() - reg.getOffset()))
+						size = reg_end.getOffset() - reg.getOffset();
+
+					if (reg_end.getSegment() != 0)
+						debugPrintf("Block size less than or equal to %d\n", size);
+
+					if (block.isRaw)
+						Common::hexdump(block.raw, size, 16, 0);
+					else
+						hexDumpReg(block.reg, size / 2, 4, 0);
+				}
+			}
+			break;
+		}
+		case SIG_TYPE_INTEGER:
+			debugPrintf("arithmetic value\n  %d (%04x)\n", (int16) reg.getOffset(), reg.getOffset());
+			break;
+		default:
+			debugPrintf("unknown type %d.\n", type);
+		}
+
+		if (type) {
+			debugPrintf("\n");
+			found = 1;
+		}
+	}
+}
+
 #ifdef ENABLE_SCI32
 void Console::printArray(reg_t reg) {
 	SegmentObj *mobj = _engine->_gamestate->_segMan->getSegment(reg.getSegment(), SEG_TYPE_ARRAY);
diff --git a/engines/sci/console.h b/engines/sci/console.h
index 82a5f69..c467b86 100644
--- a/engines/sci/console.h
+++ b/engines/sci/console.h
@@ -41,16 +41,10 @@ public:
 	Console(SciEngine *engine);
 	virtual ~Console();
 
-#ifdef ENABLE_SCI32
-	void printArray(reg_t reg);
-	void printBitmap(reg_t reg);
-#endif
-
 private:
 	virtual void preEnter();
 	virtual void postEnter();
 
-private:
 	// General
 	bool cmdHelp(int argc, const char **argv);
 	// Kernel
@@ -192,6 +186,11 @@ private:
 	void printKernelCallsFound(int kernelFuncNum, bool showFoundScripts);
 
 	void printBreakpoint(int index, const Breakpoint &bp);
+	void printReference(reg_t reg, reg_t reg_end = NULL_REG);
+#ifdef ENABLE_SCI32
+	void printArray(reg_t reg);
+	void printBitmap(reg_t reg);
+#endif
 
 	SciEngine *_engine;
 	DebugState &_debugState;


Commit: 109d8709906859519f4160664658fb6e1c83e7cd
    https://github.com/scummvm/scummvm/commit/109d8709906859519f4160664658fb6e1c83e7cd
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-04T15:19:59-05:00

Commit Message:
SCI: Remove already-finished TODO

Changed paths:
    engines/sci/console.cpp


diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index a81cdd2..a2b065a 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -3351,7 +3351,6 @@ bool Console::cmdDisassemble(int argc, const char **argv) {
 			if (jumpTarget > farthestTarget)
 				farthestTarget = jumpTarget;
 		}
-		// TODO: Use a true 32-bit reg_t for the position (addr)
 		addr = disassemble(_engine->_gamestate, make_reg32(addr.getSegment(), addr.getOffset()), obj, printBWTag, printBytecode);
 		if (addr.isNull() && prevAddr < farthestTarget)
 			addr = prevAddr + 1; // skip past the ret


Commit: bdbcc9014897ad0ddc0296bdaa853831c275073c
    https://github.com/scummvm/scummvm/commit/bdbcc9014897ad0ddc0296bdaa853831c275073c
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-04T15:19:59-05:00

Commit Message:
SCI32: Disable save game mangling in Phant2

Fixes Trac#10035.

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 338c57f..0d15b9e 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -118,6 +118,7 @@ static const char *const selectorNameTable[] = {
 	"clear",        // Torin
 	"masterVolume", // SCI2 master volume reset
 	"data",         // Phant2
+	"format",       // Phant2
 #endif
 	NULL
 };
@@ -162,7 +163,8 @@ enum ScriptPatcherSelectors {
 	SELECTOR_set,
 	SELECTOR_clear,
 	SELECTOR_masterVolume,
-	SELECTOR_data
+	SELECTOR_data,
+	SELECTOR_format
 #endif
 };
 
@@ -3877,6 +3879,37 @@ static const uint16 phant2RatboyPatch[] = {
 	PATCH_END
 };
 
+// When censorship is disabled the game sticks <PROTECTED> at the end of every
+// save game name, and when it is enabled it pads the save game name with a
+// bunch of spaces. This is annoying and not helpful, so just disable all of
+// this nonsense.
+// Applies to at least: US English
+static const uint16 phant2SaveNameSignature1[] = {
+	SIG_MAGICDWORD,
+	0x57, 0x4b, SIG_UINT16(0x06), // super SREdit, 6
+	0x63,                         // pToa (plane)
+	SIG_END
+};
+
+static const uint16 phant2SaveNamePatch1[] = {
+	PATCH_ADDTOOFFSET(+4), // super SREdit, 6
+	0x48,                  // ret
+	PATCH_END
+};
+
+static const uint16 phant2SaveNameSignature2[] = {
+	SIG_MAGICDWORD,
+	0xa5, 0x00,                  // sat 0
+	0x39, SIG_SELECTOR8(format), // pushi format
+	SIG_END
+};
+
+static const uint16 phant2SaveNamePatch2[] = {
+	PATCH_ADDTOOFFSET(+2), // sat 0
+	0x33, 0x68,            // jmp [past name mangling]
+	PATCH_END
+};
+
 // Phant2-specific version of sci2NumSavesSignature1/2
 // Applies to at least: English CD
 static const uint16 phant2NumSavesSignature[] = {
@@ -3900,6 +3933,8 @@ static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
 	{  true,  4081, "non-responsive mouse after ratboy puzzle",    1, phant2RatboySignature,         phant2RatboyPatch },
 	{  true, 63016, "non-responsive mouse during music fades",     1, phant2Wait4FadeSignature,      phant2Wait4FadePatch },
 	{  true, 63019, "non-responsive mouse during computer load",   1, phant2CompSlideDoorsSignature, phant2CompSlideDoorsPatch },
+	{  true, 64990, "remove save game name mangling (1/2)",        1, phant2SaveNameSignature1,      phant2SaveNamePatch1 },
+	{  true, 64994, "remove save game name mangling (2/2)",        1, phant2SaveNameSignature2,      phant2SaveNamePatch2 },
 	{  true, 64990, "increase number of save games",               1, phant2NumSavesSignature,       phant2NumSavesPatch },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };


Commit: 9d42bea857e23b66fd2e12a94fb4947acd7de029
    https://github.com/scummvm/scummvm/commit/9d42bea857e23b66fd2e12a94fb4947acd7de029
Author: Colin Snover (github.com at zetafleet.com)
Date: 2017-09-04T15:20:00-05:00

Commit Message:
SCI32: Fix creating over 20 saves in Phant2 native save 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 0d15b9e..4439201 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -3912,7 +3912,7 @@ static const uint16 phant2SaveNamePatch2[] = {
 
 // Phant2-specific version of sci2NumSavesSignature1/2
 // Applies to at least: English CD
-static const uint16 phant2NumSavesSignature[] = {
+static const uint16 phant2NumSavesSignature1[] = {
 	SIG_MAGICDWORD,
 	0x8d, 0x01, // lst 1
 	0x35, 0x14, // ldi 20
@@ -3920,12 +3920,26 @@ static const uint16 phant2NumSavesSignature[] = {
 	SIG_END
 };
 
-static const uint16 phant2NumSavesPatch[] = {
+static const uint16 phant2NumSavesPatch1[] = {
 	PATCH_ADDTOOFFSET(+2), // lst 1
 	0x35, 0x63,            // ldi 99
 	PATCH_END
 };
 
+static const uint16 phant2NumSavesSignature2[] = {
+	SIG_MAGICDWORD,
+	0x8d, 0x00, // lst 0
+	0x35, 0x14, // ldi 20
+	0x22,       // lt?
+	SIG_END
+};
+
+static const uint16 phant2NumSavesPatch2[] = {
+	PATCH_ADDTOOFFSET(+2), // lst 0
+	0x35, 0x63,            // ldi 99
+	PATCH_END
+};
+
 //          script, description,                                      signature                        patch
 static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
 	{  true,     0, "slow interface fades",                        3, phant2SlowIFadeSignature,      phant2SlowIFadePatch },
@@ -3935,7 +3949,8 @@ static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
 	{  true, 63019, "non-responsive mouse during computer load",   1, phant2CompSlideDoorsSignature, phant2CompSlideDoorsPatch },
 	{  true, 64990, "remove save game name mangling (1/2)",        1, phant2SaveNameSignature1,      phant2SaveNamePatch1 },
 	{  true, 64994, "remove save game name mangling (2/2)",        1, phant2SaveNameSignature2,      phant2SaveNamePatch2 },
-	{  true, 64990, "increase number of save games",               1, phant2NumSavesSignature,       phant2NumSavesPatch },
+	{  true, 64990, "increase number of save games",               1, phant2NumSavesSignature1,       phant2NumSavesPatch1 },
+	{  true, 64990, "increase number of save games",               2, phant2NumSavesSignature2,       phant2NumSavesPatch2 },
 	SCI_SIGNATUREENTRY_TERMINATOR
 };
 





More information about the Scummvm-git-logs mailing list