Author Topic: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")  (Read 7907 times)

0 Members and 2 Guests are viewing this topic.

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #15 on: September 30, 2022, 11:39:08 PM »
Ugh, I didn't notice until now that the debughandler::handleEvent method decompiled as "addAfter" - part of why the ALT commands weren't working. This fixes some of the ALT commands, but several (like get inv item) are still broken.

EricOakford did a full decompilation of KQ6CD, I think with no assembly. https://github.com/EricOakford/SCI-Decompilation-Archive/tree/master/kq6cd/src It would be nice to get a full decompilation of the debugger script, too.

Yes, if anyone unwinds the asm it would be nice to verify which debug commands were originally available.
« Last Edit: October 05, 2022, 05:58:57 AM by doomlazer »

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #16 on: October 01, 2022, 10:43:07 AM »
911 is missing from both my Collector's Edition and my Collection Series. Could it be that the European release is different from the NA release? Also, if you have the EU release, can you verify if the KQ7 demo it has is interactive or not?
KQII Remake Pic

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #17 on: October 01, 2022, 12:56:13 PM »
Debug commands

[ALT-A]      Show Cast (does nothing)
[ALT-B]      Polygon Editor (crashes game)
[ALT-C]      Control map
[ALT-D]      DebugOn Toggle (doesn't seem to disable debug)
[ALT-E]      Dialogue Editor
[ALT-F]      Flag set/clr (appears to work, needs testing)
[ALT-G]      Global set (appears to work, needs testing)
[ALT-I]      Inv items
[ALT-K]      Show Palette
[ALT-L]      Log file
[ALT-M]      Memory (crashes game)
[ALT-P]      Priority map
[ALT-Q]      show Cursor Coords
[ALT-R]      Room info (crashes game)
[ALT-S]      Updating cast element (does nothing)
[ALT-T]      Teleport ("where to, Stud" menu)
[ALT-U]      return User control (crashes game)
[ALT-V]      Visual map
[ALT-W]      feature Writer (does nothing)
[ALT-Y]      Vanishing point adj
[ALT-Z]      QUICK QUIT

[ALT-H]      Shows the above list of help commands.


Inventory Items:

Code: [Select]
0 map
1 boringBook
2 brick
3 brush
4 hair
5 clothes
6 coal
7 deadMansCoin
8 dagger
9 coin
10 egg
11 skull
12 feather
13 flower
14 flute
15 gauntlet
16 cassimaHair
17 handkerchief
18 holeInTheWall
19 huntersLamp
20 letter
21 lettuce
22 milk
23 mint
24 mirror
25 newLamp
26 nail
27 nightingale
28 ticket
29 participle
30 pearl
31 peppermint
32 note
33 potion
34 rabbitFoot
35 ribbon
36 riddleBook
37 ring
38 rose
39 royalRing
40 sacredWater
41 scarf
42 scythe
43 shield
44 skeletonKey
45 spellBook
46 teaCup
47 poem
48 tinderBox
49 tomato
50 sentence
51 ink

Event Flags
(taken from the SCI Decompile Archive)

fBefriendedClown10
fKingQueenRevived 15
fBeenAtCastleGate 18
fMadeMagicPaint 22
fBeenInBookstore 27
fBeenInPawnshop 28
fFragmented 38
fEgoDead   44
fIsVGA 48
Alexander has a reason to collect tears in a lamp 77
fTeleporting 103
fFoundHair 143
fUsedInk 151
fDrankPotion 153


Additional Debugging features

As Omer mentioned, there are additional debug features when you place a file named "g" in your KQ6 game folder while the debugger is active.

Most require that you teleport to the listed from from the opening Sierra logo.

Room 205 (help):
From the title screen click the help button - A Menu with options to skip ahead in the tutorial is show at the start.

Room 470 (dogtree):
Gives inv items tomato, teaCup, huntersLamp, skull and dagger.

Room 480 (brats):
Give flute and milk.
Assign potion to room 480.
Set flag 77.
Set Chapter 4.

Room740 (theGreatEscape):
Chose one of the many possible endings.
This also works when teleporting from room 180 to 740, which uses a seprate script.

Room750 (continuedWindup):
Gives inv item: peppermint.
Play music.
If Jollo has lamp is chosen: assign newLamp to room 750, Load 'Jollo gives lamp' script (751) and LoadMany: scripts 128, 717, 754.
If Cassima has dagger, assign it to room 870.
« Last Edit: October 05, 2022, 06:02:25 AM by doomlazer »

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #18 on: October 01, 2022, 06:22:44 PM »
911 is missing from both my Collector's Edition and my Collection Series. Could it be that the European release is different from the NA release? Also, if you have the EU release, can you verify if the KQ7 demo it has is interactive or not?

Ok, I was mistaken. 911 isn't in the Collector's Edition. I must of been confused checking so many different versions yesterday, but I tried again with a fresh install and none of the versions I have come with 911. As Omer said back in 2016, it must only be in the Italian and Spanish versions, which I can't find anywhere.

I'm assuming I must have imported Omer's 911.scr at some point and forgotten while switching between versions. The problem with importing Omer's 911.scr is most versions will not decompile it at all. Also, I couldn't get the existing patches to work with any versions I tried - they all crash with error 0.

In the collector's edition, 911 stops decompiling after the first two lines:

Code: [Select]
;;; Sierra Script 1.0 - (do not remove this comment)
(script# 911)
(include sci.sh)



However, I just now verified importing Omer's 911.scr into the GOG offline installer version (setup_kings_quest_6_-_heir_today_gone_tomorrow_1.034_(20239).exe) decompiles the entire patch, but with the wrong commands (i.e. setCursor instead of addButton).

Strangely, the edited patch I recompiled seems to work fine on both the GOG and Steam version as well as the Collector's Edition that couldn't decompile Omer's patch.
« Last Edit: October 01, 2022, 11:54:14 PM by doomlazer »

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #19 on: October 01, 2022, 09:33:18 PM »
No problems. I often have so many irons in the fire that I lose track of what is what, too. I tried your fixes and everything seems to work well. I added it to the SCI debug page: http://sciwiki.sierrahelp.com//index.php?title=SCI_Debug_Modes#King.27s_Quest_6_CD
KQII Remake Pic

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #20 on: October 04, 2022, 02:14:28 AM »
No problems. I often have so many irons in the fire that I lose track of what is what, too. I tried your fixes and everything seems to work well. I added it to the SCI debug page: http://sciwiki.sierrahelp.com//index.php?title=SCI_Debug_Modes#King.27s_Quest_6_CD

Nice, thanks. I've spent some more time with the debugger and fixed a bunch more stuff like polyedit, feature writer, Palette Display (alt+k was unlisted in help), etc.

Only three things left:
 "return user control" is disabled (doesn't work even if I rewrite it in sierra script).
"Toggle Debug" crashes on screen change because the interpreters don't have the debugger.
"Room Info" prints the information, but crashes after clearing the textbox.

Granted, I don't actually know assembly, but most of it is straightforward enough that I understand it. The part I'm unclear about is that final "send 58". Perhaps that is the cause or "67 ;width" decompiled wrong? If anyone has any insight please let me know.

One final discovery, for some reason the debugger commands are not sent to 911 in several rooms because of this proc999_5 check in Kq6::handleEvent

Code: [Select]
(else
(pEvent claimed: 1)
(if
(and
global100
(not
(proc999_5 gArrayScriptGetValue 440 450 480 270 280 470 490 670 750 740 )
)
)
(pEvent claimed: 0)
((ScriptID 911) handleEvent: pEvent)
((ScriptID 911) dispose:)
(DisposeScript 911)
)
)

What could possibly be the point of excluding all debug commands from rooms  440, 450, 480, 270, 280, 470, 490, 670, 750, 740? Doesn't make sense to me at least. I've added modified 0.scr that removes this restriction.
« Last Edit: October 04, 2022, 07:22:40 PM by doomlazer »

Offline lskovlun

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #21 on: October 04, 2022, 08:34:55 AM »
Granted, I don't actually know assembly, but most of it is straightforward enough that I understand it. The part I'm unclear about is that final "send 58". Perhaps that is the cause or "67 ;width" decompiled wrong? If anyone has any insight please let me know.
My KQ6 GOG version weirds out on me for a different reason (selector mismatch) when using the Room Info feature, so I can't help you. But the send 58 is normal, that's just because it's a big Print statement.
What could possibly be the point of excluding all debug commands from rooms  440, 450, 480, 270, 280, 470, 490, 670, 750, 740? Doesn't make sense to me at least.
My guess would be heap usage. Either that or an animated sequence might bug out with some of the debug functionality. Or both.

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #22 on: October 04, 2022, 03:33:00 PM »
My guess would be heap usage. Either that or an animated sequence might bug out with some of the debug functionality. Or both.

Yeah, that makes sense. I don't really know KQ6 gameplay, so it's difficult for me to verify if that's the case.

I think the problem with the Room Info is that it's using "addTextF" instead of (Format @temp0 ...), then using "addText: @temp0".

I fixed this in a really stupid hacky way instead of just rewriting everything in SierraScript. I bypass the original key_alt_r asm code by jumping to the end and calling a new local procedure. Then I just wrote the Format and Print in sierraScript. I had to move the strings into 911.txt because any literal strings in the procedure or asm throws off all the other command text. It's sloppy, but it does seem to work.
« Last Edit: October 05, 2022, 06:06:04 AM by doomlazer »

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #23 on: October 04, 2022, 03:57:41 PM »
Kawa did build a debug version of the interpreter that does run the game.
KQII Remake Pic

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #24 on: October 04, 2022, 04:05:03 PM »
Ah, Thank you. I didn't know about that. Seems to work pretty well.


Offline Collector

KQII Remake Pic

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #26 on: October 04, 2022, 06:31:54 PM »
Kawa's SCI2.1 debug interpreter included a readme file. The interpreter looks for help file (DBGHELP.000) that is missing. The official Sierra files we have include three such files. The attached ZIP includes your latest scripts, Kawa's debug build with readme and the missing DBGHELP files.
KQII Remake Pic

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #27 on: October 04, 2022, 07:10:49 PM »
Awesome. With Kawa's interpreter in the mix, the only missing feature is "return control to user".

Polyedit does crash under ScummVM though when moving vectors around - works fine in DOSBox. Show Pri and Show Control also don't work in SVM for some reason.

Did you update the link on the wiki? That old version was mostly broken.
« Last Edit: October 04, 2022, 07:17:27 PM by doomlazer »

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #28 on: October 04, 2022, 07:47:22 PM »
No, not yet. I'll wait until we have as much worked out as we can get. Just noticed that [SHIFT + /] no longer calls the commands help list.
KQII Remake Pic

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #29 on: October 05, 2022, 12:26:34 PM »
Good call. I've already reverted some of my "hacks" and fixed the decompile errors properly, which makes things much more historically accurate.

Turns out [ALT+E] is actually "Dialogue Editor" based on the context clues, not the more common "show Ego info" found in other debuggers. Also, looks like there are mouse related debug features in the asm, but mouse events aren't sent to 911 at the moment. I'll investigate [SHIFT+/] as well.

If I can fix enough of the assembly I'm hoping to get things to the point where SCICompanion can magically decompile everything in SierraScript. I think I'm getting close. I'll post the fixed assembly once I finish unwinding the mouse stuff.



SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.045 seconds with 20 queries.