Author Topic: SCI Companion V3 - alpha build notes/bugs/feature requests  (Read 619176 times)

0 Members and 5 Guests are viewing this topic.

Offline MusicallyInspired

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #645 on: May 13, 2016, 05:41:32 PM »
Whatever SQ6 is. Too lazy to check right now. :P
Brass Lantern Prop Competition

Offline Collector

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #646 on: May 13, 2016, 09:53:02 PM »
I hope to release a "service pack" for SCI Companion 3 at some point soon in which I include fixes for some of these issues.
Would this include having the aspect ratio setting in the game.ini for a per game setting? I am planning on new versions of my two plugins that would read this info to automatically switch aspect to match. It would also be nice to be able to load another game with a different ratio than your previous game without having to change the ratio every time.
KQII Remake Pic

Offline Charles

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #647 on: May 13, 2016, 11:40:02 PM »
Quote from: Collector
Charles as in 'Unknown Hero"?
Yup, that's me. I see a lot of familiar names around these forums. I read about SCICompanion from MusicallyInspired's KQ6 post on the ScummVM forums.

Quote from: MusicallyInspired
That said, some games still have problems recompiling be it due to code errors by Sierra, assembly code blocks that the decompiler couldn't decompile, or still yet some minor problems with the decompiler itself. It's not exactly perfect.
Sierra coding errors would only be a problem if troflip's compiler is significantly different from sierra's original compiler, wouldn't it? (Which, I guess "significant" is really subjective... could just be stricter, for all I know)  And I was under the impression that (in theory) the asm code segments troflip's decompiler creates are recompilable as is... or do they need to be reconfigured by hand into Sierra Script before they can be recompiled?

Quote from: troflip
Global find and replace would be nice, but I've just been using another editor (visual studio) for that.
Yeah, I'd probably use the same... or Notepad++. Either way, not too crazy. How well does SCI Companion handle scripts being changed out from under it? Or should I just close out SCICompanion beforehand then reopen after?

Quote from: troflip
SCI Companion compiles scripts in the background to handle symbol lookups, tooltips, autocomplete, etc...
Okay, I figured it had to be doing something in the background the way it was crashing. Same thing happened when I was in KQ4, too.  I hope it's not related to the fact I was renaming local variables.... for the foreseeable future, that's going to be my strongest use-case.

I always get the later SCI versions mixed up... which came first... SCI32, or SCI 2?

Offline Collector

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #648 on: May 14, 2016, 12:36:12 AM »
Welcome to our little community. Stick around.

I always get the later SCI versions mixed up... which came first... SCI32, or SCI 2?
SCI0 -> SCI0.1 -> SCI1 -> SCI1.1 -> SCI2 -> SCI2.1 -> SCI3(2)

http://sciwiki.sierrahelp.com//index.php?title=Sierra_Release_List
KQII Remake Pic

Offline MusicallyInspired

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #649 on: May 14, 2016, 01:25:14 AM »
Glad I could finally swing someone over this way! :D Welcome, indeed!

Unfortunately, (unless it's changed) ASM is not compile-able in Companion. Troflip will have to explain further on the differences between his decompiler/compiler and Sierra's original compiler...
Brass Lantern Prop Competition

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #650 on: May 14, 2016, 06:22:47 AM »
Unfortunately, (unless it's changed) ASM is not compile-able in Companion.
But the template game has ASM blocks, doesn't it?

Offline MusicallyInspired

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #651 on: May 14, 2016, 10:35:16 AM »
I could have sworn it was said that you couldn't compile asm. In fact, I thought I remembered you trying to translate asm sections so thay it would compile. If I'm speaking false information someone please correct me!
Brass Lantern Prop Competition

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #652 on: May 14, 2016, 10:48:17 AM »
Just look at Controls.sc in the template game, DText::handleEvent. At some point they added clickable regions, which chokes out the decompiler. I just wanted them readable, which OmerMor's source leaks allow.

*is off to replace his game's DText with OmerMor's*

Okay that's it. The only ASM blocks currently in my game's code are in backup copies. Tricky bit is to adapt the Sierra code to SCI Studio/Companion constant names, and that our GetValueAt is their WordAt, stuff like that.
« Last Edit: May 14, 2016, 11:29:51 AM by Kawa »

Offline MusicallyInspired

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #653 on: May 14, 2016, 12:26:37 PM »
I've been really off my game lately. On forums everywhere. I blame this cold I've had for the past 2 weeks...
Brass Lantern Prop Competition

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #654 on: May 14, 2016, 12:50:20 PM »
And to be completely honest with you, no matter the cause, the results are hilarious.

Offline troflip

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #655 on: May 14, 2016, 02:49:29 PM »
Sierra coding errors would only be a problem if troflip's compiler is significantly different from sierra's original compiler, wouldn't it? (Which, I guess "significant" is really subjective... could just be stricter, for all I know) 

Yes, it's more strict. Some of the "coding errors" you might find are: duplicate objects (e.g. two objects called "bigRock" in the same script), or duplicate case statements. For the latter, I've made a change to the SCI Companion compiler that will just produce a warning instead of an error. I didn't do this for the former, since I haven't researched which of the duplicate objects the interpreter ends up using...

Either way, not too crazy. How well does SCI Companion handle scripts being changed out from under it? Or should I just close out SCICompanion beforehand then reopen after?

Companion's text editor doesn't track files being changed from under it, but you'll be safe if you just close the script and re-open it. The "browse data" compiled in the background for things like "go to definition" or autocompletion will get out of date until you edit the script again in Companion, but that shouldn't be a big deal.

Okay, I figured it had to be doing something in the background the way it was crashing. Same thing happened when I was in KQ4, too.  I hope it's not related to the fact I was renaming local variables.... for the foreseeable future, that's going to be my strongest use-case.

Can you describe exactly what you were doing when this happened? Like, how did you open the script file, had you just saved it, or what?

Would this include having the aspect ratio setting in the game.ini for a per game setting?

Yes.

And yes, asm blocks are compilable. But the format of the asm blocks is different between SCI Companion and SCI Studio.

And if you ever realize there is a problem with a section of code that Companion decompiled (i.e. you know it did a bad job), you can always check the "disassemble only" box in the decompile window, and re-"decompile" that script to generate just pure asm - which should generate the same as the original Sierra code when compiled.
« Last Edit: May 14, 2016, 02:53:36 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Collector

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #656 on: May 14, 2016, 09:15:45 PM »
Perhaps an aspect ratio selection on the New Game dialog would be a good idea to add, too.
KQII Remake Pic

Offline Charles

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #657 on: May 14, 2016, 11:10:25 PM »
I'll try and take better repro notes the next time it happens, but from memory it felt pretty random. Open a previously decompiled KQ4 or LB1, open a script (701 for KQ1, 414 for LB1) by double-clicking on it in the built-in explorer, change a couple procedure names or local variables with the built-in replace command, add some comments at non-specific intervals or locations, grab a coffee (two sugars), return to find it crashed.
It definitely wasn't after saving... I lost my work a couple times, so I started saving pretty religiously.

Offline Charles

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #658 on: May 17, 2016, 09:16:47 PM »
Okay, so I'm now able to consistently reproduce the crashing I'm seeing.

I've seen is in both Laura Bow 1 (v1.000.046) and KQ4 SCI (v1.006.004). I think it's related to tooltips in some way.
In either game, I opened it up fresh, then decompiled the scripts 3 or 4 times. Then open script 000's source.

In KQ4 scroll down to procedure proc0_7 and hover the mouse over "setLoop:" for 2-3 seconds (below in gEgo , i.e. line 517).
In LB1 scroll down to procedure proc0_25 and hover the mouse over "said:" for 2-3 seconds (line 727).

Then SCICompanion will crash with an unhandled exception. (Unhandled exception at 0x00e0eb1e in SCICompanion.exe: 0xC0000005: Access violation reading location 0x000000f0.)

I also was able to make some progress on script 414 not compiling in LB1. It turns out it wasn't actually a problem with script 414, but one of the procedures in a referenced script (999).  So I made some changes to script 999 allowing it to compile, and then 414 compiled without complaint. 
However, I was surprised that I wasn't able to then take just 414 into a vanilla copy of LB1.  It would crash in both SCI and SCUMMVM.  I had to recompile all the other scripts (after correcting some minor compiler errors in a handful of other scripts) and I was able to get that running. 

So this brought up a couple of questions for me:
If I just change procedure names and variable names without changing the content/order of them, is the compiled output compatible with the existing compiled scripts?

Can I change the contents of procedures and methods etc and expect existing scripts that call those procedures/method to continue calling them, or will they fail outright?

Offline troflip

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #659 on: May 18, 2016, 01:48:25 PM »
Ok, it looks like the LB1 issue (and presumably KQ4) only happens right after a decompile, right? When I re-open the game again, I can't repro it.
I had already made a fix to Companion (unreleased) to avoid the crash, but I never found the root cause. I'll try to look more deeply now.

As for the compile issue with 414, the actual problem is that the global class table (vocab 996) in that game is out of sync with the script files. It's a list of script numbers, and the position of script numbers in that file correspond to the index of a class in that script. For instance, species 5 is supposed to be the 5th class defined in script 999. The 5th class (0-based) in script 999 is Script. But, Script defines itself as species 6 in the script 999 resource. So the script resources are out-of-sync with the class table resource (vocab 996).

I forget the exact way Sierra compiled, but I think the class table was a text file in their compilation system, and the compiler looked at that. Then it would be occasionally compiled in to vocab 996 itself. I'm guessing the game doesn't do anything with vocab 996.

So, to workaround it or fix it, there are a few options:

- Tools -> Rebuild class table. The problem is, this means you have to recompile all afterwards - which is a problem if the scripts don't compile for other reasons. And it it more likely to expose any bugs in the decompiler that may have produced compilable but incorrect code, and your game will behave weirdly or crash for a hard-to-diagnose reason.

- Manually try to fix things up by inserting dummy classes in the right spots. For instance, inserting a class between Code and Collect in script 999 should fix up that particular issue with Script (999 would need to be recompiled). However, script 999 has ten entries in the class table, but only 7 scripts defined in the actual code. And I assume other scripts have similar issues, since the class table is generally out of date. So you'd need to do this for all scripts that define classes*.

- Wait for me to make a fix to the decompiler that will do this automatically :-)

- I could change the way Companion compiles to avoid this mess (e.g. by generating a classtable.txt that would be used, instead of the vocab 996), but I was trying to maintain parity with SCI Studio's compilation system. Plus that's a lot of risky work.

Quote
If I just change procedure names and variable names without changing the content/order of them, is the compiled output compatible with the existing compiled scripts?

Should be.

Quote
Can I change the contents of procedures and methods etc and expect existing scripts that call those procedures/method to continue calling them, or will they fail outright?

The contents? Sure, that will be fine. Callers are ignorant of the contents of the methods/procedures. Of course, if you change their behavior in a way that affects state the callers use....



*To do this audit, you can get the species index from the class table, and compare it to the one defined by the object in the script resource (Script->View Script Resource). The species of a class is property 0, the first entry right under the "properties:" header for each class. If you do this for script 999, you'll see the classes have species 0, 1, 3, 4, 5, 6, 7. Hmm, so actually just a single dummy class between Code and Collect should fix that particular issue up. Oh actually wait, no, you'll need to add 2 more dummy classes at the end, since we're trying to preserve the integrity of the class table. ugh, complicated.
« Last Edit: May 18, 2016, 01:49:57 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition


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

Page created in 0.044 seconds with 16 queries.