[scummvm-devel] ScummVM 2.3.0 proposed schedule
Torbjörn Andersson
eriktorbjorn at telia.com
Sun Aug 8 17:10:34 UTC 2021
On 08/08/2021 15.16, Eugene Sandulenko via scummvm-devel wrote:
> I plan to start looking through the buglist today and prioritize the
> blockers and nice-to-get-fixed bugs.
One thing I was hoping to see fixed, even though it's not really a high
priority, is that Lemonhead glitch in non-English versions of The Secret
of Monkey Island.
For those who missed the background, it seems that when LucasArts
upgraded the game to the CD version, they managed to introduce some bugs
as well, including a couple of missing lines for Lemonhead. I recently
submitted a pull request to fix this in the English version, and it was
accepted a few days later. See
https://github.com/scummvm/scummvm/pull/3239 for details.
But this only fixed the glitch in the English CD version, and apparently
the bug is also present in localized versions as well?
From what I understand, the game was translated - both on floppy and CD
- into French, German, Italian and Spanish. There's also the "ultimate
talkie" version, but I don't even know if those extra lines were ever
recorded. Anyway, that version could change at any time so it's probably
safer to leave it alone.
If you don't have any of these localized versions you can stop reading here.
Anyone still here? Good. To illustrate, here's how the English script is
patched:
If you descumm the room-25-205 script in the floppy version (boot param
408 is useful here), you'll see this:
[00A0] (14) print(3,[Text("Oooh, that's nice." + wait() + "Simple. Just
like one of mine." + wait() + "And little. Like mine.")]);
[00F0] (AE) WaitForMessage();
In the CD version, this is inexplicably shortened to:
[009E] (14) print(3,[Text("Oooh, that's nice.")]);
The new ScummEngine::tryPatchCannibalScript() tries to patch the script.
With the English CD version, the resource it gets to work with is 82906
bytes. The Common::hexdump() function is useful for visualizing it. You
have to locate the script within the resource:
012080: 20 68 61 76 65 20 6e 6f 74 68 69 6e 67 20 66 6f | have
nothing fo|
012090: 72 20 75 73 2e 00 c0 2a 69 ff a0 4c 53 43 52 00 |r
us...*i..LSCR.|
0120a0: 00 02 5f cd 40 01 01 00 ff 62 cc 1a 61 80 01 00
|.._. at ....b..a...|
...
012140: ae 02 14 03 0f 4f 6f 6f 68 2c 20 74 68 61 74 27 |.....Oooh,
that'|
012150: 73 20 6e 69 63 65 2e 00 14 03 0f 41 6e 64 20 69 |s
nice.....And i|
...
0122e0: 01 01 5d 33 01 01 06 00 ff 62 d4 07 2d 01 00 07
|..]3.....b..-...|
0122f0: 2e 01 00 1a 20 00 04 00 c0 a0 4c 53 43 52 00 00 |....
.....LSCR..|
012300: 00 7f ce 48 00 40 02 00 62 00 48 6b 00 04 00 14
|...H. at ..b.Hk....|
The LSCR tag at offset 0x01209b (decimal 73883). The LSCR tag at offset
0x0122fa (decimal 74490) is the start of the next script. So the script
is 607 bytes.
The print instruction (0x14) we want to change is at offset 0x12142
(decimal 74050) or 167 bytes into the script. (Descumm said 158 bytes,
but I guess there is some header information that it doesn't count.) The
next print instruction starts at 0x12158 (decimal 74072) so there is 22
bytes to patch.
So that's where most of this information comes from:
expectedSize = 82906;
scriptOffset = 73883;
scriptLength = 607;
expectedMd5 = "98b1126a836ef5bfefff10b605b20555";
patchOffset = 167;
patchLength = 22;
lang[0] = 'E';
lang[1] = 'N';
lang[2] = 'G';
Just to be safe, the script will only be patched in the size matches the
expected size, if there is an LSCR tag at the beginning of the script,
if there is a print instruction at the patch offset, and if the MD5 sum
for the script matches.
There isn't enough space to fit the corrected text, so it gets replaced
by a unique marker. For the English script this is "/LH.ENG/". This is
padded with spaces to the desired size, before inserting
WaitForMessage() before the next print. Given the above information,
this should all happen automatically.
This is then replaced with the desired string in
ScummEngine_v5::printPatchedMI1CannibalString():
if (strncmp((const char *)ptr, "/LH.ENG/", 8) == 0) {
msg =
"Oooh, that's nice.\xFF\x03"
"Simple. Just like one of mine.\xFF\x03"
"And little. Like mine.";
}
The \xFF\x03 escape sequence means that it waits before printing the
next part of the message.
So that should give you all the information you need, I hope.
Torbjörn Andersson
More information about the scummvm-devel
mailing list