Skip to content

Underanalyzer compiler integration#2056

Merged
colinator27 merged 25 commits intounderanalyzerfrom
underanalyzer-compiler
Mar 19, 2025
Merged

Underanalyzer compiler integration#2056
colinator27 merged 25 commits intounderanalyzerfrom
underanalyzer-compiler

Conversation

@colinator27
Copy link
Copy Markdown
Member

@colinator27 colinator27 commented Mar 8, 2025

Description

Integrates the new compiler from Underanalyzer into UndertaleModTool. In doing so, new code compiling and importing APIs have been added to the library, and a lot of related legacy or dead code has been removed. The new compiler should support everything the old one supported, plus proper support for additional GMLv2 (GameMaker 2.3+) language features that have been missing for years. This allows many more game scripts in recent games to be easily modded.

Update: This PR has been extended with a bunch of bugfixes resulting from initial testing, as well as major refactors of code dealing with the file format, mainly in an effort to reduce memory usage and improve performance slightly. This has been tested on a variety of games using the new local game test added in this PR, made possible by the library now being mostly thread-safe for saving/loading.

Caveats

  • High likelihood of bugs, although the common case seems to work pretty well so far.
  • Some code generation isn't exactly identical in every GameMaker version; to see statistics on this for a particular game, run CheckDecompiler.csx, which will recompile every script in a game, measuring accuracy of (de)compilation. Usually, as long as the code decompiles to the same source code after compilation, it'll work fine.
  • Certain GML language features are not yet supported in the compiler, such as accessors and array owners. Also, some other buggy/esoteric behavior is not exactly mimicked.
  • Newly-defined functions in GML code will now throw a linking error if they can't be found somewhere in the game already (and if they aren't a known built-in function to UTMT). This is easily mitigated by adding the function to the functions list before compiling.
  • Some scripts such as ImportCode.csx may function a bit differently, and they can no longer automatically create collision events on objects if they don't exist (which previously could require prompting the user). In general, all code importing scripts will now create objects automatically, without user input. (Also, the CLI can now create scripts/objects/etc., and will now prompt you for collision events, specifically.) Looking for any feedback on this change, and whether any of the old behavior needs restoring.
  • The scripting interface has had many functions removed, which is a massive compatibility break.

Notes

This should get some good testing before being merged into the main underanalyzer branch, before that branch itself eventually gets merged into the main tool.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 8, 2025

@colinator27 colinator27 merged commit 11fe7bc into underanalyzer Mar 19, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant