[Scummvm-git-logs] scummvm master -> 4dc9f0e66d3a18f2906e9c2e8064a2a8de8b940f

bluegr bluegr at gmail.com
Thu Aug 23 01:00:07 CEST 2018


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:
5e2db7a178 SCI32: Add workarounds for OOB reads for parameters
4dc9f0e66d SCI32: Fix attacking necrotaurs with the sword in QFG4


Commit: 5e2db7a1788573ea7e5683d6a9d56a8f55ec485d
    https://github.com/scummvm/scummvm/commit/5e2db7a1788573ea7e5683d6a9d56a8f55ec485d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2018-08-23T01:59:26+03:00

Commit Message:
SCI32: Add workarounds for OOB reads for parameters

These are mostly used to silence known cases, for now. Some workarounds of this type have already been addded

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


diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 0324feb..fb010ad 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -141,10 +141,15 @@ static reg_t read_var(EngineState *s, int type, int index) {
 			}
 			case VAR_PARAM: {
 				// Out-of-bounds read for a parameter that goes onto stack and hits an uninitialized temp
-				//  We return 0 currently in that case
-				const SciCallOrigin origin = s->getCurrentCallOrigin();
-				warning("Uninitialized read for parameter %d from %s", index, origin.toString().c_str());
-				return NULL_REG;
+				//  We need to find correct replacements for each situation manually
+				SciCallOrigin originReply;
+				SciWorkaroundSolution solution = trackOriginAndFindWorkaround(index, uninitializedReadForParamWorkarounds, &originReply);
+				if (solution.type == WORKAROUND_NONE) {
+					warning("Uninitialized read for parameter %d from %s", index, originReply.toString().c_str());
+					return NULL_REG;
+				} else {
+					return make_reg(0, solution.value);
+				}
 			}
 			default:
 				break;
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 90c854b..766fdcc 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -317,6 +317,16 @@ static const uint16 sig_uninitread_sq1_1[] = {
 	SIG_END
 };
 
+// Workarounds for uninitialized reads for parameters
+//    gameID,           room,script,lvl,          object-name, method-name,       local-call-signature, index-range,  workaround
+const SciWorkaroundEntry uninitializedReadForParamWorkarounds[] = {
+	{ GID_HOYLE5,         -1,    15, -1,               "Hand", "add",                             NULL,     1,     1,{ WORKAROUND_FAKE,   0 } }, // When the game adds cards to your hand in any mini-game
+	{ GID_PHANTASMAGORIA2,-1, 64926,  0,              "Thumb", "action",                          NULL,     1,     1,{ WORKAROUND_FAKE,   0 } }, // When dragging one of the volume sliders and releasing the mouse button over the +/- buttons
+	{ GID_PHANTASMAGORIA2,-1, 63019,  0,     "WynDocTextView", "cue",                             NULL,     2,     2,{ WORKAROUND_FAKE,   0 } }, // When dragging the slider next to an e-mail message
+	SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+// Workarounds for uninitialized reads for temporary variables
 //    gameID,           room,script,lvl,          object-name, method-name,       local-call-signature, index-range,  workaround
 const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
 	{ GID_CAMELOT,        40,    40,  0,               "Rm40", "handleEvent",                     NULL,     0,     0, { WORKAROUND_FAKE,   0 } }, // when looking at the ground at the pool of Siloam - bug #6401
@@ -444,7 +454,6 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
 	{ GID_PEPPER,         -1,   894,  0,            "Package", "doVerb",                          NULL,     3,     3, { WORKAROUND_FAKE,   0 } }, // using the hand on the book in the inventory - bug #5154
 	{ GID_PEPPER,        150,   928,  0,           "Narrator", "startText",                       NULL,     0,     0, { WORKAROUND_FAKE,   0 } }, // happens during the non-interactive demo of Pepper
 	{ GID_PHANTASMAGORIA, -1, 64921, -1,              "Print", "addEdit",                         NULL,     1,     1, { WORKAROUND_FAKE,   0 } }, // When trying to use the game debugger's flag setting command
-	{ GID_PHANTASMAGORIA2,-1, 64926, -1,              "Thumb", "action",                          NULL,     1,     1, { WORKAROUND_FAKE,   0 } }, // When dragging one of the volume sliders and releasing the mouse button over the +/- buttons
 	{ GID_PQ4,            -1,    25,  0,         "iconToggle", "select",                          NULL,     1,     1, { WORKAROUND_FAKE,   0 } }, // when toggling the icon bar to auto-hide or not
 	{ GID_PQ4,           170,   170, -1,        "hideAndSeek", "handleEvent",                     NULL,     1,     1, { WORKAROUND_FAKE,   0 } }, // when clicking to move right while still moving left during the Emo shootout - bug #9847
 	{ GID_PQ4,           275, 64964, -1,              "DPath", "init",                            NULL,     1,     1, { WORKAROUND_FAKE,   0 } }, // when Sherry walks out of the morgue on day 3
diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h
index a462fdd..ff1f5c6 100644
--- a/engines/sci/engine/workarounds.h
+++ b/engines/sci/engine/workarounds.h
@@ -62,6 +62,7 @@ struct SciWorkaroundEntry {
 
 extern const SciWorkaroundEntry arithmeticWorkarounds[];
 extern const SciWorkaroundEntry uninitializedReadWorkarounds[];
+extern const SciWorkaroundEntry uninitializedReadForParamWorkarounds[];
 extern const SciWorkaroundEntry kAbs_workarounds[];
 extern const SciWorkaroundEntry kCelHigh_workarounds[];
 extern const SciWorkaroundEntry kCelWide_workarounds[];


Commit: 4dc9f0e66d3a18f2906e9c2e8064a2a8de8b940f
    https://github.com/scummvm/scummvm/commit/4dc9f0e66d3a18f2906e9c2e8064a2a8de8b940f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2018-08-23T01:59:26+03:00

Commit Message:
SCI32: Fix attacking necrotaurs with the sword in QFG4

Fixes bug #10419

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


diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 766fdcc..3e9c463 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -88,6 +88,7 @@ const SciWorkaroundEntry arithmeticWorkarounds[] = {
 	{ GID_QFG2,           200,  200,  0,              "astro", "messages",                        NULL,     0,     0, { WORKAROUND_FAKE,   0 } }, // op_lsi: when getting asked for your name by the astrologer - bug #5152
 	{ GID_QFG3,           780,  999,  0,                   "", "export 6",                        NULL,     0,     0, { WORKAROUND_FAKE,   0 } }, // op_add: trying to talk to yourself at the top of the giant tree - bug #6692
 	{ GID_QFG4,           710,64941,  0,          "RandCycle", "doit",                            NULL,     0,     0, { WORKAROUND_FAKE,   1 } }, // op_gt: when the tentacle appears in the third room of the caves
+	{ GID_QFG4,            -1,  870,  0,         "hurtMyself", "changeState",                     NULL,     0,     0, { WORKAROUND_FAKE,   1 } }, // op_or: when hitting a necrotaur with a sword as a paladin
 	{ GID_TORIN,        51400,64928,  0,              "Blink", "init",                            NULL,     0,     0, { WORKAROUND_FAKE,   1 } }, // op_div: when Lycentia knocks Torin out after he removes her collar
 	SCI_WORKAROUNDENTRY_TERMINATOR
 };





More information about the Scummvm-git-logs mailing list