[Scummvm-tracker] [ScummVM :: Bugs] #11528: ILLUSIONS: Duckman - Crash after option menu "times out"
ScummVM :: Bugs
trac at scummvm.org
Fri Jul 2 21:02:19 UTC 2021
#11528: ILLUSIONS: Duckman - Crash after option menu "times out"
--------------------+--------------------------------
Reporter: raziel- | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: Engine: Illusions
Version: | Resolution:
Keywords: Duckman | Game:
--------------------+--------------------------------
Comment (by dwatteau):
@raziel-: Thanks for your new test!
Indeed, there are various problems in my previous patches, but now I've
think I've found the real culprit. And of course it was a one-liner :)
Forget my Github fork, just go back to the official ScummVM sources, but
apply this change in engines/illusions/resources/talkresource.cpp:
{{{
#if defined(SCUMM_BIG_ENDIAN)
- for (byte *ptr = (byte *)_text; ptr != _tblPtr; ptr += 2) {
+ for (byte *ptr = (byte *)_text; *ptr != 0; ptr += 2) {
WRITE_UINT16(ptr, SWAP_BYTES_16(READ_UINT16(ptr)));
}
#endif
}}}
and I think that should be it.
The reason is that, on big-endian systems, the original line above
reversed the internal wide strings until reaching _tblPtr, but
TalkEntry::load() is called for every piece of text in a talk entry, and
_tblPtr is way past all the text parts:
{{{
TalkEntry::load() _talkId: 000F00C8; textOffs: 0000065C; tblOffs:
0000285A; voiceNameOffs: 00003C04
TalkEntry::load() _talkId: 000F00C9; textOffs: 000006E8; tblOffs:
00002896; voiceNameOffs: 00003C0C
TalkEntry::load() _talkId: 000F00CA; textOffs: 000007A8; tblOffs:
000028E8; voiceNameOffs: 00003C14
TalkEntry::load() _talkId: 000F00CB; textOffs: 0000080C; tblOffs:
0000290E; voiceNameOffs: 00003C1C
}}}
so, every piece of text was reversed multiple times, sometimes being in
native endianness, and sometimes not, hence the crashes (that's why c
appeared as 22272 on big-endian PowerPC instead of 87 on Intel: 0x0057 vs.
0x5700). Well, at least, that's what I understood from my debugging
session :)
I'll continue my testing a bit, but I think that's the fix I'm going to
submit.
--
Ticket URL: <https://bugs.scummvm.org/ticket/11528#comment:20>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list