Skip to content

feat: decompile and inject needed scripts before creating hooks#588

Open
NanobotZ wants to merge 2 commits into
GodotModding:4.x-devfrom
NanobotZ:feat-decompile-before-hooking
Open

feat: decompile and inject needed scripts before creating hooks#588
NanobotZ wants to merge 2 commits into
GodotModding:4.x-devfrom
NanobotZ:feat-decompile-before-hooking

Conversation

@NanobotZ
Copy link
Copy Markdown

@NanobotZ NanobotZ commented Feb 1, 2026

Adds automatic script decompilation using GDRE, so that ModHookPreprocessor can properly load and analyze the scripts and generate valid hook code.

If game contains compressed/compiled scripts (checking for .gdc files), it works by:

  • decompiling needed scripts,
  • extracting their .remap files and fixing them (pointing from .gdc file back to .gd),
  • putting both into a zip,
  • loading the zip immediately as a resource pack (please let me know if there's an easier way for loading a script as a GDScript resource).

After hook processing, modified source together with the .remap file are packed into the mod-hooks.zip, making the game load the source properly.

I tested this using only one game (Coal LLC) with two scripts in a work-in-progress mod, additional testing might be required.

Fixes #586
Works towards #535

@kyfex-uwu
Copy link
Copy Markdown
Contributor

works for me, hooked into compiled files in Ultrapool

@KANAjetzt KANAjetzt requested review from KANAjetzt and Qubus0 February 1, 2026 19:57
@KANAjetzt KANAjetzt added enhancement New feature or request 4.x labels Feb 1, 2026
@KANAjetzt KANAjetzt added this to the 4.x - 7.x milestone Feb 1, 2026
Copy link
Copy Markdown
Member

@KANAjetzt KANAjetzt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Great work!

I feel like it would be nice to decouple this into self setup and loader integrated. Because we only want to use GDRE in a self setup scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x enhancement New feature or request self setup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decompile scripts when hooking a game that has compressed scripts

3 participants