UndertaleModTool
UndertaleModTool copied to clipboard
Issues decompiling Antonblast scripts
Describe the bug
Some Antonblast scripts fail to decompile properly. An earlier build of UndertaleModTool (v94ea048) decompiled them just fine, but some builds later, either one of four error codes appear.
/* DECOMPILER FAILED! System.InvalidOperationException: Stack empty. at System.Collections.Generic.Stack`1.ThrowForEmptyStack() at System.Collections.Generic.Stack`1.Pop() at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block, List`1 tempvars, Stack`1 workQueue) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2120 at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2618 at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3769 at Submission#0.DumpCode(UndertaleCode code) in C:\X\UndertaleModTool\UTMT-Workflow\Scripts\Resource Unpackers\ExportAllCode.csx:line 89 */ /* DECOMPILER FAILED! System.NullReferenceException: Object reference not set to an instance of an object. at UndertaleModLib.Decompiler.Decompiler.FunctionDefinition.ToString(DecompileContext context) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 1386 at UndertaleModLib.Decompiler.Decompiler.AssignmentStatement.ToString(DecompileContext context) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 1181 at UndertaleModLib.Decompiler.Decompiler.BlockHLStatement.ToString(DecompileContext context, Boolean canSkipBrackets, Boolean forceSkipBrackets) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2771 at UndertaleModLib.Decompiler.Decompiler.WithHLStatement.ToString(DecompileContext context) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3164 at UndertaleModLib.Decompiler.Decompiler.BlockHLStatement.ToString(DecompileContext context, Boolean canSkipBrackets, Boolean forceSkipBrackets) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2786 at UndertaleModLib.Decompiler.Decompiler.IfHLStatement.ToString(DecompileContext context) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2972 at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3789 at Submission#0.DumpCode(UndertaleCode code) in C:\X\UndertaleModTool\UTMT-Workflow\Scripts\Resource Unpackers\ExportAllCode.csx:line 89 */ /* DECOMPILER FAILED! System.NullReferenceException: Object reference not set to an instance of an object. at UndertaleModLib.Decompiler.Decompiler.FunctionDefinition.ToString(DecompileContext context) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 1386 at UndertaleModLib.Decompiler.Decompiler.AssignmentStatement.ToString(DecompileContext context) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 1181 at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3789 at Submission#0.DumpCode(UndertaleCode code) in C:\X\UndertaleModTool\UTMT-Workflow\Scripts\Resource Unpackers\ExportAllCode.csx:line 89 */ /* DECOMPILER FAILED! System.Exception: Reentered block with different amount of vars on stack (Entry: 1, Actual Count: 0) at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block, List`1 tempvars, Stack`1 workQueue) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 1943 at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2618 at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3769 at Submission#0.DumpCode(UndertaleCode code) in C:\X\UndertaleModTool\UTMT-Workflow\Scripts\Resource Unpackers\ExportAllCode.csx:line 89 */
Reproducing steps
- Open UndertaleModTool, and go to Resource Unpackers > ExportAllCode.csx.
- Wait for the process to complete.
- Various scripts fail to decompile with one of four error codes above.
Setup Details
- UndertaleModTool version used: v6501d9a
- OS used: Windows 10 (64-bit)
- Game Maker game used: https://summitsphere.itch.io/antonblast-kickstarter-demo
Is an older version of the demo available? The current Steam download uses YYC, which produces no code UTMT can work with at all.
Mirrored them here if you want to check it out: https://archive.org/download/antonblastdemo/Kickstarter%20Demo/
Hmm. I downloaded v1.1.6 from your link, and went and compiled the tool from around the time it supposedly worked (June 2022), but all the same scripts still fail to decompile-- 9 with stack empty, 1 with reentered block with different number of variables. Is it specific to a different version, or were there additional decompiler errors that have since been resolved?
I'm not saying I intend to close this issue, but resolving the last ten is going to be trickier without decompilation from any version.
Seems like one of the stack empty problems is the use of static variables, which invoke the isstaticok.e
instruction that UTMT currently ignores, meaning the stack is missing the variable to indicate whether static is, in fact, ok. Three of the scripts still don't decompile, and recompiling the other seven with proper static implementation hasn't been implemented in the compiler.