[Scummvm-git-logs] scummvm branch-2-3 -> 6c4209d8c45744b5814364a426f60c57b271daa7
sluicebox
22204938+sluicebox at users.noreply.github.com
Wed Sep 8 22:16:07 UTC 2021
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:
fea165ace9 SCI: Improve MOTHERGOOSE256 save-id workaround
6c4209d8c4 SCI: Add MOTHERGOOSE256 workarounds for restarting
Commit: fea165ace9a1b9ae94eee77a581e4baf0ed2c27a
https://github.com/scummvm/scummvm/commit/fea165ace9a1b9ae94eee77a581e4baf0ed2c27a
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-09-08T17:14:27-05:00
Commit Message:
SCI: Improve MOTHERGOOSE256 save-id workaround
The existing workarounds for this game's unique way of handling saves
assumed that the player restored a game at some point before the end.
Starting a new game and playing to the end would still cause an error
in the SCI1.1 floppy version because the game's save global would
contain an SCI id instead of our virtual id; we were only patching the
global when restoring.
Now we also patch the global on kSaveGame so that it always contains a
virtual id when there is a saved game.
Note that the existing uninitialized read workaround had no effect since
the read occurred in a local procedure but the workaround entry didn't
include a local procedure signature. Updating that workaround wouldn't
fix this; there would still be scenarios where the wrong save would be
auto-deleted.
Fixes bug #5294
Changed paths:
engines/sci/engine/kfile.cpp
engines/sci/engine/savegame.cpp
engines/sci/engine/workarounds.cpp
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 84c8c228f0..f6ec127333 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -1172,6 +1172,16 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
error("kSavegame: no more savegame slots available");
}
}
+
+ // WORKAROUND: Mothergoose256 has a unique scheme for calculating the current save id
+ // and storing it in a global. The SCI1.1 floppy version uses this to auto-save and
+ // auto-delete at the end of the game. This is incompatible with our virtual id system
+ // so we work around this by setting the game's save global to the virtual id here and
+ // also when restoring so that it's always correct. See gamestate_afterRestoreFixUp().
+ // Fixes bug #5294
+ if (g_sci->getGameId() == GID_MOTHERGOOSE256) {
+ s->variables[VAR_GLOBAL][0xB3].setOffset(SAVEGAMEID_OFFICIALRANGE_START + savegameId);
+ }
} else {
error("kSaveGame: invalid savegameId used");
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 5387d56571..248b6b60d9 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -1309,6 +1309,9 @@ void gamestate_afterRestoreFixUp(EngineState *s, int savegameId) {
// saving a previously restored game.
// We set the current savedgame-id directly and remove the script
// code concerning this via script patch.
+ // We also set this in kSaveGame so that the global is correct even if no restoring occurs,
+ // otherwise the auto-delete script at the end of the SCI1.1 floppy version breaks if
+ // the game is played from start to finish. (bug #5294)
s->variables[VAR_GLOBAL][0xB3].setOffset(SAVEGAMEID_OFFICIALRANGE_START + savegameId);
break;
case GID_JONES:
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 088b59c456..993f18c95b 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -480,7 +480,6 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_MOTHERGOOSE256, -1, 0, 0, "MG", "doit", NULL, 5, 5, { WORKAROUND_FAKE, 0 } }, // SCI1.1: When moving the cursor all the way to the left during the game - bug #5224
{ GID_MOTHERGOOSE256, -1, 992, 0, "AIPath", "init", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // Happens in the demo and full version. In the demo, it happens when walking two screens from mother goose's house to the north. In the full version, it happens in rooms 7 and 23 - bug #5269
{ GID_MOTHERGOOSE256, 90, 90, 0, "introScript", "changeState", NULL, 65, 65, { WORKAROUND_FAKE, 0 } }, // SCI1(CD): At the very end, after the game is completed and restarted - bug #5626
- { GID_MOTHERGOOSE256, 94, 94, 0, "sunrise", "changeState", NULL, 367, 367, { WORKAROUND_FAKE, 0 } }, // At the very end, after the game is completed - bug #5294
{ GID_MOTHERGOOSEHIRES,-1,64950, -1, "Feature", "handleEvent", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // right when clicking on a child at the start and probably also later
{ GID_MOTHERGOOSEHIRES,-1,64950, -1, "View", "handleEvent", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // see above
{ GID_PEPPER, -1, 894, 0, "Package", "doVerb", NULL, 3, 3, { WORKAROUND_FAKE, 0 } }, // using the hand on the book in the inventory - bug #5154
Commit: 6c4209d8c45744b5814364a426f60c57b271daa7
https://github.com/scummvm/scummvm/commit/6c4209d8c45744b5814364a426f60c57b271daa7
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-09-08T17:14:47-05:00
Commit Message:
SCI: Add MOTHERGOOSE256 workarounds for restarting
Changed paths:
engines/sci/engine/workarounds.cpp
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 993f18c95b..3c0baaf472 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -479,7 +479,7 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_LSL7, -1, 64892, 0, "oEventHandler", "killAllEventHogs", NULL, 1, 1, { WORKAROUND_FAKE, 0 } }, // when looking at the swordfish in the kitchen
{ GID_MOTHERGOOSE256, -1, 0, 0, "MG", "doit", NULL, 5, 5, { WORKAROUND_FAKE, 0 } }, // SCI1.1: When moving the cursor all the way to the left during the game - bug #5224
{ GID_MOTHERGOOSE256, -1, 992, 0, "AIPath", "init", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // Happens in the demo and full version. In the demo, it happens when walking two screens from mother goose's house to the north. In the full version, it happens in rooms 7 and 23 - bug #5269
- { GID_MOTHERGOOSE256, 90, 90, 0, "introScript", "changeState", NULL, 65, 65, { WORKAROUND_FAKE, 0 } }, // SCI1(CD): At the very end, after the game is completed and restarted - bug #5626
+ { GID_MOTHERGOOSE256, 90, 90, 0, "introScript", "changeState", NULL, 64, 65, { WORKAROUND_FAKE, 0 } }, // At the very end, after the game is completed and restarted (floppy: temp 64, CD: temp 65) - bug #5626
{ GID_MOTHERGOOSEHIRES,-1,64950, -1, "Feature", "handleEvent", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // right when clicking on a child at the start and probably also later
{ GID_MOTHERGOOSEHIRES,-1,64950, -1, "View", "handleEvent", NULL, 0, 0, { WORKAROUND_FAKE, 0 } }, // see above
{ GID_PEPPER, -1, 894, 0, "Package", "doVerb", NULL, 3, 3, { WORKAROUND_FAKE, 0 } }, // using the hand on the book in the inventory - bug #5154
@@ -859,6 +859,7 @@ const SciWorkaroundEntry kGraphSaveBox_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index-range, workaround
const SciWorkaroundEntry kGraphRestoreBox_workarounds[] = {
{ GID_LSL6, -1, 86, 0, "LL6Inv", "hide", NULL, 0, 0, { WORKAROUND_STILLCALL, 0 } }, // happens during the game, gets called with 1 extra parameter
+ { GID_MOTHERGOOSE256, -1, 90, 0, "introScript", "changeState", NULL, 0, 0, { WORKAROUND_IGNORE, 0 } }, // happens when restoring after completing a game in SCI1.1 floppy, 2nd parameter is an object from previous game
SCI_WORKAROUNDENTRY_TERMINATOR
};
More information about the Scummvm-git-logs
mailing list