SCI: Hoyle3 Amiga - kGetFarText Crash
|Reported by:||OmerMor||Owned by:||bluegr|
|Game:||Hoyle's Book of Games 3|
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(4, 0, 443, 1) kGetFarText(3300, 4, 00d:0058)
Here's a decompilation of the relevant part from Character::say (script #0):
(cond ( (u< param1 100) (if active ; This is the case that crashed. temp501 is represents ; the text resource number: ; temp501 = gGNewRoomNumber + 1000*(view + 1) (= temp501 (+ (* 1000 (+ view 1)) gGNewRoomNumber)) (= temp502 param1) else (= temp501 (+ 19000 gGNewRoomNumber)) (= temp502 (/ param1 3)) ) (GetFarText temp501 temp502 @temp1) (= param1 (Format @global550 0 0 @temp1)) (= temp503 (if (> argc 1) param2 else 0)) ) ( (u< param1 1000) (GetFarText [param1 0] [param1 1] @temp1) (= param1 (Format @global550 0 0 @temp1)) (= temp503 (if (> 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.