[Scummvm-cvs-logs] scummvm master -> 7520aea2ec7e6055c940f7ad99ac262713947c27

bluegr bluegr at gmail.com
Fri Aug 23 12:46:38 CEST 2013


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

Summary:
9095c4124d SCI: Give more verbose error messages on arithmetic errors
7520aea2ec SCI: Fix several script bugs in Hoyle 4 (Bridge)


Commit: 9095c4124de18729d826c6c49dfcbd32f2d237bb
    https://github.com/scummvm/scummvm/commit/9095c4124de18729d826c6c49dfcbd32f2d237bb
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-08-23T03:45:19-07:00

Commit Message:
SCI: Give more verbose error messages on arithmetic errors

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



diff --git a/engines/sci/engine/vm_types.cpp b/engines/sci/engine/vm_types.cpp
index 27015d9..5327dd1 100644
--- a/engines/sci/engine/vm_types.cpp
+++ b/engines/sci/engine/vm_types.cpp
@@ -28,12 +28,12 @@
 
 namespace Sci {
 
-reg_t reg_t::lookForWorkaround(const reg_t right) const {
+reg_t reg_t::lookForWorkaround(const reg_t right, const char *operation) const {
 	SciTrackOriginReply originReply;
 	SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, arithmeticWorkarounds, &originReply);
 	if (solution.type == WORKAROUND_NONE)
-		error("Invalid arithmetic operation (params: %04x:%04x and %04x:%04x) from method %s::%s (room %d, script %d, localCall %x)",
-		PRINT_REG(*this), PRINT_REG(right), originReply.objectName.c_str(),
+		error("Invalid arithmetic operation (%s - params: %04x:%04x and %04x:%04x) from method %s::%s (room %d, script %d, localCall %x)",
+		operation, PRINT_REG(*this), PRINT_REG(right), originReply.objectName.c_str(),
 		originReply.methodName.c_str(), g_sci->getEngineState()->currentRoomNumber(), originReply.scriptNr,
 		originReply.localCallOffset);
 	assert(solution.type == WORKAROUND_FAKE);
@@ -55,7 +55,7 @@ reg_t reg_t::operator+(const reg_t right) const {
 		case SEG_TYPE_DYNMEM:
 			return make_reg(getSegment(), getOffset() + right.toSint16());
 		default:
-			return lookForWorkaround(right);
+			return lookForWorkaround(right, "addition");
 		}
 	} else if (isNumber() && right.isPointer()) {
 		// Adding a pointer to a number, flip the order
@@ -64,7 +64,7 @@ reg_t reg_t::operator+(const reg_t right) const {
 		// Normal arithmetics
 		return make_reg(0, toSint16() + right.toSint16());
 	} else {
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "addition");
 	}
 }
 
@@ -82,14 +82,14 @@ reg_t reg_t::operator*(const reg_t right) const {
 	if (isNumber() && right.isNumber())
 		return make_reg(0, toSint16() * right.toSint16());
 	else
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "multiplication");
 }
 
 reg_t reg_t::operator/(const reg_t right) const {
 	if (isNumber() && right.isNumber() && !right.isNull())
 		return make_reg(0, toSint16() / right.toSint16());
 	else
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "division");
 }
 
 reg_t reg_t::operator%(const reg_t right) const {
@@ -109,21 +109,21 @@ reg_t reg_t::operator%(const reg_t right) const {
 			result += modulo;
 		return make_reg(0, result);
 	} else
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "modulo");
 }
 
 reg_t reg_t::operator>>(const reg_t right) const {
 	if (isNumber() && right.isNumber())
 		return make_reg(0, toUint16() >> right.toUint16());
 	else
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "shift right");
 }
 
 reg_t reg_t::operator<<(const reg_t right) const {
 	if (isNumber() && right.isNumber())
 		return make_reg(0, toUint16() << right.toUint16());
 	else
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "shift left");
 }
 
 reg_t reg_t::operator+(int16 right) const {
@@ -140,7 +140,7 @@ uint16 reg_t::requireUint16() const {
 	else
 		// The right parameter is NULL_REG because
 		// we're not comparing *this with anything here.
-		return lookForWorkaround(NULL_REG).toUint16();
+		return lookForWorkaround(NULL_REG, "require unsigned number").toUint16();
 }
 
 int16 reg_t::requireSint16() const {
@@ -149,28 +149,28 @@ int16 reg_t::requireSint16() const {
 	else
 		// The right parameter is NULL_REG because
 		// we're not comparing *this with anything here.
-		return lookForWorkaround(NULL_REG).toSint16();
+		return lookForWorkaround(NULL_REG, "require signed number").toSint16();
 }
 
 reg_t reg_t::operator&(const reg_t right) const {
 	if (isNumber() && right.isNumber())
 		return make_reg(0, toUint16() & right.toUint16());
 	else
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "bitwise AND");
 }
 
 reg_t reg_t::operator|(const reg_t right) const {
 	if (isNumber() && right.isNumber())
 		return make_reg(0, toUint16() | right.toUint16());
 	else
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "bitwise OR");
 }
 
 reg_t reg_t::operator^(const reg_t right) const {
 	if (isNumber() && right.isNumber())
 		return make_reg(0, toUint16() ^ right.toUint16());
 	else
-		return lookForWorkaround(right);
+		return lookForWorkaround(right, "bitwise XOR");
 }
 
 int reg_t::cmp(const reg_t right, bool treatAsUnsigned) const {
@@ -184,7 +184,7 @@ int reg_t::cmp(const reg_t right, bool treatAsUnsigned) const {
 	} else if (right.pointerComparisonWithInteger(*this)) {
 		return -1;
 	} else
-		return lookForWorkaround(right).toSint16();
+		return lookForWorkaround(right, "comparison").toSint16();
 }
 
 bool reg_t::pointerComparisonWithInteger(const reg_t right) const {
diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h
index 9a7589e..22bd8be 100644
--- a/engines/sci/engine/vm_types.h
+++ b/engines/sci/engine/vm_types.h
@@ -156,7 +156,7 @@ private:
 	 * - a negative number if *this < right
 	 */
 	int cmp(const reg_t right, bool treatAsUnsigned) const;
-	reg_t lookForWorkaround(const reg_t right) const;
+	reg_t lookForWorkaround(const reg_t right, const char *operation) const;
 	bool pointerComparisonWithInteger(const reg_t right) const;
 };
 


Commit: 7520aea2ec7e6055c940f7ad99ac262713947c27
    https://github.com/scummvm/scummvm/commit/7520aea2ec7e6055c940f7ad99ac262713947c27
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-08-23T03:45:19-07:00

Commit Message:
SCI: Fix several script bugs in Hoyle 4 (Bridge)

This also fixes bug #3361925 - "SCI: HOYLE4: Crash in bridge"

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



diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 6f0b34b..49d6145 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -37,6 +37,7 @@ const SciWorkaroundEntry arithmeticWorkarounds[] = {
 	{ GID_ECOQUEST2,      100,    0,  0,               "Rain", "points",      0xce0,    0, { WORKAROUND_FAKE,   0 } }, // Same as above, for the Spanish version - bug #3313962
 	{ GID_FANMADE,        516,  983,  0,             "Wander", "setTarget",      -1,    0, { WORKAROUND_FAKE,   0 } }, // op_mul: The Legend of the Lost Jewel Demo (fan made): called with object as second parameter when attacked by insects - bug #3038913
 	{ GID_GK1,            800,64992,  0,                "Fwd", "doit",           -1,    0, { WORKAROUND_FAKE,   1 } }, // op_gt: when Mosely finds Gabriel and Grace near the end of the game, compares the Grooper object with 7
+	{ GID_HOYLE4,         700,   -1,  1,               "Code", "doit",           -1,    0, { WORKAROUND_FAKE,   1 } }, // op_add: while bidding in Bridge, an object ("Bid") is added to an object in another segment ("hand3")
 	{ GID_ICEMAN,         199,  977,  0,            "Grooper", "doit",           -1,    0, { WORKAROUND_FAKE,   0 } }, // op_add: While dancing with the girl
 	{ GID_MOTHERGOOSE256,  -1,  999,  0,              "Event", "new",            -1,    0, { WORKAROUND_FAKE,   0 } }, // op_and: constantly during the game (SCI1 version)
 	{ GID_MOTHERGOOSE256,  -1,    4,  0,              "rm004", "doit",           -1,    0, { WORKAROUND_FAKE,   0 } }, // op_or: when going north and reaching the castle (rooms 4 and 37) - bug #3038228
@@ -74,9 +75,11 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
 	{ GID_HOYLE4,         -1,     0,  0,                 NULL, "open",           -1,   -1, { WORKAROUND_FAKE,   0 } }, // when selecting "Control" from the menu (temp vars 0-3) - bug #3039294
 	{ GID_HOYLE4,        910,    18,  0,                 NULL, "init",           -1,    0, { WORKAROUND_FAKE,   0 } }, // during tutorial - bug #3042756
 	{ GID_HOYLE4,        910,   910,  0,                 NULL, "setup",          -1,    3, { WORKAROUND_FAKE,   0 } }, // when selecting "Tutorial" from the main menu - bug #3039294
-	{ GID_HOYLE4,        700,   718,  0,       "compete_tree", "doit",           -1,   75, { WORKAROUND_FAKE,   0 } }, // when placing a bid in bridge - bug #3292332
-	{ GID_HOYLE4,        700,   716,  0,        "other1_tree", "doit",           -1,   46, { WORKAROUND_FAKE,   0 } }, // sometimes when placing a bid in bridge
-	{ GID_HOYLE4,        700,   700,  1,         "BridgeHand", "calcQTS",        -1,    3, { WORKAROUND_FAKE,   0 } }, // sometimes when placing a bid in bridge
+	{ GID_HOYLE4,        700,   700,  1,         "BridgeHand", "calcQTS",        -1,    3, { WORKAROUND_FAKE,   0 } }, // when placing a bid in bridge (always)
+	{ GID_HOYLE4,        700,   710,  1, "BridgeStrategyPlay", "checkSplitTops", -1,   10, { WORKAROUND_FAKE,   0 } }, // while playing bridge, objects LeadReturn_Trump, SecondSeat_Trump, ThirdSeat_Trump and others - bug #3361925
+	{ GID_HOYLE4,        700,    -1,  1,      "BridgeDefense", "think",          -1,   -1, { WORKAROUND_FAKE,   0 } }, // sometimes while playing bridge, temp var 3, 17 and others, objects LeadReturn_Trump, ThirdSeat_Trump and others
+	{ GID_HOYLE4,        700,   730,  1,      "BridgeDefense", "beatTheirBest",  -1,    3, { WORKAROUND_FAKE,   0 } }, // rarely while playing bridge
+	{ GID_HOYLE4,        700,    -1,  1,               "Code", "doit",           -1,   -1, { WORKAROUND_FAKE,   0 } }, // when placing a bid in bridge (always), temp var 11, 24, 27, 46, 75, objects compete_tree, compwe_tree, other1_tree, b1 - bugs #3292332 and #3361925
 	{ GID_HOYLE4,        300,   300,  0,                   "", "export 2",   0x1d4d,    0, { WORKAROUND_FAKE,   0 } }, // after passing around cards in hearts
 	{ GID_HOYLE4,        400,   400,  1,            "GinHand", "calcRuns",       -1,    4, { WORKAROUND_FAKE,   0 } }, // sometimes while playing Gin Rummy (e.g. when knocking and placing a card) - bug #3292334
 	{ GID_HOYLE4,        500,    17,  1,          "Character", "say",            -1,  504, { WORKAROUND_FAKE,   0 } }, // sometimes while playing Cribbage (e.g. when the opponent says "Last Card") - bug #3292327






More information about the Scummvm-git-logs mailing list