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

0 Members and 1 Guest are viewing this topic.

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #900 on: January 15, 2019, 07:09:10 PM »
It's the stupidest thing but I can't make it happen? If I copy-paste GetDirectory from SCI16's SAVE.SC to a test project, compile, and then decompile it works fine. It just puts the repeat block inside a return and such little things. Perhaps it's a difference between the system code at the time preserved in SCI16.zip and at the time of SQ6... and looking at these two files, I'm inclined to believe it. I'll take a look at death messages later.

...I just did my best to rewrite LSL3's DyingScript, which is also undecompileable, and decompiled it. I hate this issue.
« Last Edit: January 15, 2019, 07:34:47 PM by Kawa »

Offline OmerMor

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #901 on: January 16, 2019, 03:27:46 AM »
If I copy-paste GetDirectory from SCI16's SAVE.SC to a test project, compile, and then decompile it works fine.

Have you tried SCI32's SAVE.SC?

Offline EricOakford

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #902 on: January 16, 2019, 10:34:31 AM »
I was going to say the same thing! SQ6 uses SCI32, so using the SCI32 SAVE.SC would have made more sense.

Also, here is the EgoDead procedure from the SCI01 template game. It doesn't decompile, so it falls back to assembly.

Decompile results:
Code: [Select]
Decompiling script 0
WARNING:  ::EgoDead: Analyzing control flow: Expected node with two successors (then/else): 1 at 0178
Falling back to disassembly for EgoDead
Generated c:\scicompanion\templategame\sci0.1\src\Main.sc
Decompiled 13 of 14 functions successfully (92%).
Overall bytecount success rate: 84%.
Fell back to assembly for the remaining functions.

For reference, here is the uncompiled code:
Code: [Select]
(procedure (EgoDead message &tmp printRet)
;This procedure handles when Ego dies. It closely matches that of QFG1EGA.
;To use it: "(EgoDead {death message})". You can add a title and icon in the same way as a normal Print message.
(HandsOff)
(Wait 100)
(= normalCursor ARROW_CURSOR)
(theGame setCursor: normalCursor TRUE)
(SFX stop:)
(music number: deathSound play:)
(repeat
(= printRet
(Print message
&rest
#width 250
#button {Restore} 1
#button {Restart} 2
#button {__Quit__} 3
)
)
(switch printRet
(1
(theGame restore:)
)
(2
(theGame restart:)
)
(3
(= quit TRUE) (break)
)
)
)
)

And here is the asm that the decompiler fell back to:
Code: [Select]
(procedure (EgoDead param1 param2 &tmp temp0)
(asm
pushi    0
call     HandsOff,  0
pushi    1
pushi    100
callk    Wait,  2
ldi      999
sal      normalCursor
pushi    #setCursor
pushi    2
lsl      normalCursor
pushi    1
lal      theGame
send     8
pushi    #stop
pushi    0
lal      SFX
send     4
pushi    #number
pushi    1
lsl      deathSound
pushi    42
pushi    0
lal      music
send     10
code_012d:
ldi      1
bnt      code_0187
pushi    12
lsp      param1
&rest    param2
pushi    70
pushi    250
pushi    81
lofss    {Restore}
pushi    1
pushi    81
lofss    {Restart}
pushi    2
pushi    81
lofss    {__Quit__}
pushi    3
calle    Print,  24
sat      temp0
lst      temp0
dup     
ldi      1
eq?     
bnt      code_0168
pushi    #restore
pushi    0
lal      theGame
send     4
jmp      code_0184
code_0168:
dup     
ldi      2
eq?     
bnt      code_0178
pushi    #restart
pushi    0
lal      theGame
send     4
jmp      code_0184
code_0178:
dup     
ldi      3
eq?     
bnt      code_0184
ldi      1
sal      quit
jmp      code_0187
code_0184:
toss   
jmp      code_012d
code_0187:
ret     
)
)

The part where the decompiler fails is at code_0178, the part that handles the Quit button. It must be the break statement that it can't handle.
« Last Edit: January 16, 2019, 10:59:54 AM by EricOakford »

Offline Kawa

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #903 on: January 16, 2019, 01:05:33 PM »
Oh crap, I meant SQ5, wow! And that break is exactly the part my attempt was missing, too. And that makes the little test routine as follows:

Code: [Select]
(procedure (TheTest)
(repeat
(switch (== 1 1)
(1 (break))
)
)
)
which decompiles to
Code: [Select]
(procedure (TheTest)
(asm
code_000a:
ldi      1
bnt      code_001a
pushi    1
dup     
ldi      1
eq?     
bnt      code_0017
jmp      code_001a
code_0017:
toss   
jmp      code_000a
code_001a:
ret     
)
)

Notably, breaking on an if works fine:
Code: [Select]
(procedure (TheTest)
(repeat
(if TRUE (break))
)
)
« Last Edit: January 16, 2019, 01:18:25 PM by Kawa »

Offline Collector

Re: SCI Companion V3 - alpha build notes/bugs/feature requests
« Reply #904 on: January 18, 2019, 04:59:07 PM »
While trying to decompile the '90 EGA Christmas card it crashes on script 996 (User). It handles all of the other scripts. If I pull the user.sc and user.sco from the VGA '90 card the compiler crashes on the same script.
KQII Remake Pic


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.112 seconds with 24 queries.