Opened 8 years ago

Closed 6 years ago

#7122 closed defect (fixed)

SCI: Hoyle3 Amiga - kGetFarText Crash

Reported by: OmerMor Owned by: bluegr
Priority: normal Component: Engine: SCI
Version: Keywords:
Cc: Game: Hoyle's Book of Games 3

Description

Game: Hoyle Official Book of Games Volume 3 Game Version: Amiga/ENGLISH ScummVM Version: 1.8.0 Operating System: Windows 10

ScummVM crashes when a character tries to speak during a game. I verified that the game is not corrupt and WAI in an Amiga emulator.

The fault is when GetFarText kernel function is called from char1::say: ~~~~ char1::say(4, 0, 443, 1) kGetFarText(3300, 4, 00d:0058) ~~~~

Here's a decompilation of the relevant part from Character::say (script #0): ~~~~ (cond ( (u argc 1) param2 else 0)) ) ( (u argc 2) [param1 2] else 0)) ) ) ~~~~

The scripts tries to access text resource 3300 which is mapped from room 300 (backgammon) and character view 2 (Rosella), using the following formula: textResource = room + 1000*(view + 1) In this case, room = 300 and view = 2, so we get text resource 3300.

The text resources in the DOS version are indeed numbered according to the scheme described in the script. However, the Amiga version has no text resource #3300.

I compared the text resources of the Amiga version with those in the DOS version, and noticed they are numbered differently. The Amiga version use a different numbering scheme which I was able to reconstruct: textResource = room - 24*(view + 1) + 1024*((view + 1)%2)

Somehow the Amiga interpreter "knows" to retrieve the correct resource number, even though the script is using the DOS numbering scheme. Possible explanation could be a translation in the kernel function. Another explanation could be that there are multiple instances of SCRIPT.000 in the resource file, and ScummVM uses the wrong one (similar to bug #5141, https://github.com/scummvm/scummvm/commit/864b067f).

Ticket imported from: bugs/7122.

Attachments (1)

hoyle3_amiga.diff (3.2 KB ) - added by bluegr 7 years ago.
Add support for Hoyle 3 Amiga

Download all attachments as: .zip

Change History (6)

comment:1 by criezy, 8 years ago

Unless I am mistaken, your reconstructed formula just looks like applying the 0x7FF mask to the DOS text resource number: amigaTextResource = dosTextResource & 0x7FF

comment:2 by OmerMor, 8 years ago

You're right! I failed to see it...

I have some more information: I tried to patch scummvm to fallback to the "amiga scheme" if the text resource is not found. It made the game workable for backgammon+rosella (room 300, view 2). However when trying checkers+mordack (room 200, view 11) it failed to find text resource 960. I checked with both SCI Companion and Sierra Viewer, and this text resource is "invisible" to them as well.

Again, checking with an emulator I verified that the game is WAI, so clearly this text resource is there. This suggests we're not handling amiga resources correctly, and maybe there is a "hidden" SCRIPT.000 as well that has the correct text numbering scheme.

comment:3 by m-kiewitz, 8 years ago

Component: Engine: SCI
Game: Hoyle's Book of Games 3

comment:4 by bluegr, 7 years ago

The Amiga version of Hoyle 3 is... strange. Texts are stored as either text, font or palette types. Seems like the resource type bits are used as part of the resource numbers. I haven't found a reliable way of loading these correctly as text in the resource manager, so the least invasive way of loading them properly, that I could think of, is in Kernel::lookupText()

I'm attaching a patch that makes Hoyle 3 Amiga fully playable, with the following changes:

  • Handling of game texts for this game
  • Skipping a reference to an invalid export function 0 in script 601, when the script is loaded (this is the script for Snakes and Ladders)
  • Enabling of the entry in the detector

If someone can think of a cleaner way to handle these resources properly in the resource manager, feel free to adapt this patch accordingly :)

by bluegr, 7 years ago

Attachment: hoyle3_amiga.diff added

Add support for Hoyle 3 Amiga

comment:5 by bluegr, 6 years ago

Owner: set to bluegr
Resolution: fixed
Status: newclosed

The patch for Hoyle 3 Amiga has now been merged on master and the game works, so I'm closing this as fixed

Note: See TracTickets for help on using tickets.