Author Topic: GAL (KQ1) extractor and decompiler  (Read 23167 times)

0 Members and 2 Guests are viewing this topic.

Offline lskovlun

Re: GAL (KQ1) extractor and decompiler
« Reply #30 on: October 29, 2023, 07:09:07 PM »
Use the tools that NewRisingSun has provided in this thread?

Also, I've looked a bit at the code. There was supposed to be a time penalty in KQ1:

Code: [Select]
$  grep -a "time penalty" KQ1.IMG
Your Score Is: with a & time penalty665535-->

Also, it seems the distribution disk used to contain the PCJR version. Line 1 and 2 are from the fairy godmother, but only line 2 is used:
Code: [Select]
$ strings KQ1.IMG | grep Graham | nl
     1 "Ye best be careful, young Grahame. The
     2 "Ye best be careful, young Graham. The
     3 "Gentle Sir Graham, your quest is
     4 Graham.
     5 Good Luck, Sir Graham!
     6 Go, Sir Graham! Go and bring me back
     7 Come closer, Sir Graham, my voice is
     8 Why, Sir Graham, have you failed me and
     9 "Sir Graham, I am an old man. I fear my
    10 I have chosen you, Sir Graham, to prove
    11 Go, Sir Graham! Go and bring me back
    12 Graham. You have been a good and
And it seems at one point you could reenter the castle without the treasures (line 8 )?
« Last Edit: October 29, 2023, 07:11:53 PM by lskovlun »

Offline lskovlun

Re: GAL (KQ1) extractor and decompiler
« Reply #31 on: October 29, 2023, 08:28:23 PM »
And this one is just silly:
Code: [Select]
if (said(climb,well)) {
        print("You cannot climb the sides of the well.\n They are too steep and slippery.");
}
if (said(rowland,well)) {
        print("You cannot climb the sides of the well.\n They are too steep and slippery.");
}
and more cases involving the rope in the well and the verb 'rowland' instead of 'climb'. They just duplicate the code of the 'climb' cases. I guess someone was tired of working on the project, or physically tired. Oddly, I can't get the interpreter to execute these statements. But they are there.

EDIT: And even more curiously, in the PCJR version (where the 'greg' animation doesn't work), we instead have:
Code: [Select]
if (said(climb,well)) {
        print("You cannot climb the sides of the well.\n They are too steep and slippery.");
}
if (said(greg,well)) {
        print("You cannot climb the sides of the well.\n They are too steep and slippery.");
}
« Last Edit: October 29, 2023, 11:46:11 PM by lskovlun »

Offline Kawa

Re: GAL (KQ1) extractor and decompiler
« Reply #32 on: October 30, 2023, 05:26:49 AM »
I guess the "greg rope" joke earlier in the thread was almost correct.

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #33 on: October 30, 2023, 09:41:16 AM »
To be fair, I had already seen the scripts that Lars found. These are the rope ones that he refers to:

Code: [Select]
if (said(greg,rope) && v137==1 && v145==0) {
        set(v167);
}
if (said(greg,rope) && v137==0 && v145==0) {
        print("The rope is out of reach.");
}
if (said(greg,rope) && v145==1) {
        set(v112);
}

What I'm wondering now is why did (presumably) Greg add these ones? As Lars mentions, they're just a copy of the same statements that use "climb" instead. Why specifically did he copy those particular statements and create "greg" versions of them? Is it that he wanted to hide something in there that used his name? Or was he trying to debug an issue? Lars mentioned that he couldn't get the interpreter to execute the "greg" variants. I wonder if the "climb" variants work? If not, then maybe he was trying to debug that, using another "said" case.

If he wasn't debugging an issue, but instead hiding another easter egg in there, then why pick these "climb well" and "climb rope" statements to copy?

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #34 on: October 30, 2023, 09:49:20 AM »
EDIT: And even more curiously, in the PCJR version (where the 'greg' animation doesn't work), we instead have:
Code: [Select]
if (said(climb,well)) {
        print("You cannot climb the sides of the well.\n They are too steep and slippery.");
}
if (said(greg,well)) {
        print("You cannot climb the sides of the well.\n They are too steep and slippery.");
}

Yeah, it does seem strange to presumably deliberately change "greg" to "rowland" for these statements. Sierra released the "greg" variants in the PCJR version, then changed them to "rowland" in the later IBM PC and TANDY versions. That does feel like a deliberate change, and it suggests that the original "greg" statements in the PCJR release were not mistakenly left in there, since someone changed the word to "rowland" and once again left them in there for the next release. They didn't spot it and think "Oh, I left that in there, better take it out" but rather "Let's change that to 'rowland' and use 'greg' for crouching instead".

Offline Kawa

Re: GAL (KQ1) extractor and decompiler
« Reply #35 on: October 30, 2023, 09:58:33 AM »
Weird idea: the copy that has the "greg" saids but doesn't accept them deliberately doesn't recognize 0xC2 and higher?

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #36 on: October 31, 2023, 12:11:23 PM »
I have four booter images. The one that starts composite color mode does. The PCjr copy does not. The Tandy/PCjr and the Tandy do.

I have managed to find what I think is the 30th May 1984 IBM PC release of King's Quest. NewRisingSun mentioned in another thread that that particular version has the text "BOOT v1.1" in it, rather than "BOOT v1.2". I found the version with "BOOT v1.1" on archive.org. So I now have all five of those early booter versions. The "LOADER" version also differs. The one with "BOOT v1.1" has "LOADER v1.15", whereas the one with "BOOT v1.2" has "LOADER v1.2".

I can confirm that this 30th May 1984 version does have both the "greg" crouching animation script and the "rowland" scripts from the well. So this would mean that these changes were made in the few weeks between the PCJR release and the first IBM PC release.

Curious thing about the Tandy versions is that Graham stays crouching, while in the composite color one he bobs right back up.

Yeah, you're right. I just tried that, and he does indeed stay crouching. Another mystery.

Offline lskovlun

Re: GAL (KQ1) extractor and decompiler
« Reply #37 on: October 31, 2023, 12:49:51 PM »
And yet another. Greg Rowland is only credited as an artist in KQ1 (and Dragon's Keep and The Dark Crystal), but it seems he was writing code too, slipping easter eggs into the game? And he did contribute code to PQ1.

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #38 on: October 31, 2023, 04:13:07 PM »
Yes, a few years back, in fact it was over 7 years ago now, there was a thread on here in which we discussed what Greg had put in his online resume in regards to King's Quest:

Quote
KINGS QUEST I Development team member. Helped design and produce graphics and animation utilities, game logic compiler, later to become known as Adventure game development system AGDS. Substantially contributed to game design and story line. Built game screen graphics and animated characters. Developed game AI logics and user response messages.

So he was definitely doing more than just graphics. Not sure why the official credits list him only under graphics.

Offline HWM

Re: GAL (KQ1) extractor and decompiler
« Reply #39 on: November 01, 2023, 08:44:37 AM »
Very interesting findings here! Somehow I've seem to have missed that there was a working decompiler for the original KQ1.

Now I didn't check it out yet, but reading the thread: Isn't it just that someone (perhaps Greg) has overwritten the entry containing the verb for ducking/crawling when padding the dictionary with names of the team members? This also could explain some of the copied statements, e.g. "climbing" versus "crawling" (in a well, a rope), which are not synonyms.

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #40 on: November 01, 2023, 11:40:58 AM »
I did wonder something similar, e.g. perhaps "greg" and "rowland" were added as synonyms for other words, or perhaps a word was completely replaced by "greg". I ruled out the synonym idea, as there is only one word with a word number of 0xC2 (i.e. greg) and one with a word number of 0xC3 (i.e. rowland).

Regarding the replacement idea, there is no "duck" or similar word in the original King's Quest WORDS list, so perhaps one of Greg's names did replace that word. The AGIv2 versions of the game do support "duck", but these early booter versions don't appear to have "duck" or "squat". There is, of course, the "-" key that makes Graham duck/squat, and that works similar to what typing "greg" does for the CGA and TANDY versions, except that for the CGA versions, "greg" squats then immediately stands, whereas for the "-" key, he stays down. For the other action words, i.e. "swim" and "jump", which have associated keys ("=" and "0"), the early booter versions of KQ do support those words, and they do the same as what the action key does... (well, it seems that the PCJR version doesn't jump when you type "jump", but the CGA versions do),  whereas "duck" is mysteriously absent from the words, which is quite strange when the other two words are supported. So you could very well be on to something there. Maybe he did unintentionally overwrite a word that was doing something else.

But given that the "duck" word wasn't in the PCJR version, or the IBM PC CGA version released a few weeks after that, and yet the bit of code that supports the "greg" word making Graham crouch was added in between those two versions, I'd like to think that someone would have noticed when adding that new bit of code that it doesn't work for the originally intended word, assuming that it was added for ducking rather than as an easter egg. Maybe these releases of the game weren't properly synced up with regards to the WORDS list and the compiled scripts. If this is the case though, then all of these booter versions had the same problem. Surely they would have rebuilt the whole game each time it was released, unless the process of compiling the scripts was quite different in these early versions.

Offline Collector

Re: GAL (KQ1) extractor and decompiler
« Reply #41 on: November 01, 2023, 08:26:03 PM »
GALextract works well with getting the game resources out of the img, butbre there any tools to dump all of the files in a booter img?
KQII Remake Pic

Offline lance.ewing

Re: GAL (KQ1) extractor and decompiler
« Reply #42 on: November 02, 2023, 04:40:40 AM »
Do you mean the reverse process? I haven't seen one yet.

Offline Collector

Re: GAL (KQ1) extractor and decompiler
« Reply #43 on: November 02, 2023, 09:34:25 AM »
No, I mean want to get other files from the image like the loader or EXE and any of the non resource files.
KQII Remake Pic

Offline lskovlun

Re: GAL (KQ1) extractor and decompiler
« Reply #44 on: November 02, 2023, 11:32:17 AM »
No, I mean want to get other files from the image like the loader or EXE and any of the non resource files.
The funny thing is that the PCjr image is very different from the others. The PC and Tandy versions have an EXE file (as you say) which is odd because EXE is a DOS file format and these versions don't run under DOS. The EXE is located at the beginning of the image (after boot sector and loader). In the PCjr image, the main program file is not an EXE file, and it is located at the end of the image. It took a few tries to get it to load in IDA (enough to investigate the thing I wanted to).


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

Page created in 0.074 seconds with 23 queries.