Open ZvikaZ opened 3 years ago
Something very interesting is going on here, since both my original decompilation of QFG1VGA script 32 from 2017 and one that I made just now actually have nothing at all in either proc32_3
or proc32_4
. This might be related to the warning in the decompilation log saying WARNING: Invalid function offset: f000
twice.
Why either of these things happen is beyond me, but it's clear at the very least there some Weird Voodoo Bullshit going on with the bytecode.
There are other files that are failing as well, if doing 'compile all'.
Here's the complete list:
Error: (rm43.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 56, col: 27
Error: (Rock.sc) Duplicate label 'code_0448' Line: 145, col: 0
Error: (Rock.sc) Duplicate label 'code_0453' Line: 152, col: 0
Error: (RTRandCycle.sc) modeless is a property. Only one parameter may be supplied. Line: 525, col: 13
Error: (chAlloc.sc) The rest modifier must be followed by a parameter name. Line: 32, col: 9
Error: (chAlloc.sc) The rest modifier must be followed by a parameter name. Line: 46, col: 9
Error: (inputBox.sc) Undeclared identifier '--UNKNOWN-PROP-NAME--' . Line: 1262, col: 32
Error: (inputBox_216.sc) Undeclared identifier '--UNKNOWN-PROP-NAME--' . Line: 330, col: 32
Error: (rm330.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 416, col: 29
Error: (rm330.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 419, col: 29
Error: (rm330.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 551, col: 29
Error: (rm330.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 554, col: 29
Error: (rm330.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 595, col: 29
Error: (rm330.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 598, col: 29
Error: (rm330.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 748, col: 29
Error: (rm330.sc) &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead. Line: 751, col: 29
Similar to the first error reported here, also in these errors I have followed Eric's decompilation, and commented the problematic code, and it just works. Except chAlloc.sc
, which I had to replace dsCOORD
with its value - 100
(similar to https://github.com/Kawa-oneechan/SCICompanion/issues/9 )
The Duplicate label
error is a symptom of Companion's function discovery algorithm. It hallucinates functions. It also misses some real functions, but hallucinations are the problem here.
There's nothing wrong with the bytecode in qfg1vga script 32. Companion has invented functions that don't exist, and since they don't exist, it fails to decompile them. Each failure produces an asm block that references the same code, so you get the same label multiple times. The compiler rejects this because it requires labels to be unique within a file. Just delete the hallucinated functions; no code calls them.
If you want to fix function discovery, in my experience, you need a different algorithm. Phil describes Companion's in the Determining code boundaries
section of: https://mtnphil.wordpress.com/2016/04/09/decompiling-sci-byte-code-part-1/
It took me several tries to come up with an error-free discovery algorithm for my tools, and I'm proud of it. When I eventually release my decompiler we can all read it (sorry I'm slow), but I have a hard time imagining anyone ever sitting down to rip out Companion's algorithm and implement mine in C++. If it were easy, I'd do it and send it over, but it's not. Just delete the dupes =)
https://github.com/sluicebox/sci-scripts/blob/main/qfg1vga-dos-2.000-patched/src/wizGame.sc
Hi. I've just decompiled QFG1VGA, and then recompiled Rock.sc (script 32) without changing anything, and it fails with:
I've checked Eric's decompilation repo, (it's called WizardGame.sc over there), and he just commented all that procedure. What's going on here?...
Thanks