[Scummvm-git-logs] scummvm master -> 071ac1be0272f4ee2bd6c0ad687b787e55b42b39
bluegr
noreply at scummvm.org
Sat Feb 7 15:01:00 UTC 2026
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
71797c2734 SCUMM: MI2 DOS NI demo - Minor script patch to prevent crash at startup.
7e06b25626 SCUMM: MI2 DOS NI demo - code cleanup
071ac1be02 SCUMM: MI2 DOS NI demo - Whitespace fixes.
Commit: 71797c27347e90eb55ae7fd233879f73b6a6be86
https://github.com/scummvm/scummvm/commit/71797c27347e90eb55ae7fd233879f73b6a6be86
Author: Robert Megone (robert.megone at gmail.com)
Date: 2026-02-07T17:00:56+02:00
Commit Message:
SCUMM: MI2 DOS NI demo - Minor script patch to prevent crash at startup.
Changed paths:
engines/scumm/resource.cpp
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 2d31e33dd78..d39c2b2a020 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -1718,6 +1718,62 @@ void ScummEngine::applyWorkaroundIfNeeded(ResType type, int idx) {
return;
int size = getResourceSize(type, idx);
+
+ // WORKAROUND: The MI2 DOS NI demo relies on a prerecorded save file ("demo.rec") to start correctly.
+ // Without it, the demo can select an invalid path and attempt to load missing rooms.
+ // We patch script 77 to force the intended startup behavior so the demo begins in a valid scene.
+ // ScummVM does not currently support playback of the 'demo.rec' file so it will crash in other places.
+ if (_game.id == GID_MONKEY2 &&
+ (_game.features & GF_DEMO) &&
+ _game.platform == Common::kPlatformDOS &&
+ _game.version == 5) {
+
+ if (type == rtScript && idx == 77) {
+ byte *scriptRes = getResourceAddress(type, idx);
+ const uint32 scriptResSize = (size > 0) ? (uint32)size : 0;
+
+ byte *code = scriptRes + 8;
+ const uint32 codeSize = scriptResSize - 8;
+
+ const byte PutActorInRoom4Pattern[] = { 0x2D, 0x01, 0x04, 0x01, 0x01 };
+
+ if (codeSize >= (uint32)sizeof(PutActorInRoom4Pattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(PutActorInRoom4Pattern) <= codeSize; ++i) {
+ if (memcmp(code + i, PutActorInRoom4Pattern, sizeof(PutActorInRoom4Pattern)) == 0) {
+ code[i + 2] = 0x03;
+ break;
+ }
+ }
+ }
+
+ const byte OverrideInstallPattern[] = { 0x58, 0x01, 0x18, 0x1E, 0x00 };
+
+ if (codeSize >= (uint32)sizeof(OverrideInstallPattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(OverrideInstallPattern) <= codeSize; ++i) {
+ if (memcmp(code + i, OverrideInstallPattern, sizeof(OverrideInstallPattern)) == 0) {
+ code[i + 0] = 0x58;
+ code[i + 1] = 0x00;
+ code[i + 2] = 0x80;
+ code[i + 3] = 0x80;
+ code[i + 4] = 0x80;
+ break;
+ }
+ }
+ }
+
+ const byte OverrideDecisionTestPattern[] = { 0xA8, 0x05, 0x00, 0x2D, 0x00 };
+ const byte SetOverrideVarTrue[] = { 0x1A, 0x05, 0x00, 0x01, 0x00 };
+
+ if (codeSize >= (uint32)sizeof(OverrideDecisionTestPattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(OverrideDecisionTestPattern) <= codeSize; ++i) {
+ if (memcmp(code + i, OverrideDecisionTestPattern, sizeof(OverrideDecisionTestPattern)) == 0) {
+ memcpy(code + i, SetOverrideVarTrue, sizeof(SetOverrideVarTrue));
+ break;
+ }
+ }
+ }
+ }
+ }
// WORKAROUND: FM-TOWNS Zak used the extra 40 pixels at the bottom to increase the inventory to 10 items
// if we trim to 200 pixels, we can show only 6 items
Commit: 7e06b25626398ccd48ee963b80651b75b4f0f30f
https://github.com/scummvm/scummvm/commit/7e06b25626398ccd48ee963b80651b75b4f0f30f
Author: Robert Megone (robert.megone at gmail.com)
Date: 2026-02-07T17:00:56+02:00
Commit Message:
SCUMM: MI2 DOS NI demo - code cleanup
Changed paths:
engines/scumm/resource.cpp
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index d39c2b2a020..286c5d9624d 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -1726,7 +1726,8 @@ void ScummEngine::applyWorkaroundIfNeeded(ResType type, int idx) {
if (_game.id == GID_MONKEY2 &&
(_game.features & GF_DEMO) &&
_game.platform == Common::kPlatformDOS &&
- _game.version == 5) {
+ _game.version == 5 &&
+ enhancementEnabled(kEnhRestoredContent)) {
if (type == rtScript && idx == 77) {
byte *scriptRes = getResourceAddress(type, idx);
@@ -1735,22 +1736,22 @@ void ScummEngine::applyWorkaroundIfNeeded(ResType type, int idx) {
byte *code = scriptRes + 8;
const uint32 codeSize = scriptResSize - 8;
- const byte PutActorInRoom4Pattern[] = { 0x2D, 0x01, 0x04, 0x01, 0x01 };
+ const byte putActorInRoom4Pattern[] = { 0x2D, 0x01, 0x04, 0x01, 0x01 };
- if (codeSize >= (uint32)sizeof(PutActorInRoom4Pattern)) {
- for (uint32 i = 0; i + (uint32)sizeof(PutActorInRoom4Pattern) <= codeSize; ++i) {
- if (memcmp(code + i, PutActorInRoom4Pattern, sizeof(PutActorInRoom4Pattern)) == 0) {
+ if (codeSize >= (uint32)sizeof(putActorInRoom4Pattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(putActorInRoom4Pattern) <= codeSize; ++i) {
+ if (memcmp(code + i, putActorInRoom4Pattern, sizeof(putActorInRoom4Pattern)) == 0) {
code[i + 2] = 0x03;
break;
}
}
}
- const byte OverrideInstallPattern[] = { 0x58, 0x01, 0x18, 0x1E, 0x00 };
+ const byte overrideInstallPattern[] = { 0x58, 0x01, 0x18, 0x1E, 0x00 };
- if (codeSize >= (uint32)sizeof(OverrideInstallPattern)) {
- for (uint32 i = 0; i + (uint32)sizeof(OverrideInstallPattern) <= codeSize; ++i) {
- if (memcmp(code + i, OverrideInstallPattern, sizeof(OverrideInstallPattern)) == 0) {
+ if (codeSize >= (uint32)sizeof(overrideInstallPattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(overrideInstallPattern) <= codeSize; ++i) {
+ if (memcmp(code + i, overrideInstallPattern, sizeof(overrideInstallPattern)) == 0) {
code[i + 0] = 0x58;
code[i + 1] = 0x00;
code[i + 2] = 0x80;
@@ -1761,13 +1762,13 @@ void ScummEngine::applyWorkaroundIfNeeded(ResType type, int idx) {
}
}
- const byte OverrideDecisionTestPattern[] = { 0xA8, 0x05, 0x00, 0x2D, 0x00 };
- const byte SetOverrideVarTrue[] = { 0x1A, 0x05, 0x00, 0x01, 0x00 };
+ const byte overrideDecisionTestPattern[] = { 0xA8, 0x05, 0x00, 0x2D, 0x00 };
+ const byte setOverrideVarTrue[] = { 0x1A, 0x05, 0x00, 0x01, 0x00 };
- if (codeSize >= (uint32)sizeof(OverrideDecisionTestPattern)) {
- for (uint32 i = 0; i + (uint32)sizeof(OverrideDecisionTestPattern) <= codeSize; ++i) {
- if (memcmp(code + i, OverrideDecisionTestPattern, sizeof(OverrideDecisionTestPattern)) == 0) {
- memcpy(code + i, SetOverrideVarTrue, sizeof(SetOverrideVarTrue));
+ if (codeSize >= (uint32)sizeof(overrideDecisionTestPattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(overrideDecisionTestPattern) <= codeSize; ++i) {
+ if (memcmp(code + i, overrideDecisionTestPattern, sizeof(overrideDecisionTestPattern)) == 0) {
+ memcpy(code + i, setOverrideVarTrue, sizeof(setOverrideVarTrue));
break;
}
}
Commit: 071ac1be0272f4ee2bd6c0ad687b787e55b42b39
https://github.com/scummvm/scummvm/commit/071ac1be0272f4ee2bd6c0ad687b787e55b42b39
Author: Robert Megone (robert.megone at gmail.com)
Date: 2026-02-07T17:00:56+02:00
Commit Message:
SCUMM: MI2 DOS NI demo - Whitespace fixes.
Changed paths:
engines/scumm/resource.cpp
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 286c5d9624d..9f59eb7cb2b 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -1724,57 +1724,58 @@ void ScummEngine::applyWorkaroundIfNeeded(ResType type, int idx) {
// We patch script 77 to force the intended startup behavior so the demo begins in a valid scene.
// ScummVM does not currently support playback of the 'demo.rec' file so it will crash in other places.
if (_game.id == GID_MONKEY2 &&
- (_game.features & GF_DEMO) &&
- _game.platform == Common::kPlatformDOS &&
- _game.version == 5 &&
- enhancementEnabled(kEnhRestoredContent)) {
-
- if (type == rtScript && idx == 77) {
- byte *scriptRes = getResourceAddress(type, idx);
- const uint32 scriptResSize = (size > 0) ? (uint32)size : 0;
-
- byte *code = scriptRes + 8;
- const uint32 codeSize = scriptResSize - 8;
-
- const byte putActorInRoom4Pattern[] = { 0x2D, 0x01, 0x04, 0x01, 0x01 };
-
- if (codeSize >= (uint32)sizeof(putActorInRoom4Pattern)) {
- for (uint32 i = 0; i + (uint32)sizeof(putActorInRoom4Pattern) <= codeSize; ++i) {
- if (memcmp(code + i, putActorInRoom4Pattern, sizeof(putActorInRoom4Pattern)) == 0) {
- code[i + 2] = 0x03;
- break;
- }
- }
- }
-
- const byte overrideInstallPattern[] = { 0x58, 0x01, 0x18, 0x1E, 0x00 };
-
- if (codeSize >= (uint32)sizeof(overrideInstallPattern)) {
- for (uint32 i = 0; i + (uint32)sizeof(overrideInstallPattern) <= codeSize; ++i) {
- if (memcmp(code + i, overrideInstallPattern, sizeof(overrideInstallPattern)) == 0) {
- code[i + 0] = 0x58;
- code[i + 1] = 0x00;
- code[i + 2] = 0x80;
- code[i + 3] = 0x80;
- code[i + 4] = 0x80;
- break;
- }
- }
- }
-
- const byte overrideDecisionTestPattern[] = { 0xA8, 0x05, 0x00, 0x2D, 0x00 };
- const byte setOverrideVarTrue[] = { 0x1A, 0x05, 0x00, 0x01, 0x00 };
-
- if (codeSize >= (uint32)sizeof(overrideDecisionTestPattern)) {
- for (uint32 i = 0; i + (uint32)sizeof(overrideDecisionTestPattern) <= codeSize; ++i) {
- if (memcmp(code + i, overrideDecisionTestPattern, sizeof(overrideDecisionTestPattern)) == 0) {
- memcpy(code + i, setOverrideVarTrue, sizeof(setOverrideVarTrue));
- break;
- }
- }
- }
- }
+ (_game.features & GF_DEMO) &&
+ _game.platform == Common::kPlatformDOS &&
+ _game.version == 5 &&
+ enhancementEnabled(kEnhRestoredContent)) {
+
+ if (type == rtScript && idx == 77) {
+ byte *scriptRes = getResourceAddress(type, idx);
+ const uint32 scriptResSize = (size > 0) ? (uint32)size : 0;
+
+ byte *code = scriptRes + 8;
+ const uint32 codeSize = scriptResSize - 8;
+
+ const byte putActorInRoom4Pattern[] = { 0x2D, 0x01, 0x04, 0x01, 0x01 };
+
+ if (codeSize >= (uint32)sizeof(putActorInRoom4Pattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(putActorInRoom4Pattern) <= codeSize; ++i) {
+ if (memcmp(code + i, putActorInRoom4Pattern, sizeof(putActorInRoom4Pattern)) == 0) {
+ code[i + 2] = 0x03;
+ break;
+ }
+ }
+ }
+
+ const byte overrideInstallPattern[] = { 0x58, 0x01, 0x18, 0x1E, 0x00 };
+
+ if (codeSize >= (uint32)sizeof(overrideInstallPattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(overrideInstallPattern) <= codeSize; ++i) {
+ if (memcmp(code + i, overrideInstallPattern, sizeof(overrideInstallPattern)) == 0) {
+ code[i + 0] = 0x58;
+ code[i + 1] = 0x00;
+ code[i + 2] = 0x80;
+ code[i + 3] = 0x80;
+ code[i + 4] = 0x80;
+ break;
+ }
+ }
+ }
+
+ const byte overrideDecisionTestPattern[] = { 0xA8, 0x05, 0x00, 0x2D, 0x00 };
+ const byte setOverrideVarTrue[] = { 0x1A, 0x05, 0x00, 0x01, 0x00 };
+
+ if (codeSize >= (uint32)sizeof(overrideDecisionTestPattern)) {
+ for (uint32 i = 0; i + (uint32)sizeof(overrideDecisionTestPattern) <= codeSize; ++i) {
+ if (memcmp(code + i, overrideDecisionTestPattern, sizeof(overrideDecisionTestPattern)) == 0) {
+ memcpy(code + i, setOverrideVarTrue, sizeof(setOverrideVarTrue));
+ break;
+ }
+ }
+ }
}
+ }
+
// WORKAROUND: FM-TOWNS Zak used the extra 40 pixels at the bottom to increase the inventory to 10 items
// if we trim to 200 pixels, we can show only 6 items
More information about the Scummvm-git-logs
mailing list